[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
@@ -874,12 +874,7 @@
)
)
(let ((gp-0 (-> self dest-pos)))
(let* ((s5-0 (handle->process (-> self focus handle)))
(a0-6 (if (type? s5-0 process-focusable)
s5-0
)
)
)
(let ((a0-6 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable))))
(set! (-> gp-0 quad) (-> (get-trans (the-as process-focusable a0-6) 0) quad))
)
(+! (-> gp-0 y) -20480.0)
@@ -1194,12 +1189,7 @@
(hover-enemy-method-153 this)
)
(when (> (-> this hit-points) 0)
(let* ((s1-0 (handle->process (-> this incoming attacker-handle)))
(v1-23 (if (type? s1-0 process-focusable)
s1-0
)
)
)
(let ((v1-23 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable))))
(if (and *target* v1-23 (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> this focus-pos)))
(f1-0 122880.0)
)
@@ -176,12 +176,7 @@
(hover-formation-method-15 a0-2 gp-0 (-> self offset))
)
(else
(let* ((s5-0 (handle->process (-> self focus handle)))
(a0-7 (if (type? s5-0 process-focusable)
s5-0
)
)
)
(let ((a0-7 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable))))
(cond
(a0-7
(let* ((s5-1 (get-trans (the-as process-focusable a0-7) 3))
@@ -477,16 +472,12 @@
(hover-enemy-method-141 self 1.0)
)
)
(let* ((gp-0 *target*)
(s1-0 (if (type? gp-0 process-focusable)
gp-0
)
)
(gp-1 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
(s4-0 (-> self root))
(s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp))
)
(let ((s1-0 (the-as target (as-type *target* process-focusable)))
(gp-1 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
(s4-0 (-> self root))
(s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp))
)
(let ((s0-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 1.0 'interp))
(s3-1
(-> (the-as collide-shape-prim-group (-> self root root-prim))
@@ -16,18 +16,10 @@
;; definition for method 16 of type hover-formation-control
(defmethod hover-formation-control-method-16 ((this hover-formation-control))
(let ((gp-0 (hover-formation-control-method-13 this (new 'stack-no-clear 'vector)))
(s4-0 (cond
((-> this anchor-proc)
(let ((s3-0 (handle->process (-> this anchor-proc))))
(if (type? s3-0 process-focusable)
(the-as process-focusable s3-0)
)
)
)
(else
(s4-0 (if (-> this anchor-proc)
(as-type (handle->process (-> this anchor-proc)) process-focusable)
*target*
)
)
)
)
(and s4-0
@@ -61,18 +53,10 @@
)
)
)
(s3-0 (cond
((-> this anchor-proc)
(let ((s2-0 (handle->process (-> this anchor-proc))))
(if (type? s2-0 process-focusable)
(the-as process-focusable s2-0)
)
)
)
(else
(s3-0 (if (-> this anchor-proc)
(as-type (handle->process (-> this anchor-proc)) process-focusable)
*target*
)
)
)
)
(cond
@@ -116,18 +100,10 @@
)
)
)
(a0-7 (cond
((-> this anchor-proc)
(let ((s4-0 (handle->process (-> this anchor-proc))))
(if (type? s4-0 process-focusable)
(the-as process-focusable s4-0)
)
)
)
(else
(a0-7 (if (-> this anchor-proc)
(as-type (handle->process (-> this anchor-proc)) process-focusable)
*target*
)
)
)
)
(cond
@@ -312,18 +288,10 @@
(vector-rotate-y! arg0 arg1 arg2)
(cond
((logtest? (-> this flags) 2)
(let ((s2-0 (cond
((-> this anchor-proc)
(let ((s4-0 (handle->process (-> this anchor-proc))))
(if (type? s4-0 process-focusable)
(the-as process-focusable s4-0)
)
)
)
(else
(let ((s2-0 (if (-> this anchor-proc)
(as-type (handle->process (-> this anchor-proc)) process-focusable)
*target*
)
)
)
(s4-1 (hover-formation-control-method-15 this (new 'stack-no-clear 'vector) arg0))
(s3-0 (new 'stack-no-clear 'vector))
@@ -402,12 +370,7 @@
(set! (-> s5-0 best-cost) -1.0)
(set! (-> s5-0 count) 0)
(dotimes (s4-0 16)
(let* ((s3-0 (handle->process (-> this actor-table s4-0)))
(a0-8 (if (type? s3-0 process-focusable)
(the-as process-focusable s3-0)
)
)
)
(let ((a0-8 (as-type (handle->process (-> this actor-table s4-0)) process-focusable)))
(cond
(a0-8
(set! (-> s5-0 actor-position s4-0 quad) (-> (get-trans a0-8 3) quad))
@@ -925,12 +925,7 @@
(let ((v1-2 (the-as list-node (-> this sphere-list))))
(while v1-2
(let ((s5-0 (-> v1-2 next)))
(let* ((s3-0 (handle->process (-> (the-as hover-nav-sphere v1-2) handle)))
(s4-0 (if (type? s3-0 hover-enemy)
s3-0
)
)
)
(let ((s4-0 (the-as process (as-type (handle->process (-> (the-as hover-nav-sphere v1-2) handle)) hover-enemy))))
(when s4-0
(let ((a1-9 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-9 from) (process->ppointer pp))