diff --git a/Common/ChunkFile.h b/Common/ChunkFile.h index fe7d6e45eb..84ad20f83d 100644 --- a/Common/ChunkFile.h +++ b/Common/ChunkFile.h @@ -581,11 +581,12 @@ class CChunkFileReader public: // Load file template template - static bool Load(const std::string& _rFilename, int _Revision, T& _class) + static bool Load(const std::string& _rFilename, int _Revision, T& _class, std::string* _failureReason) { INFO_LOG(COMMON, "ChunkReader: Loading %s" , _rFilename.c_str()); if (!File::Exists(_rFilename)) { + _failureReason->append("StateDoesntExist"); ERROR_LOG(COMMON, "ChunkReader: File doesn't exist"); return false; } @@ -617,6 +618,7 @@ public: // Check revision if (header.Revision != _Revision) { + _failureReason->append("StateWrongVersion"); ERROR_LOG(COMMON,"ChunkReader: Wrong file revision, got %d expected %d", header.Revision, _Revision); return false; diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index d011f0e064..caf392fc75 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -219,6 +219,9 @@ namespace SaveState { Operation &op = operations[i]; bool result; + std::string reason; + std::string fullMessage; + I18NCategory *s = GetI18NCategory("Screen"); switch (op.type) @@ -227,11 +230,14 @@ namespace SaveState if (MIPSComp::jit) MIPSComp::jit->ClearCache(); INFO_LOG(COMMON, "Loading state from %s", op.filename.c_str()); - result = CChunkFileReader::Load(op.filename, REVISION, state); + result = CChunkFileReader::Load(op.filename, REVISION, state, &reason); if(result) osm.Show(s->T("LoadedState"), 2.0); - else - osm.Show(s->T("LoadStateFailed"), 2.0); + else { + fullMessage.append(s->T("LoadStateFailed")); + fullMessage.append(s->T(reason.c_str())); + osm.Show(fullMessage, 2.0); + } break; case SAVESTATE_SAVE: