diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 62b7a76a60..488a9b90dc 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -180,6 +180,7 @@ void __KernelShutdown() CoreTiming::ClearPendingEvents(); CoreTiming::UnregisterAllEvents(); + Reporting::Shutdown(); kernelRunning = false; } diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 14bea074e8..c2631e859d 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -56,6 +56,8 @@ namespace Reporting static std::set logOnceUsed; // Keeps track of whether a harmful setting was ever used. static bool everUnsupported = false; + // Support is cached here to avoid checking it on every single request. + static bool currentSupported = false; enum RequestType { @@ -203,11 +205,19 @@ namespace Reporting spamProtectionCount = 0; logOnceUsed.clear(); everUnsupported = false; + currentSupported = IsSupported(); + } + + void Shutdown() + { + // Just so it can be enabled in the menu again. + Init(); } void UpdateConfig() { - if (!IsSupported()) + currentSupported = IsSupported(); + if (!currentSupported && PSP_IsInited()) everUnsupported = true; } @@ -305,12 +315,12 @@ namespace Reporting if (!File::Exists(g_Config.flash0Directory + "/font")) return false; - return true; + return !everUnsupported; } bool IsEnabled() { - if (g_Config.sReportHost.empty() || !IsSupported() || everUnsupported) + if (g_Config.sReportHost.empty() || !currentSupported) 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 cb879224b3..ce505dee55 100644 --- a/Core/Reporting.h +++ b/Core/Reporting.h @@ -37,8 +37,9 @@ namespace Reporting { - // Should be called whenever a new game is loaded to forget things. + // Should be called whenever a new game is loaded/shutdown to forget things. void Init(); + void Shutdown(); // Should be called whenever the game configuration changes. void UpdateConfig(); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index a91d61b92c..ede9615eff 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -368,6 +368,7 @@ UI::EventReturn GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) { UI::EventReturn GameSettingsScreen::OnRenderingMode(UI::EventParams &e) { // We do not want to report when rendering mode is Framebuffer to memory - so many issues // are caused by that (framebuffer copies overwriting display lists, etc). + Reporting::UpdateConfig(); enableReports_ = Reporting::IsEnabled(); enableReportsCheckbox_->SetEnabled(Reporting::IsSupported()); @@ -449,6 +450,7 @@ void GameSettingsScreen::onFinish(DialogResult result) { } Reporting::Enable(enableReports_, "report.ppsspp.org"); + Reporting::UpdateConfig(); g_Config.Save(); host->UpdateUI();