Files
jak-project/test/decompiler/reference/jak1/engine/game/settings-h_REF.gc
T
ManDude cd68cb671e deftype and defmethod syntax major changes (#3094)
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>
2023-10-30 03:20:02 +00:00

158 lines
5.8 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type setting-data
(deftype setting-data (structure)
((border-mode symbol)
(sfx-volume float)
(music-volume float)
(dialog-volume float)
(process-mask process-mask)
(common-page int32)
(language language-enum)
(screenx int32)
(screeny int32)
(vibration symbol)
(play-hints symbol)
(movie (pointer process))
(talking (pointer process))
(spooling (pointer process))
(hint (pointer process))
(ambient (pointer process))
(video-mode symbol)
(aspect-ratio symbol)
(sound-flava uint8)
(auto-save symbol)
(music-volume-movie float)
(sfx-volume-movie float)
(music symbol)
(bg-r float)
(bg-g float)
(bg-b float)
(bg-a float)
(bg-a-speed float)
(bg-a-force float)
(allow-progress symbol)
(allow-pause symbol)
(sound-flava-priority float)
(ocean-off symbol)
(allow-look-around symbol)
(ambient-volume float)
(ambient-volume-movie float)
(dialog-volume-hint float)
(dummy uint32 11)
)
(:methods
(update-from-engine (_type_ engine) setting-data)
)
)
;; definition for method 3 of type setting-data
(defmethod inspect ((this setting-data))
(format #t "[~8x] ~A~%" this 'setting-data)
(format #t "~Tborder-mode: ~A~%" (-> this border-mode))
(format #t "~Tsfx-volume: ~f~%" (-> this sfx-volume))
(format #t "~Tmusic-volume: ~f~%" (-> this music-volume))
(format #t "~Tdialog-volume: ~f~%" (-> this dialog-volume))
(format #t "~Tprocess-mask: ~D~%" (-> this process-mask))
(format #t "~Tcommon-page: ~D~%" (-> this common-page))
(format #t "~Tlanguage: ~D~%" (-> this language))
(format #t "~Tscreenx: ~D~%" (-> this screenx))
(format #t "~Tscreeny: ~D~%" (-> this screeny))
(format #t "~Tvibration: ~A~%" (-> this vibration))
(format #t "~Tplay-hints: ~A~%" (-> this play-hints))
(format #t "~Tmovie: ~A~%" (ppointer->process (-> this movie)))
(format #t "~Ttalking: ~A~%" (ppointer->process (-> this talking)))
(format #t "~Tspooling: ~A~%" (ppointer->process (-> this spooling)))
(format #t "~Thint: ~A~%" (ppointer->process (-> this hint)))
(format #t "~Tambient: ~A~%" (ppointer->process (-> this ambient)))
(format #t "~Tvideo-mode: ~A~%" (-> this video-mode))
(format #t "~Taspect-ratio: ~A~%" (-> this aspect-ratio))
(format #t "~Tsound-flava: ~D~%" (-> this sound-flava))
(format #t "~Tauto-save: ~A~%" (-> this auto-save))
(format #t "~Tmusic-volume-movie: ~f~%" (-> this music-volume-movie))
(format #t "~Tsfx-volume-movie: ~f~%" (-> this sfx-volume-movie))
(format #t "~Tmusic: ~A~%" (-> this music))
(format #t "~Tbg-r: ~f~%" (-> this bg-r))
(format #t "~Tbg-g: ~f~%" (-> this bg-g))
(format #t "~Tbg-b: ~f~%" (-> this bg-b))
(format #t "~Tbg-a: ~f~%" (-> this bg-a))
(format #t "~Tbg-a-speed: ~f~%" (-> this bg-a-speed))
(format #t "~Tbg-a-force: ~f~%" (-> this bg-a-force))
(format #t "~Tallow-progress: ~A~%" (-> this allow-progress))
(format #t "~Tallow-pause: ~A~%" (-> this allow-pause))
(format #t "~Tsound-flava-priority: ~f~%" (-> this sound-flava-priority))
(format #t "~Tocean-off: ~A~%" (-> this ocean-off))
(format #t "~Tallow-look-around: ~A~%" (-> this allow-look-around))
(format #t "~Tambient-volume: ~f~%" (-> this ambient-volume))
(format #t "~Tambient-volume-movie: ~f~%" (-> this ambient-volume-movie))
(format #t "~Tdialog-volume-hint: ~f~%" (-> this dialog-volume-hint))
(format #t "~Tdummy[11] @ #x~X~%" (-> this dummy))
this
)
;; definition of type setting-control
(deftype setting-control (basic)
((current setting-data :inline)
(target setting-data :inline)
(default setting-data :inline)
(engine engine)
)
(:methods
(new (symbol type int) _type_)
(add-setting (_type_ process symbol object object object) none)
(set-setting (_type_ process symbol object object object) none)
(remove-setting (_type_ process symbol) none)
(apply-settings (_type_) setting-data)
(update (_type_) setting-data)
)
)
;; definition for method 3 of type setting-control
(defmethod inspect ((this setting-control))
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~Tcurrent: #<setting-data @ #x~X>~%" (-> this current))
(format #t "~Ttarget: #<setting-data @ #x~X>~%" (-> this target))
(format #t "~Tdefault: #<setting-data @ #x~X>~%" (-> this default))
(format #t "~Tengine: ~A~%" (-> this engine))
this
)
;; definition for method 0 of type setting-control
(defmethod new setting-control ((allocation symbol) (type-to-make type) (arg0 int))
(let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control arg0))
s4-0
)
)
;; definition of type scf-time
(deftype scf-time (structure)
((stat uint8)
(second uint8)
(minute uint8)
(hour uint8)
(week uint8)
(day uint8)
(month uint8)
(year uint8)
)
)
;; definition for method 3 of type scf-time
(defmethod inspect ((this scf-time))
(format #t "[~8x] ~A~%" this 'scf-time)
(format #t "~Tstat: ~D~%" (-> this stat))
(format #t "~Tsecond: #x~X~%" (-> this second))
(format #t "~Tminute: #x~X~%" (-> this minute))
(format #t "~Thour: #x~X~%" (-> this hour))
(format #t "~Tweek: #x~X~%" (-> this week))
(format #t "~Tday: #x~X~%" (-> this day))
(format #t "~Tmonth: #x~X~%" (-> this month))
(format #t "~Tyear: #x~X~%" (-> this year))
this
)
;; failed to figure out what this is:
0