diff --git a/CHANGES b/CHANGES index 9a9171beb..4ad150ddf 100644 --- a/CHANGES +++ b/CHANGES @@ -66,6 +66,7 @@ Bugfixes: - GBA Cheats: Fix Pro Action Replay and GameShark issues when used together - Qt: Fix analog buttons not getting unmapped - GBA Video: Prevent tiles < 512 from being used in modes 3 - 5 + - Qt: Fix passing command line options Misc: - Qt: Handle saving input settings better - Debugger: Free watchpoints in addition to breakpoints diff --git a/src/platform/qt/ConfigController.cpp b/src/platform/qt/ConfigController.cpp index a5859fc83..65ee51528 100644 --- a/src/platform/qt/ConfigController.cpp +++ b/src/platform/qt/ConfigController.cpp @@ -115,8 +115,8 @@ ConfigController::ConfigController(QObject* parent) m_opts.rewindBufferCapacity = 0; m_opts.useBios = true; m_opts.suspendScreensaver = true; - GBAConfigLoadDefaults(&m_config, &m_opts); GBAConfigLoad(&m_config); + GBAConfigLoadDefaults(&m_config, &m_opts); GBAConfigMap(&m_config, &m_opts); } @@ -126,7 +126,11 @@ ConfigController::~ConfigController() { } bool ConfigController::parseArguments(GBAArguments* args, int argc, char* argv[]) { - return ::parseArguments(args, &m_config, argc, argv, 0); + if (::parseArguments(args, &m_config, argc, argv, 0)) { + GBAConfigMap(&m_config, &m_opts); + return true; + } + return false; } ConfigOption* ConfigController::addOption(const char* key) { diff --git a/src/platform/qt/GBAApp.cpp b/src/platform/qt/GBAApp.cpp index f8b4456b7..3200f45e7 100644 --- a/src/platform/qt/GBAApp.cpp +++ b/src/platform/qt/GBAApp.cpp @@ -45,14 +45,21 @@ GBAApp::GBAApp(int& argc, char* argv[]) Display::setDriver(static_cast(m_configController.getQtOption("displayDriver").toInt())); } + GBAArguments args; + bool loaded = m_configController.parseArguments(&args, argc, argv); + if (loaded && args.showHelp) { + usage(argv[0], 0); + ::exit(0); + return; + } + Window* w = new Window(&m_configController); connect(w, &Window::destroyed, [this]() { m_windows[0] = nullptr; }); m_windows[0] = w; - GBAArguments args; - if (m_configController.parseArguments(&args, argc, argv)) { + if (loaded) { w->argumentsPassed(&args); } else { w->loadConfig();