UI: Reset views when analog speed mapped.

This commit is contained in:
Unknown W. Brackets 2022-07-04 20:20:31 -07:00
parent 3cb4207369
commit f18c1a6e8f
2 changed files with 9 additions and 1 deletions

View file

@ -93,6 +93,7 @@ GameSettingsScreen::GameSettingsScreen(const Path &gamePath, std::string gameID,
: UIDialogScreenWithGameBackground(gamePath), gameID_(gameID), editThenRestore_(editThenRestore) {
lastVertical_ = UseVerticalLayout();
prevInflightFrames_ = g_Config.iInflightFrames;
analogSpeedMapped_ = KeyMap::AxisFromPspButton(VIRTKEY_SPEED_ANALOG, nullptr, nullptr, nullptr);
}
bool GameSettingsScreen::UseVerticalLayout() const {
@ -336,7 +337,7 @@ void GameSettingsScreen::CreateViews() {
altSpeed2->SetZeroLabel(gr->T("Unlimited"));
altSpeed2->SetNegativeDisable(gr->T("Disabled"));
if (KeyMap::AxisFromPspButton(VIRTKEY_SPEED_ANALOG, nullptr, nullptr, nullptr)) {
if (analogSpeedMapped_) {
PopupSliderChoice *analogSpeed = graphicsSettings->Add(new PopupSliderChoice(&iAlternateSpeedPercentAnalog_, 1, 1000, gr->T("Analog Alternative Speed", "Analog alternative speed (in %)"), 5, screenManager(), gr->T("%")));
altSpeed2->SetFormat("%i%%");
}
@ -1412,6 +1413,12 @@ void GameSettingsScreen::dialogFinished(const Screen *dialog, DialogResult resul
RecreateViews();
}
bool mapped = KeyMap::AxisFromPspButton(VIRTKEY_SPEED_ANALOG, nullptr, nullptr, nullptr);
if (mapped != analogSpeedMapped_) {
analogSpeedMapped_ = mapped;
RecreateViews();
}
}
void GameSettingsScreen::RecreateViews() {

View file

@ -141,6 +141,7 @@ private:
int prevInflightFrames_;
bool enableReports_ = false;
bool enableReportsSet_ = false;
bool analogSpeedMapped_ = false;
std::string shaderNames_[256];
std::string searchFilter_;