all repos — mgba @ acd0e58235b2afe37597b3980eac23ef8e1c70a7

mGBA Game Boy Advance Emulator

Add dirmode to Qt frontend
Jeffrey Pfau jeffrey@endrift.com
Sat, 18 Oct 2014 01:54:35 -0700
commit

acd0e58235b2afe37597b3980eac23ef8e1c70a7

parent

c32122c1535abf932b346f164d585f87de4509e4

2 files changed, 15 insertions(+), 8 deletions(-)

jump to
M src/platform/qt/GameController.cppsrc/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.hsrc/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();