diff --git a/src/gb/core.c b/src/gb/core.c index 0a1a1f161..24b6c9e35 100644 --- a/src/gb/core.c +++ b/src/gb/core.c @@ -96,6 +96,10 @@ static struct blip_t* _GBCoreGetAudioChannel(struct mCore* core, int ch) { } } +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 @@ struct mCore* GBCoreCreate(void) { core->setVideoBuffer = _GBCoreSetVideoBuffer; core->getVideoBuffer = _GBCoreGetVideoBuffer; core->getAudioChannel = _GBCoreGetAudioChannel; + core->setAVStream = _GBCoreSetAVStream; core->isROM = GBIsROM; core->loadROM = _GBCoreLoadROM; core->loadSave = _GBCoreLoadSave; diff --git a/src/gb/video.c b/src/gb/video.c index 3a5e0c8b6..f2b3a170e 100644 --- a/src/gb/video.c +++ b/src/gb/video.c @@ -6,6 +6,7 @@ #include "video.h" #include "core/sync.h" +#include "core/thread.h" #include "gb/gb.h" #include "gb/io.h" @@ -114,6 +115,12 @@ int32_t GBVideoProcessEvents(struct GBVideo* video, int32_t cycles) { ++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); } diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index a8748ed17..281df4f8f 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -25,7 +25,6 @@ extern "C" { #include "gba/gba.h" #include "gba/serialize.h" #include "gba/sharkport.h" -#include "gba/renderers/video-software.h" #include "util/vfs.h" } @@ -290,14 +289,21 @@ void GameController::openGame(bool biosOnly) { 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); if (bios) { diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index a856ad1ec..4d6db8507 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -272,6 +272,7 @@ void Window::saveConfig() { void Window::selectROM() { QStringList formats{ "*.gba", + "*.gb", #if defined(USE_LIBZIP) || defined(USE_ZLIB) "*.zip", #endif