recursal/Fanatic-Fandom huggingface dataset:
FF7/Field/Script/Opcodes/F6 BMUSC

* Opcode: **0xF6**
* Short name: **BMUSC**
* Long name: Battle Music

#### Description

Sets the MUSIC that will play when the next BATTLE is issued. As with the MUSIC opcode, the ID represents an offset into the list of music files that have been set by the field file. Hence, provided the field file has the correct music file(s) set, this opcode can be used to set regular or boss battle music for the current field's encounters, or even switched between in the script.
FF7/Field/Script/Opcodes/17 IFSWL

* Opcode: **0x17**
* Short name: **IFSWL**
* Long name: If (Signed Word, Long Jump)

* **const Short** *V*: Unsigned value to compare the retrieved value to, or address from the second bank of the value to retrieve, if *B2* is non-zero.
* **const UByte** *C*: Type of comparison to perform.
* **const UShort** *E*: Amount to jump if the comparison does not hold.

#### Description

This is similar to the IFSW opcode in allowing the comparison value to be negative, but in addition, allows the jump on comparison failure to be longer than 0xFF bytes.
FF7/Field/Script/Opcodes/A0 PC

* Opcode: **0xA0**
* Short name: **PC**
* Long name: Playable Character

#### Description

Defines the entity in which this script resides as a playable character. The entity then becomes associated with the character ID *C*, including the entity's visible object, animation set, and scripts. For example, creating a visible entity and inserting PC(0) into its initialisation script will associate this entity with character ID 0.
FF8/PlaystationMedia

By myst6re

# FF8DISCX.IMG File Format

Almost all of the game files are hidden in the FF8DISCX.IMG (with X=disc number) file.

## Root Files

In the case of a Japanese iso, the file begins directly with a list of file location and size, with the following format:

 4

In the case of a PAL iso, there are 5 unknown sectors (a sector = 2048 bytes in data, 2352 bytes in disk) before this list of files.

**Notes:**

* I do not have the American iso, please fix this article if you can.
* We do not know how many files there are in the list, neither file names!
* Each file in FF8DISCX.IMG are relative to the start of the **iso**!

## Field Files

In the list of root files, the third file is in fact the "FIELD.BIN". This file is LZS compressed, and contains some informations, like the list of field files position and size.

Find the file list is approximate, I am trying to find some bytes: "\x04\x00\x05\x24\x18\x00\xbf\x8f\x14\x00\xb1\x8f\x10\x00\xb0\x8f\x20\x00\xbd\x27\x08\x00\xe0\x03\x00\x00\x00\x00" (size=28), normally, there is the list right after this sequence of bytes, and before the "\x00\x00\x01\x00\x02\x00\x03\x00" (size=8) sequence.

Order of files (sorted by id):

* D000.MCH -> D075.MCH files [id=0 -> id=76]
* Field files (MIM, DAT and LZK) [id=77 -> id=last]

There are three LZSed files for each field: EXAMPLE.MIM, EXAMPLE.DAT and EXAMPLE.LZK (Extension names \*.MIM, \*.DAT and \*.LZK found in PC version, field.fs > mapdata.fs > map1.bak). If you want to convert Playstation fields to PC fields format, this is a concatenation of some PC files.

### First file (\*.MIM)

 4
 8
 12
 438284 (section 3)
 *Varies* (section 4)

### Third file (\*.LZK)

Almost like the chara.one file. The main difference is that the models data are compressed.
FF7/Field/Script/Opcodes/FB MVCAM

* Opcode: **0xFB**
* Short name: **MVCAM**
* Long name: Movie Camera Switch

#### Description

Turns on or off the use of the camera supplied by a movie file, that will be played at a future point in the script. If off, the field camera remains in use. If set to on, the camera defined in the movie file is used, including any movement of the camera to match the movie itself.
FF7/Field/Script/Opcodes/E6 LDPAL

* Opcode: **0xE6**
* Short name: **LDPAL**
* Long name: Load Palette

* **const UByte** *Vram palette id*: Id of palette. All palettes loaded starting from vram\_x = 0, vram\_y = 0x1e0, so this index is starting from vram\_y.
* **const UByte** *Palette array id*: All palette loaded from in special array 0x20 size of each item. But it just index and can be used lo load full 256 colours (it just takes 0x10 slots of array).
* **const UByte** *Size*: Size of palette to copy + 1.

#### Description

Load palette from stored array back to vram.
FF7/Field/Script/Opcodes/35 PTURA

* Opcode: **0x35**
* Short name: **PTURA**
* Long name: Turn to Party Member

* **const UByte** *S*: Speed of turning; the larger the number, the slower the turn.
* **const UByte** *A*: Larger numbers increase the likelihood that the turn will be anticlockwise.

#### Description

Rotates (turns) the field object to face the party member specified by **P** (from 0 to 2), at the speed **S**. The "standard" value for **A** is 2.
FF7/Field/Script/Opcodes/B9 GETAI

* Opcode: **0xB9**
* Short name: **GETAI**
* Long name: Get Entity Triangle ID

#### Description

Fetches the triangle ID on which the object of entity *E* is currently standing on, into bank *B*, address *A*. *E* is an offset into the entity list, not a visible object ID, and therefore includes non-visible entities; retrieving the triangle ID of a non-visible entity results in unusual values being retrieved.
FF7/Field/Script/Opcodes/49 MENU

* Opcode: **0x49**
* Short name: **MENU**
* Long name: Menu

#### Arguments

* **const UByte** *B*: Bank for parameter, or zero if *P* is specified as a literal value.
* **const UByte** *T*: Type of menu, or special event.
* **const UByte** *P*: Parameter to the menu, or address of parameter value, if *B* is non-zero.

#### Description

MENU has two uses. Its primary function is to display a menu or other special screen; these menus range from the character name entry screen, to a shop, and even the staff credit display. The type of display can be found in the first table below.

The other function is to provide a set of special events that would normally be accomplished through a set of opcodes, but are instead coded directly into a MENU call. These events are provided in the second table.

Some types of menu are erroneous or produce erratic behaviour, and were most likely used for testing. As such, they are not listed here.

#### Standard Menu Types

 6
 7
 8
 9
 E

#### Special Event Types

 12
 13

#### Parameters

* Character Name Entry: Parameter indicates the name of the character to edit, and follows the standard Character IDs, as well as 0x64 to indicate the Chocobo naming screen.
FF7/Field/Script/Opcodes/E4 BGCLR

* Opcode: **0xE4**
* Short name: **BGCLR**
* Long name: Background Clear

#### Arguments

* **const UByte** *B*: Bank to retrieve *A*, or zero if *A* is specified as a literal.
* **const UByte** *A*: The ID of the background area to clear, as specified in the background's sprite, or the address to retrieve the value if *B* is non-zero.

#### Description

Hides all portions of background whose sprite specifies that it belongs to the background area given by *A*.
FF7/Field/Script/Opcodes/C0 JUMP

* Opcode: **0xC0**
* Short name: **JUMP**
* Long name: Jump

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve X-coordinate, or zero if specifying *X* as a literal value.
* **const Bit[4]** *B2*: Bank to retrieve Y-coordinate, or zero if specifying *Y* as a literal value.
* **const Bit[4]** *B3*: Bank to retrieve triangle ID, or zero if specifying *Z* as a literal value.
* **const Bit[4]** *B4*: Bank to retrieve jump height, or zero if specifying *H* as a literal value.
* **const Short** *X*: X-coordinate of the target to jump to, or lower byte specifying address if *B1* is non-zero.
* **const Short** *Y*: Y-coordinate of the target to jump to, or lower byte specifying address if *B2* is non-zero.
* **const Short** *I*: Triangle ID of the target to jump to, or lower byte specifying address if *B3* is non-zero.
* **const UShort** *Steps*: Steps in jump. Must be non-zero if a literal value. Alternatively, lower byte specifies address if *B4* is non-zero.

#### Description

Causes the character to jump to the specified point and triangle ID, with the jump curve peaking at a height which is increased by using a larger value for the **H** argument. In addition, the larger the number, the longer the jump will take to complete. A "normal" value is around 0x15, 0x01 is fast and instantaneous; the argument must not be zero or the game will crash. Whilst this is an unsigned two-byte number, a large value (beyond around 0x60) will not only cause a vast jump height, but also cause the screen to scroll erratically (the larger the number, the more erratic).

Main update function go through all entity with JUMP state and if stage is 0 it calculates final Z point according to triangle id. It sets current coords as start coords. The main thing this function does is set B coefficient for later calculation.
It defines as follows:

B = (Z\_final - Z\_start) / steps - steps \* 1.45;

Then it set current step to 0 and stage to 1. On next update other part of function works. It's calculate real position.
First it increment current step number. Then it calculate X and Y. They change linear so nothing interesting here. Then here we go... Z calculation:

Z\_current = - step^2 \* 1.45 + step \* B + Z\_start;

If current substep equal number of steps then we set current triangle to final triangle and set stage to 2. Which finilize routine on next opcode call.

Neither animation nor sound is specified in this opcode. An animation is played by using an animation opcode such as DFANM, and a SOUND played, before the jump.
FF7/Field/FIELD.TDB

## Format for Field.TDB

Cyberman 21:45, 10 Jan 2007 (CST) Field.TDB is an LZS compressed file the first DWORD of which is it's compressed size.

After decompression the file contains the following header

FILED.TDB header
 2
 2
 4
 4

```
typedef struct
{
 uint32 FileSize;
 uint16 ImageCount;
 uint16 PaletteCount;
 uint32 ImageOffset;
 uint32 PaletteOffset;
} TDB_TextureHeader;

```

Images follow they are 32x32x 4 bits (or 512 bytes each) Palettes are next, which are B5G5R5 format, uint16 format. 16 colors per palette. Therefore each palette is 32bytes in length.

Palettes are not selected from this file but from the BSX files for models.
FF7/Battle/Battle Mechanics

This page will be for Battle memory structures. This is consistent with the memory structure of the PC version. PSX may or may not reflect these structures.

## Command Defaults

Each command type has default execution values that can, in some cases, be overridden. These come from a hard-coded structure in the executable.

 1h
 2h

## Queued Actions

When a command is selected either by a player character or an enemy the action is inserted into a priority queue. Up to 64 actions can be queued. On each update loop, the main Queue function will pop off the next action with the lowest priority and execute it in FIFO order within priority bands.

Queue entries have the following structure in memory:

 1
 2
 3
 4
 6

## AI Structure

There is a single block of memory that holds AI information on the current running script. Each Actor "owns" this while their scripts are executing.

## Active Character Data

This is an array that each playable character maintains an instance of.

## Actor Battle Data

Similar to Active Character Data, but more detailed. This data is dependent on who is performing the current action and only one instance of it exists during each action and all stats are relative to the performing actor and current action unless otherwise noted. Addresses 200h and above will change for each target of the action.
Daisy

## Plot

Daisy Williams is Maisy's younger sister and she is a playful girl and she loves to play princess with Kayla (Maisy's younger sister).

## Looks

she wears a blue overalls, yellow shirt with orange stripes, white shoes, and a plastic red headband.

## Trivia

* Her clothes and Maisy’s clothes look the same but their outfits had different colors.
* sometimes, she wears black Mary jade shoes and white socks.
* she was based on Agnes from Despicable Me
FF7/Field/Script/Opcodes/2C BGPDH

* Opcode: **0x2C**
* Short name: **BGPDH**
* Long name: Background Depth

#### Arguments

* **const Bit[4]** *B*: Bank to retrieve value for *D*, or zero if *D* is specified as a literal.
* **const Bit[4]** *0*: Four zero bits.
* **const UByte** *L*: ID number of the layer to manipulate.
* **const Short** *D*: Z-depth of the specified layer, or the address to find *D* if *B* is non-zero.

#### Description

Sets the Z-depth for the extra background layer specified by *L*. This opcode will only set the depth of those extra layers above the standard background and foreground layers (0/1, respectively), and so should be an argument of 2 or greater.
FF7/Battle/Elemental Data

## Elemental Data

There are 16 elements in FF7. They are usually stored as a bitmask, but are instead stored as an index in the case of materia.

 NOTES:
 The battle text (part 26 of the KERNEL.BIN) refers to "Ice" as "Cold" and "Bolt" as "Lightning".
 The names of elements 09h - 0Eh are not ever mentioned in the game. However, they are stored as battle text for the purpose of sensing.
 "Hidden/Ultima" has no name mentioned in the battle text.
 "Hidden/Ultima" is on only a few enemy exclusive attacks including Ultima Weapon's Ultima Beam. Elements 0Ah - 0Eh are considered Physical elements (though not enforced as such) and show up on physical attacks. Non-elemental attacks, such as Bahamuts' Flares, have no elements selected.
FF7/Field/Script/Opcodes/12 JMPB

* Opcode: **0x12**
* Short name: **JMPB**
* Long name: Jump back

#### Description

Jumps backward in the current script a specified amount. The jump begins just before the jump opcode itself and then moves the current byte pointer back the specified number of bytes. In the following example, the SOLID and WAIT lines are repeated indefinitely.

```
SOLID (01)
WAIT (70,00)
JMPF (05)

```

If a jump longer than 0xFF is required, use JMPBL instead.
FF7/Character starting stats

## KERNEL.BIN - Section 4: Initialization data

This section of KERNEL.BIN contains the starting stats for the characters and related game states. On "New Game", this data is copied directly into the Savemap (from offset 0x0054 to 0x0BAF) which is explained in the "Menu" section. This data has the same format as the data explained in that section.
FF7/Field/Palette

After the first length indicator comes another integer, also indicating length. Useless, but it's there.
 Then two bytes; palX, useful for the PS version only (always 0).
 Then two bytes again; palY, useful for the PS version only (always 480).
 Then two bytes; number of colors in the palette (always 256).
 Then two bytes; number of palettes.
 Then the actual palette data.

Each palette entry is a 16-bit color. This is unusual - normally palettes store as high quality data as possible, usually 24/32 bit. However since FF7 only ever runs in 16 bit I guess there isn't much point storing any other kind of data. Actually, the data is 15-bit (1 mask bit, 5-bit Blue, 5-bit Green and 5-bit Red).

 m

Palettes generally contain a number of colors that's a multiple of 256. This is because the palette is split up into 256-color 'pages' internally. So the first color is page 0/color 0. Color 256 is page 1/color 0. Color 628 is page 2/color 116. You'll see why in the background section.
FF7/Field/Script/Opcodes/90 AND2

* Opcode: **0x90**
* Short name: **AND2**
* Long name: Bitwise AND (16-bit)

* **const Bit[4]** *S*: Source bank, or zero if *Oper* is specified as a literal value.
* **const UByte** *Dest*: Address containing an operand of the bitwise AND, and that which receives the result.
* **const UShort** *Oper*: 16-bit operand of the bitwise AND, or address of the second operand, if S is non-zero.

#### Description

Performs a bitwise AND operation between *Dest* and *Oper* and stores the result back into *Dest*.
If the Source Bank is 0 then the *Oper* is the operand to AND with.
If the Source Bank is a 16-bit bank, then the *Oper* is the address in that bank where the operand is.
FF7/Field/Script/Opcodes/28 KAWAI

* Opcode: **0x28**
* Short name: **KAWAI**
* Long name: Character Graphics Opcode (Multibyte sequence)

#### Description

KAWAI is a multipurpose, graphics-related opcode that performs a variety of different operations on visible entity objects, depending on the subop argument. It was named after Final Fantasy VII's Character Programmer, Hiroshi Kawai.

#### Subcodes by Opcode

```
00 EYETX
01 TRNSP
02 AMBNT
06 LIGHT
0A SBOBJ
0D SHINE
FF RESET

```
FF7/Field/Script/Opcodes/A5 XYZI

* Opcode: **0xA5**
* Short name: **XYZI**
* Long name: Place Object

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve *X*, or zero if *X* is specified as a literal value.
* **const Bit[4]** *B2*: Bank to retrieve *Y*, or zero if *Y* is specified as a literal value.
* **const Bit[4]** *B3*: Bank to retrieve *Z*, or zero if *Z* is specified as a literal value.
* **const Bit[4]** *B4*: Bank to retrieve *I*, or zero if *I* is specified as a literal value.
* **const Short** *X*: X-coordinate of the field object, or address of X-coordinate if *B1* is non-zero.
* **const Short** *Y*: Y-coordinate of the field object, or address of Y-coordinate if *B2* is non-zero.
* **const Short** *Z*: Z-coordinate of the field object, or address of Z-coordinate if *B3* is non-zero.
* **const UShort** *I*: ID of the walkmesh triangle, or address of value if *B4* is non-zero.

#### Description

Places the field object for this entity on the walkmesh at the coordinates given. This variant of object placement allows the Z-coordinate of the object to be specified, as well as the ID of the walkmesh triangle on which the object is being placed.
FF7/Field/Script/Opcodes/75 PXYZI

* Opcode: **0x75**
* Short name: **PXYZI**
* Long name: Party Member Get Position

* **const UByte** *I*: Address to store the ID of the walkmesh triangle the party member is standing on.

#### Description

Retrieves the coordinates of the party member specified by *P*. If an invalid party member ID is specified, zeros are stored in the four addresses.
FF7/Field/Script/Opcodes/87 MINUS

* Opcode: **0x87**
* Short name: **MINUS**
* Long name: Subtraction (8-bit)

* **const UByte** *Dest*: The destination variable, to which the operand is subtracted.
* **const UByte** *Oper*: The operand to be subtracted from the destination.

#### Description

Subtracts two numbers and stores the result back into â€œDestâ€. The result of the subtraction wraps around into the range of 0-255.
If the Source Bank is 0 then the â€œOperâ€ is subtracted from the destination value.
If the Source Bank is an 8 bit bank, then the â€œOperâ€ is the address in that bank where the operand is.
FF7:CC/Image Formats

# Image Interlacing

Pixel-Data for all texture formats appears to have the same interlacing mechanism.

The data is divided into 16x8 pixel-chunks, but is arranged in a strange sort of way:

```
ABCD  MNOP  YZ...
EFGH  QRST   ...
IJKL  UVWX   ...

```

Then reading each chunk (in that order), grab rows of 16-pixels (like 8 scanlines, top to bottom of chunk) and plot them like so:

```
  1,  17,  33,  49,     5,  21,  37,  53,     9,  25,  41,  57,    13,  29,  45,  61,
  2,  18,  34,  50,     6,  22,  38,  54,    10,  26,  42,  58,    14,  30,  46,  62,
  3,  19,  35,  51,     7,  23,  39,  55,    11,  27,  43,  59,    15,  31,  47,  63,
  4   20,  36,  52,     8,  24,  40,  56,    12,  28,  44,  60,    16,  32,  48,  64

```

Interlacing is exactly the same, except that the interlacing in columns (numbered above: 1,17,33,49, 5,21,37,53, ... ) is determined by the width of the image.

So,

if width = 512, then you get 4 interlaced columns

if width = 256, then you get 2 interlaced columns

if width = 128, then you get 1 interlaced column

(ie, divide image width by 128)

# Known FF7:CC Image Formats

* [IMG]
* [TEX]
* [GT]

 Note that the Pixel-data is interlaced for all of these formats, as described above.

## IMG Format

Stub

 [IMG] contain multiple palletted Images, perhaps sprites or HUD images.

 The image palettes are 32bit format R8G8B8A8. Palettes for textures are fairly easy to notice because the alpha channel is pretty much all the time fully solid. For sprites it is slightly harder as they use alot of transparency. -- Zande

## TEX Format

Note: the FF7:CC [TEX] format is NOT the same as the FF7 PC TEX format.

 [TEX] Files are Texture images used by Models, frequently found embedded within [ATEL] and [!] files which use them.

```
Header: 48 bytes [upto 0x2f]

   0x00   magic "TEX"
   0x1C   DWORD: size Width
   0x20   DWORD: size height

Pixel Data: 0x30 offset

   (Width * Height) number of bytes, 1 byte per-pixel index (to pallete entry color, below)

Pallete data: (immedietly following Pixel data)

   16 bytes of mostly zeros (don't seem important)
   255 4-byte chunks [RGBA] (per pallete entry)

```

## GT Format

[GT] Files are Chapter End images, dispersed throughout the [ATEL] Event files in-line with when they are displayed during gameplay.

 The "Format-Byte": - for GT files, this is always "4" = 256 colours and 1-BpP.

 For the GT files, the 4th byte in the header tells the colour depth format, if this byte is 3 the palette has 16 colours and 1 nibble per pixel. If the byte has a value of 4, there's 256 colours and 1 byte per pixel -- Zande

```
Header: 16 bytes
   0x00   DWORD: magic "GT"
   0x04   format-byte [see notes]
   0x08   width (pixels)
   0x10   height (pixels)

Pallete Data: start offset = 0x10
   255 [RGBA] 4-byte chunks

Pixel Data: immedietly following Pallete [start offset = 0x410]
   width * height bytes (index to pallete entry)

```
FF7/Field/Script/Opcodes/AE ANIME2

* Opcode: **0xAE**
* Short name: **ANIME2**
* Long name: Animate/Return

* **const UByte** *S*: Speed the animation is played at. Real model animation speed divide by this to calculate real play speed.

#### Description

Similarly to ANIME1, the animation specified by *A* is played at speed *S* for the current entity's field object. However, in contrast, the current script's execution is **not** halted whilst the animation is played.
FF7/Technical/Autoexec.nt

* C:\Winnt\System32\config.nt The system file is not suitable for running MS-DOS and Microsoft Windows applications. Choose 'Close' to terminate the application.
* config.nt The system file is not suitable for running MS-DOS and Microsoft Windows applications. Choose 'Close' to terminate the application.
* C:\Windows\System32\Autoexec.nt The system file is not suitable for running MS-DOS and Microsoft Windows applications. Choose 'Close' to terminate the application.

### Cause

One of following files are damaged or missing:

* autoexec.nt
* config.nt
* command.com

These files are nessesary to run older programs and games, like Final Fantasy VII.

### Solution

Microsoft has support page about this problem that should help you fix this problem.

**Link**: Microsoft Knowledge Base

Back to Technical Problems page
FF7/Field/Script/Opcodes/34 PDIRA

* Opcode: **0x34**
* Short name: **PDIRA**
* Long name: Face Party Member

#### Description

Instantly turns the field object to face the party member specified by **C**. In contrast to PTURA, the turn is not gradual, and the parameter is not a party member ID (from 0 for the first to 2 for the third in the party), but a Character ID (like in MMBud).
If the specified character ID is not in your party, the field object will turn to the main character.
FF7/Field/Script/Opcodes/45 MPu

* Opcode: **0x45**
* Short name: **MPu**
* Long name: MP Up

#### Arguments

* **const UByte** *B*: Bank to retrieve value for increasing, or zero if the amount is specified by a constant in *V*.
* **const UByte** *P*: Party member whose MP will increase (0 to 2).
* **const UShort** *V*: Value to increase MP by, or address to retrieve value from if *B* is non-zero.

#### Description

Increases the MP of the party member specified by *P* by the amount *V*. If *B* is non-zero, then the value to increase by is retrieved from bank *B* and address *V*.
FF7/PSX/Sound/INSTRx.DAT

There are two files of such type: SOUND/INSTR.DAT - Main game sounds (93 instruments)

SOUND/INSTR2.DAT - Voices from ending theme "One Winged Angel" (4 instruments)

These files contain index data for all instruments from INSTRx.ALL.

## Record format

struct InstrumentIndex

{

```
  /* offsets */
  uint32_t attack_offset // offset to attack part of instrument
  uint32_t loop_offset;  // offset to loop part of instrument
  /* ADSR Envelope settings */
  uint8_t attack_rate;   // ADSR: attack rate (0x00-0x7f)
  uint8_t decay_rate;    // ADSR: decay rate (0x00-0x0f)
  uint8_t sustain_level; // ADSR: sustain level (0x00-0x0f)
  uint8_t sustain_rate;  // ADSR: sustain rate (0x00-0x7f)
  uint8_t release_rate;  // ADSR: release rate (0x00-0x1f)
  uint8_t attack_mode;   // ADSR: attack mode
                         //    0x05 - (exponential)
                         //   other - (linear)
  uint8_t sustain_mode;  // ADSR: sustain mode
                         //    0x01 - (linear, increase)
                         //    0x05 - (exponential, increase)
                         //    0x07 - (exponential, decrease)
                         //   other - (linear, decrease)
  uint8_t release_mode;  // ADSR: release mode
                         //    0x07 - (exponential decrease)
                         //   other - (linear decrease)
  uint32_t pitch[12];    // predefined pitch set for instrument

```

};

Each index file takes 4 CDROM sectors, so rest unused data filled with zeroes. Attack and loop offsets isn't real file offsets, it's offsets to instruments in SPU internal memory (all instrument data from INSTRx.ALL files are copied by DMA to SPU memory in one chunk), so to translate INSTR.ALL you need tu subtract 0x0ff0 (not sure about INSTR2.DAT file, haven't investigate that yet). INSTR.DAT file resides in PSX RAM at address 0x80075f30 and when it's needed to load any instrument or to reset pitch for this instrument this table is used.
FF7/Field/Script/Opcodes/9C 2BYTE

* Opcode: **0x9C**
* Short name: **2BYTE**
* Long name: Two Byte Value

* **const Bit[4]** *B2*: Bank to retrieve *L*, or zero if *L* is specified as a literal value.
* **const UByte** *B3*: Bank to retrieve *H*, or zero if *H* is specified as a literal value.
* **const UByte** *D*: Destination address.
* **const UByte** *L*: Low byte, or address to retrieve value if *B2* is non-zero.
* **const UByte** *H*: High byte, or address to retrieve value if *B3* is non-zero.

#### Description

Constructs and stores a two-byte value from two seperate one-byte values. The low and high bytes of the two-byte word may be taken from existing values from memory, or specified as a value (or both).
FF7/Field/Script/Opcodes/A8 MOVE

* Opcode: **0xA8**
* Short name: **MOVE**
* Long name: Move Object

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve X-coordinate, or zero if it is specified as a literal value.
* **const Bit[4]** *B2*: Bank to retrieve Y-coordinate, or zero if it is specified as a literal value.
* **const Short** *X*: X-coordinate, or lower byte specifying an address for the value if *B1* is non-zero.
* **const Short** *Y*: Y-coordinate, or lower byte specifying an address for the value if *B2* is non-zero.

#### Description

Makes the field object, associated with the entity this opcode's script resides in, walk (or move gradually) to the point specified by the coordinates, at the speed previously specified by MSPED. The object's standard walk animation is used, found with animation ID 1 in the field object associated with this entity.
FF7/Field/Script/Opcodes/A7 XYZ

* Opcode: **0xA7**
* Short name: **XYZ**
* Long name: Place Object (No I)

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve *X*, or zero if *X* is specified as a literal value.
* **const Bit[4]** *B2*: Bank to retrieve *Y*, or zero if *Y* is specified as a literal value.
* **const Bit[4]** *B3*: Bank to retrieve *Z*, or zero if *Z* is specified as a literal value.
* **const Bit[4]** *0*: Zero.
* **const Short** *X*: X-coordinate of the field object, or address of X-coordinate if *B1* is non-zero.
* **const Short** *Y*: Y-coordinate of the field object, or address of Y-coordinate if *B2* is non-zero.
* **const Short** *Z*: Z-coordinate of the field object, or address of Z-coordinate if *B3* is non-zero.

#### Description

Similar to XYZI, but does not specify a triangle ID. This lack of triangle ID may cause problems if the field object is set to move from its set position.
FF7/Field/Script/Opcodes/BA ANIM!2

* Opcode: **0xBA**
* Short name: **ANIM!2**
* Long name: Animate/Stay

* **const UByte** *S*: Speed the animation is played at. Higher numbers indicate slower animations.

#### Description

Similarly to ANIME2, plays the animation found at ID *A* in this entity's field object, at the speed marked by *S*. However, in contrast, the field object stays posed in the last frame of the animation played.

The current script's execution is halted whilst the animation is played, and continues when the animation has completed.
FF7/Field/Script/Opcodes/C1 AXYZI

* Opcode: **0xC1**
* Short name: **AXYZI**
* Long name: Entity Get Position

* **const UByte** *A*: Entity ID whose field object will have its position retrieved from.
* **const UByte** *X*: Address to store the X-coordinate of the entity's object.
* **const UByte** *Y*: Address to store the Y-coordinate of the entity's object.
* **const UByte** *Z*: Address to store the Z-coordinate of the entity's object.
* **const UByte** *I*: Address to store the ID of the walkmesh triangle the object is standing on.

#### Description

Retrieves the coordinates of the field object that the entity, whose ID specified in *A*, is associated with. This opcode uses an entity ID, not a field object offset; as such, if an entity ID is given that does not have a field object, this opcode will store zero in each of the four address specified.
FF7/Field/Script/Opcodes/01 REQ

* Opcode: **0x01**
* Short name: **REQ**
* Long name: Request remote execution (asynchronous, non-guaranteed)

* **const Bit[3]** *P*: The priority at which we want to execute the remote script (high 3 bits of byte).
* **const Bit[5]** *F*: The ID of the specific member function of *E* to be executed (low 5 bits of byte).

#### Description

Requests that a remote entity executes one of its member functions at a specified priority. The request is asynchronous and returns immediately without waiting for the remote execution to start or finish. If the specified priority is already busy executing, the request will fail silently.
FF7/Field/Script/Opcodes/E7 CPPAL

* Opcode: **0xE7**
* Short name: **CPPAL**
* Long name: Copy Palette

* **const UByte** *Source palette array id*: Source palette array id to copy data from.
* **const UByte** *Destination palette array id*: Destination palette array id to copy data to.
* **const UByte** *Size*: Size of palette data to copy + 1 (in unsigned short).
FF7/Technical/Hardware rendering

### Symptoms

In Final Fantasy VII Configurator I can't choose *Hardware Acceleration* in *Renderer* section. The test box on the right say's that system failed in *8-bit Paletted Textures* test.

### Cause

This is a very known problem. You probably have some modern graphic card, which Final Fantasy VII doesn't support, and that's why it won't let you select Hardware Acceleration.

### Solution

Eidos provided a patch that changes executable version to 1.02. You can download it from links below:

* English Version
* French Version
* German Version
* Spanish Version

You also should update your graphic drivers to newest ones. Furthermore, Aali's OpenGL Driver fixes more issues on even more recent hardware. Thanks to Aaron for hosting these patches.

Back to Technical Problems page
FF7:CC/Audio Formats

# Known FF7:CC Audio Formats

* [RIFF]
* [SSCF]

## RIFF Format

[RIFF] Audio files are voice acting dialogues.

They are possible to play if extension is renamed to .WAV and have correct codec (Sony's ATRAC3 format).

```
they are in vaild IFF format, it's all the voice acting file thingies. The files are stored in Sony's ATRAC3 format (Minidisk etc.),
if you rename the files to .wav and have an ATRAC3 codec they should play in your prefered mediaplayer (like winamp).  --Zande

```

## SSCF Format

These audio files are also found embedded within many other data files, including [ATEL], [MAGIC] and [!].

They are usually background music audio, but might also be short sound-effect samples.

A windoze program called MarC's HiMD Renderer can convert these audio files. -- aljnx
FF7/Field/Script/Opcodes/33 UC

* Opcode: **0x33**
* Short name: **UC**
* Long name: Character movability

#### Description

Disables or enables the movability of the playable character, and hides arrows and the hand pointer. If switched to off (1), the player cannot move the character using the directional buttons until a corresponding UC (0) is called, at which point the arrows and hand pointer return.
FF7/Field/Script/Opcodes/08 JOIN

* Opcode: **0x08**
* Short name: **JOIN**
* Long name: Party Field Join

#### Description

Causes seperated party characters that have previously been SPLIT onto the field, to be joined back together again; that is, only the party leader becomes visible on the field. This should be called if a previous SPLIT has completed (the party members have finished speaking, or performing their actions, for example). As with SPLIT, the speed of the join is specified, from a scale of 1 (almost instant) to FF (very slow walk), and must be non-zero.

Calling JOIN without having previously SPLIT the characters will cause the party members to appear at the walkmesh origin and attempt to JOIN from there. This is not normally the required behaviour and should be avoided.
FF7/Field/Script/Opcodes/80 SETBYTE

* Opcode: **0x80**
* Short name: **SETBYTE**
* Long name: Byte Set

#### Description

Writes the byte value from the source address, or the value argument itself, into the destination 8-bit bank. If the source bank **S** is zero, the value given by **V** is written directly into the destination address; otherwise, the value is retrieved from the source bank/address **S**/**V**, and then written to the destination bank/address **D**/**A**. If the destination is a 16-bit bank, the high byte of the destination will remain unchanged.
FF7/Field/Script/Opcodes/81 SETWORD

* Opcode: **0x81**
* Short name: **SETWORD**
* Long name: Word Set

#### Description

Writes the word value from the source address, or the value argument itself, into the destination 16-bit bank. If the source bank **S** is zero, the value given by **V** is written directly into the destination bank/address; otherwise, the value is retrieved from the source bank/address **S**/**V**, and then written to the destination bank/address **D**/**A**. If the destination is a 8-bit bank, only the low byte of the source will be written into it.
FF7/Battle/Attack Special Effects

Attacks and Items can have additional Special Effects that take place after Damage Calculation is performed. Several of them take a Modifier that further defines what action to take. If the Effect doesn't take a modifier, the modifier is NULL (FFh). In addition, these effects have specific timings. There are six different timings that will be explained later. Here are the valid values (between 0 - 23h) with examples of some attacks that have these values. If another value is provided it will be ignored. Damage Calculations A0 - A8 are handled using the highlighted effects and defaulting to damage calculation 11h.

NOTE: For these two Effects, if they are not called as part of a Limit Break they will return an index of 0.
 For Effect 0Fh, this means performing "Game Over" and ending the battle in a victory.
 For Effect 13h, the player's characters' battle queues freeze and no PC can perform any action after this was selected. Enemies still attack. The reason for this is unknown.
 For Effects 16h and 17h, only the performer gets the stat boost. The in-game English description of Lunatic High suggests this is not intentional. The statuses are granted by the actual Limit attack. Since Howling Moon only targets the caster this isn't an issue, but additional targets would not get the stat boost.
 For Effect 18h, the game assumes the second attack's animation indexes are of the same scope as the first attack's (e.g. if you call an enemy skill as the follow up for a spell, the game will (attempt) to use a magic animation).

## Timings

As mentioned, the different timings indicate when the effects take place during the process of executing the command:

* **T0:** Takes place immediately before damage calculation occurs. If there is no damage calculation, this will not activate.
* **T1:** Takes place immediately after damage calculation occurs. If there is no damage calculation, this will not activate.
* **T2:** After Command is selected and loaded, but before anything actually happens.
* **T3:** Takes place immediately after damage calculation would occur. Will activate whether there is damage done or not.
* **T4:** Activates as long as the action passes accuracy checks (Doesn't 'Miss').
* **T5:** Action Resolution. After Damage Calculations are done this will be triggered for each active actor.

For effects that have more than one timing, there are more than one functions associated with them.
 ex.
 Effect 05h ends the battle without reward. It has a T2 and a T5 command. The T2 command will check if the battle can be escaped from. If it can it sets the "run modifier" to full. The T5 command will actually set the battle to having been escaped from. If it's possible to escape from the battle, it will.
FF7/Field/Script/Opcodes/DE TURNW

* Opcode: **0xDE**
* Short name: **TURNW**
* Long name: Wait for Turn

#### Description

Halts execution of the current script for a preceding turn to complete. When the object has fully turned, execution continues. This works fine, exept TURN, TURNGEN and TURA is waitable opcode itself, so this is ignored. Perhaps this is deprecated opcode.
FF7/Field/Script/Opcodes/6F SCRLP

* Opcode: **0x6F**
* Short name: **SCRLP**
* Long name: Scroll To Party Member

#### Arguments

* **const UByte** *B*: Bank for the scroll speed, or zero if it is specified as a literal value.
* **const UShort** *S*: Speed of the scroll, in frames, or the address to find the speed if *B* is non-zero.
* **const UByte** *P*: Party ID to scroll to, between 0 and 2.
* **const UByte** *T*: Type of scroll.

#### Description

Similar to SCRLA, except the scroll moves towards the given party member, rather than a particular entity.
FF7/World Map/TXZ

## WM0.TXZ

The following information applies specifically to WM0.TXZ, it is reasonable to assume that the rest of the TXZ files use a similar format, where WM2.TXZ and WM3.TXZ presumably holds equivalent data for the underwater and snowfield maps respectively.

### Compression

TXZ files are compressed using standard LZS compression where the first 4 bytes contain the size of the compressed data.

### TXZ archive format

Uncompressed TXZ files are divided into several different sections, to extract the different sections a header must be parsed at the beginning of the file. The first 4 bytes will tell you how many sections there are. After that follows 4 \* <number of sections> bytes containing offsets into the file for each section. A section can be assumed to end where the next section begins and the last section runs until the end of the file. Offsets do not include the first 4 bytes of the file! Add 4 to get the actual file offset for each section.

## Sections

### WM0.TXZ, section 0

Unknown format, might be a model? Looks like there's atleast one or two textures in there.

### WM0.TXZ, section 1

Texture data for direct VRAM upload, same format as section 2 but contains only a single block.

### WM0.TXZ, section 2

Texture data for the worldmap mesh (see .MAP format), starts with a table of 512 palette/texture identifiers in a format compatible with the PSX GPU, see http://psx.rules.org/gpu.txt for more information.

The following structure can be used to read this data:

```
struct wm_texture
{
	unsigned int clutx:6;
	unsigned int cluty:10;
	unsigned int tx:4;
	unsigned int ty:1;
	unsigned int abr:2;
	unsigned int tp:2;
	unsigned int reserved:7;
};

```

Texture IDs are the same for the PSX and PC version which means that this table maps 1:1 to the table of PC textures which can be found here: FF7/WorldMap\_Module/TextureTable

After this table follows a number of blocks intended for direct VRAM upload, each block has the following structure:

VRAM Block
 2 bytes
 2 bytes
 2 bytes
 2 bytes
 Width \* Height \* 2 bytes

A new block can be assumed to start where the previous one ends until the end of this section is reached.

### WM0.TXZ, section 3

Unknown format, contains more blocks of VRAM data.

### WM0.TXZ, section 4

Contains the script for the overworld map, a copy of the data in wm0.ev?

### WM0.TXZ, section 5-11

These sections contain songs in standard AKAO format. Presumably the different overworld background themes are in there, don't know what else?
FF7/Field/Script/Opcodes/5C DMTRA

* Opcode: **0x5C**
* Short name: **DMTRA**
* Long name: Delete Materia

#### Arguments

* **const Bit[4]** *B1*: Source bank 1, or zero if *T* is set as a constant value.
* **const Bit[4]** *B2*: Source bank 2, or zero if this unit of *AP* is set as a constant value.
* **const Bit[4]** *B3*: Source bank 3, or zero if this unit of *AP* is set as a constant value.
* **const Bit[4]** *B4*: Source bank 4, or zero if this unit of *AP* is set as a constant value.
* **const UByte** *T*: Type of materia to remove, or source address 1.
* **const UByte[3]** *AP*: Amount of AP the deleted materia must have, or source addresses 2, 3 and 4.
* **const UByte** *A*: Amount to delete.

#### Description

Deletes a quantity of materia with the given type and AP.

#### Important Note

This opcode does not appear to function correctly in the PC version of the game. In addition, it is only used once, in the Debug Rooms.
FF7/Field/Script/Opcodes/E3 BGROL2

* Opcode: **0xE3**
* Short name: **BGROL2**
* Long name: Background Roll (Reverse)

#### Arguments

* **const UByte** *B*: Bank to retrieve *A*, or zero if *A* is specified as a literal.
* **const UByte** *A*: The ID of the background area to roll, as specified in the background's sprite.

#### Description

Similar to BGROL, except the roll runs backwards through layers, rather than forwards. Rolling backwards past layer 0 for the area specified results in no background being shown.
FF7/Field/Script/Opcodes/BD ASPED

* Opcode: **0xBD**
* Short name: **ASPED**
* Long name: Animation Speed

#### Arguments

* **const UByte** *B*: Bank to retrieve direction value, or zero if it is specified as a literal value.
* **const UShort** *S*: Speed of animation.

#### Description

Set global model animation speed. Lager the value - faster all animation played by this model.
FF7/Field/Script/Opcodes/72 BTLMD

* Opcode: **0x72**
* Short name: **BTLMD**
* Long name: Battle Mode

#### Description

Sets properties for the battle module. The argument is a bit field with bits that can be ORd together to set multiple battle properties.

#### Bit Tables

All the bytes used by the game are listed here, along with some that are not used but still have an effect on the battle module. The purpose of the bits not listed in the tables is not yet known, but they likely affect the battle module in an as-yet unseen way.

##### First Byte (MSB)

 0x40 (01000000)
 0x20 (00100000)
 0x08 (00001000)
 0x04 (00000100)
 0x02 (00000010)
FF7/Field/Script/Opcodes/86 PLUS2

* Opcode: **0x86**
* Short name: **PLUS2**
* Long name: Addition (16-bit)

* **const UByte** *Dest*: The destination variable, to which the operand is added.
* **const SWord** *Oper*: The operand, added to the destination.

#### Description

Adds two numbers together and stores the result back into â€œDestâ€. The result of the addition wraps around into the 16-bit range.
If the Source Bank is 0 then the â€œOperâ€ is added to the destination value.
If the Source Bank is an 16 bit bank, then the â€œOperâ€ is the address in that bank where the operand is.
FF7/Field/Script/Opcodes/CB IFPRTYQ

* Opcode: **0xCB**
* Short name: **IFPRTYQ**
* Long name: If Party Member

#### Description

Checks whether the character, given as the first argument, is in the current party of three. If so, the script immediately following this opcode and argument list will execute; otherwise, the script pointer is advanced by the second argument and execution continues.
FF7/Field/Script/Opcodes/AD FMOVE

* Opcode: **0xA9**
* Short name: **CMOVE**
* Long name: Move Object (No Animation)

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve X-coordinate, or zero if it is specified as a literal value.
* **const Bit[4]** *B2*: Bank to retrieve Y-coordinate, or zero if it is specified as a literal value.
* **const Short** *X*: X-coordinate, or lower byte specifying an address for the value if *B1* is non-zero.
* **const Short** *Y*: Y-coordinate, or lower byte specifying an address for the value if *B2* is non-zero.

#### Description

Similar to MOVE, but the field object won't play its animation whilst it moves. Field object will be rotated according to movement.
Knight world of Gravigne

The Knight world Gravigne is a world that is allied to the Forge-world of Syvvar.

It was founded by a group of colonists during the Age of Technology. Who, luckily, found Gravigne to be a warm but overall temperate world. Its largest continent, Nouvon. surrounds a large and warm sea, wich keeps the continent surrounding it warm during the coldest winter months. Its climate lends itself particularly well to the cultivation of grapes, wich lead to Gravigne being home to sizeable vineyards. Its other major continent, Toubliée, is far less fortunate. Being located mostly in the colder northern hemisphere of the planet, it is home to Gravigne's larger and more intensive industrial or mining operations.

Like most Knight worlds, Gravigne experienced a major technological regression during the Age of Strife. When the Adeptus Mechanicus rediscovered the world, it had become home to medieval houses feuding with eachother of small plots of land. In exchange for the loyalty of Gravigne, the techpriests of the then young Forge-world of Syvvar, repaired many of the Houses' knights and brought technology back to Gravigne. House Gardesse proved most willing to cooperate with the Techpriests of Syvvar, and were thus supported by Syvvarite troops when Lord Gerald of Gardesse, declared himself lord of Gravigne.

Altough there have been numerous struggles for power between Gardesse's rival houses in the past. This issue has mostly been resolved after the creation of the Lord's council. Upon wich all major houses can expect a seat and an important position within Gardesse's household.

   The Knight Warden known as 'The Lion of Gravigne' is currently fighting on El'lyer in support of the Syvvarites. It is piloted by Lady Laura de Gravigne, who was saved from certain death by Sagos Aventii during the Sacrevoux succession crisis and the law of honour demands she answer his calls to battle. As a member of house Gravigne, she has the right to drink and share the sacred 'Signatrait' wine. Wich she has made a tradition to share with her enemies before battle if possible.
FF7/Field/Script/Opcodes/16 IFSW

* Opcode: **0x16**
* Short name: **IFSW**
* Long name: If (Signed Word)

* **const Short** *V*: Unsigned value to compare the retrieved value to, or address from the second bank of the value to retrieve, if *B2* is non-zero.
* **const UByte** *C*: Type of comparison to perform.
* **const UByte** *E*: Amount to jump if the comparison does not hold.

#### Description

This is similar to the IFUW opcode, but the value compared to may be negative.
FF7/Field/Script/Opcodes/CA PRTYE

* Opcode: **0xCA**
* Short name: **PRTYE**
* Long name: Party Change

#### Description

Changes the current party to the characters specified by each of the three arguments, or leaves the party member blank if the ID is 0xFE. Note that the chocobo entry will crash during battle, and that Young Cloud and Sephiroth occupy the same 'slots' used by Vincent and Cait Sith's character entries.
FF7/Field/Script/Opcodes/B8 GETAXY

* Opcode: **0xB8**
* Short name: **GETAXY**
* Long name: Get Entity XY

#### Description

Fetches the current X- and Y-coordinates of the entity given by *E* into bank *B*, address *A*. *E* is an offset into the entity list, not a visible object ID, and therefore includes non-visible entities; retrieving the co-ordinates of a non-visible entity results in unusual values being retrieved.