all repos — mgba @ 47de0132838f1736e6f27b148ce5aa85514bfcb0

mGBA Game Boy Advance Emulator

Qt: Add API wrapper for VFileMemChunk
Vicki Pfau vi@endrift.com
Tue, 08 Dec 2020 19:37:13 -0800
commit

47de0132838f1736e6f27b148ce5aa85514bfcb0

parent

3c4929b798ab3b48b64d3b0dfe7804a26d9dd4f9

M src/platform/qt/CoreController.cppsrc/platform/qt/CoreController.cpp

@@ -499,7 +499,7 @@ }

mCoreThreadRunFunction(&m_threadContext, [](mCoreThread* context) { CoreController* controller = static_cast<CoreController*>(context->userData); if (!controller->m_backupLoadState.isOpen()) { - controller->m_backupLoadState = VFileMemChunk(nullptr, 0); + controller->m_backupLoadState = VFileDevice::openMemory(); } mCoreSaveStateNamed(context->core, controller->m_backupLoadState, controller->m_saveStateFlags); if (mCoreLoadState(context->core, controller->m_stateSlot, controller->m_loadStateFlags)) {

@@ -518,7 +518,7 @@ if (!vf) {

return; } if (!controller->m_backupLoadState.isOpen()) { - controller->m_backupLoadState = VFileMemChunk(nullptr, 0); + controller->m_backupLoadState = VFileDevice::openMemory(); } mCoreSaveStateNamed(context->core, controller->m_backupLoadState, controller->m_saveStateFlags); if (mCoreLoadStateNamed(context->core, vf, controller->m_loadStateFlags)) {
M src/platform/qt/FrameView.cppsrc/platform/qt/FrameView.cpp

@@ -518,7 +518,7 @@

void FrameView::refreshVl() { QMutexLocker locker(&m_mutex); m_currentFrame = m_nextFrame; - m_nextFrame = VFileMemChunk(nullptr, 0); + m_nextFrame = VFileDevice::openMemory(); if (m_currentFrame) { m_controller->endVideoLog(false); QMetaObject::invokeMethod(this, "newVl");
M src/platform/qt/VFileDevice.cppsrc/platform/qt/VFileDevice.cpp

@@ -78,9 +78,14 @@ VFile* VFileDevice::open(const QString& path, int mode) {

return VFileOpen(path.toUtf8().constData(), mode); } +VFile* VFileDevice::openMemory() { + return VFileMemChunk(nullptr, 0); +} + VDir* VFileDevice::openDir(const QString& path) { return VDirOpen(path.toUtf8().constData()); } + VDir* VFileDevice::openArchive(const QString& path) { return VDirOpenArchive(path.toUtf8().constData()); }
M src/platform/qt/VFileDevice.hsrc/platform/qt/VFileDevice.h

@@ -29,6 +29,7 @@ VFileDevice& operator=(VFile*);

operator VFile*() { return m_vf; } static VFile* open(const QString& path, int mode); + static VFile* openMemory(); static VDir* openDir(const QString& path); static VDir* openArchive(const QString& path);