;;-*-Lisp-*-
(in-package goal)

;; definition of type merc-matrix
(deftype merc-matrix (structure)
  ((quad   uint128 8         :offset-assert   0)
   (vector vector  8 :inline :offset          0)
   (tag    uint64            :offset          0)
   )
  :method-count-assert 9
  :size-assert         #x80
  :flag-assert         #x900000080
  )

;; definition for method 3 of type merc-matrix
(defmethod inspect merc-matrix ((obj merc-matrix))
  (format #t "[~8x] ~A~%" obj 'merc-matrix)
  (format #t "~Tquad[8] @ #x~X~%" (-> obj quad))
  (format #t "~Tvector[8] @ #x~X~%" (-> obj quad))
  (format #t "~Ttag: ~D~%" (-> obj tag))
  obj
  )

;; definition of type generic-merc-tag
(deftype generic-merc-tag (dma-packet)
  ((next-ptr uint32  :offset  12)
   (size     uint32  :offset   8)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type generic-merc-tag
;; INFO: Used lq/sq
(defmethod inspect generic-merc-tag ((obj generic-merc-tag))
  (format #t "[~8x] ~A~%" obj 'generic-merc-tag)
  (format #t "~Tdma: #x~X~%" (-> obj dma))
  (format #t "~Tvif0: #x~X~%" (-> obj vif0))
  (format #t "~Tvif1: #x~X~%" (-> obj vif1))
  (format #t "~Tquad: ~D~%" (-> obj quad))
  (format #t "~Tnext-ptr: ~D~%" (-> obj vif1))
  (format #t "~Tsize: ~D~%" (-> obj vif0))
  obj
  )

;; definition of type generic-merc-ctrl
(deftype generic-merc-ctrl (structure)
  ((tag    generic-merc-tag :inline :offset-assert   0)
   (lights vu-lights        :inline :offset-assert  16)
   (header merc-ctrl-header :inline :offset-assert 128)
   (effect merc-effect      :inline :offset-assert 208)
   )
  :method-count-assert 9
  :size-assert         #xf0
  :flag-assert         #x9000000f0
  )

;; definition for method 3 of type generic-merc-ctrl
(defmethod inspect generic-merc-ctrl ((obj generic-merc-ctrl))
  (format #t "[~8x] ~A~%" obj 'generic-merc-ctrl)
  (format #t "~Ttag: #<generic-merc-tag @ #x~X>~%" (-> obj tag))
  (format #t "~Tlights: #<vu-lights @ #x~X>~%" (-> obj lights))
  (format #t "~Theader: #<merc-ctrl-header @ #x~X>~%" (-> obj header))
  (format #t "~Teffect: #<merc-effect @ #x~X>~%" (-> obj effect))
  obj
  )

;; definition of type generic-merc-ctrl-with-sfx
(deftype generic-merc-ctrl-with-sfx (generic-merc-ctrl)
  ((sfx-data uint128 11 :offset-assert 240)
   )
  :method-count-assert 9
  :size-assert         #x1a0
  :flag-assert         #x9000001a0
  )

;; definition for method 3 of type generic-merc-ctrl-with-sfx
(defmethod inspect generic-merc-ctrl-with-sfx ((obj generic-merc-ctrl-with-sfx))
  (format #t "[~8x] ~A~%" obj 'generic-merc-ctrl-with-sfx)
  (format #t "~Ttag: #<generic-merc-tag @ #x~X>~%" (-> obj tag))
  (format #t "~Tlights: #<vu-lights @ #x~X>~%" (-> obj lights))
  (format #t "~Theader: #<merc-ctrl-header @ #x~X>~%" (-> obj header))
  (format #t "~Teffect: #<merc-effect @ #x~X>~%" (-> obj effect))
  (format #t "~Tsfx-data[11] @ #x~X~%" (-> obj sfx-data))
  obj
  )

;; definition of type generic-merc-input
(deftype generic-merc-input (structure)
  ((geo-tag     generic-merc-tag           :inline   :offset-assert   0)
   (geo-block   uint8                      1296      :offset-assert  16)
   (byte-header merc-byte-header           :inline   :offset         16)
   (matrix      merc-matrix                9 :inline :offset-assert 1312)
   (control     generic-merc-ctrl-with-sfx :inline   :offset-assert 2464)
   (end-tag     generic-merc-tag           :inline   :offset-assert 2880)
   (shader      adgif-shader               :inline   :offset-assert 2896)
   )
  :method-count-assert 9
  :size-assert         #xba0
  :flag-assert         #x900000ba0
  )

;; definition for method 3 of type generic-merc-input
(defmethod inspect generic-merc-input ((obj generic-merc-input))
  (format #t "[~8x] ~A~%" obj 'generic-merc-input)
  (format #t "~Tgeo-tag: #<generic-merc-tag @ #x~X>~%" (-> obj geo-tag))
  (format #t "~Tgeo-block[1296] @ #x~X~%" (-> obj geo-block))
  (format #t "~Tbyte-header: #<merc-byte-header @ #x~X>~%" (-> obj geo-block))
  (format #t "~Tmatrix[9] @ #x~X~%" (-> obj matrix))
  (format #t "~Tcontrol: #<generic-merc-ctrl-with-sfx @ #x~X>~%" (-> obj control))
  (format #t "~Tend-tag: #<generic-merc-tag @ #x~X>~%" (-> obj end-tag))
  (format #t "~Tshader: #<adgif-shader @ #x~X>~%" (-> obj shader))
  obj
  )

;; definition of type generic-merc-output
(deftype generic-merc-output (structure)
  ((info             gsf-info   :inline    :offset-assert   0)
   (header           gsf-header :inline    :offset-assert  16)
   (index-kick-table uint16     80         :offset-assert  32)
   (index-table      uint8      160        :offset         32)
   (inverse-table    uint8      256        :offset-assert 192)
   (vertex-table     gsf-vertex 72 :inline :offset-assert 448)
   )
  :method-count-assert 9
  :size-assert         #xac0
  :flag-assert         #x900000ac0
  )

;; definition for method 3 of type generic-merc-output
(defmethod inspect generic-merc-output ((obj generic-merc-output))
  (format #t "[~8x] ~A~%" obj 'generic-merc-output)
  (format #t "~Tinfo: #<gsf-info @ #x~X>~%" (-> obj info))
  (format #t "~Theader: #<gsf-header @ #x~X>~%" (-> obj header))
  (format #t "~Tindex-kick-table[80] @ #x~X~%" (-> obj index-kick-table))
  (format #t "~Tindex-table[160] @ #x~X~%" (-> obj index-kick-table))
  (format #t "~Tinverse-table[256] @ #x~X~%" (-> obj inverse-table))
  (format #t "~Tvertex-table[72] @ #x~X~%" (-> obj vertex-table))
  obj
  )

;; definition of type generic-merc-dcache
(deftype generic-merc-dcache (structure)
  ((output-a    generic-merc-output :inline :offset-assert   0)
   (output-b    generic-merc-output :inline :offset-assert 2752)
   (inv-table-1 uint8               544     :offset-assert 5504)
   (inv-table-7 uint8               544     :offset-assert 6048)
   (inv-safety  uint8               16      :offset-assert 6592)
   (effect-data uint8               1584    :offset-assert 6608)
   )
  :method-count-assert 9
  :size-assert         #x2000
  :flag-assert         #x900002000
  )

;; definition for method 3 of type generic-merc-dcache
(defmethod inspect generic-merc-dcache ((obj generic-merc-dcache))
  (format #t "[~8x] ~A~%" obj 'generic-merc-dcache)
  (format #t "~Toutput-a: #<generic-merc-output @ #x~X>~%" (-> obj output-a))
  (format #t "~Toutput-b: #<generic-merc-output @ #x~X>~%" (-> obj output-b))
  (format #t "~Tinv-table-1[544] @ #x~X~%" (-> obj inv-table-1))
  (format #t "~Tinv-table-7[544] @ #x~X~%" (-> obj inv-table-7))
  (format #t "~Tinv-safety[16] @ #x~X~%" (-> obj inv-safety))
  (format #t "~Teffect-data[1584] @ #x~X~%" (-> obj effect-data))
  obj
  )

;; definition of type gm-shadow
(deftype gm-shadow (structure)
  ((perspective                matrix              :inline :offset-assert   0)
   (isometric                  matrix              :inline :offset-assert  64)
   (inv-camera-rot             matrix              :inline :offset-assert 128)
   (envmap-shader              adgif-shader        :inline :offset-assert 192)
   (current-chain              uint32                      :offset-assert 272)
   (next-chain                 uint32                      :offset-assert 276)
   (buf-index                  uint32                      :offset-assert 280)
   (fragment-count             uint32                      :offset-assert 284)
   (write-limit                pointer                     :offset-assert 288)
   (indexed-input-base         generic-merc-input          :offset-assert 292)
   (other-input-base           generic-merc-input          :offset-assert 296)
   (indexed-output-base        generic-merc-output         :offset-assert 300)
   (other-output-base          generic-merc-output         :offset-assert 304)
   (p-input                    uint32                      :offset-assert 308)
   (gsf-buf                    generic-merc-dcache         :offset-assert 312)
   (p-fheader                  merc-fp-header              :offset-assert 316)
   (mercneric-convert          basic                       :offset-assert 320)
   (generic-prepare-dma-single basic                       :offset-assert 324)
   (generic-prepare-dma-double basic                       :offset-assert 328)
   (generic-light-proc         basic                       :offset-assert 332)
   (generic-envmap-proc        basic                       :offset-assert 336)
   (high-speed-reject          basic                       :offset-assert 340)
   (hsr-xmult                  vector              :inline :offset-assert 352)
   (hsr-ymult                  vector              :inline :offset-assert 368)
   )
  :method-count-assert 9
  :size-assert         #x180
  :flag-assert         #x900000180
  )

;; definition for method 3 of type gm-shadow
(defmethod inspect gm-shadow ((obj gm-shadow))
  (format #t "[~8x] ~A~%" obj 'gm-shadow)
  (format #t "~Tperspective: #<matrix @ #x~X>~%" (-> obj perspective))
  (format #t "~Tisometric: #<matrix @ #x~X>~%" (-> obj isometric))
  (format #t "~Tinv-camera-rot: #<matrix @ #x~X>~%" (-> obj inv-camera-rot))
  (format #t "~Tenvmap-shader: #<adgif-shader @ #x~X>~%" (-> obj envmap-shader))
  (format #t "~Tcurrent-chain: ~D~%" (-> obj current-chain))
  (format #t "~Tnext-chain: ~D~%" (-> obj next-chain))
  (format #t "~Tbuf-index: ~D~%" (-> obj buf-index))
  (format #t "~Tfragment-count: ~D~%" (-> obj fragment-count))
  (format #t "~Twrite-limit: ~D~%" (-> obj write-limit))
  (format #t "~Tindexed-input-base: #<generic-merc-input @ #x~X>~%" (-> obj indexed-input-base))
  (format #t "~Tother-input-base: #<generic-merc-input @ #x~X>~%" (-> obj other-input-base))
  (format #t "~Tindexed-output-base: #<generic-merc-output @ #x~X>~%" (-> obj indexed-output-base))
  (format #t "~Tother-output-base: #<generic-merc-output @ #x~X>~%" (-> obj other-output-base))
  (format #t "~Tp-input: #x~X~%" (-> obj p-input))
  (format #t "~Tgsf-buf: #<generic-merc-dcache @ #x~X>~%" (-> obj gsf-buf))
  (format #t "~Tp-fheader: #<merc-fp-header @ #x~X>~%" (-> obj p-fheader))
  (format #t "~Tmercneric-convert: ~A~%" (-> obj mercneric-convert))
  (format #t "~Tgeneric-prepare-dma-single: ~A~%" (-> obj generic-prepare-dma-single))
  (format #t "~Tgeneric-prepare-dma-double: ~A~%" (-> obj generic-prepare-dma-double))
  (format #t "~Tgeneric-light-proc: ~A~%" (-> obj generic-light-proc))
  (format #t "~Tgeneric-envmap-proc: ~A~%" (-> obj generic-envmap-proc))
  (format #t "~Thigh-speed-reject: ~A~%" (-> obj high-speed-reject))
  (format #t "~Thsr-xmult: #<vector @ #x~X>~%" (-> obj hsr-xmult))
  (format #t "~Thsr-ymult: #<vector @ #x~X>~%" (-> obj hsr-ymult))
  obj
  )

;; definition of type generic-merc-work
(deftype generic-merc-work (structure)
  ((input-a generic-merc-input         :inline :offset-assert   0)
   (input-b generic-merc-input         :inline :offset-assert 2976)
   (ctrl    generic-merc-ctrl-with-sfx :inline :offset-assert 5952)
   (shadow  gm-shadow                  :inline :offset-assert 6368)
   (stack   uint128                    16      :offset-assert 6752)
   )
  :method-count-assert 9
  :size-assert         #x1b60
  :flag-assert         #x900001b60
  )

;; definition for method 3 of type generic-merc-work
(defmethod inspect generic-merc-work ((obj generic-merc-work))
  (format #t "[~8x] ~A~%" obj 'generic-merc-work)
  (format #t "~Tinput-a: #<generic-merc-input @ #x~X>~%" (-> obj input-a))
  (format #t "~Tinput-b: #<generic-merc-input @ #x~X>~%" (-> obj input-b))
  (format #t "~Tctrl: #<generic-merc-ctrl-with-sfx @ #x~X>~%" (-> obj ctrl))
  (format #t "~Tshadow: #<gm-shadow @ #x~X>~%" (-> obj shadow))
  (format #t "~Tstack[16] @ #x~X~%" (-> obj stack))
  obj
  )

;; failed to figure out what this is:
0
