all repos — mgba @ 861928d12a25ade175917c18879340472dbc2895

mGBA Game Boy Advance Emulator

Qt: Window size command line options are now supported
Jeffrey Pfau jeffrey@endrift.com
Mon, 17 Aug 2015 22:02:34 -0700
commit

861928d12a25ade175917c18879340472dbc2895

parent

3271c1a0fd1b38329fd8b3ee56f2f4ba63afaba5

M CHANGESCHANGES

@@ -1,3 +1,7 @@

+0.4.0: (Future) +Misc: + - Qt: Window size command line options are now supported + 0.3.0: (2015-08-16) Features: - Ability to hide individual background layers, or OBJs
M doc/mgba-qt.6doc/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.csrc/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.hsrc/platform/commandline.h

@@ -42,6 +42,7 @@ };

struct GraphicsOpts { int multiplier; + bool fullscreen; }; struct GBAThread;
M src/platform/qt/ConfigController.cppsrc/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.hsrc/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.cppsrc/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);