change (simplify) ESM config, add option to allow using hardware sliders

This commit is contained in:
somewhatlurker
2019-08-08 05:33:50 +10:00
parent 365e15fdb0
commit 100aac8da0
3 changed files with 20 additions and 13 deletions
+3 -3
View File
@@ -26,10 +26,10 @@ 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")
#Number of stages (0 = disabled)
Enhanced_Stage_Manager=0
Enhanced_Stage_Manager_Final=2
Enhanced_Stage_Manager_Encore=3
Enhanced_Stage_Manager_Has_Encore=0
#Use encore stages or not
Enhanced_Stage_Manager_Encore=1
[Graphics]
#FPS Limiter requires "fps_limiter" component to be enabled in "components.ini"
@@ -154,6 +154,7 @@ ConfigOptionBase* optionsArray[] = {
new BooleanOption(L"no_lyrics", PATCHES_SECTION, CONFIG_FILE, L"Disable Lyrics", L"Disables showing lyrics.", false, false),
new BooleanOption(L"hide_pv_watermark", PATCHES_SECTION, CONFIG_FILE, L"Hide PV Watermark", L"Hides the watermark that's usually shown in PV viewing mode.", false, false),
new BooleanOption(L"no_error", PATCHES_SECTION, CONFIG_FILE, L"Disable Error Banner", L"Disables the error banner on the attract screen.", true, false),
new BooleanOption(L"hardware_slider", PATCHES_SECTION, CONFIG_FILE, L"Use Hardware Slider", L"Enable this if using a real arcade slider.\n(set the slider to port COM11)", false, false),
new BooleanOption(L"skip", LAUNCHER_SECTION, CONFIG_FILE, L"Skip Launcher", L"Forces the launcher to be skipped, you can also use the --launch parameter instead of this.", false, false),
+16 -10
View File
@@ -39,8 +39,6 @@ void ApplyPatches() {
// Ignore the EngineClear variable to clear the framebuffer at all resolutions
{ (void*)0x0000000140501480, { 0x90, 0x90 } },
{ (void*)0x0000000140501515, { 0x90, 0x90 } },
// Don't update the touch slider state so we can write our own
{ (void*)0x000000014061579B, { 0x90, 0x90, 0x90, 0x8B, 0x42, 0xE0, 0x90, 0x90, 0x90 } },
// Write ram files to the current directory instead of Y : / SBZV / ram
{ (void*)0x000000014066CF09, { 0xE9, 0xD8, 0x00 } },
// Change mdata path from "C:/Mount/Option" to "mdata/"
@@ -90,10 +88,9 @@ 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);
auto nEStageManager = GetPrivateProfileIntW(L"patches", L"enhanced_stage_manager", 0, CONFIG_FILE);
auto nEStageManagerEncore = GetPrivateProfileIntW(L"patches", L"enhanced_stage_manager_encore", TRUE, CONFIG_FILE);
auto nHardwareSlider = GetPrivateProfileIntW(L"patches", L"hardware_slider", FALSE, CONFIG_FILE);
// Hides the Freeplay text
if (nHideFreeplay)
@@ -207,7 +204,7 @@ void ApplyPatches() {
printf("[Patches] Errors Banner disabled\n");
}
// Enhanced Stage Manager
if (nESM)
if (nEStageManager > 0)
{
// 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 });
@@ -229,12 +226,21 @@ void ApplyPatches() {
int* ESM = (int*)0x000000014038BBB0;
ESM[0] = nESMF;
ESM[1] = nESME;
ESM[2] = nESMHE;
if (nEStageManagerEncore)
ESM[1] = nEStageManager;
else
ESM[0] = nEStageManager;
ESM[2] = nEStageManagerEncore;
printf("[Patches] Enhanced Stage Manager enabled\n");
}
// The original slider update needs to run for hardware sliders to work -- only patch it when using emulation
if (!nHardwareSlider)
{
// Don't update the touch slider state so we can write our own
InjectCode((void*)0x000000014061579B, { 0x90, 0x90, 0x90, 0x8B, 0x42, 0xE0, 0x90, 0x90, 0x90 });
}
}
void InjectCode(void* address, const std::vector<uint8_t> data)