Qt: Window size command line options are now supported

This commit is contained in:
Jeffrey Pfau 2015-08-17 22:02:34 -07:00
parent 3271c1a0fd
commit 861928d12a
7 changed files with 39 additions and 5 deletions

View File

@ -1,3 +1,7 @@
0.4.0: (Future)
Misc:
- Qt: Window size command line options are now supported
0.3.0: (2015-08-16) 0.3.0: (2015-08-16)
Features: Features:
- Ability to hide individual background layers, or OBJs - Ability to hide individual background layers, or OBJs

View File

@ -11,6 +11,7 @@
.Nd Game Boy Advance emulator .Nd Game Boy Advance emulator
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm mgba-qt .Nm mgba-qt
.Op Fl 123456f
.Op Fl b Ar biosfile .Op Fl b Ar biosfile
.Op Fl l Ar loglevel .Op Fl l Ar loglevel
.Op Fl p Ar patchfile .Op Fl p Ar patchfile
@ -21,12 +22,26 @@
is a Game Boy Advance emulator. is a Game Boy Advance emulator.
The options are as follows: The options are as follows:
.Bl -tag -width Ds .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 .It Fl b Ar biosfile , Fl -bios Ar biosfile
Specify a BIOS file to use during boot. Specify a BIOS file to use during boot.
If this flag is omitted, If this flag is omitted,
.Nm .Nm
will use the BIOS specified in the configuration file, will use the BIOS specified in the configuration file,
or a high\(hylevel emulated BIOS if none is specified. or a high\(hylevel emulated BIOS if none is specified.
.It Fl f
Start the emulator full\(hyscreen.
.It Fl l Ar loglevel .It Fl l Ar loglevel
Log messages during emulation. Log messages during emulation.
.Ar loglevel .Ar loglevel

View File

@ -145,6 +145,7 @@ void initParserForGraphics(struct SubParser* parser, struct GraphicsOpts* opts)
parser->parse = _parseGraphicsArg; parser->parse = _parseGraphicsArg;
parser->extraOptions = GRAPHICS_OPTIONS; parser->extraOptions = GRAPHICS_OPTIONS;
opts->multiplier = 0; opts->multiplier = 0;
opts->fullscreen = false;
} }
bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg) { bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg) {
@ -152,6 +153,7 @@ bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int o
struct GraphicsOpts* graphicsOpts = parser->opts; struct GraphicsOpts* graphicsOpts = parser->opts;
switch (option) { switch (option) {
case 'f': case 'f':
graphicsOpts->fullscreen = true;
GBAConfigSetDefaultIntValue(config, "fullscreen", 1); GBAConfigSetDefaultIntValue(config, "fullscreen", 1);
return true; return true;
case '1': case '1':

View File

@ -42,6 +42,7 @@ struct SubParser {
struct GraphicsOpts { struct GraphicsOpts {
int multiplier; int multiplier;
bool fullscreen;
}; };
struct GBAThread; struct GBAThread;

View File

@ -126,8 +126,8 @@ ConfigController::~ConfigController() {
GBAConfigFreeOpts(&m_opts); GBAConfigFreeOpts(&m_opts);
} }
bool ConfigController::parseArguments(GBAArguments* args, int argc, char* argv[]) { bool ConfigController::parseArguments(GBAArguments* args, int argc, char* argv[], SubParser* subparser) {
if (::parseArguments(args, &m_config, argc, argv, 0)) { if (::parseArguments(args, &m_config, argc, argv, subparser)) {
GBAConfigMap(&m_config, &m_opts); GBAConfigMap(&m_config, &m_opts);
return true; return true;
} }

View File

@ -16,6 +16,7 @@
extern "C" { extern "C" {
#include "gba/supervisor/config.h" #include "gba/supervisor/config.h"
#include "util/configuration.h" #include "util/configuration.h"
#include "platform/commandline.h"
} }
class QAction; class QAction;
@ -64,7 +65,7 @@ public:
~ConfigController(); ~ConfigController();
const GBAOptions* options() const { return &m_opts; } 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); ConfigOption* addOption(const char* key);
void updateOption(const char* key); void updateOption(const char* key);

View File

@ -50,9 +50,12 @@ GBAApp::GBAApp(int& argc, char* argv[])
} }
GBAArguments args; 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) { if (loaded && args.showHelp) {
usage(argv[0], 0); usage(argv[0], subparser.usage);
::exit(0); ::exit(0);
return; return;
} }
@ -72,6 +75,14 @@ GBAApp::GBAApp(int& argc, char* argv[])
w->loadConfig(); w->loadConfig();
} }
freeArguments(&args); 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->show();
w->controller()->setMultiplayerController(&m_multiplayer); w->controller()->setMultiplayerController(&m_multiplayer);