]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
keyhack swap
authorToni Wilen <twilen@winuae.net>
Sun, 23 Apr 2023 16:51:33 +0000 (19:51 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 23 Apr 2023 16:51:33 +0000 (19:51 +0300)
include/inputdevice.h
include/keybuf.h
keybuf.cpp
od-win32/dinput.cpp
od-win32/win32.cpp

index 2771788072c3f2441e0c0043098a53b55c5c4ce8..338bc9c0ef57d492fda1bf92da7a44ade78fb098 100644 (file)
@@ -372,4 +372,6 @@ extern int inputdevice_testread_count (void);
 
 extern bool target_can_autoswitchdevice(void);
 
+extern int key_swap_hack, key_swap_hack2;
+
 #endif /* UAE_INPUTDEVICE_H */
index b9b70f123f05f232a7db341b54ba4dd714d381a6..ae247af2f11b0079a70c3f9de8261b15a41751dd 100644 (file)
@@ -20,5 +20,4 @@ extern void setcapslockstate (int);
 extern void keybuf_inject(const uae_char*);
 extern void keybuf_ignore_next_release(void);
 extern void keybuf_vsync(void);
-extern int key_swap_hack;
 #endif /* UAE_KEYBUF_H */
index fd7d497258cc89b590a0d48556d1806ca3502e08..e1dc10feae8ea81f37e1b2924f3f0c1735ebd6fc 100644 (file)
@@ -23,7 +23,7 @@
 #include "custom.h"
 #include "savestate.h"
 
-int key_swap_hack = false;
+int key_swap_hack2 = false;
 
 static int kpb_first, kpb_last;
 
@@ -280,7 +280,7 @@ int record_key_direct (int kc)
        int kpb_next = kpb_first + 1;
        int kcd = (kc << 7) | (kc >> 1);
 
-       if (key_swap_hack) {
+       if (key_swap_hack2) {
                // $0D <> $0C
                if ((kcd & 0x7f) == 0x0c) {
                        kcd = 0x0d | (kcd & 0x80);
index 2d39a490547438f6977c1d8e076600b1d0459c82..d6cdad7b335119a009fd9b4e3f1709ed8f42364f 100644 (file)
@@ -18,6 +18,7 @@ int no_rawinput = 0;
 int no_directinput = 0;
 int no_windowsmouse = 0;
 int winekeyboard = 0;
+int key_swap_hack = 0;
 
 #define _WIN32_WINNT 0x501 /* enable RAWINPUT support */
 
@@ -2468,6 +2469,14 @@ static void handle_rawinput_2 (RAWINPUT *raw, LPARAM lParam)
                if (rp_isactive ())
                        return;
 #endif
+               if (key_swap_hack) {
+                       if (scancode == DIK_F11) {
+                               scancode = DIK_EQUALS;
+                       } else if (scancode == DIK_EQUALS) {
+                               scancode = DIK_F11;
+                       }
+               }
+
                // eat E1 extended keys
                if (rk->Flags & (RI_KEY_E1))
                        return;
index d573c92da2b0525b3e36fa8e8d5b618b24dd0123..14015ad03487ea77603e53b7ff73904fc897b93b 100644 (file)
@@ -6728,6 +6728,14 @@ static int parseargs(const TCHAR *argx, const TCHAR *np, const TCHAR *np2)
                rp_modem = 1;
                return 1;
        }
+       if (!_tcscmp(arg, _T("key_swap_hack"))) {
+               key_swap_hack = 1;
+               return 1;
+       }
+       if (!_tcscmp(arg, _T("key_swap_hack2"))) {
+               key_swap_hack2 = 1;
+               return 1;
+       }
 
        if (!np)
                return 0;