From cbd5b91141c71a5dc2c9f3f1ce1336e17d945219 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Thu, 31 Mar 2022 12:02:53 -0700 Subject: [PATCH] implement flip surfaces --- lib/dllmain.cpp | 9 +++++++++ lib/hooks.cpp | 7 ++++++- src/patchgrid.cpp | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/dllmain.cpp b/lib/dllmain.cpp index e0d50c9..337ab0d 100644 --- a/lib/dllmain.cpp +++ b/lib/dllmain.cpp @@ -31,6 +31,15 @@ DWORD WINAPI Patch() dsCreateOriginal = (dsCreateFunction)OverwriteImport(dllBase, "DirectSoundCreate", (LPVOID)InterceptDirectSoundCreate); dinputCreateOriginal = (dinputCreateFunction)OverwriteImport(dllBase, "DirectInputCreateA", (LPVOID)InterceptDirectInputCreateA); + // Flip surfaces is incompatible with full screen, if these options are set, warn the user + if (config.GetInt(_T("FlipSurfaces")) && !config.GetInt(_T("FullScreen"))) { + if (MessageBoxA(0, "The setting 'Flip Video Memory Pages' is incompatible with LEGO Island's windowed mode. " + "LEGO Island will likely fail to start up unless you disable 'Flip Video Memory Pages' " + "or run in full screen mode. Do you wish to continue?", "Warning", MB_YESNO) == IDNO) { + TerminateProcess(GetCurrentProcess(), 0); + } + } + // Stay active when defocused if (config.GetInt(_T("StayActiveWhenDefocused"))) { // Patch jump if window isn't active (TODO: Replace with C++ patch) diff --git a/lib/hooks.cpp b/lib/hooks.cpp index 20d8431..3ba3437 100644 --- a/lib/hooks.cpp +++ b/lib/hooks.cpp @@ -181,7 +181,12 @@ LONG WINAPI InterceptRegQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpR } else if (!strcmp(lpValueName, "Draw Cursor")) { - ReturnRegistryYESNOFromBool(lpData, config.GetInt(_T("DrawCursor"), 1)); + ReturnRegistryYESNOFromBool(lpData, config.GetInt(_T("DrawCursor"), 0)); + return ERROR_SUCCESS; + + } else if (!strcmp(lpValueName, "Flip Surfaces")) { + + ReturnRegistryYESNOFromBool(lpData, config.GetInt(_T("FlipSurfaces"), 0)); return ERROR_SUCCESS; } else if (!strcmp(lpValueName, "3D Device ID")) { diff --git a/src/patchgrid.cpp b/src/patchgrid.cpp index 55d0612..a648020 100644 --- a/src/patchgrid.cpp +++ b/src/patchgrid.cpp @@ -147,6 +147,10 @@ PatchGrid::PatchGrid() _T("Renders a custom in-game cursor, rather than a standard Windows pointer."), AddBoolItem(sectionGraphics, _T("Draw Cursor"), false)); + AddPatch("FlipSurfaces", + _T(""), // FIXME: Write description for this + AddBoolItem(sectionGraphics, _T("Flip Video Memory Pages"), false)); + vector fpsList; fpsList.push_back(_T("Default")); fpsList.push_back(_T("Uncapped"));