REL (File Format): Difference between revisions
Jump to navigation
Jump to search
m
→Relocation Table
>Aruki |
>Aruki |
||
Line 272: | Line 272: | ||
=== Relocation Table === | === Relocation Table === | ||
This data is pointed to by the ''Relocation Table Offset'' value in the header. Since modules have space allocated at runtime and | This data is pointed to by the ''Relocation Table Offset'' value in the header. Since modules have space allocated at runtime and therefore do not have a fixed memory address, the relocations table is needed to ensure all references to symbols within the REL have the correct address. When the module is linked in, the game uses the relocation table to iterate over all instructions and data values referring to REL symbols, and patch them to point to the correct address. | ||
There are multiple distinct groups of relocations, with each one being pointed to by an entry in the [[#Import Table|import table]]. To read the relocations for a given module, you need to iterate over all relocation entries until you hit an R_DOLPHIN_END directive. Each relocation is 0x8 bytes. | There are multiple distinct groups of relocations, with each one being pointed to by an entry in the [[#Import Table|import table]]. To read the relocations for a given module, you need to iterate over all relocation entries until you hit an R_DOLPHIN_END directive. Each relocation is 0x8 bytes. |