Qt: GB game loading

This commit is contained in:
Jeffrey Pfau 2016-02-07 22:41:10 -08:00
parent 533e96392b
commit 4f43b574e2
4 changed files with 22 additions and 3 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
}
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) {

View File

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