patch_manager.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <map>
  6. #include <string>
  7. #include "common/common_types.h"
  8. #include "core/file_sys/vfs.h"
  9. #include "nca_metadata.h"
  10. #include "romfs_factory.h"
  11. namespace FileSys {
  12. class NCA;
  13. enum class TitleVersionFormat : u8 {
  14. ThreeElements, ///< vX.Y.Z
  15. FourElements, ///< vX.Y.Z.W
  16. };
  17. std::string FormatTitleVersion(u32 version,
  18. TitleVersionFormat format = TitleVersionFormat::ThreeElements);
  19. enum class PatchType {
  20. Update,
  21. };
  22. std::string FormatPatchTypeName(PatchType type);
  23. // A centralized class to manage patches to games.
  24. class PatchManager {
  25. public:
  26. explicit PatchManager(u64 title_id);
  27. // Currently tracked ExeFS patches:
  28. // - Game Updates
  29. VirtualDir PatchExeFS(VirtualDir exefs) const;
  30. // Currently tracked RomFS patches:
  31. // - Game Updates
  32. VirtualFile PatchRomFS(VirtualFile base, u64 ivfc_offset,
  33. ContentRecordType type = ContentRecordType::Program) const;
  34. // Returns a vector of pairs between patch names and patch versions.
  35. // i.e. Update v80 will return {Update, 80}
  36. std::map<PatchType, std::string> GetPatchVersionNames() const;
  37. private:
  38. u64 title_id;
  39. };
  40. } // namespace FileSys