[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
+13 -54
View File
@@ -324,12 +324,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))
)
@@ -456,12 +456,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)
(the-as process-drawable s5-0)
)
)
)
(let ((s3-0 (as-type arg0 process-drawable)))
(if (and s3-0 (zero? (-> s3-0 draw)))
(set! s3-0 (the-as process-drawable #f))
)
@@ -694,12 +689,7 @@
(-> this extra trans z)
)
)
(let* ((s3-2 (-> this extra process))
(s4-2 (if (type? s3-2 process-drawable)
s3-2
)
)
)
(let ((s4-2 (as-type (-> this extra process) process-drawable)))
(format
#t
":pr #x~8X ~-18S ~-5S/~-5S "
@@ -901,29 +891,13 @@
(set! sv-16 (res-lump-data s2-0 'visvol (inline-array vector)))
(set! sv-20 (-> sv-16 0))
(set! sv-24 (-> sv-16 1))
(let ((s2-1 (-> s2-0 extra process)))
(set! sv-28 (if (type? s2-1 process-drawable)
s2-1
)
)
)
(set! sv-28 (as-type (-> s2-0 extra process) process-drawable))
)
(when sv-28
(update-actor-vis-box (the-as process-drawable sv-28) sv-20 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
)
)
sv-20
sv-24
)
)
(update-actor-vis-box (the-as process-drawable (as-type (-> s2-2 0) process-drawable)) sv-20 sv-24)
(set! s2-2 (-> s2-2 0 brother))
)
)
@@ -1399,12 +1373,7 @@
(let ((v1-7 (handle->process (-> s4-0 handle))))
(when (not v1-7)
(when (-> s4-0 name)
(let ((s3-0 (process-by-name (-> s4-0 name) *active-pool*)))
(set! v1-7 (if (type? s3-0 process-drawable)
s3-0
)
)
)
(set! v1-7 (as-type (process-by-name (-> s4-0 name) *active-pool*) process-drawable))
(set! (-> s4-0 handle) (process->handle v1-7))
)
)
@@ -1524,12 +1493,7 @@
)
(cond
(*debug-actor*
(let* ((s4-3 *debug-actor*)
(s5-4 (if (type? s4-3 process-drawable)
(the-as process-drawable s4-3)
)
)
)
(let ((s5-4 (as-type *debug-actor* process-drawable)))
(when s5-4
(if (nonzero? (-> s5-4 skel))
(debug-print-channels (-> s5-4 skel) (the-as symbol *stdcon*))
@@ -1973,12 +1937,7 @@
)
)
(else
(let* ((s3-0 arg0)
(v1-55 (if (type? s3-0 process-drawable)
s3-0
)
)
)
(let ((v1-55 (as-type arg0 process-drawable)))
(when v1-55
(cond
((and (nonzero? (-> (the-as process-drawable v1-55) part))