all repos — mgba @ 893fdd383f3f4f59de31ac617bc8a28d3f8059c6

mGBA Game Boy Advance Emulator

src/platform/qt/VFileDevice.cpp (view raw)

 1/* Copyright (c) 2013-2014 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#include "VFileDevice.h"
 7
 8#include <mgba-util/vfs.h>
 9
10using namespace QGBA;
11
12VFileDevice::VFileDevice(VFile* vf, QObject* parent)
13	: QIODevice(parent)
14	, m_vf(vf)
15{
16	// Nothing to do
17}
18
19qint64 VFileDevice::readData(char* data, qint64 maxSize) {
20	return m_vf->read(m_vf, data, maxSize);
21}
22
23qint64 VFileDevice::writeData(const char* data, qint64 maxSize) {
24	return m_vf->write(m_vf, data, maxSize);
25}
26
27qint64 VFileDevice::size() const {
28	return m_vf->size(m_vf);
29}
30
31VFile* VFileDevice::open(const QString& path, int mode) {
32	return VFileOpen(path.toUtf8().constData(), mode);
33}
34
35VDir* VFileDevice::openDir(const QString& path) {
36	return VDirOpen(path.toUtf8().constData());
37}
38VDir* VFileDevice::openArchive(const QString& path) {
39	return VDirOpenArchive(path.toUtf8().constData());
40}