Skip to content

Commit e8ecec1

Browse files
committed
ignore checksum
1 parent 04ff76d commit e8ecec1

File tree

5 files changed

+23
-35
lines changed

5 files changed

+23
-35
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- add a ab test in th15, 123's normal
3030
- add roll from csv
3131
- add LW practice for IN
32+
- make IN and PCB ignore .exe checksum to avoid unexpected changes in .exe file(like using SpecialK and game crashes)
3233

3334
## 给 thprac 2.2.1.8 加了个实用(?) branch, 其加入的功能如下
3435
- 重新把解锁刷新率加回来了
@@ -61,3 +62,4 @@
6162
- 在绀珠传123非符后面加了个底力测试
6263
- 使用CSV文件随机roll东西
6364
- 永夜抄LW练习
65+
- 妖/永禁用checksum, 从而如汉化版等修改版的rep和score.dat不会导致游戏崩溃/游戏存档清零了(但是rep可能仍然会炸)

thprac/src/thprac/thprac_games.cpp

-22
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ bool g_pauseBGM_06 = false;
2828
bool g_forceRenderCursor=false;
2929
bool g_testKey=false;
3030
bool g_disable_max_btn = true;
31-
bool g_disable_checksum = false;
3231
AdvancedIGI_Options g_adv_igi_options;
3332

3433
bool g_useCustomFont = false;
@@ -220,19 +219,6 @@ void GameGuiInit(game_gui_impl impl, int device, int hwnd, int wndproc_addr,
220219
Gui::ingame_input_gen_t input_gen, int reg1, int reg2, int reg3,
221220
int wnd_size_flag, float x, float y)
222221
{
223-
if (device == 0) // special for th08
224-
{
225-
if (LauncherCfgInit(true)) {
226-
bool disable_checksum = false;
227-
if (LauncherSettingGet("disable_checksum", disable_checksum) && disable_checksum) {
228-
if (device == 0x17ce760) // 08
229-
{
230-
g_disable_checksum = true;
231-
}
232-
}
233-
}
234-
return;
235-
}
236222
ingame_mb_init();
237223
::ImGui::CreateContext();
238224
g_gameGuiImpl = impl;
@@ -412,14 +398,6 @@ void GameGuiInit(game_gui_impl impl, int device, int hwnd, int wndproc_addr,
412398
g_disable_f10_11_13 = false;
413399
}
414400

415-
bool disable_checksum = false;
416-
if (LauncherSettingGet("disable_checksum", disable_checksum) && disable_checksum) {
417-
if (device == 0x17ce760) // 08
418-
{
419-
g_disable_checksum = true;
420-
}
421-
}
422-
423401
LauncherSettingGet_KeyBind();
424402

425403
int theme;

thprac/src/thprac/thprac_launcher_cfg.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,6 @@ class THCfgGui {
19471947
void GuiMain()
19481948
{
19491949
if (ImGui::CollapsingHeader(S(THPRAC_COMPATIBILITY_SETTINGS))) {
1950-
mDisableChecksum.Gui(S(THPRAC_DISABLE_CHECKSUM_08), S(THPRAC_DISABLE_CHECKSUM_08_DESC));
19511950
mInitWindowPos.Gui(S(THPRAC_INIT_WINDOW_POS), S(THPRAC_INIT_WINDOW_POS_DESC));
19521951
mDisableMaximizeBtn.Gui(S(THPRAC_DISABLE_MAXIMIZE_BTN));
19531952
mDisableF10_11_13.Gui(S(THPRAC_DISABLE_F10_11_13));
@@ -2167,7 +2166,6 @@ class THCfgGui {
21672166
THCfgCheckbox mTestKey { "test_key", false };
21682167
THCfgCheckbox mUseCorrectJaFonts { "use_correct_ja_fonts", false };
21692168
THCfgCheckbox mUseCustomFont { "use_custom_font", false };
2170-
THCfgCheckbox mDisableChecksum { "disable_checksum", false };
21712169
THCfgCombo mCustomFont { "custom_font", 0, 999 };
21722170

21732171
THCfgCombo mExistingGameAction { "existing_game_launch_action", 0, 3 };

thprac/src/thprac/thprac_th07.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -2020,6 +2020,17 @@ namespace TH07 {
20202020
}
20212021

20222022
#pragma endregion
2023+
EHOOK_DY(th07_checksum1, 0x43A655) // checksum read fix
2024+
{
2025+
*(DWORD*)(pCtx->Ebp + 0xC) = *(DWORD*)(pCtx->Ebp - 0x14);
2026+
*(DWORD*)(pCtx->Ebp + 0x10) = *(DWORD*)(pCtx->Ebp - 0x8);
2027+
}
2028+
EHOOK_DY(th07_checksum2, 0x435FBB) // checksum
2029+
{
2030+
*(DWORD*)(0x575C14) = 650752;
2031+
*(DWORD*)(0x575C10) = 2932163676;
2032+
// 1.00b
2033+
}
20232034
HOOKSET_ENDDEF()
20242035
}
20252036

thprac/src/thprac/thprac_th08.cpp

+10-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <format>
44

55
namespace THPrac {
6-
extern bool g_disable_checksum;
76
namespace TH08 {
87
using std::pair;
98
struct THPracParam {
@@ -2609,18 +2608,18 @@ namespace TH08 {
26092608
TH08InGameInfo::singleton().mLSCCount++;
26102609
}
26112610
}
2612-
EHOOK_DY(th08_checksum, 0x44858D)
2611+
#pragma endregion
2612+
EHOOK_DY(th08_checksum1, 0x448679) // checksum read fix
26132613
{
2614-
static bool init = false;
2615-
if (!init)
2616-
GameGuiInit(IMPL_WIN32_DX8, 0, 0,0, Gui::INGAGME_INPUT_GEN1, 0, 0);
2617-
if (g_disable_checksum)
2618-
{
2619-
pCtx->Eax = 0;
2620-
pCtx->Eip = 0x4486B7;
2621-
}
2614+
*(DWORD*)(pCtx->Ebp + 0xC) = *(DWORD*)(pCtx->Ebp - 0x14);
2615+
*(DWORD*)(pCtx->Ebp + 0x10) = *(DWORD*)(pCtx->Ebp - 0x8);
2616+
}
2617+
EHOOK_DY(th08_checksum2, 0x443836) // checksum
2618+
{
2619+
*(DWORD*)(0x17CEAB0) = 840704;
2620+
*(DWORD*)(0x17CEAAC) = 2724749753;
2621+
// 1.00d
26222622
}
2623-
#pragma endregion
26242623
HOOKSET_ENDDEF()
26252624
}
26262625

0 commit comments

Comments
 (0)