Sdl12-compat: EventFilter20to12: set keysym.scancode to 0 for SDL_KEYUP/SDL_KEYDOWN:

From 53bd8b5f9f39b16fa235d36136ce31c7bfb6e16e Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 20 Feb 2021 23:33:10 +0300
Subject: [PATCH] EventFilter20to12: set keysym.scancode to 0 for
 SDL_KEYUP/SDL_KEYDOWN:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Turns out that some apps actually made use of the hardware scancodes
(checking for platform beforehand):  dosbox (to give an example), is
somewhat activly using scancodes (dosbox/src/gui_sdl_mapper.cpp:421;
function called GetKeyCode). The bounds-checking is also only an assert,
so this is a guaranteed crash.

Patch from Malte Kießling:
https://github.com/libsdl-org/sdl12-compat/issues/20
https://github.com/libsdl-org/sdl12-compat/issues/22
---
 src/SDL12_compat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 741a2a4..f9bacab 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -2068,7 +2068,9 @@ EventFilter20to12(void *data, SDL_Event *event20)
             event12.type = (event20->type == SDL_KEYDOWN) ? SDL12_KEYDOWN : SDL12_KEYUP;
             event12.key.which = 0;
             event12.key.state = event20->key.state;
-            event12.key.keysym.scancode = (event20->key.keysym.scancode < 256) ? (Uint8) event20->key.keysym.scancode : 0;
+            FIXME("SDL1.2 and SDL2.0 scancodes are incompatible");
+            // turns out that some apps actually made use of the hardware scancodes (checking for platform beforehand)
+            event12.key.keysym.scancode = 0;
             event12.key.keysym.mod = event20->key.keysym.mod;  /* these match up between 1.2 and 2.0! */
             event12.key.keysym.unicode = 0;  FIXME("unicode");
             break;