FileBlob.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2008 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <cstdio>
  5. #include <memory>
  6. #include <string>
  7. #include "Common/CommonTypes.h"
  8. #include "Common/IOFile.h"
  9. #include "DiscIO/Blob.h"
  10. namespace DiscIO
  11. {
  12. class PlainFileReader : public BlobReader
  13. {
  14. public:
  15. static std::unique_ptr<PlainFileReader> Create(File::IOFile file);
  16. BlobType GetBlobType() const override { return BlobType::PLAIN; }
  17. std::unique_ptr<BlobReader> CopyReader() const override;
  18. u64 GetRawSize() const override { return m_size; }
  19. u64 GetDataSize() const override { return m_size; }
  20. DataSizeType GetDataSizeType() const override { return DataSizeType::Accurate; }
  21. u64 GetBlockSize() const override { return 0; }
  22. bool HasFastRandomAccessInBlock() const override { return true; }
  23. std::string GetCompressionMethod() const override { return {}; }
  24. std::optional<int> GetCompressionLevel() const override { return std::nullopt; }
  25. bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;
  26. private:
  27. PlainFileReader(File::IOFile file);
  28. File::IOFile m_file;
  29. u64 m_size;
  30. };
  31. } // namespace DiscIO