From 2b7ecfaf7c0b7343dcac4404838b8a8dbee5fb5a Mon Sep 17 00:00:00 2001 From: Malkierian Date: Mon, 29 Apr 2024 20:47:24 -0700 Subject: [PATCH] Add CMake functionality to allow a port to modify what LUS uses for CVar names (#527) --- CMakeLists.txt | 1 + cmake/cvars.cmake | 48 ++++++++++++++++ src/CMakeLists.txt | 2 + src/controller/controldeck/ControlDeck.cpp | 3 +- .../controldevice/controller/Controller.cpp | 8 ++- .../controller/ControllerButton.cpp | 13 +++-- .../controller/ControllerGyro.cpp | 7 ++- .../controller/ControllerLED.cpp | 9 ++- .../controller/ControllerRumble.cpp | 7 ++- .../controller/ControllerStick.cpp | 29 +++++----- .../factories/AxisDirectionMappingFactory.cpp | 2 +- .../factories/ButtonMappingFactory.cpp | 2 +- .../mapping/factories/GyroMappingFactory.cpp | 2 +- .../mapping/factories/LEDMappingFactory.cpp | 2 +- .../factories/RumbleMappingFactory.cpp | 2 +- .../KeyboardKeyToAxisDirectionMapping.cpp | 4 +- .../keyboard/KeyboardKeyToButtonMapping.cpp | 4 +- ...SDLAxisDirectionToAxisDirectionMapping.cpp | 4 +- .../sdl/SDLAxisDirectionToButtonMapping.cpp | 4 +- .../sdl/SDLButtonToAxisDirectionMapping.cpp | 4 +- .../mapping/sdl/SDLButtonToButtonMapping.cpp | 4 +- .../controller/mapping/sdl/SDLGyroMapping.cpp | 4 +- .../controller/mapping/sdl/SDLLEDMapping.cpp | 4 +- .../mapping/sdl/SDLRumbleMapping.cpp | 4 +- .../ShipDeviceIndexMappingManager.cpp | 14 ++--- ...ShipDeviceIndexToSDLDeviceIndexMapping.cpp | 4 +- src/graphic/Fast3D/gfx_direct3d11.cpp | 2 +- src/graphic/Fast3D/gfx_dxgi.cpp | 8 +-- src/graphic/Fast3D/gfx_opengl.cpp | 2 +- src/graphic/Fast3D/gfx_pc.cpp | 4 +- src/graphic/Fast3D/gfx_sdl2.cpp | 11 ++-- src/resource/ResourceManager.cpp | 6 +- src/window/Window.cpp | 2 +- src/window/gui/GameOverlay.h | 4 -- src/window/gui/Gui.cpp | 56 ++++++++++--------- src/window/gui/Gui.h | 1 + 36 files changed, 175 insertions(+), 112 deletions(-) create mode 100644 cmake/cvars.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d69a5df..0f73aba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") endif() project(libultraship LANGUAGES C CXX) + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") enable_language(OBJCXX) set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -fobjc-arc") diff --git a/cmake/cvars.cmake b/cmake/cvars.cmake new file mode 100644 index 0000000..cebfe39 --- /dev/null +++ b/cmake/cvars.cmake @@ -0,0 +1,48 @@ +set(CVAR_VSYNC_ENABLED "gVsyncEnabled" CACHE STRING "") +set(CVAR_Z_FIGHTING_MODE "gZFightingMode" CACHE STRING "") +set(CVAR_NEW_FILE_DROPPED "gNewFileDropped" CACHE STRING "") +set(CVAR_DROPPED_FILE "gDroppedFile" CACHE STRING "") +set(CVAR_INTERNAL_RESOLUTION "gInternalResolution" CACHE STRING "") +set(CVAR_MSAA_VALUE "gMSAAValue" CACHE STRING "") +set(CVAR_SDL_WINDOWED_FULLSCREEN "gSdlWindowedFullscreen" CACHE STRING "") +set(CVAR_TEXTURE_FILTER "gTextureFilter" CACHE STRING "") +set(CVAR_IMGUI_CONTROLLER_NAV "gControlNav" CACHE STRING "") +set(CVAR_CONSOLE_WINDOW_OPEN "gConsoleEnabled" CACHE STRING "") +set(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN "gControllerConfigurationEnabled" CACHE STRING "") +set(CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN "gControllerDisconnectedWindowEnabled" CACHE STRING "") +set(CVAR_CONTROLLER_REORDERING_WINDOW_OPEN "gControllerReorderingWindowEnabled" CACHE STRING "") +set(CVAR_GFX_DEBUGGER_WINDOW_OPEN "gGfxDebuggerEnabled" CACHE STRING "") +set(CVAR_STATS_WINDOW_OPEN "gStatsEnabled" CACHE STRING "") +set(CVAR_ENABLE_MULTI_VIEWPORTS "gEnableMultiViewports" CACHE STRING "") +set(CVAR_LOW_RES_MODE "gLowResMode" CACHE STRING "") +set(CVAR_SIMULATED_INPUT_LAG "gSimulatedInputLag" CACHE STRING "") +set(CVAR_ALT_ASSETS "gAltAssets" CACHE STRING "") +set(CVAR_GAME_OVERLAY_FONT "gOverlayFont" CACHE STRING "") +set(CVAR_MENU_BAR_OPEN "gOpenMenuBar" CACHE STRING "") +set(CVAR_PREFIX_CONTROLLERS "gControllers" CACHE STRING "") +set(CVAR_PREFIX_ADVANCED_RESOLUTION "gAdvancedResolution" CACHE STRING "") +add_compile_definitions( + CVAR_VSYNC_ENABLED="${CVAR_VSYNC_ENABLED}" + CVAR_Z_FIGHTING_MODE="${CVAR_Z_FIGHTING_MODE}" + CVAR_NEW_FILE_DROPPED="${CVAR_NEW_FILE_DROPPED}" + CVAR_DROPPED_FILE="${CVAR_DROPPED_FILE}" + CVAR_INTERNAL_RESOLUTION="${CVAR_INTERNAL_RESOLUTION}" + CVAR_MSAA_VALUE="${CVAR_MSAA_VALUE}" + CVAR_SDL_WINDOWED_FULLSCREEN="${CVAR_SDL_WINDOWED_FULLSCREEN}" + CVAR_TEXTURE_FILTER="${CVAR_TEXTURE_FILTER}" + CVAR_IMGUI_CONTROLLER_NAV="${CVAR_IMGUI_CONTROLLER_NAV}" + CVAR_CONSOLE_WINDOW_OPEN="${CVAR_CONSOLE_WINDOW_OPEN}" + CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN="${CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN}" + CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN="${CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN}" + CVAR_CONTROLLER_REORDERING_WINDOW_OPEN="${CVAR_CONTROLLER_REORDERING_WINDOW_OPEN}" + CVAR_GFX_DEBUGGER_WINDOW_OPEN="${CVAR_GFX_DEBUGGER_WINDOW_OPEN}" + CVAR_STATS_WINDOW_OPEN="${CVAR_STATS_WINDOW_OPEN}" + CVAR_ENABLE_MULTI_VIEWPORTS="${CVAR_ENABLE_MULTI_VIEWPORTS}" + CVAR_LOW_RES_MODE="${CVAR_LOW_RES_MODE}" + CVAR_SIMULATED_INPUT_LAG="${CVAR_SIMULATED_INPUT_LAG}" + CVAR_ALT_ASSETS="${CVAR_ALT_ASSETS}" + CVAR_GAME_OVERLAY_FONT="${CVAR_GAME_OVERLAY_FONT}" + CVAR_MENU_BAR_OPEN="${CVAR_MENU_BAR_OPEN}" + CVAR_PREFIX_CONTROLLERS="${CVAR_PREFIX_CONTROLLERS}" + CVAR_PREFIX_ADVANCED_RESOLUTION="${CVAR_PREFIX_ADVANCED_RESOLUTION}" +) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9f36073..ffdc430 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,5 @@ +include(../cmake/cvars.cmake) + add_library(libultraship STATIC) set_target_properties(libultraship PROPERTIES PREFIX "") set_property(TARGET libultraship PROPERTY CXX_STANDARD 20) diff --git a/src/controller/controldeck/ControlDeck.cpp b/src/controller/controldeck/ControlDeck.cpp index 5e0a55e..352c30e 100644 --- a/src/controller/controldeck/ControlDeck.cpp +++ b/src/controller/controldeck/ControlDeck.cpp @@ -65,7 +65,8 @@ bool ControlDeck::AllGameInputBlocked() { bool ControlDeck::GamepadGameInputBlocked() { // block controller input when using the controller to navigate imgui menus - return AllGameInputBlocked() || (CVarGetInteger("gOpenMenuBar", 0) && CVarGetInteger("gControlNav", 0)); + return AllGameInputBlocked() || + (CVarGetInteger(CVAR_MENU_BAR_OPEN, 0) && CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0)); } bool ControlDeck::KeyboardGameInputBlocked() { diff --git a/src/controller/controldevice/controller/Controller.cpp b/src/controller/controldevice/controller/Controller.cpp index 4cf7a67..254413e 100644 --- a/src/controller/controldevice/controller/Controller.cpp +++ b/src/controller/controldevice/controller/Controller.cpp @@ -70,7 +70,8 @@ uint8_t Controller::GetPortIndex() { } bool Controller::HasConfig() { - const std::string hasConfigCvarKey = StringHelper::Sprintf("gControllers.Port%d.HasConfig", mPortIndex + 1); + const std::string hasConfigCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.HasConfig", mPortIndex + 1); return CVarGetInteger(hasConfigCvarKey.c_str(), false); } @@ -108,7 +109,8 @@ void Controller::AddDefaultMappings(ShipDeviceIndex shipDeviceIndex) { GetLeftStick()->AddDefaultMappings(shipDeviceIndex); GetRumble()->AddDefaultMappings(shipDeviceIndex); - const std::string hasConfigCvarKey = StringHelper::Sprintf("gControllers.Port%d.HasConfig", mPortIndex + 1); + const std::string hasConfigCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.HasConfig", mPortIndex + 1); CVarSetInteger(hasConfigCvarKey.c_str(), true); CVarSave(); } @@ -142,7 +144,7 @@ void Controller::ReadToPad(OSContPad* pad) { mPadBuffer.push_front(padToBuffer); if (pad != nullptr) { auto& padFromBuffer = - mPadBuffer[std::min(mPadBuffer.size() - 1, (size_t)CVarGetInteger("gSimulatedInputLag", 0))]; + mPadBuffer[std::min(mPadBuffer.size() - 1, (size_t)CVarGetInteger(CVAR_SIMULATED_INPUT_LAG, 0))]; pad->button |= padFromBuffer.button; diff --git a/src/controller/controldevice/controller/ControllerButton.cpp b/src/controller/controldevice/controller/ControllerButton.cpp index 302e7fd..2783542 100644 --- a/src/controller/controldevice/controller/ControllerButton.cpp +++ b/src/controller/controldevice/controller/ControllerButton.cpp @@ -105,8 +105,9 @@ void ControllerButton::SaveButtonMappingIdsToConfig() { buttonMappingIdListString += ","; } - const std::string buttonMappingIdsCvarKey = StringHelper::Sprintf( - "gControllers.Port%d.Buttons.%sButtonMappingIds", mPortIndex + 1, GetConfigNameFromBitmask(mBitmask).c_str()); + const std::string buttonMappingIdsCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.Buttons.%sButtonMappingIds", mPortIndex + 1, + GetConfigNameFromBitmask(mBitmask).c_str()); if (buttonMappingIdListString == "") { CVarClear(buttonMappingIdsCvarKey.c_str()); } else { @@ -124,8 +125,9 @@ void ControllerButton::ReloadAllMappingsFromConfig() { // for each controller (especially compared to include/exclude locations in rando), and // the audio editor pattern doesn't work for this because that looks for ids that are either // hardcoded or provided by an otr file - const std::string buttonMappingIdsCvarKey = StringHelper::Sprintf( - "gControllers.Port%d.Buttons.%sButtonMappingIds", mPortIndex + 1, GetConfigNameFromBitmask(mBitmask).c_str()); + const std::string buttonMappingIdsCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.Buttons.%sButtonMappingIds", mPortIndex + 1, + GetConfigNameFromBitmask(mBitmask).c_str()); std::stringstream buttonMappingIdsStringStream(CVarGetString(buttonMappingIdsCvarKey.c_str(), "")); std::string buttonMappingIdString; while (getline(buttonMappingIdsStringStream, buttonMappingIdString, ',')) { @@ -196,7 +198,8 @@ bool ControllerButton::AddOrEditButtonMappingFromRawPress(CONTROLLERBUTTONS_T bi AddButtonMapping(mapping); mapping->SaveToConfig(); SaveButtonMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf("gControllers.Port%d.HasConfig", mPortIndex + 1); + const std::string hasConfigCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.HasConfig", mPortIndex + 1); CVarSetInteger(hasConfigCvarKey.c_str(), true); CVarSave(); return true; diff --git a/src/controller/controldevice/controller/ControllerGyro.cpp b/src/controller/controldevice/controller/ControllerGyro.cpp index 46a72ca..2b001cd 100644 --- a/src/controller/controldevice/controller/ControllerGyro.cpp +++ b/src/controller/controldevice/controller/ControllerGyro.cpp @@ -31,7 +31,8 @@ bool ControllerGyro::SetGyroMappingFromRawPress() { SetGyroMapping(mapping); mapping->SaveToConfig(); SaveGyroMappingIdToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf("gControllers.Port%d.HasConfig", mPortIndex + 1); + const std::string hasConfigCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.HasConfig", mPortIndex + 1); CVarSetInteger(hasConfigCvarKey.c_str(), true); CVarSave(); return true; @@ -47,7 +48,7 @@ void ControllerGyro::UpdatePad(float& x, float& y) { void ControllerGyro::SaveGyroMappingIdToConfig() { const std::string gyroMappingIdCvarKey = - StringHelper::Sprintf("gControllers.Port%d.Gyro.GyroMappingId", mPortIndex + 1); + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.Gyro.GyroMappingId", mPortIndex + 1); if (mGyroMapping == nullptr) { CVarClear(gyroMappingIdCvarKey.c_str()); @@ -70,7 +71,7 @@ void ControllerGyro::ClearGyroMapping() { void ControllerGyro::ReloadGyroMappingFromConfig() { const std::string gyroMappingIdCvarKey = - StringHelper::Sprintf("gControllers.Port%d.Gyro.GyroMappingId", mPortIndex + 1); + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.Gyro.GyroMappingId", mPortIndex + 1); std::string id = CVarGetString(gyroMappingIdCvarKey.c_str(), ""); if (id == "") { diff --git a/src/controller/controldevice/controller/ControllerLED.cpp b/src/controller/controldevice/controller/ControllerLED.cpp index 183c3ff..9614239 100644 --- a/src/controller/controldevice/controller/ControllerLED.cpp +++ b/src/controller/controldevice/controller/ControllerLED.cpp @@ -28,7 +28,8 @@ void ControllerLED::SaveLEDMappingIdsToConfig() { ledMappingIdListString += ","; } - const std::string ledMappingIdsCvarKey = StringHelper::Sprintf("gControllers.Port%d.LEDMappingIds", mPortIndex + 1); + const std::string ledMappingIdsCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.LEDMappingIds", mPortIndex + 1); if (ledMappingIdsCvarKey == "") { CVarClear(ledMappingIdsCvarKey.c_str()); } else { @@ -97,7 +98,8 @@ void ControllerLED::ReloadAllMappingsFromConfig() { // for each controller (especially compared to include/exclude locations in rando), and // the audio editor pattern doesn't work for this because that looks for ids that are either // hardcoded or provided by an otr file - const std::string ledMappingIdsCvarKey = StringHelper::Sprintf("gControllers.Port%d.LEDMappingIds", mPortIndex + 1); + const std::string ledMappingIdsCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.LEDMappingIds", mPortIndex + 1); std::stringstream ledMappingIdsStringStream(CVarGetString(ledMappingIdsCvarKey.c_str(), "")); std::string ledMappingIdString; while (getline(ledMappingIdsStringStream, ledMappingIdString, ',')) { @@ -121,7 +123,8 @@ bool ControllerLED::AddLEDMappingFromRawPress() { AddLEDMapping(mapping); mapping->SaveToConfig(); SaveLEDMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf("gControllers.Port%d.HasConfig", mPortIndex + 1); + const std::string hasConfigCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.HasConfig", mPortIndex + 1); CVarSetInteger(hasConfigCvarKey.c_str(), true); CVarSave(); return true; diff --git a/src/controller/controldevice/controller/ControllerRumble.cpp b/src/controller/controldevice/controller/ControllerRumble.cpp index acdb328..bdf927d 100644 --- a/src/controller/controldevice/controller/ControllerRumble.cpp +++ b/src/controller/controldevice/controller/ControllerRumble.cpp @@ -34,7 +34,7 @@ void ControllerRumble::SaveRumbleMappingIdsToConfig() { } const std::string rumbleMappingIdsCvarKey = - StringHelper::Sprintf("gControllers.Port%d.RumbleMappingIds", mPortIndex + 1); + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.RumbleMappingIds", mPortIndex + 1); if (rumbleMappingIdListString == "") { CVarClear(rumbleMappingIdsCvarKey.c_str()); } else { @@ -115,7 +115,7 @@ void ControllerRumble::ReloadAllMappingsFromConfig() { // the audio editor pattern doesn't work for this because that looks for ids that are either // hardcoded or provided by an otr file const std::string rumbleMappingIdsCvarKey = - StringHelper::Sprintf("gControllers.Port%d.RumbleMappingIds", mPortIndex + 1); + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.RumbleMappingIds", mPortIndex + 1); std::stringstream rumbleMappingIdsStringStream(CVarGetString(rumbleMappingIdsCvarKey.c_str(), "")); std::string rumbleMappingIdString; while (getline(rumbleMappingIdsStringStream, rumbleMappingIdString, ',')) { @@ -139,7 +139,8 @@ bool ControllerRumble::AddRumbleMappingFromRawPress() { AddRumbleMapping(mapping); mapping->SaveToConfig(); SaveRumbleMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf("gControllers.Port%d.HasConfig", mPortIndex + 1); + const std::string hasConfigCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.HasConfig", mPortIndex + 1); CVarSetInteger(hasConfigCvarKey.c_str(), true); CVarSave(); return true; diff --git a/src/controller/controldevice/controller/ControllerStick.cpp b/src/controller/controldevice/controller/ControllerStick.cpp index 136d041..5857a04 100644 --- a/src/controller/controldevice/controller/ControllerStick.cpp +++ b/src/controller/controldevice/controller/ControllerStick.cpp @@ -88,8 +88,8 @@ void ControllerStick::SaveAxisDirectionMappingIdsToConfig() { } const std::string axisDirectionMappingIdsCvarKey = StringHelper::Sprintf( - "gControllers.Port%d.%s.%sAxisDirectionMappingIds", mPortIndex + 1, stickToConfigStickName[mStick].c_str(), - directionToConfigDirectionName[direction].c_str()); + CVAR_PREFIX_CONTROLLERS ".Port%d.%s.%sAxisDirectionMappingIds", mPortIndex + 1, + stickToConfigStickName[mStick].c_str(), directionToConfigDirectionName[direction].c_str()); if (axisDirectionMappingIdListString == "") { CVarClear(axisDirectionMappingIdsCvarKey.c_str()); } else { @@ -162,8 +162,8 @@ void ControllerStick::ReloadAllMappingsFromConfig() { // hardcoded or provided by an otr file for (auto direction : { LEFT, RIGHT, UP, DOWN }) { const std::string axisDirectionMappingIdsCvarKey = StringHelper::Sprintf( - "gControllers.Port%d.%s.%sAxisDirectionMappingIds", mPortIndex + 1, stickToConfigStickName[mStick].c_str(), - directionToConfigDirectionName[direction].c_str()); + CVAR_PREFIX_CONTROLLERS ".Port%d.%s.%sAxisDirectionMappingIds", mPortIndex + 1, + stickToConfigStickName[mStick].c_str(), directionToConfigDirectionName[direction].c_str()); std::stringstream axisDirectionMappingIdsStringStream( CVarGetString(axisDirectionMappingIdsCvarKey.c_str(), "")); @@ -173,18 +173,18 @@ void ControllerStick::ReloadAllMappingsFromConfig() { } } - SetSensitivity(CVarGetInteger(StringHelper::Sprintf("gControllers.Port%d.%s.SensitivityPercentage", mPortIndex + 1, - stickToConfigStickName[mStick].c_str()) + SetSensitivity(CVarGetInteger(StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.%s.SensitivityPercentage", + mPortIndex + 1, stickToConfigStickName[mStick].c_str()) .c_str(), DEFAULT_STICK_SENSITIVITY_PERCENTAGE)); - SetDeadzone(CVarGetInteger(StringHelper::Sprintf("gControllers.Port%d.%s.DeadzonePercentage", mPortIndex + 1, - stickToConfigStickName[mStick].c_str()) + SetDeadzone(CVarGetInteger(StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.%s.DeadzonePercentage", + mPortIndex + 1, stickToConfigStickName[mStick].c_str()) .c_str(), DEFAULT_STICK_DEADZONE_PERCENTAGE)); - SetNotchSnapAngle(CVarGetInteger(StringHelper::Sprintf("gControllers.Port%d.%s.NotchSnapAngle", mPortIndex + 1, - stickToConfigStickName[mStick].c_str()) + SetNotchSnapAngle(CVarGetInteger(StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.%s.NotchSnapAngle", + mPortIndex + 1, stickToConfigStickName[mStick].c_str()) .c_str(), 0)); } @@ -289,7 +289,8 @@ bool ControllerStick::AddOrEditAxisDirectionMappingFromRawPress(Direction direct AddAxisDirectionMapping(direction, mapping); mapping->SaveToConfig(); SaveAxisDirectionMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf("gControllers.Port%d.HasConfig", mPortIndex + 1); + const std::string hasConfigCvarKey = + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.HasConfig", mPortIndex + 1); CVarSetInteger(hasConfigCvarKey.c_str(), true); CVarSave(); return true; @@ -337,7 +338,7 @@ bool ControllerStick::ProcessKeyboardEvent(Ship::KbEventType eventType, Ship::Kb void ControllerStick::SetSensitivity(uint8_t sensitivityPercentage) { mSensitivityPercentage = sensitivityPercentage; mSensitivity = sensitivityPercentage / 100.0f; - CVarSetInteger(StringHelper::Sprintf("gControllers.Port%d.%s.SensitivityPercentage", mPortIndex + 1, + CVarSetInteger(StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.%s.SensitivityPercentage", mPortIndex + 1, stickToConfigStickName[mStick].c_str()) .c_str(), mSensitivityPercentage); @@ -359,7 +360,7 @@ bool ControllerStick::SensitivityIsDefault() { void ControllerStick::SetDeadzone(uint8_t deadzonePercentage) { mDeadzonePercentage = deadzonePercentage; mDeadzone = MAX_AXIS_RANGE * (deadzonePercentage / 100.0f); - CVarSetInteger(StringHelper::Sprintf("gControllers.Port%d.%s.DeadzonePercentage", mPortIndex + 1, + CVarSetInteger(StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.%s.DeadzonePercentage", mPortIndex + 1, stickToConfigStickName[mStick].c_str()) .c_str(), mDeadzonePercentage); @@ -380,7 +381,7 @@ bool ControllerStick::DeadzoneIsDefault() { void ControllerStick::SetNotchSnapAngle(uint8_t notchSnapAngle) { mNotchSnapAngle = notchSnapAngle; - CVarSetInteger(StringHelper::Sprintf("gControllers.Port%d.%s.NotchSnapAngle", mPortIndex + 1, + CVarSetInteger(StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.%s.NotchSnapAngle", mPortIndex + 1, stickToConfigStickName[mStick].c_str()) .c_str(), mNotchSnapAngle); diff --git a/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp index 6a7a6ae..45499b1 100644 --- a/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp @@ -12,7 +12,7 @@ namespace Ship { std::shared_ptr AxisDirectionMappingFactory::CreateAxisDirectionMappingFromConfig(uint8_t portIndex, Stick stick, std::string id) { - const std::string mappingCvarKey = "gControllers.AxisDirectionMappings." + id; + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".AxisDirectionMappings." + id; const std::string mappingClass = CVarGetString(StringHelper::Sprintf("%s.AxisDirectionMappingClass", mappingCvarKey.c_str()).c_str(), ""); diff --git a/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp index 24a909c..d0708ec 100644 --- a/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp @@ -11,7 +11,7 @@ namespace Ship { std::shared_ptr ButtonMappingFactory::CreateButtonMappingFromConfig(uint8_t portIndex, std::string id) { - const std::string mappingCvarKey = "gControllers.ButtonMappings." + id; + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".ButtonMappings." + id; const std::string mappingClass = CVarGetString(StringHelper::Sprintf("%s.ButtonMappingClass", mappingCvarKey.c_str()).c_str(), ""); CONTROLLERBUTTONS_T bitmask = diff --git a/src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp index 1052d80..89b3a12 100644 --- a/src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp @@ -9,7 +9,7 @@ namespace Ship { std::shared_ptr GyroMappingFactory::CreateGyroMappingFromConfig(uint8_t portIndex, std::string id) { - const std::string mappingCvarKey = "gControllers.GyroMappings." + id; + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".GyroMappings." + id; const std::string mappingClass = CVarGetString(StringHelper::Sprintf("%s.GyroMappingClass", mappingCvarKey.c_str()).c_str(), ""); diff --git a/src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp index 3f3f795..0adb442 100644 --- a/src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp @@ -8,7 +8,7 @@ namespace Ship { std::shared_ptr LEDMappingFactory::CreateLEDMappingFromConfig(uint8_t portIndex, std::string id) { - const std::string mappingCvarKey = "gControllers.LEDMappings." + id; + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".LEDMappings." + id; const std::string mappingClass = CVarGetString(StringHelper::Sprintf("%s.LEDMappingClass", mappingCvarKey.c_str()).c_str(), ""); diff --git a/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp index 2f7524e..e59db4b 100644 --- a/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp @@ -9,7 +9,7 @@ namespace Ship { std::shared_ptr RumbleMappingFactory::CreateRumbleMappingFromConfig(uint8_t portIndex, std::string id) { - const std::string mappingCvarKey = "gControllers.RumbleMappings." + id; + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".RumbleMappings." + id; const std::string mappingClass = CVarGetString(StringHelper::Sprintf("%s.RumbleMappingClass", mappingCvarKey.c_str()).c_str(), ""); diff --git a/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToAxisDirectionMapping.cpp b/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToAxisDirectionMapping.cpp index 33ab838..b4ec757 100644 --- a/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToAxisDirectionMapping.cpp +++ b/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToAxisDirectionMapping.cpp @@ -26,7 +26,7 @@ std::string KeyboardKeyToAxisDirectionMapping::GetAxisDirectionMappingId() { } void KeyboardKeyToAxisDirectionMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.AxisDirectionMappings." + GetAxisDirectionMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".AxisDirectionMappings." + GetAxisDirectionMappingId(); CVarSetString(StringHelper::Sprintf("%s.AxisDirectionMappingClass", mappingCvarKey.c_str()).c_str(), "KeyboardKeyToAxisDirectionMapping"); CVarSetInteger(StringHelper::Sprintf("%s.Stick", mappingCvarKey.c_str()).c_str(), mStick); @@ -36,7 +36,7 @@ void KeyboardKeyToAxisDirectionMapping::SaveToConfig() { } void KeyboardKeyToAxisDirectionMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.AxisDirectionMappings." + GetAxisDirectionMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".AxisDirectionMappings." + GetAxisDirectionMappingId(); CVarClear(StringHelper::Sprintf("%s.Stick", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.Direction", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.AxisDirectionMappingClass", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToButtonMapping.cpp b/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToButtonMapping.cpp index b6143c1..3bcf35a 100644 --- a/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToButtonMapping.cpp +++ b/src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToButtonMapping.cpp @@ -32,7 +32,7 @@ std::string KeyboardKeyToButtonMapping::GetButtonMappingId() { } void KeyboardKeyToButtonMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.ButtonMappings." + GetButtonMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".ButtonMappings." + GetButtonMappingId(); CVarSetString(StringHelper::Sprintf("%s.ButtonMappingClass", mappingCvarKey.c_str()).c_str(), "KeyboardKeyToButtonMapping"); CVarSetInteger(StringHelper::Sprintf("%s.Bitmask", mappingCvarKey.c_str()).c_str(), mBitmask); @@ -41,7 +41,7 @@ void KeyboardKeyToButtonMapping::SaveToConfig() { } void KeyboardKeyToButtonMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.ButtonMappings." + GetButtonMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".ButtonMappings." + GetButtonMappingId(); CVarClear(StringHelper::Sprintf("%s.ButtonMappingClass", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.Bitmask", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAxisDirectionMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAxisDirectionMapping.cpp index 9425916..8ff9dd7 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAxisDirectionMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAxisDirectionMapping.cpp @@ -45,7 +45,7 @@ std::string SDLAxisDirectionToAxisDirectionMapping::GetAxisDirectionMappingId() } void SDLAxisDirectionToAxisDirectionMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.AxisDirectionMappings." + GetAxisDirectionMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".AxisDirectionMappings." + GetAxisDirectionMappingId(); CVarSetString(StringHelper::Sprintf("%s.AxisDirectionMappingClass", mappingCvarKey.c_str()).c_str(), "SDLAxisDirectionToAxisDirectionMapping"); CVarSetInteger(StringHelper::Sprintf("%s.Stick", mappingCvarKey.c_str()).c_str(), mStick); @@ -58,7 +58,7 @@ void SDLAxisDirectionToAxisDirectionMapping::SaveToConfig() { } void SDLAxisDirectionToAxisDirectionMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.AxisDirectionMappings." + GetAxisDirectionMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".AxisDirectionMappings." + GetAxisDirectionMappingId(); CVarClear(StringHelper::Sprintf("%s.Stick", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.Direction", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.AxisDirectionMappingClass", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.cpp index 34e0971..75b8c7c 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.cpp @@ -56,7 +56,7 @@ std::string SDLAxisDirectionToButtonMapping::GetButtonMappingId() { } void SDLAxisDirectionToButtonMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.ButtonMappings." + GetButtonMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".ButtonMappings." + GetButtonMappingId(); CVarSetString(StringHelper::Sprintf("%s.ButtonMappingClass", mappingCvarKey.c_str()).c_str(), "SDLAxisDirectionToButtonMapping"); CVarSetInteger(StringHelper::Sprintf("%s.Bitmask", mappingCvarKey.c_str()).c_str(), mBitmask); @@ -68,7 +68,7 @@ void SDLAxisDirectionToButtonMapping::SaveToConfig() { } void SDLAxisDirectionToButtonMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.ButtonMappings." + GetButtonMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".ButtonMappings." + GetButtonMappingId(); CVarClear(StringHelper::Sprintf("%s.ButtonMappingClass", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.Bitmask", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.cpp index 0ae96c2..8971b25 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.cpp @@ -31,7 +31,7 @@ std::string SDLButtonToAxisDirectionMapping::GetAxisDirectionMappingId() { } void SDLButtonToAxisDirectionMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.AxisDirectionMappings." + GetAxisDirectionMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".AxisDirectionMappings." + GetAxisDirectionMappingId(); CVarSetString(StringHelper::Sprintf("%s.AxisDirectionMappingClass", mappingCvarKey.c_str()).c_str(), "SDLButtonToAxisDirectionMapping"); CVarSetInteger(StringHelper::Sprintf("%s.Stick", mappingCvarKey.c_str()).c_str(), mStick); @@ -43,7 +43,7 @@ void SDLButtonToAxisDirectionMapping::SaveToConfig() { } void SDLButtonToAxisDirectionMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.AxisDirectionMappings." + GetAxisDirectionMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".AxisDirectionMappings." + GetAxisDirectionMappingId(); CVarClear(StringHelper::Sprintf("%s.Stick", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.Direction", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.AxisDirectionMappingClass", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp index 1fa698b..02c198c 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp @@ -36,7 +36,7 @@ std::string SDLButtonToButtonMapping::GetButtonMappingId() { } void SDLButtonToButtonMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.ButtonMappings." + GetButtonMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".ButtonMappings." + GetButtonMappingId(); CVarSetString(StringHelper::Sprintf("%s.ButtonMappingClass", mappingCvarKey.c_str()).c_str(), "SDLButtonToButtonMapping"); CVarSetInteger(StringHelper::Sprintf("%s.Bitmask", mappingCvarKey.c_str()).c_str(), mBitmask); @@ -47,7 +47,7 @@ void SDLButtonToButtonMapping::SaveToConfig() { } void SDLButtonToButtonMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.ButtonMappings." + GetButtonMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".ButtonMappings." + GetButtonMappingId(); CVarClear(StringHelper::Sprintf("%s.ButtonMappingClass", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.Bitmask", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp index 1507911..70c8ced 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp @@ -50,7 +50,7 @@ std::string SDLGyroMapping::GetGyroMappingId() { } void SDLGyroMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.GyroMappings." + GetGyroMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".GyroMappings." + GetGyroMappingId(); CVarSetString(StringHelper::Sprintf("%s.GyroMappingClass", mappingCvarKey.c_str()).c_str(), "SDLGyroMapping"); CVarSetInteger(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str(), @@ -64,7 +64,7 @@ void SDLGyroMapping::SaveToConfig() { } void SDLGyroMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.GyroMappings." + GetGyroMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".GyroMappings." + GetGyroMappingId(); CVarClear(StringHelper::Sprintf("%s.GyroMappingClass", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLLEDMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLLEDMapping.cpp index 8e318c8..e2cce4f 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLLEDMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLLEDMapping.cpp @@ -34,7 +34,7 @@ std::string SDLLEDMapping::GetLEDMappingId() { } void SDLLEDMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.LEDMappings." + GetLEDMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".LEDMappings." + GetLEDMappingId(); CVarSetString(StringHelper::Sprintf("%s.LEDMappingClass", mappingCvarKey.c_str()).c_str(), "SDLLEDMapping"); CVarSetInteger(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str(), ControllerLEDMapping::mShipDeviceIndex); @@ -44,7 +44,7 @@ void SDLLEDMapping::SaveToConfig() { } void SDLLEDMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.LEDMappings." + GetLEDMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".LEDMappings." + GetLEDMappingId(); CVarClear(StringHelper::Sprintf("%s.LEDMappingClass", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/controldevice/controller/mapping/sdl/SDLRumbleMapping.cpp b/src/controller/controldevice/controller/mapping/sdl/SDLRumbleMapping.cpp index fef28a1..eb33d66 100644 --- a/src/controller/controldevice/controller/mapping/sdl/SDLRumbleMapping.cpp +++ b/src/controller/controldevice/controller/mapping/sdl/SDLRumbleMapping.cpp @@ -44,7 +44,7 @@ std::string SDLRumbleMapping::GetRumbleMappingId() { } void SDLRumbleMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.RumbleMappings." + GetRumbleMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".RumbleMappings." + GetRumbleMappingId(); CVarSetString(StringHelper::Sprintf("%s.RumbleMappingClass", mappingCvarKey.c_str()).c_str(), "SDLRumbleMapping"); CVarSetInteger(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str(), ControllerRumbleMapping::mShipDeviceIndex); @@ -56,7 +56,7 @@ void SDLRumbleMapping::SaveToConfig() { } void SDLRumbleMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.RumbleMappings." + GetRumbleMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".RumbleMappings." + GetRumbleMappingId(); CVarClear(StringHelper::Sprintf("%s.RumbleMappingClass", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/deviceindex/ShipDeviceIndexMappingManager.cpp b/src/controller/deviceindex/ShipDeviceIndexMappingManager.cpp index 26c49f4..8a49613 100644 --- a/src/controller/deviceindex/ShipDeviceIndexMappingManager.cpp +++ b/src/controller/deviceindex/ShipDeviceIndexMappingManager.cpp @@ -125,7 +125,7 @@ void ShipDeviceIndexMappingManager::InitializeSDLMappingsForPort(uint8_t n64port std::shared_ptr ShipDeviceIndexMappingManager::CreateDeviceIndexMappingFromConfig(std::string id) { - const std::string mappingCvarKey = "gControllers.DeviceMappings." + id; + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".DeviceMappings." + id; const std::string mappingClass = CVarGetString(StringHelper::Sprintf("%s.DeviceMappingClass", mappingCvarKey.c_str()).c_str(), ""); @@ -192,10 +192,10 @@ void ShipDeviceIndexMappingManager::UpdateControllerNamesFromConfig() { // for each controller (especially compared to include/exclude locations in rando), and // the audio editor pattern doesn't work for this because that looks for ids that are either // hardcoded or provided by an otr file - std::stringstream mappingIdsStringStream(CVarGetString("gControllers.DeviceMappingIds", "")); + std::stringstream mappingIdsStringStream(CVarGetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", "")); std::string mappingIdString; while (getline(mappingIdsStringStream, mappingIdString, ',')) { - const std::string mappingCvarKey = "gControllers.DeviceMappings." + mappingIdString; + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".DeviceMappings." + mappingIdString; const std::string mappingClass = CVarGetString(StringHelper::Sprintf("%s.DeviceMappingClass", mappingCvarKey.c_str()).c_str(), ""); @@ -588,7 +588,7 @@ void ShipDeviceIndexMappingManager::SaveMappingIdsToConfig() { // todo: this efficently (when we build out cvar array support?) std::set ids; - std::stringstream mappingIdsStringStream(CVarGetString("gControllers.DeviceMappingIds", "")); + std::stringstream mappingIdsStringStream(CVarGetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", "")); std::string mappingIdString; while (getline(mappingIdsStringStream, mappingIdString, ',')) { ids.insert(mappingIdString); @@ -605,9 +605,9 @@ void ShipDeviceIndexMappingManager::SaveMappingIdsToConfig() { } if (mappingIdListString == "") { - CVarClear("gControllers.DeviceMappingIds"); + CVarClear(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds"); } else { - CVarSetString("gControllers.DeviceMappingIds", mappingIdListString.c_str()); + CVarSetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", mappingIdListString.c_str()); } CVarSave(); @@ -622,7 +622,7 @@ ShipDeviceIndexMappingManager::GetAllDeviceIndexMappingsFromConfig() { // for each controller (especially compared to include/exclude locations in rando), and // the audio editor pattern doesn't work for this because that looks for ids that are either // hardcoded or provided by an otr file - std::stringstream mappingIdsStringStream(CVarGetString("gControllers.DeviceMappingIds", "")); + std::stringstream mappingIdsStringStream(CVarGetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", "")); std::string mappingIdString; while (getline(mappingIdsStringStream, mappingIdString, ',')) { auto mapping = CreateDeviceIndexMappingFromConfig(mappingIdString); diff --git a/src/controller/deviceindex/ShipDeviceIndexToSDLDeviceIndexMapping.cpp b/src/controller/deviceindex/ShipDeviceIndexToSDLDeviceIndexMapping.cpp index 51e115e..ff47d73 100644 --- a/src/controller/deviceindex/ShipDeviceIndexToSDLDeviceIndexMapping.cpp +++ b/src/controller/deviceindex/ShipDeviceIndexToSDLDeviceIndexMapping.cpp @@ -48,7 +48,7 @@ std::string ShipDeviceIndexToSDLDeviceIndexMapping::GetSDLControllerName() { } void ShipDeviceIndexToSDLDeviceIndexMapping::SaveToConfig() { - const std::string mappingCvarKey = "gControllers.DeviceMappings." + GetMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".DeviceMappings." + GetMappingId(); CVarSetString(StringHelper::Sprintf("%s.DeviceMappingClass", mappingCvarKey.c_str()).c_str(), "ShipDeviceIndexToSDLDeviceIndexMapping"); CVarSetInteger(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str(), mShipDeviceIndex); @@ -65,7 +65,7 @@ void ShipDeviceIndexToSDLDeviceIndexMapping::SaveToConfig() { } void ShipDeviceIndexToSDLDeviceIndexMapping::EraseFromConfig() { - const std::string mappingCvarKey = "gControllers.DeviceMappings." + GetMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".DeviceMappings." + GetMappingId(); CVarClear(StringHelper::Sprintf("%s.DeviceMappingClass", mappingCvarKey.c_str()).c_str()); CVarClear(StringHelper::Sprintf("%s.ShipDeviceIndex", mappingCvarKey.c_str()).c_str()); diff --git a/src/graphic/Fast3D/gfx_direct3d11.cpp b/src/graphic/Fast3D/gfx_direct3d11.cpp index 5712f8c..55da671 100644 --- a/src/graphic/Fast3D/gfx_direct3d11.cpp +++ b/src/graphic/Fast3D/gfx_direct3d11.cpp @@ -712,7 +712,7 @@ static void gfx_d3d11_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t const int n64modeFactor = 120; const int noVanishFactor = 100; float SSDB = -2; - switch (CVarGetInteger("gZFightingMode", 0)) { + switch (CVarGetInteger(CVAR_Z_FIGHTING_MODE, 0)) { case 1: // scaled z-fighting (N64 mode like) SSDB = -1.0f * (float)d3d.render_target_height / n64modeFactor; break; diff --git a/src/graphic/Fast3D/gfx_dxgi.cpp b/src/graphic/Fast3D/gfx_dxgi.cpp index 2c0ed2f..66b32a6 100644 --- a/src/graphic/Fast3D/gfx_dxgi.cpp +++ b/src/graphic/Fast3D/gfx_dxgi.cpp @@ -353,8 +353,8 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par break; case WM_DROPFILES: DragQueryFileA((HDROP)w_param, 0, fileName, 256); - CVarSetString("gDroppedFile", fileName); - CVarSetInteger("gNewFileDropped", 1); + CVarSetString(CVAR_DROPPED_FILE, fileName); + CVarSetInteger(CVAR_NEW_FILE_DROPPED, 1); CVarSave(); break; case WM_DISPLAYCHANGE: @@ -667,9 +667,9 @@ static bool gfx_dxgi_start_frame(void) { // dxgi.length_in_vsync_frames is used as present interval. Present interval >1 (aka fractional V-Sync) // breaks VRR and introduces even more input lag than capping via normal V-Sync does. // Get the present interval the user wants instead (V-Sync toggle). - if (dxgi.is_vsync_enabled != CVarGetInteger("gVsyncEnabled", 1)) { + if (dxgi.is_vsync_enabled != CVarGetInteger(CVAR_VSYNC_ENABLED, 1)) { // Make sure only 0 or 1 is set, as present interval technically accepts a range from 0 to 4. - dxgi.is_vsync_enabled = !!CVarGetInteger("gVsyncEnabled", 1); + dxgi.is_vsync_enabled = !!CVarGetInteger(CVAR_VSYNC_ENABLED, 1); } dxgi.length_in_vsync_frames = dxgi.is_vsync_enabled; return true; diff --git a/src/graphic/Fast3D/gfx_opengl.cpp b/src/graphic/Fast3D/gfx_opengl.cpp index ff7ce06..06ddf8e 100644 --- a/src/graphic/Fast3D/gfx_opengl.cpp +++ b/src/graphic/Fast3D/gfx_opengl.cpp @@ -795,7 +795,7 @@ static void gfx_opengl_set_zmode_decal(bool zmode_decal) { const int n64modeFactor = 120; const int noVanishFactor = 100; GLfloat SSDB = -2; - switch (CVarGetInteger("gZFightingMode", 0)) { + switch (CVarGetInteger(CVAR_Z_FIGHTING_MODE, 0)) { // scaled z-fighting (N64 mode like) case 1: if (framebuffers.size() > current_framebuffer) { // safety check for vector size can probably be removed diff --git a/src/graphic/Fast3D/gfx_pc.cpp b/src/graphic/Fast3D/gfx_pc.cpp index f52d563..9195d16 100644 --- a/src/graphic/Fast3D/gfx_pc.cpp +++ b/src/graphic/Fast3D/gfx_pc.cpp @@ -3751,9 +3751,9 @@ void gfx_init(struct GfxWindowManagerAPI* wapi, struct GfxRenderingAPI* rapi, co #ifdef __APPLE__ gfx_current_dimensions.internal_mul = 1; #else - gfx_current_dimensions.internal_mul = CVarGetFloat("gInternalResolution", 1); + gfx_current_dimensions.internal_mul = CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1); #endif - gfx_msaa_level = CVarGetInteger("gMSAAValue", 1); + gfx_msaa_level = CVarGetInteger(CVAR_MSAA_VALUE, 1); gfx_current_dimensions.width = width; gfx_current_dimensions.height = height; diff --git a/src/graphic/Fast3D/gfx_sdl2.cpp b/src/graphic/Fast3D/gfx_sdl2.cpp index 3ba0411..dc33fcb 100644 --- a/src/graphic/Fast3D/gfx_sdl2.cpp +++ b/src/graphic/Fast3D/gfx_sdl2.cpp @@ -246,9 +246,10 @@ static void set_fullscreen(bool on, bool call_callback) { SDL_SetWindowPosition(wnd, posX, posY); SDL_SetWindowSize(wnd, window_width, window_height); } - if (SDL_SetWindowFullscreen(wnd, on ? (CVarGetInteger("gSdlWindowedFullscreen", 0) ? SDL_WINDOW_FULLSCREEN_DESKTOP - : SDL_WINDOW_FULLSCREEN) - : 0) >= 0) { + if (SDL_SetWindowFullscreen(wnd, + on ? (CVarGetInteger(CVAR_SDL_WINDOWED_FULLSCREEN, 0) ? SDL_WINDOW_FULLSCREEN_DESKTOP + : SDL_WINDOW_FULLSCREEN) + : 0) >= 0) { fullscreen_state = on; } else { SPDLOG_ERROR("Failed to switch from or to fullscreen mode."); @@ -506,8 +507,8 @@ static void gfx_sdl_handle_single_event(SDL_Event& event) { } break; case SDL_DROPFILE: - CVarSetString("gDroppedFile", event.drop.file); - CVarSetInteger("gNewFileDropped", 1); + CVarSetString(CVAR_DROPPED_FILE, event.drop.file); + CVarSetInteger(CVAR_NEW_FILE_DROPPED, 1); CVarSave(); break; case SDL_QUIT: diff --git a/src/resource/ResourceManager.cpp b/src/resource/ResourceManager.cpp index cc40caa..ca9c8d0 100644 --- a/src/resource/ResourceManager.cpp +++ b/src/resource/ResourceManager.cpp @@ -61,7 +61,7 @@ ResourceManager::LoadResourceProcess(const std::string& filePath, bool loadExact // Attempt to load the alternate version of the asset, if we fail then we continue trying to load the standard // asset. - if (!loadExact && CVarGetInteger("gAltAssets", 0) && !filePath.starts_with(IResource::gAltAssetPrefix)) { + if (!loadExact && CVarGetInteger(CVAR_ALT_ASSETS, 0) && !filePath.starts_with(IResource::gAltAssetPrefix)) { const auto altPath = IResource::gAltAssetPrefix + filePath; auto altResource = LoadResourceProcess(altPath, loadExact, initData); @@ -80,7 +80,7 @@ ResourceManager::LoadResourceProcess(const std::string& filePath, bool loadExact // Check for resource load errors which can indicate an alternate asset. // If we are attempting to load an alternate asset, we can return null - if (!loadExact && CVarGetInteger("gAltAssets", 0) && filePath.starts_with(IResource::gAltAssetPrefix)) { + if (!loadExact && CVarGetInteger(CVAR_ALT_ASSETS, 0) && filePath.starts_with(IResource::gAltAssetPrefix)) { if (std::holds_alternative(cacheLine)) { try { // If we have attempted to cache an alternate asset, but failed, we return nullptr and rely on the @@ -170,7 +170,7 @@ std::shared_ptr ResourceManager::LoadResource(const std::string std::variant> ResourceManager::CheckCache(const std::string& filePath, bool loadExact) { - if (!loadExact && CVarGetInteger("gAltAssets", 0) && !filePath.starts_with(IResource::gAltAssetPrefix)) { + if (!loadExact && CVarGetInteger(CVAR_ALT_ASSETS, 0) && !filePath.starts_with(IResource::gAltAssetPrefix)) { const auto altPath = IResource::gAltAssetPrefix + filePath; auto altCacheResult = CheckCache(altPath, loadExact); diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 090f555..0b56ca6 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -89,7 +89,7 @@ void Window::Init() { mWindowManagerApi->set_fullscreen_changed_callback(OnFullscreenChanged); mWindowManagerApi->set_keyboard_callbacks(KeyDown, KeyUp, AllKeysUp); - SetTextureFilter((FilteringMode)CVarGetInteger("gTextureFilter", FILTER_THREE_POINT)); + SetTextureFilter((FilteringMode)CVarGetInteger(CVAR_TEXTURE_FILTER, FILTER_THREE_POINT)); } void Window::Close() { diff --git a/src/window/gui/GameOverlay.h b/src/window/gui/GameOverlay.h index 88529ea..b838ebf 100644 --- a/src/window/gui/GameOverlay.h +++ b/src/window/gui/GameOverlay.h @@ -12,10 +12,6 @@ namespace Ship { -#ifndef CVAR_GAME_OVERLAY_FONT -#define CVAR_GAME_OVERLAY_FONT "gOverlayFont" -#endif - enum class OverlayType { TEXT, IMAGE, NOTIFICATION }; struct Overlay { diff --git a/src/window/gui/Gui.cpp b/src/window/gui/Gui.cpp index 6a71b2c..5d545f5 100644 --- a/src/window/gui/Gui.cpp +++ b/src/window/gui/Gui.cpp @@ -58,18 +58,18 @@ namespace Ship { Gui::Gui(std::shared_ptr customInputEditorWindow) : mNeedsConsoleVariableSave(false) { mGameOverlay = std::make_shared(); - AddGuiWindow(std::make_shared("gStatsEnabled", "Stats")); + AddGuiWindow(std::make_shared(CVAR_STATS_WINDOW_OPEN, "Stats")); if (customInputEditorWindow == nullptr) { - AddGuiWindow(std::make_shared("gControllerConfigurationEnabled", "Input Editor")); + AddGuiWindow(std::make_shared(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN, "Input Editor")); } else { AddGuiWindow(customInputEditorWindow); } - AddGuiWindow(std::make_shared("gControllerDisconnectedWindowEnabled", + AddGuiWindow(std::make_shared(CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN, "Controller Disconnected")); AddGuiWindow( - std::make_shared("gControllerReorderingWindowEnabled", "Controller Reordering")); - AddGuiWindow(std::make_shared("gConsoleEnabled", "Console")); - AddGuiWindow(std::make_shared("gGfxDebuggerEnabled", "GfxDebuggerWindow")); + std::make_shared(CVAR_CONTROLLER_REORDERING_WINDOW_OPEN, "Controller Reordering")); + AddGuiWindow(std::make_shared(CVAR_CONSOLE_WINDOW_OPEN, "Console")); + AddGuiWindow(std::make_shared(CVAR_GFX_DEBUGGER_WINDOW_OPEN, "GfxDebuggerWindow")); } Gui::Gui() : Gui(nullptr) { @@ -111,11 +111,11 @@ void Gui::Init(GuiWindowInitData windowImpl) { mImGuiIo->IniFilename = strcpy(new char[imguiIniPath.length() + 1], imguiIniPath.c_str()); mImGuiIo->LogFilename = strcpy(new char[imguiLogPath.length() + 1], imguiLogPath.c_str()); - if (SupportsViewports() && CVarGetInteger("gEnableMultiViewports", 1)) { + if (SupportsViewports() && CVarGetInteger(CVAR_ENABLE_MULTI_VIEWPORTS, 1)) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; } - if (CVarGetInteger("gControlNav", 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { + if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } else { mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad; @@ -134,8 +134,8 @@ void Gui::Init(GuiWindowInitData windowImpl) { ImGuiWMInit(); ImGuiBackendInit(); - CVarClear("gNewFileDropped"); - CVarClear("gDroppedFile"); + CVarClear(CVAR_NEW_FILE_DROPPED); + CVarClear(CVAR_DROPPED_FILE); } void Gui::ImGuiWMInit() { @@ -258,7 +258,7 @@ void Gui::BlockImGuiGamepadNavigation() { } void Gui::UnblockImGuiGamepadNavigation() { - if (CVarGetInteger("gControlNav", 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { + if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } } @@ -306,12 +306,13 @@ void Gui::DrawMenu() { ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_NoDockingInCentralNode); - if (ImGui::IsKeyPressed(TOGGLE_BTN) || (ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && CVarGetInteger("gControlNav", 0))) { + if (ImGui::IsKeyPressed(TOGGLE_BTN) || + (ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0))) { GetMenuBar()->ToggleVisibility(); if (wnd->IsFullscreen()) { Context::GetInstance()->GetWindow()->SetCursorVisibility(GetMenuBar() && GetMenuBar()->IsVisible()); } - if (CVarGetInteger("gControlNav", 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { + if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } else { mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad; @@ -366,11 +367,11 @@ void Gui::DrawMenu() { gfx_current_game_window_viewport.width = (int16_t)size.x; gfx_current_game_window_viewport.height = (int16_t)size.y; - if (CVarGetInteger("gAdvancedResolution.Enabled", 0)) { + if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0)) { ApplyResolutionChanges(); } - switch (CVarGetInteger("gLowResMode", 0)) { + switch (CVarGetInteger(CVAR_LOW_RES_MODE, 0)) { case 1: { // N64 Mode gfx_current_dimensions.width = 320; gfx_current_dimensions.height = 240; @@ -440,10 +441,11 @@ void Gui::ImGuiWMNewFrame() { void Gui::ApplyResolutionChanges() { ImVec2 size = ImGui::GetContentRegionAvail(); - const float aspectRatioX = CVarGetFloat("gAdvancedResolution.AspectRatioX", 16.0f); - const float aspectRatioY = CVarGetFloat("gAdvancedResolution.AspectRatioY", 9.0f); - const uint32_t verticalPixelCount = CVarGetInteger("gAdvancedResolution.VerticalPixelCount", 480); - const bool verticalResolutionToggle = CVarGetInteger("gAdvancedResolution.VerticalResolutionToggle", 0); + const float aspectRatioX = CVarGetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", 16.0f); + const float aspectRatioY = CVarGetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", 9.0f); + const uint32_t verticalPixelCount = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", 480); + const bool verticalResolutionToggle = + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0); const bool aspectRatioIsEnabled = (aspectRatioX > 0.0f) && (aspectRatioY > 0.0f); @@ -492,10 +494,10 @@ void Gui::ApplyResolutionChanges() { } int16_t Gui::GetIntegerScaleFactor() { - if (!CVarGetInteger("gAdvancedResolution.IntegerScale.FitAutomatically", 0)) { - int16_t factor = CVarGetInteger("gAdvancedResolution.IntegerScale.Factor", 1); + if (!CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0)) { + int16_t factor = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", 1); - if (CVarGetInteger("gAdvancedResolution.IntegerScale.NeverExceedBounds", 1)) { + if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.NeverExceedBounds", 1)) { // Screen bounds take priority over whatever Factor is set to. // The same comparison as below, but checked against the configured factor @@ -531,7 +533,7 @@ int16_t Gui::GetIntegerScaleFactor() { } // Add screen bounds offset, if set. - factor += CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0); + factor += CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0); if (factor < 1) { factor = 1; @@ -544,13 +546,13 @@ void Gui::StartFrame() { const ImVec2 mainPos = ImGui::GetWindowPos(); ImVec2 size = ImGui::GetContentRegionAvail(); ImVec2 pos = ImVec2(0, 0); - if (CVarGetInteger("gLowResMode", 0) == 1) { // N64 Mode takes priority + if (CVarGetInteger(CVAR_LOW_RES_MODE, 0) == 1) { // N64 Mode takes priority const float sw = size.y * 320.0f / 240.0f; pos = ImVec2(floor(size.x / 2 - sw / 2), 0); size = ImVec2(sw, size.y); - } else if (CVarGetInteger("gAdvancedResolution.Enabled", 0)) { - if (!CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0)) { - if (!CVarGetInteger("gAdvancedResolution.IgnoreAspectCorrection", 0)) { + } else if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0)) { + if (!CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0)) { + if (!CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", 0)) { float sWdth = size.y * gfx_current_dimensions.width / gfx_current_dimensions.height; float sHght = size.x * gfx_current_dimensions.height / gfx_current_dimensions.width; float sPosX = floor(size.x / 2.0f - sWdth / 2.0f); diff --git a/src/window/gui/Gui.h b/src/window/gui/Gui.h index f01015c..f0bf3db 100644 --- a/src/window/gui/Gui.h +++ b/src/window/gui/Gui.h @@ -4,6 +4,7 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif + #include #include #include