From ce8227323b3fa658cdfb2f1e3de9b2fbca783c5a Mon Sep 17 00:00:00 2001 From: Hubert Maier Date: Thu, 11 Apr 2019 00:28:18 +0200 Subject: AmigaOS4: Exclude platform from a SDL1/2 keyboard fix that breaks numpad usage (#1551) SDL1/2: Exclude AmigaOS4 from returning 0 for .ascii *reset .ascii to 0, when Num-Lock is NOT enabled and keypad directional keys are pressed* (original description) is causing the numpad to play dead completely on AmigaOS4 (no matter if numlock is active or not). This is a workaround for the SCUMM engine, where keycodes are mixed with ASCII codes. Check commit f5ed14e93d85b638c8e49468b2885c1278d56d20 for reference. Fixes bug #10558. Tested with both SDL1 and 2 on AmigaOS4 and with both Indiana Jones games.--- backends/events/sdl/sdl-events.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'backends/events/sdl') diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index 6c4774554c..ff5f4b9ce3 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -170,8 +170,14 @@ int SdlEventSource::mapKey(SDLKey sdlKey, SDLMod mod, Uint16 unicode) { if (key >= Common::KEYCODE_F1 && key <= Common::KEYCODE_F9) { return key - Common::KEYCODE_F1 + Common::ASCII_F1; } else if (key >= Common::KEYCODE_KP0 && key <= Common::KEYCODE_KP9) { - if ((mod & KMOD_NUM) == 0) - return 0; // In case Num-Lock is NOT enabled, return 0 for ascii, so that directional keys on numpad work + // WORKAROUND: Disable this change for AmigaOS4 as it is breaking numpad usage ("fighting") on that platform. + // This fixes bug #10558. + // The actual issue here is that the SCUMM engine uses ASCII codes instead of keycodes for input. + // See also the relevant FIXME in SCUMM's input.cpp. + #ifndef __amigaos4__ + if ((mod & KMOD_NUM) == 0) + return 0; // In case Num-Lock is NOT enabled, return 0 for ascii, so that directional keys on numpad work + #endif return key - Common::KEYCODE_KP0 + '0'; } else if (key >= Common::KEYCODE_UP && key <= Common::KEYCODE_PAGEDOWN) { return key; -- cgit v1.2.3