From 5e57a2ffa8b27f735df2bca233ffe351a1a769c4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 17 Feb 2014 09:43:12 -0800 Subject: [PATCH] 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. --- Core/HLE/sceKernel.cpp | 1 + Core/Reporting.cpp | 13 +++++++++++++ Core/Reporting.h | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 488a9b90dc..e105cfd8b4 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -261,6 +261,7 @@ void __KernelDoState(PointerWrap &p) __InterruptsDoStateLate(p); __KernelThreadingDoStateLate(p); + Reporting::DoState(p); } } diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index c2631e859d..9b7d52b5d1 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -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(); diff --git a/Core/Reporting.h b/Core/Reporting.h index ce505dee55..026178fc38 100644 --- a/Core/Reporting.h +++ b/Core/Reporting.h @@ -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();