finalburnneo / FBNeo

FinalBurn Neo - We are Team FBNeo.
http://neo-source.com
Other
944 stars 368 forks source link

[Feature Request] Zstandard support for zip archives and CHDs #1613

Open crashGG opened 11 months ago

crashGG commented 11 months ago

In a recent update, mame added zstd encoding/decoding support for zip and chd. https://github.com/mamedev/mame/commit/05e69b43e9770e16c4bf1c6ca3e585e64c3f6ff9

The compression rate of zstd is between deflate/zlib and lzma,but decompression speed is faster ,somtimes even than direct copying https://mcmilk.de/projects/7-Zip-zstd/dl/compr-v120.png https://mcmilk.de/projects/7-Zip-zstd/dl/decomp-v120.png

Fast decompression means efficiency and low CPU overhead. This benefits all players and low-end devices.

litaniast commented 9 months ago

fbneo doesn't support chd at all.

barbudreadmon commented 9 months ago

@crashGG Sorry for the late answer, it seems i totally overlooked this issue. Tbh, i want to say no here, mostly due to compiler backward compatibility concerns.

crashGG commented 9 months ago

In addition to mame, many emulators have recently added zstd decoding support. This seems to be a trend. PCSX2: https://github.com/PCSX2/pcsx2/pull/10826 duckstation https://github.com/stenzek/duckstation/commit/0e6a9f637bc1975a75edcfd0ccf32f59bbafd733 flycast: https://github.com/flyinghead/flycast/pull/1402 PPSSPP: https://github.com/hrydgard/ppsspp/pull/18824 melonDS: https://github.com/melonDS-emu/melonDS/pull/1667

barbudreadmon commented 9 months ago

A few weeks ago, i've seen the maintainer of the mame libretro core complaining about that stuff, he couldn't build it with the standard libretro buildbot because it was apparently too outdated.

Is any of those emulators you are talking about available on winxp, 3ds, psvita, wiiu, ps3, ... ? Also, while it does make some sense to worry about this for emulators that read discs at runtime, or load extremely big archives at launch, FBNeo doesn't really do any of that. I don't really see the point of dropping support for multiple platforms, only to shorten already fairly short loading time.

crashGG commented 8 months ago

Maybe could consider trying to add for libretro port, which runs more on modern computer and operating systems

Aerocatia commented 7 months ago

Igor Pavlov has written his own zstandard decoder for 7-zip for the reason of supporting old compilers (7-zip itself is compiled with VS2005) The code is not out yet as he does not post code for 7-zip betas, but when it does release it might be worth looking at using that. License might end up being PD or LGPL, depends on what he uses. His LZMA code is PD. zstandard-zip is a decent enough format.

crashGG commented 2 months ago

I noticed that zlib was recently updated to the latest version, so maybe could simply use zlibwrapper to get zstd support based on that. https://github.com/facebook/zstd/tree/dev/zlibWrapper

Aerocatia commented 2 months ago

Igor has since released his old-compiler friendly decoder as BSD 3-Clause. https://github.com/ip7z/7zip/blob/main/C/ZstdDec.c

barbudreadmon commented 1 month ago

This is an open-source project, feel free to open a PR with those changes after testing them on all platforms. I personally won't go through that trouble to reduce loading times from 0.100s to 0.095s, especially after debugging the compatibility problems that arose from the recent zlib update.