Skip to content

Commit

Permalink
PR feedback changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Malkierian committed Apr 29, 2024
1 parent c7ea38f commit 902d89c
Show file tree
Hide file tree
Showing 30 changed files with 109 additions and 116 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
42 changes: 20 additions & 22 deletions cmake/cvars.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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}"
)
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/controller/controldeck/ControlDeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#endif
#include <imgui.h>
#include "controller/deviceindex/LUSDeviceIndexMappingManager.h"
#include "window/gui/Gui.h"

namespace LUS {

Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/controller/controldevice/controller/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
}
Expand Down
4 changes: 0 additions & 4 deletions src/controller/controldevice/controller/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/controller/controldevice/controller/ControllerButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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, ',')) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/controller/controldevice/controller/ControllerGyro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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());
Expand All @@ -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 == "") {
Expand Down
6 changes: 3 additions & 3 deletions src/controller/controldevice/controller/ControllerLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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, ',')) {
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/controller/controldevice/controller/ControllerRumble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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, ',')) {
Expand All @@ -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;
Expand All @@ -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;
Expand Down
20 changes: 10 additions & 10 deletions src/controller/controldevice/controller/ControllerStick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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(
Expand All @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Loading

0 comments on commit 902d89c

Please sign in to comment.