Qhimm.com Forums

Final Fantasy 7 => FF7 Tools => Topic started by: mav on 2007-10-29 08:40:01

Title: [PSX/PC] Open BIN-GZIP files - BinExplorer (1.1)
Post by: mav on 2007-10-29 08:40:01
Update: simple GUI version released

Hello again!

I promised a while ago that I'll make proggy for handling BIN-GZIP files from FF7 (kernel.bin, window.bin, etc.). So here it is. What is the difference between this and ff7dec program? Well, there are two:

- it contains only two files - an .exe and .dll (for gzip functions) versus all the files from ff7_gzip package
- it correctly handles all files (at least that's what I hope). ff7dec couldn't handle window.bin because of weird bug. In every file header (first 6 bytes) there is an ID for each file. Unfortunately this isn't just a incremental counter. In kernel.bin file it goes from 00 to 09, and then every file has 09 ID. This was handled by ff7dec. In window.bin however id's are as follows: 00, 00, 01. And the game crashes when they are different (ff7dec produces: 00, 01, 02). My program while extracting files from archive creates another file in the directory - [archive].ids - which contains the IDs so they can be imported properly later

It's a command line application written in .NET 1.1 (as my previous apps). I wanted it to be a GUI application, but unfortunately it's hard to make C# GUI apps for Windows under Linux :). But when I get my hands on Visual Studio for Windows I'll maybe update this to be also a GUI app.

As always, here are the links for actual app and it's source code:

GUI version:

Link: BinExplorer 1.1 (http://www.subfan.pl/ff7pl/ff7binexplorer_gui.zip)

Command-line version:

Link: BinExplorer 1.0 (http://www.subfan.pl/ff7pl/ff7binexplorer.zip)
Link: BinExplorer 1.0 C# source (http://www.subfan.pl/ff7pl/ff7binexplorer_src.zip)
Title: Re: [Release] FF7 BinExplorer
Post by: ARMs on 2007-10-29 19:09:51
Thanks alot it works perfectly.

Edit:  I was wondering if the dll file is the same one as the one used for your ff7scenefix program.   I just wanted to know cause if it is i'll put it in the same directory.
Title: Re: [Release] FF7 BinExplorer
Post by: mav on 2007-10-29 19:45:13
Glad you like it :).

Yes, it's the same (it cointains GZip functions). I think you can put it in your system32 directory and don't bother copying it everywhere anymore :).
Title: Re: [Release] FF7 BinExplorer
Post by: kruci on 2007-10-29 20:24:51
Only little bug report.

GUI version:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
if .ids file is not found
if I cancel dir selection(if it ask after file to extract, or dir to create new)
System.ArgumentOutOfRangeException: Length cannot be less than zero
if I cancel file selection


If I cancel choosing dir where extract .bin file, it extract to bin file directory

If it ask for name to new file to create, it dont care about what you wrote, it use name that it took from separate files.
(test1, test2, test3 ... create file test.bin, even if I choose name kernel.bin)

And, it created to me always diferent file(from same source), but change is in gzip header
0x1F8B080000000000(original header...)
0x1F8B0800XXXX2647 - changes was where is XXXX, but I think that this change dont influe anything

I didnt test it in game.


But looks like no bug that influe compatibility, so it should be working:)
Title: Re: [Release] FF7 BinExplorer
Post by: mav on 2007-10-29 20:44:41
Yeah, I have to make it error-proof, thanks for reporting :).

Files are always different, because GZip library has a slightly diffrent deflate algorithm, but game accepts this.
Title: Re: [Release] FF7 BinExplorer
Post by: Lazy Bastard on 2012-07-19 02:19:07
This program seems to have disappeared from the face of the earth? Does anyone have a copy? I'd gladly host it on GameHacking.org so it doesn't vanish again, if we can locate it somewhere...
Title: Re: [Release] FF7 BinExplorer
Post by: nfitc1 on 2012-07-19 13:11:08
You necro a five-year old thread wanting an equally old program that has been obsoleted by several others? Why?
Title: Re: [Release] FF7 BinExplorer
Post by: Lazy Bastard on 2012-07-24 18:25:39
You necro a five-year old thread wanting an equally old program that has been obsoleted by several others? Why?

Because it handles more than one .bin, and because it's an alternative to other tools, and thus could provide additional functionality.
Title: Re: [Release] FF7 BinExplorer
Post by: Bosola on 2012-07-24 19:52:27
If a program is no longer mirrored, it's generally best to first PM / email the developer and ask them to update their links. Otherwise we just end up with bumps that don't really add much.

You necro a five-year old thread wanting an equally old program that has been obsoleted by several others? Why?

Do PrC and WM really handle all the bytes within the .bin files now?
Title: Re: [Release] FF7 BinExplorer
Post by: Lazy Bastard on 2012-07-24 20:34:48
If a program is no longer mirrored, it's generally best to first PM / email the developer and ask them to update their links. Otherwise we just end up with bumps that don't really add much.

Fair enough, but M4v3R hasn't been active since 2012-02-19, and I bet there's someone else on these forums that still has a copy of it lying around somewhere...

I've PM'd him, nonetheless.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-02 07:27:36
Sorry to necrobump, but I am trying to edit "WINDOW.BIN" specifically, and this tool is exactly what I need.

McAfee says the download link contains PUPS. I downloaded it anyway, but I get errors from Windows OS and 7-Zip that the ".zip" file is invalid.

I'll send the OP a PM, but if anyone has this program (or a better program that can do the same thing) and can post a working download link, that would really help.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: Lazy Bastard on 2017-02-02 16:25:45
NERV Agent: I believe the download entitled "FF7Dec + gzip" at GameHacking.org's Downloads page can handle WINDOW.BIN:

http://gamehacking.com/download (http://gamehacking.com/download)
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-13 02:19:50
Unfortunately, the program you linked to does not work.

I tested it right now. "WINDOW.BIN" is 13,266 bytes.

I decompressed and recompressed the unmodified contents of "WINDOW.BIN", and the output was 13,108 bytes, less than the original.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: Lazy Bastard on 2017-02-13 15:50:41
I haven't used it in a while, but I did manage to successfully use that program for a few FF7 BIN files (not sure if that included WINDOW.BIN). Did you follow the instructions included?
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-14 04:47:52
I followed the correct syntax as the program describes:

Code: [Select]
Syntax: ff7dec d file.bin

        decodes file.bin in file.bin0, file.bin1, file.bin2, etc etc

        ff7dec e file.bin

        encodes file.bin0, file.bin1, file.bin2, etc etc in file.bin

There is a text file, "Notes.txt", but "WINDOW.BIN" is not mentioned anywhere in that text file.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: DLPB_ on 2017-02-14 05:51:05
It decodes all bin files, that's why.

ff7dec d window.bin

will create 3 files... the files that are part of window.bin.  You need to make changes - then with the same names of the 3 files use

ff7dec e window.bin

If you've done that, then it's possible the compression itself is different.  gzip has different levels of compression, no?  It's never going to be the exact same size.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-15 04:17:08
I checked the files it extracted now, "WINDOW.BIN0", "WINDOW.BIN1", "WINDOW.BIN2".

I recompress it with the appropriate command line, and I get a smaller file.

will create 3 files... the files that are part of window.bin.  You need to make changes -

If you are referring to the headers (like in that other thread), I cannot find any instance of "1F8B08" where I would change a header.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-16 05:01:23
Still exploring all my options here.

In the original version, the header entries are:
00 00 1F 8B 08
00 00 1F 8B 08
01 00 1F 8B 08

But after decompressing and recompressing, the entries in the newly generated file are:

00 00 1F 8B 08
01 00 1F 8B 08
02 00 1F 8B 08

I had an idea. Change modify the headers of the original file as thus:
00 00 1F 8B 08 -> 00 00 1F 8B 08
00 00 1F 8B 08 -> 01 00 1F 8B 08
01 00 1F 8B 08 -> 02 00 1F 8B 08

I intended to decompress, then recompress, then see what happens.

Decompressed, and got this output:

WINDOW.BIN0 (33 KB)
WINDOW.BIN1 (33 KB)
WINDOW.BIN2 (2 KB)

I attempted to recompress it, but the program crashes. But the program then changes files in the directory to:

WINDOW.BIN0.gz (10 KB)
WINDOW.BIN1 (33 KB)
WINDOW.BIN2 (2 KB)

I renamed those files to match what it was before (removed ".gz" from the first file), and tried to encode it again. I got the same results.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: DLPB_ on 2017-02-16 05:51:38
As I said before, FF7 will fail if the headers are not exactly the same before and after.

They MUST be

00 00 1F 8B
00 00 1F 8B
01 00 1F 8B

for the 3 parts.  The PC (and psx?) version will just crash on entry if they aren't.  The 3rd file is the font spacing table.

It's natural that compressing will give different file sizes.  It depends on the compression level, compressor, and also the data itself.  I'm right in assuming you have edited data?  If so, you cannot hope to have a file that has the same file size output.  The PSX image will have to be regenerated with new addresses (which that other program that Paul compiled will do).
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-17 04:02:03
I'm right in assuming you have edited data?

Nope. The data is unedited. After recompressing, it still turns out smaller.

The only time I started to edit the data was when I got curious and tinkered with the headers.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: DLPB_ on 2017-02-17 05:31:54
Prob just the compression algorithm.  I'll send Luksy your way.  He may know more.

Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-22 07:16:58
I don't get to work on game hacking much with my busy schedule, but I attempted to solve this right now with psxinject (included with PSXImager V2.0), but to no results.

I recompressed as usual, then changed the headers for the smaller "WINDOW.BIN" that was generated.

My copy of Final Fantasy VII PSX was ripped with CloneCD per these instructions (http://ngemu.com/threads/how-to-make-a-perfect-backup-of-psx-games.34515/), and I get a ".img" ISO. (I own the discs, so this isn't piracy FYI.)

Code: [Select]
\psximager>psxinject ff7-1us.cue INIT/WINDOW.BIN edit_headers_after_e.bin
++ WARN: could not retrieve file info for `ff7-1us.bin': No such file or directory
++ WARN: init failed
Error opening input image "ff7-1us.cue", or image has wrong type

So I changed the ".img" extension to ".bin".

Code: [Select]
\psximager>psxinject ff7-1us.cue INIT/WINDOW.BIN edit_headers_after_e.bin
File 'INIT/WINDOW.BIN' replaced in "ff7-1us.bin"

Virtual CloneDrive cannot load the ".ccd" file, even after I change "ff7-1us.img" to "ff7-1us.bin" in the ".cue" file.

I just set Virtual CloneDrive to open "Other Images" instead of "CloneCD/DVD Images", and load "ff7-1us.bin".

I run pSX to load the game from the virtual drive.

Same failtastic result. The game freezes after "Sony Entertainment America Presents".
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: DLPB_ on 2017-02-22 10:03:42
It should automatically change the headers.  At least, that's what I remember it doing when I used it. It can rebuild an image for you.

Images have to be bin format I think.  Renaming them will not fix a wrong format.  I'm not sure what the best program is for creating bin files from PSX games. Isobuster can probably do it. ImgBurn too. I've never had to do it :P

Also, if headers are still corrupt, try using ECCRegen.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: Green_goblin on 2017-02-22 10:17:11
I recommend you to insert the modified files using CD-Mage.
It will give you the option to "zero-padd" the free space in case the files you modified are smaller than the original files.
Use the "zero-padding" and the image should work fine.
Title: Re: [FF7] Open BIN-GZIP files - BinExplorer (1.1)
Post by: NERV Agent on 2017-02-23 00:38:57
I recommend you to insert the modified files using CD-Mage.
It will give you the option to "zero-padd" the free space in case the files you modified are smaller than the original files.
Use the "zero-padding" and the image should work fine.

I've been using CDmage this entire time, and the game still freezes if the file is padded out with zeroes.