I'm trying to use the nesemu with a GPIO gamepad I built. Does any of you got this working ?
I've been trying to mess around the current psxcontroller lib but without any success so far and I can't get my hands on one to at least try reverse engineer the current function :
Code: Select all
void osd_getinput(void)
{
const int ev[16]={
event_joypad1_select,0,0,event_joypad1_start,event_joypad1_up,event_joypad1_right,event_joypad1_down,event_joypad1_left,
0,0,0,0,event_soft_reset,event_joypad1_a,event_joypad1_b,event_hard_reset
};
static int oldb=0xffff;
int b=psxReadInput();
int chg=b^oldb;
int x;
oldb=b;
event_t evh;
// printf("Input: %x\n", b);
for (x=0; x<16; x++) {
if (chg&1) {
evh=event_get(ev[x]);
if (evh) evh((b&1)?INP_STATE_BREAK:INP_STATE_MAKE);
}
chg>>=1;
b>>=1;
}
}
Cheers,