[PATCH 8/8] Use hex instead of decimals for keymap scancodes

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Both in keymap config file and trace output used for debugging.

Based on Vincent Barilliot's patch.

This change is unlikely to be merged, but is provided for for easier
testing of keymaps written for Vincent's patch (with this, one should
need to remove only mod masks from them).
---
 src/keymap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/keymap.c b/src/keymap.c
index a6bd2814..2bbf13ac 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -593,7 +593,7 @@ static bool HostSpecToKeymap(const char *spec, KeyMapping* mapping)
 			Log_Printf(LOG_WARN, "extra '%s', PC/SDL scancode already set\n", token);
 			return false;
 		}
-		scancode = strtol(token, &endptr, 10);
+		scancode = strtol(token, &endptr, 16);
 		if (!scancode)
 		{
 			Log_Printf(LOG_ERROR, "invalid PC/SDL scancode '%s'\n", token);
@@ -674,7 +674,7 @@ static bool GuestSpecToKeymap(const char *spec, KeyMapping* mapping)
 			Log_Printf(LOG_WARN, "extra '%s', ST scancode already set\n", token);
 			return false;
 		}
-		scancode = strtol(token, &endptr, 10);
+		scancode = strtol(token, &endptr, 16);
 		if (!scancode)
 		{
 			Log_Printf(LOG_ERROR, "invalid ST scancode '%s'\n", token);
@@ -978,7 +978,7 @@ void Keymap_KeyDown(const SDL_Keysym *sdlkey)
 	int symkey = sdlkey->sym;
 	int modkey = sdlkey->mod;
 
-	LOG_TRACE(TRACE_KEYMAP, "key down: sym=%i scan=%i mod=0x%x name='%s'\n",
+	LOG_TRACE(TRACE_KEYMAP, "key down: sym=%i scan=0x%02x mod=0x%x name='%s'\n",
 	          symkey, sdlkey->scancode, modkey, Keymap_GetKeyName(symkey));
 
 	if (ShortCut_CheckKeys(modkey, symkey, true))
@@ -1027,7 +1027,7 @@ void Keymap_KeyUp(const SDL_Keysym *sdlkey)
 	int symkey = sdlkey->sym;
 	int modkey = sdlkey->mod;
 
-	LOG_TRACE(TRACE_KEYMAP, "key up: sym=%i scan=%i mod=0x%x name='%s'\n",
+	LOG_TRACE(TRACE_KEYMAP, "key up: sym=%i scan=0x%02x mod=0x%x name='%s'\n",
 	          symkey, sdlkey->scancode, modkey, Keymap_GetKeyName(symkey));
 
 	/* Ignore short-cut keys here */
-- 
2.30.2


--------------76C8DE25C7D90F3D7A75426A
Content-Type: text/x-patch; charset=UTF-8;
 name="0007-Support-for-specifying-PC-SDL-key-modifiers-in-the-m.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0007-Support-for-specifying-PC-SDL-key-modifiers-in-the-m.pa";
 filename*1="tch"



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/