H
halkun
Guest
Here you guys go I hope it's useful, it might be wrong....
Code: [Select]
Code: [Select]
Code:
Halkun's script doo-bob with lotsa help from lasyan3 and FIce.The script on FF7 is exactly the same between the PSX and PC versions. Theheaders are the only thing that different. They just tell you how tofind the data, and once that is found, the are exatly the same. Here's howyou get to the script in both the PC and PSX versions. Then the last partis the generic scripting accessor and how to universally extarct thescript from both versions.THE PC VERSION:The scripts are found in the files within flevel.lgp. For those who knowhow to access data in the field files, it's the first block...for those who don't, it's easy. After decompressing the field file you haveto find the first block, to quote fice's doc...-----The first two bytes of each (decompressed) field file are blank (zero).The next four bytes is an integer indicating how many sections are present inthe file.Then a number of 4-byte integers follow, giving the starting offset for eachsection.All field files should contain 9 sections; it's what FF7 expects.So, normally you'll find:00 Blank 2 bytes0009 NumSections 4 bytes???? Section 1 location 4 bytes???? Section 2 location 4 bytesetc. etc. etc.-------------------The jump to the first section will give you a 4 byte number. I think this ishow long the section is, I'm really not to sure, after that is the beginning ofthe script section....THE PSX VERSION: (from lasyan3)The PSX script is contained in the DAT file, it is compressed with LZScompression. After it's decompressed, here is the header format for that..First, we have 28 unused bytes (in fact, they are used by the PSX, it's a listof 7 2-bytes values which refer to a place in the RAM). So each time you'llfind a value which is an adress in the file, you'll have to add 28 to it in order to find the right position in the file (or else you can simply remove the first 28 bytes of the file).Note: the first byte in the header is byte 0.------------------------------------halkun: THE REST OF THE SCRIPT FORMAT IS EXACTLY THE SAME The rule of thumb is, if you want to access the PSX version of the script,start at an offset of +0x1c. If you want to access the PC version, start atan offset of +2e------------------------------------byte 00 : unknownbyte 01 : number of sectionsbyte 02 : unknownbyte 03 & 04 : adress of the pointer's table for the dialogsbyte 05 : number of data areasbyte 06 to 14 : unknown byte 15 to 15+number of unknown_names*8-1 : unknown names (8 bytes each)byte 15+number of unknown_names*8 to 15+(number of unknown_names+number of sections)*8-1 : name of each section (8 bytes each)byte 15+(number of unknown_names+number of sections)*8 to 15+(number of unknown_names+number of sections)*8+number of data areas*4-1: dataareas pointers (4 bytes each) length of the header : 15 + (number of unknown_names+number of sections)*8+number of data areas*4********************EVENTS PART********************Here we have all of the pointers tables, one for each section. Pointers are 2bytes length, like all of the pointers we can find in a DAT file. Each tablehas a length of 64 bytes, which means a section can have 32 scripts max. Eachpointer refers to the first command of the current script. The section numberN begins at the offset header_length+N*64. Note: the only way to retrieve thelength of a script is to substract the position of the next script to theposition of the current script.********************DIALOGS PART********************Right after the last script of the last section, we find the pointer's table of the dialogs. The first 2 bytes show the number of dialogs in the file, soyou can deduct the length of the table: number_of_dialogs*2. After these 2bytes we have the pointers for each dialog. Be aware that the pointers arerelative to the table, which means you must add the position of the table toeach pointer in order to find the right position of the dialog. The dialogsbegin right after the table, and the code 255 means the end of the dialog.Note: some <<hidden>> dialogs are not referenced in the table!********************END PART********************