Skip to content

Commit

Permalink
Merge pull request #18711 from hrydgard/fix-analog-speed-crash
Browse files Browse the repository at this point in the history
Don't crash after mapping analog speed to a stick.
  • Loading branch information
hrydgard committed Jan 17, 2024
2 parents feaf7ce + e1b1ae4 commit 72c4d34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Core/KeyMap.cpp
Expand Up @@ -553,12 +553,16 @@ bool InputMappingsFromPspButtonNoLock(int btn, std::vector<MultiInputMapping> *m
return false;
}
bool mapped = false;
mappings->clear();
if (mappings) {
mappings->clear();
}
for (auto &iter2 : iter->second) {
bool ignore = ignoreMouse && iter2.HasMouse();
if (mappings && !ignore) {
if (!ignore) {
mapped = true;
mappings->push_back(iter2);
if (mappings) {
mappings->push_back(iter2);
}
}
}
return mapped;
Expand Down
1 change: 1 addition & 0 deletions UI/GameSettingsScreen.cpp
Expand Up @@ -1527,6 +1527,7 @@ void GameSettingsScreen::dialogFinished(const Screen *dialog, DialogResult resul
RecreateViews();
}

// Show/hide the Analog Alternative Speed as appropriate - need to recreate views if this changed.
bool mapped = KeyMap::InputMappingsFromPspButton(VIRTKEY_SPEED_ANALOG, nullptr, true);
if (mapped != analogSpeedMapped_) {
analogSpeedMapped_ = mapped;
Expand Down

0 comments on commit 72c4d34

Please sign in to comment.