ESP32-nesemu, GPIO gamepad ?
Posted: Thu Nov 16, 2017 12:26 pm
Hi!
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 :
If someone could give me some direction that would be fantastic, because honestly I have time understand how this works with the nofendo nes core functions.
Cheers,
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,