Force PDA/FT mouth/expressions

This commit is contained in:
nastys
2020-08-05 06:35:04 +02:00
parent acf901811d
commit bc8d564314
2 changed files with 63 additions and 1 deletions
@@ -169,11 +169,13 @@ ConfigOptionBase* optionsArray[] = {
new BooleanOption(L"no_scrolling_sfx", PATCHES_SECTION, CONFIG_FILE, L"Disable Scrolling SFX", L"Disable the scrolling sound effect.", false, false),
new OptionMetaSpacer(8),
new NumericOption(L"Enhanced_Stage_Manager", PATCHES_SECTION, CONFIG_FILE, L"Number of stages:", L"Set the number of stages (0 = default).", 0, 0, INT_MAX),
new NumericOption(L"Enhanced_Stage_Manager", PATCHES_SECTION, CONFIG_FILE, L"Number of Stages:", L"Set the number of stages (0 = default).", 0, 0, INT_MAX),
new BooleanOption(L"Enhanced_Stage_Manager_Encore", PATCHES_SECTION, CONFIG_FILE, L"Encore", L"Enable encore stages.", true, false),
new OptionMetaSpacer(8),
new BooleanOption(L"no_hand_scaling", PATCHES_SECTION, CONFIG_FILE, L"No Hand Scaling", L"Disable hand scaling.", false, false),
new DropdownOption(L"force_mouth", PATCHES_SECTION, CONFIG_FILE, L"Mouth Type:", L"Change the mouth animations.", 0, std::vector<LPCWSTR>({ L"Default", L"Force PDA", L"Force FT" })),
new DropdownOption(L"force_expressions", PATCHES_SECTION, CONFIG_FILE, L"Expression Type:", L"Change the expressions.", 0, std::vector<LPCWSTR>({ L"Default", L"Force PDA", L"Force FT" })),
new OptionMetaSpacer(8),
new BooleanOption(L"hide_volume", PATCHES_SECTION, CONFIG_FILE, L"Hide Volume Buttons", L"Hide the volume and SE control buttons.", false, false),
@@ -227,6 +227,8 @@ void ApplyPatches() {
auto nQuickStart = GetPrivateProfileIntW(L"patches", L"quick_start", 1, CONFIG_FILE);
auto nNoScrollingSfx = GetPrivateProfileIntW(L"patches", L"no_scrolling_sfx", FALSE, CONFIG_FILE);
auto nNoHandScaling = GetPrivateProfileIntW(L"patches", L"no_hand_scaling", FALSE, CONFIG_FILE);
auto nForceMouth = GetPrivateProfileIntW(L"patches", L"force_mouth", 0, CONFIG_FILE);
auto nForceExpressions = GetPrivateProfileIntW(L"patches", L"force_expressions", 0, CONFIG_FILE);
std::string version_string = std::to_string(game_version);
version_string.insert(version_string.begin()+1, '.');
@@ -799,6 +801,64 @@ void ApplyPatches() {
{
InjectCode((void*)0x0000000140120709, { 0xE9, 0x82, 0x0A, 0x00 });
}
// Force mouth animations
{
if (nForceMouth == 1) // PDA
{
printf("[Patches] Forcing PDA mouth...\n");
int* mouth_table = (int*)(0x1409A1DC0);
DWORD oldProtect;
VirtualProtect(mouth_table, 44, PAGE_EXECUTE_READWRITE, &oldProtect);
for (int i = 0; i < 11; i++)
{
mouth_table[i]++;
}
VirtualProtect(mouth_table, 44, oldProtect, nullptr);
printf("[Patches] PDA mouth forced\n");
}
else if (nForceMouth == 2) // FT
{
printf("[Patches] Forcing FT mouth...\n");
int* mouth_table_oldid = (int*)(0x1409A1E1C);
DWORD oldProtect;
VirtualProtect(mouth_table_oldid, 44, PAGE_EXECUTE_READWRITE, &oldProtect);
for (int i = 0; i < 11; i++)
{
mouth_table_oldid[i]--;
}
VirtualProtect(mouth_table_oldid, 44, oldProtect, nullptr);
printf("[Patches] FT mouth forced\n");
}
}
// Force expressions
{
if (nForceExpressions == 1) // PDA
{
printf("[Patches] Forcing PDA expressions...\n");
int* exp_table = (int*)(0x140A21900);
DWORD oldProtect;
VirtualProtect(exp_table, 104, PAGE_EXECUTE_READWRITE, &oldProtect);
for (int i = 0; i < 26; i++)
{
exp_table[i] += 2;
}
VirtualProtect(exp_table, 104, oldProtect, nullptr);
printf("[Patches] PDA expressions forced\n");
}
else if (nForceExpressions == 2) // FT
{
printf("[Patches] Forcing FT expressions...\n");
int* exp_table_oldid = (int*)(0x140A219D0);
DWORD oldProtect;
VirtualProtect(exp_table_oldid, 104, PAGE_EXECUTE_READWRITE, &oldProtect);
for (int i = 0; i < 26; i++)
{
exp_table_oldid[i] -= 2;
}
VirtualProtect(exp_table_oldid, 104, oldProtect, nullptr);
printf("[Patches] FT expressions forced\n");
}
}
}