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

;; definition of type billboard
(deftype billboard (drawable)
  ((flat adgif-shader :inline :offset-assert  32)
   )
  :method-count-assert 18
  :size-assert         #x70
  :flag-assert         #x1200000070
  )

;; definition for method 3 of type billboard
(defmethod inspect billboard ((obj billboard))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tid: ~D~%" (-> obj id))
  (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
  (format #t "~Tflat: #<adgif-shader @ #x~X>~%" (-> obj flat))
  obj
  )

;; definition of type shrub-view-data
(deftype shrub-view-data (structure)
  ((data           uint128    3       :offset-assert   0)
   (texture-giftag gs-gif-tag :inline :offset          0)
   (consts         vector     :inline :offset         16)
   (fog-clamp      vector     :inline :offset         32)
   (tex-start-ptr  int32              :offset         16)
   (gifbufsum      float              :offset         16)
   (mtx-buf-ptr    int32              :offset         20)
   (exp23          float              :offset         20)
   (fog-0          float              :offset         24)
   (fog-1          float              :offset         28)
   (fog-min        float              :offset         32)
   (fog-max        float              :offset         36)
   )
  :method-count-assert 9
  :size-assert         #x30
  :flag-assert         #x900000030
  )

;; definition for method 3 of type shrub-view-data
(defmethod inspect shrub-view-data ((obj shrub-view-data))
  (format #t "[~8x] ~A~%" obj 'shrub-view-data)
  (format #t "~Tdata[3] @ #x~X~%" (-> obj data))
  (format #t "~Ttexture-giftag: #<qword @ #x~X>~%" (-> obj data))
  (format #t "~Tconsts: #<vector @ #x~X>~%" (&-> obj tex-start-ptr))
  (format #t "~Tfog-clamp: #<vector @ #x~X>~%" (&-> obj fog-min))
  (format #t "~Ttex-start-ptr: ~D~%" (-> obj tex-start-ptr))
  (format #t "~Tgifbufsum: ~f~%" (-> obj gifbufsum))
  (format #t "~Tmtx-buf-ptr: ~D~%" (-> obj mtx-buf-ptr))
  (format #t "~Texp23: ~f~%" (-> obj exp23))
  (format #t "~Tfog-0: ~f~%" (-> obj fog-0))
  (format #t "~Tfog-1: ~f~%" (-> obj fog-1))
  (format #t "~Tfog-min: ~f~%" (-> obj fog-min))
  (format #t "~Tfog-max: ~f~%" (-> obj fog-max))
  obj
  )

;; definition of type shrubbery
(deftype shrubbery (drawable)
  ((textures (inline-array adgif-shader)  :offset   4)
   (header   qword                        :offset   8)
   (obj-qwc  uint8                        :offset  12)
   (vtx-qwc  uint8                        :offset  13)
   (col-qwc  uint8                        :offset  14)
   (stq-qwc  uint8                        :offset  15)
   (obj      uint32                       :offset  16)
   (vtx      uint32                       :offset  20)
   (col      uint32                       :offset  24)
   (stq      uint32                       :offset  28)
   )
  :method-count-assert 18
  :size-assert         #x20
  :flag-assert         #x1200000020
  )

;; definition for method 3 of type shrubbery
(defmethod inspect shrubbery ((obj shrubbery))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tid: ~D~%" (-> obj id))
  (format #t "~Tbsphere: ~`vector`P~%" (&-> obj obj))
  (format #t "~Ttextures: #x~X~%" (-> obj textures))
  (format #t "~Theader: #<qword @ #x~X>~%" (-> obj header))
  (format #t "~Tobj-qwc: ~D~%" (-> obj obj-qwc))
  (format #t "~Tvtx-qwc: ~D~%" (-> obj vtx-qwc))
  (format #t "~Tcol-qwc: ~D~%" (-> obj col-qwc))
  (format #t "~Tstq-qwc: ~D~%" (-> obj stq-qwc))
  (format #t "~Tobj: #x~X~%" (-> obj obj))
  (format #t "~Tvtx: #x~X~%" (-> obj vtx))
  (format #t "~Tcol: #x~X~%" (-> obj col))
  (format #t "~Tstq: #x~X~%" (-> obj stq))
  obj
  )

;; definition of type instance-shrubbery
(deftype instance-shrubbery (instance)
  ((color-indices uint32         :offset          8)
   (flat-normal   vector :inline :offset-assert  64)
   (flat-hwidth   float          :offset         76)
   (color         uint32         :offset          8)
   )
  :method-count-assert 18
  :size-assert         #x50
  :flag-assert         #x1200000050
  )

;; definition for method 3 of type instance-shrubbery
(defmethod inspect instance-shrubbery ((obj instance-shrubbery))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tid: ~D~%" (-> obj id))
  (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
  (format #t "~Tbucket-index: ~D~%" (-> obj bucket-index))
  (format #t "~Torigin: #<matrix4h @ #x~X>~%" (-> obj origin))
  (format #t "~Twind-index: ~D~%" (-> obj wind-index))
  (format #t "~Tflat-normal: #<vector @ #x~X>~%" (-> obj flat-normal))
  (format #t "~Tflat-hwidth: ~f~%" (-> obj flat-normal w))
  (format #t "~Tcolor: ~D~%" (-> obj error))
  obj
  )

;; definition of type drawable-inline-array-instance-shrub
(deftype drawable-inline-array-instance-shrub (drawable-inline-array)
  ((data instance-shrubbery 1 :inline :offset-assert  32)
   (pad  uint32                       :offset-assert 112)
   )
  :method-count-assert 18
  :size-assert         #x74
  :flag-assert         #x1200000074
  )

;; definition of type drawable-tree-instance-shrub
(deftype drawable-tree-instance-shrub (drawable-tree)
  ((info         prototype-array-shrub-info  :offset   8)
   (colors-added time-of-day-palette         :offset  12)
   )
  :method-count-assert 18
  :size-assert         #x24
  :flag-assert         #x1200000024
  )

;; definition of type generic-shrub-fragment
(deftype generic-shrub-fragment (drawable)
  ((textures (inline-array adgif-shader)  :offset   4)
   (vtx-cnt  uint32                       :offset   8)
   (cnt-qwc  uint8                        :offset  12)
   (vtx-qwc  uint8                        :offset  13)
   (col-qwc  uint8                        :offset  14)
   (stq-qwc  uint8                        :offset  15)
   (cnt      uint32                       :offset  16)
   (vtx      uint32                       :offset  20)
   (col      uint32                       :offset  24)
   (stq      uint32                       :offset  28)
   )
  :method-count-assert 18
  :size-assert         #x20
  :flag-assert         #x1200000020
  )

;; definition for method 3 of type generic-shrub-fragment
(defmethod inspect generic-shrub-fragment ((obj generic-shrub-fragment))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tid: ~D~%" (-> obj id))
  (format #t "~Tbsphere: ~`vector`P~%" (&-> obj cnt))
  (format #t "~Ttextures: #x~X~%" (-> obj textures))
  (format #t "~Tvtx-cnt: ~D~%" (-> obj vtx-cnt))
  (format #t "~Tcnt-qwc: ~D~%" (-> obj cnt-qwc))
  (format #t "~Tvtx-qwc: ~D~%" (-> obj vtx-qwc))
  (format #t "~Tcol-qwc: ~D~%" (-> obj col-qwc))
  (format #t "~Tstq-qwc: ~D~%" (-> obj stq-qwc))
  (format #t "~Tcnt: #x~X~%" (-> obj cnt))
  (format #t "~Tvtx: #x~X~%" (-> obj vtx))
  (format #t "~Tcol: #x~X~%" (-> obj col))
  (format #t "~Tstq: #x~X~%" (-> obj stq))
  obj
  )

;; definition of type prototype-shrubbery
(deftype prototype-shrubbery (drawable-inline-array)
  ((data shrubbery 1 :inline :offset-assert  32)
   (pad  uint32              :offset-assert  64)
   )
  :method-count-assert 18
  :size-assert         #x44
  :flag-assert         #x1200000044
  )

;; definition of type prototype-trans-shrubbery
(deftype prototype-trans-shrubbery (prototype-shrubbery)
  ()
  :method-count-assert 18
  :size-assert         #x44
  :flag-assert         #x1200000044
  )

;; definition of type prototype-generic-shrub
(deftype prototype-generic-shrub (drawable-group)
  ()
  :method-count-assert 18
  :size-assert         #x24
  :flag-assert         #x1200000024
  )

;; definition of type shrubbery-matrix
(deftype shrubbery-matrix (structure)
  ((mat   matrix :inline :offset-assert   0)
   (color qword  :inline :offset-assert  64)
   )
  :method-count-assert 9
  :size-assert         #x50
  :flag-assert         #x900000050
  )

;; definition for method 3 of type shrubbery-matrix
(defmethod inspect shrubbery-matrix ((obj shrubbery-matrix))
  (format #t "[~8x] ~A~%" obj 'shrubbery-matrix)
  (format #t "~Tmat: #<matrix @ #x~X>~%" (-> obj mat))
  (format #t "~Tcolor: #<qword @ #x~X>~%" (-> obj color))
  obj
  )

;; definition for function shrubbery-login-post-texture
;; INFO: Used lq/sq
;; INFO: Return type mismatch symbol vs none.
(defun shrubbery-login-post-texture ((obj shrubbery))
  (let* ((shader-count (-> obj header data 0))
         (dst (the-as qword (+ (the-as uint (-> obj header)) (* (+ (-> obj header data 1) 1) 16))))
         (tex-dst (the-as qword (+ (the-as int dst) (* shader-count 64))))
         (src (the-as qword (-> obj textures)))
         )
    (dotimes (a0-1 (the-as int shader-count))
      (set! (-> tex-dst quad) (-> src quad))
      (let ((text-dst2 (the-as qword (+ (the-as int tex-dst) 16)))
            (src-2 (the-as qword (&+ (the-as pointer src) 16)))
            )
        (set! (-> dst vector4w x) (the-as int (-> src-2 data 0)))
        (set! (-> dst vector4w y) (the-as int (-> src-2 data 1)))
        (set! (-> dst vector4w z) (the-as int (-> src-2 data 2)))
        (set! dst (the-as qword (+ (the-as int dst) 16)))
        (let ((src-3 (the-as qword (&+ (the-as pointer src-2) 16))))
          (dotimes (t0-4 3)
            (set! (-> dst quad) (-> src-3 quad))
            (set! dst (the-as qword (+ (the-as int dst) 16)))
            (set! src-3 (the-as qword (&+ (the-as pointer src-3) 16)))
            )
          (set! (-> text-dst2 quad) (-> src-3 quad))
          (set! tex-dst (the-as qword (+ (the-as int text-dst2) 16)))
          (set! src (the-as qword (&+ (the-as pointer src-3) 80)))
          )
        )
      )
    )
  (none)
  )

;; definition for symbol *shrub-state*, type int
(define *shrub-state* 0)

;; definition of type shrub-near-packet
(deftype shrub-near-packet (structure)
  ((matrix-tmpl dma-packet :inline :offset-assert   0)
   (header-tmpl dma-packet :inline :offset-assert  16)
   (stq-tmpl    dma-packet :inline :offset-assert  32)
   (color-tmpl  dma-packet :inline :offset-assert  48)
   (vertex-tmpl dma-packet :inline :offset-assert  64)
   (mscal-tmpl  dma-packet :inline :offset-assert  80)
   (init-tmpl   dma-packet :inline :offset-assert  96)
   (init-data   uint32     8       :offset-assert 112)
   )
  :method-count-assert 9
  :size-assert         #x90
  :flag-assert         #x900000090
  )

;; definition for method 3 of type shrub-near-packet
(defmethod inspect shrub-near-packet ((obj shrub-near-packet))
  (format #t "[~8x] ~A~%" obj 'shrub-near-packet)
  (format #t "~Tmatrix-tmpl: #<dma-packet @ #x~X>~%" (-> obj matrix-tmpl))
  (format #t "~Theader-tmpl: #<dma-packet @ #x~X>~%" (-> obj header-tmpl))
  (format #t "~Tstq-tmpl: #<dma-packet @ #x~X>~%" (-> obj stq-tmpl))
  (format #t "~Tcolor-tmpl: #<dma-packet @ #x~X>~%" (-> obj color-tmpl))
  (format #t "~Tvertex-tmpl: #<dma-packet @ #x~X>~%" (-> obj vertex-tmpl))
  (format #t "~Tmscal-tmpl: #<dma-packet @ #x~X>~%" (-> obj mscal-tmpl))
  (format #t "~Tinit-tmpl: #<dma-packet @ #x~X>~%" (-> obj init-tmpl))
  (format #t "~Tinit-data[8] @ #x~X~%" (-> obj init-data))
  obj
  )

;; definition of type instance-shrub-work
(deftype instance-shrub-work (structure)
  ((dummy                     qword             3 :inline  :offset-assert   0)
   (chaina                    qword             8 :inline  :offset-assert  48)
   (chainb                    qword             8 :inline  :offset-assert 176)
   (colors                    rgba              1024       :offset-assert 304)
   (matrix-tmpl               qword             20 :inline :offset-assert 4400)
   (count-tmpl                vector4w          20 :inline :offset-assert 4720)
   (mscalf-tmpl               dma-packet        :inline    :offset-assert 5040)
   (mscalf-ret-tmpl           dma-packet        :inline    :offset-assert 5056)
   (adgif-tmpl                dma-gif-packet    :inline    :offset-assert 5072)
   (billboard-tmpl            dma-gif-packet    :inline    :offset-assert 5104)
   (billboard-const           vector            :inline    :offset-assert 5136)
   (shrub-near-packets        shrub-near-packet 6 :inline  :offset-assert 5152)
   (dma-ref                   dma-packet        :inline    :offset-assert 6016)
   (dma-end                   dma-packet        :inline    :offset-assert 6032)
   (wind-const                vector            :inline    :offset-assert 6048)
   (constants                 vector            :inline    :offset-assert 6064)
   (color-constant            vector4w          :inline    :offset-assert 6080)
   (hmge-d                    vector            :inline    :offset-assert 6096)
   (hvdf-offset               vector            :inline    :offset-assert 6112)
   (wind-force                vector            :inline    :offset-assert 6128)
   (color                     vector            :inline    :offset-assert 6144)
   (bb-color                  vector            :inline    :offset-assert 6160)
   (min-dist                  vector            :inline    :offset-assert 6176)
   (temp-vec                  vector            :inline    :offset-assert 6192)
   (guard-plane               plane             4 :inline  :offset-assert 6208)
   (plane                     plane             4 :inline  :offset-assert 6272)
   (last                      uint32            4          :offset-assert 6336)
   (next                      uint32            4          :offset-assert 6352)
   (count                     uint16            4          :offset-assert 6368)
   (mod-count                 uint16            4          :offset-assert 6376)
   (wind-vectors              uint32                       :offset-assert 6384)
   (instance-ptr              uint32                       :offset-assert 6388)
   (chain-ptr                 uint32                       :offset-assert 6392)
   (chain-ptr-next            uint32                       :offset-assert 6396)
   (stack-ptr                 uint32                       :offset-assert 6400)
   (bucket-ptr                uint32                       :offset-assert 6404)
   (src-ptr                   uint32                       :offset-assert 6408)
   (to-spr                    uint32                       :offset-assert 6412)
   (from-spr                  uint32                       :offset-assert 6416)
   (shrub-count               uint32                       :offset-assert 6420)
   (node                      uint32            6          :offset        6428)
   (length                    uint32            6          :offset-assert 6452)
   (prototypes                uint32                       :offset-assert 6476)
   (start-bank                uint8             20         :offset        6484)
   (buffer-index              uint32                       :offset-assert 6504)
   (current-spr               uint32                       :offset-assert 6508)
   (current-mem               uint32                       :offset-assert 6512)
   (current-shrub-near-packet uint32                       :offset-assert 6516)
   (dma-buffer                basic                        :offset        6524)
   (near-last                 uint32                       :offset-assert 6528)
   (near-next                 uint32                       :offset-assert 6532)
   (near-count                uint32                       :offset-assert 6536)
   (last-shrubs               uint32                       :offset-assert 6540)
   (chains                    uint32                       :offset-assert 6544)
   (flags                     uint32                       :offset-assert 6548)
   (paused                    basic                        :offset-assert 6552)
   (node-count                uint32                       :offset-assert 6556)
   (inst-count                uint32                       :offset-assert 6560)
   (wait-from-spr             uint32                       :offset-assert 6564)
   (wait-to-spr               uint32                       :offset-assert 6568)
   )
  :method-count-assert 9
  :size-assert         #x19ac
  :flag-assert         #x9000019ac
  )

;; definition for method 3 of type instance-shrub-work
(defmethod inspect instance-shrub-work ((obj instance-shrub-work))
  (format #t "[~8x] ~A~%" obj 'instance-shrub-work)
  (format #t "~Tdummy[3] @ #x~X~%" (-> obj dummy))
  (format #t "~Tchaina[8] @ #x~X~%" (-> obj chaina))
  (format #t "~Tchainb[8] @ #x~X~%" (-> obj chainb))
  (format #t "~Tcolors[1024] @ #x~X~%" (-> obj colors))
  (format #t "~Tmatrix-tmpl[20] @ #x~X~%" (-> obj matrix-tmpl))
  (format #t "~Tcount-tmpl[20] @ #x~X~%" (-> obj count-tmpl))
  (format #t "~Tmscalf-tmpl: #<dma-packet @ #x~X>~%" (-> obj mscalf-tmpl))
  (format #t "~Tmscalf-ret-tmpl: #<dma-packet @ #x~X>~%" (-> obj mscalf-ret-tmpl))
  (format #t "~Tadgif-tmpl: #<dma-gif-packet @ #x~X>~%" (-> obj adgif-tmpl))
  (format #t "~Tbillboard-tmpl: #<dma-gif-packet @ #x~X>~%" (-> obj billboard-tmpl))
  (format #t "~Tbillboard-const: #<vector @ #x~X>~%" (-> obj billboard-const))
  (format #t "~Tshrub-near-packets[6] @ #x~X~%" (-> obj shrub-near-packets))
  (format #t "~Tdma-ref: #<dma-packet @ #x~X>~%" (-> obj dma-ref))
  (format #t "~Tdma-end: #<dma-packet @ #x~X>~%" (-> obj dma-end))
  (format #t "~Twind-const: #<vector @ #x~X>~%" (-> obj wind-const))
  (format #t "~Tconstants: #<vector @ #x~X>~%" (-> obj constants))
  (format #t "~Tcolor-constant: #<vector4w @ #x~X>~%" (-> obj color-constant))
  (format #t "~Thmge-d: #<vector @ #x~X>~%" (-> obj hmge-d))
  (format #t "~Thvdf-offset: #<vector @ #x~X>~%" (-> obj hvdf-offset))
  (format #t "~Twind-force: #<vector @ #x~X>~%" (-> obj wind-force))
  (format #t "~Tcolor: #<vector @ #x~X>~%" (-> obj color))
  (format #t "~Tbb-color: #<vector @ #x~X>~%" (-> obj bb-color))
  (format #t "~Tmin-dist: #<vector @ #x~X>~%" (-> obj min-dist))
  (format #t "~Ttemp-vec: #<vector @ #x~X>~%" (-> obj temp-vec))
  (format #t "~Tguard-plane[4] @ #x~X~%" (-> obj guard-plane))
  (format #t "~Tplane[4] @ #x~X~%" (-> obj plane))
  (format #t "~Tlast[4] @ #x~X~%" (-> obj last))
  (format #t "~Tnext[4] @ #x~X~%" (-> obj next))
  (format #t "~Tcount[4] @ #x~X~%" (-> obj count))
  (format #t "~Tmod-count[4] @ #x~X~%" (-> obj mod-count))
  (format #t "~Twind-vectors: #x~X~%" (-> obj wind-vectors))
  (format #t "~Tinstance-ptr: ~D~%" (-> obj instance-ptr))
  (format #t "~Tchain-ptr: ~D~%" (-> obj chain-ptr))
  (format #t "~Tchain-ptr-next: ~D~%" (-> obj chain-ptr-next))
  (format #t "~Tstack-ptr: ~D~%" (-> obj stack-ptr))
  (format #t "~Tbucket-ptr: ~D~%" (-> obj bucket-ptr))
  (format #t "~Tsrc-ptr: ~D~%" (-> obj src-ptr))
  (format #t "~Tto-spr: ~D~%" (-> obj to-spr))
  (format #t "~Tfrom-spr: ~D~%" (-> obj from-spr))
  (format #t "~Tshrub-count: ~D~%" (-> obj shrub-count))
  (format #t "~Tstack-ptr: ~D~%" (-> obj stack-ptr))
  (format #t "~Tnode[6] @ #x~X~%" (-> obj node))
  (format #t "~Tlength[6] @ #x~X~%" (-> obj length))
  (format #t "~Tprototypes: ~D~%" (-> obj prototypes))
  (format #t "~Tbucket-ptr: ~D~%" (-> obj bucket-ptr))
  (format #t "~Tstart-bank[20] @ #x~X~%" (-> obj start-bank))
  (format #t "~Tbuffer-index: ~D~%" (-> obj buffer-index))
  (format #t "~Tcurrent-spr: ~D~%" (-> obj current-spr))
  (format #t "~Tcurrent-mem: ~D~%" (-> obj current-mem))
  (format #t "~Tcurrent-shrub-near-packet: ~D~%" (-> obj current-shrub-near-packet))
  (format #t "~Tto-spr: ~D~%" (-> obj to-spr))
  (format #t "~Tdma-buffer: ~A~%" (-> obj dma-buffer))
  (format #t "~Tnear-last: ~D~%" (-> obj near-last))
  (format #t "~Tnear-next: ~D~%" (-> obj near-next))
  (format #t "~Tnear-count: ~D~%" (-> obj near-count))
  (format #t "~Tlast-shrubs: ~D~%" (-> obj last-shrubs))
  (format #t "~Tchains: ~D~%" (-> obj chains))
  (format #t "~Tflags: ~D~%" (-> obj flags))
  (format #t "~Tpaused: ~A~%" (-> obj paused))
  (format #t "~Tnode-count: ~D~%" (-> obj node-count))
  (format #t "~Tinst-count: ~D~%" (-> obj inst-count))
  (format #t "~Twait-from-spr: ~D~%" (-> obj wait-from-spr))
  (format #t "~Twait-to-spr: ~D~%" (-> obj wait-to-spr))
  obj
  )

;; definition of type instance-shrub-dma
(deftype instance-shrub-dma (structure)
  ((instancea uint128 325 :offset-assert   0)
   (instanceb uint128 325 :offset-assert 5200)
   (outa      uint128 128 :offset-assert 10400)
   (outb      uint128 128 :offset-assert 12448)
   )
  :method-count-assert 9
  :size-assert         #x38a0
  :flag-assert         #x9000038a0
  )

;; definition for method 3 of type instance-shrub-dma
(defmethod inspect instance-shrub-dma ((obj instance-shrub-dma))
  (format #t "[~8x] ~A~%" obj 'instance-shrub-dma)
  (format #t "~Tinstancea[325] @ #x~X~%" (-> obj instancea))
  (format #t "~Tinstanceb[325] @ #x~X~%" (-> obj instanceb))
  (format #t "~Touta[128] @ #x~X~%" (-> obj outa))
  (format #t "~Toutb[128] @ #x~X~%" (-> obj outb))
  obj
  )

;; failed to figure out what this is:
0
