summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Src/FileBlob.cpp
blob: 42ea73c78d3aaee6f85a73b224d961e44ca3b348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#include "FileBlob.h"

namespace DiscIO
{

PlainFileReader::PlainFileReader(std::FILE* file)
	: m_file(file)
{
	m_size = m_file.GetSize();
}

PlainFileReader* PlainFileReader::Create(const char* filename)
{
	File::IOFile f(filename, "rb");
	if (f)
		return new PlainFileReader(f.ReleaseHandle());
	else
		return NULL;
}

bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
{
	m_file.Seek(offset, SEEK_SET);
	return m_file.ReadBytes(out_ptr, nbytes);
}

}  // namespace