mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-22 02:39:05 +02:00
SaveState: Show which PPSSPP version saved a state when loading it fails
The version comes from the file header and goes in the failure message's metadata line. A state from another version is the usual reason a load fails. Headless prints it too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a5275067b6
commit
6163bf5911
4 files changed
+33
-11
No files matched your search
+14
-1
@@ -763,6 +763,17 @@ int g_screenshotFailures;
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Which build last saved the file, from its header. Shown when a load fails, since a state from
|
||||
// another version is the usual suspect.
|
||||
static std::string SavedByVersion(const Path &path) {
|
||||
std::string title;
|
||||
std::string gitVersion;
|
||||
if (CChunkFileReader::GetFileTitle(path, &title, &gitVersion) != CChunkFileReader::ERROR_NONE || gitVersion.empty()) {
|
||||
return "";
|
||||
}
|
||||
return "PPSSPP " + gitVersion;
|
||||
}
|
||||
|
||||
static bool HandleLoadFailure(bool wasRewinding, std::string *metadata) {
|
||||
if (wasRewinding) {
|
||||
WARN_LOG(Log::SaveState, "HandleLoadFailure - trying a rewind state.");
|
||||
@@ -918,10 +929,12 @@ int g_screenshotFailures;
|
||||
} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {
|
||||
HandleLoadFailure(false, &callbackMetadata);
|
||||
callbackMessage = std::string(i18nLoadFailure) + ": " + errorString;
|
||||
ERROR_LOG(Log::SaveState, "Load state failure: %s", errorString.c_str());
|
||||
callbackMetadata = SavedByVersion(op.path);
|
||||
ERROR_LOG(Log::SaveState, "Load state failure: %s (saved by %s)", errorString.c_str(), callbackMetadata.c_str());
|
||||
callbackResult = Status::FAILURE;
|
||||
} else {
|
||||
callbackMessage = sc->T(errorString, i18nLoadFailure);
|
||||
callbackMetadata = SavedByVersion(op.path);
|
||||
callbackResult = Status::FAILURE;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user