[decompiler] as-type and font method support (#3855)

Add support for `as-type` macro, and detecting inline font methods. This
works in all three games but I've only updated jak 3's goal_src for now.
Eventually I will go back and work through the others, but I want to get
more decompiler features in first.


![image](https://github.com/user-attachments/assets/5c31bf85-97b4-437c-bc4b-dc054e60551e)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
water111
2025-02-01 21:23:11 -05:00
committed by GitHub
parent d5590ab638
commit 48cb9bb787
645 changed files with 5391 additions and 16694 deletions
+1 -6
View File
@@ -43,12 +43,7 @@
"If the focused process is not dead,
check that the [[collide-spec]] of the focus and the process match."
(when (and proc (not (logtest? (-> proc focus-status) (focus-status disable dead))))
(let* ((root (-> proc root))
(cshape (if (type? root collide-shape)
root
)
)
)
(let ((cshape (as-type (-> proc root) collide-shape)))
(and cshape (logtest? (-> this collide-with) (-> cshape root-prim prim-core collide-as)))
)
)
@@ -587,12 +587,7 @@
(remove! a0-3)
)
)
(let* ((s5-0 (-> this root))
(a0-5 (if (type? s5-0 collide-shape)
s5-0
)
)
)
(let ((a0-5 (as-type (-> this root) collide-shape)))
(when a0-5
(let ((a2-0 (-> (the-as collide-shape a0-5) actor-hash-index))
(v1-12 *actor-hash*)
@@ -662,12 +657,7 @@
(if (-> self entity)
(logior! (-> self entity extra perm status) (entity-perm-status error))
)
(let* ((gp-0 (-> self root))
(v1-12 (if (type? gp-0 collide-shape)
(the-as collide-shape gp-0)
)
)
)
(let ((v1-12 (as-type (-> self root) collide-shape)))
(when v1-12
(let ((a0-6 (-> v1-12 root-prim)))
(set! (-> a0-6 prim-core collide-as) (collide-spec))
@@ -802,12 +792,7 @@
(-> skelgroup light-index)
)
)
(let* ((gp-1 (ppointer->process (-> proc parent)))
(v1-65 (if (type? gp-1 process-drawable)
gp-1
)
)
)
(let ((v1-65 (as-type (ppointer->process (-> proc parent)) process-drawable)))
(when (and v1-65 (nonzero? (-> (the-as process-drawable v1-65) draw)))
(set! (-> s2-0 light-index) (-> (the-as process-drawable v1-65) draw light-index))
(set! (-> s2-0 shadow-mask) (-> (the-as process-drawable v1-65) draw shadow-mask))
@@ -2085,14 +2070,9 @@
;; WARN: Return type mismatch object vs process-focusable.
(defbehavior find-offending-process-focusable process-drawable ((arg0 process-tree) (arg1 attack-info))
(let ((s5-0 (the-as object #f)))
(when (and arg1 (logtest? (-> arg1 mask) (attack-mask attacker)))
(let ((s4-0 (handle->process (-> arg1 attacker))))
(set! s5-0 (if (type? s4-0 process-focusable)
s4-0
)
)
(if (and arg1 (logtest? (-> arg1 mask) (attack-mask attacker)))
(set! s5-0 (as-type (handle->process (-> arg1 attacker)) process-focusable))
)
)
(when (not (the-as process s5-0))
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-3 from) (process->ppointer self))
@@ -253,12 +253,8 @@
(new 'stack 'font-context *font-default-matrix* 32 280 0.0 (font-color default) (font-flags shadow kerning))
)
)
(let ((v1-96 s5-2))
(set! (-> v1-96 width) (the float 340))
)
(let ((v1-97 s5-2))
(set! (-> v1-97 height) (the float 80))
)
(set-width! s5-2 340)
(set-height! s5-2 80)
(let ((v1-98 s5-2)
(a0-39 (-> *setting-control* user-default language))
)