all repos — mgba @ 4f43b574e2df578159a38a984ce715ac2060395d

mGBA Game Boy Advance Emulator

Qt: GB game loading
Jeffrey Pfau jeffrey@endrift.com
Sun, 07 Feb 2016 22:41:10 -0800
commit

4f43b574e2df578159a38a984ce715ac2060395d

parent

533e96392bde7b4852c37aaaad8e53ce1bf38b0f

4 files changed, 22 insertions(+), 3 deletions(-)

jump to
M src/gb/core.csrc/gb/core.c

@@ -96,6 +96,10 @@ return NULL;

} } +static void _GBCoreSetAVStream(struct mCore* core, struct mAVStream* stream) { + // TODO +} + static bool _GBCoreLoadROM(struct mCore* core, struct VFile* vf) { return GBLoadROM(core->board, vf); }

@@ -213,6 +217,7 @@ core->desiredVideoDimensions = _GBCoreDesiredVideoDimensions;

core->setVideoBuffer = _GBCoreSetVideoBuffer; core->getVideoBuffer = _GBCoreGetVideoBuffer; core->getAudioChannel = _GBCoreGetAudioChannel; + core->setAVStream = _GBCoreSetAVStream; core->isROM = GBIsROM; core->loadROM = _GBCoreLoadROM; core->loadSave = _GBCoreLoadSave;
M src/gb/video.csrc/gb/video.c

@@ -6,6 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "video.h" #include "core/sync.h" +#include "core/thread.h" #include "gb/gb.h" #include "gb/io.h"

@@ -114,6 +115,12 @@ video->mode = 1;

++video->frameCounter; video->renderer->finishFrame(video->renderer); mCoreSyncPostFrame(video->p->sync); + + struct mCoreThread* thread = mCoreThreadGet(); + if (thread && thread->frameCallback) { + thread->frameCallback(thread); + } + if (GBRegisterSTATIsVblankIRQ(video->stat) || GBRegisterSTATIsOAMIRQ(video->stat)) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); }
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -25,7 +25,6 @@ #include "gba/core.h"

#include "gba/gba.h" #include "gba/serialize.h" #include "gba/sharkport.h" -#include "gba/renderers/video-software.h" #include "util/vfs.h" }

@@ -290,13 +289,20 @@ m_threadContext.sync.videoFrameWait = m_videoSync;

m_threadContext.sync.audioWait = m_audioSync; } - m_threadContext.core = GBACoreCreate(); + + if (!biosOnly) { + m_threadContext.core = mCoreFind(m_fname.toUtf8().constData()); + } else { + m_threadContext.core = GBACoreCreate(); + } m_threadContext.core->init(m_threadContext.core); - m_threadContext.core->setVideoBuffer(m_threadContext.core, m_drawContext, VIDEO_HORIZONTAL_PIXELS); if (!biosOnly) { mCoreLoadFile(m_threadContext.core, m_fname.toUtf8().constData()); + mCoreAutoloadSave(m_threadContext.core); } + + m_threadContext.core->setVideoBuffer(m_threadContext.core, m_drawContext, VIDEO_HORIZONTAL_PIXELS); if (!m_bios.isNull() && m_useBios) { VFile* bios = VFileDevice::open(m_bios, O_RDONLY);
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -272,6 +272,7 @@

void Window::selectROM() { QStringList formats{ "*.gba", + "*.gb", #if defined(USE_LIBZIP) || defined(USE_ZLIB) "*.zip", #endif