From 7fda054147c7ce7f5e1fdac156e3c84fac876db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 3 Sep 2025 14:10:54 +0200 Subject: [PATCH] ImDebugger: Add a GameInfo tab to the PARAM.SFO window. --- Core/Loaders.cpp | 26 +++++++++++++++++++++ Core/Loaders.h | 2 ++ UI/ImDebugger/ImDebugger.cpp | 45 ++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/Core/Loaders.cpp b/Core/Loaders.cpp index a656724b33..5a9ed1d8fc 100644 --- a/Core/Loaders.cpp +++ b/Core/Loaders.cpp @@ -534,3 +534,29 @@ void DetectZipFileContents(struct zip *z, ZipFileInfo *info) { info->contents = ZipFileContents::UNKNOWN; } } + +const char *IdentifiedFileTypeToString(IdentifiedFileType type) { + switch (type) { + case IdentifiedFileType::ERROR_IDENTIFYING: return "ERROR_IDENTIFYING"; + case IdentifiedFileType::PSP_PBP_DIRECTORY: return "PSP_PBP_DIRECTORY"; + case IdentifiedFileType::PSP_PBP: return "PSP_PBP"; + case IdentifiedFileType::PSP_ELF: return "PSP_ELF"; + case IdentifiedFileType::PSP_ISO: return "PSP_ISO"; + case IdentifiedFileType::PSP_ISO_NP: return "PSP_ISO_NP"; + case IdentifiedFileType::PSP_DISC_DIRECTORY: return "PSP_DISC_DIRECTORY"; + case IdentifiedFileType::UNKNOWN_BIN: return "UNKNOWN_BIN"; + case IdentifiedFileType::UNKNOWN_ELF: return "UNKNOWN_ELF"; + case IdentifiedFileType::UNKNOWN_ISO: return "UNKNOWN_ISO"; + case IdentifiedFileType::ARCHIVE_RAR: return "ARCHIVE_RAR"; + case IdentifiedFileType::ARCHIVE_ZIP: return "ARCHIVE_ZIP"; + case IdentifiedFileType::ARCHIVE_7Z: return "ARCHIVE_7Z"; + case IdentifiedFileType::PSP_PS1_PBP: return "PSP_PS1_PBP"; + case IdentifiedFileType::ISO_MODE2: return "ISO_MODE2"; + case IdentifiedFileType::NORMAL_DIRECTORY: return "NORMAL_DIRECTORY"; + case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY: return "PSP_SAVEDATA_DIRECTORY"; + case IdentifiedFileType::PPSSPP_SAVESTATE: return "PPSSPP_SAVESTATE"; + case IdentifiedFileType::PPSSPP_GE_DUMP: return "PPSSPP_GE_DUMP"; + case IdentifiedFileType::UNKNOWN: return "UNKNOWN"; + default: return "INVALID_TYPE"; + } +} diff --git a/Core/Loaders.h b/Core/Loaders.h index 4015e022fe..10b51933c3 100644 --- a/Core/Loaders.h +++ b/Core/Loaders.h @@ -61,6 +61,8 @@ enum class IdentifiedFileType { UNKNOWN, }; +const char *IdentifiedFileTypeToString(IdentifiedFileType type); + // NB: It is a REQUIREMENT that implementations of this class are entirely thread safe! // TOOD: actually, is it really? class FileLoader { diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 1d8539e7f7..3d84a4b622 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -65,6 +65,7 @@ #include "UI/ImDebugger/ImDebugger.h" #include "UI/ImDebugger/ImGe.h" #include "UI/AudioCommon.h" +#include "UI/GameInfoCache.h" extern bool g_TakeScreenshot; static ImVec4 g_normalTextColor; @@ -547,6 +548,50 @@ void DrawParamSFO(ImConfig &cfg, ImControl &control) { renderParamSFOTable(g_paramSFORaw); ImGui::EndTabItem(); } + if (ImGui::BeginTabItem("GameInfo")) { + Path path = PSP_CoreParameter().fileToStart; + std::shared_ptr info = g_gameInfoCache->GetInfo(nullptr, path, GameInfoFlags::PARAM_SFO); + + if (info && ImGui::BeginTable("paramsfo", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH | ImGuiTableFlags_Resizable)) { + ImGui::TableSetupColumn("Key", ImGuiTableColumnFlags_WidthFixed, 140.0f); + ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthFixed, 270.0f); + + ImGui::TableHeadersRow(); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextUnformatted("Title"); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(info->GetTitle()); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextUnformatted("Path"); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(path.ToVisualString()); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextUnformatted("Detected type"); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(IdentifiedFileTypeToString(info->fileType)); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextUnformatted("Detected region"); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(GameRegionToString(info->region)); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextUnformatted("HasConfig"); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(BoolStr(info->hasConfig)); + + ImGui::EndTable(); + } + ImGui::EndTabItem(); + } ImGui::EndTabBar(); }