Files
jak-project/test/decompiler/reference/jak1/engine/anim/joint-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

176 lines
7.4 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type joint-control-channel
(deftype joint-control-channel (structure)
((parent joint-control)
(command symbol)
(frame-interp float)
(frame-group art-joint-anim)
(frame-num float)
(num-func (function joint-control-channel float float float))
(param float 2)
(group-sub-index int16)
(group-size int16)
(dist meters)
(eval-time uint32)
(inspector-amount float)
)
(:methods
(debug-print-frames (_type_) _type_)
)
)
;; definition for method 3 of type joint-control-channel
(defmethod inspect ((this joint-control-channel))
(format #t "[~8x] ~A~%" this 'joint-control-channel)
(format #t "~Tparent: ~A~%" (-> this parent))
(format #t "~Tcommand: ~A~%" (-> this command))
(format #t "~Tframe-interp: ~f~%" (-> this frame-interp))
(format #t "~Tframe-group: ~A~%" (-> this frame-group))
(format #t "~Tframe-num: ~f~%" (-> this frame-num))
(format #t "~Tnum-func: ~A~%" (-> this num-func))
(format #t "~Tparam[2] @ #x~X~%" (-> this param))
(format #t "~Tgroup-sub-index: ~D~%" (-> this group-sub-index))
(format #t "~Tgroup-size: ~D~%" (-> this group-size))
(format #t "~Tdist: (meters ~m)~%" (-> this dist))
(format #t "~Teval-time: ~D~%" (-> this eval-time))
(format #t "~Tinspector-amount: ~f~%" (-> this inspector-amount))
this
)
;; definition of type joint-control
(deftype joint-control (basic)
((status janim-status)
(allocated-length int16)
(root-channel (inline-array joint-control-channel) :offset 16)
(blend-index int32)
(active-channels int32)
(generate-frame-function (function (inline-array vector) int process-drawable int))
(prebind-function (function pointer int process-drawable none))
(postbind-function (function process-drawable none))
(effect effect-control)
(channel joint-control-channel 3 :inline)
(frame-group0 art-joint-anim :overlay-at (-> channel 0 frame-group))
(frame-num0 float :overlay-at (-> channel 0 frame-num))
(frame-interp0 float :overlay-at (-> channel 0 frame-interp))
(frame-group1 art-joint-anim :offset 108)
(frame-num1 float :offset 112)
(frame-interp1 float :offset 104)
(frame-group2 art-joint-anim :offset 156)
(frame-num2 float :offset 160)
(frame-interp2 float :offset 152)
)
(:methods
(new (symbol type int) _type_)
(current-cycle-distance (_type_) float)
(debug-print-channels (_type_ symbol) int)
)
)
;; definition for method 3 of type joint-control
(defmethod inspect ((this joint-control))
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~Tstatus: ~D~%" (-> this status))
(format #t "~Tallocated-length: ~D~%" (-> this allocated-length))
(format #t "~Troot-channel: #x~X~%" (-> this root-channel))
(format #t "~Tblend-index: ~D~%" (-> this blend-index))
(format #t "~Tactive-channels: ~D~%" (-> this active-channels))
(format #t "~Tgenerate-frame-function: ~A~%" (-> this generate-frame-function))
(format #t "~Tprebind-function: ~A~%" (-> this prebind-function))
(format #t "~Tpostbind-function: ~A~%" (-> this postbind-function))
(format #t "~Teffect: ~A~%" (-> this effect))
(format #t "~Tchannel[0] @ #x~X~%" (-> this channel))
(format #t "~Tframe-group0: ~A~%" (-> this frame-group0))
(format #t "~Tframe-num0: ~f~%" (-> this frame-num0))
(format #t "~Tframe-interp0: ~f~%" (-> this frame-interp0))
(format #t "~Tframe-group1: ~A~%" (-> this frame-group1))
(format #t "~Tframe-num1: ~f~%" (-> this frame-num1))
(format #t "~Tframe-interp1: ~f~%" (-> this frame-interp1))
(format #t "~Tframe-group2: ~A~%" (-> this frame-group2))
(format #t "~Tframe-num2: ~f~%" (-> this frame-num2))
(format #t "~Tframe-interp2: ~f~%" (-> this frame-interp2))
this
)
;; definition of type matrix-stack
(deftype matrix-stack (structure)
((top matrix)
(data matrix 24 :inline)
)
)
;; definition for method 3 of type matrix-stack
(defmethod inspect ((this matrix-stack))
(format #t "[~8x] ~A~%" this 'matrix-stack)
(format #t "~Ttop: #<matrix @ #x~X>~%" (-> this top))
(format #t "~Tdata[24] @ #x~X~%" (-> this data))
this
)
;; definition of type channel-upload-info
(deftype channel-upload-info (structure)
((fixed joint-anim-compressed-fixed)
(fixed-qwc int32)
(frame joint-anim-compressed-frame)
(frame-qwc int32)
(amount float)
(interp float)
)
:pack-me
)
;; definition for method 3 of type channel-upload-info
(defmethod inspect ((this channel-upload-info))
(format #t "[~8x] ~A~%" this 'channel-upload-info)
(format #t "~Tfixed: #<joint-anim-compressed-fixed @ #x~X>~%" (-> this fixed))
(format #t "~Tfixed-qwc: ~D~%" (-> this fixed-qwc))
(format #t "~Tframe: #<joint-anim-compressed-frame @ #x~X>~%" (-> this frame))
(format #t "~Tframe-qwc: ~D~%" (-> this frame-qwc))
(format #t "~Tamount: ~f~%" (-> this amount))
(format #t "~Tinterp: ~f~%" (-> this interp))
this
)
;; definition of type joint-work
(deftype joint-work (structure)
((temp-mtx matrix :inline)
(joint-stack matrix-stack :inline)
(fix-jmp-table (function none) 16)
(frm-jmp-table (function none) 16)
(pair-jmp-table (function none) 16)
(uploads channel-upload-info 24 :inline)
(num-uploads int32)
(mtx-acc matrix 2 :inline)
(tq-acc transformq 100 :inline)
(jacp-hdr joint-anim-compressed-hdr :inline)
(fixed-data joint-anim-compressed-fixed :inline)
(frame-data joint-anim-compressed-frame 2 :inline)
(flatten-array float 576 :overlay-at mtx-acc)
(flattened vector 24 :inline :overlay-at mtx-acc)
)
)
;; definition for method 3 of type joint-work
(defmethod inspect ((this joint-work))
(format #t "[~8x] ~A~%" this 'joint-work)
(format #t "~Ttemp-mtx: #<matrix @ #x~X>~%" (-> this temp-mtx))
(format #t "~Tjoint-stack: #<matrix-stack @ #x~X>~%" (-> this joint-stack))
(format #t "~Tfix-jmp-table[16] @ #x~X~%" (-> this fix-jmp-table))
(format #t "~Tfrm-jmp-table[16] @ #x~X~%" (-> this frm-jmp-table))
(format #t "~Tpair-jmp-table[16] @ #x~X~%" (-> this pair-jmp-table))
(format #t "~Tuploads[24] @ #x~X~%" (-> this uploads))
(format #t "~Tnum-uploads: ~D~%" (-> this num-uploads))
(format #t "~Tmtx-acc[2] @ #x~X~%" (-> this mtx-acc))
(format #t "~Ttq-acc[100] @ #x~X~%" (-> this tq-acc))
(format #t "~Tjacp-hdr: #<joint-anim-compressed-hdr @ #x~X>~%" (-> this jacp-hdr))
(format #t "~Tfixed-data: #<joint-anim-compressed-fixed @ #x~X>~%" (-> this fixed-data))
(format #t "~Tframe-data[2] @ #x~X~%" (-> this frame-data))
(format #t "~Tflatten-array[576] @ #x~X~%" (-> this mtx-acc))
(format #t "~Tflattened[24] @ #x~X~%" (-> this mtx-acc))
this
)
;; failed to figure out what this is:
0