[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 -61
View File
@@ -385,19 +385,9 @@
(return (the-as penetrate (-> v1-0 penetrate-using)))
)
)
(let* ((gp-0 arg0)
(v1-3 (if (type? gp-0 process-drawable)
gp-0
)
)
)
(let ((v1-3 (as-type arg0 process-drawable)))
(when v1-3
(let* ((gp-1 (-> v1-3 root))
(v1-4 (if (type? gp-1 collide-shape)
(the-as collide-shape gp-1)
)
)
)
(let ((v1-4 (as-type (-> v1-3 root) collide-shape)))
(if v1-4
(return (the-as penetrate (logior (-> v1-4 penetrate-using) (penetrate generic-attack))))
)
@@ -436,12 +426,7 @@
;; WARN: Return type mismatch int vs none.
(defmethod enemy-method-62 ((this enemy))
(when (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags)))
(let* ((s4-0 (handle->process (-> this incoming attacker-handle)))
(s5-0 (if (type? s4-0 process-focusable)
s4-0
)
)
)
(let ((s5-0 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable))))
(when (enemy-method-53 this (the-as process-focusable s5-0))
(enemy-method-63 this (the-as process-focusable s5-0) (the-as enemy-aware #f))
(logior! (-> this focus flags) (enemy-flag look-at-focus))
@@ -675,11 +660,7 @@
(set! (-> this root penetrated-by) (the-as penetrate -1))
(enemy-method-49 this)
)
(let ((s5-0 (if (type? arg0 process-focusable)
arg0
)
)
)
(let ((s5-0 (the-as process (as-type arg0 process-focusable))))
(when (enemy-method-53 this (the-as process-focusable s5-0))
(let ((v1-10 (handle->process (-> this focus handle))))
(when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags)))
@@ -1438,12 +1419,7 @@
(while (!= v1-4 (-> *collide-player-list* alive-list-end))
(let ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1))))
(when (logtest? s4-0 (-> v1-5 root-prim prim-core collide-as))
(let* ((s2-0 (-> v1-5 process))
(a1-1 (if (type? s2-0 process-focusable)
(the-as process-focusable s2-0)
)
)
)
(let ((a1-1 (as-type (-> v1-5 process) process-focusable)))
(if (and a1-1 (and a1-1 (not (logtest? (-> a1-1 focus-status) (focus-status disable dead)))) (!= this a1-1))
(update-target-awareness! this a1-1 gp-0)
)
@@ -1465,12 +1441,7 @@
(while (!= v1-19 (-> *collide-hit-by-player-list* alive-list-end))
(let ((v1-20 (the-as collide-shape (-> (the-as connection v1-19) param1))))
(when (logtest? s4-0 (-> v1-20 root-prim prim-core collide-as))
(let* ((s2-1 (-> v1-20 process))
(a1-3 (if (type? s2-1 process-focusable)
(the-as process-focusable s2-1)
)
)
)
(let ((a1-3 (as-type (-> v1-20 process) process-focusable)))
(if (and a1-3 (and a1-3 (not (logtest? (-> a1-3 focus-status) (focus-status disable dead)))) (!= this a1-3))
(update-target-awareness! this a1-3 gp-0)
)
@@ -1491,12 +1462,7 @@
(while (!= v1-32 (-> *collide-hit-by-others-list* alive-list-end))
(let ((v1-33 (the-as collide-shape (-> (the-as connection v1-32) param1))))
(when (logtest? s4-0 (-> v1-33 root-prim prim-core collide-as))
(let* ((s2-2 (-> v1-33 process))
(a1-5 (if (type? s2-2 process-focusable)
(the-as process-focusable s2-2)
)
)
)
(let ((a1-5 (as-type (-> v1-33 process) process-focusable)))
(if (and a1-5 (and a1-5 (not (logtest? (-> a1-5 focus-status) (focus-status disable dead)))) (!= this a1-5))
(update-target-awareness! this a1-5 gp-0)
)
@@ -1690,20 +1656,11 @@
)
((= arg2 'touched)
(when (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate))
(let* ((s3-1 arg0)
(v1-20 (if (type? s3-1 process-drawable)
(the-as process-drawable s3-1)
)
)
)
(let ((v1-20 (as-type arg0 process-drawable)))
(when v1-20
(let* ((s3-2 (-> v1-20 root))
(a1-4 (if (type? s3-2 collide-shape)
s3-2
)
)
(s3-3 (-> arg3 param 0))
)
(let ((a1-4 (the-as trsqv (as-type (-> v1-20 root) collide-shape)))
(s3-3 (-> arg3 param 0))
)
(if (and a1-4
s3-3
((method-of-type touching-shapes-entry prims-touching-action?)
@@ -2080,13 +2037,9 @@
;; definition for method 75 of type enemy
(defmethod enemy-method-75 ((this enemy) (arg0 process) (arg1 event-message-block))
(let* ((touch-entry (the-as touching-shapes-entry (-> arg1 param 0)))
(s2-0 arg0)
(s3-0 (if (type? s2-0 process-focusable)
(the-as process-focusable s2-0)
)
)
)
(let ((touch-entry (the-as touching-shapes-entry (-> arg1 param 0)))
(s3-0 (as-type arg0 process-focusable))
)
(when (and (the-as uint touch-entry) s3-0)
(cond
((and (focus-test? this dangerous)