diff --git a/data/plugins/components.ini b/data/plugins/components.ini index d0d0c71..5a3804f 100644 --- a/data/plugins/components.ini +++ b/data/plugins/components.ini @@ -22,7 +22,7 @@ frame_rate_manager = false # sets an unlimited per session play count for the normal game mode. # this means the player won't be sent back to the title screen after 2 plays. -stage_manager = true +stage_manager = false # skip unnecessary DATA_INITIALIZE loading time, speed up SYSTEM_STARTUP and skip the startup WARNING message. # further improvements can be achieved by shortening the duration of the pv_999 script file as it's test loaded during the SYSTEM_STARTUP. diff --git a/data/plugins/config.ini b/data/plugins/config.ini index 963b7a7..0b1f0d0 100644 --- a/data/plugins/config.ini +++ b/data/plugins/config.ini @@ -25,6 +25,11 @@ No_Movies=0 Hide_Volume=0 #Disables the error banner No_Error=1 +#Enhanced Stage Manager (sets a custom number of stages; "stage_manager" should be disabled in "components.ini") +Enhanced_Stage_Manager=0 +Enhanced_Stage_Manager_Final=2 +Enhanced_Stage_Manager_Encore=3 +Enhanced_Stage_Manager_Has_Encore=0 [Graphics] #FPS Limiter requires "fps_limiter" component to be enabled in "components.ini" diff --git a/data/plugins/playerdata.ini b/data/plugins/playerdata.ini index 7e37d8c..41bb174 100644 --- a/data/plugins/playerdata.ini +++ b/data/plugins/playerdata.ini @@ -30,7 +30,7 @@ border_excellent = true use_card = false # Allows module selection without card and attempts to disable module refresh when sliding in PV select to reduce CPU and IO load. -module_card_workaround = false +module_card_workaround = true # Allows use of game mode modifiers (hi-speed, hidden, and sudden) gamemode_options = true \ No newline at end of file diff --git a/source/plugins/Patches/dllmain.cpp b/source/plugins/Patches/dllmain.cpp index 8b79438..8a187ce 100644 --- a/source/plugins/Patches/dllmain.cpp +++ b/source/plugins/Patches/dllmain.cpp @@ -68,7 +68,7 @@ void ApplyPatches() { // allow modifier modes to work without use_card { (void*)0x00000001405CB14A,{ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 } }, { (void*)0x0000000140136CFA,{ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 } }, - // enable module selector without use_card (Modules are not getting saved upon selection, commented until a fix is found) + // enable module selector without use_card { (void*)0x00000001405C513B, { 0x01 } }, // Show Freeplay instead { (void*)0x00000001403BABEA, { 0x75 } }, @@ -90,6 +90,11 @@ void ApplyPatches() { auto nNoLyrics = GetPrivateProfileIntW(L"patches", L"no_lyrics", FALSE, CONFIG_FILE); auto nNoMovies = GetPrivateProfileIntW(L"patches", L"no_movies", FALSE, CONFIG_FILE); auto nNoError = GetPrivateProfileIntW(L"patches", L"no_error", FALSE, CONFIG_FILE); + auto nESM = GetPrivateProfileIntW(L"patches", L"enhanced_stage_manager", FALSE, CONFIG_FILE); + auto nESMF = GetPrivateProfileIntW(L"patches", L"enhanced_stage_manager_final", 2, CONFIG_FILE); + auto nESME = GetPrivateProfileIntW(L"patches", L"enhanced_stage_manager_encore", 3, CONFIG_FILE); + auto nESMHE = GetPrivateProfileIntW(L"patches", L"enhanced_stage_manager_has_encore", FALSE, CONFIG_FILE); + // Hides the Freeplay text if (nHideFreeplay) { @@ -201,6 +206,35 @@ void ApplyPatches() { InjectCode((void*)0x00000001403B9E9B, { 0x90, 0x90 }); printf("[Patches] Errors Banner disabled\n"); } + // Enhanced Stage Manager + if (nESM) + { + // Replace the function that provides the number of stages and compact some of it + InjectCode((void*)0x000000014038AEF0, { 0x48, 0x8B, 0x88, 0x40, 0x01, 0x00, 0x00, 0x48, 0x89, 0x4C, 0x24, 0x20, 0x48, 0x8B, 0xD0, 0x48, 0x8B, 0x88, 0x48, 0x01, 0x00, 0x00, 0x48, 0x89, 0x4C, 0x24, 0x28, 0x8B, 0x88, 0x50, 0x01, 0x00, 0x00, 0x89, 0x4C, 0x24, 0x30, 0x8B, 0x88, 0x54, 0x01, 0x00, 0x00, 0x8B, 0x80, 0x58, 0x01, 0x00, 0x00, 0x89, 0x44, 0x24, 0x38, 0x8B, 0x82, 0x5C, 0x01, 0x00, 0x00, 0x89, 0x4C, 0x24, 0x34, 0x89, 0x44, 0x24, 0x3C, 0x48, 0x8B, 0x82, 0x60, 0x01, 0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x40, 0x48, 0x8B, 0x82, 0x68, 0x01, 0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x48, 0x48, 0x8B, 0x82, 0x70, 0x01, 0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x50, 0x8B, 0x82, 0x78, 0x01, 0x00, 0x00, 0x89, 0x44, 0x24, 0x58, 0x84, 0xC0, 0x74, 0x2A, 0x48, 0x8B, 0x44, 0x24, 0x38, 0x48, 0xC1, 0xE8, 0x20, 0x85, 0xC0, 0x75, 0x1D, 0xE8, 0xD9, 0xD9, 0xE5, 0xFF, 0x48, 0x85, 0xC0, 0x74, 0x13, 0x48, 0x8D, 0x48, 0x10, 0xE8, 0xFB, 0xD3, 0xE5, 0xFF, 0xB9, 0x03, 0x00, 0x00, 0x00, 0x85, 0xC0, 0x0F, 0x45, 0xD9, 0x8B, 0x1D, 0x1B, 0x0C, 0x00, 0x00, 0x83, 0x3D, 0x1C, 0x0C, 0x00, 0x00, 0x00, 0x74, 0x06, 0x8B, 0x1D, 0x10, 0x0C, 0x00, 0x00, 0x8B, 0xC3, 0x48, 0x83, 0xC4, 0x60, 0x5B, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC }); + + // Jump to another section by addding some code to replace the values (Jump 1) + InjectCode((void*)0x000000014038AFF4, { 0xE9, 0x87, 0x0B, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC }); + + // Jump to another section by addding some code to replace the values (Replace 1/2) while some reserving space for values + InjectCode((void*)0x000000014038BB40, { 0xFF, 0x05, 0x76, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x70, 0x00, 0x00, 0x00, 0xBA, 0x02, 0x00, 0x00, 0x00, 0x83, 0x3D, 0x60, 0x00, 0x00, 0x00, 0x00, 0x74, 0x02, 0xFF, 0xC2, 0x39, 0xD1, 0x0F, 0x4D, 0xCA, 0x89, 0x48, 0x08, 0xB9, 0x0E, 0x00, 0x00, 0x00, 0xE8, 0x92, 0x98, 0xE0, 0xFF, 0xB0, 0x01, 0x48, 0x83, 0xC4, 0x28, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x44, 0x89, 0x61, 0x08, 0x44, 0x88, 0x61, 0x0C, 0x4C, 0x89, 0x61, 0x10, 0x44, 0x89, 0x25, 0x29, 0x00, 0x00, 0x00, 0xE9, 0x68, 0xF4, 0xFF, 0xFF, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); + + // Use the value from our own address instead of the original one + InjectCode((void*)0x00000001403F65AF, { 0x48, 0x8D, 0x05, 0x4A, 0x18, 0xDA, 0x00, 0x8B, 0x1D, 0x00, 0x56 }); + + // Jump to another section by addding some code to replace the values (Jump 2) + InjectCode((void*)0x00000001403F6638, { 0xE9, 0x03, 0x55, 0xF9, 0xFF, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC}); + + DWORD StageCountProtect; + VirtualProtect((int32_t*)0x14038BBB0, 0x10, PAGE_EXECUTE_READWRITE, &StageCountProtect); + + int* ESM = (int*)0x000000014038BBB0; + + ESM[0] = nESMF; + ESM[1] = nESME; + ESM[2] = nESMHE; + + printf("[Patches] Enhanced Stage Manager enabled\n"); + } } void InjectCode(void* address, const std::vector data) diff --git a/source/plugins/TLAC/Components/PlayerDataManager.h b/source/plugins/TLAC/Components/PlayerDataManager.h index 635e91c..6199539 100644 --- a/source/plugins/TLAC/Components/PlayerDataManager.h +++ b/source/plugins/TLAC/Components/PlayerDataManager.h @@ -23,7 +23,7 @@ namespace TLAC::Components int lastPvId = -1; bool initPvId = true; bool pvModuleLoaded = true; - bool moduleCardWorkaround = false; + bool moduleCardWorkaround = true; int lastModState = 0; void ApplyPatch(); void LoadConfig();