-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support BCJ method #62
Comments
Hey, Matt, firstly, I'd like to thank you for your hard work on this. Secondly, I'd like to upvote this issue, as MAME archive uses BCJ as well.
I think I found the original C implementation in the 7z source code, but I'm sure you've seen it already. |
I think there's some additional scaffolding around that code but yes, that's essentially the implementation. It should be easier than BCJ2, I just need to find some time to do it. |
@rusq I've created #83 which seems to work with my limited testing; it works with the small test cases I created and it seems to work fine on the Swiss GameCube homebrew. I tried to test it on the MAME archive you linked but noticed that this is a self-extracting archive which my package currently doesn't support. I can probably add support for self-extracting archives doing something similar to https://github.com/hillu/go-zipsfx which searches through the file until it finds the magic archive header rather than assume it's at the head of the file. |
Thank you @bodgit ! Great work! I'll test it out. I cheated on that MAME file, in my program I'm using a specific version, so I get the archive offset by running 7z test:
Which gives the offset, then I use this value to Seek, and open a SectionReader: https://github.com/corkscrewey/soviet-tetris/blob/runner/mame.go#L70-L74. I did think of implementing a search within the file for the 7z signature, but that would be an overkill for such a simple program that just needs to unpack it. Thanks again! |
I've just created #85 which adds support for self-extracting archives. It scans the first 1 MiB of the file which should be enough to find the signature without scanning the whole file. Annoyingly on some platforms, the signature can appear more than once (usually twice) and the first occurrence is in the executable that is at the beginning of the file so there's some heuristics to work out which offset is the correct one. I've tested it on that MAME archive and it works correctly. |
That's perfect @bodgit , thank you! I'll aim to try it out on the weekend. I'm really amazed how you put so much effort to implement the 7z in go, tbh, kudos! |
Hey @bodgit, I have tried it with mame, it works (for both: SFX scan and BCJ compressed files). Thanks again! |
Thanks for testing and confirming! |
Decompression method:
3.3.1.3
The GameCube homebrew "Swiss" is distributed in a 7z that uses BCJ for some of the binaries.
The text was updated successfully, but these errors were encountered: