open-goal / jak-project

Reviving the language that brought us the Jak & Daxter Series
https://opengoal.dev
ISC License
2.79k stars 170 forks source link

[decomp] handle process pointer changes #882

Open water111 opened 2 years ago

water111 commented 2 years ago

battlecontroller.gc

xTVaser commented 1 year ago

Jak 2's idle-control seems to have this problem as well? The decompiler handles it, but not the compiler idle-control::10

B0:
    or gp, a0, r0             ;; [  0] (set! obj obj) [a0: idle-control ] -> [gp: idle-control ]
    lwu v1, 0(gp)             ;; [  1] (set! v1-0 (l.wu obj)) [gp: idle-control ] -> [v1: (pointer uint32) ]
    beq v1, r0, L12           ;; [  2] (b! (zero? v1-0) L12 (set! v1-1 #f)) [v1: (pointer uint32) ] -> [v1: '#f ]
    or v1, s7, r0

B1:
    or s5, s6, r0             ;; [  3] (set! s5-0 self) [s6: process ] -> [s5: process ]
    or s6, a1, r0             ;; [  4] (set! self arg0) [a1: process-drawable ] -> [s6: process-drawable ]
Cannot set! igpr-2 because it is not settable.
Form:
(set! self arg0)
Location:
C:\Users\xtvas\Repos\opengoal\jak-project\goal_src\jak2\engine\game\idle-control.gc:52   
      (set! self arg0)
       ^
Code:
(set! self arg0)

This is only a problem if the method/function is given a :behavior. In this case it is required in order for the ja macro to function properly https://github.com/open-goal/jak-project/issues/2078#issuecomment-1368328486