Prevent soft-locking the emulator on invalid PBP files, or crashes in some cases.

This commit is contained in:
Henrik Rydgård 2024-10-03 18:38:54 +02:00
parent 1a89c26dc0
commit 8fbe46ab9e
2 changed files with 21 additions and 5 deletions

View file

@ -1224,6 +1224,11 @@ void EmuScreen::update() {
return;
}
if (pauseTrigger_) {
pauseTrigger_ = false;
screenManager()->push(new GamePauseScreen(gamePath_));
}
if (invalid_)
return;
@ -1231,11 +1236,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 +1297,11 @@ ScreenRenderRole EmuScreen::renderRole(bool isTop) const {
return true;
return false;
}
if (invalid_) {
return false;
}
return true;
};

View file

@ -522,6 +522,10 @@ public:
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<std::mutex> lock(info_->lock);
info_->MarkReadyNoLock(flags_);
return;
}
@ -720,10 +724,17 @@ handleELF:
// 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<std::mutex> 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<std::mutex> lock(info_->lock);
info_->MarkReadyNoLock(flags_);
return;
}
ISOFileSystem umd(&handles, bd);