LEB: Difference between revisions
(More info) |
|||
Line 20: | Line 20: | ||
<code>ffff ffff</code> | <code>ffff ffff</code> | ||
=== Entries Section === | ===Entries Section=== | ||
There are 6 entries in most LEB files. | There are 6 entries in most LEB files. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 54: | Line 54: | ||
The Name Hashes of each should not be touched. The purpose of the DataOffsets is still unknown. | The Name Hashes of each should not be touched. The purpose of the DataOffsets is still unknown. | ||
=== Data Section === | ===Data Section=== | ||
Much of the data section is still unknown. | Much of the data section is still unknown. | ||
Line 63: | Line 63: | ||
Where the last 4 bytes store the offset of each actor's data block in the actor data section. | Where the last 4 bytes store the offset of each actor's data block in the actor data section. | ||
==== Actor Data Block ==== | ====Actor Data Block==== | ||
This section starts is preceded by a u64 which specifies the number of bytes the actor data section takes. The section contains blocks of | This section starts is preceded by a u64 which specifies the number of bytes the actor data section takes. The section contains blocks of data for each actor in the room. Usually these are 0x98 bytes but for some actors are longer, and in the following format: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ | ||
Line 73: | Line 73: | ||
|0x0 | |0x0 | ||
|u64 | |u64 | ||
|''' | |'''Group.''' For most actors, this will be 0x90, but in some cases it will be different. For example, rooms with Three-of-a-Kind enemies have 0xC4 for those enemies. Does not seem to functionally matter in most cases. | ||
|- | |- | ||
|0x8 | |0x8 | ||
Line 129: | Line 129: | ||
|} | |} | ||
==== Notes on Parameters for Specific Actors ==== | ====Notes on Parameters for Specific Actors==== | ||
'''ObjCaveRock:''' (and other blocks?), the first four parameters correspond to whether you can push them in a certain direction, ordered as RIGHT, LEFT, DOWN, UP. 0x0 is not pushable in that direction, 0x1 is pushable. | '''ObjCaveRock:''' (and other blocks?), the first four parameters correspond to whether you can push them in a certain direction, ordered as RIGHT, LEFT, DOWN, UP. 0x0 is not pushable in that direction, 0x1 is pushable. | ||
=== Names Section === | ===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. | 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 seems to always be one separator that 2 null bytes instead of 1. Depending on the file, this is either between <code>point</code> and <code>rail</code> at the start of the names section, or between the 1st and 2nd listed actors (it is more commonly the latter). | All labels in the names section are separated by null bytes. Of note, there seems to always be one separator that 2 null bytes instead of 1. Depending on the file, this is either between <code>point</code> and <code>rail</code> at the start of the names section, or between the 1st and 2nd listed actors (it is more commonly the latter). | ||
[[Category:File formats]] | [[Category:File formats]] |
Revision as of 20:28, 4 June 2021
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. There is consistency in how the FixedHash is built for LEB files, with the exception of Lv7EagleTower_05E (the lower part of the Eagle boss room), which for some reason is different than all other rooms. Aside from this room, LEBs always have 0x17 hash table buckets and 0x4 child FixedHash nodes. The buckets are always the same, so the start of LEB files always look like:
3d01 1700 0400 0000 ffff ffff 0000 0000
2000 0000 ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff 4000 0000 ffff ffff
ffff ffff 5000 0000 ffff ffff 3000 0000
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff
Entries Section
There are 6 entries in most LEB files.
Node Index | Name Offset | Next entry offset |
---|---|---|
0xFFF0 | Offset of version in the names section
|
0xFFFFFFFF |
0xFFF0 | Offset of information in the names section
|
0xFFFFFFFF |
0x0 | Offset of point in the names section
|
0xFFFFFFFF |
0x1 | Offset of rail in the names section
|
0xFFFFFFFF |
0x2 | Offset of actor in the names section
|
0x10 |
0x3 | Offset of grid in the names section
|
0xFFFFFFFF |
The Name Hashes of each should not be touched. The purpose of the DataOffsets is still unknown.
Data Section
Much of the data section is still unknown.
Early in the section is a list of entry-like data, 16 bytes for each actor, which look like:
F0 FF 00 00 00 00 00 00 FF FF FF FF xx xx xx xx
Where the last 4 bytes store the offset of each actor's data block in the actor data section.
Actor Data Block
This section starts is preceded by a u64 which specifies the number of bytes the actor data section takes. The section contains blocks of data for each actor in the room. Usually these are 0x98 bytes but for some actors are longer, and in the following format:
Offset | Type | Description |
---|---|---|
0x0 | u64 | Group. For most actors, this will be 0x90, but in some cases it will be different. For example, rooms with Three-of-a-Kind enemies have 0xC4 for those enemies. Does not seem to functionally matter in most cases. |
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. Generally this should be consistent across all actors in the file, since each room has its own file. |
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:
Most actors have "blank " parameters filled in as 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. |
Notes on Parameters for Specific Actors
ObjCaveRock: (and other blocks?), the first four parameters correspond to whether you can push them in a certain direction, ordered as RIGHT, LEFT, DOWN, UP. 0x0 is not pushable in that direction, 0x1 is pushable.
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 seems to always be one separator that 2 null bytes instead of 1. Depending on the file, this is either between point
and rail
at the start of the names section, or between the 1st and 2nd listed actors (it is more commonly the latter).