Author Topic: FF7's .BIN Format Spec  (Read 13424 times)

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
FF7's .BIN Format Spec
« on: 2003-05-09 00:11:16 »
Hi guys, maybe you already know that but if you need infos about the specs of FF7's .BIN files i can help. Actually i found 2 types of .BIN.
One is used by most of them. Files like WINDOW.BIN, KERNEL.BIN or CO.BIN (those files are in both pc and psx version). The other format in used especialy by SCENE.BIN in the BATTLE forder (in both pc and psx version :P). Seems that this last file contain most if not all of the in-battle text.

_Ombra_

Cyberman

  • *
  • Posts: 1572
    • View Profile
FF7's .BIN Format Spec
« Reply #1 on: 2003-05-10 01:32:47 »
SCENE.BIN has all the combat 'scenes' in the game as for decoding it well I believe they've gotten a lot farther than I have. I know Fice has Zangan that can decode and view a scene from the .bin file.

I don't know if the PSX version and the PC version are the same for the SCENE.BIN file, The SaiNt knows more about this. Right now I'm trying to decipher the script and background information myself.  The other thing is deciphering the combat models, I've not been able to do that but I think I have some information that will help now. I can only hope it's THAT simple ;)

Cyb

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
FF7's .BIN Format Spec
« Reply #2 on: 2003-05-12 11:39:08 »
Quote
I know Fice has Zangan that can decode and view a scene from the .bin file.

Are you sure ? I thought that battle locations are stored in the battle.lgp (at least 3d models of the scenes). Or do you have different battle-scene-data in mind ?

And the combat models have been decyphered (for PC). And i think that Phaeron knows them on PSX.

Cyberman

  • *
  • Posts: 1572
    • View Profile
FF7's .BIN Format Spec
« Reply #3 on: 2003-05-12 14:10:18 »
On the PSX SCENE.BIN has ALL the battle scenes scripted and unscripted ones inclusive.

All the other files are too small..
Phaeron not seen him hmmmmm. I suppose he does.
I've been begging the information from Snailrush for the backgrounds but I think he's a bit busy. It's ok though I've got a fair more done than I expected with the software I have been writing.  TIM and compressed TIM files are really easy. The compressed proprietary formats are a bit more callenging.  At least I have code that decompresses LZS information fast.

I know what the SCENE.BIN file and some of the format information but not enough to make that knowledge useful.  :)

Cyb

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
FF7's .BIN Format Spec
« Reply #4 on: 2003-05-13 11:26:46 »
I was not able to decrypt TIM files correctly. FF7 pc TEX's were easy but FF8 TIM's are harder for me ... did you written some format info ? I'd be glad to see it, so i could add it to biturn.

mav

  • *
  • Posts: 239
  • The Sauce team
    • View Profile
FF7's .BIN Format Spec
« Reply #5 on: 2003-07-07 19:11:24 »
For those who don't know: inside scene.bin you can find many files, that are actually compressed with GZIP. If you try to decompress them, in some of them you can find in-battle texts!

Thanks to Ombra for this info ;).

Fremen^SF

  • *
  • Posts: 15
    • View Profile
    • http://www.planet-shitfliez.org/
FF7's .BIN Format Spec
« Reply #6 on: 2003-09-30 06:29:37 »
At first please excuse me for my english mistakes. :)

I was looking for informations in order to find where were located monster's specifications (HP, MP, strength, ...). And I found them with your help. Thus I want to thank you for sharing your knowledge on this board.
My project was to write a command line program to allow me to modify monster's specifications in FF7 PC and PSX, and I finished my first "quite working" version today. Hence I thought that the few informations I've found about the SCENE.BIN file might be usefull to someone.

I uploaded a PDF file there.

About my project, if it interests someone, I can upload it and explain to use it.
Shorty, it reads data I've "understood" in SCENE.BIN file, generates a text file you can modify (an example is there) and creates a new SCENE.BIN.

At last, thanks again to all members of this board, your work is very interesting and I hope you'll continue for a long time.

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
FF7's .BIN Format Spec
« Reply #7 on: 2003-09-30 16:46:28 »
@Fremen^SF:
You did a real nice job. I first discovered the scene.bin format (how the files where stored) and Maver discovered some of the specs. You put a lot of effort, i saw the PDF and you did a great job. Thanks

The Skillster

  • *
  • Posts: 2284
  • Loving every Final Fantasy
    • View Profile
FF7's .BIN Format Spec
« Reply #8 on: 2003-09-30 18:17:38 »
looks interesting
maybe terrence and that other girl would like to see this

Fremen^SF

  • *
  • Posts: 15
    • View Profile
    • http://www.planet-shitfliez.org/
FF7's .BIN Format Spec
« Reply #9 on: 2003-10-01 23:28:43 »
I'm sorry _Ombra_, I didn't see (in this board) that Maver and you have already found some of the specs of SCENE.BIN. So if you agree, I'll add your names in my PDF. I don't want this work to be said as plagiarism ;)

I see it could be useful for anyone, so I'll continue to post there if I find other specifications of SCENE.BIN.
_Ombra_, I would be very grateful if you had any link to give me about the specifications that Maver discovered. I didn't find them in this forum. (With the Search tool, I didn't find any post of Maver). It will allow me not to have to discover again things already discovered ;)

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
FF7's .BIN Format Spec
« Reply #10 on: 2003-10-02 14:05:54 »
@Fremen^SF: don't worry, you don't need to put our names... btw you discovered everything by yourself :P. I read your document and you already figured out everything that Maver had, plus a lot of other things :P

The Skillster

  • *
  • Posts: 2284
  • Loving every Final Fantasy
    • View Profile
FF7's .BIN Format Spec
« Reply #11 on: 2003-10-02 16:29:35 »
who was maver btw?

Fremen^SF

  • *
  • Posts: 15
    • View Profile
    • http://www.planet-shitfliez.org/
FF7's .BIN Format Spec
« Reply #12 on: 2003-10-02 18:23:13 »
_Ombra_ : Ok thank you for your answer. But if a friend and me finish the editor we are working on, I hope you'll let me put your name in the credits ! ;) If I didn't know that scene.bin was gziped, I wouldn't find anything.

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
FF7's .BIN Format Spec
« Reply #13 on: 2003-10-02 22:11:11 »
@Fremen^SF: It's no problem for me ;) just put Maver's name too, he deserve it.

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
FF7's .BIN Format Spec
« Reply #14 on: 2003-10-04 10:41:40 »
wow i could add this info to mine Leviathan, monster info would be more complete with it ... i'll credit you all ofcourse :)

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
FF7's .BIN Format Spec
« Reply #15 on: 2003-10-04 20:39:54 »
Of course Mirex, i talked to you a while ago about that, remember ??  :wink:

mav

  • *
  • Posts: 239
  • The Sauce team
    • View Profile
FF7's .BIN Format Spec
« Reply #16 on: 2003-10-05 09:59:39 »
Hiya guys! It was a while since I've been here, and I see some great work. Freemen: I'm suprised you've got so far, conratulations! I worked on scene.bin format too, but I've only got locations of basic specs like HP, MP, Level, AP, Gil and monster attacks ;). And I wrote program to extract this data from the file. Now with your research I can make far more superior program, if you that is :).

BTW: Freemen, I have some info about sections that you don't know (these 84 and 12 unknown bytes). I you want to talk, my ICQ is 286575676 (im always invisible ;) )

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
FF7's .BIN Format Spec
« Reply #17 on: 2003-10-06 11:30:30 »
Ombra: i didnt, no worries

Fremen^SF

  • *
  • Posts: 15
    • View Profile
    • http://www.planet-shitfliez.org/
FF7's .BIN Format Spec
« Reply #18 on: 2003-10-06 19:54:09 »
Quote from: mirex
wow i could add this info to mine Leviathan, monster info would be more complete with it ... i'll credit you all ofcourse :)


Some friends and me are continuing working on scene.bin specifications. We already have found more specifications.
We found each battle scenes (coordinates of each monster, ID number of each monster, ...), special attack texts and in the end of scene.bin, there are something like scripts we are trying to understand.
So maybe could you wait until we release the whole specifications of scene.bin, with source code examples. Of course you can do as you want. :)

If someone wants to see what we found in SCENE.BIN, there's a new version of "my scenestats.txt" you can find there (5 MB). For each "file*" contained in SCENE.BIN, you'll find :
- ID of the monsters
- 2 tables (battleUnknown and battleUnknown2) we are working on. Maybe are they camera coordinates ?
- Battle scenes descriptions (up to 4 battle scenes in each file, and up to 6 monsters in each battle scene).
- Monsters description (name, level, luck, ...) with their actionID and actionTextID (they have something to do with special attacks)
- After monster description, there is an "UnknownStructure" we are trying to understand the meaning. (Any idea ? ^^)
- After there are the special attacks names followed by another "unknown structure"
- In the end of scene.bin, we have found scripts. We have written them in hex and when the program finds strings in them, it displays them between "[[[" "]]]".


Hence we're trying to understand battle scripts syntax, and to find the meaning of remaining "unkwnown structures". If someone has got any idea, they would be welcomed :)


M4v3R : Thank you for your answer. I'll add your ICQ in my contact list, and I will contact you soon.
Oh, please note something : I'm not "Freemen" but "Fremen", like in Frank Herbert's Dune ;)

mav

  • *
  • Posts: 239
  • The Sauce team
    • View Profile
FF7's .BIN Format Spec
« Reply #19 on: 2003-10-06 20:12:16 »
Great job again Fremen! So, I'll put here my file too. It's everything I can find in scene.bin about monsters: Specs + Attacks. It's here.

_Ombra_

  • *
  • Posts: 110
    • View Profile
    • http://www.sadnescity.it
FF7's .BIN Format Spec
« Reply #20 on: 2003-10-06 20:31:12 »
@Fremen^SF: You got mail ;)

Fremen^SF

  • *
  • Posts: 15
    • View Profile
    • http://www.planet-shitfliez.org/
FF7's .BIN Format Spec
« Reply #21 on: 2003-10-06 23:29:41 »
M4v3R : I only understand now that M4v3R = Maver  :lol:
I see you made a very great piece of work. Thank you to put online those informations. I see we have found the same things about monsters (although you find them before me), but I don't understand your lines about "Elements". Maybe is it something I didn't find, but for me elements are small values. For example, "3" means "Earth", "7" means "Wind" and "6" means "Water" (the data containing elements informations follow "Magic Defence" value in each file).

So I want to ask you what are the elements you often call "E3 - R3", "E4 - R5" ? Has it something to do with elements ?

Again, thank you all for your nice help, _Ombra_ for your mail and M4v3R for your support.

mav

  • *
  • Posts: 239
  • The Sauce team
    • View Profile
FF7's .BIN Format Spec
« Reply #22 on: 2003-10-07 11:04:50 »
E3 means Element three (from table that you've created), and R2 is Rate (200%, -100%, 0% etc) again from your table :). I created new version of doc with all elements in human readable format. It's here. But there are some elements that I don't now what they mean, like 0x20. Do you have an idea what they are?

Fremen^SF

  • *
  • Posts: 15
    • View Profile
    • http://www.planet-shitfliez.org/
FF7's .BIN Format Spec
« Reply #23 on: 2003-10-08 01:50:32 »
Ok thanks for Element and Rate, I wasn't hard to understand, but I prefer human readable format ;)

In fact, I found special values too, I've put them in my nutshell (see bellow) but, like you, I don't now what they mean.

Element 20h | Absorb (06h) : Ghost, Ghost Ship, Dragon Zombie, Zenene, Cripshay, Vargid Police
Element 26h | Weakness (02h) : 3rd Soldier, Corvette
Element 22h | Weakness (02h) : Palmer

Those are the only exceptions I found in my version, and they seem to be the same in your version. Maybe did I forget one or two.
I tried to add elements 20h, 22h, 26h with 06h/02h for test purposes, but I didn't find changes during battle. Element 20h/06h seems to concern Undead, but I don't know what those values can change.

Marco

  • *
  • Posts: 26
    • View Profile
don't know
« Reply #24 on: 2004-01-29 13:56:24 »
if this is useful to anyone, but this can extract the scene.bin files (I hope):

// Warning: rush work

#include <stdio.h>
#include <zlib.h>

char* buff = new char[7808];
char* buff2 = new char[8192];
int* FileOffsets = new int[16];
FILE* rf;
FILE* bd;
int fnum = 1;

int ProcFiles(int* i)
{
   *i *= 4;
   for(int j = 1; j<17; j++)
   {
      i++;
      if (*i == 0xFFFFFFFF)
         return j;
      *i *= 4;
   }
   return 16;
}

void BlockProc(int& i, int dec)
{
   while (i < dec)
      i += 0x2000;
   i -= dec;
}

void ExtractBlock()
{
   char fname[64];
   fread(FileOffsets, 4, 16, rf);
   int fsize;
   int nFiles = ProcFiles(FileOffsets);
   fwrite(&nFiles, 1, 1, bd);
   nFiles -= 1;
   int BlockSize = 0x2000 - 0x40;

   for (int i = 0; i<nFiles; i++)
   {
      fsize = FileOffsets[i+1] - FileOffsets;
      BlockProc(BlockSize, fsize);
      fread(buff2, fsize, 1, rf);
      FILE* of = fopen("tmp.dat", "w+b");
      fwrite(buff2, fsize, 1, of);
      fclose(of);
      gzFile gzip = gzopen("tmp.dat", "r+b");
      gzread(gzip, buff, 7808);
      sprintf(fname, "%d.txt", fnum);
      of = fopen(fname, "w+b");
      fwrite(buff, 7808, 1, of);
      fclose(of);
      fnum++;
      gzclose(gzip);
   }

   fread(buff2, BlockSize, 1, rf);
   FILE* of = fopen("tmp.dat", "w+b");
   fwrite(buff2, BlockSize, 1, of);
   fclose(of);
   gzFile gzip = gzopen("tmp.dat", "r+b");
   gzread(gzip, buff, 7808);
   sprintf(fname, "%d.txt", fnum);
   of = fopen(fname, "w+b");
   fwrite(buff, 7808, 1, of);
   fclose(of);
   fnum++;
   gzclose(gzip);
}

void main()
{
   rf = fopen("scene.bin", "r+b");
   bd = fopen("blockdat.dat", "w+b");

   while (fnum < 254) //unsure here
      ExtractBlock();

   fclose(rf);
   fclose(bd);
   delete[] buff;
   delete[] buff2;
   delete[] FileOffsets;
}

The blockdat.bin will be used when reconstructing the file