mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Merge pull request #21870 from hrydgard/more-input-refactor
Add ugly hack to prevent double-trigger of ESC to close the pause screen
This commit is contained in:
@@ -172,7 +172,7 @@ bool UIDialogScreen::key(const KeyInput &key) {
|
||||
if (!retval && (key.flags & KeyInputFlags::DOWN) && UI::IsEscapeKey(key)) {
|
||||
if (finished_) {
|
||||
ERROR_LOG(Log::System, "Screen already finished");
|
||||
} else {
|
||||
} else if (!firstFrame_) {
|
||||
finished_ = true;
|
||||
TriggerFinish(DR_BACK);
|
||||
UI::PlayUISound(UI::UISound::BACK);
|
||||
|
||||
@@ -79,9 +79,15 @@ class UIDialogScreen : public UIScreen {
|
||||
public:
|
||||
UIDialogScreen() : UIScreen(), finished_(false) {}
|
||||
~UIDialogScreen() override;
|
||||
void update() override {
|
||||
UIScreen::update();
|
||||
firstFrame_ = false;
|
||||
}
|
||||
bool key(const KeyInput &key) override;
|
||||
void sendMessage(UIMessage message, const char *value) override;
|
||||
|
||||
protected:
|
||||
bool firstFrame_ = true; // Since back button can toggle this screen, we need to make sure we don't immediately pop it on the first frame.
|
||||
private:
|
||||
bool finished_;
|
||||
};
|
||||
|
||||
+4
-2
@@ -333,11 +333,13 @@ void SaveSlotView::OnSaveState(UI::EventParams &e) {
|
||||
|
||||
void GamePauseScreen::update() {
|
||||
UpdateUIState(UISTATE_PAUSEMENU);
|
||||
UIScreen::update();
|
||||
|
||||
if (g_controlMapper.PollPauseTrigger()) {
|
||||
if (!firstFrame_ && g_controlMapper.PollPauseTrigger()) {
|
||||
TriggerFinish(DR_BACK);
|
||||
}
|
||||
UIScreen::update();
|
||||
|
||||
firstFrame_ = false;
|
||||
|
||||
if (finishNextFrame_) {
|
||||
TriggerFinish(finishNextFrameResult_);
|
||||
|
||||
Reference in New Issue
Block a user