[UI] Standardized bundled data lookups (patches, optimized settings)

Should fix appimage not being able to load recommended settings
This commit is contained in:
Herman S.
2026-02-09 00:07:56 +09:00
parent dba21257a7
commit 86ead2d0fe
4 changed files with 11 additions and 10 deletions
+4
View File
@@ -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;
+1
View File
@@ -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.
+4 -7
View File
@@ -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",
+2 -3
View File
@@ -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<std::filesystem::path> 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