Decompollaborate / spimdisasm

MIPS disassembler
https://pypi.org/project/spimdisasm/
MIT License
42 stars 13 forks source link

Rename data symbols based on file name and offset #144

Closed cadmic closed 10 months ago

cadmic commented 10 months ago

This makes comparing files easier when data sections have shifted around. Example:

glabel func_80832594
  lui         $t7, %hi(ovl_player_actor.data_0001C8)
  lh          $t7, %lo(ovl_player_actor.data_0001C8)($t7)
  lh          $t6, 0xA70($a0)
  lui         $at, %hi(ovl_player_actor.data_0001C4)
  lwc1        $fv0, %lo(ovl_player_actor.data_0001C4)($at)
  subu        $v0, $t6, $t7
  sll         $v0, $v0, 16
  sra         $v0, $v0, 16
  bltz        $v0, .Lfunc_80832594_1
   abs.s      $fv0, $fv0
  b           .Lfunc_80832594_2
   move       $v1, $v0
.Lfunc_80832594_1:
  negu        $v1, $v0
.Lfunc_80832594_2:
  mtc1        $v1, $ft0
  lui         $at, %hi(ovl_player_actor.rodata_000000)
  lwc1        $ft3, %lo(ovl_player_actor.rodata_000000)($at)
  cvt.s.w     $ft1, $ft0
  lh          $t2, 0x840($a0)
  lui         $t5, %hi(ovl_player_actor.bss_00002C)
  addu        $t3, $t2, $a1
  mul.s       $ft2, $ft1, $fv0
  nop
  mul.s       $ft4, $ft2, $ft3
  trunc.w.s   $ft5, $ft4
  mfc1        $t1, $ft5
  nop
  addu        $t4, $t3, $t1
  sh          $t4, 0x840($a0)
  lw          $t5, %lo(ovl_player_actor.bss_00002C)($t5)
  lhu         $t6, 0xC($t5)
  andi        $t7, $t6, 0xC000
  beqz        $t7, .Lfunc_80832594_3
   nop
  lh          $t8, 0x840($a0)
  addiu       $t9, $t8, 0x5
  sh          $t9, 0x840($a0)
.Lfunc_80832594_3:
  lh          $t0, 0x840($a0)
  slt         $v0, $a2, $t0
  jr          $ra
   nop
.size func_80832594, . - func_80832594