all repos — mgba @ 8af5a4854993ff9c16ea120c0819db4fc3b97a57

mGBA Game Boy Advance Emulator

Wii: Analog support
Jeffrey Pfau jeffrey@endrift.com
Sun, 16 Aug 2015 01:37:15 -0700
commit

8af5a4854993ff9c16ea120c0819db4fc3b97a57

parent

509f34f34d45de71ba2662653a2e5a9a357f71f7

1 files changed, 14 insertions(+), 0 deletions(-)

jump to
M src/platform/wii/main.csrc/platform/wii/main.c

@@ -231,6 +231,20 @@ }

if (padkeys & PAD_BUTTON_DOWN) { keys |= 1 << GBA_KEY_DOWN; } + int x = PAD_StickX(0); + int y = PAD_StickY(0); + if (x < -0x40) { + keys |= 1 << GBA_KEY_LEFT; + } + if (x > 0x40) { + keys |= 1 << GBA_KEY_RIGHT; + } + if (y < -0x40) { + keys |= 1 << GBA_KEY_DOWN; + } + if (y > 0x40) { + keys |= 1 << GBA_KEY_UP; + } if (padkeys & PAD_TRIGGER_Z) { break; }