From 2c80b243a9a8d964a7bab9e2c90967a367c46665 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 24 Mar 2024 16:14:29 +0100 Subject: [PATCH] Gamecard/3DSX: Fix file size reporting with RomFS --- source/loader/gamecard.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/loader/gamecard.cpp b/source/loader/gamecard.cpp index 6c87db2..e5d3b21 100644 --- a/source/loader/gamecard.cpp +++ b/source/loader/gamecard.cpp @@ -518,6 +518,11 @@ public: } HLE::OS::OS::ResultAnd 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); }