Gamecard/3DSX: Fix file size reporting with RomFS

This commit is contained in:
Tony Wasserka 2024-03-24 16:14:29 +01:00
parent 79a9221eaf
commit 2c80b243a9

View file

@ -518,6 +518,11 @@ public:
}
HLE::OS::OS::ResultAnd<uint64_t> GetSize(HLE::PXI::FS::FileContext& context) override {
if (ncch.romfs_size.ToBytes()) {
// RomFS may extend past original 3DSX size, since its start offset is aligned in NCCH but not in 3DSX
return std::make_tuple(HLE::OS::RESULT_OK, uint64_t { ncch.romfs_offset.ToBytes() + ncch.romfs_size.ToBytes() });
}
// Return original file size as upper bound; this is merely needed to prevent the bounds check in FileViews from failing
return file->GetSize(context);
}