[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
+9 -23
View File
@@ -317,32 +317,22 @@
(set! (-> this strings 0 scale) 0.0)
(set! (-> s1-0 origin x) 45.0)
(set! (-> s1-0 origin y) 20.0)
(let ((v1-15 s1-0))
(set! (-> v1-15 width) (the float 422))
)
(let ((v1-16 s1-0))
(set! (-> v1-16 height) (the float 80))
)
(set-width! s1-0 422)
(set-height! s1-0 80)
(let ((a0-12 s1-0))
(set! (-> a0-12 color) (font-color red))
)
(let ((a0-13 s1-0))
(set! (-> a0-13 flags) (font-flags kerning middle middle-vert large))
)
(let ((v1-19 s1-0))
(set! (-> v1-19 scale) 1.0)
)
(set-scale! s1-0 1.0)
(cond
((zero? (-> s5-0 finish-count))
(set! s0-0 80)
(let ((v1-21 s1-0))
(set! (-> v1-21 scale) 1.6)
)
(when (= (-> *setting-control* user-default language) (language-enum german))
(let ((v1-24 s1-0))
(set! (-> v1-24 scale) 1.0)
(set-scale! s1-0 1.6)
(if (= (-> *setting-control* user-default language) (language-enum german))
(set-scale! s1-0 1.0)
)
)
(set! sv-112 print-game-text)
(let ((a0-20 (lookup-text! *common-text* (text-id race-you-win) #f))
(a2-2 #f)
@@ -354,14 +344,10 @@
)
(else
(set! s0-0 80)
(let ((v1-27 s1-0))
(set! (-> v1-27 scale) 1.6)
)
(when (= (-> *setting-control* user-default language) (language-enum german))
(let ((v1-30 s1-0))
(set! (-> v1-30 scale) 1.0)
(set-scale! s1-0 1.6)
(if (= (-> *setting-control* user-default language) (language-enum german))
(set-scale! s1-0 1.0)
)
)
(set! sv-128 print-game-text)
(let ((a0-26 (lookup-text! *common-text* (text-id race-you-lose) #f))
(a1-5 s1-0)
+15 -31
View File
@@ -601,13 +601,11 @@
)
)
(((race-state-enum player-get-on))
(let* ((f30-0 (* 0.0033333334 (the float (- (-> this current-time) (-> this countdown-start-time)))))
(s4-0 (handle->process (-> this racer-array (-> this i-player) racer)))
(s5-1 (if (type? s4-0 process-focusable)
s4-0
)
)
)
(let ((f30-0 (* 0.0033333334 (the float (- (-> this current-time) (-> this countdown-start-time)))))
(s5-1
(the-as process (as-type (handle->process (-> this racer-array (-> this i-player) racer)) process-focusable))
)
)
(cond
((< f30-0 1.0)
(when s5-1
@@ -630,12 +628,10 @@
)
)
(((race-state-enum player-set-pos))
(let* ((s4-2 (handle->process (-> this racer-array (-> this i-player) racer)))
(s5-3 (if (type? s4-2 process-focusable)
s4-2
)
)
)
(let ((s5-3
(the-as process (as-type (handle->process (-> this racer-array (-> this i-player) racer)) process-focusable))
)
)
(when s5-3
(cubic-curve-method-10 (-> this player-intro-curve) (-> (the-as process-focusable s5-3) root trans) 1.0)
(vector-reset! (-> (the-as process-focusable s5-3) root transv))
@@ -1255,15 +1251,9 @@
(new 'stack 'font-context *font-default-matrix* 70 20 0.0 (font-color orange) (font-flags shadow kerning))
)
)
(let ((v1-4 gp-1))
(set! (-> v1-4 scale) 0.7)
)
(let ((v1-5 gp-1))
(set! (-> v1-5 width) (the float 225))
)
(let ((v1-6 gp-1))
(set! (-> v1-6 height) (the float 70))
)
(set-scale! gp-1 0.7)
(set-width! gp-1 225)
(set-height! gp-1 70)
(set! (-> gp-1 origin x) (the float (- 256 (the int (/ (-> gp-1 width) 2)))))
(set! (-> gp-1 origin y) 320.0)
(set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large))
@@ -1285,15 +1275,9 @@
(new 'stack 'font-context *font-default-matrix* 70 20 0.0 (font-color orange) (font-flags shadow kerning))
)
)
(let ((v1-4 gp-1))
(set! (-> v1-4 scale) 0.7)
)
(let ((v1-5 gp-1))
(set! (-> v1-5 width) (the float 240))
)
(let ((v1-6 gp-1))
(set! (-> v1-6 height) (the float 35))
)
(set-scale! gp-1 0.7)
(set-width! gp-1 240)
(set-height! gp-1 35)
(set! (-> gp-1 origin x) (the float (- 256 (the int (/ (-> gp-1 width) 2)))))
(set! (-> gp-1 origin y) 320.0)
(set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large))