mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Correct OnVkey locking on PauseScreen as well
This commit is contained in:
1 parent
9fc2fff68a
commit
497baecc9e
3 files changed
+15
-6
No files matched your search
@@ -34,7 +34,6 @@ struct VulkanPipelineRasterStateKey {
|
||||
unsigned int destColor : 5; // VkBlendFactor
|
||||
unsigned int srcAlpha : 5; // VkBlendFactor
|
||||
unsigned int destAlpha : 5; // VkBlendFactor
|
||||
// bool useBlendConstant : 1; // sacrifice a bit to cheaply check if we need to update the blend color
|
||||
unsigned int blendOpColor : 3; // VkBlendOp
|
||||
unsigned int blendOpAlpha : 3; // VkBlendOp
|
||||
unsigned int logicOpEnable : 1;
|
||||
@@ -53,7 +52,7 @@ struct VulkanPipelineRasterStateKey {
|
||||
unsigned int stencilDepthFailOp : 4; // VkStencilOp
|
||||
|
||||
// We'll use dynamic state for writemask, reference and comparemask to start with,
|
||||
// and viewport/scissor.
|
||||
// and viewport/scissor. More dynamic state requires extensions.
|
||||
|
||||
// Rasterizer
|
||||
unsigned int cullMode : 2; // VkCullModeFlagBits
|
||||
|
||||
+13
-4
@@ -341,9 +341,12 @@ void GamePauseScreen::update() {
|
||||
|
||||
firstFrame_ = false;
|
||||
|
||||
if (finishNextFrame_) {
|
||||
TriggerFinish(finishNextFrameResult_);
|
||||
finishNextFrame_ = false;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
|
||||
if (finishNextFrame_) {
|
||||
TriggerFinish(finishNextFrameResult_);
|
||||
finishNextFrame_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
const bool networkConnected = IsNetworkConnected();
|
||||
@@ -385,6 +388,7 @@ GamePauseScreen::~GamePauseScreen() {
|
||||
void GamePauseScreen::OnVKey(VirtKey virtualKeyCode, bool down) {
|
||||
// Simple de-bounce using createdTime_, just to be safe.
|
||||
if (down && virtualKeyCode == VIRTKEY_PAUSE && time_now_d() > createdTime_ + 0.1) {
|
||||
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
|
||||
finishNextFrame_ = true;
|
||||
finishNextFrameResult_ = DR_BACK;
|
||||
}
|
||||
@@ -405,6 +409,7 @@ void GamePauseScreen::CreateSavestateControls(UI::LinearLayout *leftColumnItems,
|
||||
int slotNum = v->GetSlot();
|
||||
auto doLoad = [this, slotNum]() {
|
||||
SaveState::LoadSlot(saveStatePrefix_, slotNum, &ShowMessageAfterSaveStateAction);
|
||||
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
|
||||
finishNextFrame_ = true;
|
||||
finishNextFrameResult_ = DR_CANCEL;
|
||||
};
|
||||
@@ -777,12 +782,14 @@ void GamePauseScreen::ShowContextMenu(UI::View *menuButton, bool portrait) {
|
||||
screenManager()->push(new UI::MessagePopupScreen(di->T("Reset"), confirmMessage, di->T("Reset"), di->T("Cancel"), [this](bool result) {
|
||||
if (result) {
|
||||
System_PostUIMessage(UIMessage::REQUEST_GAME_RESET);
|
||||
finishNextFrameResult_ = DR_BACK; // resume
|
||||
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
|
||||
finishNextFrame_ = true;
|
||||
finishNextFrameResult_ = DR_BACK; // resume
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
System_PostUIMessage(UIMessage::REQUEST_GAME_RESET);
|
||||
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
|
||||
finishNextFrameResult_ = DR_BACK; // resume
|
||||
finishNextFrame_ = true;
|
||||
}
|
||||
@@ -819,6 +826,7 @@ void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) {
|
||||
std::string tag = dialog->tag();
|
||||
if (tag == "ScreenshotView") {
|
||||
if (dr == DR_OK) {
|
||||
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
|
||||
finishNextFrame_ = true;
|
||||
} else if (dr != DR_CANCEL && dr != DR_BACK) {
|
||||
// Just go back to the pause menu, but refresh the savestate thumbnails in case something changed.
|
||||
@@ -894,6 +902,7 @@ void GamePauseScreen::OnExit(UI::EventParams &e) {
|
||||
if (g_Config.bPauseMenuExitsEmulator) {
|
||||
System_ExitApp();
|
||||
} else {
|
||||
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
|
||||
finishNextFrameResult_ = DR_OK; // exit game
|
||||
finishNextFrame_ = true;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
void AddExtraOptions(UI::ViewGroup *parent);
|
||||
|
||||
// hack
|
||||
std::mutex finishNextFrameMutex_;
|
||||
bool finishNextFrame_ = false;
|
||||
DialogResult finishNextFrameResult_ = DR_CANCEL;
|
||||
|
||||
|
||||
Reference in new issue
Block a user