DiscExtractor.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2017 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <functional>
  5. #include <optional>
  6. #include <string>
  7. #include <string_view>
  8. #include "Common/CommonTypes.h"
  9. namespace DiscIO
  10. {
  11. class FileInfo;
  12. struct Partition;
  13. class Volume;
  14. u64 ReadFile(const Volume& volume, const Partition& partition, const FileInfo* file_info,
  15. u8* buffer, u64 max_buffer_size, u64 offset_in_file = 0);
  16. u64 ReadFile(const Volume& volume, const Partition& partition, std::string_view path, u8* buffer,
  17. u64 max_buffer_size, u64 offset_in_file = 0);
  18. bool ExportData(const Volume& volume, const Partition& partition, u64 offset, u64 size,
  19. const std::string& export_filename);
  20. bool ExportFile(const Volume& volume, const Partition& partition, const FileInfo* file_info,
  21. const std::string& export_filename);
  22. bool ExportFile(const Volume& volume, const Partition& partition, std::string_view path,
  23. const std::string& export_filename);
  24. // update_progress is called once for each child (file or directory).
  25. // If update_progress returns true, the extraction gets cancelled.
  26. // filesystem_path is supposed to be the path corresponding to the directory argument.
  27. void ExportDirectory(const Volume& volume, const Partition& partition, const FileInfo& directory,
  28. bool recursive, const std::string& filesystem_path,
  29. const std::string& export_folder,
  30. const std::function<bool(const std::string& path)>& update_progress);
  31. // To export everything listed below, you can use ExportSystemData
  32. bool ExportWiiUnencryptedHeader(const Volume& volume, const std::string& export_filename);
  33. bool ExportWiiRegionData(const Volume& volume, const std::string& export_filename);
  34. bool ExportTicket(const Volume& volume, const Partition& partition,
  35. const std::string& export_filename);
  36. bool ExportTMD(const Volume& volume, const Partition& partition,
  37. const std::string& export_filename);
  38. bool ExportCertificateChain(const Volume& volume, const Partition& partition,
  39. const std::string& export_filename);
  40. bool ExportH3Hashes(const Volume& volume, const Partition& partition,
  41. const std::string& export_filename);
  42. bool ExportHeader(const Volume& volume, const Partition& partition,
  43. const std::string& export_filename);
  44. bool ExportBI2Data(const Volume& volume, const Partition& partition,
  45. const std::string& export_filename);
  46. bool ExportApploader(const Volume& volume, const Partition& partition,
  47. const std::string& export_filename);
  48. bool ExportDOL(const Volume& volume, const Partition& partition,
  49. const std::string& export_filename);
  50. bool ExportFST(const Volume& volume, const Partition& partition,
  51. const std::string& export_filename);
  52. bool ExportSystemData(const Volume& volume, const Partition& partition,
  53. const std::string& export_folder);
  54. } // namespace DiscIO