Changes
From Final Fantasy Inside
no edit summary
=== Section 1: Dialog and Event ([[User:Halkun|Halkun]], [[User:Laysan|Laysan]] and [[User:Ficedula|Ficedula]]) ===
The First section holds the Field Script logic and Dialog data for that particular field file. The first section of the PSX DAT file (excluding the DAT header) and the data in this section are the same. A recap of the PSX DAT file format is later in this document.
The data in this section also has a header with the following format.
==== Section 1 Header ====
struct FF7SCRIPTHEADER {
u16 unknown1;
char nEntities; // Number of entities
u16 unknown2; // Always less than nEntities; possibly visible entities?
u16 wStringOffset; // Offset to strings
u16 nExtraOffsets; // An optional number of extra offsets... unknown
u16 unknown4[4];
char szCreator[8]; // Field creator (never shown)
char szName[8]; // Field name (never shown)
char szEntities[nEntities][8]; // Field entity names
u32 dwExtraOffsets[nExtraOffsets]; // Said extra offsets... unknown
u16 vEntityScripts[nEntities][32]; // Entity script entry points, or more
// explicitly, subroutine offsets
};
==== Event Script Subsection ====
Here we have all of the pointers tables, one for each section. Pointers are 2 bytes length. Each table has a length of 64 bytes, which means a section can have 32 scripts max. Each pointer refers to the first command of the current script. The section number N begins at the offset header_length+N*64. Note: the only way to retrieve the length of a script is to subtract the position of the next script to the position of the current script.
==== Dialog Subsection ====
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, so you can deduct the length of the table: number_of_dialogs*2. After these 2 bytes we have the pointers for each dialog. Be aware that the pointers are relative to the table, which means you must add the position of the table to each pointer in order to find the right position of the dialog. The dialogs begin right after the table, and the code 255 means the end of the dialog. Note: some hidden dialogs are not referenced in the table!
The First section holds the Field Script logic and Dialog data for that particular field file. The first section of the PSX DAT file (excluding the DAT header) and the data in this section are the same. A recap of the PSX DAT file format is later in this document.
The data in this section also has a header with the following format.
==== Section 1 Header ====
struct FF7SCRIPTHEADER {
u16 unknown1;
char nEntities; // Number of entities
u16 unknown2; // Always less than nEntities; possibly visible entities?
u16 wStringOffset; // Offset to strings
u16 nExtraOffsets; // An optional number of extra offsets... unknown
u16 unknown4[4];
char szCreator[8]; // Field creator (never shown)
char szName[8]; // Field name (never shown)
char szEntities[nEntities][8]; // Field entity names
u32 dwExtraOffsets[nExtraOffsets]; // Said extra offsets... unknown
u16 vEntityScripts[nEntities][32]; // Entity script entry points, or more
// explicitly, subroutine offsets
};
==== Event Script Subsection ====
Here we have all of the pointers tables, one for each section. Pointers are 2 bytes length. Each table has a length of 64 bytes, which means a section can have 32 scripts max. Each pointer refers to the first command of the current script. The section number N begins at the offset header_length+N*64. Note: the only way to retrieve the length of a script is to subtract the position of the next script to the position of the current script.
==== Dialog Subsection ====
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, so you can deduct the length of the table: number_of_dialogs*2. After these 2 bytes we have the pointers for each dialog. Be aware that the pointers are relative to the table, which means you must add the position of the table to each pointer in order to find the right position of the dialog. The dialogs begin right after the table, and the code 255 means the end of the dialog. Note: some hidden dialogs are not referenced in the table!