From 690df0321fad148ca8315d06d14791f3ee40189c Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 12 Jul 2019 13:39:49 +0200 Subject: [PATCH] Pass ROM as launch argument --- src/qt/main.cpp | 7 +++++-- src/qt/oboy.cpp | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/qt/main.cpp b/src/qt/main.cpp index f45a3e3..7e3d945 100644 --- a/src/qt/main.cpp +++ b/src/qt/main.cpp @@ -10,16 +10,19 @@ int main(int argc, char *argv[]) { + QCoreApplication::setApplicationName("OBoy"); + QCoreApplication::setOrganizationName("ffreling"); + QCoreApplication::setOrganizationDomain("ffreling.com"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); + caml_main(argv); + qmlRegisterType("com.oboy.oboy", 1, 0, "OBoy"); QQmlApplicationEngine engine; engine.addImageProvider(QLatin1String("oboy"), new OImageProvider(engine)); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - caml_main(argv); - return app.exec(); } diff --git a/src/qt/oboy.cpp b/src/qt/oboy.cpp index a621458..062536f 100644 --- a/src/qt/oboy.cpp +++ b/src/qt/oboy.cpp @@ -1,6 +1,7 @@ #include "oboy.h" #include +#include #include #include @@ -12,7 +13,10 @@ OBoy::OBoy(QObject *parent) : QObject(parent) { -// load("/Users/ffreling/Downloads/Super_Mario_Land.gb"); + const QStringList args = QCoreApplication::arguments(); + if (args.size() > 1) { + load(args.at(1)); + } } value *fetch_caml_callback(const char *name) {