https://wiki.tockdom.com/w/api.php?action=feedcontributions&user=Test175.9&feedformat=atomCustom Mario Kart - User contributions [en]2024-03-29T08:15:02ZUser contributionsMediaWiki 1.35.14https://wiki.tockdom.com/w/index.php?title=REL_(File_Format)&diff=156703REL (File Format)2019-01-16T21:27:01Z<p>Test175.9: /* Section Info Table */</p>
<hr />
<div>'''REL files''' are relocatable object files used by Nintendo. [[Mario Kart Wii]] features one such file: '''[[Filesystem/rel/StaticR.rel|StaticR.rel]]'''. In general these files allow extra code to be loaded as needed by games, especially when the memory footprint becomes a concern. In Mario Kart, the REL code contains much of the Mario Kart specific logic, such as gameplay, and, once loaded during the health and safety screen, remains loaded for the entire run of the application. Information about specific alteration that can be made to the Mario Kart Wii file can be found '''[[Filesystem/rel/StaticR.rel|here]]'''.<br />
<br />
= File Format =<br />
Like many object formats, the file is divided into sections, grouped by like access. For example, all executable code is placed in one section, read only data in another, etc. The file begins with a header, followed by the section info table, followed by the section data, followed by the relocation information.<br />
<br />
== File Header ==<br />
The file begins with a header of up to 0x4C bytes:<br />
{| class="wikitable"<br />
|+ REL file header<br />
|-<br />
! Offset<br />
! Size<br />
! Field Name<br />
! Description<br />
|-<br />
| 0x00<br />
| 4<br />
| <code>id</code><br />
| Arbitrary identification number. Must be unique amongst all RELs used by a game. Must not be 0.<br />
|-<br />
| 0x04<br />
| 4<br />
| Next module<br />
| Pointer to next module, filled at runtime. <br />
|-<br />
| 0x08<br />
| 4<br />
| Previous module<br />
| Pointer to previous module, filled at runtime. <br />
|-<br />
| 0x0c<br />
| 4<br />
| <code>numSections</code><br />
| Number of sections in the file.<br />
|-<br />
| 0x10<br />
| 4<br />
| <code>sectionInfoOffset</code><br />
| Offset to the start of the [[#Section Info Table|section table]].<br />
|-<br />
| 0x14<br />
| 4<br />
| <code>nameOffset</code><br />
| Offset to ASCII string containing name of module. May be NULL. Relative to start of REL file.<br />
|-<br />
| 0x18<br />
| 4<br />
| <code>nameSize</code><br />
| Size of the module name in bytes.<br />
|-<br />
| 0x1c<br />
| 4<br />
| <code>version</code><br />
| Version number of the REL file format.<br />
|-<br />
| 0x20<br />
| 4<br />
| <code>bssSize</code><br />
| Size of the '<code>.bss</code>' section.<br />
|-<br />
| 0x24<br />
| 4<br />
| <code>relOffset</code><br />
| Offset to the [[#Relocation Data|relocation table]].<br />
|-<br />
| 0x28<br />
| 4<br />
| <code>impOffset</code><br />
| Offset to [[#imp|imp table]].<br />
|-<br />
| 0x2c<br />
| 4<br />
| <code>impSize</code><br />
| Size of [[#imp|imp table]] in bytes.<br />
|-<br />
| 0x30<br />
| 1<br />
| <code>prologSection</code><br />
| Index into [[#Section Info Table|section table]] which <code>prolog</code> is relative to. Skip if this field is 0.<br />
|-<br />
| 0x31<br />
| 1<br />
| <code>epilogSection</code><br />
| Index into [[#Section Info Table|section table]] which <code>epilog</code> is relative to. Skip if this field is 0.<br />
|-<br />
| 0x32<br />
| 1<br />
| <code>unresolvedSection</code><br />
| Index into [[#Section Info Table|section table]] which <code>unresolved</code> is relative to. Skip if this field is 0.<br />
|-<br />
| 0x33<br />
| 1<br />
| <code>bssSection</code><br />
| Index into [[#Section Info Table|section table]] which <code>bss</code> is relative to. Filled at runtime!<br />
|-<br />
| 0x34<br />
| 4<br />
| <code>prolog</code><br />
| Offset into specified section of the <code>_prolog</code> function.<br />
|-<br />
| 0x38<br />
| 4<br />
| <code>epilog</code><br />
| Offset into specified section of the <code>_epilog</code> function.<br />
|-<br />
| 0x3c<br />
| 4<br />
| <code>unresolved</code><br />
| Offset into specified section of the <code>_unresolved</code> function.<br />
|-<br />
| 0x40<br />
| 4<br />
| <code>align</code><br />
| Version &ge; 2 only. Alignment constraint on all sections, expressed as power of 2.<br />
|-<br />
| 0x44<br />
| 4<br />
| <code>bssAlign</code><br />
| Version &ge; 2 only. Alignment constraint on all '<code>.bss</code>' section, expressed as power of 2.<br />
|-<br />
| 0x48<br />
| 4<br />
| <code>fixSize</code><br />
| Version &ge; 3 only. If REL is linked with OSLinkFixed (instead of OSLink), the space after this address can be used for other purposes (like BSS). <br />
|-<br />
| 0x4c or 0x48 or 0x40<br />
| colspan=3 {{unknown|End of header}}<br />
|-<br />
|}<br />
<br />
== Section Info Table ==<br />
The section info table comprises of ''numSections'' entries each 0x8 bytes long, of the following form:<br />
{| class="wikitable"<br />
|+ Section table entry<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 30 bits<br />
| Offset from the beginning of the REL to the section. If this is zero, the section is an uninitialized section (i.e. <code>.bss</code>).<br />
|-<br />
| 0x3.6<br />
| 1 bit<br />
| 1 means the file contains debug info<br />
|-<br />
| 0x3.7<br />
| 1 bit<br />
| Executable flag; if this is 1 the section is executable.<br />
|-<br />
| 0x4<br />
| 4<br />
| Length in bytes of the section. If this is zero, this entry is skipped.<br />
|-<br />
| 0x8<br />
| colspan=2 {{unknown|Next entry}}<br />
|-<br />
|}<br />
<br />
== imp ==<br />
The '''imp''' acts as a directory for the relocation information. It controls which entries in the relocation table refer to. Each entry has the form:<br />
{| class="wikitable"<br />
|+ imp table entry<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 4<br />
| Module number (<code>id</code>) that these relocations refer to. 0 means these refer to [[main.dol]] instead.<br />
|-<br />
| 0x4<br />
| 4<br />
| Offset from the beginning of the REL to the relocation data.<br />
|-<br />
| 0x8<br />
| colspan=2 {{unknown|Next entry}}<br />
|-<br />
|}<br />
<br />
== Relocation Data ==<br />
The relocation data seems to be heavily based on the ELF relocation format. It is one or more lists of 0x8 byte structures, and must be parsed in order. The [[#imp|imp table]] gives the start of each list. The end of each list is marked by the special type code 203. Each entry has the form:<br />
{| class="wikitable"<br />
|+ Relocation table entry<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 2<br />
| Offset in bytes from the previous relocation to this one. If this is the first relocation in the section, this is relative to the section start.<br />
|-<br />
| 0x2<br />
| 1<br />
| The relocation type. Described below.<br />
|-<br />
| 0x3<br />
| 1<br />
| The section of the symbol to relocate against. For the special relocation type 202, this is instead the number of the section in this file which the following relocation entries apply to.<br />
|-<br />
| 0x4<br />
| 4<br />
| Offset in bytes of the symbol to relocate against, relative to the start of its section. This is an absolute address instead for relocations against [[main.dol]].<br />
|-<br />
| 0x8<br />
| colspan=2 {{unknown|Next entry}}<br />
|-<br />
|}<br />
<br />
The following relocation types are known[https://www.power.org/wp-content/uploads/2012/07/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf <sup>[1&#93;</sup>]:<br />
{| class="wikitable"<br />
|+ Relocation entry type<br />
|-<br />
! Type<br />
! Name<br />
! Description<br />
|-<br />
| 0<br />
| R_PPC_NONE<br />
| Do nothing. Skip this entry.<br />
|-<br />
| 1<br />
| R_PPC_ADDR32<br />
| Write the 32 bit address of the symbol.<br />
|-<br />
| 2<br />
| R_PPC_ADDR24<br />
| Write the 24 bit address of the symbol divided by four shifted up 2 bits to the 32 bit value (for relocating branch instructions). Fail if address won't fit.<br />
|-<br />
| 3<br />
| R_PPC_ADDR16<br />
| Write the 16 bit address of the symbol. Fail if address more than 16 bits.<br />
|-<br />
| 4<br />
| R_PPC_ADDR16_LO<br />
| Write the low 16 bits of the address of the symbol.<br />
|-<br />
| 5<br />
| R_PPC_ADDR16_HI<br />
| Write the high 16 bits of the address of the symbol.<br />
|-<br />
| 6<br />
| R_PPC_ADDR16_HA<br />
| Write the high 16 bits of the address of the symbol plus 0x8000.<br />
|-<br />
| 7 - 9<br />
| R_PPC_ADDR14<br />
| Write the 14 bits of the address of the symbol divided by four shifted up 2 bits to the 32 bit value (for relocating conditional branch instructions). Fail if address won't fit.<br />
|-<br />
| 10<br />
| R_PPC_REL24<br />
| Write the 24 bit address of the symbol minus the address of the relocation divided by four shifted up 2 bits to the 32 bit value (for relocating relative branch instructions). Fail if address won't fit.<br />
|-<br />
| 11 - 13<br />
| R_PPC_REL14<br />
| Write the 14 bit address of the symbol minus the address of the relocation divided by four shifted up 2 bits to the 32 bit value (for relocating conditional relative branch instructions). Fail if address won't fit.<br />
|-<br />
| 14<br />
| {{unknown-left}}<br />
| Undefined, handled like 203 R_RVL_STOP by newer Nintendo SDKs. Unsupported by Mario Kart Wii.<br />
|-<br />
| 201<br />
| R_RVL_NONE<br/>R_DOLPHIN_NOP<br />
| Do nothing. Skip this entry. Carry the address of the symbol to the next entry.<br />
|-<br />
| 202<br />
| R_RVL_SECT<br/>R_DOLPHIN_SECTION<br />
| Change which section relocations are being applied to. Set the offset into the section to 0.<br />
|-<br />
| 203<br />
| R_RVL_STOP<br/>R_DOLPHIN_END<br />
| Stop parsing the relocation table.<br />
|-<br />
| 204<br />
| R_DOLPHIN_MRKREF<br />
| {{unknown-left|Unknown. Unsupported by Mario Kart Wii.}}<br />
|-<br />
|}<br />
<br />
The loader walks this table obeying each command until it encounters R_RVL_STOP. When relocation against a REL file (including against this file itself), the symbol address is calculated by taking the load address of the section ''section'' and adding the offset ''address''. For relocation again [[main.dol]], the symbol address is just ''address'' with no adjustment.<br />
<br />
= Tools =<br />
<br />
The following tools can handle REL files:<br />
* [[BrawlBox]], by [[Kryal]] & [[BlackJax]]<br />
* '''wstrt''' (see [[Wiimms SZS Tools]]) is able to patch data in the [[Mario Kart Wii]] file [[StaticR.rel]].<br />
* [[StaticR.rel Tool]], by [[Atlas]], can edit the region number, plus HUD, region line, Mii suit and layout button colors from the same file.<br />
<br />
[[Category:File Format/Wii]]</div>Test175.9https://wiki.tockdom.com/w/index.php?title=Template:News_Month_01&diff=156701Template:News Month 012019-01-16T21:24:32Z<p>Test175.9: </p>
<hr />
<div><noinclude>[[Category:Template/News]]{{News Attention}}<br />
{{News Links and Months}}<br />
<!-- IMPORTANT: Newer entries within the same date must be put below older entries. --><br />
</noinclude>{{textbox|news|January 2019|<br />
; 2019-01-16<br />
* [[ChaosShadow23]] updated '''[[Hellado Mountain]]''' to v1.1.<br />
* I need help on how to creat a CT. Custom Tube is hard I think.<br />
<br />
; 2019-01-15<br />
* [[ZPL Gaming]] and [[IEF◇Spyro]] updated '''[[Sahara Hideout]]''' to v1.62-Nether.<br />
* [[Hollend]] updated '''[[GBA Peach Circuit (Hollend)|GBA Peach Circuit]]''' to v1.1.<br />
<br />
; 2019-01-14<br />
* [[S4M]] released v1.0 of '''[[Withered Fortress]]'''.<br />
* [[ChisSilver64]] and [[ZPL Gaming]] updated the custom track distribution '''[[Chis Kart Wii]]''' to v2.0.<br />
* [[IronDragonGD]] updated the custom track distribution '''[[Waluigi Kart Wii]]''' to v1.1.<br />
* [[MEGAKart69]] updated '''[[Final Grounds]]''' to v2.0.<br />
* [[Babypeachd]] released v1.0 of the character '''[[Ice Funky (Funky Kong Texture)|Ice Funky]]'''.<br />
<br />
; 2019-01-13<br />
* [[Nevesqq]] released v1.0 of the distribution '''[[Nevesqq's Texture n' Music Pack]]'''.<br />
* [[Hollend]] released v1.0 of '''[[GBA Peach Circuit (Hollend)|GBA Peach Circuit]]'''.<br />
<br />
; 2019-01-12<br />
* [[Jiyuu]] released v1.0 of the character '''[[Zelda on Flame Runner]]'''.<br />
* [[Bearably]] and [[MK Mier]] released v1.0 of '''[[Saltwater Swamp]]'''.<br />
* [[Hollend]] updated '''[[Containers Raceway]]''' to v1.22.<br />
* [[ALE XD]] released v1.0 of the character '''[[Rouge the Bat]]'''.<br />
<br />
; 2019-01-11<br />
* [[Retrostyle12]] released v1.0 of the battle arena '''[[Death Chamber 3]]'''.<br />
* [[Bri]] released v1.0-beta of the character '''[[Fire Toadette (Toadette Texture)|Fire Toadette]]'''.<br />
<br />
; 2019-01-09<br />
* [[Ferv]] updated '''[[Lakeside Grove]]''' to v1.1.<br />
* [[S4M]] released v1.0 of '''[[Blood Moon Forest]]'''.<br />
* [[varemi]] updated '''[[Tetris DT Cannon]]''' to Beta 2.<br />
<br />
; 2019-01-07<br />
* [[Bri]] updated '''[[Orange Loop (Toxic Prime & Bri)|Orange Loop]]''' to Beta 2.<br />
* [[MrTamkis]] updated the program '''[[Thwimp]]''' to v1.1.<br />
* [[Hollend]] updated '''[[Containers Raceway]]''' to v1.2.<br />
<br />
; 2019-01-06<br />
* [[ANoob]] released a Beta of '''[[Paradise Gardens]]'''.<br />
* [[Ferv]] released v1.0 of '''[[Lakeside Grove]]'''.<br />
<br />
; 2019-01-05<br />
* [[JDS]] released v1.0 of '''[[Cascade Jungle]]'''.<br />
* [[Skipper93653]] updated '''[[Desert Dash]]''' to v1.1.<br />
* The ''Variety'' team updated '''[[Variety Pack]]''' to v1.31.<br />
<br />
; 2019-01-04<br />
* [[9Paran]] updated '''[[Lakeside Raceway]]''' to v1.0-hotfix.<br />
* [[Toxic Prime]] and [[Bri]] released Beta 1.1 of '''[[Orange Loop (Toxic Prime & Bri)|Orange Loop]]'''.<br />
* Jaxx, Hoesay, Ferg, and Rajwii64 updated the custom track distribution '''[[JHFR CT Pack]]''' to v2.1.<br />
<br />
; 2019-01-03<br />
* [[Huili]] updated '''[[MKW Character Pack]]''' to v7.0.<br />
* [[Renegade Ciara]] and [[ChaosShadow23]] updated '''[[Cherry Blossom Garden]]''' to v1.1.<br />
<br />
; 2019-01-02<br />
* [[ZPL Gaming]] updated '''[[Lunar Speedway]]''' to v1.0.<br />
* [[FunkyDude15]] updated '''[[Love Circuit]]''' to v4.0.<br />
* [[ZPL Gaming]] updated '''[[4IT★Clown's Road]]''' to v1.2.<br />
* Jaxx, Hoesay, Ferg, and Rajwii64 updated the custom track distribution '''[[JHFR CT Pack]]''' to v2.0.<br />
<br />
; 2019-01-01<br />
* The Wiiki administration established a new [[Template:News Attention|template schema for News]].<br />
* [[Huili]] updated the custom track distribution '''[[MKW Hack Pack]]''' to v6.<br />
* [[Retrostyle12]] released v1.0 of '''[[Entei Castle 1]]'''.<br />
* [[Blue Link]] released v1.0 of the distribution '''[[Blue Link's Music & Track Distribution]]'''.<br />
* [[ZPL Gaming]] and [[IEF◇Spyro]] updated '''[[Grassy Plains (ZPL Gaming)|Grassy Plains]]''' to v2.5.<br />
* [[ZPL Gaming]] and [[IEF◇Spyro]] updated '''[[Sahara Hideout]]''' to v1.61.<br />
}}</div>Test175.9