melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
3.16k stars 518 forks source link

Cannot load zstd compressed ROM #1691

Open CasualPokePlayer opened 1 year ago

CasualPokePlayer commented 1 year ago

image image Occurs on both Windows and Linux.

CasualPokePlayer commented 1 year ago

Seems the issue here is that ZSTD_getFrameContentSize is returning ZSTD_CONTENTSIZE_UNKNOWN. This is also noted in the zstd manual:

decompressed size is an optional field, it may not be present, typically in streaming mode.
            When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size.
            In which case, it's necessary to use streaming mode to decompress data.
            Optionally, application can rely on some implicit limit,
            as ZSTD_decompress() only needs an upper bound of decompressed size.
            (For example, data could be necessarily cut into blocks <= 16 KB).

This is probably from me using 7-zip-zstd to compress this ROM, which probably uses ZSTD streaming mode under the hood.