encounter / decomp-toolkit

A GameCube & Wii decompilation toolkit
Apache License 2.0
115 stars 16 forks source link

Handle `lbzx` relocations #33

Closed encounter closed 6 months ago

encounter commented 10 months ago

dtk fails to detect a relocation in GetMesMaxSizeSub in mario party 4.

 /* 800473F0 00044250  88 7F 00 00 */    lbz r3, 0x0(r31)
 /* 800473F4 00044254  38 63 89 A9 */    subi r3, r3, 0x7657
 /* 800473F8 00044258  7F A3 68 AE */    lbzx r29, r3, r13

the relevant code is this. 0x7657 points to mesWInsert-0x1 which is equivalent to winTabSize this code translates to

var_r29 = mesWInsert[*var_r31 - 1];
encounter commented 6 months ago

In release v0.8.3, the add_relocations config option was added.

This specific example would be fixed using:

add_relocations:
  type: sda21
  target: mesWInsert
  addend: -1