mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
iidx: fix kana input broken in subscreen when system language is not Japanese (#421)
## Link to GitHub Issue, if one exists user-reported ## Description of change When the system non-Unicode language is not set to Japanese, TDJ subscreen katakana keyboard was broken (weird behavior with characters not erasing, ending with corrupt characters, etc) To fix this, add a hook for `IsDBCSLeadByte`. `IsDBCSLeadByte` assumes system ACP (which may not be SHIFT_JIS). Instead, redirect bm2dx.dll to use `IsDBCSLeadByteEx` instead with SHIFT_JIS explicitly specified as a parameter. Presumably the game was using IsDBCSLeadByte to manage the keyboard typing logic.... which is weird because SDVX doesn't do the same. ## Testing Tested iidx 31 and tried to do searches.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include <ntstatus.h>
|
#include <ntstatus.h>
|
||||||
|
|
||||||
#include "avs/game.h"
|
#include "avs/game.h"
|
||||||
|
#include "games/iidx/iidx.h"
|
||||||
#include "util/detour.h"
|
#include "util/detour.h"
|
||||||
#include "util/logging.h"
|
#include "util/logging.h"
|
||||||
#include "util/utils.h"
|
#include "util/utils.h"
|
||||||
@@ -22,6 +23,7 @@ static decltype(GetLocaleInfoEx) *GetLocaleInfoEx_orig = nullptr;
|
|||||||
|
|
||||||
#ifdef SPICE64
|
#ifdef SPICE64
|
||||||
static decltype(GetSystemDefaultLCID) *GetSystemDefaultLCID_orig = nullptr;
|
static decltype(GetSystemDefaultLCID) *GetSystemDefaultLCID_orig = nullptr;
|
||||||
|
static decltype(IsDBCSLeadByte) *IsDBCSLeadByte_orig = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static NTSTATUS NTAPI RtlMultiByteToUnicodeN_hook(
|
static NTSTATUS NTAPI RtlMultiByteToUnicodeN_hook(
|
||||||
@@ -162,6 +164,17 @@ static int WINAPI GetLocaleInfoEx_hook (
|
|||||||
return GetLocaleInfoEx_orig(lpLocaleName, LCType, lpLCData, cchData);
|
return GetLocaleInfoEx_orig(lpLocaleName, LCType, lpLCData, cchData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SPICE64
|
||||||
|
|
||||||
|
static BOOL WINAPI IsDBCSLeadByte_hook (
|
||||||
|
BYTE TestChar
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return IsDBCSLeadByteEx(CODEPAGE_SHIFT_JIS, TestChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void hooks::lang::early_init() {
|
void hooks::lang::early_init() {
|
||||||
log_info("hooks::lang", "early initialization");
|
log_info("hooks::lang", "early initialization");
|
||||||
|
|
||||||
@@ -189,6 +202,19 @@ void hooks::lang::early_init() {
|
|||||||
GetLocaleInfoEx_hook,
|
GetLocaleInfoEx_hook,
|
||||||
&GetLocaleInfoEx_orig);
|
&GetLocaleInfoEx_orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SPICE64
|
||||||
|
// for TDJ subscreen search keyboard
|
||||||
|
if (avs::game::is_model("LDJ") && games::iidx::TDJ_MODE) {
|
||||||
|
log_info("hooks::lang", "hooking IsDBCSLeadByte");
|
||||||
|
detour::trampoline_try(
|
||||||
|
"kernel32.dll",
|
||||||
|
"IsDBCSLeadByte",
|
||||||
|
IsDBCSLeadByte_hook,
|
||||||
|
&IsDBCSLeadByte_orig);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hooks::lang::init() {
|
void hooks::lang::init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user