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)
Features:
- Ability to hide individual background layers, or OBJs

View File

@ -11,6 +11,7 @@
.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 @@
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

View File

@ -145,6 +145,7 @@ void initParserForGraphics(struct SubParser* parser, struct GraphicsOpts* 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 @@ bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int o
struct GraphicsOpts* graphicsOpts = parser->opts;
switch (option) {
case 'f':
graphicsOpts->fullscreen = true;
GBAConfigSetDefaultIntValue(config, "fullscreen", 1);
return true;
case '1':

View File

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

View File

@ -126,8 +126,8 @@ ConfigController::~ConfigController() {
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;
}

View File

@ -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 @@ public:
~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);

View File

@ -50,9 +50,12 @@ GBAApp::GBAApp(int& argc, char* argv[])
}
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 @@ GBAApp::GBAApp(int& argc, char* argv[])
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);