Play-/Source/ui_qt/main.cpp

73 lines
1.8 KiB
C++
Raw Normal View History

2016-09-06 00:12:56 +01:00
#include <QApplication>
2018-10-08 02:43:23 +01:00
#include <QCommandLineParser>
#include "mainwindow.h"
2018-10-08 02:43:23 +01:00
#include "QStringUtils.h"
2016-09-06 00:12:56 +01:00
2018-04-30 21:01:23 +01:00
int main(int argc, char* argv[])
2016-09-06 00:12:56 +01:00
{
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
2018-04-30 21:01:23 +01:00
QApplication a(argc, argv);
2018-10-08 02:43:23 +01:00
QCoreApplication::setApplicationName("Play!");
QCoreApplication::setApplicationVersion("Version: " PLAY_VERSION);
QCommandLineParser parser;
parser.setApplicationDescription("Description: A multiplatform PS2 emulator.");
parser.addHelpOption();
parser.addVersionOption();
#ifdef DEBUGGER_INCLUDED
QCommandLineOption debugger_option("debugger", "Show debugger");
parser.addOption(debugger_option);
#endif
2018-10-08 02:43:23 +01:00
QCommandLineOption cdrom_image_option("cdrom0", "Boot last booted cdvd image");
parser.addOption(cdrom_image_option);
2018-10-08 02:43:23 +01:00
QCommandLineOption disc_image_option("disc", "Boot any supported disc image", "disc_image");
parser.addOption(disc_image_option);
2018-10-08 02:43:23 +01:00
QCommandLineOption elf_image_option("elf", "Boot supported elf image", "elf_image");
parser.addOption(elf_image_option);
QCommandLineOption load_state_option("state", "Load state at index", "state_index");
parser.addOption(load_state_option);
2018-10-08 02:43:23 +01:00
parser.process(a);
2018-04-30 21:01:23 +01:00
MainWindow w;
#ifdef DEBUGGER_INCLUDED
a.installNativeEventFilter(&w);
#endif
2018-04-30 21:01:23 +01:00
w.show();
2018-10-08 02:43:23 +01:00
if(parser.isSet(cdrom_image_option))
{
w.BootCDROM();
}
else if(parser.isSet(disc_image_option))
{
QString disc_image = parser.value(disc_image_option);
w.LoadCDROM(QStringToPath(disc_image));
w.BootCDROM();
}
else if(parser.isSet(elf_image_option))
{
QString elf_image = parser.value(elf_image_option);
w.BootElf(QStringToPath(elf_image));
}
if(parser.isSet(load_state_option))
{
QString stateIndex = parser.value(load_state_option);
w.loadState(stateIndex.toInt());
}
#ifdef DEBUGGER_INCLUDED
if(parser.isSet(debugger_option))
{
w.ShowDebugger();
}
#endif
2018-04-30 21:01:23 +01:00
return a.exec();
2016-09-06 00:12:56 +01:00
}