ryujinx-mirror / ryujinx

Hard-fork of the Ryujinx project
MIT License
1.04k stars 404 forks source link

[Feature Request] NSZ and XCZ support. #36

Open TimeFlex1 opened 1 week ago

TimeFlex1 commented 1 week ago

Could we get support for the most common compression filetypes for Switch emulation? Would like the keep my games compressed on my external and just play them without decompressing the games first. Some games are half the file size in compressed format. Please!

amurgshere commented 6 days ago

Hey @TimeFlex1 ,

The XCI formats probably compress to XCZ so well because a lot of the space in the XCI files is just padding, I have create a branch and pull request for a new trim feature which will trim XCI files allowing for the smaller size without the compression. decompression performance overheads. You might want to download that version and try out the trimming instead while this feature is still being considered.

Thank You.

LokeYourC3PH commented 1 day ago

Hey @TimeFlex1 ,

The XCI formats probably compress to XCZ so well because a lot of the space in the XCI files is just padding, I have create a branch and pull request for a new trim feature which will trim XCI files allowing for the smaller size without the compression. decompression performance overheads. You might want to download that version and try out the trimming instead while this feature is still being considered.

Thank You.

Thank god someone is working on it, I really hated the hesitancy and outright dismissal at times of old RyujiNX and Yuzu devs to include NSZ and XCZ support with the usual canned reply of "don't need it, nobody uses it", when that obviously wasn't back then and still now isn't true. So thank you for actually considering it 🙏

amurgshere commented 22 hours ago

@LokeYourC3PH ,

The support for these files would only be worth if they support block level compression, which would enable the emulator to play games from them on the fly without having to first extract the entire ROM.

This information here:

https://gbatemp.net/threads/nszip-nsp-compressor-decompressor-to-reduce-storage.530313/

References a format of XCZ and NSZ that does support Block level compression

NSZ/XCZ:

I think implementing the Block compression would be possible, as a Stream wrapper could be written around the file stream. This stream wrapper could decompress the blocks on an as needed basis and even potentially cache blocks that are being hit more often.

But keep in mind it could only support the formats that use block compression, and only if the block compression is implemented in a way that allows random seeking to the original file position.

extherian commented 1 hour ago

Out of curiosity, wouldn't this require XCIs to be decrypted first? How is it possible to compress an image full of redundant, encrypted data? Or does it decrypt the XCI, compress it, then reencrypt it again?