Cache reporting support to avoid slowdown.

Turns out checking flash0:/ was not fast, oops, but especially when
disabled.

Also, make the box show as disabled when it's been disabled during the
session, and make it not do that in the menu.
This commit is contained in:
Unknown W. Brackets committed 2014-02-15 20:34:03 -08:00
1 parent 96a19ea982
commit 3dea6fdd86
4 files changed
+18 -4

No files matched your search

+1
View File
@@ -180,6 +180,7 @@ void __KernelShutdown()
CoreTiming::ClearPendingEvents();
CoreTiming::UnregisterAllEvents();
Reporting::Shutdown();
kernelRunning = false;
}
+13 -3
View File
@@ -56,6 +56,8 @@ namespace Reporting
static std::set<const char *> 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)
+2 -1
View File
@@ -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();
+2
View File
@@ -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();