add patch grid

This commit is contained in:
itsmattkc 2021-09-18 19:05:41 -07:00
parent ef126149d4
commit a113201f2c
6 changed files with 175 additions and 5 deletions

View file

@ -22,6 +22,10 @@ add_library(Rebld SHARED
)
target_link_libraries(Rebld PRIVATE winmm.lib)
# Add property grid
set(PROPERTYGRID_BUILD_APP OFF CACHE BOOL "")
add_subdirectory(ext/PropertyGrid)
#
# Build launcher/configuration executable
#
@ -34,6 +38,8 @@ add_executable(Rebuilder WIN32
src/clinkstatic.h
src/launcher.cpp
src/launcher.h
src/patchgrid.cpp
src/patchgrid.h
src/window.cpp
src/window.h
)
@ -44,7 +50,7 @@ if (BUILD_UNICODE)
target_link_options(Rebuilder PRIVATE /entry:wWinMainCRTStartup)
endif()
target_link_libraries(Rebuilder PRIVATE shlwapi.lib)
target_link_libraries(Rebuilder PRIVATE shlwapi.lib PropertyGrid)
# Ensure DLL is compiled before resource is built into executable
set_source_files_properties(res/res.rc PROPERTIES OBJECT_DEPENDS Rebld)

@ -1 +1 @@
Subproject commit 7ba4fd1ce140aa85934de5f69704fbe827c4954d
Subproject commit 937145d0f2a0bc43d8e69927fff1b166fb93ce69

136
src/patchgrid.cpp Normal file
View file

@ -0,0 +1,136 @@
#include "patchgrid.h"
PatchGrid::PatchGrid()
{
SetBoldModified(true);
// General section
HSECTION sectionGeneral = AddSection(_T("General"));
AddPatch("DebugToggle",
_T("Enables the in-game debug mode automatically without the need to type OGEL."),
AddBoolItem(sectionGeneral, _T("Debug Mode"), false));
AddPatch("MultipleInstances",
_T("By default, LEGO Island will allow only one instance of itself to run. "
"This patch allows infinite instances of LEGO Island to run."),
AddBoolItem(sectionGeneral, _T("Allow Multiple Instances"), false));
AddPatch("StayActiveWhenDefocused",
_T("By default, LEGO Island pauses when it's not the active window. "
"This patch prevents that behavior."),
AddBoolItem(sectionGeneral, _T("Stay Active When Defocused"), false));
AddPatch("RedirectSaveData",
_T("By default LEGO Island saves its game data in its Program Files folder. In newer versions of "
"Windows, this folder is considered privileged access, necessitating running LEGO Island as administrator "
"to save here. This patch sets LEGO Island's save location to %APPDATA% instead, which is an accessible and "
"standard location that most modern games and apps save to."),
AddBoolItem(sectionGeneral, _T("Redirect Save Files to %APPDATA%"), false));
AddPatch("DisableAutoFinishBuilding",
_T("In LEGO Island v1.1, placing the last block when building will automatically end the building section. While convenient, "
"this prevents players from making any further changes after placing the last brick. It also notably defies what Bill Ding says - you "
"don't hit the triangle when you're finished building.\n\nThis patch restores the functionality in v1.0 where placing the last block "
"will not automatically finish the build section."),
AddBoolItem(sectionGeneral, _T("Disable Auto-Finish Building Section"), false));
// Controls section
HSECTION sectionControls = AddSection(_T("Controls"));
AddPatch("UseWASD",
_T(""),
AddBoolItem(sectionControls, _T("Use WASD"), false));
AddPatch("UseJoystick",
_T(""),
AddBoolItem(sectionControls, _T("Use Joystick"), false));
AddPatch("MouseDeadzone",
_T(""),
AddIntegerItem(sectionControls, _T("Mouse Deadzone"), 40));
AddPatch("UnhookTurnSpeed",
_T("LEGO Island contains a bug where the turning speed is influenced by the frame rate. Enable this to make the turn speed independent of the frame rate."),
AddBoolItem(sectionControls, _T("Unhook Turning From Frame Rate"), false));
AddPatch("TurnUseVelocity",
_T("By default, LEGO Island ignores the turning acceleration/deceleration values. Set this to TRUE to utilize them (Default = FALSE)"),
AddBoolItem(sectionControls, _T("Enable Turning Velocity"), false));
// Navigation section
HSECTION sectionNavigation = AddSection(_T("Navigation"));
AddPatch("TurnMaxSpeed",
_T("Set the maximum turning speed. (Default = 20.0)"),
AddDoubleItem(sectionNavigation, _T("Turning: Max Speed"), 20.0));
AddPatch("TurnMaxAcceleration",
_T("Set the speed at which turning accelerates (requires 'Turning: Enable Velocity') (Default = 30.0)"),
AddDoubleItem(sectionNavigation, _T("Turning: Max Acceleration"), 30.0));
AddPatch("TurnMinAcceleration",
_T("Set the speed at which turning accelerates (requires 'Turning: Enable Velocity') (Default = 15.0)"),
AddDoubleItem(sectionNavigation, _T("Turning: Min Acceleration"), 15.0));
AddPatch("TurnDeceleration",
_T("Set the speed at which turning decelerates (requires 'Turning: Enable Velocity') (Default = 50.0)"),
AddDoubleItem(sectionNavigation, _T("Turning: Deceleration"), 50.0));
AddPatch("MovementMaxSpeed",
_T("Set the movement maximum speed. (Default = 40.0)"),
AddDoubleItem(sectionNavigation, _T("Movement: Max Speed"), 40.0));
AddPatch("MovementMaxAcceleration",
_T("Set the movement acceleration speed (i.e. how long it takes to go from not moving to top speed) (Default = 15.0)"),
AddDoubleItem(sectionNavigation, _T("Movement: Max Acceleration"), 15.0));
AddPatch("MovementMinAcceleration",
_T("Set the movement acceleration speed (i.e. how long it takes to go from not moving to top speed) (Default = 4.0)"),
AddDoubleItem(sectionNavigation, _T("Movement: Min Acceleration"), 4.0));
AddPatch("MovementDeceleration",
_T("Set the movement deceleration speed (i.e. how long it takes to slow to a stop after releasing the controls). "
"Increase this value to stop faster, decrease it to stop slower. "
"Usually this is set to a very high value making deceleration almost instant. (Default = 50.0)"),
AddDoubleItem(sectionNavigation, _T("Movement: Deceleration"), 50.0));
// Graphics Section
HSECTION sectionGraphics = AddSection(_T("Graphics"));
AddPatch("FullScreen",
_T("Allows you to change modes without administrator privileges and registry editing. NOTE: Windowed mode is NOT compatible with \"Flip Video Memory Pages\"."),
AddBoolItem(sectionGraphics, _T("Run in Full Screen"), true));
AddPatch("DrawCursor",
_T("Renders a custom in-game cursor, rather than a standard Windows pointer."),
AddBoolItem(sectionGraphics, _T("Draw Cursor"), false));
vector<string> fpsList;
fpsList.push_back(_T("Default"));
fpsList.push_back(_T("Uncapped"));
fpsList.push_back(_T("Limited"));
AddPatch("FPSLimit",
_T("Modify LEGO Island's frame rate cap"),
AddComboItem(sectionGraphics, _T("FPS Cap"), fpsList, 0));
AddPatch("CustomFPS",
_T("If 'FPS Cap' is set to 'Limited', this will be the frame rate used."),
AddDoubleItem(sectionGraphics, _T("FPS Cap - Custom Limit"), 24.0));
vector<string> qualityList;
qualityList.push_back(_T("Infinite"));
qualityList.push_back(_T("High"));
qualityList.push_back(_T("Medium"));
qualityList.push_back(_T("Low"));
AddPatch("ModelQuality",
_T("Change LEGO Island's default model quality"),
AddComboItem(sectionGraphics, _T("Model Quality"), qualityList, 2));
AddPatch("FOVMultiplier",
_T("Globally adjusts the field of view by a multiplier\n\n"
"0.1 = Default (smaller than 0.1 is more zoomed in, larger than 0.1 is more zoomed out"),
AddDoubleItem(sectionGraphics, _T("Field of View Adjustment"), 0.1));
// Audio section
HSECTION sectionMusic = AddSection(_T("Audio"));
AddPatch("MusicToggle",
_T("Turns in-game music on or off."),
AddBoolItem(sectionMusic, _T("Play Music"), true));
}
void PatchGrid::AddPatch(const string &id, const CString &description, HITEM item)
{
m_mPatchItems[id] = item;
m_mPatchDescriptions[id] = description;
}

20
src/patchgrid.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef PATCHGRID_H
#define PATCHGRID_H
#include "../ext/PropertyGrid/stdafx.h"
#include "../ext/PropertyGrid/PropertyGrid.h"
class PatchGrid : public CPropertyGrid
{
public:
PatchGrid();
private:
void AddPatch(const std::string &id, const CString &description, HITEM item);
std::map<std::string, HITEM> m_mPatchItems;
std::map<std::string, CString> m_mPatchDescriptions;
};
#endif // PATCHGRID_H

View file

@ -53,8 +53,9 @@ CRebuilderWindow::CRebuilderWindow()
delete [] tabItem.pszText;
// Create property grid (placeholder right now)
m_cPatchGrid.Create(_T("Property Grid"), WS_CHILD | WS_VISIBLE, CRect(), &m_cTabCtrl);
// Create property grid
m_cPatchGrid.Create(AfxRegisterWndClass(CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW), _T("Patch Grid"), WS_CHILD | WS_VISIBLE, CRect(), &m_cTabCtrl, ID_PATCHGRID);
m_cMusicTable.Create(_T("Music Tab"), WS_CHILD, CRect(), &m_cTabCtrl);
// Create run button
@ -71,6 +72,11 @@ CRebuilderWindow::CRebuilderWindow()
static const UINT defaultWindowHeight = 32;
SetWindowPos(NULL, 0, 0, m_nFontHeight * defaultWindowWidth, m_nFontHeight * defaultWindowHeight, 0);
CenterWindow(NULL);
// Set column width
RECT patchGridClientRect;
m_cPatchGrid.GetClientRect(&patchGridClientRect);
m_cPatchGrid.SetGutterWidth((patchGridClientRect.right - patchGridClientRect.left) / 2);
}
DWORD WINAPI WaitForProcessToClose(HANDLE hProcess)

View file

@ -6,6 +6,7 @@
#include <VECTOR>
#include "clinkstatic.h"
#include "patchgrid.h"
class CRebuilderWindow : public CFrameWnd
{
@ -57,7 +58,8 @@ private:
CButton m_cRunBtn;
CButton m_cKillBtn;
CStatic m_cPatchGrid;
PatchGrid m_cPatchGrid;
CStatic m_cMusicTable;
std::vector<HANDLE> m_lProcesses;