summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/FileBlob.h
blob: 3a857996518dbfb83d7c9de95824d6d5f79e2ca2 (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
32
33
34
// Copyright 2008 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#pragma once

#include <cstdio>
#include <memory>
#include <string>

#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "DiscIO/Blob.h"

namespace DiscIO
{
class PlainFileReader : public IBlobReader
{
public:
  static std::unique_ptr<PlainFileReader> Create(const std::string& filename);

  BlobType GetBlobType() const override { return BlobType::PLAIN; }
  u64 GetDataSize() const override { return m_size; }
  u64 GetRawSize() const override { return m_size; }
  bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;

private:
  PlainFileReader(std::FILE* file);

  File::IOFile m_file;
  s64 m_size;
};

}  // namespace