From b46ca9f94bb3a2a6bcfb2a8535183ccc2202092a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 9 Feb 2014 14:04:16 -0800 Subject: [PATCH] Lock out reporting if harmful settings are used. Before, if you turned it on, broke stuff, and then turned it off, we reported the broken stuff. This could be responsible for various messages that have seemed strange. --- Core/Reporting.cpp | 11 ++++++++++- Core/Reporting.h | 4 ++++ UI/EmuScreen.cpp | 2 ++ UI/GameSettingsScreen.cpp | 2 ++ UI/MainScreen.cpp | 2 ++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 9698cc5e35..8486d99053 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -52,6 +52,8 @@ namespace Reporting static std::string lastHostname; // Keeps track of report-only-once identifiers. static std::set logOnceUsed; + // Keeps track of whether a harmful setting was ever used. + static bool everUnsupported = false; enum RequestType { @@ -198,6 +200,13 @@ namespace Reporting // New game, clean slate. spamProtectionCount = 0; logOnceUsed.clear(); + everUnsupported = false; + } + + void UpdateConfig() + { + if (!IsSupported()) + everUnsupported = true; } bool ShouldLogOnce(const char *identifier) @@ -265,7 +274,7 @@ namespace Reporting bool IsEnabled() { - if (g_Config.sReportHost.empty() || !IsSupported()) + if (g_Config.sReportHost.empty() || !IsSupported() || everUnsupported) return false; // Disabled by default for now. if (g_Config.sReportHost.compare("default") == 0) diff --git a/Core/Reporting.h b/Core/Reporting.h index b2598e6db4..cb879224b3 100644 --- a/Core/Reporting.h +++ b/Core/Reporting.h @@ -40,6 +40,9 @@ namespace Reporting // Should be called whenever a new game is loaded to forget things. void Init(); + // Should be called whenever the game configuration changes. + void UpdateConfig(); + // Returns whether or not the reporting system is currently enabled. bool IsEnabled(); @@ -55,5 +58,6 @@ namespace Reporting // Report a message string, using the format string as a key. void ReportMessage(const char *message, ...); + // Returns true if that identifier has not been logged yet. bool ShouldLogOnce(const char *identifier); } \ No newline at end of file diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 41eab12b69..b057ecb553 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -35,6 +35,7 @@ #include "Core/CoreParameter.h" #include "Core/Core.h" #include "Core/Host.h" +#include "Core/Reporting.h" #include "Core/System.h" #include "GPU/GPUState.h" #include "GPU/GPUInterface.h" @@ -202,6 +203,7 @@ void EmuScreen::sendMessage(const char *message, const char *value) { gpu->ClearCacheNextFrame(); gpu->Resized(); } + Reporting::UpdateConfig(); RecreateViews(); } else if (!strcmp(message, "gpu dump next frame")) { if (gpu) gpu->DumpNextFrame(); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 4fef5820ee..083af43018 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -394,6 +394,7 @@ UI::EventReturn GameSettingsScreen::OnResolutionChange(UI::EventParams &e) { if (gpu) { gpu->Resized(); } + Reporting::UpdateConfig(); return UI::EVENT_DONE; } @@ -498,6 +499,7 @@ UI::EventReturn GameSettingsScreen::OnPostProcShaderChange(UI::EventParams &e) { if (gpu) { gpu->Resized(); } + Reporting::UpdateConfig(); return UI::EVENT_DONE; } UI::EventReturn GameSettingsScreen::OnDeveloperTools(UI::EventParams &e) { diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 8ddc317a86..59cb2382af 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -31,6 +31,7 @@ #include "Common/FileUtil.h" #include "Core/System.h" #include "Core/Host.h" +#include "Core/Reporting.h" #include "Core/SaveState.h" #include "UI/EmuScreen.h" @@ -1045,6 +1046,7 @@ void GamePauseScreen::onFinish(DialogResult result) { // Do we really always need to "gpu->Resized" here? if (gpu) gpu->Resized(); + Reporting::UpdateConfig(); } UI::EventReturn GamePauseScreen::OnExitToMenu(UI::EventParams &e) {