Anonymous

Changes

From Final Fantasy Inside

FF7/Battle and growth data

2,857 bytes added, 21:57, 15 November 2012
Scene.bin Look-up file
A basic disassembly of the characters' scripts can be found [http://forums.qhimm.com/index.php?topic=7928.msg97889#msg97889 here]
==== Scene.bin Look-up file Table ====
As you may know, In order to understand the purpose of this table we must understand the structure of the compressed and packed [[FF7/Battle/Battle_scenes|scene.bin]] file . It is divided into banks or sections. There are 33 total sections, and each one is 8192 longblocks of 8K in size. Each section contains 5 - 16 GZipped files (scenes), based on their length. Since each section of scene.bin must be 8192 these blocks begins with an array of pointers that point to a compressed array of bytes, altering that contain a single scene may cause it to file. There can be necessary to place it between 1 and 16 inclusive scenes in the next sectioneach of these blocks. This look-up table contains data about the starting scene in each section:
00 0C 12 19 21 27 2D There is no direct indication of how many scenes are in each block other than searching through all the headers to find the desired one.It would take a noticeable amount of time to search through each block when the greater valued formations are requested.The working solution to this is a look up table that would tell the scene retrieval method which block contains the desired scene. Enter the Scene Look-Up Table (hereafter abbreviated SLUT because I can :) ).
Which meansWhen a specific formation ID is requested, the Scene File that contains it can be determined like this: Scene File = ( Formation ID AND FFFC ) >> 2So, for example, we know that formation 134h would be in scene 4Dh.
Section 1 contains scenes 0x00 - 0x0B = 12 files Section 2 contains scenes 0x0C - 0x11 = 6 files Section 3 contains scenes 0x12 - 0x18 = 7 files Without searching through all the blocks as noted above, this table serves to indicate what the first scene is in each block of 8K... and so onWhen a formation is to be loaded, the containing scene file is retrieved as mentioned above then the SLUT is looped through to find the lowest value greater than the requested scene then uses the value BEFORE that.
Every Example Unmodded SLUT: 00 0C 12 19 21 27 2D 35 3D 49 51 5A ...etc Desired scene is 4D. 51 is first in that list greater than 4D. Value to the left of that is used (49). Then we know that the 10th block in the scene.bin contains the scene and formation we're looking for. The rest of the details of what happens next don't matter. This is all that involves the SLUT. This needs to be checked/updated each time you modify the scene.bin is compressed and repacked. If not it can lead to errors and out-of-place formations being used. As an example, if a modder changes the one of the scenes in the first block it may not be able to fit together in an 8K block of compressed space with all its original "brothers." The last scene in this block is then kicked out of that block and into the next. Now each scene in the next block is off by one file you must also keep this table updated or you. This will domino onward displacing scene after scene until a block with enough padding can absorb a new scene without going over the 8K limit. So if formation 31h is requested it will see that formation is part of scene 0Ch which is the first scene of block three. But since one of the scenes from block 1 became the first scene in block 2, the game will load the second formation in the first scene which won't match the one we'll end with VERY random encounters re really looking for. The solution is to change the second byte in the SLUT to 0Bh which will correctly indicate that the desired scene is actually the second scene of block two. Also consider if scene 0Bh were requested. The scene retrieval mentioned above leads the game to conclude that scene 0Bh is in the first block. However, when it tries to loop through the pointers in the block, it will find a null pointer. Then an error beyond your imagination will occur: the game will crash!! D: (wrong battles in wrong placesnot verified, but probably around 0x5D116BBoth [[http://forums. You can use qhimm.com/index.php?topic=7186.0 Hojo]] and [[http://forums.qhimm.com/index.php?topic=71278481.0 SceneFixProud Clod]] programwill examine this SLUT automatically and make changes accordingly. The moral of the above story is use one of these programs when altering the scene.bin and let them take action accordingly on the KERNEL.BIN.  Bonus Info: Since there are only 64 bytes allotted to this table, there must be no more than 64 blocks in a scene.bin file which'll update the table for youindirectly limits its size to 64 * 8K or 512K.
==== Magic Order ====
Anonymous user