diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 89a5886b7222..12a2eec522f1 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -337,7 +337,7 @@ bool SavedataParam::Delete(SceUtilitySavedataParam* param, int saveId) { std::string dirPath = GetSaveFilePath(param, GetSaveDir(saveId)); if (dirPath.size() == 0) { - ERROR_LOG(Log::sceUtility, "GetSaveFilePath (%.*s) returned empty - cannot delete save directory. Might already be deleted?", sizeof(param->gameName), param->gameName); + ERROR_LOG(Log::sceUtility, "GetSaveFilePath (%.*s) returned empty - cannot delete save directory. Might already be deleted?", (int)sizeof(param->gameName), param->gameName); return false; } diff --git a/Core/MIPS/IR/IRRegCache.h b/Core/MIPS/IR/IRRegCache.h index 742d1cae3385..addd31d2338c 100644 --- a/Core/MIPS/IR/IRRegCache.h +++ b/Core/MIPS/IR/IRRegCache.h @@ -31,7 +31,7 @@ constexpr int TOTAL_MAPPABLE_IRREGS = 256; // Arbitrary - increase if your backend has more. constexpr int TOTAL_POSSIBLE_NATIVEREGS = 128; -typedef int8_t IRNativeReg; +typedef int8_t IRNativeReg; // invalid value is -1 constexpr IRReg IRREG_INVALID = 255; diff --git a/Core/MIPS/x86/X64IRRegCache.cpp b/Core/MIPS/x86/X64IRRegCache.cpp index 8ea13ef775aa..02afe8a663c6 100644 --- a/Core/MIPS/x86/X64IRRegCache.cpp +++ b/Core/MIPS/x86/X64IRRegCache.cpp @@ -265,7 +265,7 @@ X64Reg X64IRRegCache::GetAndLockTempFPR() { void X64IRRegCache::ReserveAndLockXGPR(Gen::X64Reg r) { IRNativeReg nreg = GPRToNativeReg(r); - if (nr[nreg].mipsReg != -1) + if (nr[nreg].mipsReg != IRREG_INVALID) FlushNativeReg(nreg); nr[r].tempLockIRIndex = irIndex_; } diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 2c5f4986586a..ec6b47b6e074 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1020,6 +1020,7 @@ static UI::AnchorLayoutParams *AnchorInCorner(const Bounds &bounds, int corner, void EmuScreen::CreateViews() { using namespace UI; + auto di = GetI18NCategory(I18NCat::DIALOG); auto dev = GetI18NCategory(I18NCat::DEVELOPER); auto sc = GetI18NCategory(I18NCat::SCREEN); @@ -1043,9 +1044,21 @@ void EmuScreen::CreateViews() { resumeButton_->SetVisibility(V_GONE); resetButton_ = buttons->Add(new Button(dev->T("Reset"))); - resetButton_->OnClick.Handle(this, &EmuScreen::OnReset); + resetButton_->OnClick.Add([](UI::EventParams &) { + if (coreState == CoreState::CORE_RUNTIME_ERROR) { + System_PostUIMessage(UIMessage::REQUEST_GAME_RESET); + } + return UI::EVENT_DONE; + }); resetButton_->SetVisibility(V_GONE); + backButton_ = buttons->Add(new Button(dev->T("Back"))); + backButton_->OnClick.Add([this](UI::EventParams &) { + this->pauseTrigger_ = true; + return UI::EVENT_DONE; + }); + backButton_->SetVisibility(V_GONE); + cardboardDisableButton_ = root_->Add(new Button(sc->T("Cardboard VR OFF"), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 30, true))); cardboardDisableButton_->OnClick.Handle(this, &EmuScreen::OnDisableCardboard); cardboardDisableButton_->SetVisibility(V_GONE); @@ -1166,19 +1179,13 @@ UI::EventReturn EmuScreen::OnResume(UI::EventParams ¶ms) { return UI::EVENT_DONE; } -UI::EventReturn EmuScreen::OnReset(UI::EventParams ¶ms) { - if (coreState == CoreState::CORE_RUNTIME_ERROR) { - System_PostUIMessage(UIMessage::REQUEST_GAME_RESET); - } - return UI::EVENT_DONE; -} - void EmuScreen::update() { using namespace UI; UIScreen::update(); resumeButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR && Memory::MemFault_MayBeResumable() ? V_VISIBLE : V_GONE); resetButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR ? V_VISIBLE : V_GONE); + backButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR ? V_VISIBLE : V_GONE); if (chatButton_ && chatMenu_) { if (chatMenu_->GetVisibility() != V_GONE) { @@ -1224,6 +1231,11 @@ void EmuScreen::update() { return; } + if (pauseTrigger_) { + pauseTrigger_ = false; + screenManager()->push(new GamePauseScreen(gamePath_)); + } + if (invalid_) return; @@ -1231,11 +1243,6 @@ void EmuScreen::update() { controlMapper_.Update(now); - if (pauseTrigger_) { - pauseTrigger_ = false; - screenManager()->push(new GamePauseScreen(gamePath_)); - } - if (saveStatePreview_ && !bootPending_) { int currentSlot = SaveState::GetCurrentSlot(); if (saveStateSlot_ != currentSlot) { @@ -1297,6 +1304,11 @@ ScreenRenderRole EmuScreen::renderRole(bool isTop) const { return true; return false; } + + if (invalid_) { + return false; + } + return true; }; diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index a80e684019ab..4637d6fe5f32 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -67,7 +67,6 @@ class EmuScreen : public UIScreen { UI::EventReturn OnDisableCardboard(UI::EventParams ¶ms); UI::EventReturn OnChat(UI::EventParams ¶ms); UI::EventReturn OnResume(UI::EventParams ¶ms); - UI::EventReturn OnReset(UI::EventParams ¶ms); void bootGame(const Path &filename); bool bootAllowStorage(const Path &filename); @@ -114,6 +113,7 @@ class EmuScreen : public UIScreen { UI::TextView *loadingTextView_ = nullptr; UI::Button *resumeButton_ = nullptr; UI::Button *resetButton_ = nullptr; + UI::Button *backButton_ = nullptr; UI::View *chatButton_ = nullptr; ChatMenu *chatMenu_ = nullptr; diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 00b4e13cdd0b..6f9460ce829f 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -522,6 +522,10 @@ class GameInfoWorkItem : public Task { goto handleELF; } ERROR_LOG(Log::Loader, "invalid pbp '%s'\n", pbpLoader->GetPath().c_str()); + // We can't win here - just mark everything pending as fetched, and let the caller + // handle the missing data. + std::unique_lock lock(info_->lock); + info_->MarkReadyNoLock(flags_); return; } @@ -720,10 +724,17 @@ class GameInfoWorkItem : public Task { // few files. auto fl = info_->GetFileLoader(); if (!fl) { + // BAD! Can't win here. + ERROR_LOG(Log::Loader, "Failed getting game info for ISO %s", info_->GetFilePath().ToVisualString().c_str()); + std::unique_lock lock(info_->lock); + info_->MarkReadyNoLock(flags_); return; } BlockDevice *bd = constructBlockDevice(info_->GetFileLoader().get()); if (!bd) { + ERROR_LOG(Log::Loader, "Failed constructing block device for ISO %s", info_->GetFilePath().ToVisualString().c_str()); + std::unique_lock lock(info_->lock); + info_->MarkReadyNoLock(flags_); return; } ISOFileSystem umd(&handles, bd);