Include the git version in savestates.

This way we can provide better warnings when it fails to load.
This commit is contained in:
Unknown W. Brackets 2013-04-13 01:13:28 -07:00
parent d586d7ddd2
commit 117ffaeb60
3 changed files with 19 additions and 12 deletions

View file

@ -15,10 +15,11 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "HLE.h"
#include "../MIPS/MIPS.h"
#include "../MIPS/MIPSCodeUtils.h"
#include "../MIPS/MIPSInt.h"
#include "Core/Config.h"
#include "Core/HLE/HLE.h"
#include "Core/MIPS/MIPS.h"
#include "Core/MIPS/MIPSCodeUtils.h"
#include "Core/MIPS/MIPSInt.h"
#include "Common/LogManager.h"
#include "../FileSystems/FileSystem.h"
@ -161,6 +162,11 @@ void __KernelShutdown()
void __KernelDoState(PointerWrap &p)
{
std::string git_version = PPSSPP_GIT_VERSION;
p.Do(git_version);
if (git_version != PPSSPP_GIT_VERSION)
WARN_LOG(HLE, "Warning: this savestate was generated by a different version of PPSSPP. It may not load properly.");
p.Do(kernelRunning);
kernelObjects.DoState(p);
p.DoMarker("KernelObjects");

View file

@ -111,6 +111,11 @@ namespace SaveState
Enqueue(Operation(SAVESTATE_SAVE, filename, callback, cbUserData));
}
void Verify(Callback callback, void *cbUserData)
{
Enqueue(Operation(SAVESTATE_VERIFY, std::string(""), callback, cbUserData));
}
// Slot utilities
@ -148,9 +153,10 @@ namespace SaveState
(*callback)(false, cbUserData);
}
void HasSaveInSlot(int slot)
bool HasSaveInSlot(int slot)
{
std::string fn = GenerateSaveSlotFilename(slot);
return File::Exists(fn);
}
bool operator < (const tm &t1, const tm &t2) {
@ -186,11 +192,6 @@ namespace SaveState
}
void Verify(Callback callback, void *cbUserData)
{
Enqueue(Operation(SAVESTATE_VERIFY, std::string(""), callback, cbUserData));
}
std::vector<Operation> Flush()
{
std::lock_guard<std::recursive_mutex> guard(mutex);

View file

@ -24,14 +24,14 @@ namespace SaveState
typedef void (*Callback)(bool status, void *cbUserData);
// TODO: Better place for this?
const int REVISION = 1;
const int REVISION = 2;
const int SAVESTATESLOTS = 4;
void Init();
void SaveSlot(int slot, Callback callback, void *cbUserData = 0);
void LoadSlot(int slot, Callback callback, void *cbUserData = 0);
void HasSaveInSlot(int slot);
bool HasSaveInSlot(int slot);
int GetNewestSlot();
// Load the specified file into the current state (async.)