[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
+29 -60
View File
@@ -203,19 +203,17 @@
(goto cfg-211)
)
)
(let* ((s4-1 (art-group-get-by-name *level* (-> this art-group) (the-as (pointer uint32) #f)))
(s2-0 (if (type? s4-1 skeleton-group)
(the-as skeleton-group s4-1)
)
)
(s0-0 (-> arg0 level))
(s3-0
(or (string= (-> this name) "jak-highres")
(string= (-> this name) "jak-highres-prison")
(string= (-> this name) "darkjak-highres")
)
)
)
(let ((s2-0
(as-type (art-group-get-by-name *level* (-> this art-group) (the-as (pointer uint32) #f)) skeleton-group)
)
(s0-0 (-> arg0 level))
(s3-0
(or (string= (-> this name) "jak-highres")
(string= (-> this name) "jak-highres-prison")
(string= (-> this name) "darkjak-highres")
)
)
)
(set! (-> arg0 level) #f)
(set! s4-0
(when s2-0
@@ -611,14 +609,14 @@
(-> *level* default-level)
)
)
(v1-55 (when level
(let ((s0-0 (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f))))
(if (type? s0-0 skeleton-group)
s0-0
)
)
)
)
(v1-55
(if level
(the-as
art-group
(as-type (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f)) skeleton-group)
)
)
)
)
(cond
((or (not s1-0) (not (or (= (-> s1-0 status) 'active) (= (-> s1-0 status) 'reserved))))
@@ -849,23 +847,15 @@
(new 'stack 'font-context *font-default-matrix* 20 290 0.0 (font-color default) (font-flags shadow kerning))
)
)
(let ((v1-20 s2-0))
(set! (-> v1-20 width) (the float 465))
)
(let ((v1-21 s2-0))
(set! (-> v1-21 height) (the float 70))
)
(let ((v1-22 s2-0))
(set! (-> v1-22 scale) 0.5)
)
(set-width! s2-0 465)
(set-height! s2-0 70)
(set-scale! s2-0 0.5)
(set! (-> s2-0 flags) (font-flags shadow kerning middle large))
(case (-> s3-0 type)
((string)
(when (= (-> *setting-control* user-default subtitle-language) (language-enum korean))
(set! s3-0 (convert-korean-text (the-as string s3-0)))
(let ((v1-27 s2-0))
(set! (-> v1-27 scale) 0.6)
)
(set-scale! s2-0 0.6)
)
(set! (-> s2-0 flags) (font-flags kerning middle middle-vert large))
(+! (-> s2-0 origin x) -1.0)
@@ -1408,12 +1398,7 @@
)
(when (logtest? gp-4 (scene-controls special-fma-spheres))
(dotimes (s5-3 (-> self scene actor length))
(let* ((s4-1 (handle->process (-> self scene actor s5-3 process)))
(v1-63 (if (type? s4-1 process-drawable)
(the-as process-drawable s4-1)
)
)
)
(let ((v1-63 (as-type (handle->process (-> self scene actor s5-3 process)) process-drawable)))
(if (and v1-63 (nonzero? (-> v1-63 draw)))
(add-debug-sphere
#t
@@ -1428,12 +1413,7 @@
)
(when (logtest? gp-4 (scene-controls scene-controls-7))
(dotimes (s5-4 (-> self scene actor length))
(let* ((s4-2 (handle->process (-> self scene actor s5-4 process)))
(v1-79 (if (type? s4-2 process-drawable)
(the-as process-drawable s4-2)
)
)
)
(let ((v1-79 (as-type (handle->process (-> self scene actor s5-4 process)) process-drawable)))
(if (and v1-79 (nonzero? (-> v1-79 draw)))
(format
*stdcon*
@@ -1452,12 +1432,7 @@
)
(when (logtest? gp-4 (scene-controls scene-controls-8))
(dotimes (gp-5 (-> self scene actor length))
(let* ((s5-5 (handle->process (-> self scene actor gp-5 process)))
(v1-94 (if (type? s5-5 process-drawable)
(the-as process-drawable s5-5)
)
)
)
(let ((v1-94 (as-type (handle->process (-> self scene actor gp-5 process)) process-drawable)))
(if (and v1-94 (nonzero? (-> v1-94 draw)))
(add-debug-text-3d
#t
@@ -1485,15 +1460,9 @@
(new 'stack 'font-context *font-default-matrix* 36 60 0.0 (font-color default) (font-flags shadow kerning))
)
)
(let ((v1-121 gp-6))
(set! (-> v1-121 width) (the float 440))
)
(let ((v1-122 gp-6))
(set! (-> v1-122 height) (the float 48))
)
(let ((v1-123 gp-6))
(set! (-> v1-123 scale) 0.5)
)
(set-width! gp-6 440)
(set-height! gp-6 48)
(set-scale! gp-6 0.5)
(set! (-> gp-6 flags) (font-flags shadow kerning middle large))
(print-game-text
(lookup-text!