issue with input from the second controller
Posted: Fri Jun 20, 2008 12:26 pm
I'd like to add a 2 players feature in my project, but can't succesfully receive data from the second controler.
I init my pads with this:
and 4 "ok" are printed, fine!
but how can I receive data from the second one?
i tried
but then
just never works...
I init my pads with this:
Code: Select all
int port = 0; // 0 -> Connector 1, 1 -> Connector 2
int slot = 0; // Always zero if not using multitap
if((ret = padPortOpen(port, slot, padBuf)) == 0) {
scr_printf("padOpenPort failed: %d\n", ret);
SleepThread();
}
else{scr_printf("ok-");}
if(!initializePad(port, slot)) {
scr_printf("pad initalization failed!\n");
SleepThread();
}
else{scr_printf("ok-");}
port = 1; // 0 -> Connector 1, 1 -> Connector 2
slot = 0; // Always zero if not using multitap
if((ret = padPortOpen(port, slot, padBuf)) == 0) {
scr_printf("padOpenPort failed: %d\n", ret);
SleepThread();
}
else{scr_printf("ok-");}
if(!initializePad(port, slot)) {
scr_printf("pad initalization failed!\n");
SleepThread();
}
else{scr_printf("ok-");}
but how can I receive data from the second one?
i tried
Code: Select all
struct padButtonStatus buttons[2];
int port =1;
int slot=0;
int ret
ret = padRead(port, slot, &buttons[port]); // port, slot, buttons
if (ret != 0) {
paddata[port] = 0xffff ^ buttons[port].btns;
new_pad[port] = paddata[port] & ~old_pad[port];
old_pad[port] = paddata[port];
i=new_pad[port];
}
paddata[port] = 0xffff ^ buttons[port].btns;
i=paddata[port];
Code: Select all
if (i&PAD_TRIANGLE) { ... }