From 8e900a301a1094d74f68f173c7dec67b12baec25 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sat, 25 Aug 2018 19:03:45 -0400 Subject: file_sys: Add class to manage game patches Right now only includes Updates, but should eventually contain all of the other patches we need. --- src/core/file_sys/patch_manager.h | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/core/file_sys/patch_manager.h (limited to 'src/core/file_sys/patch_manager.h') diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h new file mode 100644 index 000000000..2a39c473a --- /dev/null +++ b/src/core/file_sys/patch_manager.h @@ -0,0 +1,42 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include "common/common_types.h" +#include "core/file_sys/vfs.h" + +namespace FileSys { + +std::string FormatTitleVersion(u32 version, bool full = false); + +enum class PatchType { + Update, +}; + +std::string FormatPatchTypeName(PatchType type); + +// A centralized class to manage patches to games. +class PatchManager { +public: + explicit PatchManager(u64 title_id); + + // Currently tracked ExeFS patches: + // - Game Updates + VirtualDir PatchExeFS(VirtualDir exefs) const; + + // Currently tracked RomFS patches: + // - Game Updates + VirtualFile PatchRomFS(VirtualFile romfs) const; + + // Returns a vector of pairs between patch names and patch versions. + // i.e. Update v80 will return {Update, 80} + std::map GetPatchVersionNames() const; + +private: + u64 title_id; +}; + +} // namespace FileSys -- cgit v1.2.3 From 9664ce255db09f4501db642c1e82d8cf8f274a22 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sun, 26 Aug 2018 10:53:31 -0400 Subject: bktr: Fix missing includes and optimize style --- src/core/file_sys/patch_manager.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/core/file_sys/patch_manager.h') diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index 2a39c473a..803bcb2a2 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h @@ -5,12 +5,19 @@ #pragma once #include +#include #include "common/common_types.h" #include "core/file_sys/vfs.h" namespace FileSys { -std::string FormatTitleVersion(u32 version, bool full = false); +enum class TitleVersionFormat : u8 { + ThreeElements, ///< vX.Y.Z + FourElements, ///< vX.Y.Z.W +}; + +std::string FormatTitleVersion(u32 version, + TitleVersionFormat format = TitleVersionFormat::ThreeElements); enum class PatchType { Update, -- cgit v1.2.3 From cbd517d8cc1ba70d149adb57299a62c7a4e5fd72 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 28 Aug 2018 22:38:35 -0400 Subject: bktr: Add logging on successful patch --- src/core/file_sys/patch_manager.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/core/file_sys/patch_manager.h') diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index 803bcb2a2..021bc3366 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h @@ -8,9 +8,13 @@ #include #include "common/common_types.h" #include "core/file_sys/vfs.h" +#include "nca_metadata.h" +#include "romfs_factory.h" namespace FileSys { +class NCA; + enum class TitleVersionFormat : u8 { ThreeElements, ///< vX.Y.Z FourElements, ///< vX.Y.Z.W @@ -36,7 +40,8 @@ public: // Currently tracked RomFS patches: // - Game Updates - VirtualFile PatchRomFS(VirtualFile romfs) const; + VirtualFile PatchRomFS(VirtualFile base, u64 ivfc_offset, + ContentRecordType type = ContentRecordType::Program) const; // Returns a vector of pairs between patch names and patch versions. // i.e. Update v80 will return {Update, 80} -- cgit v1.2.3 From c91b60a421a3bd0dc85d80e0a5a2d261370df340 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sat, 1 Sep 2018 13:11:30 -0400 Subject: game_list: Fix version display on non-NAND titles --- src/core/file_sys/patch_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/file_sys/patch_manager.h') diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index 021bc3366..b6bf86222 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h @@ -45,7 +45,7 @@ public: // Returns a vector of pairs between patch names and patch versions. // i.e. Update v80 will return {Update, 80} - std::map GetPatchVersionNames() const; + std::map GetPatchVersionNames() const; private: u64 title_id; -- cgit v1.2.3 From 23a16c1720ee522f6ac7d1f426a2d4a918ce41c9 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 3 Sep 2018 18:57:52 -0400 Subject: patch_manager: Centralize Control-type NCA parsing --- src/core/file_sys/patch_manager.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/patch_manager.h') diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index b6bf86222..c2626bc6c 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h @@ -7,13 +7,14 @@ #include #include #include "common/common_types.h" +#include "core/file_sys/nca_metadata.h" +#include "core/file_sys/romfs_factory.h" #include "core/file_sys/vfs.h" -#include "nca_metadata.h" -#include "romfs_factory.h" namespace FileSys { class NCA; +class NACP; enum class TitleVersionFormat : u8 { ThreeElements, ///< vX.Y.Z @@ -47,6 +48,14 @@ public: // i.e. Update v80 will return {Update, 80} std::map GetPatchVersionNames() const; + // Given title_id of the program, attempts to get the control data of the update and parse it, + // falling back to the base control data. + std::pair, VirtualFile> GetControlMetadata() const; + + // Version of GetControlMetadata that takes an arbitrary NCA + std::pair, VirtualFile> ParseControlNCA( + const std::shared_ptr& nca) const; + private: u64 title_id; }; -- cgit v1.2.3 From c913136eb215699f9c8d51a8fd56490b9df7657f Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 4 Sep 2018 17:01:40 -0400 Subject: bktr: Fix bucket overlap error --- src/core/file_sys/patch_manager.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/core/file_sys/patch_manager.h') diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index c2626bc6c..28c7ae136 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h @@ -8,7 +8,6 @@ #include #include "common/common_types.h" #include "core/file_sys/nca_metadata.h" -#include "core/file_sys/romfs_factory.h" #include "core/file_sys/vfs.h" namespace FileSys { -- cgit v1.2.3