+QStringList virtualMediaList; // {TYPE, POSITION}
+QCommandLineOption *_opt_fds[8];
+QCommandLineOption *_opt_hdds[8];
+QCommandLineOption *_opt_cmts[2];
+QCommandLineOption *_opt_lds[2];
+QCommandLineOption *_opt_cds[2];
+QCommandLineOption *_opt_binaries[8];
+QCommandLineOption *_opt_bubbles[8];
+QCommandLineOption *_opt_qds[8];
+QCommandLineOption *_opt_carts[8];
+extern QCommandLineOption *_opt_homedir;
+extern QCommandLineOption *_opt_cfgfile;
+extern QCommandLineOption *_opt_cfgdir;
+extern QCommandLineOption *_opt_resdir;
+extern QCommandLineOption *_opt_opengl;
+extern QCommandLineOption *_opt_envver;
+extern QCommandLineOption *_opt_dump_envver;
+extern QCommandLineOption *_opt_dipsw_on;
+extern QCommandLineOption *_opt_dipsw_off;
+extern QProcessEnvironment _envvers;
+bool _b_dump_envver;
+std::string config_fullpath;
+
+void SetFDOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_FLOPPY_DISK)
+ for(int i = 0; i < USE_FLOPPY_DISK; i++) {
+ QString sfdType1 = QString::fromUtf8("fd%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vFd%1").arg(i);
+ QString sfdType3 = QString::fromUtf8("vFloppyDisk%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _cl.append(sfdType3);
+ _opt_fds[i] = new QCommandLineOption(_cl,QCoreApplication::translate("main", "Set virtual floppy disk %1.").arg(i) , "[D88_SLOT@]fullpath");
+ cmdparser->addOption(*_opt_fds[i]);
+ _cl.clear();
+ }
+#endif
+}
+
+void SetHDDOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_HARD_DISK)
+ for(int i = 0; i < USE_HARD_DISK; i++) {
+ QString sfdType1 = QString::fromUtf8("hd%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vHd%1").arg(i);
+ QString sfdType3 = QString::fromUtf8("vHardDisk%1").arg(i);
+ QString sfdType4 = QString::fromUtf8("vHardDrive%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _cl.append(sfdType3);
+ _cl.append(sfdType4);
+ _opt_hdds[i] = new QCommandLineOption(_cl,QCoreApplication::translate("main", "Set virtual hard drive %1.").arg(i) , "[D88_SLOT@]fullpath");
+ cmdparser->addOption(*_opt_hdds[i]);
+ _cl.clear();
+ }
+#endif
+}
+
+void SetBinaryOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_BINARY_FILE)
+ for(int i = 0; i < USE_BINARY_FILE; i++) {
+ QString sfdType1 = QString::fromUtf8("bin%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vBinary%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _opt_binaries[i] = new QCommandLineOption(_cl,QCoreApplication::translate("main", "Set virtual binary image %1.").arg(i) , "fullpath");
+ cmdparser->addOption(*_opt_binaries[i]);
+ _cl.clear();
+ }
+#endif
+}
+
+void SetCartOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_CART)
+ for(int i = 0; i < USE_CART; i++) {
+ QString sfdType1 = QString::fromUtf8("cart%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vCart%1").arg(i);
+ QString sfdType3 = QString::fromUtf8("vCartridge%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _cl.append(sfdType3);
+ _opt_carts[i] = new QCommandLineOption(_cl,QCoreApplication::translate("main", "Set virtual cartridge %1 (mostly ROM).").arg(i) , "fullpath");
+ cmdparser->addOption(*_opt_carts[i]);
+ _cl.clear();
+ }
+#endif
+}
+void SetBubbleOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_BUBBLE)
+ for(int i = 0; i < USE_BUBBLE; i++) {
+ QString sfdType1 = QString::fromUtf8("bub%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vBubble%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _opt_bubbles[i] = new QCommandLineOption(_cl,QCoreApplication::translate("main", "Set virtual bubble cartridge %1.").arg(i) , "[B88_SLOT@]fullpath");
+ cmdparser->addOption(*_opt_bubbles[i]);
+ }
+#endif
+}
+
+void SetLDOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_LASER_DISC)
+ for(int i = 0; i < USE_LASER_DISC; i++) {
+ QString sfdType1 = QString::fromUtf8("ld%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vLaserDisc%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _opt_lds[i] = new QCommandLineOption(_cl, QCoreApplication::translate("main", "Set virtual laser disc %1 (mostly movie file).").arg(i) , "fullpath");
+ cmdparser->addOption(*_opt_lds[i]);
+ _cl.clear();
+ }
+#endif
+}
+void SetCDOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_COMPACT_DISC)
+ for(int i = 0; i < USE_COMPACT_DISC; i++) {
+ QString sfdType1 = QString::fromUtf8("cd%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vCompactDisc%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _opt_cds[i] = new QCommandLineOption(_cl,QCoreApplication::translate("main", "Set virtual compact disc %1.").arg(i) , "fullpath");
+ cmdparser->addOption(*_opt_cds[i]);
+ _cl.clear();
+ }
+#endif
+}
+
+void SetCmtOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_TAPE)
+ for(int i = 0; i < USE_TAPE; i++) {
+ QString sfdType1 = QString::fromUtf8("cmt%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("tape%1").arg(i);
+ QString sfdType3 = QString::fromUtf8("vCmt%1").arg(i);
+ QString sfdType4 = QString::fromUtf8("vTape%1").arg(i);
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _cl.append(sfdType3);
+ _cl.append(sfdType4);
+ _opt_cmts[i] = new QCommandLineOption(_cl, QCoreApplication::translate("main", "Set virtual casette tape %1.").arg(i) , "fullpath");
+ cmdparser->addOption(*_opt_cmts[i]);
+ _cl.clear();
+ }
+#endif
+}
+
+void SetQuickDiskOptions(QCommandLineParser *cmdparser)
+{
+#if defined(USE_QUICK_DISK)
+ for(int i = 0; i < USE_QUICK_DISK; i++) {
+ QString sfdType1 = QString::fromUtf8("qd%1").arg(i);
+ QString sfdType2 = QString::fromUtf8("vQuickDisk%1").arg(i);
+
+ QStringList _cl;
+ _cl.append(sfdType1);
+ _cl.append(sfdType2);
+ _opt_qds[i] = new QCommandLineOption(_cl, QCoreApplication::translate("main", "Set virtual quick disk %1.").arg(i) , "fullpath");
+ cmdparser->addOption(*_opt_qds[i]);
+ _cl.clear();
+ }
+#endif
+}
+
+
+void SetProcCmdFD(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_FLOPPY_DISK)
+ for(int i = 0; i < USE_FLOPPY_DISK; i++) {
+ if(_opt_fds[i] != NULL) {
+ if(cmdparser->isSet(*_opt_fds[i])) {
+ QString sfdType = QString::fromUtf8("vFloppyDisk%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_fds[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdHDD(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_HARD_DISK)
+ for(int i = 0; i < USE_HARD_DISK; i++) {
+ if(_opt_hdds[i] != NULL) {
+ if(cmdparser->isSet(*_opt_hdds[i])) {
+ QString sfdType = QString::fromUtf8("vHardDisk%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_hdds[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdQuickDisk(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_QUICK_DISK)
+ for(int i = 0; i < USE_QUICK_DISK; i++) {
+ if(_opt_qds[i] != NULL) {
+ if(cmdparser->isSet(*_opt_qds[i])) {
+ QString sfdType = QString::fromUtf8("vQuickDisk%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_qds[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdCmt(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_TAPE)
+ for(int i = 0; i < USE_TAPE; i++) {
+ if(_opt_cmts[i] != NULL) {
+ if(cmdparser->isSet(*_opt_cmts[i])) {
+ QString sfdType = QString::fromUtf8("vCmt%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_cmts[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdBinary(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_BINARY_FILE)
+ for(int i = 0; i < USE_BINARY_FILE; i++) {
+ if(_opt_binaries[i] != NULL) {
+ if(cmdparser->isSet(*_opt_binaries[i])) {
+ QString sfdType = QString::fromUtf8("vBinary%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_binaries[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdBubble(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_BUBBLE)
+ for(int i = 0; i < USE_BUBBLE; i++) {
+ if(_opt_bubbles[i] != NULL) {
+ if(cmdparser->isSet(*_opt_bubbles[i])) {
+ QString sfdType = QString::fromUtf8("vBubble%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_bubbles[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdCart(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_CART)
+ for(int i = 0; i < USE_CART; i++) {
+ if(_opt_carts[i] != NULL) {
+ if(cmdparser->isSet(*_opt_carts[i])) {
+ QString sfdType = QString::fromUtf8("vCart%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_carts[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdLD(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_LASER_DISC)
+ for(int i = 0; i < USE_LASER_DISC; i++) {
+ if(_opt_lds[i] != NULL) {
+ if(cmdparser->isSet(*_opt_lds[i])) {
+ QString sfdType = QString::fromUtf8("vLD%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_lds[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+void SetProcCmdCD(QCommandLineParser *cmdparser, QStringList *_l)
+{
+#if defined(USE_COMPACT_DISC)
+ for(int i = 0; i < USE_COMPACT_DISC; i++) {
+ if(_opt_cds[i] != NULL) {
+ if(cmdparser->isSet(*_opt_cds[i])) {
+ QString sfdType = QString::fromUtf8("vCD%1").arg(i);
+ QString medianame = cmdparser->value(*_opt_cds[i]);
+ _l->append(sfdType);
+ _l->append(medianame);
+ }
+ }
+ }
+#endif
+}
+
+extern void SetOptions_Sub(QCommandLineParser *cmdparser);
+void SetOptions(QCommandLineParser *cmdparser)
+{
+ QString emudesc = QString::fromUtf8("Emulator for ");
+ emudesc = emudesc + QString::fromUtf8(DEVICE_NAME);
+ cmdparser->setApplicationDescription(emudesc);
+ cmdparser->addHelpOption();
+ //cmdparser->addVersionOption();
+
+ SetOptions_Sub(cmdparser);
+ QStringList _cl;
+
+ for(int i = 0; i < 8; i++) {
+ _opt_fds[i] = NULL;
+ _opt_hdds[i] = NULL;
+ _opt_qds[i] = NULL;
+ _opt_bubbles[i] = NULL;
+ _opt_binaries[i] = NULL;
+ _opt_carts[i] = NULL;
+ }
+ for(int i = 0; i < 2; i++) {
+ _opt_cmts[i] = NULL;
+ _opt_lds[i] = NULL;
+ _opt_cds[i] = NULL;
+ }
+
+ SetFDOptions(cmdparser);
+ SetHDDOptions(cmdparser);
+ //SetBinaryOptions(cmdparser); // Temporally disabled.
+ SetCmtOptions(cmdparser);
+ SetCartOptions(cmdparser);
+ SetBubbleOptions(cmdparser); // Temporally disabled.
+ SetQuickDiskOptions(cmdparser);
+ SetLDOptions(cmdparser); // Temporally disabled.
+ SetCDOptions(cmdparser);
+
+ cmdparser->addOption(*_opt_envver);
+ cmdparser->addOption(*_opt_dump_envver);
+}
+
+extern void ProcessCmdLine_Sub(QCommandLineParser *cmdparser, QStringList *_l);
+
+void ProcessCmdLine(QCommandLineParser *cmdparser, QStringList *_l)