From 9b754ae117a90623a083284337c3541d718c5ed3 Mon Sep 17 00:00:00 2001 From: Fire Cube Date: Sat, 24 May 2025 12:24:24 +0200 Subject: [PATCH] move gamefolder to elfinfo --- src/common/elf_info.h | 5 +++++ src/core/devtools/widget/module_list.cpp | 3 --- src/core/devtools/widget/module_list.h | 10 ++-------- src/emulator.cpp | 4 ++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/common/elf_info.h b/src/common/elf_info.h index 062cee012..02b845cb5 100644 --- a/src/common/elf_info.h +++ b/src/common/elf_info.h @@ -71,6 +71,7 @@ class ElfInfo { PSFAttributes psf_attributes{}; std::filesystem::path splash_path{}; + std::filesystem::path game_folder{}; public: static constexpr u32 FW_15 = 0x1500000; @@ -123,6 +124,10 @@ public: [[nodiscard]] const std::filesystem::path& GetSplashPath() const { return splash_path; } + + [[nodiscard]] const std::filesystem::path& GetGameFolder() const { + return game_folder; + } }; } // namespace Common diff --git a/src/core/devtools/widget/module_list.cpp b/src/core/devtools/widget/module_list.cpp index 85b554838..73afe3462 100644 --- a/src/core/devtools/widget/module_list.cpp +++ b/src/core/devtools/widget/module_list.cpp @@ -12,9 +12,6 @@ using namespace ImGui; namespace Core::Devtools::Widget { - -std::filesystem::path ModuleList::game_folder; - void ModuleList::Draw() { SetNextWindowSize({550.0f, 600.0f}, ImGuiCond_FirstUseEver); if (!Begin("Module List", &open)) { diff --git a/src/core/devtools/widget/module_list.h b/src/core/devtools/widget/module_list.h index 1f1f85a1f..4c961919e 100644 --- a/src/core/devtools/widget/module_list.h +++ b/src/core/devtools/widget/module_list.h @@ -8,7 +8,7 @@ #include #include #include - +#include "common/elf_info.h" #include "common/path_util.h" namespace Core::Devtools::Widget { @@ -21,12 +21,6 @@ public: void Draw(); bool open = false; - static std::filesystem::path game_folder; - - static void SetGameFolder(const std::filesystem::path& path) { - game_folder = path; - } - static bool IsSystemModule(const std::filesystem::path& path) { const auto sys_modules_path = Common::FS::GetUserPath(Common::FS::PathType::SysModuleDir); @@ -40,7 +34,7 @@ public: } static bool IsSystemModule(const std::string& name) { - const auto game_modules_path = game_folder / "sce_module"; + const auto game_modules_path = Common::ElfInfo::Instance().GetGameFolder() / "sce_module"; const auto prx_path = game_modules_path / name; if (!std::filesystem::exists(prx_path)) { diff --git a/src/emulator.cpp b/src/emulator.cpp index bbb5076a8..f32248727 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -76,8 +76,6 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector::Instance(); mnt->Mount(game_folder, "/app0", true); @@ -191,6 +189,8 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector", id, title, app_version); std::string window_title = ""; if (Common::g_is_release) {