mirror of https://github.com/mgba-emu/mgba.git
Add dirmode to Qt frontend
This commit is contained in:
parent
c32122c153
commit
acd0e58235
|
@ -113,24 +113,31 @@ void GameController::setDebugger(ARMDebugger* debugger) {
|
||||||
setPaused(wasPaused);
|
setPaused(wasPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::loadGame(const QString& path) {
|
void GameController::loadGame(const QString& path, bool dirmode) {
|
||||||
closeGame();
|
closeGame();
|
||||||
m_threadContext.sync.videoFrameWait = 0;
|
m_threadContext.sync.videoFrameWait = 0;
|
||||||
m_threadContext.sync.audioWait = 1;
|
m_threadContext.sync.audioWait = 1;
|
||||||
QFile file(path);
|
if (!dirmode) {
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
QFile file(path);
|
||||||
return;
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
}
|
}
|
||||||
file.close();
|
|
||||||
m_gameOpen = true;
|
m_gameOpen = true;
|
||||||
|
|
||||||
m_pauseAfterFrame = false;
|
m_pauseAfterFrame = false;
|
||||||
|
|
||||||
m_threadContext.fname = strdup(path.toLocal8Bit().constData());
|
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
|
#if ENABLE_LIBZIP
|
||||||
m_threadContext.gameDir = VDirOpenZip(m_threadContext.fname, 0);
|
m_threadContext.gameDir = VDirOpenZip(m_threadContext.fname, 0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
GBAThreadStart(&m_threadContext);
|
GBAThreadStart(&m_threadContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ signals:
|
||||||
void postLog(int level, const QString& log);
|
void postLog(int level, const QString& log);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadGame(const QString& path);
|
void loadGame(const QString& path, bool dirmode = false);
|
||||||
void closeGame();
|
void closeGame();
|
||||||
void setPaused(bool paused);
|
void setPaused(bool paused);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
Loading…
Reference in New Issue