aboutsummaryrefslogtreecommitdiff
path: root/src/tests/core/nup_writer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #327 from daniel-cabral/fix/nup-writer-msvcJonas29 hours1-1/+1
|\ | | | | tests when building on Windows: compare FindBestUpdatePackage with a size_t
| * tests when building on Windows: compare FindBestUpdatePackage with a size_tDaniel Cabral34 hours1-1/+1
| | | | | | | | | | | | | | | | | | | | FindBestUpdatePackage returns std::optional<std::size_t>, and comparing it with an int makes MSVC emit C4388 inside <optional>, which WERROR turns into an error, so the tests target does not build on Windows. Part of #326. Assisted-by: Claude Opus 5.5 (diagnosis, fix and commit message draft)
* | Merge pull request #334 from snowstormxd/codex/upstream-mkw-testJonas30 hours1-1/+4
|\ \ | | | | | | MKW performance improvements
| * | loader: find mixed-case loose RomFS directories consistentlysnowstormxd33 hours1-1/+4
| |/ | | | | | | | | | | Linux missed base version metadata for Base/RomFS while Windows included it. Use a case-insensitive fallback for the loose directory and check the version and resulting archive checksum. Assisted by Codex.
* | file_sys: reject NUP tables with wrapping bounds or cyclic directoriesSssnowyyy33 hours1-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 31b901b93b checked the TOC with unchecked arithmetic on counts and offsets read from the file. The record-table size (u64 count times record size) and u32 first_child + child_count can wrap, so the bounds checks pass and later reads go out of bounds; the same holds for the TOC range, name ranges, file extents and the meta range. A directory that lists its own ancestor as a child also made BuildDirTree recurse until the stack overflowed. Bound the counts by the TOC size before multiplying, compare ranges by subtraction, and widen the child range to u64. Walk the directory graph once after parsing with an explicit stack and reject cycles and nesting deeper than 128, so BuildDirTree can no longer recurse without bound. The file is rejected with ErrorNUPBadFormat. Assisted-by: Claude Sonnet 5.5 (implementation and commit message)
* | file_sys: decompress large NUP zstd members onceSssnowyyy33 hours1-0/+52
|/ | | | | | | | | | | | | | | | | | | 31b901b93b only cached a zstd member while it fit the 512 MiB cache. Anything larger was never cached, so every Read() allocated the full uncompressed size and decompressed the whole extent again, which makes a multi-GB RomFS read in small chunks unusably slow. Members between 256 and 512 MiB evicted each other on alternate reads, and Insert copied the vector so memory briefly doubled. Two threads decompressing the same member also left a duplicate LRU entry and a wrong byte count. The writer emits one zstd frame per member, so there are no frame boundaries to seek by. Members larger than half the cache are now streamed once into a temporary file under the cache directory and read from there, using bounded memory. The file is removed when the container is released. Smaller members stay in the LRU, which now moves the vector in and ignores a duplicate insert. Assisted-by: Claude Sonnet 5.5 (implementation and commit message)
* loader: read the display version from GameDataList.Product.NNN tookraibse37 hours1-0/+22
| | | | | | | | | Donkey Kong Bananza names its resource size table without a version, so no version was found for a loose dump. Its GameData/GameDataList.Product .320.* files carry it (3.2.0), so read them as well and use the newest tag from either source. Assisted-by: Claude Sonnet 5.5 (wrote the GameDataList version lookup and its test)
* file_sys: let the NUP packer override and probe the name, icon and versionkraibse37 hours1-0/+31
| | | | | | | | | | PackOptions::metadata overrides the title name, icon and display version found in the dump. A version override is written to the base and to the newest update, since the NUP loader reads the version from the newest update first. ProbeMetadata reads what a dump would be packed with, the version coming from the newest update that reports one, else the base. Assisted-by: Claude Sonnet 5.5 (wrote the metadata overrides, ProbeMetadata and their test)
* file_sys: add a deterministic NUP packer, Convert to NUP in Qt and eden-cli ↵Jonas45 hours1-0/+392
--pack-nup (#271) * file_sys: add a NUP packer for loose dumps Packs a loose dump (exefs/romfs, base/, updates/<version>/ and dlc/<titleid>/<n>/) into a NUP v1 container with the aligned record layout. Every package is kept, files are deduplicated by SHA-256 and compressed with zstd unless that does not shrink them, and files over 256 MiB are stored raw. Output is byte-identical on every platform: compression is single-threaded with every frame parameter set explicitly, and zstd is always bundled so all builds use the same version. A low-storage mode deletes each source file once its extent is synced and journaled, and an interrupted run resumes from the journal. Assisted-by: Claude Opus 5.5 (wrote the packer, its EdenPack-free dump detection, the aligned record layout and the deterministic zstd setup; ran the Raiders and Donkey Kong Bananza packs and boot checks) * tests: cover the NUP packer Round-trips a dump through NupContainer, checks standalone updates, a bare exefs/romfs dump, low-storage resume and overwrite rejection, and pins the hash of a packed dump so changes to the output are deliberate. Assisted-by: Claude Opus 5.5 (wrote the tests, including the pinned output hash) * qt: add Convert to NUP to the game list Shown for loose dumps. Asks for confirmation with the estimated space, offers low-storage mode, runs in the background with progress and cancel, and resumes an interrupted low-storage conversion. Assisted-by: Claude Opus 5.5 (wrote the Convert to NUP action and its progress and resume handling) * cli: add --pack-nup <dump> [out.nup] Assisted-by: Claude Opus 5.5 (wrote the --pack-nup option)