mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add an option to the in-game dev menu to reset counts on limited logging
(making it start logging such things again, until it hits the limits yet again).
This commit is contained in:
parent
d2516bb43f
commit
1a78328e32
4 changed files with 24 additions and 5 deletions
|
@ -60,7 +60,9 @@ namespace Reporting
|
|||
// Temporarily stores a reference to the hostname.
|
||||
static std::string lastHostname;
|
||||
// Keeps track of report-only-once identifiers. Since they're always constants, a pointer is okay.
|
||||
static std::map<const char *, int> logOnceUsed;
|
||||
static std::map<const char *, int> logNTimes;
|
||||
static std::mutex logNTimesLock;
|
||||
|
||||
// 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.
|
||||
|
@ -303,7 +305,7 @@ namespace Reporting
|
|||
{
|
||||
// New game, clean slate.
|
||||
spamProtectionCount = 0;
|
||||
logOnceUsed.clear();
|
||||
logNTimes.clear();
|
||||
everUnsupported = false;
|
||||
currentSupported = IsSupported();
|
||||
pendingMessagesDone = false;
|
||||
|
@ -347,9 +349,10 @@ namespace Reporting
|
|||
bool ShouldLogNTimes(const char *identifier, int count)
|
||||
{
|
||||
// True if it wasn't there already -> so yes, log.
|
||||
auto iter = logOnceUsed.find(identifier);
|
||||
if (iter == logOnceUsed.end()) {
|
||||
logOnceUsed.insert(std::pair<const char*, int>(identifier, 1));
|
||||
std::lock_guard<std::mutex> lock(logNTimesLock);
|
||||
auto iter = logNTimes.find(identifier);
|
||||
if (iter == logNTimes.end()) {
|
||||
logNTimes.insert(std::pair<const char*, int>(identifier, 1));
|
||||
return true;
|
||||
} else {
|
||||
if (iter->second >= count) {
|
||||
|
@ -361,6 +364,11 @@ namespace Reporting
|
|||
}
|
||||
}
|
||||
|
||||
void ResetCounts() {
|
||||
std::lock_guard<std::mutex> lock(logNTimesLock);
|
||||
logNTimes.clear();
|
||||
}
|
||||
|
||||
std::string CurrentGameID()
|
||||
{
|
||||
// TODO: Maybe ParamSFOData shouldn't include nulls in std::strings? Don't work to break savedata, though...
|
||||
|
|
|
@ -53,6 +53,9 @@ namespace Reporting
|
|||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
// Resets counts on any count-limited logs (see ShouldLogNTimes).
|
||||
void ResetCounts();
|
||||
|
||||
// Check savestate compatibility, mostly needed on load.
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include "Common/System/Display.h"
|
||||
#include "Common/System/NativeApp.h"
|
||||
#include "Common/System/System.h"
|
||||
|
@ -37,6 +38,7 @@
|
|||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/MIPS/MIPSTables.h"
|
||||
#include "Core/MIPS/JitCommon/JitBlockCache.h"
|
||||
|
@ -90,6 +92,7 @@ void DevMenu::CreatePopupContents(UI::ViewGroup *parent) {
|
|||
items->Add(new CheckBox(&g_Config.bShowFrameProfiler, dev->T("Frame Profiler"), ""));
|
||||
#endif
|
||||
items->Add(new CheckBox(&g_Config.bDrawFrameGraph, dev->T("Draw Frametimes Graph")));
|
||||
items->Add(new Choice(dev->T("Reset limited logging")))->OnClick.Handle(this, &DevMenu::OnResetLimitedLogging);
|
||||
|
||||
scroll->Add(items);
|
||||
parent->Add(scroll);
|
||||
|
@ -105,6 +108,10 @@ UI::EventReturn DevMenu::OnToggleAudioDebug(UI::EventParams &e) {
|
|||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn DevMenu::OnResetLimitedLogging(UI::EventParams &e) {
|
||||
Reporting::ResetCounts();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn DevMenu::OnLogView(UI::EventParams &e) {
|
||||
UpdateUIState(UISTATE_PAUSEMENU);
|
||||
|
|
|
@ -45,6 +45,7 @@ protected:
|
|||
UI::EventReturn OnDumpFrame(UI::EventParams &e);
|
||||
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
|
||||
UI::EventReturn OnToggleAudioDebug(UI::EventParams &e);
|
||||
UI::EventReturn OnResetLimitedLogging(UI::EventParams &e);
|
||||
};
|
||||
|
||||
class JitDebugScreen : public UIDialogScreenWithBackground {
|
||||
|
|
Loading…
Add table
Reference in a new issue