[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
+14 -26
View File
@@ -168,23 +168,15 @@
(a0-2
(hover-formation-method-15 a0-2 gp-0 (-> self offset))
)
(else
(let ((s5-0 (handle->process (-> self focus handle))))
(cond
((if (type? s5-0 process-focusable)
s5-0
)
(let* ((s5-1 (-> self focus-pos))
(a0-8 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) s5-1))
)
(vector+! gp-0 s5-1 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> self offset) (vector-y-angle a0-8)))
)
)
(else
(vector-copy! gp-0 (-> self root trans))
((as-type (handle->process (-> self focus handle)) process-focusable)
(let* ((s5-1 (-> self focus-pos))
(a0-8 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) s5-1))
)
)
)
(vector+! gp-0 s5-1 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> self offset) (vector-y-angle a0-8)))
)
)
(else
(vector-copy! gp-0 (-> self root trans))
)
)
(hover-nav-control-method-12 (-> self hover) gp-0)
@@ -505,16 +497,12 @@
(go process-drawable-art-error "no path")
)
(set-time! (-> self scale-timer))
(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)
s3-0
)
)
)
(else
(s4-0 (if (-> this anchor-proc)
(as-type (handle->process (-> this anchor-proc)) process-focusable)
*target*
)
)
)
)
(and s4-0
@@ -63,18 +55,10 @@
)
)
)
(s1-0 (cond
((-> this anchor-proc)
(let ((s3-0 (handle->process (-> this anchor-proc))))
(if (type? s3-0 process-focusable)
s3-0
)
)
)
(else
(s1-0 (if (-> this anchor-proc)
(as-type (handle->process (-> this anchor-proc)) process-focusable)
*target*
)
)
)
)
(cond
@@ -139,18 +123,10 @@
)
)
)
(a0-7 (cond
((-> this anchor-proc)
(let ((s4-0 (handle->process (-> this anchor-proc))))
(if (type? s4-0 process-focusable)
s4-0
)
)
)
(else
(a0-7 (if (-> this anchor-proc)
(as-type (handle->process (-> this anchor-proc)) process-focusable)
*target*
)
)
)
)
(cond
@@ -437,12 +413,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)
s3-0
)
)
)
(let ((a0-8 (as-type (handle->process (-> this actor-table s4-0)) process-focusable)))
(cond
(a0-8
(vector-copy! (-> s5-0 actor-position s4-0) (get-trans (the-as process-focusable a0-8) 3))
@@ -833,7 +804,6 @@
)
;; definition for method 3 of type flying-formation
;; INFO: this function exists in multiple non-identical object files
(defmethod inspect ((this flying-formation))
(when (not this)
(set! this this)
@@ -929,12 +929,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 (as-type (handle->process (-> self focus handle)) process-focusable)))
(vector-copy! gp-0 (get-trans (the-as process-focusable a0-6) 0))
)
(+! (-> gp-0 y) -20480.0)