Qt: Fix passing command line options
Jeffrey Pfau jeffrey@endrift.com
Wed, 05 Aug 2015 18:04:07 -0700
3 files changed,
16 insertions(+),
4 deletions(-)
M
CHANGES
→
CHANGES
@@ -66,6 +66,7 @@ - Qt: Fix a missing va_end call in the log handler lambda within the GameController constructor
- 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
M
src/platform/qt/ConfigController.cpp
→
src/platform/qt/ConfigController.cpp
@@ -115,8 +115,8 @@ m_opts.rewindBufferInterval = 0;
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 @@ GBAConfigFreeOpts(&m_opts);
} 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) {
M
src/platform/qt/GBAApp.cpp
→
src/platform/qt/GBAApp.cpp
@@ -45,14 +45,21 @@ if (!m_configController.getQtOption("displayDriver").isNull()) {
Display::setDriver(static_cast<Display::Driver>(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();