mirror of
https://github.com/open-goal/jak-project
synced 2026-07-29 07:33:59 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
241 lines
8.6 KiB
Common Lisp
Vendored
Generated
241 lines
8.6 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type profile-segment
|
|
(deftype profile-segment (structure)
|
|
((name symbol)
|
|
(start-time int16)
|
|
(end-time int16)
|
|
(count uint8)
|
|
(vu-count uint8)
|
|
(depth uint16)
|
|
(color rgba)
|
|
(code-time uint16 :overlay-at start-time)
|
|
(vu-time uint16 :overlay-at end-time)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
;; definition for method 3 of type profile-segment
|
|
(defmethod inspect ((this profile-segment))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'profile-segment)
|
|
(format #t "~1Tname: ~A~%" (-> this name))
|
|
(format #t "~1Tstart-time: ~D~%" (-> this start-time))
|
|
(format #t "~1Tend-time: ~D~%" (-> this end-time))
|
|
(format #t "~1Tcount: ~D~%" (-> this count))
|
|
(format #t "~1Tvu-count: ~D~%" (-> this vu-count))
|
|
(format #t "~1Tdepth: ~D~%" (-> this depth))
|
|
(format #t "~1Tcolor: #x~X~%" (-> this color))
|
|
(format #t "~1Tcode-time: ~D~%" (-> this code-time))
|
|
(format #t "~1Tvu-time: ~D~%" (-> this vu-time))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type profile-collapse
|
|
(deftype profile-collapse (structure)
|
|
((count int32)
|
|
(data profile-segment 48 :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type profile-collapse
|
|
(defmethod inspect ((this profile-collapse))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'profile-collapse)
|
|
(format #t "~1Tcount: ~D~%" (-> this count))
|
|
(format #t "~1Tdata[48] @ #x~X~%" (-> this data))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type profile-segment-array
|
|
(deftype profile-segment-array (basic)
|
|
((count int16)
|
|
(depth int8)
|
|
(max-depth int8)
|
|
(base-time int16)
|
|
(segment profile-segment 9)
|
|
(data profile-segment 512 :inline)
|
|
)
|
|
(:methods
|
|
(get-total-time (_type_) int)
|
|
(start-frame! (_type_) none)
|
|
(start-segment! (_type_ symbol rgba) none)
|
|
(end-segment! (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type profile-segment-array
|
|
(defmethod inspect ((this profile-segment-array))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~1Tcount: ~D~%" (-> this count))
|
|
(format #t "~1Tdepth: ~D~%" (-> this depth))
|
|
(format #t "~1Tmax-depth: ~D~%" (-> this max-depth))
|
|
(format #t "~1Tbase-time: ~D~%" (-> this base-time))
|
|
(format #t "~1Tsegment[9] @ #x~X~%" (-> this segment))
|
|
(format #t "~1Tdata[512] @ #x~X~%" (-> this data))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type profile-array
|
|
(deftype profile-array (structure)
|
|
((data profile-segment-array 2)
|
|
)
|
|
(:methods
|
|
(setup-categories! (_type_) none)
|
|
(draw-bars! (_type_ dma-buffer int) none)
|
|
(draw-text! (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type profile-array
|
|
(defmethod inspect ((this profile-array))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'profile-array)
|
|
(format #t "~1Tdata[2] @ #x~X~%" (-> this data))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 9 of type profile-segment-array
|
|
(defmethod get-total-time ((this profile-segment-array))
|
|
(- (-> this data 0 end-time) (-> this data 0 start-time))
|
|
)
|
|
|
|
;; definition for symbol *profile-gap-color*, type rgba
|
|
(define *profile-gap-color* (new 'static 'rgba :r #x30 :g #x30 :b #x30 :a #x80))
|
|
|
|
;; definition for symbol *profile-all-color*, type rgba
|
|
(define *profile-all-color* (new 'static 'rgba :r #x55 :g #x55 :b #x55 :a #x80))
|
|
|
|
;; definition for symbol *profile-particles-color*, type rgba
|
|
(define *profile-particles-color* (new 'static 'rgba :r #x80 :g #x40 :b #x40 :a #x80))
|
|
|
|
;; definition for symbol *profile-target-color*, type rgba
|
|
(define *profile-target-color* (new 'static 'rgba :r #x40 :g #x80 :b #x40 :a #x80))
|
|
|
|
;; definition for symbol *profile-target-post-color*, type rgba
|
|
(define *profile-target-post-color* (new 'static 'rgba :r #x40 :g #x40 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-joints-color*, type rgba
|
|
(define *profile-joints-color* (new 'static 'rgba :r #x70 :g #x70 :b #x20 :a #x80))
|
|
|
|
;; definition for symbol *profile-debug-color*, type rgba
|
|
(define *profile-debug-color* (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-draw-hook-color*, type rgba
|
|
(define *profile-draw-hook-color* (new 'static 'rgba :r #x20 :g #x70 :b #x70 :a #x80))
|
|
|
|
;; definition for symbol *profile-sky-color*, type rgba
|
|
(define *profile-sky-color* (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80))
|
|
|
|
;; definition for symbol *profile-ocean-color*, type rgba
|
|
(define *profile-ocean-color* (new 'static 'rgba :r #x60 :g #x80 :b #x20 :a #x80))
|
|
|
|
;; definition for symbol *profile-background-color*, type rgba
|
|
(define *profile-background-color* (new 'static 'rgba :r #x60 :g #x60 :b #x40 :a #x80))
|
|
|
|
;; definition for symbol *profile-bsp-color*, type rgba
|
|
(define *profile-bsp-color* (new 'static 'rgba :r #x60 :g #x40 :b #x60 :a #x80))
|
|
|
|
;; definition for symbol *profile-foreground-color*, type rgba
|
|
(define *profile-foreground-color* (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80))
|
|
|
|
;; definition for symbol *profile-tfrag-color*, type rgba
|
|
(define *profile-tfrag-color* (new 'static 'rgba :r #x80 :g #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-instance-tie-color*, type rgba
|
|
(define *profile-instance-tie-color* (new 'static 'rgba :r #x80 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-instance-shrubbery-color*, type rgba
|
|
(define *profile-instance-shrubbery-color* (new 'static 'rgba :g #x80 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-generic-tie-color*, type rgba
|
|
(define *profile-generic-tie-color* (new 'static 'rgba :r #x80 :g #x20 :b #x60 :a #x80))
|
|
|
|
;; definition for symbol *profile-bones-color*, type rgba
|
|
(define *profile-bones-color* (new 'static 'rgba :r #x20 :g #x80 :b #x60 :a #x80))
|
|
|
|
;; definition for symbol *profile-generic-merc-color*, type rgba
|
|
(define *profile-generic-merc-color* (new 'static 'rgba :r #x20 :g #x60 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-shadow-color*, type rgba
|
|
(define *profile-shadow-color* (new 'static 'rgba :r #x48 :g #x48 :b #x70 :a #x80))
|
|
|
|
;; definition for symbol *profile-update-actors-color*, type rgba
|
|
(define *profile-update-actors-color* (new 'static 'rgba :r #x48 :g #x70 :b #x48 :a #x80))
|
|
|
|
;; definition for symbol *profile-menu-hook-color*, type rgba
|
|
(define *profile-menu-hook-color* (new 'static 'rgba :r #x70 :g #x48 :b #x48 :a #x80))
|
|
|
|
;; definition for symbol *profile-texture-color*, type rgba
|
|
(define *profile-texture-color* (new 'static 'rgba :r #x80 :g #x70 :b #x10 :a #x80))
|
|
|
|
;; definition for symbol *profile-effects-color*, type rgba
|
|
(define *profile-effects-color* (new 'static 'rgba :r #x70 :g #x80 :b #x10 :a #x80))
|
|
|
|
;; definition for symbol *profile-sprite-color*, type rgba
|
|
(define *profile-sprite-color* (new 'static 'rgba :r #x70 :g #x10 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-merc-color*, type rgba
|
|
(define *profile-merc-color* (new 'static 'rgba :r #x10 :g #x70 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-actors-color*, type rgba
|
|
(define *profile-actors-color* (new 'static 'rgba :r #x80 :g #x10 :b #x70 :a #x80))
|
|
|
|
;; definition for symbol *profile-collide-color*, type rgba
|
|
(define *profile-collide-color* (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-nav-color*, type rgba
|
|
(define *profile-nav-color* (new 'static 'rgba :r #x38 :g #x48 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-camera-color*, type rgba
|
|
(define *profile-camera-color* (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-blit-color*, type rgba
|
|
(define *profile-blit-color* (new 'static 'rgba :r #xff :g #xff :b #x80 :a #x80))
|
|
|
|
;; definition for symbol *profile-hud-color*, type rgba
|
|
(define *profile-hud-color* (new 'static 'rgba :r #xff :g #x80 :b #xff :a #x80))
|
|
|
|
;; definition for symbol *profile-emerc-color*, type rgba
|
|
(define *profile-emerc-color* (new 'static 'rgba :r #x80 :g #xff :b #xff :a #x80))
|
|
|
|
;; this part is debug only
|
|
(when *debug-segment*
|
|
;; definition for symbol *profile-array*, type profile-array
|
|
(define *profile-array* (new 'debug 'profile-array))
|
|
|
|
;; failed to figure out what this is:
|
|
(set! (-> *profile-array* data 0) (new 'debug 'profile-segment-array))
|
|
|
|
;; failed to figure out what this is:
|
|
(set! (-> *profile-array* data 1) (new 'debug 'profile-segment-array))
|
|
|
|
;; definition for symbol *profile-collapse*, type profile-collapse
|
|
(define *profile-collapse* (new 'debug 'profile-collapse))
|
|
|
|
;; definition for symbol *profile-interrupt-segment*, type profile-segment-array
|
|
(define *profile-interrupt-segment* (-> *profile-array* data 1))
|
|
|
|
;; definition for symbol *profile-interrupt-start*, type symbol
|
|
(define *profile-interrupt-start* #f)
|
|
|
|
)
|