Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions in_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,19 @@ static int in_sdl_update(void *drv_data, const int *binds, int *result)
mask = state->keystate[i];
if (mask == 0)
continue;

// For GPI case scan code, Start = 0xA7, Select = 0xA6
// mask is 4 byte long -> 4 * 8 -> 32 bit
// scan code 0xA0 - 0xA7 -> 32 * 5 (0xA0)
// Its mask should be 1100 0000b, and index is 5
if (mask == 0xC0 && i == 5)
{
// Enter menu
result[0] |= 0x2; // 1 << SACTION_ENTER_MENU
result[1] |= 0x0;
return 0;
}

Copy link
Copy Markdown
Owner

@notaz notaz Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to put it before the loop, when the buttons are pressed, you don't want to do anything else and just enter the menu, right?
Also add #ifdef to not break other things.

Something like

collect_events(state, NULL, NULL);

#ifdef <something from your platform>
if (state->keystate[5] == 0xC0) {
  result[0] = 2;
  return 0;
}
#endif

for (...

for (bit = 0; mask != 0; bit++, mask >>= 1) {
if ((mask & 1) == 0)
continue;
Expand Down