mirror of https://github.com/mgba-emu/mgba.git
Qt: GB game loading
This commit is contained in:
parent
533e96392b
commit
4f43b574e2
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -272,6 +272,7 @@ void Window::saveConfig() {
|
|||
void Window::selectROM() {
|
||||
QStringList formats{
|
||||
"*.gba",
|
||||
"*.gb",
|
||||
#if defined(USE_LIBZIP) || defined(USE_ZLIB)
|
||||
"*.zip",
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue