From bbef3564cc5acdd1ce392c62eff9c2c1d27f882e Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Mon, 28 Oct 2019 18:41:50 +0100 Subject: [PATCH] OpenGL patches --- source-code/data/plugins/config.ini | 4 ++++ source-code/source/plugins/Launcher/framework.h | 4 ++++ source-code/source/plugins/Patches/dllmain.cpp | 13 +++++++++++++ 3 files changed, 21 insertions(+) diff --git a/source-code/data/plugins/config.ini b/source-code/data/plugins/config.ini index a577fcd..8b7fca0 100644 --- a/source-code/data/plugins/config.ini +++ b/source-code/data/plugins/config.ini @@ -50,6 +50,10 @@ Enhanced_Stage_Manager=0 Enhanced_Stage_Manager_Encore=1 #Unlock PSEUDO modules (incomplete, will default to Miku) Unlock_Pseudo=0 +#Ignores some OpenGL-related errors. Don't use both patches at the same time unless you're know what you're doing +OpenGL_Patch_A=0 +#Ignores some OpenGL-related errors. Don't use both patches at the same time unless you're know what you're doing +OpenGL_Patch_B=0 [Graphics] # Set to -1 to unlock the frame rate. diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index 9c13be6..01def69 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -195,6 +195,10 @@ ConfigOptionBase* optionsArray[] = { new BooleanOption(L"rumble", KEYCONFIG_SECTION, KEYCONFIG_FILE, L"XInput Rumble", L"Enables rumble during chainslides.", true, true), new NumericOption(L"xinput_preferred", KEYCONFIG_SECTION, KEYCONFIG_FILE, L"XInput Controller Num:", L"Sets the preferred XInput controller.\nIf unavailable, the next connected controller is used.", 0, 0, 3), new OptionMetaSpacer(8), + + new BooleanOption(L"opengl_patch_a", LAUNCHER_SECTION, CONFIG_FILE, L"OpenGL Patch A", L"Ignores some OpenGL-related errors. Don't use both patches at the same time unless you're know what you're doing.", L"", false), + new BooleanOption(L"opengl_patch_b", LAUNCHER_SECTION, CONFIG_FILE, L"OpenGL Patch B", L"Ignores some OpenGL-related errors. Don't use both patches at the same time unless you're know what you're doing.", L"", false), + new OptionMetaSpacer(8), new BooleanOption(L"no_gpu_dialog", LAUNCHER_SECTION, CONFIG_FILE, L"Disable GPU Warning", L"Disables the warning dialog for unsupported GPUs.", L"", false), new StringOption(L"command_line", LAUNCHER_SECTION, CONFIG_FILE, L"Command Line:", L"Allows setting command line parameters for the game when using the launcher.\nDisabling the launcher will bypass this.", L"", false), diff --git a/source-code/source/plugins/Patches/dllmain.cpp b/source-code/source/plugins/Patches/dllmain.cpp index d8d5130..adc49c1 100644 --- a/source-code/source/plugins/Patches/dllmain.cpp +++ b/source-code/source/plugins/Patches/dllmain.cpp @@ -142,6 +142,8 @@ void ApplyPatches() { auto nEStageManagerEncore = GetPrivateProfileIntW(L"patches", L"enhanced_stage_manager_encore", TRUE, CONFIG_FILE); auto nUnlockPseudo = GetPrivateProfileIntW(L"patches", L"unlock_pseudo", FALSE, CONFIG_FILE); auto nHardwareSlider = GetPrivateProfileIntW(L"patches", L"hardware_slider", FALSE, CONFIG_FILE); + auto nOGLPatchA = GetPrivateProfileIntW(L"patches", L"opengl_patch_a", FALSE, CONFIG_FILE); + auto nOGLPatchB = GetPrivateProfileIntW(L"patches", L"opengl_patch_b", FALSE, CONFIG_FILE); // Replace the hardcoded videos with MP4s, if they exist if (nMP4Movies) @@ -326,6 +328,17 @@ void ApplyPatches() { printf("[Patches] Enhanced Stage Manager enabled\n"); } + // OpenGL Patches + if (nOGLPatchA) + { + // (call cs:glGetError) -> (xor eax, eax); (nop); (nop); (nop); (nop); + InjectCode((void*)0x000000014069D21D, { 0x31, 0xC0, 0x90, 0x90, 0x90, 0x90 }); + } + if (nOGLPatchB) + { + // (js loc_14069BC32) -> (nop)... + InjectCode((void*)0x000000014069BAF4, { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); + } // Unlock PSEUDO modules (which will all default to Miku, unless we also patch them to match the first performer) if (nUnlockPseudo) {