mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Refactor overlays into an enum
This commit is contained in:
parent
7538807ee7
commit
fc6879674e
@ -848,13 +848,10 @@ static const ConfigSetting debuggerSettings[] = {
|
||||
ConfigSetting("DisplayStatusBar", &g_Config.bDisplayStatusBar, true, CfgFlag::DEFAULT),
|
||||
ConfigSetting("ShowBottomTabTitles",&g_Config.bShowBottomTabTitles, true, CfgFlag::DEFAULT),
|
||||
ConfigSetting("ShowDeveloperMenu", &g_Config.bShowDeveloperMenu, false, CfgFlag::DEFAULT),
|
||||
ConfigSetting("ShowAllocatorDebug", &g_Config.bShowAllocatorDebug, false, CfgFlag::DONT_SAVE),
|
||||
ConfigSetting("ShowGpuProfile", &g_Config.bShowGpuProfile, false, CfgFlag::DONT_SAVE),
|
||||
ConfigSetting("SkipDeadbeefFilling", &g_Config.bSkipDeadbeefFilling, false, CfgFlag::DEFAULT),
|
||||
ConfigSetting("FuncHashMap", &g_Config.bFuncHashMap, false, CfgFlag::DEFAULT),
|
||||
ConfigSetting("SkipFuncHashMap", &g_Config.sSkipFuncHashMap, "", CfgFlag::DEFAULT),
|
||||
ConfigSetting("MemInfoDetailed", &g_Config.bDebugMemInfoDetailed, false, CfgFlag::DEFAULT),
|
||||
ConfigSetting("DrawFrameGraph", &g_Config.bDrawFrameGraph, false, CfgFlag::DEFAULT),
|
||||
};
|
||||
|
||||
static const ConfigSetting jitSettings[] = {
|
||||
@ -1060,8 +1057,6 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||
INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
|
||||
bSaveSettings = true;
|
||||
|
||||
bShowFrameProfiler = true;
|
||||
|
||||
IniFile iniFile;
|
||||
if (!iniFile.Load(iniFilename_)) {
|
||||
ERROR_LOG(LOADER, "Failed to read '%s'. Setting config to default.", iniFilename_.c_str());
|
||||
|
@ -465,16 +465,15 @@ public:
|
||||
bool bDisplayStatusBar;
|
||||
bool bShowBottomTabTitles;
|
||||
bool bShowDeveloperMenu;
|
||||
bool bShowAllocatorDebug;
|
||||
// Double edged sword: much easier debugging, but not accurate.
|
||||
bool bSkipDeadbeefFilling;
|
||||
bool bFuncHashMap;
|
||||
std::string sSkipFuncHashMap;
|
||||
bool bDebugMemInfoDetailed;
|
||||
bool bDrawFrameGraph;
|
||||
|
||||
// Volatile development settings
|
||||
bool bShowFrameProfiler;
|
||||
// Overlays
|
||||
DebugOverlay iDebugOverlay;
|
||||
bool bGpuLogProfiler; // Controls the Vulkan logging profiler (profiles textures uploads etc).
|
||||
|
||||
// Retro Achievement settings
|
||||
|
@ -175,3 +175,16 @@ enum class ScreenEdgePosition {
|
||||
CENTER_RIGHT = 7,
|
||||
VALUE_COUNT,
|
||||
};
|
||||
|
||||
enum class DebugOverlay : int {
|
||||
OFF,
|
||||
DEBUG_STATS,
|
||||
FRAME_GRAPH,
|
||||
#ifdef USE_PROFILER
|
||||
FRAME_PROFILE,
|
||||
#endif
|
||||
CONTROL,
|
||||
AUDIO,
|
||||
GPU_PROFILE,
|
||||
GPU_ALLOCATOR,
|
||||
};
|
||||
|
@ -496,7 +496,7 @@ static void DoFrameIdleTiming() {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_Config.bDrawFrameGraph || coreCollectDebugStats) {
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
DisplayNotifySleep(time_now_d() - before);
|
||||
}
|
||||
}
|
||||
@ -662,7 +662,7 @@ void __DisplayFlip(int cyclesLate) {
|
||||
CoreTiming::ScheduleEvent(0 - cyclesLate, afterFlipEvent, 0);
|
||||
numVBlanksSinceFlip = 0;
|
||||
|
||||
if (g_Config.bDrawFrameGraph || coreCollectDebugStats) {
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
// Track how long we sleep (whether vsync or sleep_ms.)
|
||||
DisplayNotifySleep(time_now_d() - frameSleepStart, frameSleepPos);
|
||||
}
|
||||
@ -726,7 +726,7 @@ void hleLagSync(u64 userdata, int cyclesLate) {
|
||||
const int over = (int)((now - goal) * 1000000);
|
||||
ScheduleLagSync(over - emuOver);
|
||||
|
||||
if (g_Config.bDrawFrameGraph || coreCollectDebugStats) {
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
DisplayNotifySleep(now - before);
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static void CalculateFPS() {
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Config.bDrawFrameGraph || coreCollectDebugStats) {
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
frameTimeHistory[frameTimeHistoryPos++] = now - lastFrameTimeHistory;
|
||||
lastFrameTimeHistory = now;
|
||||
frameTimeHistoryPos = frameTimeHistoryPos % frameTimeHistorySize;
|
||||
|
@ -142,7 +142,7 @@ void TextureCacheCommon::StartFrame() {
|
||||
timesInvalidatedAllThisFrame_ = 0;
|
||||
replacementTimeThisFrame_ = 0.0;
|
||||
|
||||
if (g_Config.bShowDebugStats) {
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
gpuStats.numReplacerTrackedTex = replacer_.GetNumTrackedTextures();
|
||||
gpuStats.numCachedReplacedTextures = replacer_.GetNumCachedReplacedTextures();
|
||||
}
|
||||
|
@ -88,6 +88,29 @@ static const char *logLevelList[] = {
|
||||
"Verb."
|
||||
};
|
||||
|
||||
static const char *g_debugOverlayList[] = {
|
||||
"Off",
|
||||
"Debug stats",
|
||||
"Draw Frametimes Graph",
|
||||
#ifdef USE_PROFILER
|
||||
"Frame profile",
|
||||
#endif
|
||||
"Toggle Control Debug",
|
||||
"Toggle Audio Debug",
|
||||
"GPU Profile",
|
||||
"GPU Allocator Viewer",
|
||||
};
|
||||
|
||||
void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager) {
|
||||
using namespace UI;
|
||||
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
|
||||
int numOverlays = ARRAY_SIZE(g_debugOverlayList);
|
||||
if (!(g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL)) {
|
||||
numOverlays -= 2; // skip the last 2.
|
||||
}
|
||||
items->Add(new PopupMultiChoice((int *)&g_Config.iDebugOverlay, dev->T("Debug overlay"), g_debugOverlayList, 0, numOverlays, I18NCat::DEVELOPER, screenManager));
|
||||
}
|
||||
|
||||
void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
|
||||
@ -103,27 +126,21 @@ void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
items->Add(new Choice(sy->T("Developer Tools")))->OnClick.Handle(this, &DevMenuScreen::OnDeveloperTools);
|
||||
items->Add(new Choice(dev->T("Jit Compare")))->OnClick.Handle(this, &DevMenuScreen::OnJitCompare);
|
||||
items->Add(new Choice(dev->T("Shader Viewer")))->OnClick.Handle(this, &DevMenuScreen::OnShaderView);
|
||||
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
|
||||
items->Add(new CheckBox(&g_Config.bShowAllocatorDebug, dev->T("GPU Allocator Viewer")));
|
||||
}
|
||||
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
|
||||
items->Add(new CheckBox(&g_Config.bShowGpuProfile, dev->T("GPU Profile")));
|
||||
}
|
||||
items->Add(new Choice(dev->T("Toggle Freeze")))->OnClick.Handle(this, &DevMenuScreen::OnFreezeFrame);
|
||||
|
||||
items->Add(new Choice(dev->T("Dump next frame to log")))->OnClick.Handle(this, &DevMenuScreen::OnDumpFrame);
|
||||
items->Add(new Choice(dev->T("Toggle Audio Debug")))->OnClick.Add([](UI::EventParams &) {
|
||||
g_Config.bShowAudioDebug = !g_Config.bShowAudioDebug;
|
||||
AddOverlayList(items, screenManager());
|
||||
items->Add(new Choice(dev->T("Toggle Freeze")))->OnClick.Add([](UI::EventParams &e) {
|
||||
if (PSP_CoreParameter().frozen) {
|
||||
PSP_CoreParameter().frozen = false;
|
||||
} else {
|
||||
PSP_CoreParameter().freezeNext = true;
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
items->Add(new Choice(dev->T("Toggle Control Debug")))->OnClick.Add([](UI::EventParams &) {
|
||||
g_Config.bShowControlDebug = !g_Config.bShowControlDebug;
|
||||
|
||||
items->Add(new Choice(dev->T("Dump next frame to log")))->OnClick.Add([](UI::EventParams &e) {
|
||||
gpu->DumpNextFrame();
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
#ifdef USE_PROFILER
|
||||
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, &DevMenuScreen::OnResetLimitedLogging);
|
||||
|
||||
scroll->Add(items);
|
||||
@ -171,20 +188,6 @@ UI::EventReturn DevMenuScreen::OnShaderView(UI::EventParams &e) {
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn DevMenuScreen::OnFreezeFrame(UI::EventParams &e) {
|
||||
if (PSP_CoreParameter().frozen) {
|
||||
PSP_CoreParameter().frozen = false;
|
||||
} else {
|
||||
PSP_CoreParameter().freezeNext = true;
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn DevMenuScreen::OnDumpFrame(UI::EventParams &e) {
|
||||
gpu->DumpNextFrame();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void DevMenuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
|
||||
UpdateUIState(UISTATE_INGAME);
|
||||
// Close when a subscreen got closed.
|
||||
|
@ -42,8 +42,6 @@ protected:
|
||||
UI::EventReturn OnLogConfig(UI::EventParams &e);
|
||||
UI::EventReturn OnJitCompare(UI::EventParams &e);
|
||||
UI::EventReturn OnShaderView(UI::EventParams &e);
|
||||
UI::EventReturn OnFreezeFrame(UI::EventParams &e);
|
||||
UI::EventReturn OnDumpFrame(UI::EventParams &e);
|
||||
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
|
||||
UI::EventReturn OnResetLimitedLogging(UI::EventParams &e);
|
||||
|
||||
@ -226,3 +224,5 @@ private:
|
||||
|
||||
void DrawProfile(UIContext &ui);
|
||||
const char *GetCompilerABI();
|
||||
|
||||
void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager);
|
||||
|
@ -1515,7 +1515,7 @@ void EmuScreen::render() {
|
||||
}
|
||||
}
|
||||
|
||||
Core_UpdateDebugStats(g_Config.bShowDebugStats || g_Config.bLogFrameDrops);
|
||||
Core_UpdateDebugStats(g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS || g_Config.bLogFrameDrops);
|
||||
|
||||
bool blockedExecution = Achievements::IsBlockingExecution();
|
||||
if (!blockedExecution) {
|
||||
@ -1591,7 +1591,7 @@ bool EmuScreen::hasVisibleUI() {
|
||||
if (g_Config.bEnableCardboardVR || g_Config.bEnableNetworkChat)
|
||||
return true;
|
||||
// Debug UI.
|
||||
if (g_Config.bShowDebugStats || g_Config.bShowDeveloperMenu || g_Config.bShowAudioDebug || g_Config.bShowFrameProfiler || g_Config.bShowControlDebug)
|
||||
if (g_Config.iDebugOverlay != DebugOverlay::OFF)
|
||||
return true;
|
||||
|
||||
// Exception information.
|
||||
@ -1626,38 +1626,39 @@ void EmuScreen::renderUI() {
|
||||
}
|
||||
|
||||
if (!invalid_) {
|
||||
if (g_Config.bShowDebugStats) {
|
||||
switch (g_Config.iDebugOverlay) {
|
||||
case DebugOverlay::DEBUG_STATS:
|
||||
DrawDebugStats(ctx, ctx->GetLayoutBounds());
|
||||
}
|
||||
|
||||
if (g_Config.bShowAudioDebug) {
|
||||
break;
|
||||
case DebugOverlay::FRAME_GRAPH:
|
||||
DrawFrameTimes(ctx, ctx->GetLayoutBounds());
|
||||
break;
|
||||
case DebugOverlay::AUDIO:
|
||||
DrawAudioDebugStats(ctx, ctx->GetLayoutBounds());
|
||||
break;
|
||||
case DebugOverlay::CONTROL:
|
||||
DrawControlDebug(ctx, controlMapper_, ctx->GetLayoutBounds());
|
||||
break;
|
||||
#if !PPSSPP_PLATFORM(UWP) && !PPSSPP_PLATFORM(SWITCH)
|
||||
|
||||
case DebugOverlay::GPU_PROFILE:
|
||||
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
|
||||
DrawGPUProfilerVis(ctx, gpu);
|
||||
}
|
||||
break;
|
||||
case DebugOverlay::GPU_ALLOCATOR:
|
||||
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
|
||||
DrawGPUMemoryVis(ctx, gpu);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_Config.iShowStatusFlags) {
|
||||
DrawFPS(ctx, ctx->GetLayoutBounds());
|
||||
}
|
||||
|
||||
if (g_Config.bDrawFrameGraph) {
|
||||
DrawFrameTimes(ctx, ctx->GetLayoutBounds());
|
||||
}
|
||||
|
||||
if (g_Config.bShowControlDebug) {
|
||||
DrawControlDebug(ctx, controlMapper_, ctx->GetLayoutBounds());
|
||||
}
|
||||
}
|
||||
|
||||
#if !PPSSPP_PLATFORM(UWP) && !PPSSPP_PLATFORM(SWITCH)
|
||||
if ((g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) && g_Config.bShowAllocatorDebug) {
|
||||
DrawGPUMemoryVis(ctx, gpu);
|
||||
}
|
||||
|
||||
if ((g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) && g_Config.bShowGpuProfile) {
|
||||
DrawGPUProfilerVis(ctx, gpu);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_PROFILER
|
||||
if (g_Config.bShowFrameProfiler && !invalid_) {
|
||||
DrawProfile(*ctx);
|
||||
|
@ -562,8 +562,7 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
|
||||
#ifdef CAN_DISPLAY_CURRENT_BATTERY_CAPACITY
|
||||
BitCheckBox *showBattery = graphicsSettings->Add(new BitCheckBox(&g_Config.iShowStatusFlags, (int)ShowStatusFlags::BATTERY_PERCENT, gr->T("Show Battery %")));
|
||||
#endif
|
||||
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gr->T("Show Debug Statistics")))->OnClick.Handle(this, &GameSettingsScreen::OnJitAffectingSetting);
|
||||
AddOverlayList(graphicsSettings, screenManager());
|
||||
}
|
||||
|
||||
void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
|
||||
@ -1658,6 +1657,8 @@ void DeveloperToolsScreen::CreateViews() {
|
||||
cpuTests->SetEnabled(TestsAvailable());
|
||||
#endif
|
||||
|
||||
AddOverlayList(list, screenManager());
|
||||
|
||||
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN) {
|
||||
list->Add(new CheckBox(&g_Config.bRenderMultiThreading, dev->T("Multi-threaded rendering"), ""))->OnClick.Add([](UI::EventParams &e) {
|
||||
// TODO: Not translating yet. Will combine with other translations of settings that need restart.
|
||||
@ -1873,7 +1874,7 @@ UI::EventReturn DeveloperToolsScreen::OnRemoteDebugger(UI::EventParams &e) {
|
||||
}
|
||||
// Persist the setting. Maybe should separate?
|
||||
g_Config.bRemoteDebuggerOnStartup = allowDebugger_;
|
||||
return UI::EVENT_CONTINUE;
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void DeveloperToolsScreen::update() {
|
||||
|
@ -1098,7 +1098,7 @@ void NativeRender(GraphicsContext *graphicsContext) {
|
||||
g_screenManager->getUIContext()->SetTintSaturation(g_Config.fUITint, g_Config.fUISaturation);
|
||||
|
||||
Draw::DebugFlags debugFlags = Draw::DebugFlags::NONE;
|
||||
if (g_Config.bShowGpuProfile)
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::GPU_PROFILE)
|
||||
debugFlags |= Draw::DebugFlags::PROFILE_TIMESTAMPS;
|
||||
if (g_Config.bGpuLogProfiler)
|
||||
debugFlags |= Draw::DebugFlags::PROFILE_SCOPES;
|
||||
|
@ -709,7 +709,13 @@ namespace MainWindow {
|
||||
break;
|
||||
|
||||
case ID_DEBUG_SHOWDEBUGSTATISTICS:
|
||||
g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
|
||||
// This is still useful as a shortcut to tell users to use.
|
||||
// So let's fake the enum.
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
g_Config.iDebugOverlay = DebugOverlay::OFF;
|
||||
} else {
|
||||
g_Config.iDebugOverlay = DebugOverlay::DEBUG_STATS;
|
||||
}
|
||||
System_PostUIMessage("clear jit", "");
|
||||
break;
|
||||
|
||||
@ -958,7 +964,7 @@ namespace MainWindow {
|
||||
HMENU menu = GetMenu(GetHWND());
|
||||
#define CHECKITEM(item,value) CheckMenuItem(menu,item,MF_BYCOMMAND | ((value) ? MF_CHECKED : MF_UNCHECKED));
|
||||
CHECKITEM(ID_DEBUG_IGNOREILLEGALREADS, g_Config.bIgnoreBadMemAccess);
|
||||
CHECKITEM(ID_DEBUG_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats);
|
||||
CHECKITEM(ID_DEBUG_SHOWDEBUGSTATISTICS, g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS);
|
||||
CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform);
|
||||
CHECKITEM(ID_DEBUG_BREAKONLOAD, !g_Config.bAutoRun);
|
||||
CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache);
|
||||
|
@ -234,7 +234,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
|
||||
|
||||
System_Notify(SystemNotification::BOOT_DONE);
|
||||
|
||||
Core_UpdateDebugStats(g_Config.bShowDebugStats || g_Config.bLogFrameDrops);
|
||||
Core_UpdateDebugStats(g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS || g_Config.bLogFrameDrops);
|
||||
|
||||
PSP_BeginHostFrame();
|
||||
Draw::DrawContext *draw = coreParameter.graphicsContext ? coreParameter.graphicsContext->GetDrawContext() : nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user