Skip to content

Commit

Permalink
InputManager: fix issue with A/B/Start/Back in non-debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Jan 10, 2025
1 parent f3ac58a commit 70b7f42
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/input_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,17 @@ class InputManager
if (!std::filesystem::exists(iniPath))
return false;

spdlog::info(__FUNCTION__ " - reading INI from {}", iniPath.string());

std::vector<std::pair<std::string, std::string>> pad_binds;
std::vector<std::pair<std::string, std::string>> key_binds;

std::ifstream file(iniPath);
if (!file || !file.is_open())
{
spdlog::error(__FUNCTION__ " - failed to read INI, using defaults");
return false;
}

std::string line;
bool inBindingSection = false;
Expand Down Expand Up @@ -541,7 +546,12 @@ class InputManager
file.close();

if (key_binds.size() <= 0 && pad_binds.size() <= 0)
{
spdlog::error(__FUNCTION__ " - failed to read binds from INI, using defaults");
return false;
}

spdlog::info(__FUNCTION__ " - {} key binds, {} pad binds", key_binds.size(), pad_binds.size());

// we have binds, reset any of our defaults

Expand Down Expand Up @@ -571,7 +581,7 @@ class InputManager
SwitchId switchId = SwitchId::Count;

// is this a volume?
for (int i = 0; i < int(ADChannel::Count); i++)
for (int i = 0; i < 3; i++)
{
if (!stricmp(actionName.c_str(), volumeNames[i].c_str()))
{
Expand Down Expand Up @@ -624,7 +634,7 @@ class InputManager
SwitchId switchId = SwitchId::Count;

// Check if it's a volume action
for (int i = 0; i < int(ADChannel::Count); i++)
for (int i = 0; i < 3; i++)
{
if (!stricmp(actionName.c_str(), volumeNames[i].c_str()))
{
Expand Down

0 comments on commit 70b7f42

Please sign in to comment.