[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
+3 -17
View File
@@ -102,12 +102,7 @@
((25)
(logior! (-> arg0 mask) (sound-mask reg0))
(set! (-> arg0 reg 0) (the-as uint (-> *footstep-surface* material)))
(let* ((s2-3 arg3)
(v1-33 (if (type? s2-3 process-focusable)
s2-3
)
)
)
(let ((v1-33 (as-type arg3 process-focusable)))
(when v1-33
(cond
((focus-test? v1-33 in-air)
@@ -117,12 +112,7 @@
(set! (-> arg0 reg 0) (the-as uint 127))
)
(else
(let* ((s2-4 (-> v1-33 root))
(v1-34 (if (type? s2-4 collide-shape-moving)
s2-4
)
)
)
(let ((v1-34 (as-type (-> v1-33 root) collide-shape-moving)))
(if v1-34
(set! (-> arg0 reg 0) (the-as uint (-> (the-as collide-shape-moving v1-34) ground-pat material)))
)
@@ -365,11 +355,7 @@
(= (-> s3-0 data 5) 116)
(= (-> s3-0 data 6) 45)
)
(let* ((s2-0 (-> this process root))
(v1-38 (if (type? s2-0 collide-shape-moving)
s2-0
)
)
(let* ((v1-38 (as-type (-> this process root) collide-shape-moving))
(t1-2 (if v1-38
(-> (the-as collide-shape-moving v1-38) ground-pat)
*footstep-surface*
+7 -21
View File
@@ -2252,12 +2252,8 @@
(new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning))
)
)
(let ((v1-5 gp-0))
(set! (-> v1-5 width) (the float 440))
)
(let ((v1-6 gp-0))
(set! (-> v1-6 height) (the float 80))
)
(set-width! gp-0 440)
(set-height! gp-0 80)
(set! (-> gp-0 flags) (font-flags shadow kerning))
(format (clear *temp-string*) "~S / ~S ~D~%" (-> self mode) (-> self state name) (-> self which))
(print-game-text *temp-string* gp-0 #f 44 (bucket-id hud-draw-hud-alpha))
@@ -2268,15 +2264,9 @@
(new 'stack 'font-context *font-default-matrix* 20 80 0.0 (font-color default) (font-flags shadow kerning))
)
)
(let ((v1-17 gp-1))
(set! (-> v1-17 scale) 0.8)
)
(let ((v1-18 gp-1))
(set! (-> v1-18 width) (the float 432))
)
(let ((v1-19 gp-1))
(set! (-> v1-19 height) (the float 20))
)
(set-scale! gp-1 0.8)
(set-width! gp-1 432)
(set-height! gp-1 20)
(set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large))
(when (and (>= 1 (-> *game-info* auto-save-count))
(and (-> self next-state) (= (-> self next-state name) 'save))
@@ -2309,12 +2299,8 @@
)
(set! (-> gp-1 origin x) 20.0)
(set! (-> gp-1 origin y) 130.0)
(let ((v1-37 gp-1))
(set! (-> v1-37 scale) 0.7)
)
(let ((v1-38 gp-1))
(set! (-> v1-38 height) (the float 200))
)
(set-scale! gp-1 0.7)
(set-height! gp-1 200)
(let ((s5-2 print-game-text))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id progress-memcard-remove-warn) #f) 1)
(s5-2 *temp-string* gp-1 #f 44 (bucket-id hud-draw-hud-alpha))
+1 -6
View File
@@ -1977,12 +1977,7 @@
(set! (-> s5-1 use-mouse-tumble-point) (-> s4-1 use-mouse-tumble-point))
(vector-copy! (-> s5-1 mouse-tumble-point) (-> s4-1 mouse-tumble-point))
(set! (-> s5-1 handle-of-interest) (-> s4-1 handle-of-interest))
(let* ((s3-11 (handle->process (-> s5-1 handle-of-interest)))
(a0-159 (if (type? s3-11 process-focusable)
s3-11
)
)
)
(let ((a0-159 (as-type (handle->process (-> s5-1 handle-of-interest)) process-focusable)))
(when a0-159
(set! (-> s5-1 use-point-of-interest) #t)
(vector-copy! (-> s5-1 point-of-interest) (get-trans (the-as process-focusable a0-159) 4))
+8 -22
View File
@@ -218,13 +218,9 @@
)
(-> (the-as pair (-> (the-as pair (-> (the-as pair s4-0) cdr)) cdr)) car)
(-> (the-as pair (-> (the-as pair (-> (the-as pair (-> (the-as pair s4-0) cdr)) cdr)) cdr)) car)
(let* ((s3-0 (-> (the-as symbol v1-0) value))
(v1-1 (if (type? s3-0 level-load-info)
s3-0
)
)
(a0-11 (-> (the-as pair (-> (the-as pair s4-0) cdr)) cdr))
)
(let ((v1-1 (as-type (-> (the-as symbol v1-0) value) level-load-info))
(a0-11 (-> (the-as pair (-> (the-as pair s4-0) cdr)) cdr))
)
(when (and v1-1 (-> (the-as level-load-info v1-1) borrow))
(case s5-0
(('alias)
@@ -2350,15 +2346,9 @@
)
)
(set! (-> gp-0 origin x) 120.0)
(let ((v1-7 gp-0))
(set! (-> v1-7 scale) 0.7)
)
(let ((v1-8 gp-0))
(set! (-> v1-8 width) (the float 300))
)
(let ((v1-9 gp-0))
(set! (-> v1-9 height) (the float 35))
)
(set-scale! gp-0 0.7)
(set-width! gp-0 300)
(set-height! gp-0 35)
(set! (-> gp-0 flags) (font-flags shadow kerning middle middle-vert large))
(let ((s4-0 (if (logtest? (-> this params flags) (resetter-flag text-message))
(the-as int (-> this params text-message))
@@ -2374,16 +2364,12 @@
)
)
(when (= (-> this params message) (resetter-message mission-fail-or-retry))
(let ((v1-17 gp-0))
(set! (-> v1-17 height) (the float 95))
)
(set-height! gp-0 95)
(let ((s5-1 print-game-text))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id text-008b) #f) 1)
(s5-1 *temp-string* gp-0 #f 44 (bucket-id hud-draw-hud-alpha))
)
(let ((v1-19 gp-0))
(set! (-> v1-19 height) (the float 155))
)
(set-height! gp-0 155)
(let ((s5-2 print-game-text))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id text-0081) #f) 1)
(s5-2 *temp-string* gp-0 #f 44 (bucket-id hud-draw-hud-alpha))