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

285 lines
8.0 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type dma-chcr
(deftype dma-chcr (uint32)
((dir uint8 :offset 0 :size 1)
(mod uint8 :offset 2 :size 2)
(asp uint8 :offset 4 :size 2)
(tte uint8 :offset 6 :size 1)
(tie uint8 :offset 7 :size 1)
(str uint8 :offset 8 :size 1)
(tag uint16 :offset 16 :size 16)
)
)
;; definition for method 3 of type dma-chcr
(defmethod inspect ((this dma-chcr))
(format #t "[~8x] ~A~%" this 'dma-chcr)
(format #t "~Tdir: ~D~%" (-> this dir))
(format #t "~Tmod: ~D~%" (-> this mod))
(format #t "~Tasp: ~D~%" (-> this asp))
(format #t "~Ttte: ~D~%" (-> this tte))
(format #t "~Ttie: ~D~%" (-> this tie))
(format #t "~Tstr: ~D~%" (-> this str))
(format #t "~Ttag: #x~X~%" (-> this tag))
this
)
;; definition of type dma-bank
(deftype dma-bank (structure)
((chcr dma-chcr :offset 0)
(madr uint32 :offset 16)
(qwc uint32 :offset 32)
)
)
;; definition for method 3 of type dma-bank
(defmethod inspect ((this dma-bank))
(format #t "[~8x] ~A~%" this 'dma-bank)
(format #t "~Tchcr: #x~X~%" (-> this chcr))
(format #t "~Tmadr: #x~X~%" (-> this madr))
(format #t "~Tqwc: #x~X~%" (-> this qwc))
this
)
;; definition of type dma-bank-source
(deftype dma-bank-source (dma-bank)
((tadr uint32 :offset 48)
)
)
;; definition for method 3 of type dma-bank-source
(defmethod inspect ((this dma-bank-source))
(format #t "[~8x] ~A~%" this 'dma-bank-source)
(format #t "~Tchcr: #x~X~%" (-> this chcr))
(format #t "~Tmadr: #x~X~%" (-> this madr))
(format #t "~Tqwc: #x~X~%" (-> this qwc))
(format #t "~Ttadr: #x~X~%" (-> this tadr))
this
)
;; definition of type dma-bank-vif
(deftype dma-bank-vif (dma-bank-source)
((as0 uint32 :offset 64)
(as1 uint32 :offset 80)
)
)
;; definition for method 3 of type dma-bank-vif
(defmethod inspect ((this dma-bank-vif))
(format #t "[~8x] ~A~%" this 'dma-bank-vif)
(format #t "~Tchcr: #x~X~%" (-> this chcr))
(format #t "~Tmadr: #x~X~%" (-> this madr))
(format #t "~Tqwc: #x~X~%" (-> this qwc))
(format #t "~Ttadr: #x~X~%" (-> this tadr))
(format #t "~Tas0: #x~X~%" (-> this as0))
(format #t "~Tas1: #x~X~%" (-> this as1))
this
)
;; definition of type dma-bank-spr
(deftype dma-bank-spr (dma-bank-source)
((sadr uint32 :offset 128)
)
)
;; definition for method 3 of type dma-bank-spr
(defmethod inspect ((this dma-bank-spr))
(format #t "[~8x] ~A~%" this 'dma-bank-spr)
(format #t "~Tchcr: #x~X~%" (-> this chcr))
(format #t "~Tmadr: #x~X~%" (-> this madr))
(format #t "~Tqwc: #x~X~%" (-> this qwc))
(format #t "~Ttadr: #x~X~%" (-> this tadr))
(format #t "~Tsadr: #x~X~%" (-> this sadr))
this
)
;; definition of type dma-ctrl
(deftype dma-ctrl (uint32)
((dmae uint8 :offset 0 :size 1)
(rele uint8 :offset 1 :size 1)
(mfd uint8 :offset 2 :size 2)
(sts uint8 :offset 4 :size 2)
(std uint8 :offset 6 :size 2)
(rcyc uint8 :offset 8 :size 3)
)
)
;; definition of type dma-enable
(deftype dma-enable (uint32)
((cpnd uint8 :offset 16 :size 1)
)
)
;; definition of type dma-sqwc
(deftype dma-sqwc (uint32)
((sqwc uint8 :offset 0 :size 8)
(tqwc uint8 :offset 16 :size 8)
)
)
;; definition of type dma-bank-control
(deftype dma-bank-control (structure)
((ctrl dma-ctrl :offset 0)
(stat uint32 :offset 16)
(pcr uint32 :offset 32)
(sqwc dma-sqwc :offset 48)
(rbsr uint32 :offset 64)
(rbor uint32 :offset 80)
(stadr uint32 :offset 96)
(enabler uint32 :offset 5408)
(enablew uint32 :offset 5520)
)
)
;; definition for method 3 of type dma-bank-control
(defmethod inspect ((this dma-bank-control))
(format #t "[~8x] ~A~%" this 'dma-bank-control)
(format #t "~Tctrl: #x~X~%" (-> this ctrl))
(format #t "~Tstat: #x~X~%" (-> this stat))
(format #t "~Tpcr: #x~X~%" (-> this pcr))
(format #t "~Tsqwc: #x~X~%" (-> this sqwc))
(format #t "~Trbsr: #x~X~%" (-> this rbsr))
(format #t "~Trbor: #x~X~%" (-> this rbor))
(format #t "~Tstadr: #x~X~%" (-> this stadr))
(format #t "~Tenabler: ~D~%" (-> this enabler))
(format #t "~Tenablew: ~D~%" (-> this enablew))
this
)
;; definition of type vu-code-block
(deftype vu-code-block (basic)
((name basic)
(code uint32)
(size int32)
(dest-address uint32)
)
)
;; definition for method 3 of type vu-code-block
(defmethod inspect ((this vu-code-block))
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~Tname: ~A~%" (-> this name))
(format #t "~Tcode: #x~X~%" (-> this code))
(format #t "~Tsize: ~D~%" (-> this size))
(format #t "~Tdest-address: ~D~%" (-> this dest-address))
this
)
;; definition of type vu-stat
(deftype vu-stat (uint64)
()
)
;; definition of type dma-tag
(deftype dma-tag (uint64)
((qwc uint16 :offset 0 :size 16)
(pce uint8 :offset 26 :size 2)
(id dma-tag-id :offset 28 :size 3)
(irq uint8 :offset 31 :size 1)
(addr uint32 :offset 32 :size 31)
(spr uint8 :offset 63 :size 1)
)
)
;; definition for method 3 of type dma-tag
(defmethod inspect ((this dma-tag))
(format #t "[~8x] ~A~%" this 'dma-tag)
(format #t "~Tqwc: ~D~%" (-> this qwc))
(format #t "~Tpce: ~D~%" (-> this pce))
(format #t "~Tid: ~D~%" (-> this id))
(format #t "~Tirq: ~D~%" (-> this irq))
(format #t "~Taddr: #x~X~%" (-> this addr))
(format #t "~Tspr: ~D~%" (-> this spr))
this
)
;; definition of type dma-bucket
(deftype dma-bucket (structure)
((tag dma-tag)
(last (pointer dma-tag))
(dummy uint32)
(next uint32 :offset 4)
)
)
;; definition for method 3 of type dma-bucket
(defmethod inspect ((this dma-bucket))
(format #t "[~8x] ~A~%" this 'dma-bucket)
(format #t "~Ttag: ~D~%" (-> this tag))
(format #t "~Tlast: #x~X~%" (-> this last))
(format #t "~Tdummy: ~D~%" (-> this dummy))
(format #t "~Tnext: #x~X~%" (-> this next))
this
)
;; definition of type vif-mask
(deftype vif-mask (uint32)
((m0 uint8 :offset 0 :size 2)
(m1 uint8 :offset 2 :size 2)
(m2 uint8 :offset 4 :size 2)
(m3 uint8 :offset 6 :size 2)
(m4 uint8 :offset 8 :size 2)
(m5 uint8 :offset 10 :size 2)
(m6 uint8 :offset 12 :size 2)
(m7 uint8 :offset 14 :size 2)
(m8 uint8 :offset 16 :size 2)
(m9 uint8 :offset 18 :size 2)
(m10 uint8 :offset 20 :size 2)
(m11 uint8 :offset 22 :size 2)
(m12 uint8 :offset 24 :size 2)
(m13 uint8 :offset 26 :size 2)
(m14 uint8 :offset 28 :size 2)
(m15 uint8 :offset 30 :size 2)
)
)
;; definition of type vif-stcycl-imm
(deftype vif-stcycl-imm (uint16)
((cl uint8 :offset 0 :size 8)
(wl uint8 :offset 8 :size 8)
)
)
;; definition of type vif-unpack-imm
(deftype vif-unpack-imm (uint16)
((addr uint16 :offset 0 :size 10)
(usn uint8 :offset 14 :size 1)
(flg uint8 :offset 15 :size 1)
)
)
;; definition of type vif-tag
(deftype vif-tag (uint32)
((imm uint16 :offset 0 :size 16)
(num uint8 :offset 16 :size 8)
(cmd vif-cmd :offset 24 :size 7)
(irq uint8 :offset 31 :size 1)
(msk uint8 :offset 28 :size 1)
)
)
;; definition for method 3 of type vif-tag
(defmethod inspect ((this vif-tag))
(format #t "[~8x] ~A~%" this 'vif-tag)
(format #t "~Timm: #x~X~%" (-> this imm))
(format #t "~Tnum: ~D~%" (-> this num))
(format #t "~Tcmd: #x~X~%" (-> this cmd))
(format #t "~Tmsk: ~D~%" (-> this msk))
(format #t "~Tirq: ~D~%" (-> this irq))
this
)
;; definition for function dma-sync-fast
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function dma-send-no-scratch
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function dma-sync-with-count
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function dma-count-until-done
;; ERROR: function was not converted to expressions. Cannot decompile.