PS3 un7zip library (PSL1GHT)

bucanero

Developer
Here's my library to extract .7z files on the PS3 :)

Since the linux p7zip was not an option due to the pthread requirement, I kept looking around for alternatives...
So, I found an Android implementation (AndroidUn7zip) that was clean from threads, and ported it to PSL1GHT. :D

Here's the Github repo:
https://github.com/bucanero/libun7zip

You can find a basic example here: https://github.com/bucanero/libun7zip/tree/master/example

@aldostools @Zar I guess that you can add .7z support to MGZ and Irisman too ;)
 
Actually, there's no specific PSL1GHT stuff in my version, so this library could actually work in almost any platform with a gcc/g++ compiler.
 
Thanks, it supprort 7zip only ?

yes, it's only for 7 zip files.

I think there is something similar inside rco mage src I(included in mgz).
https://github.com/Zarh/ManaGunZ/tree/master/MGZ/source/RCO/7z
Maybe i'm wrong i never read these files ;)


I checked your code, it's only for encoding byte streams using the Deflate compression method.
(It doesn't have the decompression or the file format part)

but I guess that mixing that with this library, it could be possible to also create new 7 zip files from the PlayStation 3. :)
 
Last edited:
Cool, i guess this completes the collection of most popular compressed formats, zip, rar, 7z :)
Btw, the 7z code of rcomage is because is used to compress in zlib format, right ?


Edit:
Hmm, and rlz too... the RCO format uses both compression methods: zlib, and rlz
 
Cool, i guess this completes the collection of most popular compressed formats, zip, rar, 7z :)

yeah :D I think that many users will be happy to get the next version of MGZ and Irisman.

Btw, the 7z code of rcomage is because is used to compress in zlib format, right ?

yes, you're right. For some reason the RCO developer used parts of the 7zip code, but not for the 7z (lzma) method, but for the regular zlib "deflate" method. Perhaps for simplicity (no external library) or for performance. (wikipedia says 7zip creates better deflated results)
 
yeah :D I think that many users will be happy to get the next version of MGZ and Irisman.
Yes, there has been some talks related with .rar and .7z latelly, and you are on a strike :encouragement:

yes, you're right. For some reason the RCO developer used parts of the 7zip code, but not for the 7z (lzma) method, but for the regular zlib "deflate" method. Perhaps for simplicity (no external library) or for performance. (wikipedia says 7zip creates better deflated results)
I was curious about how many things we could do and was taking a peek here:
https://www.psdevwiki.com/ps3/Resource_Container_(RCO)
https://www.7-zip.org/7z.html

So as far i understand with the code from rcomage in mgz git we could create a valid .7z file ? (using deflate method)


*And the RLZ compression method was a "hack" specific for rcomage added on top of 7zip source code, right ?
 
Yes, there has been some talks related with .rar and .7z latelly, and you are on a strike :encouragement:

:D I wonder if somebody will ask for ".tar.gz" unpacking now... :P
(actually it should be quite easy, since we have libz on psl1ght)

I was curious about how many things we could do and was taking a peek here:
https://www.psdevwiki.com/ps3/Resource_Container_(RCO)
https://www.7-zip.org/7z.html

So as far i understand with the code from rcomage in mgz git we could create a valid .7z file ? (using deflate method)

*And the RLZ compression method was a "hack" specific for rcomage added on top of 7zip source code, right ?

I'm not an expert on the .rco stuff, but at least from the source, it looks like the RLZ method was added in rlzpack.c . Probably it's a stand-alone function not connected to the 7zip source.

Right now we can't do .7z files, even if we use the deflate method. The thing missing to create a valid .7z is the archiver part. (the code that builds a valid .7z file, headers, structure, etc.)
Still, I think that it would only make sense if the LZMA method is also implemented, so you'd get a better compression ratio. If not, it would just be a .zip with a .7z header. :)

btw, I've updated the library code, simplified the calls and added a List7zFile() function to get the archive contents without needing to unpack it.
 
it'll not support multiman?
only support megagunz & irisman!

This is only a decompression library. It depends on Multiman's autor (deank) to add these libraries or not.
Note: multiman is not open-source, so only the author can make changes to it.
 
:D I wonder if somebody will ask for ".tar.gz" unpacking now... :P
(actually it should be quite easy, since we have libz on psl1ght)



I'm not an expert on the .rco stuff, but at least from the source, it looks like the RLZ method was added in rlzpack.c . Probably it's a stand-alone function not connected to the 7zip source.

Right now we can't do .7z files, even if we use the deflate method. The thing missing to create a valid .7z is the archiver part. (the code that builds a valid .7z file, headers, structure, etc.)
Still, I think that it would only make sense if the LZMA method is also implemented, so you'd get a better compression ratio. If not, it would just be a .zip with a .7z header. :)

btw, I've updated the library code, simplified the calls and added a List7zFile() function to get the archive contents without needing to unpack it.
Ok, got it :)
Btw, in psl1ght there is lzma ?, im thinking in homebrew apps for the PS3 that could use lzma but i dont remember any
The PSARC (PlayStation ARChive) format uses it though, is used a lot by game companies to pack game files (i guess because sony promotes it in the PSP/PS3/PS4/PSV SDK's), but not used in homebrew as far i know

In 7zip web there is C and C++ source code for it (not sure f monothread or multithread) https://www.7-zip.org/sdk.html
I guess is almost ready to be compiled in psl1ght and see if the compiler complains about something, maybe we are lucky and compiles fine
 
Ok, got it :)
Btw, in psl1ght there is lzma ?, im thinking in homebrew apps for the PS3 that could use lzma but i dont remember any
The PSARC (PlayStation ARChive) format uses it though, is used a lot by game companies to pack game files (i guess because sony promotes it in the PSP/PS3/PS4/PSV SDK's), but not used in homebrew as far i know

from what I know, there's no lzma stuff on psl1ght, only Gzip and Zip. Now we have a few more options with the decompressors I added (rar/7z/tar/etc) but note that these are only unpacking tools. (we can't create .rar or .7z files)

Yes, I guess that LZMA is a choice for many developers nowadays because you can get much better compression ratios than with a standard Zip, while still being an open format (no royalties and stuff). E.g., RAR might be achieve great ratios too, but it's proprietary so I think dev studios will avoid it.

In 7zip web there is C and C++ source code for it (not sure f monothread or multithread) https://www.7-zip.org/sdk.html
I guess is almost ready to be compiled in psl1ght and see if the compiler complains about something, maybe we are lucky and compiles fine

from what I remember, the LZMA encoder is available in plain C (something like lzmaEnc.c) and should compile without threads. (allowing us to compress byte stream buffers with LZMA)

not sure who would need it or use it though :confused:
 
from what I remember, the LZMA encoder is available in plain C (something like lzmaEnc.c) and should compile without threads. (allowing us to compress byte stream buffers with LZMA)

not sure who would need it or use it though :confused:
Dunno, for something related with exporting files, i was wondering if you was going to export stuff with apollo in compressed formats, but is not a request, i was just thinking loud :)
 
Dunno, for something related with exporting files, i was wondering if you was going to export stuff with apollo in compressed formats, but is not a request, i was just thinking loud :)

I'm exporting a few things on Apollo using .Zip as archive format. I think it's the most user friendly, in the sense that almost anyone knows how to open/extract a .zip, and they're a ton of tools to do it.
As an example, even if a ".tar.bz2" could achieve a better compression ratio, I think that not every user could open it easily.
 
لWhy is it that when I try to build it always tells me that the interpreter is old? I use PSDK3v2
Thats because PSDK3v2 is outdated, Bucanero has his own toolchain with a newer gcc version (which is probably why you are getting that error), there is a thread on it here
https://www.psx-place.com/threads/compiling-open-source-ps3-toolchain-nowadays-in-2020.30030/
and you can download the toolchain at
https://github.com/bucanero/ps3toolchain
if you are on ubuntu or macos it has precompiled versions in releases, if not you would need to compile it yourself (if you are on windows you could use WSL2 with the ubuntu version or you could use cygwin to compile a native version for windows)
 
Thats because PSDK3v2 is outdated, Bucanero has his own toolchain with a newer gcc version (which is probably why you are getting that error), there is a thread on it here
https://www.psx-place.com/threads/compiling-open-source-ps3-toolchain-nowadays-in-2020.30030/
and you can download the toolchain at
https://github.com/bucanero/ps3toolchain
if you are on ubuntu or macos it has precompiled versions in releases, if not you would need to compile it yourself (if you are on windows you could use WSL2 with the ubuntu version or you could use cygwin to compile a native version for windows)

Oh thx
 
I didn't know about this, so I tried installing it on my ubuntu 20.04 distro. no problems. thanks. I don't recall how old my ps3 toolchain is, but it's probably not super old as I used it to build mania, and the new fork is for newer versions of the toolchain.

edit: I almost forgot to mention. this is on wsl v2 btw.
 
Glad it helps, also @Charles_n_town there is also a experimental version with even higher gcc support (v13) at
https://github.com/humbertodias/ps3toolchain
but not sure if anyone has tested it yet so not sure if it works or not, but if you find you need an even newer compiler its also a option.
There is also a gcc9 version for ArchLinux too
https://www.psx-place.com/threads/i-updated-the-ps3toolchain-to-gcc-9-5-0-binutils-2-40.39786/
anyway thats just a couple more options if you ever need newer gcc versions. But Bucanero's build has worked for anything i have compiled so far :)
 

Similar threads

Back
Top