content_archive.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <algorithm>
  5. #include <cstring>
  6. #include <optional>
  7. #include <utility>
  8. #include "common/logging/log.h"
  9. #include "core/crypto/aes_util.h"
  10. #include "core/crypto/ctr_encryption_layer.h"
  11. #include "core/file_sys/content_archive.h"
  12. #include "core/file_sys/nca_patch.h"
  13. #include "core/file_sys/partition_filesystem.h"
  14. #include "core/file_sys/romfs.h"
  15. #include "core/file_sys/vfs_offset.h"
  16. #include "core/loader/loader.h"
  17. namespace FileSys {
  18. // Media offsets in headers are stored divided by 512. Mult. by this to get real offset.
  19. constexpr u64 MEDIA_OFFSET_MULTIPLIER = 0x200;
  20. constexpr u64 SECTION_HEADER_SIZE = 0x200;
  21. constexpr u64 SECTION_HEADER_OFFSET = 0x400;
  22. constexpr u32 IVFC_MAX_LEVEL = 6;
  23. enum class NCASectionFilesystemType : u8 {
  24. PFS0 = 0x2,
  25. ROMFS = 0x3,
  26. };
  27. struct NCASectionHeaderBlock {
  28. INSERT_PADDING_BYTES(3);
  29. NCASectionFilesystemType filesystem_type;
  30. NCASectionCryptoType crypto_type;
  31. INSERT_PADDING_BYTES(3);
  32. };
  33. static_assert(sizeof(NCASectionHeaderBlock) == 0x8, "NCASectionHeaderBlock has incorrect size.");
  34. struct NCASectionRaw {
  35. NCASectionHeaderBlock header;
  36. std::array<u8, 0x138> block_data;
  37. std::array<u8, 0x8> section_ctr;
  38. INSERT_PADDING_BYTES(0xB8);
  39. };
  40. static_assert(sizeof(NCASectionRaw) == 0x200, "NCASectionRaw has incorrect size.");
  41. struct PFS0Superblock {
  42. NCASectionHeaderBlock header_block;
  43. std::array<u8, 0x20> hash;
  44. u32_le size;
  45. INSERT_PADDING_BYTES(4);
  46. u64_le hash_table_offset;
  47. u64_le hash_table_size;
  48. u64_le pfs0_header_offset;
  49. u64_le pfs0_size;
  50. INSERT_PADDING_BYTES(0x1B0);
  51. };
  52. static_assert(sizeof(PFS0Superblock) == 0x200, "PFS0Superblock has incorrect size.");
  53. struct RomFSSuperblock {
  54. NCASectionHeaderBlock header_block;
  55. IVFCHeader ivfc;
  56. INSERT_PADDING_BYTES(0x118);
  57. };
  58. static_assert(sizeof(RomFSSuperblock) == 0x200, "RomFSSuperblock has incorrect size.");
  59. struct BKTRHeader {
  60. u64_le offset;
  61. u64_le size;
  62. u32_le magic;
  63. INSERT_PADDING_BYTES(0x4);
  64. u32_le number_entries;
  65. INSERT_PADDING_BYTES(0x4);
  66. };
  67. static_assert(sizeof(BKTRHeader) == 0x20, "BKTRHeader has incorrect size.");
  68. struct BKTRSuperblock {
  69. NCASectionHeaderBlock header_block;
  70. IVFCHeader ivfc;
  71. INSERT_PADDING_BYTES(0x18);
  72. BKTRHeader relocation;
  73. BKTRHeader subsection;
  74. INSERT_PADDING_BYTES(0xC0);
  75. };
  76. static_assert(sizeof(BKTRSuperblock) == 0x200, "BKTRSuperblock has incorrect size.");
  77. union NCASectionHeader {
  78. NCASectionRaw raw;
  79. PFS0Superblock pfs0;
  80. RomFSSuperblock romfs;
  81. BKTRSuperblock bktr;
  82. };
  83. static_assert(sizeof(NCASectionHeader) == 0x200, "NCASectionHeader has incorrect size.");
  84. static bool IsValidNCA(const NCAHeader& header) {
  85. // TODO(DarkLordZach): Add NCA2/NCA0 support.
  86. return header.magic == Common::MakeMagic('N', 'C', 'A', '3');
  87. }
  88. NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_offset,
  89. Core::Crypto::KeyManager keys_)
  90. : file(std::move(file_)), bktr_base_romfs(std::move(bktr_base_romfs_)), keys(std::move(keys_)) {
  91. if (file == nullptr) {
  92. status = Loader::ResultStatus::ErrorNullFile;
  93. return;
  94. }
  95. if (sizeof(NCAHeader) != file->ReadObject(&header)) {
  96. LOG_ERROR(Loader, "File reader errored out during header read.");
  97. status = Loader::ResultStatus::ErrorBadNCAHeader;
  98. return;
  99. }
  100. if (!HandlePotentialHeaderDecryption()) {
  101. return;
  102. }
  103. has_rights_id = std::any_of(header.rights_id.begin(), header.rights_id.end(),
  104. [](char c) { return c != '\0'; });
  105. const std::vector<NCASectionHeader> sections = ReadSectionHeaders();
  106. is_update = std::any_of(sections.begin(), sections.end(), [](const NCASectionHeader& header) {
  107. return header.raw.header.crypto_type == NCASectionCryptoType::BKTR;
  108. });
  109. if (!ReadSections(sections, bktr_base_ivfc_offset)) {
  110. return;
  111. }
  112. status = Loader::ResultStatus::Success;
  113. }
  114. NCA::~NCA() = default;
  115. bool NCA::CheckSupportedNCA(const NCAHeader& nca_header) {
  116. if (nca_header.magic == Common::MakeMagic('N', 'C', 'A', '2')) {
  117. status = Loader::ResultStatus::ErrorNCA2;
  118. return false;
  119. }
  120. if (nca_header.magic == Common::MakeMagic('N', 'C', 'A', '0')) {
  121. status = Loader::ResultStatus::ErrorNCA0;
  122. return false;
  123. }
  124. return true;
  125. }
  126. bool NCA::HandlePotentialHeaderDecryption() {
  127. if (IsValidNCA(header)) {
  128. return true;
  129. }
  130. if (!CheckSupportedNCA(header)) {
  131. return false;
  132. }
  133. NCAHeader dec_header{};
  134. Core::Crypto::AESCipher<Core::Crypto::Key256> cipher(
  135. keys.GetKey(Core::Crypto::S256KeyType::Header), Core::Crypto::Mode::XTS);
  136. cipher.XTSTranscode(&header, sizeof(NCAHeader), &dec_header, 0, 0x200,
  137. Core::Crypto::Op::Decrypt);
  138. if (IsValidNCA(dec_header)) {
  139. header = dec_header;
  140. encrypted = true;
  141. } else {
  142. if (!CheckSupportedNCA(dec_header)) {
  143. return false;
  144. }
  145. if (keys.HasKey(Core::Crypto::S256KeyType::Header)) {
  146. status = Loader::ResultStatus::ErrorIncorrectHeaderKey;
  147. } else {
  148. status = Loader::ResultStatus::ErrorMissingHeaderKey;
  149. }
  150. return false;
  151. }
  152. return true;
  153. }
  154. std::vector<NCASectionHeader> NCA::ReadSectionHeaders() const {
  155. const std::ptrdiff_t number_sections =
  156. std::count_if(std::begin(header.section_tables), std::end(header.section_tables),
  157. [](NCASectionTableEntry entry) { return entry.media_offset > 0; });
  158. std::vector<NCASectionHeader> sections(number_sections);
  159. const auto length_sections = SECTION_HEADER_SIZE * number_sections;
  160. if (encrypted) {
  161. auto raw = file->ReadBytes(length_sections, SECTION_HEADER_OFFSET);
  162. Core::Crypto::AESCipher<Core::Crypto::Key256> cipher(
  163. keys.GetKey(Core::Crypto::S256KeyType::Header), Core::Crypto::Mode::XTS);
  164. cipher.XTSTranscode(raw.data(), length_sections, sections.data(), 2, SECTION_HEADER_SIZE,
  165. Core::Crypto::Op::Decrypt);
  166. } else {
  167. file->ReadBytes(sections.data(), length_sections, SECTION_HEADER_OFFSET);
  168. }
  169. return sections;
  170. }
  171. bool NCA::ReadSections(const std::vector<NCASectionHeader>& sections, u64 bktr_base_ivfc_offset) {
  172. for (std::size_t i = 0; i < sections.size(); ++i) {
  173. const auto& section = sections[i];
  174. if (section.raw.header.filesystem_type == NCASectionFilesystemType::ROMFS) {
  175. if (!ReadRomFSSection(section, header.section_tables[i], bktr_base_ivfc_offset)) {
  176. return false;
  177. }
  178. } else if (section.raw.header.filesystem_type == NCASectionFilesystemType::PFS0) {
  179. if (!ReadPFS0Section(section, header.section_tables[i])) {
  180. return false;
  181. }
  182. }
  183. }
  184. return true;
  185. }
  186. bool NCA::ReadRomFSSection(const NCASectionHeader& section, const NCASectionTableEntry& entry,
  187. u64 bktr_base_ivfc_offset) {
  188. const std::size_t base_offset = entry.media_offset * MEDIA_OFFSET_MULTIPLIER;
  189. ivfc_offset = section.romfs.ivfc.levels[IVFC_MAX_LEVEL - 1].offset;
  190. const std::size_t romfs_offset = base_offset + ivfc_offset;
  191. const std::size_t romfs_size = section.romfs.ivfc.levels[IVFC_MAX_LEVEL - 1].size;
  192. auto raw = std::make_shared<OffsetVfsFile>(file, romfs_size, romfs_offset);
  193. auto dec = Decrypt(section, raw, romfs_offset);
  194. if (dec == nullptr) {
  195. if (status != Loader::ResultStatus::Success)
  196. return false;
  197. if (has_rights_id)
  198. status = Loader::ResultStatus::ErrorIncorrectTitlekeyOrTitlekek;
  199. else
  200. status = Loader::ResultStatus::ErrorIncorrectKeyAreaKey;
  201. return false;
  202. }
  203. if (section.raw.header.crypto_type == NCASectionCryptoType::BKTR) {
  204. if (section.bktr.relocation.magic != Common::MakeMagic('B', 'K', 'T', 'R') ||
  205. section.bktr.subsection.magic != Common::MakeMagic('B', 'K', 'T', 'R')) {
  206. status = Loader::ResultStatus::ErrorBadBKTRHeader;
  207. return false;
  208. }
  209. if (section.bktr.relocation.offset + section.bktr.relocation.size !=
  210. section.bktr.subsection.offset) {
  211. status = Loader::ResultStatus::ErrorBKTRSubsectionNotAfterRelocation;
  212. return false;
  213. }
  214. const u64 size = MEDIA_OFFSET_MULTIPLIER * (entry.media_end_offset - entry.media_offset);
  215. if (section.bktr.subsection.offset + section.bktr.subsection.size != size) {
  216. status = Loader::ResultStatus::ErrorBKTRSubsectionNotAtEnd;
  217. return false;
  218. }
  219. const u64 offset = section.romfs.ivfc.levels[IVFC_MAX_LEVEL - 1].offset;
  220. RelocationBlock relocation_block{};
  221. if (dec->ReadObject(&relocation_block, section.bktr.relocation.offset - offset) !=
  222. sizeof(RelocationBlock)) {
  223. status = Loader::ResultStatus::ErrorBadRelocationBlock;
  224. return false;
  225. }
  226. SubsectionBlock subsection_block{};
  227. if (dec->ReadObject(&subsection_block, section.bktr.subsection.offset - offset) !=
  228. sizeof(RelocationBlock)) {
  229. status = Loader::ResultStatus::ErrorBadSubsectionBlock;
  230. return false;
  231. }
  232. std::vector<RelocationBucketRaw> relocation_buckets_raw(
  233. (section.bktr.relocation.size - sizeof(RelocationBlock)) / sizeof(RelocationBucketRaw));
  234. if (dec->ReadBytes(relocation_buckets_raw.data(),
  235. section.bktr.relocation.size - sizeof(RelocationBlock),
  236. section.bktr.relocation.offset + sizeof(RelocationBlock) - offset) !=
  237. section.bktr.relocation.size - sizeof(RelocationBlock)) {
  238. status = Loader::ResultStatus::ErrorBadRelocationBuckets;
  239. return false;
  240. }
  241. std::vector<SubsectionBucketRaw> subsection_buckets_raw(
  242. (section.bktr.subsection.size - sizeof(SubsectionBlock)) / sizeof(SubsectionBucketRaw));
  243. if (dec->ReadBytes(subsection_buckets_raw.data(),
  244. section.bktr.subsection.size - sizeof(SubsectionBlock),
  245. section.bktr.subsection.offset + sizeof(SubsectionBlock) - offset) !=
  246. section.bktr.subsection.size - sizeof(SubsectionBlock)) {
  247. status = Loader::ResultStatus::ErrorBadSubsectionBuckets;
  248. return false;
  249. }
  250. std::vector<RelocationBucket> relocation_buckets(relocation_buckets_raw.size());
  251. std::transform(relocation_buckets_raw.begin(), relocation_buckets_raw.end(),
  252. relocation_buckets.begin(), &ConvertRelocationBucketRaw);
  253. std::vector<SubsectionBucket> subsection_buckets(subsection_buckets_raw.size());
  254. std::transform(subsection_buckets_raw.begin(), subsection_buckets_raw.end(),
  255. subsection_buckets.begin(), &ConvertSubsectionBucketRaw);
  256. u32 ctr_low;
  257. std::memcpy(&ctr_low, section.raw.section_ctr.data(), sizeof(ctr_low));
  258. subsection_buckets.back().entries.push_back({section.bktr.relocation.offset, {0}, ctr_low});
  259. subsection_buckets.back().entries.push_back({size, {0}, 0});
  260. std::optional<Core::Crypto::Key128> key = {};
  261. if (encrypted) {
  262. if (has_rights_id) {
  263. status = Loader::ResultStatus::Success;
  264. key = GetTitlekey();
  265. if (!key) {
  266. status = Loader::ResultStatus::ErrorMissingTitlekey;
  267. return false;
  268. }
  269. } else {
  270. key = GetKeyAreaKey(NCASectionCryptoType::BKTR);
  271. if (!key) {
  272. status = Loader::ResultStatus::ErrorMissingKeyAreaKey;
  273. return false;
  274. }
  275. }
  276. }
  277. if (bktr_base_romfs == nullptr) {
  278. status = Loader::ResultStatus::ErrorMissingBKTRBaseRomFS;
  279. return false;
  280. }
  281. auto bktr = std::make_shared<BKTR>(
  282. bktr_base_romfs, std::make_shared<OffsetVfsFile>(file, romfs_size, base_offset),
  283. relocation_block, relocation_buckets, subsection_block, subsection_buckets, encrypted,
  284. encrypted ? *key : Core::Crypto::Key128{}, base_offset, bktr_base_ivfc_offset,
  285. section.raw.section_ctr);
  286. // BKTR applies to entire IVFC, so make an offset version to level 6
  287. files.push_back(std::make_shared<OffsetVfsFile>(
  288. bktr, romfs_size, section.romfs.ivfc.levels[IVFC_MAX_LEVEL - 1].offset));
  289. } else {
  290. files.push_back(std::move(dec));
  291. }
  292. romfs = files.back();
  293. return true;
  294. }
  295. bool NCA::ReadPFS0Section(const NCASectionHeader& section, const NCASectionTableEntry& entry) {
  296. const u64 offset = (static_cast<u64>(entry.media_offset) * MEDIA_OFFSET_MULTIPLIER) +
  297. section.pfs0.pfs0_header_offset;
  298. const u64 size = MEDIA_OFFSET_MULTIPLIER * (entry.media_end_offset - entry.media_offset);
  299. auto dec = Decrypt(section, std::make_shared<OffsetVfsFile>(file, size, offset), offset);
  300. if (dec != nullptr) {
  301. auto npfs = std::make_shared<PartitionFilesystem>(std::move(dec));
  302. if (npfs->GetStatus() == Loader::ResultStatus::Success) {
  303. dirs.push_back(std::move(npfs));
  304. if (IsDirectoryExeFS(dirs.back()))
  305. exefs = dirs.back();
  306. } else {
  307. if (has_rights_id)
  308. status = Loader::ResultStatus::ErrorIncorrectTitlekeyOrTitlekek;
  309. else
  310. status = Loader::ResultStatus::ErrorIncorrectKeyAreaKey;
  311. return false;
  312. }
  313. } else {
  314. if (status != Loader::ResultStatus::Success)
  315. return false;
  316. if (has_rights_id)
  317. status = Loader::ResultStatus::ErrorIncorrectTitlekeyOrTitlekek;
  318. else
  319. status = Loader::ResultStatus::ErrorIncorrectKeyAreaKey;
  320. return false;
  321. }
  322. return true;
  323. }
  324. u8 NCA::GetCryptoRevision() const {
  325. u8 master_key_id = header.crypto_type;
  326. if (header.crypto_type_2 > master_key_id)
  327. master_key_id = header.crypto_type_2;
  328. if (master_key_id > 0)
  329. --master_key_id;
  330. return master_key_id;
  331. }
  332. std::optional<Core::Crypto::Key128> NCA::GetKeyAreaKey(NCASectionCryptoType type) const {
  333. const auto master_key_id = GetCryptoRevision();
  334. if (!keys.HasKey(Core::Crypto::S128KeyType::KeyArea, master_key_id, header.key_index))
  335. return {};
  336. std::vector<u8> key_area(header.key_area.begin(), header.key_area.end());
  337. Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(
  338. keys.GetKey(Core::Crypto::S128KeyType::KeyArea, master_key_id, header.key_index),
  339. Core::Crypto::Mode::ECB);
  340. cipher.Transcode(key_area.data(), key_area.size(), key_area.data(), Core::Crypto::Op::Decrypt);
  341. Core::Crypto::Key128 out;
  342. if (type == NCASectionCryptoType::XTS)
  343. std::copy(key_area.begin(), key_area.begin() + 0x10, out.begin());
  344. else if (type == NCASectionCryptoType::CTR || type == NCASectionCryptoType::BKTR)
  345. std::copy(key_area.begin() + 0x20, key_area.begin() + 0x30, out.begin());
  346. else
  347. LOG_CRITICAL(Crypto, "Called GetKeyAreaKey on invalid NCASectionCryptoType type={:02X}",
  348. static_cast<u8>(type));
  349. u128 out_128{};
  350. memcpy(out_128.data(), out.data(), 16);
  351. LOG_TRACE(Crypto, "called with crypto_rev={:02X}, kak_index={:02X}, key={:016X}{:016X}",
  352. master_key_id, header.key_index, out_128[1], out_128[0]);
  353. return out;
  354. }
  355. std::optional<Core::Crypto::Key128> NCA::GetTitlekey() {
  356. const auto master_key_id = GetCryptoRevision();
  357. u128 rights_id{};
  358. memcpy(rights_id.data(), header.rights_id.data(), 16);
  359. if (rights_id == u128{}) {
  360. status = Loader::ResultStatus::ErrorInvalidRightsID;
  361. return {};
  362. }
  363. auto titlekey = keys.GetKey(Core::Crypto::S128KeyType::Titlekey, rights_id[1], rights_id[0]);
  364. if (titlekey == Core::Crypto::Key128{}) {
  365. status = Loader::ResultStatus::ErrorMissingTitlekey;
  366. return {};
  367. }
  368. if (!keys.HasKey(Core::Crypto::S128KeyType::Titlekek, master_key_id)) {
  369. status = Loader::ResultStatus::ErrorMissingTitlekek;
  370. return {};
  371. }
  372. Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(
  373. keys.GetKey(Core::Crypto::S128KeyType::Titlekek, master_key_id), Core::Crypto::Mode::ECB);
  374. cipher.Transcode(titlekey.data(), titlekey.size(), titlekey.data(), Core::Crypto::Op::Decrypt);
  375. return titlekey;
  376. }
  377. VirtualFile NCA::Decrypt(const NCASectionHeader& s_header, VirtualFile in, u64 starting_offset) {
  378. if (!encrypted)
  379. return in;
  380. switch (s_header.raw.header.crypto_type) {
  381. case NCASectionCryptoType::NONE:
  382. LOG_DEBUG(Crypto, "called with mode=NONE");
  383. return in;
  384. case NCASectionCryptoType::CTR:
  385. // During normal BKTR decryption, this entire function is skipped. This is for the metadata,
  386. // which uses the same CTR as usual.
  387. case NCASectionCryptoType::BKTR:
  388. LOG_DEBUG(Crypto, "called with mode=CTR, starting_offset={:016X}", starting_offset);
  389. {
  390. std::optional<Core::Crypto::Key128> key = {};
  391. if (has_rights_id) {
  392. status = Loader::ResultStatus::Success;
  393. key = GetTitlekey();
  394. if (!key) {
  395. if (status == Loader::ResultStatus::Success)
  396. status = Loader::ResultStatus::ErrorMissingTitlekey;
  397. return nullptr;
  398. }
  399. } else {
  400. key = GetKeyAreaKey(NCASectionCryptoType::CTR);
  401. if (!key) {
  402. status = Loader::ResultStatus::ErrorMissingKeyAreaKey;
  403. return nullptr;
  404. }
  405. }
  406. auto out = std::make_shared<Core::Crypto::CTREncryptionLayer>(std::move(in), *key,
  407. starting_offset);
  408. std::vector<u8> iv(16);
  409. for (u8 i = 0; i < 8; ++i)
  410. iv[i] = s_header.raw.section_ctr[0x8 - i - 1];
  411. out->SetIV(iv);
  412. return std::static_pointer_cast<VfsFile>(out);
  413. }
  414. case NCASectionCryptoType::XTS:
  415. // TODO(DarkLordZach): Find a test case for XTS-encrypted NCAs
  416. default:
  417. LOG_ERROR(Crypto, "called with unhandled crypto type={:02X}",
  418. static_cast<u8>(s_header.raw.header.crypto_type));
  419. return nullptr;
  420. }
  421. }
  422. Loader::ResultStatus NCA::GetStatus() const {
  423. return status;
  424. }
  425. std::vector<std::shared_ptr<VfsFile>> NCA::GetFiles() const {
  426. if (status != Loader::ResultStatus::Success)
  427. return {};
  428. return files;
  429. }
  430. std::vector<std::shared_ptr<VfsDirectory>> NCA::GetSubdirectories() const {
  431. if (status != Loader::ResultStatus::Success)
  432. return {};
  433. return dirs;
  434. }
  435. std::string NCA::GetName() const {
  436. return file->GetName();
  437. }
  438. std::shared_ptr<VfsDirectory> NCA::GetParentDirectory() const {
  439. return file->GetContainingDirectory();
  440. }
  441. NCAContentType NCA::GetType() const {
  442. return header.content_type;
  443. }
  444. u64 NCA::GetTitleId() const {
  445. if (is_update || status == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS)
  446. return header.title_id | 0x800;
  447. return header.title_id;
  448. }
  449. bool NCA::IsUpdate() const {
  450. return is_update;
  451. }
  452. VirtualFile NCA::GetRomFS() const {
  453. return romfs;
  454. }
  455. VirtualDir NCA::GetExeFS() const {
  456. return exefs;
  457. }
  458. VirtualFile NCA::GetBaseFile() const {
  459. return file;
  460. }
  461. u64 NCA::GetBaseIVFCOffset() const {
  462. return ivfc_offset;
  463. }
  464. } // namespace FileSys