all repos — mgba @ 517aa353caaa6484a2607d93265c4aafc14997ae

mGBA Game Boy Advance Emulator

Qt: Add creating a VFileDevice from a QByteArray
Vicki Pfau vi@endrift.com
Mon, 01 Feb 2021 01:55:06 -0800
commit

517aa353caaa6484a2607d93265c4aafc14997ae

parent

df082b46d9c9d0a31edc29d05f9c93fd5b17197e

2 files changed, 8 insertions(+), 0 deletions(-)

jump to
M src/platform/qt/VFileDevice.cppsrc/platform/qt/VFileDevice.cpp

@@ -91,6 +91,13 @@ setOpenMode(mode);

} } +VFileDevice::VFileDevice(const QByteArray& mem, QObject* parent) + : QIODevice(parent) + , m_vf(VFileMemChunk(mem.constData(), mem.size())) +{ + setOpenMode(QIODevice::ReadWrite); +} + VFileDevice::~VFileDevice() { close(); }
M src/platform/qt/VFileDevice.hsrc/platform/qt/VFileDevice.h

@@ -19,6 +19,7 @@ Q_OBJECT

public: VFileDevice(VFile* vf = nullptr, QObject* parent = nullptr); + VFileDevice(const QByteArray& mem, QObject* parent = nullptr); VFileDevice(const QString&, QIODevice::OpenMode, QObject* parent = nullptr); virtual ~VFileDevice();