bktr: Add logging on successful patch
This commit is contained in:
parent
2814ca3624
commit
cbd517d8cc
|
@ -43,7 +43,7 @@ size_t BKTR::Read(u8* data, size_t length, size_t offset) const {
|
||||||
|
|
||||||
const auto next_relocation = GetNextRelocationEntry(offset);
|
const auto next_relocation = GetNextRelocationEntry(offset);
|
||||||
|
|
||||||
if (offset + length >= next_relocation.address_patch) {
|
if (offset + length > next_relocation.address_patch) {
|
||||||
const u64 partition = next_relocation.address_patch - offset;
|
const u64 partition = next_relocation.address_patch - offset;
|
||||||
return Read(data, partition, offset) +
|
return Read(data, partition, offset) +
|
||||||
Read(data + partition, length - partition, offset + partition);
|
Read(data + partition, length - partition, offset + partition);
|
||||||
|
|
|
@ -34,6 +34,8 @@ std::string FormatPatchTypeName(PatchType type) {
|
||||||
PatchManager::PatchManager(u64 title_id) : title_id(title_id) {}
|
PatchManager::PatchManager(u64 title_id) : title_id(title_id) {}
|
||||||
|
|
||||||
VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
|
VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
|
||||||
|
LOG_INFO(Loader, "Patching ExeFS for title_id={:016X}", title_id);
|
||||||
|
|
||||||
if (exefs == nullptr)
|
if (exefs == nullptr)
|
||||||
return exefs;
|
return exefs;
|
||||||
|
|
||||||
|
@ -45,6 +47,8 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
|
||||||
if (update != nullptr) {
|
if (update != nullptr) {
|
||||||
if (update->GetStatus() == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS &&
|
if (update->GetStatus() == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS &&
|
||||||
update->GetExeFS() != nullptr) {
|
update->GetExeFS() != nullptr) {
|
||||||
|
LOG_INFO(Loader, " ExeFS: Update ({}) applied successfully",
|
||||||
|
FormatTitleVersion(installed->GetEntryVersion(update_tid).get_value_or(0)));
|
||||||
exefs = update->GetExeFS();
|
exefs = update->GetExeFS();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +56,11 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
|
||||||
return exefs;
|
return exefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualFile PatchManager::PatchRomFS(VirtualFile romfs) const {
|
VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset,
|
||||||
|
ContentRecordType type) const {
|
||||||
|
LOG_INFO(Loader, "Patching RomFS for title_id={:016X}, type={:02X}", title_id,
|
||||||
|
static_cast<u8>(type));
|
||||||
|
|
||||||
if (romfs == nullptr)
|
if (romfs == nullptr)
|
||||||
return romfs;
|
return romfs;
|
||||||
|
|
||||||
|
@ -60,11 +68,15 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs) const {
|
||||||
|
|
||||||
// Game Updates
|
// Game Updates
|
||||||
const auto update_tid = GetUpdateTitleID(title_id);
|
const auto update_tid = GetUpdateTitleID(title_id);
|
||||||
const auto update = installed->GetEntryRaw(update_tid, ContentRecordType::Program);
|
const auto update = installed->GetEntryRaw(update_tid, type);
|
||||||
if (update != nullptr) {
|
if (update != nullptr) {
|
||||||
const auto nca = std::make_shared<NCA>(update, romfs);
|
const auto new_nca = std::make_shared<NCA>(update, romfs, ivfc_offset);
|
||||||
if (nca->GetStatus() == Loader::ResultStatus::Success && nca->GetRomFS() != nullptr)
|
if (new_nca->GetStatus() == Loader::ResultStatus::Success &&
|
||||||
romfs = nca->GetRomFS();
|
new_nca->GetRomFS() != nullptr) {
|
||||||
|
LOG_INFO(Loader, " RomFS: Update ({}) applied successfully",
|
||||||
|
FormatTitleVersion(installed->GetEntryVersion(update_tid).get_value_or(0)));
|
||||||
|
romfs = new_nca->GetRomFS();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return romfs;
|
return romfs;
|
||||||
|
|
|
@ -8,9 +8,13 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/file_sys/vfs.h"
|
#include "core/file_sys/vfs.h"
|
||||||
|
#include "nca_metadata.h"
|
||||||
|
#include "romfs_factory.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
|
class NCA;
|
||||||
|
|
||||||
enum class TitleVersionFormat : u8 {
|
enum class TitleVersionFormat : u8 {
|
||||||
ThreeElements, ///< vX.Y.Z
|
ThreeElements, ///< vX.Y.Z
|
||||||
FourElements, ///< vX.Y.Z.W
|
FourElements, ///< vX.Y.Z.W
|
||||||
|
@ -36,7 +40,8 @@ public:
|
||||||
|
|
||||||
// Currently tracked RomFS patches:
|
// Currently tracked RomFS patches:
|
||||||
// - Game Updates
|
// - 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.
|
// Returns a vector of pairs between patch names and patch versions.
|
||||||
// i.e. Update v80 will return {Update, 80}
|
// i.e. Update v80 will return {Update, 80}
|
||||||
|
|
Loading…
Reference in a new issue