BFEVFL: Difference between revisions

261 bytes removed ,  1 year ago
(→‎Container: ore::ResMetaData, not ore::ResMetadata)
Tags: Mobile edit Mobile web edit
 
(4 intermediate revisions by 2 users not shown)
Line 46: Line 46:
| 0x24 || u32 || Padding
| 0x24 || u32 || Padding
|-
|-
| 0x28 || Flowchart* || Flowchart (nullptr if no flowchart)
| 0x28 || Flowchart** || Flowchart (nullptr if no flowchart)
|-
|-
| 0x30 || [[#Dictionary|Dictionary]]* || Flowchart name dictionary
| 0x30 || [[#Dictionary|Dictionary]]* || Flowchart name dictionary
|-
|-
| 0x38 || Timeline* || Timeline (nullptr if no timeline)
| 0x38 || Timeline** || Timeline (nullptr if no timeline)
|-
|-
| 0x40 || Dictionary* || Timeline name dictionary
| 0x40 || Dictionary* || Timeline name dictionary
Line 78: Line 78:
Note: the number of sections is almost always 1 because a single section can already fit 2^32 - 1 entries. If you need more than 4 billion entries, you are probably doing something ''very wrong''.
Note: the number of sections is almost always 1 because a single section can already fit 2^32 - 1 entries. If you need more than 4 billion entries, you are probably doing something ''very wrong''.


The table base pointer is calculated as follows: `reinterpret_cast<char*>(&table) - table_start_offset`
The table base pointer is calculated as follows: <code>reinterpret_cast<char*>(&table) - table_start_offset</code>


==== Relocation table section ====
==== Relocation table section ====
Line 142: Line 142:
! Offset !! Type !! Description
! Offset !! Type !! Description
|-
|-
| 0x0 || u32 || Compact representation of bit index
| 0x0 || u32 || Bit index
|-
|-
| 0x4 || u16 || Next index if bit is 0
| 0x4 || u16 || Index of next node if bit is 0
|-
|-
| 0x6 || u16 || Next index if bit is 1
| 0x6 || u16 || Index of next node if bit is 1
|-
|-
| 0x8 || PascalString* || Name
| 0x8 || PascalString* || Name
|}
|}
The compact representation of the bit index has two parts:
* Bits 3-7: index of the byte that should be checked
* Bits 0-2: index of the bit in that byte
A bit index can be translated to its compact representation using:
<syntaxhighlight lang="python">
def get_compact_representation(bit_idx: int) -> int:
    byte_idx = bit_idx // 8
    return (byte_idx << 3) | (bit_idx - 8*byte_idx)
</syntaxhighlight>


Example: <code>Hello</code> corresponds to 100100001100101011011000110110001101111. Bits 0-3 are 1, bit 4 is 0, etc.
Example: <code>Hello</code> corresponds to 100100001100101011011000110110001101111. Bits 0-3 are 1, bit 4 is 0, etc.
Line 208: Line 197:
| String || String (not in string pool, follows item structure immediately) || 1
| String || String (not in string pool, follows item structure immediately) || 1
|-
|-
| Wide string ("wstring") || (not implemented) || ?
| Wide string ("wstring") || Wide string (not in string pool, follows item structure immediately) || 1
|-
|-
| Int array || Int[n] || n
| Int array || Int[n] || n
Line 218: Line 207:
| String array || String[n] (aligned to 8-byte boundaries this time) || n
| String array || String[n] (aligned to 8-byte boundaries this time) || n
|-
|-
| Wstring array || (not implemented) || ?
| Wstring array || WString[n] (aligned to 8-byte boundaries this time) || n
|-
|-
| Actor identifier || Two strings: actor name + secondary name || 2
| Actor identifier || Two strings: actor name + secondary name || 2
|}
|}
Wide strings use wchar_t which is 32-bit long on Switch.


==== ContainerDataType enum ====
==== ContainerDataType enum ====