Skip to content

Commit

Permalink
Mutually exclude left / right D-pad - this should fix crashing
Browse files Browse the repository at this point in the history
issues in Metal Slug Advance
  • Loading branch information
inactive123 committed Nov 9, 2013
1 parent 9f5bc10 commit 9a259d4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,21 @@ void retro_run(void)
u32 J = 0;

for (unsigned i = 0; i < 10; i++)
J |= input_cb(0, RETRO_DEVICE_JOYPAD, 0, device_type ? binds2[i] : binds[i]) << i;
{
unsigned button = device_type ? binds2[i] : binds[i];

if (button == RETRO_DEVICE_ID_JOYPAD_LEFT)
{
if (J & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT) == RETRO_DEVICE_ID_JOYPAD_RIGHT)
continue;
}
else if (button == RETRO_DEVICE_ID_JOYPAD_RIGHT)
{
if (J & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT) == RETRO_DEVICE_ID_JOYPAD_LEFT)
continue;
}
J |= input_cb(0, RETRO_DEVICE_JOYPAD, 0, button) << i;
}

joy = J;

Expand Down

0 comments on commit 9a259d4

Please sign in to comment.