Files
jak-project/test/decompiler/reference/jak2/engine/sound/speech-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

152 lines
4.7 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type speech-type-info
(deftype speech-type-info (structure)
((channel uint8)
(flags speech-type-flag)
(priority int8)
(request-timeout uint16)
(min-delay uint16)
(max-delay uint16)
(delay uint16)
(play-index int16)
(list (array string))
)
)
;; definition for method 3 of type speech-type-info
(defmethod inspect ((this speech-type-info))
(when (not this)
(set! this this)
(goto cfg-6)
)
(format #t "[~8x] ~A~%" this 'speech-type-info)
(format #t "~1Tchannel: ~D~%" (-> this channel))
(format #t "~1Tflags: #x~X : (speech-type-flag " (-> this flags))
(let ((a0-4 (-> this flags)))
(if (= (logand a0-4 (speech-type-flag random-order)) (speech-type-flag random-order))
(format #t "random-order ")
)
)
(format #t ")~%")
(format #t "~1Tpriority: ~D~%" (-> this priority))
(format #t "~1Trequest-timeout: ~D~%" (-> this request-timeout))
(format #t "~1Tmin-delay: ~D~%" (-> this min-delay))
(format #t "~1Tmax-delay: ~D~%" (-> this max-delay))
(format #t "~1Tdelay: ~D~%" (-> this delay))
(format #t "~1Tplay-index: ~D~%" (-> this play-index))
(format #t "~1Tlist: ~A~%" (-> this list))
(label cfg-6)
this
)
;; definition of type speech-request
(deftype speech-request (structure)
((handle handle)
(time time-frame)
(priority float)
(speech-type speech-type)
)
:pack-me
)
;; definition for method 3 of type speech-request
(defmethod inspect ((this speech-request))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'speech-request)
(format #t "~1Thandle: ~D~%" (-> this handle))
(format #t "~1Ttime: ~D~%" (-> this time))
(format #t "~1Tpriority: ~f~%" (-> this priority))
(format #t "~1Tspeech-type: ~D~%" (-> this speech-type))
(label cfg-4)
this
)
;; definition of type speech-channel
(deftype speech-channel (structure)
((flags speech-channel-flag)
(gui-channel gui-channel)
(delay uint16)
(id sound-id)
(update-time time-frame)
(start-time time-frame)
(end-time time-frame)
(request speech-request :inline)
(last-request speech-request :inline)
(target-pos vector :inline)
(speech-table (pointer speech-type-info))
)
(:methods
(speech-channel-method-9 (_type_ process-drawable speech-type) none)
(speech-channel-method-10 (_type_ handle) none)
(speech-channel-method-11 (_type_) none)
(speech-channel-method-12 (_type_) none)
(speech-channel-method-13 (_type_) none)
)
)
;; definition for method 3 of type speech-channel
(defmethod inspect ((this speech-channel))
(when (not this)
(set! this this)
(goto cfg-6)
)
(format #t "[~8x] ~A~%" this 'speech-channel)
(format #t "~1Tflags: #x~X : (speech-channel-flag " (-> this flags))
(let ((a0-3 (-> this flags)))
(if (= (logand a0-3 (speech-channel-flag disable)) (speech-channel-flag disable))
(format #t "disable ")
)
)
(format #t ")~%")
(format #t "~1Tgui-channel: ~D~%" (-> this gui-channel))
(format #t "~1Tdelay: ~D~%" (-> this delay))
(format #t "~1Tid: ~D~%" (-> this id))
(format #t "~1Tupdate-time: ~D~%" (-> this update-time))
(format #t "~1Tstart-time: ~D~%" (-> this start-time))
(format #t "~1Tend-time: ~D~%" (-> this end-time))
(format #t "~1Trequest: #<speech-request @ #x~X>~%" (-> this request))
(format #t "~1Tlast-request: #<speech-request @ #x~X>~%" (-> this last-request))
(format #t "~1Ttarget-pos: #<vector @ #x~X>~%" (-> this target-pos))
(format #t "~1Tspeech-table: #x~X~%" (-> this speech-table))
(label cfg-6)
this
)
;; definition of type speech-control
(deftype speech-control (structure)
((channel-array speech-channel 2 :inline)
(speech-table speech-type-info 57)
)
(:methods
(speech-control-method-9 (_type_) none)
(speech-table-set! (_type_ speech-type speech-type-info) none)
(speech-control-method-11 (_type_) none)
(speech-control-method-12 (_type_ process-drawable speech-type) none)
(speech-control-method-13 (_type_ handle) none)
(speech-control-method-14 (_type_) none)
(speech-control-method-15 (_type_ process-drawable) none)
(speech-control-method-16 (_type_) none)
)
)
;; definition for method 3 of type speech-control
(defmethod inspect ((this speech-control))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'speech-control)
(format #t "~1Tchannel-array[2] @ #x~X~%" (-> this channel-array))
(format #t "~1Tspeech-table[57] @ #x~X~%" (-> this speech-table))
(label cfg-4)
this
)
;; failed to figure out what this is:
0