mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
a82675b7d5
Also changes some function params, but this is ok. Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
33 lines
627 B
C++
33 lines
627 B
C++
// Copyright 2013 Dolphin Emulator Project
|
|
// Licensed under GPLv2
|
|
// Refer to the license.txt file included.
|
|
|
|
#include <string>
|
|
#include "DiscIO/FileBlob.h"
|
|
|
|
namespace DiscIO
|
|
{
|
|
|
|
PlainFileReader::PlainFileReader(std::FILE* file)
|
|
: m_file(file)
|
|
{
|
|
m_size = m_file.GetSize();
|
|
}
|
|
|
|
PlainFileReader* PlainFileReader::Create(const std::string& filename)
|
|
{
|
|
File::IOFile f(filename, "rb");
|
|
if (f)
|
|
return new PlainFileReader(f.ReleaseHandle());
|
|
else
|
|
return nullptr;
|
|
}
|
|
|
|
bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
|
{
|
|
m_file.Seek(offset, SEEK_SET);
|
|
return m_file.ReadBytes(out_ptr, nbytes);
|
|
}
|
|
|
|
} // namespace
|