From: Toni Wilen Date: Sat, 9 Dec 2023 19:29:36 +0000 (+0200) Subject: OSK and MM keyboard modes should bypass Backslash/F11 option. X-Git-Tag: 5.1.0~21 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=af2e5681827b323d22bdea0ca350d9690cc4314d;p=francis%2Fwinuae.git OSK and MM keyboard modes should bypass Backslash/F11 option. --- diff --git a/consolehook.cpp b/consolehook.cpp index ac63fb68..023fbe9e 100644 --- a/consolehook.cpp +++ b/consolehook.cpp @@ -69,8 +69,8 @@ static void console_thread (void *v) c[0] = 0; c[1] = 0; ua_copy (c, 1, &wc); - record_key_direct ((0x10 << 1) | 0); - record_key_direct ((0x10 << 1) | 1); + record_key_direct((0x10 << 1) | 0, false); + record_key_direct((0x10 << 1) | 1, false); } } diff --git a/include/keybuf.h b/include/keybuf.h index ae247af2..4266ba5a 100644 --- a/include/keybuf.h +++ b/include/keybuf.h @@ -10,13 +10,13 @@ #ifndef UAE_KEYBUF_H #define UAE_KEYBUF_H -extern int get_next_key (void); -extern int keys_available (void); -extern int record_key (int); -extern int record_key_direct (int); -extern void keybuf_init (void); -extern int getcapslockstate (void); -extern void setcapslockstate (int); +extern int get_next_key(void); +extern int keys_available(void); +extern int record_key(int, bool); +extern int record_key_direct(int, bool); +extern void keybuf_init(void); +extern int getcapslockstate(void); +extern void setcapslockstate(int); extern void keybuf_inject(const uae_char*); extern void keybuf_ignore_next_release(void); extern void keybuf_vsync(void); diff --git a/inputdevice.cpp b/inputdevice.cpp index 43c75d79..ec30ab1a 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -3467,9 +3467,9 @@ static void mouseupdate (int pct, bool vsync) /* if v != 0, record mouse wheel key presses * according to the NewMouse standard */ if (v3 > 0) - record_key (0x7a << 1); + record_key(0x7a << 1, true); else if (v3 < 0) - record_key (0x7b << 1); + record_key(0x7b << 1, true); if (!mouse_deltanoreset[i][2]) mouse_delta[i][2] = 0; @@ -4100,7 +4100,7 @@ static void inject_events (const TCHAR *str) } if (kc != 0xff) { //write_log (_T("%s\n"), cf); - record_key (kc); + record_key(kc, false); } } } @@ -4109,8 +4109,8 @@ static void inject_events (const TCHAR *str) if ((ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')) { for (int i = 1; events[i].name; i++) { if (events[i].allow_mask == AM_K && events[i].name[1] == 0 && events[i].name[0] == ch) { - record_key (events[i].data << 1); - record_key ((events[i].data << 1) | 0x01); + record_key(events[i].data << 1, false); + record_key((events[i].data << 1) | 0x01, false); //write_log (_T("%c\n"), ch); } } @@ -4121,7 +4121,7 @@ static void inject_events (const TCHAR *str) while (--keycnt >= 0) { uae_u8 kc = keys[keycnt]; if (kc != 0xff) - record_key (kc | 0x01); + record_key(kc | 0x01, false); } } @@ -4608,7 +4608,7 @@ void inputdevice_do_keyboard(int code, int state) } } if (!keyboard_reset_seq_mode) { - if (record_key((uae_u8)((key << 1) | (key >> 7)))) { + if (record_key((uae_u8)((key << 1) | (key >> 7)), false)) { if (inputdevice_logging & 1) write_log(_T("Amiga key %02X %d\n"), key & 0x7f, key >> 7); } @@ -8462,7 +8462,7 @@ static void sendmmcodes (int code, int newstate) uae_u8 b; b = RAW_STEALTH | IECODE_UP_PREFIX; - record_key (((b << 1) | (b >> 7)) & 0xff); + record_key(((b << 1) | (b >> 7)) & 0xff, true); b = IECODE_UP_PREFIX; if ((code >> 8) == 0x01) b |= STEALTHF_E0KEY; @@ -8470,11 +8470,11 @@ static void sendmmcodes (int code, int newstate) b |= STEALTHF_E1KEY; if (!newstate) b |= STEALTHF_UPSTROKE; - record_key(((b << 1) | (b >> 7)) & 0xff); + record_key(((b << 1) | (b >> 7)) & 0xff, true); b = ((code >> 4) & 0x0f) | IECODE_UP_PREFIX; - record_key(((b << 1) | (b >> 7)) & 0xff); + record_key(((b << 1) | (b >> 7)) & 0xff, true); b = (code & 0x0f) | IECODE_UP_PREFIX; - record_key(((b << 1) | (b >> 7)) & 0xff); + record_key(((b << 1) | (b >> 7)) & 0xff, true); } // main keyboard press/release entry point diff --git a/keybuf.cpp b/keybuf.cpp index 8ae63184..9f6725bc 100644 --- a/keybuf.cpp +++ b/keybuf.cpp @@ -177,17 +177,17 @@ static void keytoscancode(int key, bool release) v = (v << 1) | (v >> 7); q |= mask; if (release) { - record_key(v); + record_key(v, false); if (q & 0x7f) { q = (q << 1) | (q >> 7); - record_key(q); + record_key(q, false); } } else { if (q & 0x7f) { q = (q << 1) | (q >> 7); - record_key(q); + record_key(q, false); } - record_key(v); + record_key(v, false); } } @@ -263,16 +263,16 @@ void keybuf_vsync(void) if (delayed_released_time > 0) { delayed_released_time--; if (delayed_released_time == 0) { - record_key(delayed_released_code); + record_key(delayed_released_code, false); } } } -int record_key (int kc) +int record_key(int kc, bool direct) { if (pause_emulation) return 0; - return record_key_direct (kc); + return record_key_direct(kc, direct); } static void keyswap(int *kcdp, int *kcp, uae_u8 k1, uae_u8 k2) @@ -290,24 +290,26 @@ static void keyswap(int *kcdp, int *kcp, uae_u8 k1, uae_u8 k2) *kcp = kc; } -int record_key_direct (int kc) +int record_key_direct(int kc, bool direct) { int kpb_next = kpb_first + 1; int kcd = (kc << 7) | (kc >> 1); - if (key_swap_hack2) { - // $0D <> $0C - keyswap(&kcd, &kc, 0x0d, 0x0c); - } - if (key_swap_hack == 2) { - // $2B <> $0D - keyswap(&kcd, &kc, 0x2b, 0x0d); - } + if (!direct) { + if (key_swap_hack2) { + // $0D <> $0C + keyswap(&kcd, &kc, 0x0d, 0x0c); + } + if (key_swap_hack == 2) { + // $2B <> $0D + keyswap(&kcd, &kc, 0x2b, 0x0d); + } - if (ignore_next_release) { - ignore_next_release = false; - if (kcd & 0x80) { - return 0; + if (ignore_next_release) { + ignore_next_release = false; + if (kcd & 0x80) { + return 0; + } } } diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index ea879d19..22f0e4b5 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -4836,9 +4836,9 @@ void target_osk_control(int x, int y, int button, int buttonstate) D3D_extoverlay(&osd_kb_eo, 0); if ((kb->code & 0xf000) != 0xf000) { if (kb->pressed) { - record_key((kb->code << 1) | 0); + record_key((kb->code << 1) | 0, true); } else { - record_key((kb->code << 1) | 1); + record_key((kb->code << 1) | 1, true); } } } @@ -4851,7 +4851,7 @@ void target_osk_control(int x, int y, int button, int buttonstate) highlight(&osd_kb_eo, kb, true); D3D_extoverlay(&osd_kb_eo, 0); if (kb->code != 0x62) { - record_key((kb->code << 1) | 1); + record_key((kb->code << 1) | 1, true); } } if (buttonstate) { @@ -4883,14 +4883,14 @@ void target_osk_control(int x, int y, int button, int buttonstate) if (buttonstate) { int capsstate = getcapslockstate(); capsstate = capsstate ? 0 : 1; - record_key((kb->code << 1) | capsstate); + record_key((kb->code << 1) | capsstate, true); setcapslockstate(capsstate); } } else { if (buttonstate) { - record_key((kb->code << 1) | 0); + record_key((kb->code << 1) | 0, true); } else { - record_key((kb->code << 1) | 1); + record_key((kb->code << 1) | 1, true); } } }