diff options
author | Ricardo <rsribeiro@users.noreply.github.com> | 2022-11-10 23:41:12 +0300 |
---|---|---|
committer | kcgen <1557255+kcgen@users.noreply.github.com> | 2022-11-12 03:35:56 +0300 |
commit | b28c10f8a8c102a32fc9a8f48a778a3137646640 (patch) | |
tree | c19e00a33be8ea8acc18b13d0e5f9076ebcedcb1 | |
parent | eb15b52e03f27c887cc411e542d8e815dc6968b1 (diff) |
Add handling for ABNT2 slash/question mark key
This commit is based on Wengier's INTERNATIONAL1 scancode
handling in DOSBox-X.
Imported-from: joncampbell123/dosbox-x@779dee8
Co-authored-by: Wengier <wengierwu@yahoo.com>
-rw-r--r-- | include/bios.h | 2 | ||||
-rw-r--r-- | include/keyboard.h | 2 | ||||
-rw-r--r-- | src/gui/sdl_mapper.cpp | 15 | ||||
-rw-r--r-- | src/hardware/keyboard.cpp | 3 | ||||
-rw-r--r-- | src/ints/bios_keyboard.cpp | 3 |
5 files changed, 23 insertions, 2 deletions
diff --git a/include/bios.h b/include/bios.h index a89e70932..783f14f37 100644 --- a/include/bios.h +++ b/include/bios.h @@ -113,7 +113,7 @@ #define BIOS_DEFAULT_RESET_LOCATION (RealMake(0xf000,(machine==MCH_PCJR)?0x0043:0xe05b)) /* maximum of scancodes handled by keyboard bios routines */ -#define MAX_SCAN_CODE 0x58 +#define MAX_SCAN_CODE 0x59 /* The Section handling Bios Disk Access */ //#define BIOS_MAX_DISK 10 diff --git a/include/keyboard.h b/include/keyboard.h index febda8b59..a953c4e32 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -132,6 +132,8 @@ enum KBD_KEYS { KBD_kpenter, KBD_kpperiod, + KBD_intl1, + KBD_LAST }; diff --git a/src/gui/sdl_mapper.cpp b/src/gui/sdl_mapper.cpp index 188bd38ac..954efa5dc 100644 --- a/src/gui/sdl_mapper.cpp +++ b/src/gui/sdl_mapper.cpp @@ -2176,6 +2176,19 @@ static void CreateLayout() { AddKeyButtonEvent(PX(XO+2),PY(YO+4),BW,BH,".","kp_period",KBD_kpperiod); #undef XO #undef YO + +#define XO 0 +#define YO 11 +#define MX 1 +#define MY 1 +#define CX (BW / 2) +#define BU(_X_) (BW * (_X_) + MX * ((_X_)-1)) +#define BV(_Y_) (BH * (_Y_) + MY * ((_Y_)-1)) + + AddKeyButtonEvent(PX(XO + 4) + CX, PY(YO + 0), BU(1), BV(1), "\\", "intl1", KBD_intl1); +#undef XO +#undef YO + #define XO 10 #define YO 8 /* Joystick Buttons/Texts */ @@ -2475,6 +2488,8 @@ static struct { /* Is that the extra backslash key ("less than" key) */ /* on some keyboards with the 102-keys layout?? */ {"lessthan", SDL_SCANCODE_NONUSBACKSLASH}, + + {"intl1", SDL_SCANCODE_INTERNATIONAL1}, {0, SDL_SCANCODE_UNKNOWN}}; diff --git a/src/hardware/keyboard.cpp b/src/hardware/keyboard.cpp index df290462a..68d1cb917 100644 --- a/src/hardware/keyboard.cpp +++ b/src/hardware/keyboard.cpp @@ -440,6 +440,9 @@ void KEYBOARD_AddKey(KBD_KEYS keytype,bool pressed) { KEYBOARD_AddBuffer(0xe0); KEYBOARD_AddBuffer(55|(pressed?0:0x80)); return; + case KBD_intl1: + ret = 89; + break; default: E_Exit("Unsupported key press"); break; diff --git a/src/ints/bios_keyboard.cpp b/src/ints/bios_keyboard.cpp index 12ec15691..fb0d94aed 100644 --- a/src/ints/bios_keyboard.cpp +++ b/src/ints/bios_keyboard.cpp @@ -125,7 +125,8 @@ static struct { { none, none, none, none }, { 0x565c, 0x567c, none, none }, /* (102-key) */ { 0x8500, 0x8700, 0x8900, 0x8b00 }, /* F11 */ - { 0x8600, 0x8800, 0x8a00, 0x8c00 } /* F12 */ + { 0x8600, 0x8800, 0x8a00, 0x8c00 }, /* F12 */ + { 0x352f, 0x353f, none, 0x35f0 } /* international 1 */ }; bool BIOS_AddKeyToBuffer(uint16_t code) { |