Keep track of whether a savestate has been used.

Mostly to improve info we get in reporting.
This commit is contained in:
Unknown W. Brackets 2014-02-09 13:45:51 -08:00
parent 274160bc22
commit a8b55c3e10
3 changed files with 17 additions and 1 deletions

View File

@ -20,6 +20,7 @@
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/SaveState.h"
#include "Core/System.h" #include "Core/System.h"
#include "Core/HLE/sceDisplay.h" #include "Core/HLE/sceDisplay.h"
#include "Core/HLE/sceKernelMemory.h" #include "Core/HLE/sceKernelMemory.h"
@ -219,7 +220,8 @@ namespace Reporting
postdata.Add("fps", fps); postdata.Add("fps", fps);
} }
// TODO: Settings, savestate/savedata status, some measure of speed/fps? // TODO: Settings?
postdata.Add("savestate_used", SaveState::HasLoadedState());
switch (payload.type) switch (payload.type)
{ {

View File

@ -203,6 +203,7 @@ namespace SaveState
static bool needsProcess = false; static bool needsProcess = false;
static std::vector<Operation> pending; static std::vector<Operation> pending;
static std::recursive_mutex mutex; static std::recursive_mutex mutex;
static bool hasLoadedState = false;
// TODO: Should this be configurable? // TODO: Should this be configurable?
static const int REWIND_NUM_STATES = 20; static const int REWIND_NUM_STATES = 20;
@ -430,6 +431,11 @@ namespace SaveState
rewindStates.Save(); rewindStates.Save();
} }
bool HasLoadedState()
{
return hasLoadedState;
}
void Process() void Process()
{ {
#ifndef MOBILE_DEVICE #ifndef MOBILE_DEVICE
@ -474,6 +480,7 @@ namespace SaveState
if (result == CChunkFileReader::ERROR_NONE) { if (result == CChunkFileReader::ERROR_NONE) {
osm.Show(s->T("Loaded State"), 2.0); osm.Show(s->T("Loaded State"), 2.0);
callbackResult = true; callbackResult = true;
hasLoadedState = true;
} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) { } else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {
HandleFailure(); HandleFailure();
osm.Show(i18nLoadFailure, 2.0); osm.Show(i18nLoadFailure, 2.0);
@ -513,12 +520,14 @@ namespace SaveState
if (result == CChunkFileReader::ERROR_NONE) { if (result == CChunkFileReader::ERROR_NONE) {
osm.Show(s->T("Loaded State"), 2.0); osm.Show(s->T("Loaded State"), 2.0);
callbackResult = true; callbackResult = true;
hasLoadedState = true;
} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) { } else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {
// Cripes. Good news is, we might have more. Let's try those too, better than a reset. // Cripes. Good news is, we might have more. Let's try those too, better than a reset.
if (HandleFailure()) { if (HandleFailure()) {
// Well, we did rewind, even if too much... // Well, we did rewind, even if too much...
osm.Show(s->T("Loaded State"), 2.0); osm.Show(s->T("Loaded State"), 2.0);
callbackResult = true; callbackResult = true;
hasLoadedState = true;
} else { } else {
osm.Show(i18nLoadFailure, 2.0); osm.Show(i18nLoadFailure, 2.0);
callbackResult = false; callbackResult = false;
@ -547,5 +556,7 @@ namespace SaveState
std::lock_guard<std::recursive_mutex> guard(mutex); std::lock_guard<std::recursive_mutex> guard(mutex);
rewindStates.Clear(); rewindStates.Clear();
hasLoadedState = false;
} }
} }

View File

@ -63,6 +63,9 @@ namespace SaveState
// Returns true if there are rewind snapshots available. // Returns true if there are rewind snapshots available.
bool CanRewind(); bool CanRewind();
// Returns true if a savestate has been used during this session.
bool HasLoadedState();
// Check if there's any save stating needing to be done. Normally called once per frame. // Check if there's any save stating needing to be done. Normally called once per frame.
void Process(); void Process();
}; };