mirror of
https://github.com/izzy2lost/xenia-edge.git
synced 2026-07-06 00:20:26 -07:00
[UI] Standardized bundled data lookups (patches, optimized settings)
Should fix appimage not being able to load recommended settings
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user