diff --git a/patches/dinput-map_dik_codes/0001-dinput-Map-scan-codes-to-DIK-code.patch b/patches/dinput-map_dik_codes/0001-dinput-Map-scan-codes-to-DIK-code.patch new file mode 100644 index 00000000..fed0a63e --- /dev/null +++ b/patches/dinput-map_dik_codes/0001-dinput-Map-scan-codes-to-DIK-code.patch @@ -0,0 +1,111 @@ +From 5f1cef62ad3baad16e3d15eb45049473fa6e6c97 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 11 Dec 2018 08:02:49 +1100 +Subject: [PATCH] dinput: Map scan codes to DIK code + +Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=45605 + +Origial Author is supercoolemail@seznam.cz, however they +are annoymous. Credit will be assigned as soon as this +information is worked out. +--- + dlls/dinput/keyboard.c | 75 ++++++++++++++++++++++++++++++++++-------- + 1 file changed, 61 insertions(+), 14 deletions(-) + +diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c +index 642d0c0beb8..4c83f4bc1f2 100644 +--- a/dlls/dinput/keyboard.c ++++ b/dlls/dinput/keyboard.c +@@ -78,28 +78,75 @@ static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType) + switch (scanCode) + { + case 0x0d: /* ^ */ +- scanCode = DIK_CIRCUMFLEX; +- break; ++ return DIK_CIRCUMFLEX; + case 0x1a: /* @ */ +- scanCode = DIK_AT; +- break; ++ return DIK_AT; + case 0x1b: /* [ */ +- scanCode = DIK_LBRACKET; +- break; ++ return DIK_LBRACKET; + case 0x28: /* : */ +- scanCode = DIK_COLON; +- break; ++ return DIK_COLON; + case 0x29: /* Hankaku/Zenkaku */ +- scanCode = DIK_KANJI; +- break; ++ return DIK_KANJI; + case 0x2b: /* ] */ +- scanCode = DIK_RBRACKET; +- break; ++ return DIK_RBRACKET; + case 0x73: /* \ */ +- scanCode = DIK_BACKSLASH; +- break; ++ return DIK_BACKSLASH; + } + } ++ ++ switch (vkCode) ++ { ++ case '0': return DIK_0; ++ case '1': return DIK_1; ++ case '2': return DIK_2; ++ case '3': return DIK_3; ++ case '4': return DIK_4; ++ case '5': return DIK_5; ++ case '6': return DIK_6; ++ case '7': return DIK_7; ++ case '8': return DIK_8; ++ case '9': return DIK_9; ++ ++ case 'A': return DIK_A; ++ case 'B': return DIK_B; ++ case 'C': return DIK_C; ++ case 'D': return DIK_D; ++ case 'E': return DIK_E; ++ case 'F': return DIK_F; ++ case 'G': return DIK_G; ++ case 'H': return DIK_H; ++ case 'I': return DIK_I; ++ case 'J': return DIK_J; ++ case 'K': return DIK_K; ++ case 'L': return DIK_L; ++ case 'M': return DIK_M; ++ case 'N': return DIK_N; ++ case 'O': return DIK_O; ++ case 'P': return DIK_P; ++ case 'Q': return DIK_Q; ++ case 'R': return DIK_R; ++ case 'S': return DIK_S; ++ case 'T': return DIK_T; ++ case 'U': return DIK_U; ++ case 'V': return DIK_V; ++ case 'W': return DIK_W; ++ case 'X': return DIK_X; ++ case 'Y': return DIK_Y; ++ case 'Z': return DIK_Z; ++ ++ case 0xbd: return DIK_MINUS; ++ case 0xeb: return DIK_EQUALS; ++ case 0xdb: return DIK_LBRACKET; ++ case 0xdd: return DIK_RBRACKET; ++ case 0xc0: return DIK_SEMICOLON; ++ case 0xde: return DIK_APOSTROPHE; ++ case 0xdc: return DIK_BACKSLASH; ++ case 0xbc: return DIK_COMMA; ++ case 0xbe: return DIK_PERIOD; ++ case 0xbf: return DIK_SLASH; ++ case 0xba: return DIK_GRAVE; ++ } ++ + return scanCode; + } + +-- +2.19.2 + diff --git a/patches/dinput-map_dik_codes/definition b/patches/dinput-map_dik_codes/definition new file mode 100644 index 00000000..68df2dca --- /dev/null +++ b/patches/dinput-map_dik_codes/definition @@ -0,0 +1 @@ +Fixes: [45605] Map scan codes to DIK code diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index aff4e9ac..47af22c2 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -134,6 +134,7 @@ patch_enable_all () enable_ddraw_Write_Vtable="$1" enable_dinput_Deadlock="$1" enable_dinput_Initialize="$1" + enable_dinput_map_dik_codes="$1" enable_dsound_EAX="$1" enable_dsound_Fast_Mixer="$1" enable_dwrite_FontFallback="$1" @@ -556,6 +557,9 @@ patch_enable () dinput-Initialize) enable_dinput_Initialize="$2" ;; + dinput-map_dik_codes) + enable_dinput_map_dik_codes="$2" + ;; dsound-EAX) enable_dsound_EAX="$2" ;; @@ -3300,6 +3304,21 @@ if test "$enable_dinput_Initialize" -eq 1; then ) >> "$patchlist" fi +# Patchset dinput-map_dik_codes +# | +# | This patchset fixes the following Wine bugs: +# | * [#45605] Map scan codes to DIK code +# | +# | Modified files: +# | * dlls/dinput/keyboard.c +# | +if test "$enable_dinput_map_dik_codes" -eq 1; then + patch_apply dinput-map_dik_codes/0001-dinput-Map-scan-codes-to-DIK-code.patch + ( + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Map scan codes to DIK code.", 1 },'; + ) >> "$patchlist" +fi + # Patchset dsound-Fast_Mixer # | # | This patchset fixes the following Wine bugs: