diff options
| author | 2018-08-28 22:38:35 -0400 | |
|---|---|---|
| committer | 2018-09-04 16:24:02 -0400 | |
| commit | cbd517d8cc1ba70d149adb57299a62c7a4e5fd72 (patch) | |
| tree | 39f994f49b20fad537bcc74e0bb7fdb8ef209803 /src/core | |
| parent | game_list: Use friendly game versions (diff) | |
| download | yuzu-cbd517d8cc1ba70d149adb57299a62c7a4e5fd72.tar.gz yuzu-cbd517d8cc1ba70d149adb57299a62c7a4e5fd72.tar.xz yuzu-cbd517d8cc1ba70d149adb57299a62c7a4e5fd72.zip | |
bktr: Add logging on successful patch
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/file_sys/nca_patch.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 22 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.h | 7 |
3 files changed, 24 insertions, 7 deletions
diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp index e293af452..1e93000d5 100644 --- a/src/core/file_sys/nca_patch.cpp +++ b/src/core/file_sys/nca_patch.cpp | |||
| @@ -43,7 +43,7 @@ size_t BKTR::Read(u8* data, size_t length, size_t offset) const { | |||
| 43 | 43 | ||
| 44 | const auto next_relocation = GetNextRelocationEntry(offset); | 44 | const auto next_relocation = GetNextRelocationEntry(offset); |
| 45 | 45 | ||
| 46 | if (offset + length >= next_relocation.address_patch) { | 46 | if (offset + length > next_relocation.address_patch) { |
| 47 | const u64 partition = next_relocation.address_patch - offset; | 47 | const u64 partition = next_relocation.address_patch - offset; |
| 48 | return Read(data, partition, offset) + | 48 | return Read(data, partition, offset) + |
| 49 | Read(data + partition, length - partition, offset + partition); | 49 | Read(data + partition, length - partition, offset + partition); |
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 5e853c2c0..8b7d79773 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -34,6 +34,8 @@ std::string FormatPatchTypeName(PatchType type) { | |||
| 34 | PatchManager::PatchManager(u64 title_id) : title_id(title_id) {} | 34 | PatchManager::PatchManager(u64 title_id) : title_id(title_id) {} |
| 35 | 35 | ||
| 36 | VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { | 36 | VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { |
| 37 | LOG_INFO(Loader, "Patching ExeFS for title_id={:016X}", title_id); | ||
| 38 | |||
| 37 | if (exefs == nullptr) | 39 | if (exefs == nullptr) |
| 38 | return exefs; | 40 | return exefs; |
| 39 | 41 | ||
| @@ -45,6 +47,8 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { | |||
| 45 | if (update != nullptr) { | 47 | if (update != nullptr) { |
| 46 | if (update->GetStatus() == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS && | 48 | if (update->GetStatus() == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS && |
| 47 | update->GetExeFS() != nullptr) { | 49 | update->GetExeFS() != nullptr) { |
| 50 | LOG_INFO(Loader, " ExeFS: Update ({}) applied successfully", | ||
| 51 | FormatTitleVersion(installed->GetEntryVersion(update_tid).get_value_or(0))); | ||
| 48 | exefs = update->GetExeFS(); | 52 | exefs = update->GetExeFS(); |
| 49 | } | 53 | } |
| 50 | } | 54 | } |
| @@ -52,7 +56,11 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { | |||
| 52 | return exefs; | 56 | return exefs; |
| 53 | } | 57 | } |
| 54 | 58 | ||
| 55 | VirtualFile PatchManager::PatchRomFS(VirtualFile romfs) const { | 59 | VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, |
| 60 | ContentRecordType type) const { | ||
| 61 | LOG_INFO(Loader, "Patching RomFS for title_id={:016X}, type={:02X}", title_id, | ||
| 62 | static_cast<u8>(type)); | ||
| 63 | |||
| 56 | if (romfs == nullptr) | 64 | if (romfs == nullptr) |
| 57 | return romfs; | 65 | return romfs; |
| 58 | 66 | ||
| @@ -60,11 +68,15 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs) const { | |||
| 60 | 68 | ||
| 61 | // Game Updates | 69 | // Game Updates |
| 62 | const auto update_tid = GetUpdateTitleID(title_id); | 70 | const auto update_tid = GetUpdateTitleID(title_id); |
| 63 | const auto update = installed->GetEntryRaw(update_tid, ContentRecordType::Program); | 71 | const auto update = installed->GetEntryRaw(update_tid, type); |
| 64 | if (update != nullptr) { | 72 | if (update != nullptr) { |
| 65 | const auto nca = std::make_shared<NCA>(update, romfs); | 73 | const auto new_nca = std::make_shared<NCA>(update, romfs, ivfc_offset); |
| 66 | if (nca->GetStatus() == Loader::ResultStatus::Success && nca->GetRomFS() != nullptr) | 74 | if (new_nca->GetStatus() == Loader::ResultStatus::Success && |
| 67 | romfs = nca->GetRomFS(); | 75 | new_nca->GetRomFS() != nullptr) { |
| 76 | LOG_INFO(Loader, " RomFS: Update ({}) applied successfully", | ||
| 77 | FormatTitleVersion(installed->GetEntryVersion(update_tid).get_value_or(0))); | ||
| 78 | romfs = new_nca->GetRomFS(); | ||
| 79 | } | ||
| 68 | } | 80 | } |
| 69 | 81 | ||
| 70 | return romfs; | 82 | return romfs; |
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 @@ | |||
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/file_sys/vfs.h" | 10 | #include "core/file_sys/vfs.h" |
| 11 | #include "nca_metadata.h" | ||
| 12 | #include "romfs_factory.h" | ||
| 11 | 13 | ||
| 12 | namespace FileSys { | 14 | namespace FileSys { |
| 13 | 15 | ||
| 16 | class NCA; | ||
| 17 | |||
| 14 | enum class TitleVersionFormat : u8 { | 18 | enum class TitleVersionFormat : u8 { |
| 15 | ThreeElements, ///< vX.Y.Z | 19 | ThreeElements, ///< vX.Y.Z |
| 16 | FourElements, ///< vX.Y.Z.W | 20 | FourElements, ///< vX.Y.Z.W |
| @@ -36,7 +40,8 @@ public: | |||
| 36 | 40 | ||
| 37 | // Currently tracked RomFS patches: | 41 | // Currently tracked RomFS patches: |
| 38 | // - Game Updates | 42 | // - Game Updates |
| 39 | VirtualFile PatchRomFS(VirtualFile romfs) const; | 43 | VirtualFile PatchRomFS(VirtualFile base, u64 ivfc_offset, |
| 44 | ContentRecordType type = ContentRecordType::Program) const; | ||
| 40 | 45 | ||
| 41 | // Returns a vector of pairs between patch names and patch versions. | 46 | // Returns a vector of pairs between patch names and patch versions. |
| 42 | // i.e. Update v80 will return {Update, 80} | 47 | // i.e. Update v80 will return {Update, 80} |