archive_romfs.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <vector>
  6. #include "common/common_types.h"
  7. #include "core/file_sys/archive.h"
  8. #include "core/loader/loader.h"
  9. ////////////////////////////////////////////////////////////////////////////////////////////////////
  10. // FileSys namespace
  11. namespace FileSys {
  12. /// File system interface to the RomFS archive
  13. class Archive_RomFS final : public Archive {
  14. public:
  15. Archive_RomFS(const Loader::AppLoader& app_loader);
  16. ~Archive_RomFS() override;
  17. /**
  18. * Get the IdCode of the archive (e.g. RomFS, SaveData, etc.)
  19. * @return IdCode of the archive
  20. */
  21. IdCode GetIdCode() const override { return IdCode::RomFS; };
  22. /**
  23. * Read data from the archive
  24. * @param offset Offset in bytes to start reading archive from
  25. * @param length Length in bytes to read data from archive
  26. * @param buffer Buffer to read data into
  27. * @return Number of bytes read
  28. */
  29. size_t Read(const u64 offset, const u32 length, u8* buffer) const override;
  30. /**
  31. * Get the size of the archive in bytes
  32. * @return Size of the archive in bytes
  33. */
  34. size_t GetSize() const override;
  35. private:
  36. std::vector<u8> raw_data;
  37. };
  38. } // namespace FileSys