From 806dd7daa62d3224c82a93fa6615e544587b31c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ed=C3=AAnis=20Freindorfer=20Azevedo?= Date: Wed, 25 Sep 2019 17:47:35 -0300 Subject: [PATCH] Fix circular `--config` for SDL port. When using the command line options, we had a circular issue: - using `LoadConfig()` before `ReadOpts()` would mean the `--config` is ignored. - using `ReadOpts()` before `LoadConfig()` would mean the command line options were ignored in favor of the default ones. If we want to use a custom `vbam.ini`, we need to load it with `--config`. Now we only consider params order on command line. --- src/common/ConfigManager.cpp | 1 + src/sdl/SDL.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/ConfigManager.cpp b/src/common/ConfigManager.cpp index 6be93583..18879515 100644 --- a/src/common/ConfigManager.cpp +++ b/src/common/ConfigManager.cpp @@ -898,6 +898,7 @@ int ReadOpts(int argc, char ** argv) preferences = NULL; OpenPreferences(optarg); fclose(f); + LoadConfig(); } break; case 'd': diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index 1829a36d..44f00cfc 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -1538,8 +1538,8 @@ int main(int argc, char** argv) gb_effects_config.surround = false; gb_effects_config.enabled = false; - ReadOpts(argc, argv); LoadConfig(); // Parse command line arguments (overrides ini) + ReadOpts(argc, argv); inputSetKeymap(PAD_1, KEY_LEFT, ReadPrefHex("Joy0_Left")); inputSetKeymap(PAD_1, KEY_RIGHT, ReadPrefHex("Joy0_Right"));