Qt: Fix passing command line options

This commit is contained in:
Jeffrey Pfau 2015-08-05 18:04:07 -07:00
parent 742296b8b9
commit cf8e84a1f8
3 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -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) {

View File

@ -45,14 +45,21 @@ GBAApp::GBAApp(int& argc, char* argv[])
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();