Add FixLanguage
This commit is contained in:
parent
db6df724cb
commit
036f68b06d
@ -51,6 +51,8 @@ unlock_songs = true
|
|||||||
mode_collabo026 = false
|
mode_collabo026 = false
|
||||||
|
|
||||||
[patches.jpn39]
|
[patches.jpn39]
|
||||||
|
# sync test mode language to attract etc
|
||||||
|
fix_language = false
|
||||||
# use cn font and chineseS wordlist value
|
# use cn font and chineseS wordlist value
|
||||||
chs_patch = false
|
chs_patch = false
|
||||||
|
|
||||||
|
1
dist/config.toml
vendored
1
dist/config.toml
vendored
@ -17,6 +17,7 @@ unlock_songs = true
|
|||||||
mode_collabo026 = false
|
mode_collabo026 = false
|
||||||
|
|
||||||
[patches.jpn39]
|
[patches.jpn39]
|
||||||
|
fix_language = false
|
||||||
chs_patch = false
|
chs_patch = false
|
||||||
|
|
||||||
[graphics]
|
[graphics]
|
||||||
|
@ -14,6 +14,17 @@ HOOK_DYNAMIC (i64, __fastcall, curl_easy_setopt, i64 a1, i64 a2, i64 a3, i64 a4,
|
|||||||
return originalcurl_easy_setopt (a1, a2, a3, a4, a5);
|
return originalcurl_easy_setopt (a1, a2, a3, a4, a5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i64 (__fastcall *lua_settop) (u64, u64) = (i64 (__fastcall *) (u64, u64))PROC_ADDRESS ("lua51.dll", "lua_settop");
|
||||||
|
i64 (__fastcall *lua_pushboolean) (u64, u64) = (i64 (__fastcall *) (u64, u64))PROC_ADDRESS ("lua51.dll", "lua_pushboolean");
|
||||||
|
i64 (__fastcall *lua_pushstring) (u64, u64) = (i64 (__fastcall *) (u64, u64))PROC_ADDRESS ("lua51.dll", "lua_pushstring");
|
||||||
|
|
||||||
|
i64
|
||||||
|
lua_pushtrue (i64 a1) {
|
||||||
|
lua_settop (a1, 0);
|
||||||
|
lua_pushboolean (a1, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
const i32 datatableBufferSize = 1024 * 1024 * 12;
|
const i32 datatableBufferSize = 1024 * 1024 * 12;
|
||||||
safetyhook::Allocation datatableBuffer1;
|
safetyhook::Allocation datatableBuffer1;
|
||||||
safetyhook::Allocation datatableBuffer2;
|
safetyhook::Allocation datatableBuffer2;
|
||||||
@ -46,15 +57,42 @@ SafetyHookMid changeLanguageTypeHook{};
|
|||||||
void
|
void
|
||||||
ChangeLanguageType(SafetyHookContext& ctx) {
|
ChangeLanguageType(SafetyHookContext& ctx) {
|
||||||
int* pFontType = (int *) ctx.rax;
|
int* pFontType = (int *) ctx.rax;
|
||||||
printf("---- saftyhook 2 fontType = %d\n", *pFontType);
|
|
||||||
if (*pFontType == 4) *pFontType = 2;
|
if (*pFontType == 4) *pFontType = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int language = 0;
|
||||||
|
const char *
|
||||||
|
languageStr () {
|
||||||
|
switch (language) {
|
||||||
|
case 1: return "en_us";
|
||||||
|
case 2: return "cn_tw";
|
||||||
|
case 3: return "kor";
|
||||||
|
case 4: return "cn_cn";
|
||||||
|
default: return "jpn";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HOOK (i64, GetLanguage, ASLR (0x140024AC0), i64 a1) {
|
||||||
|
auto result = originalGetLanguage (a1);
|
||||||
|
language = *((u32 *)result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
HOOK (i64, GetRegionLanguage, ASLR (0x1401CE9B0), i64 a1) {
|
||||||
|
lua_settop (a1, 0);
|
||||||
|
lua_pushstring (a1, (u64)languageStr ());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
HOOK (i64, GetCabinetLanguage, ASLR (0x1401D1A60), i64, i64 a2) {
|
||||||
|
lua_settop (a2, 0);
|
||||||
|
lua_pushstring (a2, (u64)languageStr ());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Init () {
|
Init () {
|
||||||
i32 xRes = 1920;
|
i32 xRes = 1920;
|
||||||
i32 yRes = 1080;
|
i32 yRes = 1080;
|
||||||
bool unlockSongs = true;
|
bool unlockSongs = true;
|
||||||
|
bool fixLanguage = false;
|
||||||
bool chsPatch = false;
|
bool chsPatch = false;
|
||||||
|
|
||||||
auto configPath = std::filesystem::current_path () / "config.toml";
|
auto configPath = std::filesystem::current_path () / "config.toml";
|
||||||
@ -65,6 +103,7 @@ Init () {
|
|||||||
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
|
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
|
||||||
auto jpn39 = openConfigSection (patches, "jpn39");
|
auto jpn39 = openConfigSection (patches, "jpn39");
|
||||||
if (jpn39) {
|
if (jpn39) {
|
||||||
|
fixLanguage = readConfigBool (jpn39, "fix_language", fixLanguage);
|
||||||
chsPatch = readConfigBool (jpn39, "chs_patch", chsPatch);
|
chsPatch = readConfigBool (jpn39, "chs_patch", chsPatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,6 +171,7 @@ Init () {
|
|||||||
ReplaceLeaBufferAddress (datatableBuffer3Addresses, datatableBuffer3.data ());
|
ReplaceLeaBufferAddress (datatableBuffer3Addresses, datatableBuffer3.data ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// patch to use chs font/wordlist instead of cht
|
||||||
if (chsPatch) {
|
if (chsPatch) {
|
||||||
WRITE_MEMORY (ASLR (0x140CD1AE0), char, "cn_64");
|
WRITE_MEMORY (ASLR (0x140CD1AE0), char, "cn_64");
|
||||||
WRITE_MEMORY (ASLR (0x140CD1AF0), char, "cn_32");
|
WRITE_MEMORY (ASLR (0x140CD1AF0), char, "cn_32");
|
||||||
@ -142,6 +182,13 @@ Init () {
|
|||||||
changeLanguageTypeHook = safetyhook::create_mid (ASLR (0x1400B2016), ChangeLanguageType);
|
changeLanguageTypeHook = safetyhook::create_mid (ASLR (0x1400B2016), ChangeLanguageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix language
|
||||||
|
if (fixLanguage) {
|
||||||
|
INSTALL_HOOK (GetLanguage);
|
||||||
|
INSTALL_HOOK (GetRegionLanguage);
|
||||||
|
INSTALL_HOOK (GetCabinetLanguage);
|
||||||
|
}
|
||||||
|
|
||||||
// Disable live check
|
// Disable live check
|
||||||
auto amHandle = (u64)GetModuleHandle ("AMFrameWork.dll");
|
auto amHandle = (u64)GetModuleHandle ("AMFrameWork.dll");
|
||||||
INSTALL_HOOK_DYNAMIC (AMFWTerminate, (void *)(amHandle + 0x42DE0));
|
INSTALL_HOOK_DYNAMIC (AMFWTerminate, (void *)(amHandle + 0x42DE0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user