Don't allow reporting from bad savestates.

If the savestate was created with bad settings, or was loaded from an
older version, it may be damaged.  Let's not report old problems.
This commit is contained in:
Unknown W. Brackets 2014-02-17 09:43:12 -08:00
parent b894bd9b27
commit 5e57a2ffa8
3 changed files with 19 additions and 0 deletions

View file

@ -261,6 +261,7 @@ void __KernelDoState(PointerWrap &p)
__InterruptsDoStateLate(p);
__KernelThreadingDoStateLate(p);
Reporting::DoState(p);
}
}

View file

@ -214,6 +214,19 @@ namespace Reporting
Init();
}
void DoState(PointerWrap &p)
{
const int LATEST_VERSION = 1;
auto s = p.Section("Reporting", 0, LATEST_VERSION);
if (!s || s < LATEST_VERSION) {
// Don't report from old savestates, they may "entomb" bugs.
everUnsupported = true;
return;
}
p.Do(everUnsupported);
}
void UpdateConfig()
{
currentSupported = IsSupported();

View file

@ -35,12 +35,17 @@
#define NOTICE_LOG_ONCE(n,t,...) { if (Reporting::ShouldLogOnce(#n)) { NOTICE_LOG(t, __VA_ARGS__); } }
#define INFO_LOG_ONCE(n,t,...) { if (Reporting::ShouldLogOnce(#n)) { INFO_LOG(t, __VA_ARGS__); } }
struct PointerWrap;
namespace Reporting
{
// Should be called whenever a new game is loaded/shutdown to forget things.
void Init();
void Shutdown();
// Check savestate compatibility, mostly needed on load.
void DoState(PointerWrap &p);
// Should be called whenever the game configuration changes.
void UpdateConfig();