LEB

Revision as of 00:23, 4 June 2021 by Glan (talk | contribs) (Filled in more info)

LEB is a custom format used to store room data in Link's Awakening.

This format is still in the process of being reverse engineered and so this page is currently incomplete.

Format

LEB files are in a FixedHash format, with the data for actors stored in the data section and the names section.

The names section contains a list of actors by name, followed by a hyphen (-), followed by a 16-digit hexadecimal number. This also includes some plaintext parameters for some objects, such as the contents of a chest (ObjTreasureBox) or the destination of a loading zone (AreaLevelOpen). Note that these do not define what actors exist, in fact it seems like the actual labels here are meaningless aside from the aforementioned parameters.

All labels in the names section are separated by null bytes. Of note, there are 2 null bytes separating the first and second actor labels, instead of 1.


The data section contains, among other things, blocks of 0x98 bytes, one for each actor in the room. Preceding this is a u64 which specifies the number of bytes the actor data section takes.

Offset Type Description
0x0 u64 Magic. Appears to always be 0x90, but changing it appears to not have any effect.
0x8 u64 Actor key. This value must match the hex value of the corresponding actor label in the names section.
0x10 u32 Names section offset. This stores the offset in the names section for the start of the label that corresponds to this actor.
0x14 u16 Actor ID
0x16 u16 Padding?
0x18 u32 Room ID. The actor loads when entering the specified room and unloads when leaving it.
0x1C u32 X coordinate. One “tile” is 0xC0000 units, so using the lower 2 bytes here is going to generally be pretty insignificant. Hence them usually being 0
0x20 u32 Appears to be Z coordinate (height). However it scales very strangely, maybe not linear?
0x24 u32 Y coordinate. One “tile” is 0xC0000 units, so using the lower 2 bytes here is going to generally be pretty insignificant. Hence them usually being 0
0x28-0x3F Unknown.
0x40-0x7F u32[16] Parameters. This section contains multiple u32's, which appear to be grouped into pairs of [parameter, parameter type].

For any pair, the first 4 bytes make up the value of the parameter. This can be basically anything (will include some known parameters for certain actor types below).

The second 4 bytes indicate what the purpose of the parameter is. There are only 3 observed values so far:

  • 0x0, which indicates the parameter is not used?
  • 0x3, which indicates that the parameter is a direct parameter. e.g., the parameter 0x1 is used to indicate being able to push a block actor.
  • 0x4, which indicates that the parameter is a plaintext parameter specified in the names section. The value in the previous u32 is the offset in the names section for this parameter.

Most actors have "blank " parameters filled in offsets to the 2nd null byte after the first label in the names section; however, this seems to be functionally equivalent to leaving the parameter as 0.

0x80-0x97 Unknown.