Add dirmode to Qt frontend
Jeffrey Pfau jeffrey@endrift.com
Sat, 18 Oct 2014 01:54:35 -0700
2 files changed,
15 insertions(+),
8 deletions(-)
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -113,24 +113,31 @@ }
setPaused(wasPaused); } -void GameController::loadGame(const QString& path) { +void GameController::loadGame(const QString& path, bool dirmode) { closeGame(); m_threadContext.sync.videoFrameWait = 0; m_threadContext.sync.audioWait = 1; - QFile file(path); - if (!file.open(QIODevice::ReadOnly)) { - return; + if (!dirmode) { + QFile file(path); + if (!file.open(QIODevice::ReadOnly)) { + return; + } + file.close(); } - file.close(); m_gameOpen = true; m_pauseAfterFrame = false; m_threadContext.fname = strdup(path.toLocal8Bit().constData()); - m_threadContext.rom = VFileOpen(m_threadContext.fname, O_RDONLY); + if (dirmode) { + m_threadContext.gameDir = VDirOpen(m_threadContext.fname); + m_threadContext.stateDir = m_threadContext.gameDir; + } else { + m_threadContext.rom = VFileOpen(m_threadContext.fname, O_RDONLY); #if ENABLE_LIBZIP - m_threadContext.gameDir = VDirOpenZip(m_threadContext.fname, 0); + m_threadContext.gameDir = VDirOpenZip(m_threadContext.fname, 0); #endif + } GBAThreadStart(&m_threadContext); }
M
src/platform/qt/GameController.h
→
src/platform/qt/GameController.h
@@ -52,7 +52,7 @@
void postLog(int level, const QString& log); public slots: - void loadGame(const QString& path); + void loadGame(const QString& path, bool dirmode = false); void closeGame(); void setPaused(bool paused); void reset();