[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)))
)
)
@@ -538,12 +538,7 @@
(remove! a0-3)
)
)
(let* ((s5-0 (-> this root))
(a0-5 (if (type? s5-0 collide-shape)
s5-0
)
)
)
(let ((a0-5 (the-as trsqv (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*)
@@ -578,12 +573,7 @@
(if (-> self entity)
(logior! (-> self entity extra perm status) (entity-perm-status error))
)
(let* ((s5-0 (-> self root))
(v1-6 (if (type? s5-0 collide-shape)
s5-0
)
)
)
(let ((v1-6 (the-as trsqv (as-type (-> self root) collide-shape))))
(when v1-6
(let ((a0-5 (-> (the-as collide-shape v1-6) root-prim)))
(set! (-> a0-5 prim-core collide-as) (collide-spec))
@@ -715,12 +705,7 @@
(-> arg1 light-index)
)
)
(let* ((gp-1 (ppointer->process (-> arg0 parent)))
(v1-54 (if (type? gp-1 process-drawable)
gp-1
)
)
)
(let ((v1-54 (the-as process-tree (as-type (ppointer->process (-> arg0 parent)) process-drawable))))
(when (and v1-54 (nonzero? (-> (the-as process-drawable v1-54) draw)))
(set! (-> s2-0 light-index) (-> (the-as process-drawable v1-54) draw light-index))
(set! (-> s2-0 shadow-mask) (-> (the-as process-drawable v1-54) draw shadow-mask))
@@ -1884,14 +1869,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 (the-as object (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))
@@ -236,15 +236,9 @@
(new 'stack 'font-context *font-default-matrix* 32 280 0.0 (font-color default) (font-flags shadow kerning))
)
)
(let ((v1-84 s5-1))
(set! (-> v1-84 width) (the float 340))
)
(let ((v1-85 s5-1))
(set! (-> v1-85 height) (the float 80))
)
(let ((v1-86 s5-1))
(set! (-> v1-86 scale) 0.9)
)
(set-width! s5-1 340)
(set-height! s5-1 80)
(set-scale! s5-1 0.9)
(set! (-> s5-1 flags) (font-flags shadow kerning middle-vert large))
(print-game-text (lookup-text! *common-text* (-> self talk-message) #f) s5-1 #f 44 (bucket-id progress))
)