aboutsummaryrefslogtreecommitdiff
path: root/backends/events/sdl
diff options
context:
space:
mode:
authorHubert Maier2019-04-11 00:28:18 +0200
committerFilippos Karapetis2019-04-11 01:28:18 +0300
commitce8227323b3fa658cdfb2f1e3de9b2fbca783c5a (patch)
tree373ab2ae43ca02ce944888db9256b43b0fc0d705 /backends/events/sdl
parent08d3c7f636f7957412d4f50e39e77442f5c437b6 (diff)
downloadscummvm-rg350-ce8227323b3fa658cdfb2f1e3de9b2fbca783c5a.tar.gz
scummvm-rg350-ce8227323b3fa658cdfb2f1e3de9b2fbca783c5a.tar.bz2
scummvm-rg350-ce8227323b3fa658cdfb2f1e3de9b2fbca783c5a.zip
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.
Diffstat (limited to 'backends/events/sdl')
-rw-r--r--backends/events/sdl/sdl-events.cpp10
1 files changed, 8 insertions, 2 deletions
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;