[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
@@ -97,12 +97,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)
@@ -112,12 +107,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 (the-as collide-shape (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)))
)
@@ -362,11 +352,7 @@
(= (-> v1-23 data 5) 116)
(= (-> v1-23 data 6) 45)
)
(let* ((s3-1 (-> this process root))
(v1-27 (if (type? s3-1 collide-shape-moving)
s3-1
)
)
(let* ((v1-27 (the-as trsqv (as-type (-> this process root) collide-shape-moving)))
(t1-2 (if v1-27
(-> (the-as collide-shape-moving v1-27) ground-pat)
*footstep-surface*
+7 -21
View File
@@ -1878,12 +1878,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 progress))
@@ -1894,15 +1890,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)) (-> self next-state) (= (-> self next-state name) 'save))
(print-game-text
@@ -1914,12 +1904,8 @@
)
(set! (-> gp-1 origin x) 20.0)
(set! (-> gp-1 origin y) 130.0)
(let ((v1-30 gp-1))
(set! (-> v1-30 scale) 0.7)
)
(let ((v1-31 gp-1))
(set! (-> v1-31 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-dont-remove) #f) 1)
(s5-2 *temp-string* gp-1 #f 44 (bucket-id progress))
+2 -7
View File
@@ -1361,13 +1361,8 @@
(set! (-> s5-1 use-mouse-tumble-point) (-> s4-1 use-mouse-tumble-point))
(set! (-> s5-1 mouse-tumble-point quad) (-> s4-1 mouse-tumble-point quad))
(set! (-> s5-1 handle-of-interest) (-> s4-1 handle-of-interest))
(let* ((s3-1 (handle->process (-> s5-1 handle-of-interest)))
(a0-147 (the-as process-focusable (if (type? s3-1 process-focusable)
(the-as process-focusable s3-1)
)
)
)
)
(let ((a0-147 (the-as process-focusable (as-type (handle->process (-> s5-1 handle-of-interest)) process-focusable)))
)
(when (the-as process a0-147)
(set! (-> s5-1 use-point-of-interest) #t)
(set! (-> s5-1 point-of-interest quad) (-> (get-trans a0-147 4) quad))
+6 -20
View File
@@ -100,11 +100,7 @@
(s5-0 (/ (the-as int (car (cdr a0-1))) 8))
(s4-0 (car (cdr (cdr a0-1))))
(s3-0 (car (cdr (cdr (cdr a0-1)))))
(s2-0 (-> (the-as symbol v1-0) value))
(v1-1 (if (type? s2-0 level-load-info)
(the-as level-load-info s2-0)
)
)
(v1-1 (as-type (-> (the-as symbol v1-0) value) level-load-info))
)
(when v1-1
(set! (-> v1-1 borrow-level s5-0) (the-as symbol s4-0))
@@ -1456,15 +1452,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 flags) (fail-mission-flags famflags-2))
(the-as int (-> this fail-message))
@@ -1480,16 +1470,12 @@
)
)
(when (= (-> this message) (fail-mission-message fammsg-1))
(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 try-again?) #f) 1)
(s5-1 *temp-string* gp-0 #f 44 (bucket-id progress))
)
(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 yes-no-prompt) #f) 1)
(s5-2 *temp-string* gp-0 #f 44 (bucket-id progress))