Qt: Window size command line options are now supported
Jeffrey Pfau jeffrey@endrift.com
Mon, 17 Aug 2015 22:02:34 -0700
7 files changed,
39 insertions(+),
5 deletions(-)
M
doc/mgba-qt.6
→
doc/mgba-qt.6
@@ -11,6 +11,7 @@ .Nm mgba-qt
.Nd Game Boy Advance emulator .Sh SYNOPSIS .Nm mgba-qt +.Op Fl 123456f .Op Fl b Ar biosfile .Op Fl l Ar loglevel .Op Fl p Ar patchfile@@ -21,12 +22,26 @@ .Nm
is a Game Boy Advance emulator. The options are as follows: .Bl -tag -width Ds +.It Fl 1 +Scale the window 1\(mu. +.It Fl 2 +Scale the window 2\(mu. +.It Fl 3 +Scale the window 3\(mu. +.It Fl 4 +Scale the window 4\(mu. +.It Fl 5 +Scale the window 5\(mu. +.It Fl 6 +Scale the window 6\(mu. .It Fl b Ar biosfile , Fl -bios Ar biosfile Specify a BIOS file to use during boot. If this flag is omitted, .Nm will use the BIOS specified in the configuration file, or a high\(hylevel emulated BIOS if none is specified. +.It Fl f +Start the emulator full\(hyscreen. .It Fl l Ar loglevel Log messages during emulation. .Ar loglevel
M
src/platform/commandline.c
→
src/platform/commandline.c
@@ -145,6 +145,7 @@ parser->opts = opts;
parser->parse = _parseGraphicsArg; parser->extraOptions = GRAPHICS_OPTIONS; opts->multiplier = 0; + opts->fullscreen = false; } bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg) {@@ -152,6 +153,7 @@ UNUSED(arg);
struct GraphicsOpts* graphicsOpts = parser->opts; switch (option) { case 'f': + graphicsOpts->fullscreen = true; GBAConfigSetDefaultIntValue(config, "fullscreen", 1); return true; case '1':
M
src/platform/commandline.h
→
src/platform/commandline.h
@@ -42,6 +42,7 @@ };
struct GraphicsOpts { int multiplier; + bool fullscreen; }; struct GBAThread;
M
src/platform/qt/ConfigController.cpp
→
src/platform/qt/ConfigController.cpp
@@ -126,8 +126,8 @@ GBAConfigDeinit(&m_config);
GBAConfigFreeOpts(&m_opts); } -bool ConfigController::parseArguments(GBAArguments* args, int argc, char* argv[]) { - if (::parseArguments(args, &m_config, argc, argv, 0)) { +bool ConfigController::parseArguments(GBAArguments* args, int argc, char* argv[], SubParser* subparser) { + if (::parseArguments(args, &m_config, argc, argv, subparser)) { GBAConfigMap(&m_config, &m_opts); return true; }
M
src/platform/qt/ConfigController.h
→
src/platform/qt/ConfigController.h
@@ -16,6 +16,7 @@
extern "C" { #include "gba/supervisor/config.h" #include "util/configuration.h" +#include "platform/commandline.h" } class QAction;@@ -64,7 +65,7 @@ ConfigController(QObject* parent = nullptr);
~ConfigController(); const GBAOptions* options() const { return &m_opts; } - bool parseArguments(GBAArguments* args, int argc, char* argv[]); + bool parseArguments(GBAArguments* args, int argc, char* argv[], SubParser* subparser = nullptr); ConfigOption* addOption(const char* key); void updateOption(const char* key);
M
src/platform/qt/GBAApp.cpp
→
src/platform/qt/GBAApp.cpp
@@ -50,9 +50,12 @@ Display::setDriver(static_cast<Display::Driver>(m_configController.getQtOption("displayDriver").toInt()));
} GBAArguments args; - bool loaded = m_configController.parseArguments(&args, argc, argv); + GraphicsOpts graphicsOpts; + SubParser subparser; + initParserForGraphics(&subparser, &graphicsOpts); + bool loaded = m_configController.parseArguments(&args, argc, argv, &subparser); if (loaded && args.showHelp) { - usage(argv[0], 0); + usage(argv[0], subparser.usage); ::exit(0); return; }@@ -72,6 +75,14 @@ } else {
w->loadConfig(); } freeArguments(&args); + + if (graphicsOpts.multiplier) { + w->resizeFrame(VIDEO_HORIZONTAL_PIXELS * graphicsOpts.multiplier, VIDEO_VERTICAL_PIXELS * graphicsOpts.multiplier); + } + if (graphicsOpts.fullscreen) { + w->enterFullScreen(); + } + w->show(); w->controller()->setMultiplayerController(&m_multiplayer);