mirror of
https://github.com/open-goal/jak-project
synced 2026-08-07 10:16:45 -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>
447 lines
17 KiB
Common Lisp
Vendored
Generated
447 lines
17 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
(local-vars (gp-0 game-info))
|
|
|
|
;; definition of type game-bank
|
|
(deftype game-bank (basic)
|
|
((life-max-default float)
|
|
(life-start-default float)
|
|
(life-single-inc float)
|
|
(money-task-inc float)
|
|
(money-oracle-inc float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type game-bank
|
|
(defmethod inspect ((this game-bank))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~1Tlife-max-default: ~f~%" (-> this life-max-default))
|
|
(format #t "~1Tlife-start-default: ~f~%" (-> this life-start-default))
|
|
(format #t "~1Tlife-single-inc: ~f~%" (-> this life-single-inc))
|
|
(format #t "~1Tmoney-task-inc: ~f~%" (-> this money-task-inc))
|
|
(format #t "~1Tmoney-oracle-inc: ~f~%" (-> this money-oracle-inc))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for symbol *GAME-bank*, type game-bank
|
|
(define *GAME-bank* (new 'static 'game-bank
|
|
:life-max-default 99.0
|
|
:life-start-default 5.0
|
|
:life-single-inc 1.0
|
|
:money-task-inc 90.0
|
|
:money-oracle-inc 120.0
|
|
)
|
|
)
|
|
|
|
;; definition of type actor-id
|
|
(deftype actor-id (uint32)
|
|
()
|
|
)
|
|
|
|
;; definition of type highscore-info
|
|
(deftype highscore-info (structure)
|
|
((flags highscore-flags)
|
|
(award-scores float 3)
|
|
(bronze-score float :overlay-at (-> award-scores 0))
|
|
(silver-score float :overlay-at (-> award-scores 1))
|
|
(gold-score float :overlay-at (-> award-scores 2))
|
|
)
|
|
(:methods
|
|
(get-rank (_type_ float) int)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type highscore-info
|
|
(defmethod inspect ((this highscore-info))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'highscore-info)
|
|
(format #t "~1Tflags: ~D~%" (-> this flags))
|
|
(format #t "~1Taward-scores[3] @ #x~X~%" (-> this award-scores))
|
|
(format #t "~1Tbronze-score: ~f~%" (-> this bronze-score))
|
|
(format #t "~1Tsilver-score: ~f~%" (-> this silver-score))
|
|
(format #t "~1Tgold-score: ~f~%" (-> this gold-score))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type level-buffer-state
|
|
(deftype level-buffer-state (structure)
|
|
((name symbol)
|
|
(display? symbol)
|
|
(force-vis? symbol)
|
|
(force-inside? symbol)
|
|
)
|
|
:pack-me
|
|
)
|
|
|
|
;; definition for method 3 of type level-buffer-state
|
|
(defmethod inspect ((this level-buffer-state))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'level-buffer-state)
|
|
(format #t "~1Tname: ~A~%" (-> this name))
|
|
(format #t "~1Tdisplay?: ~A~%" (-> this display?))
|
|
(format #t "~1Tforce-vis?: ~A~%" (-> this force-vis?))
|
|
(format #t "~1Tforce-inside?: ~A~%" (-> this force-inside?))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type load-state
|
|
(deftype load-state (basic)
|
|
((want level-buffer-state 6 :inline)
|
|
(want-sound symbol 3)
|
|
(vis-nick symbol)
|
|
(command-list pair)
|
|
(object-name string 256)
|
|
(object-status basic 256)
|
|
)
|
|
(:methods
|
|
(new (symbol type) _type_)
|
|
(reset! (_type_) _type_)
|
|
(update! (_type_) int)
|
|
(want-levels (_type_ (pointer symbol)) int)
|
|
(want-sound-banks (_type_ (pointer symbol)) none)
|
|
(want-display-level (_type_ symbol symbol) int)
|
|
(want-vis-level (_type_ symbol) none)
|
|
(want-force-vis (_type_ symbol symbol) int)
|
|
(want-force-inside (_type_ symbol symbol) none)
|
|
(execute-commands-up-to (_type_ float) none)
|
|
(backup-load-state-and-set-cmds (_type_ pair) int)
|
|
(restore-load-state-and-cleanup (_type_) int)
|
|
(restore-load-state (_type_) int)
|
|
(add-borrow-levels (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type load-state
|
|
(defmethod inspect ((this load-state))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-10)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~1Twant[6] @ #x~X~%" (-> this want))
|
|
(dotimes (s5-0 6)
|
|
(format #t "~T [~D]~1Twant: ~`level-buffer-state`P~%" s5-0 (-> this want s5-0))
|
|
)
|
|
(format #t "~1Twant-sound[3] @ #x~X~%" (-> this want-sound))
|
|
(dotimes (s5-1 3)
|
|
(format #t "~T [~D]~1Twant-sound: ~`symbol`P~%" s5-1 (-> this want-sound s5-1))
|
|
)
|
|
(format #t "~1Tvis-nick: ~A~%" (-> this vis-nick))
|
|
(format #t "~1Tcommand-list: ~A~%" (-> this command-list))
|
|
(format #t "~1Tobject-name[256] @ #x~X~%" (-> this object-name))
|
|
(format #t "~1Tobject-status[256] @ #x~X~%" (-> this object-status))
|
|
(label cfg-10)
|
|
this
|
|
)
|
|
|
|
;; definition for method 0 of type load-state
|
|
(defmethod new load-state ((allocation symbol) (type-to-make type))
|
|
(reset! (object-new allocation type-to-make (the-as int (-> type-to-make size))))
|
|
)
|
|
|
|
;; definition of type continue-point
|
|
(deftype continue-point (basic)
|
|
((name string)
|
|
(level symbol)
|
|
(flags continue-flags)
|
|
(trans vector :inline)
|
|
(quat vector :inline)
|
|
(camera-trans vector :inline)
|
|
(camera-rot vector3s 3 :inline)
|
|
(on-goto pair)
|
|
(vis-nick symbol)
|
|
(want level-buffer-state 6 :inline)
|
|
(want-sound symbol 3)
|
|
)
|
|
(:methods
|
|
(debug-draw (_type_) int)
|
|
(continue-point-method-10 (_type_ load-state) continue-point)
|
|
(move-camera! (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type continue-point
|
|
(defmethod inspect ((this continue-point))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-10)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~1Tname: ~A~%" (-> this name))
|
|
(format #t "~1Tlevel: ~A~%" (-> this level))
|
|
(format #t "~1Tflags: ~D~%" (-> this flags))
|
|
(format #t "~1Ttrans: ~`vector`P~%" (-> this trans))
|
|
(format #t "~1Tquat: ~`vector`P~%" (-> this quat))
|
|
(format #t "~1Tcamera-trans: ~`vector`P~%" (-> this camera-trans))
|
|
(format #t "~1Tcamera-rot[9] @ #x~X~%" (-> this camera-rot))
|
|
(format #t "~1Ton-goto: ~A~%" (-> this on-goto))
|
|
(format #t "~1Tvis-nick: ~A~%" (-> this vis-nick))
|
|
(format #t "~1Twant[6] @ #x~X~%" (-> this want))
|
|
(dotimes (s5-0 6)
|
|
(format #t "~T [~D]~1Twant: ~`level-buffer-state`P~%" s5-0 (-> this want s5-0))
|
|
)
|
|
(format #t "~1Twant-sound[3] @ #x~X~%" (-> this want-sound))
|
|
(dotimes (s5-1 3)
|
|
(format #t "~T [~D]~1Twant-sound: ~`symbol`P~%" s5-1 (-> this want-sound s5-1))
|
|
)
|
|
(label cfg-10)
|
|
this
|
|
)
|
|
|
|
;; definition of type game-info
|
|
(deftype game-info (basic)
|
|
((mode symbol)
|
|
(save-name string)
|
|
(life float)
|
|
(life-max float)
|
|
(money float)
|
|
(money-total float)
|
|
(money-per-level uint8 32)
|
|
(deaths-per-level uint8 32)
|
|
(buzzer-total float)
|
|
(fuel float)
|
|
(gem float)
|
|
(gem-total float)
|
|
(skill float)
|
|
(skill-total float)
|
|
(karma float)
|
|
(eco-pill-dark float)
|
|
(eco-pill-dark-total float)
|
|
(features game-feature)
|
|
(debug-features game-feature)
|
|
(secrets game-secrets)
|
|
(unknown-pad1 uint32)
|
|
(purchase-secrets game-secrets)
|
|
(unknown-pad2 uint32)
|
|
(gun-type pickup-type)
|
|
(gun-ammo float 4)
|
|
(shield float)
|
|
(score float)
|
|
(score-owner handle)
|
|
(timer time-frame)
|
|
(timer-owner handle)
|
|
(timer-flash symbol)
|
|
(counter float)
|
|
(counter-flash basic)
|
|
(attack-id uint32)
|
|
(perm-list entity-perm-array)
|
|
(task-perm-list entity-perm-array)
|
|
(current-continue continue-point)
|
|
(last-continue continue-point)
|
|
(play-list (array game-task-info))
|
|
(sub-task-list (array game-task-node-info))
|
|
(mission-list (array game-task-node-info))
|
|
(task-counter uint32)
|
|
(unknown-pad6 (array uint16))
|
|
(level-opened uint8 32)
|
|
(total-deaths int32)
|
|
(continue-deaths int32)
|
|
(task-deaths int32)
|
|
(total-trys int32)
|
|
(game-start-time time-frame)
|
|
(continue-time time-frame)
|
|
(death-time time-frame)
|
|
(hit-time time-frame)
|
|
(task-pickup-time time-frame)
|
|
(unknown-array1 (array time-frame))
|
|
(task-enter-times (array time-frame))
|
|
(task-in-times (array time-frame))
|
|
(death-pos vector-array :offset 372)
|
|
(stop-watch-start uint64)
|
|
(stop-watch-stop uint64)
|
|
(blackout-time time-frame)
|
|
(letterbox-time time-frame)
|
|
(hint-play-time time-frame)
|
|
(display-text-time time-frame)
|
|
(display-text-handle handle)
|
|
(death-movie-tick int32)
|
|
(want-auto-save symbol)
|
|
(auto-save-proc handle)
|
|
(auto-save-status mc-status-code)
|
|
(auto-save-card int32)
|
|
(auto-save-which int32)
|
|
(auto-save-count int32)
|
|
(pov-camera-handle handle)
|
|
(other-camera-handle handle)
|
|
(controller handle 2)
|
|
(race-timer uint64)
|
|
(race-current-lap-count int32)
|
|
(race-total-lap-count int32)
|
|
(race-position int32)
|
|
(race-number-turbos int32)
|
|
(bot-health float 3)
|
|
(demo-state uint32)
|
|
(wanted-flash symbol)
|
|
(distance float)
|
|
(kiosk-timeout uint64)
|
|
(pause-start-time time-frame)
|
|
(game-score (array float))
|
|
(goal float)
|
|
(miss float)
|
|
(miss-max float)
|
|
(task-close-times (array time-frame))
|
|
(live-eco-pill-count int32)
|
|
(live-gem-count int32)
|
|
(air-supply float)
|
|
(homing-beacon int32)
|
|
(dark-eco-pickup int32)
|
|
(green-eco-pickup int32)
|
|
)
|
|
(:methods
|
|
(initialize! (_type_ symbol game-save string) _type_)
|
|
(give (_type_ symbol float handle) float)
|
|
(task-complete? (_type_ game-task) symbol)
|
|
(subtask-index-by-name (_type_ string) int)
|
|
(set-subtask-hook! (_type_ game-task-node int function) function)
|
|
(actor-perm (_type_ actor-id) entity-perm)
|
|
(task-perm-by-index (_type_ int) entity-perm)
|
|
(copy-perms-from-level! (_type_ level) int)
|
|
(copy-perms-to-level! (_type_ level) int)
|
|
(debug-inspect (_type_ symbol) _type_)
|
|
(get-current-continue-forced (_type_) continue-point)
|
|
(get-continue-by-name (_type_ string) continue-point)
|
|
(set-continue! (_type_ basic symbol) continue-point)
|
|
(game-info-method-22 (_type_) int)
|
|
(save-game (_type_ game-save string) game-save)
|
|
(load-game (_type_ game-save) game-save)
|
|
(you-suck-stage (_type_ symbol) int)
|
|
(you-suck-scale (_type_ object) float)
|
|
(get-next-attack-id (_type_) uint)
|
|
(game-info-method-28 (_type_ game-score float) int)
|
|
(get-game-score-ref (_type_ int) (pointer float))
|
|
(calculate-percentage (_type_) float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type game-info
|
|
(defmethod inspect ((this game-info))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~1Tmode: ~A~%" (-> this mode))
|
|
(format #t "~1Tsave-name: ~A~%" (-> this save-name))
|
|
(format #t "~1Tlife: ~f~%" (-> this life))
|
|
(format #t "~1Tlife-max: ~f~%" (-> this life-max))
|
|
(format #t "~1Tmoney: ~f~%" (-> this money))
|
|
(format #t "~1Tmoney-total: ~f~%" (-> this money-total))
|
|
(format #t "~1Tmoney-per-level[32] @ #x~X~%" (-> this money-per-level))
|
|
(format #t "~1Tdeaths-per-level[32] @ #x~X~%" (-> this deaths-per-level))
|
|
(format #t "~1Tbuzzer-total: ~f~%" (-> this buzzer-total))
|
|
(format #t "~1Tfuel: ~f~%" (-> this fuel))
|
|
(format #t "~1Tgem: ~f~%" (-> this gem))
|
|
(format #t "~1Tgem-total: ~f~%" (-> this gem-total))
|
|
(format #t "~1Tskill: ~f~%" (-> this skill))
|
|
(format #t "~1Tskill-total: ~f~%" (-> this skill-total))
|
|
(format #t "~1Tkarma: ~f~%" (-> this karma))
|
|
(format #t "~1Teco-pill-dark: ~f~%" (-> this eco-pill-dark))
|
|
(format #t "~1Teco-pill-dark-total: ~f~%" (-> this eco-pill-dark-total))
|
|
(format #t "~1Tfeatures: ~D~%" (-> this features))
|
|
(format #t "~1Tdebug-features: ~D~%" (-> this debug-features))
|
|
(format #t "~1Tsecrets: ~D~%" (-> this secrets))
|
|
(format #t "~1Tpurchase-secrets: ~D~%" (-> this purchase-secrets))
|
|
(format #t "~1Tgun-type: ~D~%" (-> this gun-type))
|
|
(format #t "~1Tgun-ammo[4] @ #x~X~%" (-> this gun-ammo))
|
|
(format #t "~1Tshield: ~f~%" (-> this shield))
|
|
(format #t "~1Tscore: ~f~%" (-> this score))
|
|
(format #t "~1Tscore-owner: ~D~%" (-> this score-owner))
|
|
(format #t "~1Ttimer: ~D~%" (-> this timer))
|
|
(format #t "~1Ttimer-owner: ~D~%" (-> this timer-owner))
|
|
(format #t "~1Ttimer-flash: ~A~%" (-> this timer-flash))
|
|
(format #t "~1Tcounter: ~f~%" (-> this counter))
|
|
(format #t "~1Tcounter-flash: ~A~%" (-> this counter-flash))
|
|
(format #t "~1Tattack-id: ~D~%" (-> this attack-id))
|
|
(format #t "~1Tperm-list: ~A~%" (-> this perm-list))
|
|
(format #t "~1Ttask-perm-list: ~A~%" (-> this task-perm-list))
|
|
(format #t "~1Tcurrent-continue: ~A~%" (-> this current-continue))
|
|
(format #t "~1Tlast-continue: ~A~%" (-> this last-continue))
|
|
(format #t "~1Ttask-counter: ~D~%" (-> this task-counter))
|
|
(format #t "~1Tlevel-opened[32] @ #x~X~%" (-> this level-opened))
|
|
(format #t "~1Ttotal-deaths: ~D~%" (-> this total-deaths))
|
|
(format #t "~1Tcontinue-deaths: ~D~%" (-> this continue-deaths))
|
|
(format #t "~1Ttask-deaths: ~D~%" (-> this task-deaths))
|
|
(format #t "~1Ttotal-trys: ~D~%" (-> this total-trys))
|
|
(format #t "~1Tgame-start-time: ~D~%" (-> this game-start-time))
|
|
(format #t "~1Tcontinue-time: ~D~%" (-> this continue-time))
|
|
(format #t "~1Tdeath-time: ~D~%" (-> this death-time))
|
|
(format #t "~1Thit-time: ~D~%" (-> this hit-time))
|
|
(format #t "~1Ttask-pickup-time: ~D~%" (-> this task-pickup-time))
|
|
(format #t "~1Tdeath-pos: ~A~%" (-> this death-pos))
|
|
(format #t "~1Tstop-watch-start: ~D~%" (-> this stop-watch-start))
|
|
(format #t "~1Tstop-watch-stop: ~D~%" (-> this stop-watch-stop))
|
|
(format #t "~1Tblackout-time: ~D~%" (-> this blackout-time))
|
|
(format #t "~1Tletterbox-time: ~D~%" (-> this letterbox-time))
|
|
(format #t "~1Thint-play-time: ~D~%" (-> this hint-play-time))
|
|
(format #t "~1Tdisplay-text-time: ~D~%" (-> this display-text-time))
|
|
(format #t "~1Tdisplay-text-handle: ~D~%" (-> this display-text-handle))
|
|
(format #t "~1Tdeath-movie-tick: ~D~%" (-> this death-movie-tick))
|
|
(format #t "~1Twant-auto-save: ~A~%" (-> this want-auto-save))
|
|
(format #t "~1Tauto-save-proc: ~D~%" (-> this auto-save-proc))
|
|
(format #t "~1Tauto-save-status: ~D~%" (-> this auto-save-status))
|
|
(format #t "~1Tauto-save-card: ~D~%" (-> this auto-save-card))
|
|
(format #t "~1Tauto-save-which: ~D~%" (-> this auto-save-which))
|
|
(format #t "~1Tauto-save-count: ~D~%" (-> this auto-save-count))
|
|
(format #t "~1Tpov-camera-handle: ~D~%" (-> this pov-camera-handle))
|
|
(format #t "~1Tother-camera-handle: ~D~%" (-> this other-camera-handle))
|
|
(format #t "~1Tcontroller[2] @ #x~X~%" (-> this controller))
|
|
(format #t "~1Trace-timer: ~D~%" (-> this race-timer))
|
|
(format #t "~1Trace-current-lap-count: ~D~%" (-> this race-current-lap-count))
|
|
(format #t "~1Trace-total-lap-count: ~D~%" (-> this race-total-lap-count))
|
|
(format #t "~1Trace-position: ~D~%" (-> this race-position))
|
|
(format #t "~1Trace-number-turbos: ~D~%" (-> this race-number-turbos))
|
|
(format #t "~1Tbot-health[3] @ #x~X~%" (-> this bot-health))
|
|
(format #t "~1Tdemo-state: ~D~%" (-> this demo-state))
|
|
(format #t "~1Twanted-flash: ~A~%" (-> this wanted-flash))
|
|
(format #t "~1Tdistance: ~f~%" (-> this distance))
|
|
(format #t "~1Tkiosk-timeout: ~D~%" (-> this kiosk-timeout))
|
|
(format #t "~1Tpause-start-time: ~D~%" (-> this pause-start-time))
|
|
(format #t "~1Tgame-score: ~A~%" (-> this game-score))
|
|
(format #t "~1Tgoal: ~f~%" (-> this goal))
|
|
(format #t "~1Tmiss: ~f~%" (-> this miss))
|
|
(format #t "~1Tmiss-max: ~f~%" (-> this miss-max))
|
|
(format #t "~1Tlive-eco-pill-count: ~D~%" (-> this live-eco-pill-count))
|
|
(format #t "~1Tlive-gem-count: ~D~%" (-> this live-gem-count))
|
|
(format #t "~1Tair-supply: ~f~%" (-> this air-supply))
|
|
(format #t "~1Thoming-beacon: ~D~%" (-> this homing-beacon))
|
|
(format #t "~1Tdark-eco-pickup: ~D~%" (-> this dark-eco-pickup))
|
|
(format #t "~1Tgreen-eco-pickup: ~D~%" (-> this green-eco-pickup))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 27 of type game-info
|
|
(defmethod get-next-attack-id ((this game-info))
|
|
(let ((v0-0 (+ (-> this attack-id) 1)))
|
|
(set! (-> this attack-id) v0-0)
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(set! gp-0
|
|
(when (or (not *game-info*) (zero? *game-info*))
|
|
(set! gp-0 (new 'static 'game-info :mode 'debug :current-continue #f :last-continue #f))
|
|
(set! (-> gp-0 unknown-array1) (the-as (array time-frame) (new 'global 'boxed-array uint64 110)))
|
|
(set! (-> gp-0 task-close-times) (the-as (array time-frame) (new 'global 'boxed-array uint64 110)))
|
|
(set! (-> gp-0 task-enter-times) (the-as (array time-frame) (new 'global 'boxed-array uint64 32)))
|
|
(set! (-> gp-0 task-in-times) (the-as (array time-frame) (new 'global 'boxed-array uint64 32)))
|
|
(set! *game-info* gp-0)
|
|
gp-0
|
|
)
|
|
)
|