Code: Select all
PadState pads[8];
HidAnalogStickState l, r;
volatile rt_config rt_conf = {0};
t_conf.multicap = config_multicap_enabled(config);
for (int i = 0; i < 8; i++) {
padInitialize(&pads[i], i);
rt_conf.pads_enabled[i] = config_player_enabled(config, i);
}
Thread t;
threadCreate(&t, service_scope_func, (void *)&rt_conf, NULL, 0x1000, 0x20, -2);
threadStart(&t);
server_setup();
char client_msg[10];
int client_len;
char payload[810] = {'[', 0};
int payload_len = 1;
u64 down;
u32 to_send;
while (true) {
/* ... */
for (int i = 0; i < 8; i++) {
// comments illustrate attempts, none of which worked
// padConfigureInput(8, HidNpadStyleSet_NpadStandard);
// hidSetSupportedNpadStyleSet(HidNpadStyleTag_NpadGc);
padUpdate(&pads[i]);
down = padGetButtons(&pads[i]);
l = padGetStickPos(&pads[i], 0);
r = padGetStickPos(&pads[i], 1);
HidNpadGcState state;
hidGetNpadStatesGc(i, &state, 1);
// hidGetNpadStatesGc(i, &state, 1);
// hidGetNpadStatesGc(__builtin_ffs(pads[i].id_mask) - 1, &state, 1);
// u32 gcl = state.trigger_l;
// padConfigureInput(8, HidNpadStyleTag_NpadGc);
// padUpdate(&pads[i]);
u32 gcr = pads[i].gc_triggers[0];//__builtin_ffs(pads[i].id_mask) - 1;//padGetGcTriggerPos(&pads[i], 0);
u32 gcl = HidNpadIdType_No1 + __builtin_ffs(pads[i].id_mask)-1;//padGetGcTriggerPos(&pads[i], 1);
// (prepare and send payload)
}
}