ps3dev / PSL1GHT

A lightweight PS3 SDK
www.psl1ght.com
MIT License
226 stars 64 forks source link

Don't use fixed buffer size it fails with big executables #127

Closed lephilousophe closed 3 years ago

lephilousophe commented 3 years ago

When creating big SELF, def_buffer may not be large enough to get the whole deflated section. Compacted data is then invalid. Make use of deflateBound to allocate a buffer large enough to get the whole deflated stream.

zeldin commented 3 years ago

Looks great. Just one thing: If the change of ZLIB_LEVEL was intentional I think that should go into a separate commit since it's not really part of the purported change here. I don't know why geohot picked level 6 in the first place, so I think some visibility for that change would be good if it turns out that there was some deeper meaning behind it...

lephilousophe commented 3 years ago

Indeed, this was part of my tests and didn't pay attention when committing. The whole patch (dynamic allocation and zlib compression level set to 9) has been tested on ScummVM PS3 toolchain and has been proven to work on RPCS3 and real hardware

zeldin commented 3 years ago

Merged. Thanks!