WLDTEX.TM2

From Final Fantasy Hacktics
Jump to: navigation, search

Notice: Values used to represent data in this doc are:

  • byte: 8 bit unsigned integer
  • ushort: 16 bit unsigned integer
  • uint: 32 bit unsigned integer

WLDTEX.TM2 is an archive containing pieces of raw graphics to be drawn on the PSX VRAM.

Notice: PSX VRAM is treated as a 1024x512, two bytes per pixel raw image.

Each piece of graphics is organized inside a GraphicStructure. A GraphicStructureList is a list of GraphicStructure.

The WLDTEX.TM2 archive structure can be described like this:


WLDTEX.TM2 "ARCHIVE" FORMAT

sizeof(GraphicStructureList) bytes GraphicStructureList1
sizeof(GraphicStructureList) bytes GraphicStructureList2
. .
. .
. .
sizeof(GraphicStructureList) bytes GraphicStructureListN


Each GraphicStructureList is 2048 (0x800) bytes in size. So, N=sizeInBytes(WLDTEX.TM2)/0x800.


GRAPHICSTRUCTURELIST FORMAT

ushort Number of GraphicStructures (for example K) contained in this list
ushort Unknown (always 0, maybe Number of GraphicStructures is an uint)
sizeof(GraphicStructure1) bytes GraphicStructure1
sizeof(GraphicStructure1) bytes GraphicStructure2
. .
. .
. .
sizeof(GraphicStructure1) bytes GraphicStructureK


GRAPHICSTRUCTURE FORMAT

ushort x-axis on the psx vram (x)
ushort y-axis on the psx vram (y)
ushort width of the current GraphicStructure's piece of raw graphics (w)
ushort height of the current GraphicStructure's piece of raw graphics (h)
w*h*bytesPerPixel bytes current GraphicStructure's piece of raw graphics

Notice: Sometime, the last GraphicStructure of each GraphicStructureList has a piece of raw graphics bigger than w*h*bytesPerPixel bytes (probably to reach the 2048 bytes size). I extracted all graphics ignoring these bytes, it looks like they are not necessary.

Reference [1]