Miscellaneous Forums > Scripting and Reverse Engineering

[FF7 PSX] What should be removed after recompressing the BATTLE.X file?

(1/3) > >>

Raziel80:
When I use gzip to recompress (BATTLE.X) file after editing, it turns out 7 bytes larger than the original file and that's after I reinsert the 8 byte header. What bytes need to be removed after recompressing the BATTLE.X file? (FF7 PSX PAL English SCES-00867)
SymphoniC said that this is because: "compression utilities by default add a time stamp when compressing"

--- Quote ---I guess most compression utilities by default add in the filename and a time stamp when compressing and stuff like that.
--- End quote ---

It looks like something has been added to the beginning of the file.

original BATTLE.X looks like this: (first 0x28 bytes for comparison)

--- Code: ---Offset      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F

00000000   C0 38 05 00 D8 41 07 00  1F 8B 08 00 00 00 00 00   А8  ШA   ‹     
00000010   00 00 C4 BD 0D 7C 5C 55  99 3F FE CC 9D 9B 64 92     ДЅ |\U™?юМќ›d’
00000020   A6 ED 4D 3A 2D 53 A8 74                            ¦нM:-SЁt
--- End code ---

after recompressing and reinserting the 8 byte header BATTLE.X looks like this

--- Code: ---Offset      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F

00000000   C0 38 05 00 D8 41 07 00  1F 8B 08 08 9B 11 A9 60   А8  ШA   ‹  › ©`
00000010   00 03 42 41 54 54 4C 45  00 C4 BD 0D 7C 5C 55 99     BATTLE ДЅ |\U™
00000020   3F FE CC 9D 9B 64 92 A6                            ?юМќ›d’¦
--- End code ---

So, I deleted in the edited BATTLE.X 7 bytes: 03 42 41 54 54 4C 45 at offset 0x11. (this means the word BATTLE, the gzip tool may have added the filename)
Then I changed 1F 8B 08 08 9B 11 A9 60 from offset 0x08 to 1F 8B 08 00 00 00 00 00. (don’t know, because there’s something wrong with that)
Did I do everything right?

Additional question. What tools are exist for working with BIN, BIN-GZIP, LZS archives, to decompress/recompress?

MysticLord:
https://github.com/cebix/ff7tools
^Tools for working with FF7 archives, though you'll need to understand how to use the command prompt and how to install the dependencies (Python 2.7 and a couple other things).

Raziel80:

--- Quote from: MysticLord on 2021-05-23 22:58:06 ---https://github.com/cebix/ff7tools
^Tools for working with FF7 archives, though you'll need to understand how to use the command prompt and how to install the dependencies (Python 2.7 and a couple other things).

--- End quote ---
I installed Python 2.7.16, launched Command Prompt (launched cmd.exe on win xp 32 bit) and went to the folder where BATTLE.X is located along the path F: \ games \ FF7 \ zQhimm-FF7 \ ff7tools-master \ ff7.
What to do next? Need step by step instructions.
Do I need to do the following steps as in the post below?

--- Quote ---The X format is a simple gzip file containing overlay code and with an 8 byte header. The first 4 bytes are used for decompression size, the last 4 indicate the decompression size+bss segment (which is an area used for zero-initialized values, so it's just a bunch of zeroes). Cut those 8 bytes, rename .x to .gz and decompress. When recompressing add again those 8 bytes using identical values and it will work.
--- End quote ---

MysticLord:
I assume so. Make sure you back up your files.

Ask NFITC1 if you run into problems.

Raziel80:
Answers to my questions.
To decompress files with https://github.com/cebix/ff7tools need to enter command in the command prompt: python unbingz KERNEL.BIN.
But these tools work with KERNEL.BIN file, they don't work with BATTLE.gz file. I do not see a tool or command that can recompress the KERNEL.BIN back.

ff7_gzip tools can decompress/recompress BATTLE.gz file. Command to decompress BATTLE.gz: gunzip BATTLE.gz. Command to recompress BATTLE file: gzip BATTLE or gzip -n BATTLE.
The -n switch stops gzip inserting the file's name and compression timestamp into the archive.

Navigation

[0] Message Index

[#] Next page

Go to full version