Pass ROM as launch argument

This commit is contained in:
Fabien Freling 2019-07-12 13:39:49 +02:00
parent fda60ba538
commit 690df0321f
2 changed files with 10 additions and 3 deletions

View file

@ -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<OBoy>("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();
}

View file

@ -1,6 +1,7 @@
#include "oboy.h"
#include <QtGlobal>
#include <QCoreApplication>
#include <caml/mlvalues.h>
#include <caml/callback.h>
@ -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) {