Merge pull request #19507 from hrydgard/misc-fixes-again
Some checks failed
Build / build-windows (ARM64) (push) Has been cancelled
Build / build-windows (x64) (push) Has been cancelled
Build / build-uwp (push) Has been cancelled
Build / build (./b.sh --headless --unittest --fat --no-png --no-sdl2, clang, clang++, test, macos, macos-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, clang, clang++, test, clang-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, gcc, g++, gcc-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --ios, clang, clang++, ios, ios, macos-latest) (push) Has been cancelled
Build / build (./b.sh --libretro_android ppsspp_libretro, clang, clang++, android, android-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --qt, gcc, g++, qt, qt, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a OPENXR=1, clang, clang++, android, android-vr, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm64, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm32, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=x86_64 UNITTEST=1 HEADLESS=1, clang, clang++, android, android-x86_64, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, clang, clang++, libretro, clang-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, gcc, g++, libretro, gcc-libretro, ubuntu-latest) (push) Has been cancelled
Build / build_test_headless_alpine (push) Has been cancelled
Generate Docker Layer / build (push) Has been cancelled
Build / test-windows (push) Has been cancelled
Build / test (macos-latest) (push) Has been cancelled
Build / test (ubuntu-latest) (push) Has been cancelled

Prevent soft-locking the emulator on bad PBP files
This commit is contained in:
Henrik Rydgård 2024-10-03 19:08:31 +02:00 committed by GitHub
commit 16d97aa810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 40 additions and 17 deletions

View File

@ -337,7 +337,7 @@ bool SavedataParam::Delete(SceUtilitySavedataParam* param, int saveId) {
std::string dirPath = GetSaveFilePath(param, GetSaveDir(saveId)); std::string dirPath = GetSaveFilePath(param, GetSaveDir(saveId));
if (dirPath.size() == 0) { 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; return false;
} }

View File

@ -31,7 +31,7 @@ constexpr int TOTAL_MAPPABLE_IRREGS = 256;
// Arbitrary - increase if your backend has more. // Arbitrary - increase if your backend has more.
constexpr int TOTAL_POSSIBLE_NATIVEREGS = 128; constexpr int TOTAL_POSSIBLE_NATIVEREGS = 128;
typedef int8_t IRNativeReg; typedef int8_t IRNativeReg; // invalid value is -1
constexpr IRReg IRREG_INVALID = 255; constexpr IRReg IRREG_INVALID = 255;

View File

@ -265,7 +265,7 @@ X64Reg X64IRRegCache::GetAndLockTempFPR() {
void X64IRRegCache::ReserveAndLockXGPR(Gen::X64Reg r) { void X64IRRegCache::ReserveAndLockXGPR(Gen::X64Reg r) {
IRNativeReg nreg = GPRToNativeReg(r); IRNativeReg nreg = GPRToNativeReg(r);
if (nr[nreg].mipsReg != -1) if (nr[nreg].mipsReg != IRREG_INVALID)
FlushNativeReg(nreg); FlushNativeReg(nreg);
nr[r].tempLockIRIndex = irIndex_; nr[r].tempLockIRIndex = irIndex_;
} }

View File

@ -1020,6 +1020,7 @@ static UI::AnchorLayoutParams *AnchorInCorner(const Bounds &bounds, int corner,
void EmuScreen::CreateViews() { void EmuScreen::CreateViews() {
using namespace UI; using namespace UI;
auto di = GetI18NCategory(I18NCat::DIALOG);
auto dev = GetI18NCategory(I18NCat::DEVELOPER); auto dev = GetI18NCategory(I18NCat::DEVELOPER);
auto sc = GetI18NCategory(I18NCat::SCREEN); auto sc = GetI18NCategory(I18NCat::SCREEN);
@ -1043,9 +1044,21 @@ void EmuScreen::CreateViews() {
resumeButton_->SetVisibility(V_GONE); resumeButton_->SetVisibility(V_GONE);
resetButton_ = buttons->Add(new Button(dev->T("Reset"))); 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); 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_ = root_->Add(new Button(sc->T("Cardboard VR OFF"), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 30, true)));
cardboardDisableButton_->OnClick.Handle(this, &EmuScreen::OnDisableCardboard); cardboardDisableButton_->OnClick.Handle(this, &EmuScreen::OnDisableCardboard);
cardboardDisableButton_->SetVisibility(V_GONE); cardboardDisableButton_->SetVisibility(V_GONE);
@ -1166,19 +1179,13 @@ UI::EventReturn EmuScreen::OnResume(UI::EventParams &params) {
return UI::EVENT_DONE; return UI::EVENT_DONE;
} }
UI::EventReturn EmuScreen::OnReset(UI::EventParams &params) {
if (coreState == CoreState::CORE_RUNTIME_ERROR) {
System_PostUIMessage(UIMessage::REQUEST_GAME_RESET);
}
return UI::EVENT_DONE;
}
void EmuScreen::update() { void EmuScreen::update() {
using namespace UI; using namespace UI;
UIScreen::update(); UIScreen::update();
resumeButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR && Memory::MemFault_MayBeResumable() ? V_VISIBLE : V_GONE); 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); 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 (chatButton_ && chatMenu_) {
if (chatMenu_->GetVisibility() != V_GONE) { if (chatMenu_->GetVisibility() != V_GONE) {
@ -1224,6 +1231,11 @@ void EmuScreen::update() {
return; return;
} }
if (pauseTrigger_) {
pauseTrigger_ = false;
screenManager()->push(new GamePauseScreen(gamePath_));
}
if (invalid_) if (invalid_)
return; return;
@ -1231,11 +1243,6 @@ void EmuScreen::update() {
controlMapper_.Update(now); controlMapper_.Update(now);
if (pauseTrigger_) {
pauseTrigger_ = false;
screenManager()->push(new GamePauseScreen(gamePath_));
}
if (saveStatePreview_ && !bootPending_) { if (saveStatePreview_ && !bootPending_) {
int currentSlot = SaveState::GetCurrentSlot(); int currentSlot = SaveState::GetCurrentSlot();
if (saveStateSlot_ != currentSlot) { if (saveStateSlot_ != currentSlot) {
@ -1297,6 +1304,11 @@ ScreenRenderRole EmuScreen::renderRole(bool isTop) const {
return true; return true;
return false; return false;
} }
if (invalid_) {
return false;
}
return true; return true;
}; };

View File

@ -67,7 +67,6 @@ private:
UI::EventReturn OnDisableCardboard(UI::EventParams &params); UI::EventReturn OnDisableCardboard(UI::EventParams &params);
UI::EventReturn OnChat(UI::EventParams &params); UI::EventReturn OnChat(UI::EventParams &params);
UI::EventReturn OnResume(UI::EventParams &params); UI::EventReturn OnResume(UI::EventParams &params);
UI::EventReturn OnReset(UI::EventParams &params);
void bootGame(const Path &filename); void bootGame(const Path &filename);
bool bootAllowStorage(const Path &filename); bool bootAllowStorage(const Path &filename);
@ -114,6 +113,7 @@ private:
UI::TextView *loadingTextView_ = nullptr; UI::TextView *loadingTextView_ = nullptr;
UI::Button *resumeButton_ = nullptr; UI::Button *resumeButton_ = nullptr;
UI::Button *resetButton_ = nullptr; UI::Button *resetButton_ = nullptr;
UI::Button *backButton_ = nullptr;
UI::View *chatButton_ = nullptr; UI::View *chatButton_ = nullptr;
ChatMenu *chatMenu_ = nullptr; ChatMenu *chatMenu_ = nullptr;

View File

@ -522,6 +522,10 @@ public:
goto handleELF; goto handleELF;
} }
ERROR_LOG(Log::Loader, "invalid pbp '%s'\n", pbpLoader->GetPath().c_str()); 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<std::mutex> lock(info_->lock);
info_->MarkReadyNoLock(flags_);
return; return;
} }
@ -720,10 +724,17 @@ handleELF:
// few files. // few files.
auto fl = info_->GetFileLoader(); auto fl = info_->GetFileLoader();
if (!fl) { 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<std::mutex> lock(info_->lock);
info_->MarkReadyNoLock(flags_);
return; return;
} }
BlockDevice *bd = constructBlockDevice(info_->GetFileLoader().get()); BlockDevice *bd = constructBlockDevice(info_->GetFileLoader().get());
if (!bd) { if (!bd) {
ERROR_LOG(Log::Loader, "Failed constructing block device for ISO %s", info_->GetFilePath().ToVisualString().c_str());
std::unique_lock<std::mutex> lock(info_->lock);
info_->MarkReadyNoLock(flags_);
return; return;
} }
ISOFileSystem umd(&handles, bd); ISOFileSystem umd(&handles, bd);