Separate TriggerFinish from parent result

This commit is contained in:
Eloren1
2026-05-31 22:05:53 +03:00
parent 938029cd6a
commit 109d1caa50
4 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -509,7 +509,7 @@ EmuScreen::~EmuScreen() {
void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
std::string_view tag = dialog->tag();
if (tag == "TextEditPopup" || tag == "LoadStateConfirm") {
if (tag == "TextEditPopup") {
// Chat message finished.
return;
}
+6 -2
View File
@@ -28,6 +28,10 @@ void LoadStateConfirmScreen::CreatePopupContents(UI::ViewGroup *parent) {
new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(0, 8))));
}
void LoadStateConfirmScreen::OnCompleted(DialogResult result) {
if (callback_) callback_(result == DR_OK);
void LoadStateConfirmScreen::TriggerFinish(DialogResult result) {
if (callback_) {
callback_(result == DR_OK);
callback_ = nullptr;
}
UI::PopupScreen::TriggerFinish(DR_CANCEL);
}
+1 -2
View File
@@ -12,8 +12,7 @@ public:
LoadStateConfirmScreen(std::string_view saveStatePrefix, int slot, std::function<void(bool)> callback);
const char *tag() const override { return "LoadStateConfirm"; }
void CreatePopupContents(UI::ViewGroup *parent) override;
protected:
void OnCompleted(DialogResult result) override;
void TriggerFinish(DialogResult result) override;
private:
std::string saveStatePrefix_;
int slot_;
+1 -1
View File
@@ -829,7 +829,7 @@ void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) {
} else {
if (tag == "Game") {
g_BackgroundAudio.SetGame(Path());
} else if (tag != "MessagePopupScreen" && tag != "Prompt" && tag != "ContextMenuPopup" && tag != "ContextMenuCallbackPopup" && tag != "Report" && tag != "listpopup" && tag != "LoadStateConfirm") {
} else if (tag != "MessagePopupScreen" && tag != "Prompt" && tag != "ContextMenuPopup" && tag != "ContextMenuCallbackPopup" && tag != "Report" && tag != "listpopup") {
// Maybe should invert the logic here, so many cases..
// There may have been changes to our savestates, so let's recreate.
SaveState::Rescan(saveStatePrefix_);