Skip to content

Commit

Permalink
Add an ImDebugger window for PPSSPP internals, right now just for sys…
Browse files Browse the repository at this point in the history
…dirs
  • Loading branch information
hrydgard committed Jan 23, 2025
1 parent 493367c commit 366fb98
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions UI/ImDebugger/ImDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Core/FileSystems/MetaFileSystem.h"
#include "Core/Debugger/SymbolMap.h"
#include "Core/MemMap.h"
#include "Core/System.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/SocketManager.h"
#include "Core/HLE/NetInetConstants.h"
Expand Down Expand Up @@ -546,6 +547,48 @@ static void DrawApctl(ImConfig &cfg) {
ImGui::End();
}

static void DrawInternals(ImConfig &cfg) {
if (!ImGui::Begin("PPSSPP Internals", &cfg.internalsOpen)) {
ImGui::End();
return;
}

struct entry {
PSPDirectories dir;
const char *name;
};

static const entry dirs[] = {
{DIRECTORY_PSP, "PSP"},
{DIRECTORY_CHEATS, "CHEATS"},
{DIRECTORY_SCREENSHOT, "SCREENSHOT"},
{DIRECTORY_SYSTEM, "SYSTEM"},
{DIRECTORY_GAME, "GAME"},
{DIRECTORY_SAVEDATA, "SAVEDATA"},
{DIRECTORY_PAUTH, "PAUTH"},
{DIRECTORY_DUMP, "DUMP"},
{DIRECTORY_SAVESTATE, "SAVESTATE"},
{DIRECTORY_CACHE, "CACHE"},
{DIRECTORY_TEXTURES, "TEXTURES"},
{DIRECTORY_PLUGINS, "PLUGINS"},
{DIRECTORY_APP_CACHE, "APP_CACHE"},
{DIRECTORY_VIDEO, "VIDEO"},
{DIRECTORY_AUDIO, "AUDIO"},
{DIRECTORY_MEMSTICK_ROOT, "MEMSTICK_ROOT"},
{DIRECTORY_EXDATA, "EXDATA"},
{DIRECTORY_CUSTOM_SHADERS, "CUSTOM_SHADERS"},
{DIRECTORY_CUSTOM_THEMES, "CUSTOM_THEMES"},
};

if (ImGui::CollapsingHeader("Directories", ImGuiTreeNodeFlags_DefaultOpen)) {
for (auto &dir : dirs) {
ImGui::Text("%s: %s", dir.name, GetSysDirectory(dir.dir).c_str());
}
}

ImGui::End();
}

static void DrawAdhoc(ImConfig &cfg) {
if (!ImGui::Begin("AdHoc", &cfg.adhocOpen)) {
ImGui::End();
Expand Down Expand Up @@ -1281,6 +1324,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
if (ImGui::MenuItem("Close Debugger")) {
g_Config.bShowImDebugger = false;
}
ImGui::MenuItem("PPSSPP Internals", nullptr, &cfg_.internalsOpen);
ImGui::MenuItem("Dear ImGui Demo", nullptr, &cfg_.demoOpen);
ImGui::MenuItem("Dear ImGui Style editor", nullptr, &cfg_.styleEditorOpen);
ImGui::EndMenu();
Expand Down Expand Up @@ -1410,6 +1454,10 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
DrawApctl(cfg_);
}

if (cfg_.internalsOpen) {
DrawInternals(cfg_);
}

// Process UI commands
switch (control.command.cmd) {
case ImCmd::SHOW_IN_CPU_DISASM:
Expand Down Expand Up @@ -1777,6 +1825,7 @@ void ImConfig::SyncConfig(IniFile *ini, bool save) {
sync.Sync("adhocOpen", &adhocOpen, false);
sync.Sync("apctlOpen", &apctlOpen, false);
sync.Sync("pixelViewerOpen", &pixelViewerOpen, false);
sync.Sync("internalsOpen", &internalsOpen, false);
for (int i = 0; i < 4; i++) {
char name[64];
snprintf(name, sizeof(name), "memory%dOpen", i + 1);
Expand Down
1 change: 1 addition & 0 deletions UI/ImDebugger/ImDebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ struct ImConfig {
bool apctlOpen;
bool adhocOpen;
bool memDumpOpen;
bool internalsOpen;
bool memViewOpen[4];

// HLE explorer settings
Expand Down

0 comments on commit 366fb98

Please sign in to comment.