[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
+15 -47
View File
@@ -322,12 +322,12 @@
(gp-0 (the-as nav-mesh #f))
)
(when v1-1
(let* ((s5-1 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as (pointer uint32) (&+ v1-1 (* arg2 4)))))))
(v1-3 (if (type? s5-1 entity-nav-mesh)
s5-1
)
)
)
(let ((v1-3 (as-type
(entity-nav-mesh-by-aid (the-as actor-id (-> (the-as (pointer uint32) (&+ v1-1 (* arg2 4))))))
entity-nav-mesh
)
)
)
(if v1-3
(set! gp-0 (-> v1-3 nav-mesh))
)
@@ -454,12 +454,7 @@
;; definition (debug) for function process-status-bits
;; WARN: Return type mismatch int vs none.
(defun-debug process-status-bits ((arg0 process) (arg1 symbol))
(let* ((s5-0 arg0)
(s3-0 (if (type? s5-0 process-drawable)
s5-0
)
)
)
(let ((s3-0 (the-as process (as-type arg0 process-drawable))))
(if (and s3-0 (zero? (-> (the-as process-drawable s3-0) draw)))
(set! s3-0 (the-as process #f))
)
@@ -689,12 +684,7 @@
(format #t " :trans ~14m ~14m ~14m " (-> this extra trans x) (-> this extra trans y) (-> this extra trans z))
(format #t " :trans ~14f ~14f ~14f " (-> this extra trans x) (-> this extra trans y) (-> this extra trans z))
)
(let* ((s3-2 (-> this extra process))
(s4-2 (if (type? s3-2 process-drawable)
s3-2
)
)
)
(let ((s4-2 (the-as process (as-type (-> this extra process) process-drawable))))
(format
#t
":pr #x~8X ~-12S ~-21S ~-5S/~-5S "
@@ -898,28 +888,16 @@
(set! sv-16 (res-lump-data s2-0 'visvol pointer))
(set! sv-20 (&+ sv-16 0))
(set! sv-24 (&+ sv-16 16))
(let ((s2-1 (-> s2-0 extra process)))
(set! sv-28 (if (type? s2-1 process-drawable)
s2-1
)
)
)
(set! sv-28 (the-as process (as-type (-> s2-0 extra process) process-drawable)))
)
(when sv-28
(update-actor-vis-box (the-as process-drawable sv-28) (the-as vector sv-20) (the-as vector sv-24))
(let ((s2-2 (-> sv-28 child)))
(while s2-2
(let ((s1-0 update-actor-vis-box)
(s0-0 (-> s2-2 0))
)
(s1-0
(the-as process-drawable (if (type? s0-0 process-drawable)
s0-0
)
)
(the-as vector sv-20)
(the-as vector sv-24)
)
(update-actor-vis-box
(the-as process-drawable (the-as process-tree (as-type (-> s2-2 0) process-drawable)))
(the-as vector sv-20)
(the-as vector sv-24)
)
(set! s2-2 (-> s2-2 0 brother))
)
@@ -1539,12 +1517,7 @@
)
(cond
(*debug-actor*
(let* ((s4-3 *debug-actor*)
(s5-4 (if (type? s4-3 process-drawable)
s4-3
)
)
)
(let ((s5-4 (the-as object (as-type *debug-actor* process-drawable))))
(when s5-4
(if (nonzero? (-> (the-as process-drawable s5-4) skel))
(debug-print-channels (-> (the-as process-drawable s5-4) skel) (the-as symbol *stdcon*))
@@ -1993,12 +1966,7 @@
)
)
(else
(let* ((s3-0 arg0)
(v1-44 (if (type? s3-0 process-drawable)
s3-0
)
)
)
(let ((v1-44 (the-as process (as-type arg0 process-drawable))))
(when v1-44
(cond
((and (nonzero? (-> (the-as process-drawable v1-44) part))