From 902d89cffbe3a0f7f80028e3983add5a7fcd2a77 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sun, 28 Apr 2024 18:40:17 -0700 Subject: [PATCH] PR feedback changes. --- CMakeLists.txt | 2 - cmake/cvars.cmake | 42 +++++++++--------- src/CMakeLists.txt | 2 + src/controller/controldeck/ControlDeck.cpp | 3 +- .../controldevice/controller/Controller.cpp | 4 +- .../controldevice/controller/Controller.h | 4 -- .../controller/ControllerButton.cpp | 8 ++-- .../controller/ControllerGyro.cpp | 8 ++-- .../controller/ControllerLED.cpp | 6 +-- .../controller/ControllerRumble.cpp | 8 ++-- .../controller/ControllerStick.cpp | 20 ++++----- .../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 +- .../LUSDeviceIndexMappingManager.cpp | 20 ++++----- .../LUSDeviceIndexToSDLDeviceIndexMapping.cpp | 4 +- src/window/Window.cpp | 2 +- src/window/gui/ConsoleWindow.cpp | 2 +- src/window/gui/Gui.cpp | 44 +++++++++---------- 30 files changed, 109 insertions(+), 116 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ec43efe1..63ab7236e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,6 @@ option(NON_PORTABLE "Build a non-portable version" OFF) project(libultraship LANGUAGES C CXX) -include(cmake/cvars.cmake) - if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") enable_language(OBJCXX) set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -fobjc-arc") diff --git a/cmake/cvars.cmake b/cmake/cvars.cmake index b41905416..cebfe39d0 100644 --- a/cmake/cvars.cmake +++ b/cmake/cvars.cmake @@ -6,22 +6,21 @@ 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_CONTROL_NAV "gControlNav" CACHE STRING "") -set(CVAR_CONSOLE_ENABLED "gConsoleEnabled" CACHE STRING "") -set(CVAR_CONTROLLER_CONFIGURATION_ENABLED "gControllerConfigurationEnabled" CACHE STRING "") -set(CVAR_CONTROLLER_DISCONNECTED_ENABLED "gControllerDisconnectedWindowEnabled" CACHE STRING "") -set(CVAR_CONTROLLER_REORDERING_ENABLED "gControllerReorderingWindowEnabled" CACHE STRING "") -set(CVAR_GFX_DEBUGGER_ENABLED "gGfxDebuggerEnabled" CACHE STRING "") -set(CVAR_STATS_ENABLED "gStatsEnabled" 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_SINK_ENABLED "gSinkEnabled" CACHE STRING "") set(CVAR_GAME_OVERLAY_FONT "gOverlayFont" CACHE STRING "") -set(CVAR_OPEN_MENU_BAR "gOpenMenuBar" CACHE STRING "") -set(CVAR_BLOCK_CONTROLLERS "gControllers" CACHE STRING "") -set(CVAR_BLOCK_ADVANCED_RESOLUTION "gAdvancedResolution" 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}" @@ -31,20 +30,19 @@ add_compile_definitions( CVAR_MSAA_VALUE="${CVAR_MSAA_VALUE}" CVAR_SDL_WINDOWED_FULLSCREEN="${CVAR_SDL_WINDOWED_FULLSCREEN}" CVAR_TEXTURE_FILTER="${CVAR_TEXTURE_FILTER}" - CVAR_CONTROL_NAV="${CVAR_CONTROL_NAV}" - CVAR_CONSOLE_ENABLED="${CVAR_CONSOLE_ENABLED}" - CVAR_CONTROLLER_CONFIGURATION_ENABLED="${CVAR_CONTROLLER_CONFIGURATION_ENABLED}" - CVAR_CONTROLLER_DISCONNECTED_ENABLED="${CVAR_CONTROLLER_DISCONNECTED_ENABLED}" - CVAR_CONTROLLER_REORDERING_ENABLED="${CVAR_CONTROLLER_REORDERING_ENABLED}" - CVAR_GFX_DEBUGGER_ENABLED="${CVAR_GFX_DEBUGGER_ENABLED}" - CVAR_STATS_ENABLED="${CVAR_STATS_ENABLED}" + 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_SINK_ENABLED="${CVAR_SINK_ENABLED}" CVAR_GAME_OVERLAY_FONT="${CVAR_GAME_OVERLAY_FONT}" - CVAR_OPEN_MENU_BAR="${CVAR_OPEN_MENU_BAR}" - CVAR_BLOCK_CONTROLLERS="${CVAR_BLOCK_CONTROLLERS}" - CVAR_BLOCK_ADVANCED_RESOLUTION="${CVAR_BLOCK_ADVANCED_RESOLUTION}" + 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 7a46cf1e2..dec037ca4 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 ee54372d7..4808d1d79 100644 --- a/src/controller/controldeck/ControlDeck.cpp +++ b/src/controller/controldeck/ControlDeck.cpp @@ -9,7 +9,6 @@ #endif #include #include "controller/deviceindex/LUSDeviceIndexMappingManager.h" -#include "window/gui/Gui.h" namespace LUS { @@ -70,7 +69,7 @@ bool ControlDeck::AllGameInputBlocked() { bool ControlDeck::GamepadGameInputBlocked() { // block controller input when using the controller to navigate imgui menus - return AllGameInputBlocked() || (CVarGetInteger(CVAR_OPEN_MENU_BAR, 0) && CVarGetInteger(CVAR_CONTROL_NAV, 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 6639ef539..c070d3fa1 100644 --- a/src/controller/controldevice/controller/Controller.cpp +++ b/src/controller/controldevice/controller/Controller.cpp @@ -70,7 +70,7 @@ uint8_t Controller::GetPortIndex() { } bool Controller::HasConfig() { - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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 +108,7 @@ void Controller::AddDefaultMappings(LUSDeviceIndex lusDeviceIndex) { GetLeftStick()->AddDefaultMappings(lusDeviceIndex); GetRumble()->AddDefaultMappings(lusDeviceIndex); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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(); } diff --git a/src/controller/controldevice/controller/Controller.h b/src/controller/controldevice/controller/Controller.h index d377c1cf7..ca4c1a513 100644 --- a/src/controller/controldevice/controller/Controller.h +++ b/src/controller/controldevice/controller/Controller.h @@ -18,10 +18,6 @@ #include "controller/controldevice/ControlDevice.h" #include "controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h" -#ifndef CVAR_SIMULATED_INPUT_LAG -#define CVAR_SIMULATED_INPUT_LAG "gSimulatedInputLag" -#endif - namespace LUS { class Controller : public ControlDevice { diff --git a/src/controller/controldevice/controller/ControllerButton.cpp b/src/controller/controldevice/controller/ControllerButton.cpp index 45e455243..40c097172 100644 --- a/src/controller/controldevice/controller/ControllerButton.cpp +++ b/src/controller/controldevice/controller/ControllerButton.cpp @@ -106,7 +106,7 @@ void ControllerButton::SaveButtonMappingIdsToConfig() { } const std::string buttonMappingIdsCvarKey = StringHelper::Sprintf( - CVAR_BLOCK_CONTROLLERS ".Port%d.Buttons.%sButtonMappingIds", mPortIndex + 1, GetConfigNameFromBitmask(mBitmask).c_str()); + CVAR_PREFIX_CONTROLLERS ".Port%d.Buttons.%sButtonMappingIds", mPortIndex + 1, GetConfigNameFromBitmask(mBitmask).c_str()); if (buttonMappingIdListString == "") { CVarClear(buttonMappingIdsCvarKey.c_str()); } else { @@ -125,7 +125,7 @@ void ControllerButton::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 buttonMappingIdsCvarKey = StringHelper::Sprintf( - CVAR_BLOCK_CONTROLLERS ".Port%d.Buttons.%sButtonMappingIds", mPortIndex + 1, GetConfigNameFromBitmask(mBitmask).c_str()); + 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, ',')) { @@ -186,7 +186,7 @@ bool ControllerButton::AddOrEditButtonMappingFromRawPress(CONTROLLERBUTTONS_T bi AddButtonMapping(mapping); mapping->SaveToConfig(); SaveButtonMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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; @@ -229,7 +229,7 @@ bool ControllerButton::AddOrEditButtonMappingFromRawPress(CONTROLLERBUTTONS_T bi AddButtonMapping(mapping); mapping->SaveToConfig(); SaveButtonMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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 8234b826f..be6ed03b9 100644 --- a/src/controller/controldevice/controller/ControllerGyro.cpp +++ b/src/controller/controldevice/controller/ControllerGyro.cpp @@ -32,7 +32,7 @@ bool ControllerGyro::SetGyroMappingFromRawPress() { SetGyroMapping(mapping); mapping->SaveToConfig(); SaveGyroMappingIdToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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; @@ -50,7 +50,7 @@ bool ControllerGyro::SetGyroMappingFromRawPress() { SetGyroMapping(mapping); mapping->SaveToConfig(); SaveGyroMappingIdToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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; @@ -67,7 +67,7 @@ void ControllerGyro::UpdatePad(float& x, float& y) { void ControllerGyro::SaveGyroMappingIdToConfig() { const std::string gyroMappingIdCvarKey = - StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".Port%d.Gyro.GyroMappingId", mPortIndex + 1); + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.Gyro.GyroMappingId", mPortIndex + 1); if (mGyroMapping == nullptr) { CVarClear(gyroMappingIdCvarKey.c_str()); @@ -90,7 +90,7 @@ void ControllerGyro::ClearGyroMapping() { void ControllerGyro::ReloadGyroMappingFromConfig() { const std::string gyroMappingIdCvarKey = - StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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 636a7105a..8e480175c 100644 --- a/src/controller/controldevice/controller/ControllerLED.cpp +++ b/src/controller/controldevice/controller/ControllerLED.cpp @@ -28,7 +28,7 @@ void ControllerLED::SaveLEDMappingIdsToConfig() { ledMappingIdListString += ","; } - const std::string ledMappingIdsCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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 +97,7 @@ 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(CVAR_BLOCK_CONTROLLERS ".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, ',')) { @@ -138,7 +138,7 @@ bool ControllerLED::AddLEDMappingFromRawPress() { AddLEDMapping(mapping); mapping->SaveToConfig(); SaveLEDMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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 834171f85..6892f18db 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(CVAR_BLOCK_CONTROLLERS ".Port%d.RumbleMappingIds", mPortIndex + 1); + StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.RumbleMappingIds", mPortIndex + 1); if (rumbleMappingIdListString == "") { CVarClear(rumbleMappingIdsCvarKey.c_str()); } else { @@ -128,7 +128,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(CVAR_BLOCK_CONTROLLERS ".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, ',')) { @@ -153,7 +153,7 @@ bool ControllerRumble::AddRumbleMappingFromRawPress() { AddRumbleMapping(mapping); mapping->SaveToConfig(); SaveRumbleMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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; @@ -171,7 +171,7 @@ bool ControllerRumble::AddRumbleMappingFromRawPress() { AddRumbleMapping(mapping); mapping->SaveToConfig(); SaveRumbleMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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 d5e61873f..5ad818147 100644 --- a/src/controller/controldevice/controller/ControllerStick.cpp +++ b/src/controller/controldevice/controller/ControllerStick.cpp @@ -88,7 +88,7 @@ void ControllerStick::SaveAxisDirectionMappingIdsToConfig() { } const std::string axisDirectionMappingIdsCvarKey = StringHelper::Sprintf( - CVAR_BLOCK_CONTROLLERS ".Port%d.%s.%sAxisDirectionMappingIds", mPortIndex + 1, stickToConfigStickName[mStick].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()); @@ -177,7 +177,7 @@ void ControllerStick::ReloadAllMappingsFromConfig() { // hardcoded or provided by an otr file for (auto direction : { LEFT, RIGHT, UP, DOWN }) { const std::string axisDirectionMappingIdsCvarKey = StringHelper::Sprintf( - CVAR_BLOCK_CONTROLLERS ".Port%d.%s.%sAxisDirectionMappingIds", mPortIndex + 1, stickToConfigStickName[mStick].c_str(), + CVAR_PREFIX_CONTROLLERS ".Port%d.%s.%sAxisDirectionMappingIds", mPortIndex + 1, stickToConfigStickName[mStick].c_str(), directionToConfigDirectionName[direction].c_str()); std::stringstream axisDirectionMappingIdsStringStream( @@ -188,17 +188,17 @@ void ControllerStick::ReloadAllMappingsFromConfig() { } } - SetSensitivity(CVarGetInteger(StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".Port%d.%s.SensitivityPercentage", mPortIndex + 1, + 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(CVAR_BLOCK_CONTROLLERS ".Port%d.%s.DeadzonePercentage", mPortIndex + 1, + 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(CVAR_BLOCK_CONTROLLERS ".Port%d.%s.NotchSnapAngle", mPortIndex + 1, + SetNotchSnapAngle(CVarGetInteger(StringHelper::Sprintf(CVAR_PREFIX_CONTROLLERS ".Port%d.%s.NotchSnapAngle", mPortIndex + 1, stickToConfigStickName[mStick].c_str()) .c_str(), 0)); @@ -293,7 +293,7 @@ bool ControllerStick::AddOrEditAxisDirectionMappingFromRawPress(Direction direct AddAxisDirectionMapping(direction, mapping); mapping->SaveToConfig(); SaveAxisDirectionMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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; @@ -326,7 +326,7 @@ bool ControllerStick::AddOrEditAxisDirectionMappingFromRawPress(Direction direct AddAxisDirectionMapping(direction, mapping); mapping->SaveToConfig(); SaveAxisDirectionMappingIdsToConfig(); - const std::string hasConfigCvarKey = StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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; @@ -377,7 +377,7 @@ bool ControllerStick::ProcessKeyboardEvent(LUS::KbEventType eventType, LUS::KbSc void ControllerStick::SetSensitivity(uint8_t sensitivityPercentage) { mSensitivityPercentage = sensitivityPercentage; mSensitivity = sensitivityPercentage / 100.0f; - CVarSetInteger(StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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); @@ -399,7 +399,7 @@ bool ControllerStick::SensitivityIsDefault() { void ControllerStick::SetDeadzone(uint8_t deadzonePercentage) { mDeadzonePercentage = deadzonePercentage; mDeadzone = MAX_AXIS_RANGE * (deadzonePercentage / 100.0f); - CVarSetInteger(StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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); @@ -420,7 +420,7 @@ bool ControllerStick::DeadzoneIsDefault() { void ControllerStick::SetNotchSnapAngle(uint8_t notchSnapAngle) { mNotchSnapAngle = notchSnapAngle; - CVarSetInteger(StringHelper::Sprintf(CVAR_BLOCK_CONTROLLERS ".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 de0fe38b0..ed48d534a 100644 --- a/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp @@ -17,7 +17,7 @@ namespace LUS { std::shared_ptr AxisDirectionMappingFactory::CreateAxisDirectionMappingFromConfig(uint8_t portIndex, Stick stick, std::string id) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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 c1b1d6a6d..83ec47c06 100644 --- a/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp @@ -16,7 +16,7 @@ namespace LUS { std::shared_ptr ButtonMappingFactory::CreateButtonMappingFromConfig(uint8_t portIndex, std::string id) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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 679937513..fbe07a974 100644 --- a/src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp @@ -13,7 +13,7 @@ namespace LUS { std::shared_ptr GyroMappingFactory::CreateGyroMappingFromConfig(uint8_t portIndex, std::string id) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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 26d9cf576..5f1c19cd6 100644 --- a/src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp @@ -11,7 +11,7 @@ namespace LUS { std::shared_ptr LEDMappingFactory::CreateLEDMappingFromConfig(uint8_t portIndex, std::string id) { #ifndef __WIIU__ - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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 8f066df71..5d02dbb82 100644 --- a/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp @@ -13,7 +13,7 @@ namespace LUS { std::shared_ptr RumbleMappingFactory::CreateRumbleMappingFromConfig(uint8_t portIndex, std::string id) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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 53c2223a0..a70048074 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 = CVAR_BLOCK_CONTROLLERS ".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 = CVAR_BLOCK_CONTROLLERS ".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 493e614ea..f69e5405d 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 = CVAR_BLOCK_CONTROLLERS ".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 = CVAR_BLOCK_CONTROLLERS ".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 0bdd2b08c..5b6192ca5 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 = CVAR_BLOCK_CONTROLLERS ".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 = CVAR_BLOCK_CONTROLLERS ".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 d5744f8db..375715465 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 = CVAR_BLOCK_CONTROLLERS ".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 = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", 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 b5c6a9c76..82b28fa21 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 = CVAR_BLOCK_CONTROLLERS ".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 = CVAR_BLOCK_CONTROLLERS ".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 cd210bd38..2d9b8ad4e 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 = CVAR_BLOCK_CONTROLLERS ".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 = CVAR_BLOCK_CONTROLLERS ".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 fe91dd96a..6cfc45faf 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 = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", mappingCvarKey.c_str()).c_str(), @@ -64,7 +64,7 @@ void SDLGyroMapping::SaveToConfig() { } void SDLGyroMapping::EraseFromConfig() { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", 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 ff21b4228..989ccc09e 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 = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", mappingCvarKey.c_str()).c_str(), ControllerLEDMapping::mLUSDeviceIndex); @@ -44,7 +44,7 @@ void SDLLEDMapping::SaveToConfig() { } void SDLLEDMapping::EraseFromConfig() { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", 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 da5898db4..2486b902e 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 = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", mappingCvarKey.c_str()).c_str(), ControllerRumbleMapping::mLUSDeviceIndex); @@ -56,7 +56,7 @@ void SDLRumbleMapping::SaveToConfig() { } void SDLRumbleMapping::EraseFromConfig() { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", mappingCvarKey.c_str()).c_str()); diff --git a/src/controller/deviceindex/LUSDeviceIndexMappingManager.cpp b/src/controller/deviceindex/LUSDeviceIndexMappingManager.cpp index 9a13f3bf0..eca79dca5 100644 --- a/src/controller/deviceindex/LUSDeviceIndexMappingManager.cpp +++ b/src/controller/deviceindex/LUSDeviceIndexMappingManager.cpp @@ -142,7 +142,7 @@ bool LUSDeviceIndexMappingManager::IsValidWiiUExtensionType(int32_t extensionTyp std::shared_ptr LUSDeviceIndexMappingManager::CreateDeviceIndexMappingFromConfig(std::string id) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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(), ""); @@ -181,10 +181,10 @@ void LUSDeviceIndexMappingManager::UpdateExtensionTypesFromConfig() { // 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(CVAR_BLOCK_CONTROLLERS ".DeviceMappingIds", "")); + std::stringstream mappingIdsStringStream(CVarGetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", "")); std::string mappingIdString; while (getline(mappingIdsStringStream, mappingIdString, ',')) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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(), ""); @@ -320,7 +320,7 @@ void LUSDeviceIndexMappingManager::InitializeSDLMappingsForPort(uint8_t n64port, std::shared_ptr LUSDeviceIndexMappingManager::CreateDeviceIndexMappingFromConfig(std::string id) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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(), ""); @@ -387,10 +387,10 @@ void LUSDeviceIndexMappingManager::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(CVAR_BLOCK_CONTROLLERS ".DeviceMappingIds", "")); + std::stringstream mappingIdsStringStream(CVarGetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", "")); std::string mappingIdString; while (getline(mappingIdsStringStream, mappingIdString, ',')) { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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(), ""); @@ -784,7 +784,7 @@ void LUSDeviceIndexMappingManager::SaveMappingIdsToConfig() { // todo: this efficently (when we build out cvar array support?) std::set ids; - std::stringstream mappingIdsStringStream(CVarGetString(CVAR_BLOCK_CONTROLLERS ".DeviceMappingIds", "")); + std::stringstream mappingIdsStringStream(CVarGetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", "")); std::string mappingIdString; while (getline(mappingIdsStringStream, mappingIdString, ',')) { ids.insert(mappingIdString); @@ -801,9 +801,9 @@ void LUSDeviceIndexMappingManager::SaveMappingIdsToConfig() { } if (mappingIdListString == "") { - CVarClear(CVAR_BLOCK_CONTROLLERS ".DeviceMappingIds"); + CVarClear(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds"); } else { - CVarSetString(CVAR_BLOCK_CONTROLLERS ".DeviceMappingIds", mappingIdListString.c_str()); + CVarSetString(CVAR_PREFIX_CONTROLLERS ".DeviceMappingIds", mappingIdListString.c_str()); } CVarSave(); @@ -818,7 +818,7 @@ LUSDeviceIndexMappingManager::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(CVAR_BLOCK_CONTROLLERS ".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/LUSDeviceIndexToSDLDeviceIndexMapping.cpp b/src/controller/deviceindex/LUSDeviceIndexToSDLDeviceIndexMapping.cpp index dae9633fd..2a452dba9 100644 --- a/src/controller/deviceindex/LUSDeviceIndexToSDLDeviceIndexMapping.cpp +++ b/src/controller/deviceindex/LUSDeviceIndexToSDLDeviceIndexMapping.cpp @@ -48,7 +48,7 @@ std::string LUSDeviceIndexToSDLDeviceIndexMapping::GetSDLControllerName() { } void LUSDeviceIndexToSDLDeviceIndexMapping::SaveToConfig() { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".DeviceMappings." + GetMappingId(); + const std::string mappingCvarKey = CVAR_PREFIX_CONTROLLERS ".DeviceMappings." + GetMappingId(); CVarSetString(StringHelper::Sprintf("%s.DeviceMappingClass", mappingCvarKey.c_str()).c_str(), "LUSDeviceIndexToSDLDeviceIndexMapping"); CVarSetInteger(StringHelper::Sprintf("%s.LUSDeviceIndex", mappingCvarKey.c_str()).c_str(), mLUSDeviceIndex); @@ -65,7 +65,7 @@ void LUSDeviceIndexToSDLDeviceIndexMapping::SaveToConfig() { } void LUSDeviceIndexToSDLDeviceIndexMapping::EraseFromConfig() { - const std::string mappingCvarKey = CVAR_BLOCK_CONTROLLERS ".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.LUSDeviceIndex", mappingCvarKey.c_str()).c_str()); diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 4ee637920..87b0c315b 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -106,7 +106,7 @@ void Window::Init() { #ifndef __WIIU__ mWindowManagerApi->set_keyboard_callbacks(KeyDown, KeyUp, AllKeysUp); #endif - 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/ConsoleWindow.cpp b/src/window/gui/ConsoleWindow.cpp index 09ebdbb1d..a5cdb194b 100644 --- a/src/window/gui/ConsoleWindow.cpp +++ b/src/window/gui/ConsoleWindow.cpp @@ -319,7 +319,7 @@ void ConsoleWindow::DrawElement() { mLog[mCurrentChannel].clear(); } - if (CVarGetInteger(CVAR_SINK_ENABLED, 0)) { + if (CVarGetInteger("gSinkEnabled", 0)) { ImGui::SameLine(); ImGui::SetNextItemWidth(150); if (ImGui::BeginCombo("##channel", mCurrentChannel.c_str())) { diff --git a/src/window/gui/Gui.cpp b/src/window/gui/Gui.cpp index 39235624f..34cbb886b 100644 --- a/src/window/gui/Gui.cpp +++ b/src/window/gui/Gui.cpp @@ -72,18 +72,18 @@ namespace LUS { Gui::Gui(std::shared_ptr customInputEditorWindow) : mNeedsConsoleVariableSave(false) { mGameOverlay = std::make_shared(); - AddGuiWindow(std::make_shared(CVAR_STATS_ENABLED, "Stats")); + AddGuiWindow(std::make_shared(CVAR_STATS_WINDOW_OPEN, "Stats")); if (customInputEditorWindow == nullptr) { - AddGuiWindow(std::make_shared(CVAR_CONTROLLER_CONFIGURATION_ENABLED, "Input Editor")); + AddGuiWindow(std::make_shared(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN, "Input Editor")); } else { AddGuiWindow(customInputEditorWindow); } - AddGuiWindow(std::make_shared(CVAR_CONTROLLER_DISCONNECTED_ENABLED, + AddGuiWindow(std::make_shared(CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN, "Controller Disconnected")); AddGuiWindow( - std::make_shared(CVAR_CONTROLLER_REORDERING_ENABLED, "Controller Reordering")); - AddGuiWindow(std::make_shared(CVAR_CONSOLE_ENABLED, "Console")); - AddGuiWindow(std::make_shared(CVAR_GFX_DEBUGGER_ENABLED, "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) { @@ -143,7 +143,7 @@ void Gui::Init(GuiWindowInitData windowImpl) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; } - if (CVarGetInteger(CVAR_CONTROL_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { + if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } else { mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad; @@ -317,7 +317,7 @@ void Gui::BlockImGuiGamepadNavigation() { } void Gui::UnblockImGuiGamepadNavigation() { - if (CVarGetInteger(CVAR_CONTROL_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { + if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } } @@ -365,12 +365,12 @@ 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(CVAR_CONTROL_NAV, 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(CVAR_CONTROL_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { + if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && GetMenuBar() && GetMenuBar()->IsVisible()) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } else { mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad; @@ -425,7 +425,7 @@ 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(CVAR_BLOCK_ADVANCED_RESOLUTION ".Enabled", 0)) { + if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0)) { ApplyResolutionChanges(); } @@ -507,10 +507,10 @@ void Gui::ImGuiWMNewFrame() { void Gui::ApplyResolutionChanges() { ImVec2 size = ImGui::GetContentRegionAvail(); - const float aspectRatioX = CVarGetFloat(CVAR_BLOCK_ADVANCED_RESOLUTION ".AspectRatioX", 16.0f); - const float aspectRatioY = CVarGetFloat(CVAR_BLOCK_ADVANCED_RESOLUTION ".AspectRatioY", 9.0f); - const uint32_t verticalPixelCount = CVarGetInteger(CVAR_BLOCK_ADVANCED_RESOLUTION ".VerticalPixelCount", 480); - const bool verticalResolutionToggle = CVarGetInteger(CVAR_BLOCK_ADVANCED_RESOLUTION ".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); @@ -559,10 +559,10 @@ void Gui::ApplyResolutionChanges() { } int16_t Gui::GetIntegerScaleFactor() { - if (!CVarGetInteger(CVAR_BLOCK_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0)) { - int16_t factor = CVarGetInteger(CVAR_BLOCK_ADVANCED_RESOLUTION ".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(CVAR_BLOCK_ADVANCED_RESOLUTION ".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 @@ -598,7 +598,7 @@ int16_t Gui::GetIntegerScaleFactor() { } // Add screen bounds offset, if set. - factor += CVarGetInteger(CVAR_BLOCK_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0); + factor += CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0); if (factor < 1) { factor = 1; @@ -615,9 +615,9 @@ void Gui::StartFrame() { 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(CVAR_BLOCK_ADVANCED_RESOLUTION ".Enabled", 0)) { - if (!CVarGetInteger(CVAR_BLOCK_ADVANCED_RESOLUTION ".PixelPerfectMode", 0)) { - if (!CVarGetInteger(CVAR_BLOCK_ADVANCED_RESOLUTION ".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);