mirror of
https://github.com/open-goal/jak-project
synced 2026-06-20 16:21:35 -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>
217 lines
6.2 KiB
Common Lisp
Vendored
Generated
217 lines
6.2 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type sync-info
|
|
(deftype sync-info (structure)
|
|
((offset float)
|
|
(period uint32)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(get-current-value (_type_ float) float)
|
|
(get-current-phase-no-mod (_type_) float)
|
|
(get-current-phase (_type_) float)
|
|
(get-current-value-with-mirror (_type_ float) float)
|
|
(get-current-phase-with-mirror (_type_) float)
|
|
(setup-params! (_type_ uint float float float) none)
|
|
(load-params! (_type_ process uint float float float) symbol)
|
|
(sync-now! (_type_ float) float)
|
|
(get-phase-offset (_type_) float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type sync-info
|
|
(defmethod inspect ((this sync-info))
|
|
(format #t "[~8x] ~A~%" this 'sync-info)
|
|
(format #t "~Toffset: ~f~%" (-> this offset))
|
|
(format #t "~Tperiod: ~D~%" (-> this period))
|
|
this
|
|
)
|
|
|
|
;; definition of type sync-info-eased
|
|
(deftype sync-info-eased (sync-info)
|
|
((tlo float)
|
|
(thi float)
|
|
(ylo float)
|
|
(m2 float)
|
|
(yend float)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
;; definition for method 3 of type sync-info-eased
|
|
(defmethod inspect ((this sync-info-eased))
|
|
(format #t "[~8x] ~A~%" this 'sync-info-eased)
|
|
(format #t "~Toffset: ~f~%" (-> this offset))
|
|
(format #t "~Tperiod: ~D~%" (-> this period))
|
|
(format #t "~Ttlo: ~f~%" (-> this tlo))
|
|
(format #t "~Tthi: ~f~%" (-> this thi))
|
|
(format #t "~Tylo: ~f~%" (-> this ylo))
|
|
(format #t "~Tm2: ~f~%" (-> this m2))
|
|
(format #t "~Tyend: ~f~%" (-> this yend))
|
|
this
|
|
)
|
|
|
|
;; definition of type sync-info-paused
|
|
(deftype sync-info-paused (sync-info)
|
|
((pause-after-out float)
|
|
(pause-after-in float)
|
|
)
|
|
:pack-me
|
|
)
|
|
|
|
;; definition for method 3 of type sync-info-paused
|
|
(defmethod inspect ((this sync-info-paused))
|
|
(format #t "[~8x] ~A~%" this 'sync-info-paused)
|
|
(format #t "~Toffset: ~f~%" (-> this offset))
|
|
(format #t "~Tperiod: ~D~%" (-> this period))
|
|
(format #t "~Tpause-after-out: ~f~%" (-> this pause-after-out))
|
|
(format #t "~Tpause-after-in: ~f~%" (-> this pause-after-in))
|
|
this
|
|
)
|
|
|
|
;; definition of type delayed-rand-float
|
|
(deftype delayed-rand-float (structure)
|
|
((min-time int32)
|
|
(max-time int32)
|
|
(max-val float)
|
|
(timer int32)
|
|
(start-time time-frame)
|
|
(value float)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(set-params! (_type_ int int float) float)
|
|
(update! (_type_) float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type delayed-rand-float
|
|
(defmethod inspect ((this delayed-rand-float))
|
|
(format #t "[~8x] ~A~%" this 'delayed-rand-float)
|
|
(format #t "~Tmin-time: ~D~%" (-> this min-time))
|
|
(format #t "~Tmax-time: ~D~%" (-> this max-time))
|
|
(format #t "~Tmax-val: ~f~%" (-> this max-val))
|
|
(format #t "~Ttimer: ~D~%" (-> this timer))
|
|
(format #t "~Tstart-time: ~D~%" (-> this start-time))
|
|
(format #t "~Tvalue: ~f~%" (-> this value))
|
|
this
|
|
)
|
|
|
|
;; definition of type oscillating-float
|
|
(deftype oscillating-float (structure)
|
|
((value float)
|
|
(target float)
|
|
(vel float)
|
|
(max-vel float)
|
|
(damping float)
|
|
(accel float)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(set-params! (_type_ float float float float) float)
|
|
(update! (_type_ float) float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type oscillating-float
|
|
(defmethod inspect ((this oscillating-float))
|
|
(format #t "[~8x] ~A~%" this 'oscillating-float)
|
|
(format #t "~Tvalue: ~f~%" (-> this value))
|
|
(format #t "~Ttarget: ~f~%" (-> this target))
|
|
(format #t "~Tvel: ~f~%" (-> this vel))
|
|
(format #t "~Tmax-vel: ~f~%" (-> this max-vel))
|
|
(format #t "~Tdamping: ~f~%" (-> this damping))
|
|
(format #t "~Taccel: ~f~%" (-> this accel))
|
|
this
|
|
)
|
|
|
|
;; definition of type bouncing-float
|
|
(deftype bouncing-float (structure)
|
|
((osc oscillating-float :inline)
|
|
(max-value float)
|
|
(min-value float)
|
|
(elasticity float)
|
|
(state int32)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(set-params! (_type_ float float float float float float float) float)
|
|
(update! (_type_ float) float)
|
|
(at-min? (_type_) symbol)
|
|
(at-max? (_type_) symbol)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type bouncing-float
|
|
(defmethod inspect ((this bouncing-float))
|
|
(format #t "[~8x] ~A~%" this 'bouncing-float)
|
|
(format #t "~Tosc: #<oscillating-float @ #x~X>~%" (-> this osc))
|
|
(format #t "~Tmax-value: ~f~%" (-> this max-value))
|
|
(format #t "~Tmin-value: ~f~%" (-> this min-value))
|
|
(format #t "~Telasticity: ~f~%" (-> this elasticity))
|
|
(format #t "~Tstate: ~D~%" (-> this state))
|
|
this
|
|
)
|
|
|
|
;; definition of type delayed-rand-vector
|
|
(deftype delayed-rand-vector (structure)
|
|
((min-time int32)
|
|
(max-time int32)
|
|
(xz-max float)
|
|
(y-max float)
|
|
(timer int32)
|
|
(start-time time-frame)
|
|
(value vector :inline)
|
|
)
|
|
(:methods
|
|
(set-params! (_type_ int int float float) vector)
|
|
(update-now! (_type_) vector)
|
|
(update-with-delay! (_type_) vector)
|
|
(update-with-delay-or-reset! (_type_) vector)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type delayed-rand-vector
|
|
(defmethod inspect ((this delayed-rand-vector))
|
|
(format #t "[~8x] ~A~%" this 'delayed-rand-vector)
|
|
(format #t "~Tmin-time: ~D~%" (-> this min-time))
|
|
(format #t "~Tmax-time: ~D~%" (-> this max-time))
|
|
(format #t "~Txz-max: ~f~%" (-> this xz-max))
|
|
(format #t "~Ty-max: ~f~%" (-> this y-max))
|
|
(format #t "~Ttimer: ~D~%" (-> this timer))
|
|
(format #t "~Tstart-time: ~D~%" (-> this start-time))
|
|
(format #t "~Tvalue: #<vector @ #x~X>~%" (-> this value))
|
|
this
|
|
)
|
|
|
|
;; definition of type oscillating-vector
|
|
(deftype oscillating-vector (structure)
|
|
((value vector :inline)
|
|
(target vector :inline)
|
|
(vel vector :inline)
|
|
(max-vel float)
|
|
(damping float)
|
|
(accel float)
|
|
)
|
|
(:methods
|
|
(set-params! (_type_ vector float float float) vector)
|
|
(update! (_type_ vector) vector)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type oscillating-vector
|
|
(defmethod inspect ((this oscillating-vector))
|
|
(format #t "[~8x] ~A~%" this 'oscillating-vector)
|
|
(format #t "~Tvalue: #<vector @ #x~X>~%" (-> this value))
|
|
(format #t "~Ttarget: #<vector @ #x~X>~%" (-> this target))
|
|
(format #t "~Tvel: #<vector @ #x~X>~%" (-> this vel))
|
|
(format #t "~Tmax-vel: ~f~%" (-> this max-vel))
|
|
(format #t "~Tdamping: ~f~%" (-> this damping))
|
|
(format #t "~Taccel: ~f~%" (-> this accel))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|