From 86ead2d0feb3d6c5604aa1be728352469fb3cf3d Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Mon, 9 Feb 2026 00:07:56 +0900 Subject: [PATCH] [UI] Standardized bundled data lookups (patches, optimized settings) Should fix appimage not being able to load recommended settings --- src/xenia/config.cc | 4 ++++ src/xenia/config.h | 1 + src/xenia/ui/game_config_dialog_qt.cc | 11 ++++------- src/xenia/ui/game_list_dialog_qt.cc | 5 ++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/xenia/config.cc b/src/xenia/config.cc index bd8ef0508..143100372 100644 --- a/src/xenia/config.cc +++ b/src/xenia/config.cc @@ -50,6 +50,10 @@ std::filesystem::path GetGameConfigPath(const std::string& title_id) { return config_folder / "config" / (title_id + game_config_suffix); } +std::filesystem::path GetBundledDataPath(const std::string& subdirectory) { + return xe::filesystem::GetExecutablePath().parent_path() / subdirectory; +} + bool sortCvar(cvar::IConfigVar* a, cvar::IConfigVar* b) { if (a->category() < b->category()) return true; if (a->category() > b->category()) return false; diff --git a/src/xenia/config.h b/src/xenia/config.h index 09cc10780..344d22cb9 100644 --- a/src/xenia/config.h +++ b/src/xenia/config.h @@ -26,6 +26,7 @@ extern std::string game_config_suffix; void SetupConfig(const std::filesystem::path& config_folder); toml::table LoadGameConfig(uint32_t title_id); +std::filesystem::path GetBundledDataPath(const std::string& subdirectory); // Extract title_id from a game file and load its config overrides. // Returns the title_id if successful, 0 otherwise. diff --git a/src/xenia/ui/game_config_dialog_qt.cc b/src/xenia/ui/game_config_dialog_qt.cc index f44f348f9..a7776a4d2 100644 --- a/src/xenia/ui/game_config_dialog_qt.cc +++ b/src/xenia/ui/game_config_dialog_qt.cc @@ -92,9 +92,8 @@ GameConfigDialogQt::GameConfigDialogQt(QWidget* parent, LoadConfigOverrides(); // Check if recommended settings exist and enable/disable button accordingly - std::filesystem::path settings_path = - xe::filesystem::GetExecutableFolder() / "optimized_settings" / - (fmt::format("{:08X}", title_id_) + ".json"); + auto settings_path = config::GetBundledDataPath("optimized_settings") / + (fmt::format("{:08X}", title_id_) + ".json"); recommended_button_->setEnabled(std::filesystem::exists(settings_path)); } @@ -703,10 +702,8 @@ void GameConfigDialogQt::OnUseRecommendedClicked() { } void GameConfigDialogQt::LoadRecommendedSettings() { - // Construct path to recommended settings JSON file - std::filesystem::path settings_path = - xe::filesystem::GetExecutableFolder() / "optimized_settings" / - (fmt::format("{:08X}", title_id_) + ".json"); + auto settings_path = config::GetBundledDataPath("optimized_settings") / + (fmt::format("{:08X}", title_id_) + ".json"); if (!std::filesystem::exists(settings_path)) { QMessageBox::information(this, "No Recommended Settings", diff --git a/src/xenia/ui/game_list_dialog_qt.cc b/src/xenia/ui/game_list_dialog_qt.cc index 22853dac3..c914ec1f6 100644 --- a/src/xenia/ui/game_list_dialog_qt.cc +++ b/src/xenia/ui/game_list_dialog_qt.cc @@ -39,6 +39,7 @@ #include "xenia/base/string_util.h" #include "xenia/base/system.h" #include "xenia/base/utf8.h" +#include "xenia/config.h" #include "xenia/emulator.h" #include "xenia/hid/input_system.h" #include "xenia/kernel/kernel_state.h" @@ -1516,9 +1517,7 @@ std::vector GameListDialogQt::FindPatchesForTitle( scan_patch_directory(storage_patches_dir, true); // Second, scan executable_dir/game_patches (bundled, read-only patches) - auto executable_path = xe::filesystem::GetExecutablePath(); - auto executable_dir = executable_path.parent_path(); - auto bundled_patches_dir = executable_dir / "game_patches"; + auto bundled_patches_dir = config::GetBundledDataPath("game_patches"); scan_patch_directory(bundled_patches_dir, false); // Don't overwrite storage_root patches