Game specific configs (#3376)

* poc

* Set up variable game specific variable copies

* Set up getters to return the game specific option if it exists

* Avoid exceptions if a value isn't in the config

* Make sure the custom configs folder exists

* Update + review comments + rewrite

* The loathsome clang-formatter

* Specify which getter/setter is used everywhere
This commit is contained in:
kalaposfos13
2025-09-04 20:25:04 +02:00
committed by GitHub
parent e06667d307
commit 487bcaae85
5 changed files with 393 additions and 328 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,7 @@ struct GameInstallDir {
enum HideCursorState : int { Never, Idle, Always };
void load(const std::filesystem::path& path);
void load(const std::filesystem::path& path, bool is_game_specific = false);
void save(const std::filesystem::path& path);
int getVolumeSlider();

View File

@@ -137,6 +137,7 @@ static auto UserPaths = [] {
create_path(PathType::PatchesDir, user_dir / PATCHES_DIR);
create_path(PathType::MetaDataDir, user_dir / METADATA_DIR);
create_path(PathType::CustomTrophy, user_dir / CUSTOM_TROPHY);
create_path(PathType::CustomConfigs, user_dir / CUSTOM_CONFIGS);
std::ofstream notice_file(user_dir / CUSTOM_TROPHY / "Notice.txt");
if (notice_file.is_open()) {

View File

@@ -27,6 +27,7 @@ enum class PathType {
PatchesDir, // Where patches are stored.
MetaDataDir, // Where game metadata (e.g. trophies and menu backgrounds) is stored.
CustomTrophy, // Where custom files for trophies are stored.
CustomConfigs, // Where custom files for different games are stored.
};
constexpr auto PORTABLE_DIR = "user";
@@ -44,6 +45,7 @@ constexpr auto CHEATS_DIR = "cheats";
constexpr auto PATCHES_DIR = "patches";
constexpr auto METADATA_DIR = "game_data";
constexpr auto CUSTOM_TROPHY = "custom_trophy";
constexpr auto CUSTOM_CONFIGS = "custom_configs";
// Filenames
constexpr auto LOG_FILE = "shad_log.txt";

View File

@@ -114,6 +114,9 @@ void Emulator::Run(std::filesystem::path file, const std::vector<std::string> ar
}
}
Config::load(Common::FS::GetUserPath(Common::FS::PathType::CustomConfigs) / (id + ".toml"),
true);
// Initialize logging as soon as possible
if (!id.empty() && Config::getSeparateLogFilesEnabled()) {
Common::Log::Initialize(id + ".log");