From 6adf7cb2d3d9a67f488a2f2c7ee2b375fa74661e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mikko=20Kein=C3=A4nen?= Date: Sat, 9 Oct 2010 00:07:09 +0300 Subject: [PATCH] First game ever launched using EmuFront was Blue Print for Commodore 64 B) --- src/emulauncher.cpp | 20 +++++++++++++++++++- src/emulauncher.h | 5 ++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/emulauncher.cpp b/src/emulauncher.cpp index 4c6ab4d..8d1c48f 100644 --- a/src/emulauncher.cpp +++ b/src/emulauncher.cpp @@ -18,6 +18,7 @@ // along with EmuFront. If not, see . #include +#include #include #include "utils/OSDaB-Zip/unzip.h" #include "emulauncher.h" @@ -36,11 +37,20 @@ EmuLauncher::EmuLauncher(QWidget *parent) : dbMediaType = new DbMediaType(this); dbExec = new DbExecutable(this); dbMic = 0; + proc = 0; initWidgets(); layout(); connectSignals(); } +EmuLauncher::~EmuLauncher() +{ + if (proc) { + proc->kill(); // TODO: do this in a more sophisticated way + delete proc; + } +} + void EmuLauncher::updateData() { platformSelectBox->updateDataModel(); @@ -154,7 +164,7 @@ void EmuLauncher::launchEmu() } } -void EmuLauncher::launch(const Executable * ex, const MediaImageContainer * mic) const +void EmuLauncher::launch(const Executable * ex, const MediaImageContainer * mic) { // extract the media image container to tmp folder // (TODO: tmp folder configuration) @@ -171,4 +181,12 @@ void EmuLauncher::launch(const Executable * ex, const MediaImageContainer * mic) // or if emulator command options has a place for more than one // media image assign the media images in the list order // to emulator command line. + QString cmdWithParams; + cmdWithParams.append(ex->getExecutable()); + // TODO: tmp will be set dynamically + // TODO: command parameters and assigning multiple media images + cmdWithParams.append(" -cartcrt \"/tmp/").append(mic->getMediaImages().first()->getName()).append("\""); + qDebug() << "Command with params " << cmdWithParams; + if (!proc) proc = new QProcess(this); // This has to be done in the heap + proc->start(cmdWithParams, QIODevice::ReadOnly); } diff --git a/src/emulauncher.h b/src/emulauncher.h index 00e69f0..2217487 100644 --- a/src/emulauncher.h +++ b/src/emulauncher.h @@ -32,12 +32,14 @@ class EFFileObjectComboBox; class ExecutableComboBox; class Executable; class MediaImageContainer; +class QProcess; class EmuLauncher : public QWidget { Q_OBJECT public: explicit EmuLauncher(QWidget *parent = 0); + ~EmuLauncher(); void updateData(); signals: @@ -57,12 +59,13 @@ private: DbMediaType *dbMediaType; DbMediaImageContainer *dbMic; DbExecutable *dbExec; + QProcess *proc; void initWidgets(); void layout(); void connectSignals(); void populatePlatformSelectBox(); void populateMediaTypeSelectBox(); - void launch(const Executable*, const MediaImageContainer*) const; + void launch(const Executable*, const MediaImageContainer*); }; #endif // EMULAUNCHER_H -- 1.7.9.5