archive_romfs.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #include "common/common_types.h"
  5. #include "core/file_sys/archive_romfs.h"
  6. ////////////////////////////////////////////////////////////////////////////////////////////////////
  7. // FileSys namespace
  8. namespace FileSys {
  9. Archive_RomFS::Archive_RomFS(const Loader::AppLoader& app_loader) {
  10. // Load the RomFS from the app
  11. if (Loader::ResultStatus::Success != app_loader.ReadRomFS(raw_data)) {
  12. WARN_LOG(FILESYS, "Unable to read RomFS!");
  13. }
  14. }
  15. Archive_RomFS::~Archive_RomFS() {
  16. }
  17. /**
  18. * Read data from the archive
  19. * @param offset Offset in bytes to start reading archive from
  20. * @param length Length in bytes to read data from archive
  21. * @param buffer Buffer to read data into
  22. * @return Number of bytes read
  23. */
  24. size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const {
  25. DEBUG_LOG(FILESYS, "called offset=%d, length=%d", offset, length);
  26. memcpy(buffer, &raw_data[(u32)offset], length);
  27. return length;
  28. }
  29. /**
  30. * Get the size of the archive in bytes
  31. * @return Size of the archive in bytes
  32. */
  33. size_t Archive_RomFS::GetSize() const {
  34. ERROR_LOG(FILESYS, "(UNIMPLEMENTED)");
  35. return 0;
  36. }
  37. } // namespace FileSys