1
1
mirror of synced 2025-02-25 21:58:29 +01:00

Add chs_patch for 3906

This commit is contained in:
RyuMiya 2024-10-15 11:20:57 +08:00
parent f07574ac3f
commit db6df724cb
4 changed files with 37 additions and 3 deletions

View File

@ -50,6 +50,10 @@ unlock_songs = true
# enable ai soshina mode
mode_collabo026 = false
[patches.jpn39]
# use cn font and chineseS wordlist value
chs_patch = false
[audio]
# wasapi shared mode
# allows you to have multiple audio sources at once at a cost of having higher latency

3
dist/config.toml vendored
View File

@ -16,6 +16,9 @@ unlock_songs = true
mode_collabo025 = false
mode_collabo026 = false
[patches.jpn39]
chs_patch = false
[graphics]
res = { x = 1920, y = 1080 }
windowed = false

View File

@ -130,7 +130,7 @@ Init () {
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
auto chn00 = openConfigSection (patches, "chn00");
if (chn00) {
fixLanguage = readConfigBool (chn00, "fix_language", fixLanguage);
fixLanguage = readConfigBool (chn00, "fix_language", fixLanguage);
demoMovie = readConfigBool (chn00, "demo_movie", demoMovie);
modeCollabo025 = readConfigBool (chn00, "mode_collabo025", modeCollabo025);
modeCollabo026 = readConfigBool (chn00, "mode_collabo026", modeCollabo026);

View File

@ -1,6 +1,7 @@
#include "../patches.h"
#include "helpers.h"
#include <safetyhook.hpp>
#include <stdio.h>
namespace patches::JPN39 {
@ -40,17 +41,33 @@ ReplaceLeaBufferAddress (const std::vector<uintptr_t> &bufferAddresses, void *ne
}
}
SafetyHookMid changeLanguageTypeHook{};
void
ChangeLanguageType(SafetyHookContext& ctx) {
int* pFontType = (int *) ctx.rax;
printf("---- saftyhook 2 fontType = %d\n", *pFontType);
if (*pFontType == 4) *pFontType = 2;
}
void
Init () {
i32 xRes = 1920;
i32 yRes = 1080;
bool unlockSongs = true;
bool chsPatch = false;
auto configPath = std::filesystem::current_path () / "config.toml";
std::unique_ptr<toml_table_t, void (*) (toml_table_t *)> config_ptr (openConfig (configPath), toml_free);
if (config_ptr) {
auto patches = openConfigSection (config_ptr.get (), "patches");
if (patches) unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
if (patches) {
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
auto jpn39 = openConfigSection (patches, "jpn39");
if (jpn39) {
chsPatch = readConfigBool (jpn39, "chs_patch", chsPatch);
}
}
auto graphics = openConfigSection (config_ptr.get (), "graphics");
if (graphics) {
@ -115,6 +132,16 @@ Init () {
ReplaceLeaBufferAddress (datatableBuffer3Addresses, datatableBuffer3.data ());
}
if (chsPatch) {
WRITE_MEMORY (ASLR (0x140CD1AE0), char, "cn_64");
WRITE_MEMORY (ASLR (0x140CD1AF0), char, "cn_32");
WRITE_MEMORY (ASLR (0x140CD1AF8), char, "cn_30");
WRITE_MEMORY (ASLR (0x140C946A0), char, "chineseSText");
WRITE_MEMORY (ASLR (0x140C946B0), char, "chineseSFontType");
changeLanguageTypeHook = safetyhook::create_mid (ASLR (0x1400B2016), ChangeLanguageType);
}
// Disable live check
auto amHandle = (u64)GetModuleHandle ("AMFrameWork.dll");
INSTALL_HOOK_DYNAMIC (AMFWTerminate, (void *)(amHandle + 0x42DE0));
@ -137,4 +164,4 @@ Init () {
patches::Qr::Init ();
patches::AmAuth::Init ();
}
} // namespace patches::JPN39
} // namespace patches::JPN39