mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Enable the Load State button only if there is a state in the selected slot.
This commit is contained in:
parent
3f6d1d5e13
commit
42c1203b86
2 changed files with 20 additions and 2 deletions
|
@ -655,9 +655,13 @@ void GamePauseScreen::CreateViews() {
|
|||
saveSlots_->AddChoice(" 3 ");
|
||||
saveSlots_->AddChoice(" 4 ");
|
||||
saveSlots_->SetSelection(g_Config.iCurrentStateSlot);
|
||||
saveSlots_->OnChoice.Handle(this, &GamePauseScreen::OnStateSelected);
|
||||
|
||||
saveStateButton_ = leftColumnItems->Add(new Choice(gs->T("Save State")));
|
||||
saveStateButton_->OnClick.Handle(this, &GamePauseScreen::OnSaveState);
|
||||
|
||||
leftColumnItems->Add(new Choice(gs->T("Save State")))->OnClick.Handle(this, &GamePauseScreen::OnSaveState);
|
||||
leftColumnItems->Add(new Choice(gs->T("Load State")))->OnClick.Handle(this, &GamePauseScreen::OnLoadState);
|
||||
loadStateButton_ = leftColumnItems->Add(new Choice(gs->T("Load State")));
|
||||
loadStateButton_->OnClick.Handle(this, &GamePauseScreen::OnLoadState);
|
||||
|
||||
ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
|
||||
root_->Add(rightColumn);
|
||||
|
@ -668,6 +672,10 @@ void GamePauseScreen::CreateViews() {
|
|||
rightColumnItems->Add(new Choice(i->T("Continue")))->OnClick.Handle(this, &GamePauseScreen::OnContinue);
|
||||
rightColumnItems->Add(new Choice(i->T("Game Settings")))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings);
|
||||
rightColumnItems->Add(new Choice(i->T("Exit to menu")))->OnClick.Handle(this, &GamePauseScreen::OnExitToMenu);
|
||||
|
||||
UI::EventParams e;
|
||||
e.a = g_Config.iCurrentStateSlot;
|
||||
saveSlots_->OnChoice.Trigger(e);
|
||||
}
|
||||
|
||||
UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) {
|
||||
|
@ -675,6 +683,12 @@ UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) {
|
|||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GamePauseScreen::OnStateSelected(UI::EventParams &e) {
|
||||
int st = e.a;
|
||||
loadStateButton_->SetEnabled(SaveState::HasSaveInSlot(st));
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GamePauseScreen::OnContinue(UI::EventParams &e) {
|
||||
screenManager()->finishDialog(this, DR_CANCEL);
|
||||
if (gpu) gpu->Resized();
|
||||
|
|
|
@ -65,8 +65,12 @@ private:
|
|||
|
||||
UI::EventReturn OnSaveState(UI::EventParams &e);
|
||||
UI::EventReturn OnLoadState(UI::EventParams &e);
|
||||
|
||||
UI::EventReturn OnStateSelected(UI::EventParams &e);
|
||||
|
||||
std::string gamePath_;
|
||||
|
||||
UI::ChoiceStrip *saveSlots_;
|
||||
UI::Choice *saveStateButton_;
|
||||
UI::Choice *loadStateButton_;
|
||||
};
|
Loading…
Add table
Reference in a new issue