mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-22 08:05:46 +00:00
content_archive: Add update title detection
This is needed because the title IDs of update NCAs will not use the update title ID. The only sure way to tell is to look for a partition with BKTR crypto.
This commit is contained in:
parent
8f6ef9d395
commit
87927a3be7
2 changed files with 11 additions and 0 deletions
|
@ -258,6 +258,10 @@ NCA::NCA(VirtualFile file_) : file(std::move(file_)) {
|
||||||
file->ReadBytes(sections.data(), length_sections, SECTION_HEADER_OFFSET);
|
file->ReadBytes(sections.data(), length_sections, SECTION_HEADER_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_update = std::find_if(sections.begin(), sections.end(), [](const NCASectionHeader& header) {
|
||||||
|
return header.raw.header.crypto_type == NCASectionCryptoType::BKTR;
|
||||||
|
}) != sections.end();
|
||||||
|
|
||||||
for (std::ptrdiff_t i = 0; i < number_sections; ++i) {
|
for (std::ptrdiff_t i = 0; i < number_sections; ++i) {
|
||||||
auto section = sections[i];
|
auto section = sections[i];
|
||||||
|
|
||||||
|
@ -358,6 +362,10 @@ VirtualFile NCA::GetBaseFile() const {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NCA::IsUpdate() const {
|
||||||
|
return is_update;
|
||||||
|
}
|
||||||
|
|
||||||
bool NCA::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) {
|
bool NCA::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,8 @@ public:
|
||||||
|
|
||||||
VirtualFile GetBaseFile() const;
|
VirtualFile GetBaseFile() const;
|
||||||
|
|
||||||
|
bool IsUpdate() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override;
|
bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override;
|
||||||
|
|
||||||
|
@ -111,6 +113,7 @@ private:
|
||||||
|
|
||||||
NCAHeader header{};
|
NCAHeader header{};
|
||||||
bool has_rights_id{};
|
bool has_rights_id{};
|
||||||
|
bool is_update{};
|
||||||
|
|
||||||
Loader::ResultStatus status{};
|
Loader::ResultStatus status{};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue