diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index cdf64fcfee..69e8208297 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -29,6 +29,7 @@ (define-extern global kheap) (define-extern kheap type) (define-extern pointer type) +(define-extern string type) (define-extern #t symbol) (define-extern #f symbol) @@ -3658,110 +3659,110 @@ (gmerc2-l9-tfrag 129) (tex-l0-shrub 130) - (bucket131 131) - (bucket132 132) - (bucket133 133) - (bucket134 134) - (bucket135 135) + (shrub-l0-shrub 131) + (shrub-near-l0-shrub 132) + (billboard-l0-shrub 133) + (shrub-vanish-l0-shrub 134) + (shrub-near-trans-l0-shrub 135) (merc-l0-shrub 136) (emerc-l0-shrub 137) (gmerc-l0-shrub 138) (gmerc2-l0-shrub 139) (tex-l1-shrub 140) - (bucket141 141) - (bucket142 142) - (bucket143 143) - (bucket144 144) - (bucket145 145) + (shrub-l1-shrub 141) + (shrub-near-l1-shrub 142) + (billboard-l1-shrub 143) + (shrub-vanish-l1-shrub 144) + (shrub-near-trans-l1-shrub 145) (merc-l1-shrub 146) (emerc-l1-shrub 147) (gmerc-l1-shrub 148) (gmerc2-l1-shrub 149) (tex-l2-shrub 150) - (bucket151 151) - (bucket152 152) - (bucket153 153) - (bucket154 154) - (bucket155 155) + (shrub-l2-shrub 151) + (shrub-near-l2-shrub 152) + (billboard-l2-shrub 153) + (shrub-vanish-l2-shrub 154) + (shrub-near-trans-l2-shrub 155) (merc-l2-shrub 156) (emerc-l2-shrub 157) (gmerc-l2-shrub 158) (gmerc2-l2-shrub 159) (tex-l3-shrub 160) - (bucket161 161) - (bucket162 162) - (bucket163 163) - (bucket164 164) - (bucket165 165) + (shrub-l3-shrub 161) + (shrub-near-l3-shrub 162) + (billboard-l3-shrub 163) + (shrub-vanish-l3-shrub 164) + (shrub-near-trans-l3-shrub 165) (merc-l3-shrub 166) (emerc-l3-shrub 167) (gmerc-l3-shrub 168) (gmerc2-l3-shrub 169) (tex-l4-shrub 170) - (bucket171 171) - (bucket172 172) - (bucket173 173) - (bucket174 174) - (bucket175 175) + (shrub-l4-shrub 171) + (shrub-near-l4-shrub 172) + (billboard-l4-shrub 173) + (shrub-vanish-l4-shrub 174) + (shrub-near-trans-l4-shrub 175) (merc-l4-shrub 176) (emerc-l4-shrub 177) (gmerc-l4-shrub 178) (gmerc2-l4-shrub 179) (tex-l5-shrub 180) - (bucket181 181) - (bucket182 182) - (bucket183 183) - (bucket184 184) - (bucket185 185) + (shrub-l5-shrub 181) + (shrub-near-l5-shrub 182) + (billboard-l5-shrub 183) + (shrub-vanish-l5-shrub 184) + (shrub-near-trans-l5-shrub 185) (merc-l5-shrub 186) (emerc-l5-shrub 187) (gmerc-l5-shrub 188) (gmerc2-l5-shrub 189) (tex-l6-shrub 190) - (bucket191 191) - (bucket192 192) - (bucket193 193) - (bucket194 194) - (bucket195 195) + (shrub-l6-shrub 191) + (shrub-near-l6-shrub 192) + (billboard-l6-shrub 193) + (shrub-vanish-l6-shrub 194) + (shrub-near-trans-l6-shrub 195) (merc-l6-shrub 196) (emerc-l6-shrub 197) (gmerc-l6-shrub 198) (gmerc2-l6-shrub 199) (tex-l7-shrub 200) - (bucket201 201) - (bucket202 202) - (bucket203 203) - (bucket204 204) - (bucket205 205) + (shrub-l7-shrub 201) + (shrub-near-l7-shrub 202) + (billboard-l7-shrub 203) + (shrub-vanish-l7-shrub 204) + (shrub-near-trans-l7-shrub 205) (merc-l7-shrub 206) (emerc-l7-shrub 207) (gmerc-l7-shrub 208) (gmerc2-l7-shrub 209) (tex-l8-shrub 210) - (bucket211 211) - (bucket212 212) - (bucket213 213) - (bucket214 214) - (bucket215 215) + (shrub-l8-shrub 211) + (shrub-near-l8-shrub 212) + (billboard-l8-shrub 213) + (shrub-vanish-l8-shrub 214) + (shrub-near-trans-l8-shrub 215) (merc-l8-shrub 216) (emerc-l8-shrub 217) (gmerc-l8-shrub 218) (gmerc2-l8-shrub 219) (tex-l9-shrub 220) - (bucket221 221) - (bucket222 222) - (bucket223 223) - (bucket224 224) - (bucket225 225) + (shrub-l9-shrub 221) + (shrub-near-l9-shrub 222) + (billboard-l9-shrub 223) + (shrub-vanish-l9-shrub 224) + (shrub-near-trans-l9-shrub 225) (merc-l9-shrub 226) (emerc-l9-shrub 227) (gmerc-l9-shrub 228) @@ -4208,45 +4209,45 @@ ;; ---vu1-user-h:texture-enable-mask-u32 ;; +++vu1-user-h:vu1-renderer-mask -;; TODO stolen from Jak 2 +;; TODO stolen from Jak 2 (and it was all wrong...) (defenum vu1-renderer-mask :type uint64 :bitfield #t (rn0) (rn1) (rn2) - (sky) - (ocean) - (ocean-wave) - (tfrag) - (tie) - (tie-envmap) - (tie-scissor) - (tie-envmap-scissor) - (tie-vanish) + (rn3) + (rn4) + (rn5) + (rn6) + (rn7) + (rn8) + (rn9) + (rn10) + (rn11) + (rn12) + (rn13) + (generic) ;; right + (merc) ;; right + (emerc) ;; right (shrubbery) (shrub-near) - (generic) - (merc) - (emerc) (billboard) - (shrubbery-vanish) - (tfrag-trans) - (tie-scissor-trans) - (tie-trans) - (tie-envmap-trans) - (tie-envmap-scissor-trans) - (tfrag-water) - (tie-scissor-water) - (tie-water) - (tie-envmap-water) - (tie-envmap-scissor-water) - (sprite) - (shadow) + (shrub-vanish) + (rn21) + (rn22) + (rn23) + (rn24) + (rn25) + (rn26) + (rn27) + (rn28) + (rn29) + (rn30) (rn31) (rn32) (rn33) - (depth-cue) + (rn34) (rn35) (rn36) (rn37) @@ -7479,7 +7480,7 @@ (lf7 7) (lf8 8) (lf9 9) - (lf10 10) + (use-camera-other 10) (lf11 11) (lf12 12) (lf13 13) @@ -7702,7 +7703,7 @@ (level-method-13 () none) ;; 13 ;; (bsp-name (_type_) symbol) (compute-memory-usage! (_type_ symbol) memory-usage-block) ;; 14 (level-method-15 () none) ;; 15 ;; (inside-boxes-check (_type_ vector) symbol) - (update-vis! (_type_ level-vis-info uint (pointer uint8)) symbol) ;; 16 + (update-vis! "Load/decompress precomputed visibility." (_type_ level-vis-info uint (pointer uint8)) symbol) ;; 16 (level-method-17 () none) ;; 17 ;; (load-continue (_type_) _type_) (level-method-18 () none) ;; 18 ;; (load-begin (_type_) _type_) (level-method-19 () none) ;; 19 ;; (login-begin (_type_) _type_) @@ -8098,6 +8099,7 @@ (projection float :offset-assert 56) (scale float :offset-assert 60) (color font-color :offset-assert 64) ;; guessed by decompiler + (color-signed int32 :overlay-at color) (flags font-flags :offset-assert 68) ;; guessed by decompiler (mat matrix :offset-assert 72) (start-line uint32 :offset-assert 76) @@ -8177,7 +8179,7 @@ :size-assert #xbec :flag-assert #xa00000bec (:methods - (set-context! (_type_ object) none) ;; 9 + (set-context! (_type_ font-context) none) ;; 9 ) ) @@ -10784,6 +10786,18 @@ :bitfield #f :type uint32 + (drawable-group 0) + + (shrubbery 27) + (shrubbery-object 28) + (shrubbery-vertex 29) + (shrubbery-color 30) + (shrubbery-stq 31) + (shrubbery-pal 32) + (billboard 33) + (instance-shrubbery 34) + + (entity 44) (camera 45) @@ -10792,6 +10806,8 @@ (bsp-node 61) (bsp-leaf-vis-self 62) + (draw-node 64) + (pat 65) @@ -14169,8 +14185,8 @@ ) (deftype generic-gif-tag (structure) - ((data uint32 4 :offset-assert 0) ;; guessed by decompiler - (qword qword :inline :offset 0) + ((data uint32 4 :offset-assert 0 :score -1) ;; guessed by decompiler + (qword qword :inline :offset 0 :score -1) (fan-prim gif-tag-prim :offset 0) ;; guessed by decompiler (str-prim gif-tag-prim :offset 4) ;; guessed by decompiler (regs gif-tag-regs-32 :offset 8) ;; guessed by decompiler @@ -17154,7 +17170,8 @@ (deftype prototype-bucket-shrub (prototype-bucket) ((next uint32 4 :offset-assert 64) ;; guessed by decompiler (count uint16 4 :offset-assert 80) ;; guessed by decompiler - (mod-count uint16 4 :offset-assert 88) ;; guessed by decompiler + (count-quad uint128 :offset 80) + (mod-count uint16 4 :offset 88) ;; guessed by decompiler (last dma-packet 4 :offset-assert 96) ;; guessed by decompiler (next-clear uint128 :offset 64) (count-clear uint64 :offset 80) @@ -22995,7 +23012,7 @@ (nav) (nav-dma-all) (nav-dma-read) - (nav-dma-write) + (nav-dma-write) ;; 10 (nav-dma-work) (nav-part1) (nav-part2) @@ -23005,7 +23022,7 @@ (nav-part6) (nav-part7) (nav-part8) - (nav-part9) + (nav-part9) ;; 20 (nav-part10) (add-to-translation) (update-current-poly) @@ -23015,7 +23032,7 @@ (travel-around-spheres) (avoid-spheres) (check-vector-collision-with-nav-spheres) - (find-nearest-poly) + (find-nearest-poly) ;; 30 (find-containing-poly) (generate-velocity) (apply-rotation) @@ -23025,7 +23042,7 @@ (misc) (mercneric) (tie-generic) - (background) + (background) ;; 40 (drawable) (tfrag) (tfrag-scissor) @@ -23078,8 +23095,9 @@ "The bsp-header is really an entire level. This probably started as a very simple structure, but now it is extremely complicated." ((info file-info :offset 4) - (all-visible-list (pointer uint16) :offset 32) ;; guessed by decompiler + (all-visible-list (pointer uint8) :offset 32) ;; guessed by decompiler (visible-list-length int16 :offset 36) + (extra-vis-list-length int16 :offset-assert 38) (drawable-trees drawable-tree-array :offset 40) ;; guessed by decompiler (pat pointer :offset 44) ;; guessed by decompiler (pat-length int32 :offset 48) @@ -23115,9 +23133,9 @@ ; (region-array region-array :offset-assert 192) (collide-hash collide-hash :offset 196) ; ;; 200 is some array - ; (wind-array uint32 :offset 200) + (wind-array uint32 :offset 200) ; ;; 204 is maybe that array's length - ; (wind-array-length int32 :offset 204) + (wind-array-length int32 :offset 204) ; (city-level-info city-level-info :offset 208) (vis-spheres vector-array :offset 216) (vis-spheres-length uint32 :offset 248) @@ -23142,7 +23160,7 @@ (bsp-scale vector :inline :offset 288) (bsp-offset vector :inline :offset-assert 304) - (unk-drawable drawable :offset 320) + (hfrag-drawable drawable :offset 320) (end uint8 :offset #x18f) @@ -23547,7 +23565,7 @@ (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 qword 8 :offset-assert 112) ;; guessed by decompiler + (init-data qword 2 :inline :offset-assert 112) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x90 @@ -29005,7 +29023,7 @@ (define-extern update-wind "Update the wind force for this frame. This value will be used by level-update-wind to update tie/shrub wind values." (function wind-work (array uint8) none)) (define-extern wind-get-hashed-index "Unused function, likely a leftover from Jak 1's different wind system." (function vector wind-work int)) -;; (define-extern level-update-wind function) ;; (function wind-work none) +(define-extern level-update-wind (function wind-work none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bsp ;; @@ -29845,14 +29863,14 @@ ;; generic-effect ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *target-lock* object) ;; object -;; (define-extern *generic-consts* object) ;; generic-consts -;; (define-extern generic-work-init function) ;; (function generic-bucket-state none) -;; (define-extern generic-upload-vu0 function) ;; (function none) -;; (define-extern upload-vu0-program function) ;; (function vu-function pointer none) -;; (define-extern generic-initialize-without-sync function) ;; (function matrix vu-lights none) -;; (define-extern generic-initialize function) ;; (function generic-bucket-state matrix vu-lights none) -;; (define-extern generic-wrapup function) ;; (function generic-bucket-state none) +(define-extern *target-lock* object) +(define-extern *generic-consts* generic-consts) +(define-extern generic-work-init "Initialize the scratchpad work for generic." (function generic-bucket-state none)) +(define-extern generic-upload-vu0 "Upload generic VU0 program." (function none)) +(define-extern upload-vu0-program "Upload vu-function to VU0." (function vu-function pointer none)) +(define-extern generic-initialize-without-sync "Init generic, version for generic-merc, which relies on generic-merc init running after." (function matrix vu-lights none)) +(define-extern generic-initialize "Normal init for generic - sets up scratchpad and VU0." (function generic-bucket-state matrix vu-lights none)) +(define-extern generic-wrapup (function generic-bucket-state none)) ;; (define-extern generic-dma-from-spr function) ;; (define-extern generic-light-proc function) ;; (define-extern generic-envmap-proc function) @@ -29870,9 +29888,9 @@ ;; (define-extern generic-copy-vtx-dclr-dtex function) ;; (define-extern generic-none function) ;; (define-extern generic-none-dma-wait function) -;; (define-extern *warp-data* object) ;; object -;; (define-extern generic-warp-source-proc function) ;; (function none) -;; (define-extern generic-warp-source function) ;; (function gsf-buffer none) +(define-extern *warp-data* object) ;; object +(define-extern generic-warp-source-proc (function none)) +(define-extern generic-warp-source (function gsf-buffer none)) ;; (define-extern generic-warp-dest-proc function) ;; (define-extern generic-warp-dest function) ;; (define-extern generic-warp-envmap-dest function) @@ -30057,10 +30075,10 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern fx-copy-buf (function dma-buffer none)) -;; (define-extern *warp-shader* object) ;; adgif-shader -;; (define-extern create-blanket function) ;; (function symbol) -;; (define-extern *warp* object) ;; symbol -;; (define-extern warp-test function) ;; (function object object int none) +(define-extern *warp-shader* adgif-shader) +(define-extern create-blanket (function symbol)) +(define-extern *warp* symbol) +(define-extern warp-test (function object object int none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; texture-anim ;; @@ -30145,8 +30163,8 @@ ;; font-data ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *font12-table* object) ;; (inline-array vector) -;; (define-extern *font24-table* object) ;; (inline-array vector) +(define-extern *font12-table* (inline-array vector)) +(define-extern *font24-table* (inline-array vector)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; font ;; @@ -30157,17 +30175,16 @@ (b float :offset 32)) ) -;; (define-extern draw-string-asm function) ;; (function string dma-buffer font-context draw-string-result) +(define-extern draw-string-asm (function string dma-buffer font-context draw-string-result)) (define-extern draw-string (function string dma-buffer font-context draw-string-result)) -;; (define-extern get-string-length function) ;; (function string font-context draw-string-result) +(define-extern get-string-length (function string font-context draw-string-result)) (define-extern draw-string-xy (function string dma-buffer int int font-color font-flags draw-string-result)) -;; (define-extern draw-string-adv function) ;; (function string dma-buffer font-context none) +(define-extern draw-string-adv (function string dma-buffer font-context none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; decomp ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype huf-dictionary-node (structure) ((zero uint16 :offset-assert 0) (one uint16 :offset-assert 2) @@ -30176,27 +30193,26 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -;; (define-extern unpack-comp-rle function) ;; (function (pointer int8) (pointer int8) (pointer int8)) -;; (define-extern unpack-comp-huf function) ;; (function (pointer uint8) (pointer uint8) uint huf-dictionary-node none) -(define-extern unpack-comp-lzo (function (pointer uint8) (pointer uint8) none)) -;; (define-extern pack-comp-rle function) ;; (function (pointer uint8) (pointer uint8) int int (pointer uint8)) +(define-extern unpack-comp-rle "Decompress data compressed with run-length encoding." (function (pointer int8) (pointer int8) (pointer int8))) +(define-extern unpack-comp-huf "Decompress data compressed with huffman encoding." (function (pointer uint8) (pointer uint8) uint huf-dictionary-node none)) +(define-extern unpack-comp-lzo "Decompress data compressed with LZO encoding." (function (pointer uint8) (pointer uint8) none)) +(define-extern pack-comp-rle "Compress data, used for map mask stuff." (function (pointer uint8) (pointer uint8) int int (pointer uint8))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; background ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *background-work* object) ;; background-work -;; (define-extern background-vu0-block object) ;; vu-function -;; (define-extern background-upload-vu0 function) ;; (function none) -;; (define-extern init-background function) ;; (function none) -;; (define-extern upload-vis-bits function) ;; (function level level bsp-header none) -;; (define-extern set-background-regs! function) ;; (function level none) -;; (define-extern set-tie-quard-planes! function) ;; (function level none) -;; (define-extern set-shrub-quard-planes! function) ;; (function level none) -;; (define-extern set-subdivide-settings! function) -;; (define-extern finish-background function) ;; (function none) +(define-extern *background-work* background-work) +(define-extern background-vu0-block vu-function) +(define-extern background-upload-vu0 "Upload VU0 functions for background. (believed unused?)" (function none)) +(define-extern init-background "Reset lists of trees to draw for background rendering." (function none)) +(define-extern upload-vis-bits "Upload vis data to the scratchpad." (function level level bsp-header none)) +(define-extern set-background-regs! (function level none)) +(define-extern set-tie-quard-planes! "Set up TIE work guard planes." (function level none)) +(define-extern set-shrub-quard-planes! "Set shrub work guard planes." (function level none)) +(define-extern set-subdivide-settings! "Set subdivide settings from the level." (function level none)) +(define-extern finish-background "Run all renderers for background data added." (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; draw-node ;; @@ -30220,17 +30236,14 @@ ;; shrubbery ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype dma-test (structure) - ((data qword 101 :offset-assert 0) ;; guessed by decompiler + ((data qword 101 :inline :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x650 :flag-assert #x900000650 ) -|# -#| (deftype dma-test-work (structure) ((upload dma-packet :inline :offset-assert 0) (end dma-packet :inline :offset-assert 16) @@ -30239,7 +30252,6 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# #| (deftype prototype-shrubbery (drawable-inline-array) @@ -30253,25 +30265,25 @@ ) |# -;; (define-extern mem-usage-shrub-walk function) ;; (function draw-node int memory-usage-block int draw-node) -;; (define-extern highres-shrub-login function) -;; (define-extern shrub-vu1-block object) ;; vu-function -;; (define-extern shrub-num-tris function) ;; (function shrubbery uint) -(define-extern shrub-make-perspective-matrix (function matrix matrix matrix)) -;; (define-extern shrub-init-view-data function) ;; (function shrub-view-data symbol) -;; (define-extern shrub-upload-view-data function) ;; (function dma-buffer symbol) -;; (define-extern shrub-time function) ;; (function int int int int int int) -;; (define-extern shrub-do-init-frame function) ;; (function dma-buffer symbol) -;; (define-extern shrub-init-frame function) ;; (function dma-buffer gs-test symbol) -;; (define-extern shrub-upload-model function) ;; (function shrubbery dma-buffer int symbol) -;; (define-extern draw-inline-array-instance-shrub function) ;; (function dma-buffer drawable int (inline-array prototype-bucket-shrub) none) -;; (define-extern draw-prototype-inline-array-shrub function) ;; (function int (inline-array prototype-bucket-shrub) pointer) -;; (define-extern draw-drawable-tree-instance-shrub function) ;; (function drawable-tree-instance-shrub level none) -;; (define-extern *dma-test* object) ;; dma-test -;; (define-extern *dma-test-work* object) ;; dma-test-work -;; (define-extern init-dma-test function) ;; (function none) -;; (define-extern dma-test-func function) ;; (function none) -;; (define-extern move-test-func function) ;; (function none) +(define-extern mem-usage-shrub-walk "Walk the shrub tree and compute memory usagbe for draw nodes and shrub instances." (function draw-node int memory-usage-block int draw-node)) +(define-extern highres-shrub-login "Set draw-node's distance to max, to force to always draw." (function draw-node none)) +(define-extern shrub-vu1-block vu-function) +(define-extern shrub-num-tris "Get the number of triangles in this shrubbery." (function shrubbery uint)) +(define-extern shrub-make-perspective-matrix "Create shrub drawing matrix." (function matrix matrix matrix)) +(define-extern shrub-init-view-data "Initialize shrub drawing constants." (function shrub-view-data symbol)) +(define-extern shrub-upload-view-data "Create DMA to set shrub vu1 constants." (function dma-buffer symbol)) +(define-extern shrub-time "Unknown. Maybe rough cycle count for a shrub fragment?" (function int int int int int int)) +(define-extern shrub-do-init-frame "Set up DMA to set up VU1 for shrub rendering." (function dma-buffer symbol)) +(define-extern shrub-init-frame "Set up DMA to set up VU1 and GS for shrub rendering." (function dma-buffer gs-test symbol)) +(define-extern shrub-upload-model "Set up DMA to upload a single shrub model." (function shrubbery dma-buffer int symbol)) +(define-extern draw-inline-array-instance-shrub (function dma-buffer drawable int (inline-array prototype-bucket-shrub) none)) +(define-extern draw-prototype-inline-array-shrub (function int (inline-array prototype-bucket-shrub) pointer)) +(define-extern draw-drawable-tree-instance-shrub "Draw a shrub tree!" (function drawable-tree-instance-shrub level none)) +(define-extern *dma-test* dma-test) +(define-extern *dma-test-work* dma-test-work) +(define-extern init-dma-test (function none)) +(define-extern dma-test-func (function none)) +(define-extern move-test-func (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; shrub-work ;; @@ -30339,9 +30351,9 @@ |# ;; (define-extern edge-debug-lines function) ;; (function (array vector-array) none) -;; (define-extern draw-drawable-tree-tfrag function) ;; (function drawable-tree-tfrag none) -;; (define-extern draw-drawable-tree-tfrag-trans function) ;; (function drawable-tree-tfrag none) -;; (define-extern draw-drawable-tree-tfrag-water function) ;; (function drawable-tree-tfrag none) +(define-extern draw-drawable-tree-tfrag (function drawable-tree-tfrag none)) +(define-extern draw-drawable-tree-tfrag-trans (function drawable-tree-tfrag none)) +(define-extern draw-drawable-tree-tfrag-water (function drawable-tree-tfrag none)) ;; (define-extern tfrag-vu1-init-buf function) ;; (function bucket-id gs-test int uint symbol none) ;; (define-extern tfrag-scissor-vu1-init-buf function) ;; (function bucket-id gs-test int uint symbol none) ;; (define-extern *tfrag-init-table* object) ;; (inline-array tfrag-init-data) @@ -30568,7 +30580,7 @@ ;; (define-extern tie-near-init-consts function) ;; (define-extern tie-near-init-engine function) ;; (function dma-buffer gs-test int none) ;; (define-extern tie-near-end-buffer function) ;; (function dma-buffer none) -;; (define-extern tie-scissor-make-perspective-matrix function) ;; (function matrix matrix none) +(define-extern tie-scissor-make-perspective-matrix (function matrix matrix none)) ;; (define-extern tie-near-int-reg function) ;; (define-extern tie-near-float-reg function) @@ -30628,7 +30640,7 @@ ;; (define-extern draw-inline-array-instance-tie function) ;; (function pointer (inline-array instance-tie) int dma-buffer none) ;; (define-extern draw-inline-array-prototype-tie-asm function) ;; (function dma-buffer int prototype-array-tie none) ;; (define-extern instance-tie-patch-buckets function) ;; (function dma-buffer level object) -;; (define-extern draw-drawable-tree-instance-tie function) ;; (function drawable-tree-instance-tie level none) +(define-extern draw-drawable-tree-instance-tie (function drawable-tree-instance-tie level none)) ;; (define-extern tie-init-scissor-buf function) ;; (function bucket-id gs-alpha gs-test gs-test none) ;; (define-extern tie-init-buf function) ;; (function bucket-id gs-alpha gs-test gs-test none) ;; (define-extern tie-init-envmap-buf function) ;; (function bucket-id gs-alpha gs-test none) @@ -31654,8 +31666,8 @@ ;; (define-extern init-time-of-day function) ;; (function object :behavior time-of-day-proc) ;; (define-extern start-time-of-day function) ;; (function (pointer process)) ;; (define-extern time-of-day-setup function) ;; (function symbol symbol) -;; (define-extern time-of-day-interp-colors function) ;; (function (pointer rgba) uint mood-context none) -;; (define-extern time-of-day-interp-colors-scratch function) ;; (function (pointer rgba) time-of-day-palette mood-context none) +(define-extern time-of-day-interp-colors (function (pointer rgba) uint mood-context none)) +(define-extern time-of-day-interp-colors-scratch (function (pointer rgba) time-of-day-palette mood-context none)) ;; (define-extern init-time-of-day-context function) ;; (function time-of-day-context symbol) ;; (define-extern set-filter-color! function) ;; (function float float float none) ;; (define-extern tod-madd! function) ;; (function vector vector vector float) @@ -39942,7 +39954,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern *generic-envmap-texture* object) ;; texture -;; (define-extern *default-envmap-shader* object) ;; adgif-shader +(define-extern *default-envmap-shader* adgif-shader) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; texture-finish ;; diff --git a/decompiler/config/jak3/ntsc_v1/hacks.jsonc b/decompiler/config/jak3/ntsc_v1/hacks.jsonc index 9aa2ebb8de..9867676da9 100644 --- a/decompiler/config/jak3/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak3/ntsc_v1/hacks.jsonc @@ -277,7 +277,45 @@ "add-debug-box-with-transform": [0, 3], "add-debug-line-sphere": [0], "bones-mtx-calc-execute": [19, 7], - "foreground-draw": [0, 1, 126] + "foreground-draw": [0, 1, 126], + "unpack-comp-rle": [1, 3, 5, 6], + "unpack-comp-huf": [2, 4, 5, 6, 7, 8, 9], + "unpack-comp-lzo": [ + 0, + 1, + 4, + 5, + 6, + 7, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, // branch fwd 39 + 39, // branch fwd no delay + 43, // goto 18 + 45 // goto 6 + ], + "(method 16 level)": [0, 1, 5, 13, 14, 15], + "upload-vis-bits": [2, 6, 3, 0], + "set-background-regs!": [4, 3], + "draw-drawable-tree-instance-shrub": [5, 7, 9, 11] }, // Sometimes the game might use format strings that are fetched dynamically, @@ -294,7 +332,7 @@ "moving-sphere-triangle-intersect", "calc-animation-from-spr", "draw-string-asm", - "draw-string", + // "draw-string", "get-string-length", "adgif-shader<-texture-with-update!", "init-boundary-regs", @@ -414,7 +452,8 @@ "generic-warp-envmap-dest", "generic-no-light-proc", "(method 21 cloth-system)", - "debug-line-clip?" + "debug-line-clip?", + "(method 9 font-work)" ], "mips2c_jump_table_functions": {}, diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index 411dd9b193..c04cb696f0 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -318,5 +318,17 @@ "foreground": [ ["L215", "(pointer bucket-id-16)", 462], ["L214", "vector"] + ], + "font-data": [ + ["L1", "(inline-array vector)", 250], + ["L2", "(inline-array vector)", 250] + ], + "shrubbery": [ + ["L155", "(pointer bucket-id)", 12], + ["L152", "(pointer bucket-id)", 12], + ["L151", "(pointer bucket-id)", 12], + ["L150", "(pointer bucket-id)", 12], + ["L153", "(pointer bucket-id)", 12] + ] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index e994ee728a..31a0c9ca2e 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -2495,5 +2495,115 @@ [[340, 364], "v1", "(pointer uint8)"], [364, "v1", "(pointer uint8)"], [[365, 372], "v1", "(pointer uint8)"] - ] + ], + "generic-work-init": [ + [4, "a0", "generic-work"], + [[9, 19], "a0", "generic-work"], + [23, "a1", "generic-work"] + ], + "generic-initialize-without-sync": [ + [8, "a0", "generic-work"], + [21, "a0", "generic-work"] + ], + "generic-initialize": [ + [8, "a0", "generic-work"], + [21, "a0", "generic-work"] + ], + "generic-wrapup": [ + [1, "v1", "generic-work"], + [4, "v1", "generic-work"] + ], + "generic-warp-source": [[2, "at", "generic-work"]], + "(method 9 font-work)": [ + [16, "t0", "(pointer uint32)"], + [47, "a2", "(pointer uint32)"], + [49, "a2", "(pointer uint32)"], + [51, "a2", "(pointer uint32)"], + [53, "a2", "(pointer uint32)"] + ], + "unpack-comp-rle": [[[10, 26], "a0", "(pointer int8)"]], + "unpack-comp-huf": [[[21, 23], "t3", "(pointer uint16)"]], + "(method 16 level)": [ + [222, "v1", "(pointer uint128)"], + [223, "a1", "(pointer uint128)"], + [225, "a0", "(pointer uint128)"], + [[71, 168], "s1", "(pointer int8)"], + [72, "v1", "(pointer int8)"], + [[74, 169], "s0", "(pointer int8)"], + [[170, 193], "s1", "(pointer uint8)"], + [[171, 193], "s2", "(pointer uint8)"], + [227, "v1", "(pointer uint8)"] + ], + "upload-vis-bits": [ + [14, "a1", "(pointer uint128)"], + [[8, 35], "a2", "(pointer uint128)"] + ], + "finish-background": [ + [900, "t4", "(pointer int32)"], + [963, "t4", "(pointer int32)"], + [1026, "t4", "(pointer int32)"], + [1089, "t3", "(pointer int32)"] + ], + "(method 16 drawable-inline-array-node)": [[[1, 7], "v1", "draw-node"]], + "(method 9 shrubbery)": [ + [23, "a2", "(pointer int32)"], + [28, "a3", "(pointer int32)"] + ], + "shrub-upload-view-data": [[[3, 17], "a0", "dma-packet"]], +"shrub-do-init-frame": [ + [[12, 21], "a0", "dma-packet"], + [[26, 29], "a0", "dma-packet"], + [33, "v1", "(pointer vif-tag)"], + [[35, 41], "v1", "(pointer uint32)"], + [42, "v1", "(pointer vif-tag)"], + [[44, 51], "v1", "(pointer uint32)"], + [52, "v1", "(pointer vif-tag)"], + [54, "v1", "(pointer uint32)"] + ], +"shrub-init-frame": [ + [[8, 12], "a0", "dma-packet"], + [[18, 21], "a0", "gs-gif-tag"], + [24, "v1", "(pointer gs-test)"], + [26, "v1", "(pointer gs-reg64)"] + ], +"shrub-upload-model": [ + [[17, 26], "a3", "dma-packet"], + [[33, 41], "a0", "dma-packet"], + [[47, 55], "a0", "dma-packet"] + ], +"draw-prototype-inline-array-shrub": [ + [387, "a0", "prototype-shrubbery"], + [481, "v1", "prototype-shrubbery"], + [[637, 646], "a1", "prototype-bucket-shrub"], + [[301, 392], "s1", "prototype-bucket-shrub"], + [[470, 515], "s1", "prototype-bucket-shrub"], + [[470, 658], "gp", "prototype-bucket-shrub"], + [[13, 56], "v1", "prototype-bucket-shrub"] + // [[102, 114], "a0", "shrub-near-packet"], + // [[114, 117], "v1", "vector4w-3"], + // [118, "a1", "vector4w"], + // [123, "v1", "dma-packet"], + // [[124, 126], "v1", "vector4w"], + // [[334, 364], "s1", "prototype-bucket-shrub"], + // [416, "a0", "drawable-group"], + // [420, "s1", "prototype-bucket-shrub"], + // [525, "v1", "drawable-group"], + // [[518, 535], "s1", "prototype-bucket-shrub"], + // [558, "s1", "prototype-bucket-shrub"], + // [[677, 718], "gp", "prototype-bucket-shrub"], + // [[696, 706], "a1", "prototype-bucket-shrub"] + ], + "(method 8 drawable-tree-instance-shrub)": [[51, "v1", "drawable-group"]], + "(method 13 drawable-tree-instance-shrub)": [ + [[12, 151], "gp", "prototype-bucket-shrub"], + [19, "a1", "drawable-group"], + [45, "v1", "drawable-group"], + [67, "s3", "shrubbery"], + [93, "v1", "drawable-group"], + [115, "s3", "shrubbery"], + [161, "gp", "(inline-array prototype-bucket-shrub)"] + ], + "draw-drawable-tree-instance-shrub": [[86, "a0", "drawable-group"]] + + } diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index aed1459ffa..97fb2ebf24 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -186,6 +186,8 @@ set(RUNTIME_SOURCE mips2c/jak2_functions/vortex.cpp mips2c/jak3_functions/collide_func.cpp mips2c/jak3_functions/debug.cpp + mips2c/jak3_functions/font.cpp + mips2c/jak3_functions/generic_effect.cpp mips2c/jak3_functions/lights.cpp mips2c/jak3_functions/sky.cpp mips2c/mips2c_table.cpp diff --git a/game/mips2c/jak3_functions/font.cpp b/game/mips2c/jak3_functions/font.cpp new file mode 100644 index 0000000000..e4c17c0017 --- /dev/null +++ b/game/mips2c/jak3_functions/font.cpp @@ -0,0 +1,2770 @@ + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace method_9_font_work { +struct Cache { + void* font_work; // *font-work* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->daddiu(sp, sp, -16); // daddiu sp, sp, -16 + c->sd(fp, 8, sp); // sd fp, 8(sp) + c->mov64(fp, t9); // or fp, t9, r0 + c->lui(v1, 17152); // lui v1, 17152 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->lwc1(f1, 76, a1); // lwc1 f1, 76(a1) + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->cvtws(f0, f0); // cvt.w.s f0, f0 + c->mfc1(v1, f0); // mfc1 v1, f0 + c->lq(a2, 12, a1); // lq a2, 12(a1) + c->addiu(a2, r0, 0); // addiu a2, r0, 0 + //beq r0, r0, L122 // beq r0, r0, L122 + // nop // sll r0, r0, 0 + goto block_5; // branch always + + +block_1: + c->addiu(a3, r0, 0); // addiu a3, r0, 0 + //beq r0, r0, L121 // beq r0, r0, L121 + // nop // sll r0, r0, 0 + goto block_3; // branch always + + +block_2: + c->dsll(t0, a3, 2); // dsll t0, a3, 2 + c->dsll(t1, a2, 4); // dsll t1, a2, 4 + c->daddu(t0, t0, t1); // daddu t0, t0, t1 + c->load_symbol2(t1, cache.font_work); // lw t1, *font-work*(s7) + c->daddu(t0, t0, t1); // daddu t0, t0, t1 + c->lwu(t0, 2224, t0); // lwu t0, 2224(t0) + // Unknown instr: ld t1, L124(fp) +/* +L124: +.word 0xffffff +.word 0xffffffff + */ + c->gprs[t1].du32[0] = 0xffffff; + c->gprs[t1].du32[1] = 0xffffffff; + + c->and_(t0, t0, t1); // and t0, t0, t1 + c->dsll32(t1, v1, 24); // dsll32 t1, v1, 24 + c->dsrl32(t1, t1, 0); // dsrl32 t1, t1, 0 + c->or_(t0, t0, t1); // or t0, t0, t1 + c->dsll(t1, a3, 2); // dsll t1, a3, 2 + c->dsll(t2, a2, 4); // dsll t2, a2, 4 + c->daddu(t1, t1, t2); // daddu t1, t1, t2 + c->load_symbol2(t2, cache.font_work); // lw t2, *font-work*(s7) + c->daddu(t1, t1, t2); // daddu t1, t1, t2 + c->sw(t0, 2224, t1); // sw t0, 2224(t1) + c->daddiu(a3, a3, 1); // daddiu a3, a3, 1 + +block_3: + c->slti(t0, a3, 4); // slti t0, a3, 4 + bc = c->sgpr64(t0) != 0; // bne t0, r0, L120 + // nop // sll r0, r0, 0 + if (bc) {goto block_2;} // branch non-likely + + c->mov64(a3, s7); // or a3, s7, r0 + c->mov64(a3, s7); // or a3, s7, r0 + c->daddiu(a2, a2, 1); // daddiu a2, a2, 1 + +block_5: + c->slti(a3, a2, 45); // slti a3, a2, 45 + bc = c->sgpr64(a3) != 0; // bne a3, r0, L119 + // nop // sll r0, r0, 0 + if (bc) {goto block_1;} // branch non-likely + + c->mov64(a2, s7); // or a2, s7, r0 + c->mov64(a2, s7); // or a2, s7, r0 + c->load_symbol2(a2, cache.font_work); // lw a2, *font-work*(s7) + c->sw(v1, 2220, a2); // sw v1, 2220(a2) + c->lw(v1, 60, a1); // lw v1, 60(a1) + // nop // sll r0, r0, 0 + c->sw(v1, 3008, a0); // sw v1, 3008(a0) + // nop // sll r0, r0, 0 + c->sll(v1, v1, 4); // sll v1, v1, 4 + // nop // sll r0, r0, 0 + c->daddu(a2, v1, a0); // daddu a2, v1, a0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->lwu(v1, 2224, a2); // lwu v1, 2224(a2) + // nop // sll r0, r0, 0 + c->lwu(a3, 2228, a2); // lwu a3, 2228(a2) + c->pextlb(v1, r0, v1); // pextlb v1, r0, v1 + c->lwu(a1, 2232, a2); // lwu a1, 2232(a2) + c->pextlh(v1, r0, v1); // pextlh v1, r0, v1 + c->lwu(a2, 2236, a2); // lwu a2, 2236(a2) + c->pextlb(a3, r0, a3); // pextlb a3, r0, a3 + c->sq(v1, 672, a0); // sq v1, 672(a0) + c->pextlh(a3, r0, a3); // pextlh a3, r0, a3 + c->sq(v1, 1056, a0); // sq v1, 1056(a0) + c->pextlb(a1, r0, a1); // pextlb a1, r0, a1 + c->sq(a3, 688, a0); // sq a3, 688(a0) + c->pextlh(a1, r0, a1); // pextlh a1, r0, a1 + c->sq(a3, 1072, a0); // sq a3, 1072(a0) + c->pextlb(a2, r0, a2); // pextlb a2, r0, a2 + c->sq(a1, 704, a0); // sq a1, 704(a0) + c->pextlh(a2, r0, a2); // pextlh a2, r0, a2 + c->sq(a1, 1088, a0); // sq a1, 1088(a0) + // nop // sll r0, r0, 0 + c->sq(a2, 720, a0); // sq a2, 720(a0) + // nop // sll r0, r0, 0 + c->sq(a2, 1104, a0); // sq a2, 1104(a0) + // nop // sll r0, r0, 0 + c->sq(v1, 480, a0); // sq v1, 480(a0) + // nop // sll r0, r0, 0 + c->sq(v1, 544, a0); // sq v1, 544(a0) + // nop // sll r0, r0, 0 + c->sq(a3, 496, a0); // sq a3, 496(a0) + // nop // sll r0, r0, 0 + c->sq(a3, 560, a0); // sq a3, 560(a0) + // nop // sll r0, r0, 0 + c->sq(a1, 512, a0); // sq a1, 512(a0) + // nop // sll r0, r0, 0 + c->sq(a1, 576, a0); // sq a1, 576(a0) + // nop // sll r0, r0, 0 + c->sq(a2, 528, a0); // sq a2, 528(a0) + // nop // sll r0, r0, 0 + c->sq(a2, 592, a0); // sq a2, 592(a0) + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(fp, 8, sp); // ld fp, 8(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 16); // daddiu sp, sp, 16 + goto end_of_function; // return + +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.font_work = intern_from_c(-1, 0, "*font-work*").c(); + gLinkedFunctionTable.reg("(method 9 font-work)", execute, 128); +} + +} // namespace method_9_font_work +} // namespace Mips2C +// add method_9_font_work::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace draw_string_asm { +struct Cache { + void* font_work; // *font-work* + void* font12_table; // *font12-table* + void* font24_table; // *font24-table* + void* math_camera; // *math-camera* + void* video_params; // *video-params* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->load_symbol2(v1, cache.math_camera); // lw v1, *math-camera*(s7) + c->lqc2(vf26, 812, v1); // lqc2 vf26, 812(v1) + c->lqc2(vf27, 812, v1); // lqc2 vf27, 812(v1) + c->vadd_bc(DEST::xy, BC::w, vf26, vf26, vf0); // vaddw.xy vf26, vf26, vf0 + c->vadd_bc(DEST::x, BC::w, vf26, vf26, vf0); // vaddw.x vf26, vf26, vf0 + c->lw(v1, 68, a2); // lw v1, 68(a2) + c->lqc2(vf25, 44, a2); // lqc2 vf25, 44(a2) + c->lqc2(vf23, 12, a2); // lqc2 vf23, 12(a2) + c->lqc2(vf24, 12, a2); // lqc2 vf24, 12(a2) + c->lqc2(vf28, 0, v1); // lqc2 vf28, 0(v1) + c->lqc2(vf29, 16, v1); // lqc2 vf29, 16(v1) + c->lqc2(vf30, 32, v1); // lqc2 vf30, 32(v1) + c->lqc2(vf31, 48, v1); // lqc2 vf31, 48(v1) + c->load_symbol2(v1, cache.video_params); // lw v1, *video-params*(s7) + c->mov64(v1, v1); // or v1, v1, r0 + c->lqc2(vf1, 32, v1); // lqc2 vf1, 32(v1) + c->vdiv(vf0, BC::w, vf25, BC::w); // vdiv Q, vf0.w, vf25.w + c->lqc2(vf2, 16, v1); // lqc2 vf2, 16(v1) + c->vmul(DEST::x, vf25, vf25, vf1); // vmul.x vf25, vf25, vf1 + c->vmul(DEST::x, vf23, vf23, vf1); // vmul.x vf23, vf23, vf1 + c->vmul(DEST::x, vf24, vf24, vf1); // vmul.x vf24, vf24, vf1 + c->vwaitq(); // vwaitq + c->vmulq(DEST::xy, vf25, vf25); // vmulq.xy vf25, vf25, Q + c->vmulq(DEST::xy, vf23, vf23); // vmulq.xy vf23, vf23, Q + c->vmulq(DEST::xy, vf24, vf24); // vmulq.xy vf24, vf24, Q + c->vadd(DEST::xy, vf25, vf25, vf24); // vadd.xy vf25, vf25, vf24 + c->vmul_bc(DEST::x, BC::w, vf28, vf28, vf25); // vmulw.x vf28, vf28, vf25 + c->vmul_bc(DEST::y, BC::w, vf29, vf29, vf25); // vmulw.y vf29, vf29, vf25 + c->vmul(DEST::x, vf28, vf28, vf2); // vmul.x vf28, vf28, vf2 + c->load_symbol2(v1, cache.font_work); // lw v1, *font-work*(s7) + c->mov64(v1, v1); // or v1, v1, r0 + c->sw(a1, 3020, v1); // sw a1, 3020(v1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + c->sw(a0, 3024, v1); // sw a0, 3024(v1) + c->lw(t0, 64, a2); // lw t0, 64(a2) + c->vmove(DEST::xyzw, vf1, vf0); // vmove.xyzw vf1, vf0 + c->vmove(DEST::xyzw, vf2, vf0); // vmove.xyzw vf2, vf0 + c->vmove(DEST::xyzw, vf3, vf0); // vmove.xyzw vf3, vf0 + c->vmove(DEST::xyzw, vf4, vf0); // vmove.xyzw vf4, vf0 + c->sw(t0, 3028, v1); // sw t0, 3028(v1) + c->lqc2(vf16, 416, v1); // lqc2 vf16, 416(v1) + c->lqc2(vf17, 432, v1); // lqc2 vf17, 432(v1) + c->lqc2(vf18, 448, v1); // lqc2 vf18, 448(v1) + c->load_symbol2(a3, cache.video_params); // lw a3, *video-params*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + c->lqc2(vf1, 16, a3); // lqc2 vf1, 16(a3) + c->andi(a3, t0, 32); // andi a3, t0, 32 + // nop // sll r0, r0, 0 + bc = c->sgpr64(a3) != 0; // bne a3, r0, L35 + c->load_symbol2(a3, cache.font12_table); // lw a3, *font12-table*(s7) + if (bc) {goto block_2;} // branch non-likely + + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lq(t1, 80, v1); // lq t1, 80(v1) + // nop // sll r0, r0, 0 + c->lq(t2, 96, v1); // lq t2, 96(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 112, v1); // lq t3, 112(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 128, v1); // lq t4, 128(v1) + // nop // sll r0, r0, 0 + c->sq(t1, 2944, v1); // sq t1, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 2960, v1); // sq t2, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2976, v1); // sq t3, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2992, v1); // sq t4, 2992(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf13, 208, v1); // lqc2 vf13, 208(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 224, v1); // lqc2 vf14, 224(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 240, v1); // lqc2 vf15, 240(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + //beq r0, r0, L36 // beq r0, r0, L36 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + goto block_3; // branch always + + +block_2: + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font24_table); // lw a3, *font24-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lq(t1, 144, v1); // lq t1, 144(v1) + // nop // sll r0, r0, 0 + c->lq(t2, 160, v1); // lq t2, 160(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 176, v1); // lq t3, 176(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 192, v1); // lq t4, 192(v1) + // nop // sll r0, r0, 0 + c->sq(t1, 2944, v1); // sq t1, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 2960, v1); // sq t2, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2976, v1); // sq t3, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2992, v1); // sq t4, 2992(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf13, 256, v1); // lqc2 vf13, 256(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 336, v1); // lqc2 vf15, 336(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 272, v1); // lqc2 vf14, 272(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 288, v1); // lqc2 vf14, 288(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 304, v1); // lqc2 vf14, 304(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 320, v1); // lqc2 vf14, 320(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + // nop // sll r0, r0, 0 + +block_3: + c->lw(t1, 3008, v1); // lw t1, 3008(v1) + // nop // sll r0, r0, 0 + c->sll(t1, t1, 4); // sll t1, t1, 4 + // nop // sll r0, r0, 0 + c->daddu(t2, t1, v1); // daddu t2, t1, v1 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->lwu(t1, 2224, t2); // lwu t1, 2224(t2) + // nop // sll r0, r0, 0 + c->lwu(t3, 2228, t2); // lwu t3, 2228(t2) + c->pextlb(t4, r0, t1); // pextlb t4, r0, t1 + c->lwu(t1, 2232, t2); // lwu t1, 2232(t2) + c->pextlh(t4, r0, t4); // pextlh t4, r0, t4 + c->lwu(t2, 2236, t2); // lwu t2, 2236(t2) + c->pextlb(t3, r0, t3); // pextlb t3, r0, t3 + c->sq(t4, 672, v1); // sq t4, 672(v1) + c->pextlh(t3, r0, t3); // pextlh t3, r0, t3 + c->sq(t4, 1056, v1); // sq t4, 1056(v1) + c->pextlb(t1, r0, t1); // pextlb t1, r0, t1 + c->sq(t3, 688, v1); // sq t3, 688(v1) + c->pextlh(t1, r0, t1); // pextlh t1, r0, t1 + c->sq(t3, 1072, v1); // sq t3, 1072(v1) + c->pextlb(t2, r0, t2); // pextlb t2, r0, t2 + c->sq(t1, 704, v1); // sq t1, 704(v1) + c->pextlh(t2, r0, t2); // pextlh t2, r0, t2 + c->sq(t1, 1088, v1); // sq t1, 1088(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 720, v1); // sq t2, 720(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 1104, v1); // sq t2, 1104(v1) + c->mov64(t1, v1); // or t1, v1, r0 + // nop // sll r0, r0, 0 + +block_4: + c->lbu(t2, 4, a0); // lbu t2, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + c->lqc2(vf20, 2944, v1); // lqc2 vf20, 2944(v1) + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L63 + c->daddiu(t3, t2, -3); // daddiu t3, t2, -3 + if (bc) {goto block_78;} // branch non-likely + + bc = ((s64)c->sgpr64(t3)) <= 0; // blez t3, L52 + c->daddiu(t3, t2, -126); // daddiu t3, t2, -126 + if (bc) {goto block_59;} // branch non-likely + + bc = c->sgpr64(t3) != 0; // bne t3, r0, L56 + // nop // sll r0, r0, 0 + if (bc) {goto block_65;} // branch non-likely + + c->lbu(t2, 4, a0); // lbu t2, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + c->addiu(t3, r0, 0); // addiu t3, r0, 0 + c->addiu(t4, r0, 0); // addiu t4, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L63 + c->daddiu(t5, t2, -43); // daddiu t5, t2, -43 + if (bc) {goto block_78;} // branch non-likely + + c->movz(t3, t2, t5); // movz t3, t2, t5 + c->daddiu(t5, t2, -45); // daddiu t5, t2, -45 + c->movz(t3, t2, t5); // movz t3, t2, t5 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t3) != 0; // bne t3, r0, L38 + c->daddiu(t5, t2, -91); // daddiu t5, t2, -91 + if (bc) {goto block_18;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L37 + c->daddiu(t4, t2, -93); // daddiu t4, t2, -93 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L37 + c->daddiu(t4, t2, -121); // daddiu t4, t2, -121 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L50 + c->daddiu(t4, t2, -89); // daddiu t4, t2, -89 + if (bc) {goto block_57;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L50 + c->daddiu(t4, t2, -122); // daddiu t4, t2, -122 + if (bc) {goto block_57;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L51 + c->daddiu(t4, t2, -90); // daddiu t4, t2, -90 + if (bc) {goto block_58;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L51 + c->daddiu(t4, t2, -48); // daddiu t4, t2, -48 + if (bc) {goto block_58;} // branch non-likely + + bc = ((s64)c->sgpr64(t4)) < 0; // bltz t4, L56 + c->daddiu(t4, t2, -57); // daddiu t4, t2, -57 + if (bc) {goto block_65;} // branch non-likely + + bc = ((s64)c->sgpr64(t4)) > 0; // bgtz t4, L56 + c->daddiu(t4, t2, -126); // daddiu t4, t2, -126 + if (bc) {goto block_65;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L56 + c->daddiu(t4, t2, -48); // daddiu t4, t2, -48 + if (bc) {goto block_65;} // branch non-likely + + +block_18: + c->lbu(t2, 4, a0); // lbu t2, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L63 + c->daddiu(t5, t2, -110); // daddiu t5, t2, -110 + if (bc) {goto block_78;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L39 + c->daddiu(t5, t2, -78); // daddiu t5, t2, -78 + if (bc) {goto block_38;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L39 + c->daddiu(t5, t2, -108); // daddiu t5, t2, -108 + if (bc) {goto block_38;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L37 + c->daddiu(t5, t2, -76); // daddiu t5, t2, -76 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L37 + c->daddiu(t5, t2, -119); // daddiu t5, t2, -119 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L37 + c->daddiu(t5, t2, -87); // daddiu t5, t2, -87 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L37 + c->daddiu(t5, t2, -107); // daddiu t5, t2, -107 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L41 + c->daddiu(t5, t2, -75); // daddiu t5, t2, -75 + if (bc) {goto block_41;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L41 + c->daddiu(t5, t2, -106); // daddiu t5, t2, -106 + if (bc) {goto block_41;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L42 + c->daddiu(t5, t2, -74); // daddiu t5, t2, -74 + if (bc) {goto block_43;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L42 + c->daddiu(t5, t2, -104); // daddiu t5, t2, -104 + if (bc) {goto block_43;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L44 + c->daddiu(t5, t2, -72); // daddiu t5, t2, -72 + if (bc) {goto block_47;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L44 + c->daddiu(t5, t2, -118); // daddiu t5, t2, -118 + if (bc) {goto block_47;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L47 + c->daddiu(t5, t2, -86); // daddiu t5, t2, -86 + if (bc) {goto block_52;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L47 + c->daddiu(t5, t2, -117); // daddiu t5, t2, -117 + if (bc) {goto block_52;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L37 + c->daddiu(t5, t2, -85); // daddiu t5, t2, -85 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L37 + c->daddiu(t5, t2, -48); // daddiu t5, t2, -48 + if (bc) {goto block_4;} // branch non-likely + + bc = ((s64)c->sgpr64(t5)) < 0; // bltz t5, L56 + c->daddiu(t6, t2, -57); // daddiu t6, t2, -57 + if (bc) {goto block_65;} // branch non-likely + + bc = ((s64)c->sgpr64(t6)) > 0; // bgtz t6, L56 + c->sll(t6, t4, 2); // sll t6, t4, 2 + if (bc) {goto block_65;} // branch non-likely + + c->daddu(t2, t4, t6); // daddu t2, t4, t6 + // nop // sll r0, r0, 0 + c->sll(t2, t2, 1); // sll t2, t2, 1 + // nop // sll r0, r0, 0 + //beq r0, r0, L38 // beq r0, r0, L38 + c->daddu(t4, t2, t5); // daddu t4, t2, t5 + goto block_18; // branch always + + +block_38: + bc = c->sgpr64(t4) != 0; // bne t4, r0, L40 + c->addiu(t2, r0, -33); // addiu t2, r0, -33 + if (bc) {goto block_40;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(a3, 80, v1); // lq a3, 80(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 96, v1); // lq t3, 96(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 112, v1); // lq t4, 112(v1) + // nop // sll r0, r0, 0 + c->lq(t5, 128, v1); // lq t5, 128(v1) + // nop // sll r0, r0, 0 + c->sq(a3, 2944, v1); // sq a3, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2960, v1); // sq t3, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2976, v1); // sq t4, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t5, 2992, v1); // sq t5, 2992(v1) + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font12_table); // lw a3, *font12-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 208, v1); // lqc2 vf13, 208(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 224, v1); // lqc2 vf14, 224(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 240, v1); // lqc2 vf15, 240(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + //beq r0, r0, L37 // beq r0, r0, L37 + c->and_(t0, t0, t2); // and t0, t0, t2 + goto block_4; // branch always + + +block_40: + // nop // sll r0, r0, 0 + c->lq(a3, 144, v1); // lq a3, 144(v1) + // nop // sll r0, r0, 0 + c->lq(t2, 160, v1); // lq t2, 160(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 176, v1); // lq t3, 176(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 192, v1); // lq t4, 192(v1) + // nop // sll r0, r0, 0 + c->sq(a3, 2944, v1); // sq a3, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 2960, v1); // sq t2, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2976, v1); // sq t3, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2992, v1); // sq t4, 2992(v1) + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font24_table); // lw a3, *font24-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 256, v1); // lqc2 vf13, 256(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 336, v1); // lqc2 vf15, 336(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 272, v1); // lqc2 vf14, 272(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 288, v1); // lqc2 vf14, 288(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 304, v1); // lqc2 vf14, 304(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 320, v1); // lqc2 vf14, 320(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + //beq r0, r0, L37 // beq r0, r0, L37 + c->ori(t0, t0, 32); // ori t0, t0, 32 + goto block_4; // branch always + + +block_41: + c->addiu(t2, r0, -3); // addiu t2, r0, -3 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L37 + c->and_(t0, t0, t2); // and t0, t0, t2 + if (bc) {goto block_4;} // branch non-likely + + //beq r0, r0, L37 // beq r0, r0, L37 + c->ori(t0, t0, 2); // ori t0, t0, 2 + goto block_4; // branch always + + +block_43: + c->addiu(t2, r0, -21); // addiu t2, r0, -21 + c->daddiu(t3, t4, -2); // daddiu t3, t4, -2 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L37 + c->and_(t0, t0, t2); // and t0, t0, t2 + if (bc) {goto block_4;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L43 + // nop // sll r0, r0, 0 + if (bc) {goto block_46;} // branch non-likely + + //beq r0, r0, L37 // beq r0, r0, L37 + c->ori(t0, t0, 16); // ori t0, t0, 16 + goto block_4; // branch always + + +block_46: + //beq r0, r0, L37 // beq r0, r0, L37 + c->ori(t0, t0, 4); // ori t0, t0, 4 + goto block_4; // branch always + + +block_47: + c->mov128_vf_gpr(vf1, t4); // qmtc2.i vf1, t4 + c->daddiu(t2, t3, -45); // daddiu t2, t3, -45 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L46 + c->vitof0(DEST::xyzw, vf1, vf1); // vitof0.xyzw vf1, vf1 + if (bc) {goto block_51;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L45 + // nop // sll r0, r0, 0 + if (bc) {goto block_50;} // branch non-likely + + //beq r0, r0, L37 // beq r0, r0, L37 + c->vadd_bc(DEST::x, BC::x, vf23, vf23, vf1); // vaddx.x vf23, vf23, vf1 + goto block_4; // branch always + + +block_50: + //beq r0, r0, L37 // beq r0, r0, L37 + c->vsub_bc(DEST::x, BC::x, vf23, vf23, vf1); // vsubx.x vf23, vf23, vf1 + goto block_4; // branch always + + +block_51: + //beq r0, r0, L37 // beq r0, r0, L37 + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf1); // vaddx.x vf23, vf0, vf1 + goto block_4; // branch always + + +block_52: + c->mov128_vf_gpr(vf1, t4); // qmtc2.i vf1, t4 + c->daddiu(t2, t3, -45); // daddiu t2, t3, -45 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L49 + c->vitof0(DEST::xyzw, vf1, vf1); // vitof0.xyzw vf1, vf1 + if (bc) {goto block_56;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L48 + // nop // sll r0, r0, 0 + if (bc) {goto block_55;} // branch non-likely + + //beq r0, r0, L37 // beq r0, r0, L37 + c->vadd_bc(DEST::y, BC::x, vf23, vf23, vf1); // vaddx.y vf23, vf23, vf1 + goto block_4; // branch always + + +block_55: + //beq r0, r0, L37 // beq r0, r0, L37 + c->vsub_bc(DEST::y, BC::x, vf23, vf23, vf1); // vsubx.y vf23, vf23, vf1 + goto block_4; // branch always + + +block_56: + //beq r0, r0, L37 // beq r0, r0, L37 + c->vadd_bc(DEST::y, BC::x, vf23, vf0, vf1); // vaddx.y vf23, vf0, vf1 + goto block_4; // branch always + + +block_57: + //beq r0, r0, L37 // beq r0, r0, L37 + c->sqc2(vf23, 464, v1); // sqc2 vf23, 464(v1) + goto block_4; // branch always + + +block_58: + //beq r0, r0, L37 // beq r0, r0, L37 + c->lqc2(vf23, 464, v1); // lqc2 vf23, 464(v1) + goto block_4; // branch always + + +block_59: + c->daddiu(t3, t2, -3); // daddiu t3, t2, -3 + c->ori(t0, t0, 64); // ori t0, t0, 64 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L54 + c->daddiu(t2, t2, -2); // daddiu t2, t2, -2 + if (bc) {goto block_63;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L53 + c->lqc2(vf14, 384, v1); // lqc2 vf14, 384(v1) + if (bc) {goto block_62;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lqc2(vf14, 368, v1); // lqc2 vf14, 368(v1) + //beq r0, r0, L55 // beq r0, r0, L55 + c->lqc2(vf20, 2960, v1); // lqc2 vf20, 2960(v1) + goto block_64; // branch always + + +block_62: + //beq r0, r0, L55 // beq r0, r0, L55 + c->lqc2(vf20, 2976, v1); // lqc2 vf20, 2976(v1) + goto block_64; // branch always + + +block_63: + // nop // sll r0, r0, 0 + c->lqc2(vf14, 400, v1); // lqc2 vf14, 400(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf20, 2992, v1); // lqc2 vf20, 2992(v1) + +block_64: + c->lbu(t2, 4, a0); // lbu t2, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + c->vadd(DEST::xyz, vf4, vf23, vf15); // vadd.xyz vf4, vf23, vf15 + c->sll(t3, t2, 4); // sll t3, t2, 4 + //beq r0, r0, L60 // beq r0, r0, L60 + c->vsub(DEST::xyzw, vf1, vf25, vf23); // vsub.xyzw vf1, vf25, vf23 + goto block_72; // branch always + + +block_65: + // nop // sll r0, r0, 0 + c->addiu(t3, r0, -65); // addiu t3, r0, -65 + c->and_(t0, t0, t3); // and t0, t0, t3 + c->lqc2(vf14, 352, v1); // lqc2 vf14, 352(v1) + c->vadd(DEST::xyz, vf4, vf23, vf15); // vadd.xyz vf4, vf23, vf15 + c->sll(t3, t2, 4); // sll t3, t2, 4 + c->vsub(DEST::xyzw, vf1, vf25, vf23); // vsub.xyzw vf1, vf25, vf23 + c->daddiu(t4, t2, -10); // daddiu t4, t2, -10 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L57 + c->daddiu(t2, t2, -13); // daddiu t2, t2, -13 + if (bc) {goto block_67;} // branch non-likely + + bc = c->sgpr64(t2) != 0; // bne t2, r0, L60 + // nop // sll r0, r0, 0 + if (bc) {goto block_72;} // branch non-likely + + +block_67: + c->vsub(DEST::xyzw, vf1, vf23, vf24); // vsub.xyzw vf1, vf23, vf24 + c->andi(t2, t0, 16); // andi t2, t0, 16 + bc = c->sgpr64(t2) != 0; // bne t2, r0, L58 + c->andi(t2, t0, 4); // andi t2, t0, 4 + if (bc) {goto block_70;} // branch non-likely + + bc = c->sgpr64(t2) != 0; // bne t2, r0, L59 + // nop // sll r0, r0, 0 + if (bc) {goto block_71;} // branch non-likely + + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf24); // vaddx.x vf23, vf0, vf24 + // nop // sll r0, r0, 0 + c->sqc2(vf23, 1184, t1); // sqc2 vf23, 1184(t1) + c->vadd_bc(DEST::y, BC::w, vf23, vf23, vf15); // vaddw.y vf23, vf23, vf15 + //beq r0, r0, L37 // beq r0, r0, L37 + c->daddiu(t1, t1, 16); // daddiu t1, t1, 16 + goto block_4; // branch always + + +block_70: + c->vsub(DEST::x, vf23, vf24, vf1); // vsub.x vf23, vf24, vf1 + c->sqc2(vf23, 1184, t1); // sqc2 vf23, 1184(t1) + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf24); // vaddx.x vf23, vf0, vf24 + c->vadd_bc(DEST::y, BC::w, vf23, vf23, vf15); // vaddw.y vf23, vf23, vf15 + //beq r0, r0, L37 // beq r0, r0, L37 + c->daddiu(t1, t1, 16); // daddiu t1, t1, 16 + goto block_4; // branch always + + +block_71: + c->vmul_bc(DEST::x, BC::w, vf1, vf1, vf16); // vmulw.x vf1, vf1, vf16 + // nop // sll r0, r0, 0 + c->vsub(DEST::x, vf23, vf24, vf1); // vsub.x vf23, vf24, vf1 + c->sqc2(vf23, 1184, t1); // sqc2 vf23, 1184(t1) + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf24); // vaddx.x vf23, vf0, vf24 + c->vadd_bc(DEST::y, BC::w, vf23, vf23, vf15); // vaddw.y vf23, vf23, vf15 + //beq r0, r0, L37 // beq r0, r0, L37 + c->daddiu(t1, t1, 16); // daddiu t1, t1, 16 + goto block_4; // branch always + + +block_72: + c->addu(t2, t3, a3); // addu t2, t3, a3 + // nop // sll r0, r0, 0 + c->lqc2(vf5, -96, t2); // lqc2 vf5, -96(t2) + c->mov128_gpr_vf(t2, vf1); // qmfc2.i t2, vf1 + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L63 + c->sra(t2, t2, 31); // sra t2, t2, 31 + if (bc) {goto block_78;} // branch non-likely + + c->vmul(DEST::xyzw, vf19, vf5, vf13); // vmul.xyzw vf19, vf5, vf13 + c->andi(t2, t0, 2); // andi t2, t0, 2 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L61 + c->andi(t2, t0, 64); // andi t2, t0, 64 + if (bc) {goto block_76;} // branch non-likely + + bc = c->sgpr64(t2) != 0; // bne t2, r0, L61 + // nop // sll r0, r0, 0 + if (bc) {goto block_76;} // branch non-likely + + //beq r0, r0, L62 // beq r0, r0, L62 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf19); // vaddw.x vf23, vf23, vf19 + goto block_77; // branch always + + +block_76: + // nop // sll r0, r0, 0 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14 + +block_77: + //beq r0, r0, L37 // beq r0, r0, L37 + // nop // sll r0, r0, 0 + goto block_4; // branch always + + +block_78: + c->vsub(DEST::xyzw, vf1, vf23, vf24); // vsub.xyzw vf1, vf23, vf24 + c->andi(a0, t0, 16); // andi a0, t0, 16 + bc = c->sgpr64(a0) != 0; // bne a0, r0, L64 + c->andi(a0, t0, 4); // andi a0, t0, 4 + if (bc) {goto block_81;} // branch non-likely + + bc = c->sgpr64(a0) != 0; // bne a0, r0, L65 + // nop // sll r0, r0, 0 + if (bc) {goto block_82;} // branch non-likely + + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf24); // vaddx.x vf23, vf0, vf24 + // nop // sll r0, r0, 0 + //beq r0, r0, L66 // beq r0, r0, L66 + c->sqc2(vf23, 1184, t1); // sqc2 vf23, 1184(t1) + goto block_83; // branch always + + +block_81: + c->vsub(DEST::x, vf23, vf24, vf1); // vsub.x vf23, vf24, vf1 + // nop // sll r0, r0, 0 + //beq r0, r0, L66 // beq r0, r0, L66 + c->sqc2(vf23, 1184, t1); // sqc2 vf23, 1184(t1) + goto block_83; // branch always + + +block_82: + c->vmul_bc(DEST::x, BC::w, vf1, vf1, vf16); // vmulw.x vf1, vf1, vf16 + // nop // sll r0, r0, 0 + c->vsub(DEST::x, vf23, vf24, vf1); // vsub.x vf23, vf24, vf1 + c->sqc2(vf23, 1184, t1); // sqc2 vf23, 1184(t1) + +block_83: + c->lw(a0, 3028, v1); // lw a0, 3028(v1) + c->mov64(t0, v1); // or t0, v1, r0 + c->lw(t1, 3024, v1); // lw t1, 3024(v1) + c->lqc2(vf23, 1184, t0); // lqc2 vf23, 1184(t0) + +block_84: + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + c->lqc2(vf20, 2944, v1); // lqc2 vf20, 2944(v1) + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L90 + c->daddiu(t3, t2, -3); // daddiu t3, t2, -3 + if (bc) {goto block_158;} // branch non-likely + + bc = ((s64)c->sgpr64(t3)) <= 0; // blez t3, L81 + c->daddiu(t3, t2, -126); // daddiu t3, t2, -126 + if (bc) {goto block_137;} // branch non-likely + + bc = c->sgpr64(t3) != 0; // bne t3, r0, L85 + // nop // sll r0, r0, 0 + if (bc) {goto block_143;} // branch non-likely + + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + c->addiu(t3, r0, 0); // addiu t3, r0, 0 + c->addiu(t4, r0, 0); // addiu t4, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L90 + c->daddiu(t5, t2, -43); // daddiu t5, t2, -43 + if (bc) {goto block_158;} // branch non-likely + + c->movz(t3, t2, t5); // movz t3, t2, t5 + c->daddiu(t5, t2, -45); // daddiu t5, t2, -45 + c->movz(t3, t2, t5); // movz t3, t2, t5 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t3) != 0; // bne t3, r0, L68 + c->daddiu(t5, t2, -91); // daddiu t5, t2, -91 + if (bc) {goto block_98;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L67 + c->daddiu(t4, t2, -93); // daddiu t4, t2, -93 + if (bc) {goto block_84;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L67 + c->daddiu(t4, t2, -121); // daddiu t4, t2, -121 + if (bc) {goto block_84;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L79 + c->daddiu(t4, t2, -89); // daddiu t4, t2, -89 + if (bc) {goto block_135;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L79 + c->daddiu(t4, t2, -122); // daddiu t4, t2, -122 + if (bc) {goto block_135;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L80 + c->daddiu(t4, t2, -90); // daddiu t4, t2, -90 + if (bc) {goto block_136;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L80 + c->daddiu(t4, t2, -48); // daddiu t4, t2, -48 + if (bc) {goto block_136;} // branch non-likely + + bc = ((s64)c->sgpr64(t4)) < 0; // bltz t4, L85 + c->daddiu(t4, t2, -57); // daddiu t4, t2, -57 + if (bc) {goto block_143;} // branch non-likely + + bc = ((s64)c->sgpr64(t4)) > 0; // bgtz t4, L85 + c->daddiu(t4, t2, -126); // daddiu t4, t2, -126 + if (bc) {goto block_143;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L85 + c->daddiu(t4, t2, -48); // daddiu t4, t2, -48 + if (bc) {goto block_143;} // branch non-likely + + +block_98: + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L90 + c->daddiu(t5, t2, -110); // daddiu t5, t2, -110 + if (bc) {goto block_158;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L69 + c->daddiu(t5, t2, -78); // daddiu t5, t2, -78 + if (bc) {goto block_118;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L69 + c->daddiu(t5, t2, -108); // daddiu t5, t2, -108 + if (bc) {goto block_118;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L67 + c->daddiu(t5, t2, -76); // daddiu t5, t2, -76 + if (bc) {goto block_84;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L67 + c->daddiu(t5, t2, -119); // daddiu t5, t2, -119 + if (bc) {goto block_84;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L71 + c->daddiu(t5, t2, -87); // daddiu t5, t2, -87 + if (bc) {goto block_121;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L71 + c->daddiu(t5, t2, -107); // daddiu t5, t2, -107 + if (bc) {goto block_121;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L72 + c->daddiu(t5, t2, -75); // daddiu t5, t2, -75 + if (bc) {goto block_123;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L72 + c->daddiu(t5, t2, -106); // daddiu t5, t2, -106 + if (bc) {goto block_123;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L67 + c->daddiu(t5, t2, -74); // daddiu t5, t2, -74 + if (bc) {goto block_84;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L67 + c->daddiu(t5, t2, -104); // daddiu t5, t2, -104 + if (bc) {goto block_84;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L73 + c->daddiu(t5, t2, -72); // daddiu t5, t2, -72 + if (bc) {goto block_125;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L73 + c->daddiu(t5, t2, -118); // daddiu t5, t2, -118 + if (bc) {goto block_125;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L76 + c->daddiu(t5, t2, -86); // daddiu t5, t2, -86 + if (bc) {goto block_130;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L76 + c->daddiu(t5, t2, -117); // daddiu t5, t2, -117 + if (bc) {goto block_130;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L67 + c->daddiu(t5, t2, -85); // daddiu t5, t2, -85 + if (bc) {goto block_84;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L67 + c->daddiu(t5, t2, -48); // daddiu t5, t2, -48 + if (bc) {goto block_84;} // branch non-likely + + bc = ((s64)c->sgpr64(t5)) < 0; // bltz t5, L85 + c->daddiu(t6, t2, -57); // daddiu t6, t2, -57 + if (bc) {goto block_143;} // branch non-likely + + bc = ((s64)c->sgpr64(t6)) > 0; // bgtz t6, L85 + c->sll(t6, t4, 2); // sll t6, t4, 2 + if (bc) {goto block_143;} // branch non-likely + + c->daddu(t2, t4, t6); // daddu t2, t4, t6 + // nop // sll r0, r0, 0 + c->sll(t2, t2, 1); // sll t2, t2, 1 + // nop // sll r0, r0, 0 + //beq r0, r0, L68 // beq r0, r0, L68 + c->daddu(t4, t2, t5); // daddu t4, t2, t5 + goto block_98; // branch always + + +block_118: + bc = c->sgpr64(t4) != 0; // bne t4, r0, L70 + c->addiu(t2, r0, -33); // addiu t2, r0, -33 + if (bc) {goto block_120;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(a3, 80, v1); // lq a3, 80(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 96, v1); // lq t3, 96(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 112, v1); // lq t4, 112(v1) + // nop // sll r0, r0, 0 + c->lq(t5, 128, v1); // lq t5, 128(v1) + // nop // sll r0, r0, 0 + c->sq(a3, 2944, v1); // sq a3, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2960, v1); // sq t3, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2976, v1); // sq t4, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t5, 2992, v1); // sq t5, 2992(v1) + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font12_table); // lw a3, *font12-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 208, v1); // lqc2 vf13, 208(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 224, v1); // lqc2 vf14, 224(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 240, v1); // lqc2 vf15, 240(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + //beq r0, r0, L67 // beq r0, r0, L67 + c->and_(a0, a0, t2); // and a0, a0, t2 + goto block_84; // branch always + + +block_120: + // nop // sll r0, r0, 0 + c->lq(a3, 144, v1); // lq a3, 144(v1) + // nop // sll r0, r0, 0 + c->lq(t2, 160, v1); // lq t2, 160(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 176, v1); // lq t3, 176(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 192, v1); // lq t4, 192(v1) + // nop // sll r0, r0, 0 + c->sq(a3, 2944, v1); // sq a3, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 2960, v1); // sq t2, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2976, v1); // sq t3, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2992, v1); // sq t4, 2992(v1) + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font24_table); // lw a3, *font24-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 256, v1); // lqc2 vf13, 256(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 336, v1); // lqc2 vf15, 336(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 272, v1); // lqc2 vf14, 272(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 288, v1); // lqc2 vf14, 288(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 304, v1); // lqc2 vf14, 304(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 320, v1); // lqc2 vf14, 320(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + //beq r0, r0, L67 // beq r0, r0, L67 + c->ori(a0, a0, 32); // ori a0, a0, 32 + goto block_84; // branch always + + +block_121: + c->addiu(t2, r0, -2); // addiu t2, r0, -2 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L67 + c->and_(a0, a0, t2); // and a0, a0, t2 + if (bc) {goto block_84;} // branch non-likely + + //beq r0, r0, L67 // beq r0, r0, L67 + c->ori(a0, a0, 1); // ori a0, a0, 1 + goto block_84; // branch always + + +block_123: + c->addiu(t2, r0, -3); // addiu t2, r0, -3 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L67 + c->and_(a0, a0, t2); // and a0, a0, t2 + if (bc) {goto block_84;} // branch non-likely + + //beq r0, r0, L67 // beq r0, r0, L67 + c->ori(a0, a0, 2); // ori a0, a0, 2 + goto block_84; // branch always + + +block_125: + c->mov128_vf_gpr(vf1, t4); // qmtc2.i vf1, t4 + c->daddiu(t2, t3, -45); // daddiu t2, t3, -45 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L75 + c->vitof0(DEST::xyzw, vf1, vf1); // vitof0.xyzw vf1, vf1 + if (bc) {goto block_129;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L74 + // nop // sll r0, r0, 0 + if (bc) {goto block_128;} // branch non-likely + + //beq r0, r0, L67 // beq r0, r0, L67 + c->vadd_bc(DEST::x, BC::x, vf23, vf23, vf1); // vaddx.x vf23, vf23, vf1 + goto block_84; // branch always + + +block_128: + //beq r0, r0, L67 // beq r0, r0, L67 + c->vsub_bc(DEST::x, BC::x, vf23, vf23, vf1); // vsubx.x vf23, vf23, vf1 + goto block_84; // branch always + + +block_129: + //beq r0, r0, L67 // beq r0, r0, L67 + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf1); // vaddx.x vf23, vf0, vf1 + goto block_84; // branch always + + +block_130: + c->mov128_vf_gpr(vf1, t4); // qmtc2.i vf1, t4 + c->daddiu(t2, t3, -45); // daddiu t2, t3, -45 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L78 + c->vitof0(DEST::xyzw, vf1, vf1); // vitof0.xyzw vf1, vf1 + if (bc) {goto block_134;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L77 + // nop // sll r0, r0, 0 + if (bc) {goto block_133;} // branch non-likely + + //beq r0, r0, L67 // beq r0, r0, L67 + c->vadd_bc(DEST::y, BC::x, vf23, vf23, vf1); // vaddx.y vf23, vf23, vf1 + goto block_84; // branch always + + +block_133: + //beq r0, r0, L67 // beq r0, r0, L67 + c->vsub_bc(DEST::y, BC::x, vf23, vf23, vf1); // vsubx.y vf23, vf23, vf1 + goto block_84; // branch always + + +block_134: + //beq r0, r0, L67 // beq r0, r0, L67 + c->vadd_bc(DEST::y, BC::x, vf23, vf0, vf1); // vaddx.y vf23, vf0, vf1 + goto block_84; // branch always + + +block_135: + //beq r0, r0, L67 // beq r0, r0, L67 + c->sqc2(vf23, 464, v1); // sqc2 vf23, 464(v1) + goto block_84; // branch always + + +block_136: + //beq r0, r0, L67 // beq r0, r0, L67 + c->lqc2(vf23, 464, v1); // lqc2 vf23, 464(v1) + goto block_84; // branch always + + +block_137: + c->daddiu(t3, t2, -3); // daddiu t3, t2, -3 + c->ori(a0, a0, 64); // ori a0, a0, 64 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L83 + c->daddiu(t2, t2, -2); // daddiu t2, t2, -2 + if (bc) {goto block_141;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L82 + c->lqc2(vf14, 384, v1); // lqc2 vf14, 384(v1) + if (bc) {goto block_140;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lqc2(vf14, 368, v1); // lqc2 vf14, 368(v1) + //beq r0, r0, L84 // beq r0, r0, L84 + c->lqc2(vf20, 2960, v1); // lqc2 vf20, 2960(v1) + goto block_142; // branch always + + +block_140: + //beq r0, r0, L84 // beq r0, r0, L84 + c->lqc2(vf20, 2976, v1); // lqc2 vf20, 2976(v1) + goto block_142; // branch always + + +block_141: + // nop // sll r0, r0, 0 + c->lqc2(vf14, 400, v1); // lqc2 vf14, 400(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf20, 2992, v1); // lqc2 vf20, 2992(v1) + +block_142: + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + c->vadd(DEST::xyz, vf4, vf23, vf15); // vadd.xyz vf4, vf23, vf15 + c->sll(t3, t2, 4); // sll t3, t2, 4 + //beq r0, r0, L87 // beq r0, r0, L87 + c->vsub(DEST::xyzw, vf1, vf25, vf23); // vsub.xyzw vf1, vf25, vf23 + goto block_146; // branch always + + +block_143: + // nop // sll r0, r0, 0 + c->addiu(t3, r0, -65); // addiu t3, r0, -65 + c->and_(a0, a0, t3); // and a0, a0, t3 + c->lqc2(vf14, 352, v1); // lqc2 vf14, 352(v1) + c->vadd(DEST::xyz, vf4, vf23, vf15); // vadd.xyz vf4, vf23, vf15 + c->sll(t3, t2, 4); // sll t3, t2, 4 + c->vsub(DEST::xyzw, vf1, vf25, vf23); // vsub.xyzw vf1, vf25, vf23 + c->daddiu(t4, t2, -10); // daddiu t4, t2, -10 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L86 + c->daddiu(t2, t2, -13); // daddiu t2, t2, -13 + if (bc) {goto block_145;} // branch non-likely + + bc = c->sgpr64(t2) != 0; // bne t2, r0, L87 + // nop // sll r0, r0, 0 + if (bc) {goto block_146;} // branch non-likely + + +block_145: + // nop // sll r0, r0, 0 + c->daddiu(t0, t0, 16); // daddiu t0, t0, 16 + //beq r0, r0, L67 // beq r0, r0, L67 + c->lqc2(vf23, 1184, t0); // lqc2 vf23, 1184(t0) + goto block_84; // branch always + + +block_146: + // nop // sll r0, r0, 0 + c->addu(t2, t3, a3); // addu t2, t3, a3 + c->lqc2(vf5, -96, t2); // lqc2 vf5, -96(t2) + c->mov128_gpr_vf(t2, vf1); // qmfc2.i t2, vf1 + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L90 + c->vadd(DEST::xyz, vf6, vf5, vf16); // vadd.xyz vf6, vf5, vf16 + if (bc) {goto block_158;} // branch non-likely + + c->sra(t2, t2, 31); // sra t2, t2, 31 + c->vadd(DEST::xyz, vf7, vf5, vf17); // vadd.xyz vf7, vf5, vf17 + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L67 + c->vadd(DEST::xyz, vf8, vf5, vf18); // vadd.xyz vf8, vf5, vf18 + if (bc) {goto block_84;} // branch non-likely + + c->vadd(DEST::xyz, vf1, vf23, vf0); // vadd.xyz vf1, vf23, vf0 + c->andi(t2, a0, 1); // andi t2, a0, 1 + c->vadd(DEST::xyz, vf2, vf23, vf13); // vadd.xyz vf2, vf23, vf13 + c->sqc2(vf5, 736, v1); // sqc2 vf5, 736(v1) + c->vadd(DEST::xyz, vf3, vf23, vf14); // vadd.xyz vf3, vf23, vf14 + c->sqc2(vf6, 752, v1); // sqc2 vf6, 752(v1) + c->vmul(DEST::xyzw, vf19, vf5, vf13); // vmul.xyzw vf19, vf5, vf13 + c->sqc2(vf7, 768, v1); // sqc2 vf7, 768(v1) + bc = c->sgpr64(t2) == 0; // beq t2, r0, L67 + c->sqc2(vf8, 784, v1); // sqc2 vf8, 784(v1) + if (bc) {goto block_84;} // branch non-likely + + // nop // sll r0, r0, 0 + c->sqc2(vf1, 608, v1); // sqc2 vf1, 608(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf2, 624, v1); // sqc2 vf2, 624(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf3, 640, v1); // sqc2 vf3, 640(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf4, 656, v1); // sqc2 vf4, 656(v1) + c->lqc2(vf1, 608, v1); // lqc2 vf1, 608(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf2, 624, v1); // lqc2 vf2, 624(v1) + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + c->lqc2(vf3, 640, v1); // lqc2 vf3, 640(v1) + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf1); // vmaddax.xyzw acc, vf28, vf1 + c->lqc2(vf4, 656, v1); // lqc2 vf4, 656(v1) + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf1); // vmadday.xyzw acc, vf29, vf1 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf1, vf30, vf1); // vmaddz.xyzw vf1, vf30, vf1 + // nop // sll r0, r0, 0 + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf2); // vmaddax.xyzw acc, vf28, vf2 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf2); // vmadday.xyzw acc, vf29, vf2 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf2, vf30, vf2); // vmaddz.xyzw vf2, vf30, vf2 + // nop // sll r0, r0, 0 + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf3); // vmaddax.xyzw acc, vf28, vf3 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf3); // vmadday.xyzw acc, vf29, vf3 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf3, vf30, vf3); // vmaddz.xyzw vf3, vf30, vf3 + // nop // sll r0, r0, 0 + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf4); // vmaddax.xyzw acc, vf28, vf4 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf4); // vmadday.xyzw acc, vf29, vf4 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf4, vf30, vf4); // vmaddz.xyzw vf4, vf30, vf4 + c->vdiv(vf25, BC::z, vf1, BC::w); // vdiv Q, vf25.z, vf1.w + c->lq(t2, 32, v1); // lq t2, 32(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 48, v1); // lq t3, 48(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 0, a1); // sq t2, 0(a1) + // nop // sll r0, r0, 0 + c->sq(t3, 16, a1); // sq t3, 16(a1) + c->lqc2(vf5, 736, v1); // lqc2 vf5, 736(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf6, 752, v1); // lqc2 vf6, 752(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf7, 768, v1); // lqc2 vf7, 768(v1) + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf1, vf1); // vmulq.xyz vf1, vf1, Q + c->sqc2(vf20, 32, a1); // sqc2 vf20, 32(a1) + c->vmulq(DEST::xyz, vf5, vf5); // vmulq.xyz vf5, vf5, Q + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + c->vdiv(vf25, BC::z, vf2, BC::w); // vdiv Q, vf25.z, vf2.w + // nop // sll r0, r0, 0 + c->lqc2(vf8, 784, v1); // lqc2 vf8, 784(v1) + // nop // sll r0, r0, 0 + c->vadd(DEST::xyzw, vf1, vf1, vf26); // vadd.xyzw vf1, vf1, vf26 + // nop // sll r0, r0, 0 + c->lqc2(vf9, 2208, v1); // lqc2 vf9, 2208(v1) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1 + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf2, vf2); // vmulq.xyz vf2, vf2, Q + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf6, vf6); // vmulq.xyz vf6, vf6, Q + c->sqc2(vf5, 48, a1); // sqc2 vf5, 48(a1) + // nop // vnop + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + c->vdiv(vf25, BC::z, vf3, BC::w); // vdiv Q, vf25.z, vf3.w + c->sqc2(vf9, 64, a1); // sqc2 vf9, 64(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf1, 80, a1); // sqc2 vf1, 80(a1) + c->vadd(DEST::xyzw, vf2, vf2, vf26); // vadd.xyzw vf2, vf2, vf26 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->vftoi4(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2 + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf3, vf3); // vmulq.xyz vf3, vf3, Q + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf7, vf7); // vmulq.xyz vf7, vf7, Q + c->sqc2(vf6, 96, a1); // sqc2 vf6, 96(a1) + // nop // vnop + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + c->vdiv(vf25, BC::z, vf4, BC::w); // vdiv Q, vf25.z, vf4.w + c->sqc2(vf9, 112, a1); // sqc2 vf9, 112(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf2, 128, a1); // sqc2 vf2, 128(a1) + c->vadd(DEST::xyzw, vf3, vf3, vf26); // vadd.xyzw vf3, vf3, vf26 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->vftoi4(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3 + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf4, vf4); // vmulq.xyz vf4, vf4, Q + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf8, vf8); // vmulq.xyz vf8, vf8, Q + c->sqc2(vf7, 144, a1); // sqc2 vf7, 144(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 160, a1); // sqc2 vf9, 160(a1) + c->vadd(DEST::xyzw, vf4, vf4, vf26); // vadd.xyzw vf4, vf4, vf26 + c->sqc2(vf3, 176, a1); // sqc2 vf3, 176(a1) + c->andi(t2, a0, 2); // andi t2, a0, 2 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L88 + c->andi(t2, a0, 64); // andi t2, a0, 64 + if (bc) {goto block_152;} // branch non-likely + + bc = c->sgpr64(t2) != 0; // bne t2, r0, L88 + // nop // sll r0, r0, 0 + if (bc) {goto block_152;} // branch non-likely + + //beq r0, r0, L89 // beq r0, r0, L89 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf19); // vaddw.x vf23, vf23, vf19 + goto block_153; // branch always + + +block_152: + // nop // sll r0, r0, 0 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14 + +block_153: + c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->sqc2(vf8, 192, a1); // sqc2 vf8, 192(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 208, a1); // sqc2 vf9, 208(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf4, 224, a1); // sqc2 vf4, 224(a1) + // nop // sll r0, r0, 0 + c->lw(t3, 80, a1); // lw t3, 80(a1) + // nop // sll r0, r0, 0 + c->lw(t2, 84, a1); // lw t2, 84(a1) + c->ori(t4, r0, 36864); // ori t4, r0, 36864 + c->dsubu(t3, t3, t4); // dsubu t3, t3, t4 + c->lw(t4, 224, a1); // lw t4, 224(a1) + c->ori(t5, r0, 36096); // ori t5, r0, 36096 + c->dsubu(t2, t2, t5); // dsubu t2, t2, t5 + c->lw(t5, 228, a1); // lw t5, 228(a1) + bc = ((s64)c->sgpr64(t3)) > 0; // bgtz t3, L67 + c->daddiu(t3, t4, -28672); // daddiu t3, t4, -28672 + if (bc) {goto block_84;} // branch non-likely + + bc = ((s64)c->sgpr64(t2)) > 0; // bgtz t2, L67 + c->daddiu(t2, t5, -29440); // daddiu t2, t5, -29440 + if (bc) {goto block_84;} // branch non-likely + + bc = ((s64)c->sgpr64(t3)) < 0; // bltz t3, L67 + // nop // sll r0, r0, 0 + if (bc) {goto block_84;} // branch non-likely + + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L67 + // nop // sll r0, r0, 0 + if (bc) {goto block_84;} // branch non-likely + + //beq r0, r0, L67 // beq r0, r0, L67 + c->daddiu(a1, a1, 240); // daddiu a1, a1, 240 + goto block_84; // branch always + + +block_158: + c->lw(a0, 3028, v1); // lw a0, 3028(v1) + c->mov64(t0, v1); // or t0, v1, r0 + c->lw(t1, 3024, v1); // lw t1, 3024(v1) + c->lqc2(vf23, 1184, t0); // lqc2 vf23, 1184(t0) + +block_159: + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + c->lqc2(vf20, 2944, v1); // lqc2 vf20, 2944(v1) + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L117 + c->daddiu(t3, t2, -3); // daddiu t3, t2, -3 + if (bc) {goto block_236;} // branch non-likely + + bc = ((s64)c->sgpr64(t3)) <= 0; // blez t3, L108 + c->daddiu(t3, t2, -126); // daddiu t3, t2, -126 + if (bc) {goto block_216;} // branch non-likely + + bc = c->sgpr64(t3) != 0; // bne t3, r0, L112 + // nop // sll r0, r0, 0 + if (bc) {goto block_222;} // branch non-likely + + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + c->addiu(t3, r0, 0); // addiu t3, r0, 0 + c->addiu(t4, r0, 0); // addiu t4, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L117 + c->daddiu(t5, t2, -43); // daddiu t5, t2, -43 + if (bc) {goto block_236;} // branch non-likely + + c->movz(t3, t2, t5); // movz t3, t2, t5 + c->daddiu(t5, t2, -45); // daddiu t5, t2, -45 + c->movz(t3, t2, t5); // movz t3, t2, t5 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t3) != 0; // bne t3, r0, L92 + c->daddiu(t5, t2, -91); // daddiu t5, t2, -91 + if (bc) {goto block_173;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L104 + c->daddiu(t4, t2, -93); // daddiu t4, t2, -93 + if (bc) {goto block_212;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L105 + c->daddiu(t4, t2, -121); // daddiu t4, t2, -121 + if (bc) {goto block_213;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L106 + c->daddiu(t4, t2, -89); // daddiu t4, t2, -89 + if (bc) {goto block_214;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L106 + c->daddiu(t4, t2, -122); // daddiu t4, t2, -122 + if (bc) {goto block_214;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L107 + c->daddiu(t4, t2, -90); // daddiu t4, t2, -90 + if (bc) {goto block_215;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L107 + c->daddiu(t4, t2, -48); // daddiu t4, t2, -48 + if (bc) {goto block_215;} // branch non-likely + + bc = ((s64)c->sgpr64(t4)) < 0; // bltz t4, L112 + c->daddiu(t4, t2, -57); // daddiu t4, t2, -57 + if (bc) {goto block_222;} // branch non-likely + + bc = ((s64)c->sgpr64(t4)) > 0; // bgtz t4, L112 + c->daddiu(t4, t2, -126); // daddiu t4, t2, -126 + if (bc) {goto block_222;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L112 + c->daddiu(t4, t2, -48); // daddiu t4, t2, -48 + if (bc) {goto block_222;} // branch non-likely + + +block_173: + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L117 + c->daddiu(t5, t2, -110); // daddiu t5, t2, -110 + if (bc) {goto block_236;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L93 + c->daddiu(t5, t2, -78); // daddiu t5, t2, -78 + if (bc) {goto block_193;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L93 + c->daddiu(t5, t2, -108); // daddiu t5, t2, -108 + if (bc) {goto block_193;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L95 + c->daddiu(t5, t2, -76); // daddiu t5, t2, -76 + if (bc) {goto block_196;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L95 + c->daddiu(t5, t2, -119); // daddiu t5, t2, -119 + if (bc) {goto block_196;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L91 + c->daddiu(t5, t2, -87); // daddiu t5, t2, -87 + if (bc) {goto block_159;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L91 + c->daddiu(t5, t2, -107); // daddiu t5, t2, -107 + if (bc) {goto block_159;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L97 + c->daddiu(t5, t2, -75); // daddiu t5, t2, -75 + if (bc) {goto block_200;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L97 + c->daddiu(t5, t2, -106); // daddiu t5, t2, -106 + if (bc) {goto block_200;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L91 + c->daddiu(t5, t2, -74); // daddiu t5, t2, -74 + if (bc) {goto block_159;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L91 + c->daddiu(t5, t2, -104); // daddiu t5, t2, -104 + if (bc) {goto block_159;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L98 + c->daddiu(t5, t2, -72); // daddiu t5, t2, -72 + if (bc) {goto block_202;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L98 + c->daddiu(t5, t2, -118); // daddiu t5, t2, -118 + if (bc) {goto block_202;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L101 + c->daddiu(t5, t2, -86); // daddiu t5, t2, -86 + if (bc) {goto block_207;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L101 + c->daddiu(t5, t2, -117); // daddiu t5, t2, -117 + if (bc) {goto block_207;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L96 + c->daddiu(t5, t2, -85); // daddiu t5, t2, -85 + if (bc) {goto block_198;} // branch non-likely + + bc = c->sgpr64(t5) == 0; // beq t5, r0, L96 + c->daddiu(t5, t2, -48); // daddiu t5, t2, -48 + if (bc) {goto block_198;} // branch non-likely + + bc = ((s64)c->sgpr64(t5)) < 0; // bltz t5, L112 + c->daddiu(t6, t2, -57); // daddiu t6, t2, -57 + if (bc) {goto block_222;} // branch non-likely + + bc = ((s64)c->sgpr64(t6)) > 0; // bgtz t6, L112 + c->sll(t6, t4, 2); // sll t6, t4, 2 + if (bc) {goto block_222;} // branch non-likely + + c->daddu(t2, t4, t6); // daddu t2, t4, t6 + // nop // sll r0, r0, 0 + c->sll(t2, t2, 1); // sll t2, t2, 1 + // nop // sll r0, r0, 0 + //beq r0, r0, L92 // beq r0, r0, L92 + c->daddu(t4, t2, t5); // daddu t4, t2, t5 + goto block_173; // branch always + + +block_193: + bc = c->sgpr64(t4) != 0; // bne t4, r0, L94 + c->addiu(t2, r0, -33); // addiu t2, r0, -33 + if (bc) {goto block_195;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(a3, 80, v1); // lq a3, 80(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 96, v1); // lq t3, 96(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 112, v1); // lq t4, 112(v1) + // nop // sll r0, r0, 0 + c->lq(t5, 128, v1); // lq t5, 128(v1) + // nop // sll r0, r0, 0 + c->sq(a3, 2944, v1); // sq a3, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2960, v1); // sq t3, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2976, v1); // sq t4, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t5, 2992, v1); // sq t5, 2992(v1) + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font12_table); // lw a3, *font12-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 208, v1); // lqc2 vf13, 208(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 224, v1); // lqc2 vf14, 224(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 240, v1); // lqc2 vf15, 240(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->and_(a0, a0, t2); // and a0, a0, t2 + goto block_159; // branch always + + +block_195: + // nop // sll r0, r0, 0 + c->lq(a3, 144, v1); // lq a3, 144(v1) + // nop // sll r0, r0, 0 + c->lq(t2, 160, v1); // lq t2, 160(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 176, v1); // lq t3, 176(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 192, v1); // lq t4, 192(v1) + // nop // sll r0, r0, 0 + c->sq(a3, 2944, v1); // sq a3, 2944(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 2960, v1); // sq t2, 2960(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 2976, v1); // sq t3, 2976(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 2992, v1); // sq t4, 2992(v1) + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font24_table); // lw a3, *font24-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 256, v1); // lqc2 vf13, 256(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf15, 336, v1); // lqc2 vf15, 336(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 272, v1); // lqc2 vf14, 272(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, v1); // sqc2 vf14, 352(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 288, v1); // lqc2 vf14, 288(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, v1); // sqc2 vf14, 368(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 304, v1); // lqc2 vf14, 304(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, v1); // sqc2 vf14, 384(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 320, v1); // lqc2 vf14, 320(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, v1); // sqc2 vf14, 400(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->ori(a0, a0, 32); // ori a0, a0, 32 + goto block_159; // branch always + + +block_196: + c->andi(t2, a0, 128); // andi t2, a0, 128 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) != 0; // bne t2, r0, L91 + // nop // sll r0, r0, 0 + if (bc) {goto block_159;} // branch non-likely + + // nop // sll r0, r0, 0 + c->sw(t4, 3008, v1); // sw t4, 3008(v1) + c->sll(t2, t4, 4); // sll t2, t4, 4 + c->lq(t3, 672, v1); // lq t3, 672(v1) + c->daddu(t2, t2, v1); // daddu t2, t2, v1 + c->lq(t4, 688, v1); // lq t4, 688(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 864, v1); // sq t3, 864(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 880, v1); // sq t4, 880(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 704, v1); // lq t3, 704(v1) + // nop // sll r0, r0, 0 + c->lq(t4, 720, v1); // lq t4, 720(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 896, v1); // sq t3, 896(v1) + // nop // sll r0, r0, 0 + c->sq(t4, 912, v1); // sq t4, 912(v1) + // nop // sll r0, r0, 0 + c->lwu(t4, 2224, t2); // lwu t4, 2224(t2) + // nop // sll r0, r0, 0 + c->lwu(t3, 2228, t2); // lwu t3, 2228(t2) + c->pextlb(t4, r0, t4); // pextlb t4, r0, t4 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlh(t4, r0, t4); // pextlh t4, r0, t4 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlb(t3, r0, t3); // pextlb t3, r0, t3 + c->sq(t4, 672, v1); // sq t4, 672(v1) + c->pextlh(t3, r0, t3); // pextlh t3, r0, t3 + c->sq(t4, 1056, v1); // sq t4, 1056(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 688, v1); // sq t3, 688(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 1072, v1); // sq t3, 1072(v1) + // nop // sll r0, r0, 0 + c->lwu(t3, 2232, t2); // lwu t3, 2232(t2) + // nop // sll r0, r0, 0 + c->lwu(t2, 2236, t2); // lwu t2, 2236(t2) + c->pextlb(t3, r0, t3); // pextlb t3, r0, t3 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlh(t3, r0, t3); // pextlh t3, r0, t3 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlb(t2, r0, t2); // pextlb t2, r0, t2 + c->sq(t3, 704, v1); // sq t3, 704(v1) + c->pextlh(t2, r0, t2); // pextlh t2, r0, t2 + c->sq(t3, 1088, v1); // sq t3, 1088(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 720, v1); // sq t2, 720(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->sq(t2, 1104, v1); // sq t2, 1104(v1) + goto block_159; // branch always + + +block_198: + c->andi(t2, a0, 128); // andi t2, a0, 128 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) != 0; // bne t2, r0, L91 + // nop // sll r0, r0, 0 + if (bc) {goto block_159;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(t2, 672, v1); // lq t2, 672(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 688, v1); // lq t3, 688(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 864, v1); // sq t2, 864(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 880, v1); // sq t3, 880(v1) + // nop // sll r0, r0, 0 + c->lq(t2, 704, v1); // lq t2, 704(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 720, v1); // lq t3, 720(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 896, v1); // sq t2, 896(v1) + // nop // sll r0, r0, 0 + c->sq(t3, 912, v1); // sq t3, 912(v1) + c->pextlb(t2, r0, t4); // pextlb t2, r0, t4 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlh(t2, r0, t2); // pextlh t2, r0, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->sq(t2, 672, v1); // sq t2, 672(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 1056, v1); // sq t2, 1056(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 688, v1); // sq t2, 688(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 1072, v1); // sq t2, 1072(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 704, v1); // sq t2, 704(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 1088, v1); // sq t2, 1088(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 720, v1); // sq t2, 720(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->sq(t2, 1104, v1); // sq t2, 1104(v1) + goto block_159; // branch always + + +block_200: + c->addiu(t2, r0, -3); // addiu t2, r0, -3 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L91 + c->and_(a0, a0, t2); // and a0, a0, t2 + if (bc) {goto block_159;} // branch non-likely + + //beq r0, r0, L91 // beq r0, r0, L91 + c->ori(a0, a0, 2); // ori a0, a0, 2 + goto block_159; // branch always + + +block_202: + c->mov128_vf_gpr(vf1, t4); // qmtc2.i vf1, t4 + c->daddiu(t2, t3, -45); // daddiu t2, t3, -45 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L100 + c->vitof0(DEST::xyzw, vf1, vf1); // vitof0.xyzw vf1, vf1 + if (bc) {goto block_206;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L99 + // nop // sll r0, r0, 0 + if (bc) {goto block_205;} // branch non-likely + + //beq r0, r0, L91 // beq r0, r0, L91 + c->vadd_bc(DEST::x, BC::x, vf23, vf23, vf1); // vaddx.x vf23, vf23, vf1 + goto block_159; // branch always + + +block_205: + //beq r0, r0, L91 // beq r0, r0, L91 + c->vsub_bc(DEST::x, BC::x, vf23, vf23, vf1); // vsubx.x vf23, vf23, vf1 + goto block_159; // branch always + + +block_206: + //beq r0, r0, L91 // beq r0, r0, L91 + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf1); // vaddx.x vf23, vf0, vf1 + goto block_159; // branch always + + +block_207: + c->mov128_vf_gpr(vf1, t4); // qmtc2.i vf1, t4 + c->daddiu(t2, t3, -45); // daddiu t2, t3, -45 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L103 + c->vitof0(DEST::xyzw, vf1, vf1); // vitof0.xyzw vf1, vf1 + if (bc) {goto block_211;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L102 + // nop // sll r0, r0, 0 + if (bc) {goto block_210;} // branch non-likely + + //beq r0, r0, L91 // beq r0, r0, L91 + c->vadd_bc(DEST::y, BC::x, vf23, vf23, vf1); // vaddx.y vf23, vf23, vf1 + goto block_159; // branch always + + +block_210: + //beq r0, r0, L91 // beq r0, r0, L91 + c->vsub_bc(DEST::y, BC::x, vf23, vf23, vf1); // vsubx.y vf23, vf23, vf1 + goto block_159; // branch always + + +block_211: + //beq r0, r0, L91 // beq r0, r0, L91 + c->vadd_bc(DEST::y, BC::x, vf23, vf0, vf1); // vaddx.y vf23, vf0, vf1 + goto block_159; // branch always + + +block_212: + // nop // sll r0, r0, 0 + c->lw(t2, 3008, v1); // lw t2, 3008(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf9, 672, v1); // lqc2 vf9, 672(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf10, 688, v1); // lqc2 vf10, 688(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf11, 704, v1); // lqc2 vf11, 704(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf12, 720, v1); // lqc2 vf12, 720(v1) + // nop // sll r0, r0, 0 + c->sw(t2, 3012, v1); // sw t2, 3012(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 480, v1); // sqc2 vf9, 480(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf10, 496, v1); // sqc2 vf10, 496(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf11, 512, v1); // sqc2 vf11, 512(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->sqc2(vf12, 528, v1); // sqc2 vf12, 528(v1) + goto block_159; // branch always + + +block_213: + // nop // sll r0, r0, 0 + c->lw(t2, 3012, v1); // lw t2, 3012(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf9, 480, v1); // lqc2 vf9, 480(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf10, 496, v1); // lqc2 vf10, 496(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf11, 512, v1); // lqc2 vf11, 512(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf12, 528, v1); // lqc2 vf12, 528(v1) + // nop // sll r0, r0, 0 + c->sw(t2, 3008, v1); // sw t2, 3008(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 672, v1); // sqc2 vf9, 672(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 1056, v1); // sqc2 vf9, 1056(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf10, 688, v1); // sqc2 vf10, 688(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf10, 1072, v1); // sqc2 vf10, 1072(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf11, 704, v1); // sqc2 vf11, 704(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf11, 1088, v1); // sqc2 vf11, 1088(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf12, 720, v1); // sqc2 vf12, 720(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->sqc2(vf12, 1104, v1); // sqc2 vf12, 1104(v1) + goto block_159; // branch always + + +block_214: + // nop // sll r0, r0, 0 + c->lw(t2, 3008, v1); // lw t2, 3008(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf9, 672, v1); // lqc2 vf9, 672(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf10, 688, v1); // lqc2 vf10, 688(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf11, 704, v1); // lqc2 vf11, 704(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf12, 720, v1); // lqc2 vf12, 720(v1) + // nop // sll r0, r0, 0 + c->sw(t2, 3016, v1); // sw t2, 3016(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 544, v1); // sqc2 vf9, 544(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf10, 560, v1); // sqc2 vf10, 560(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf11, 576, v1); // sqc2 vf11, 576(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf12, 592, v1); // sqc2 vf12, 592(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->sqc2(vf23, 464, v1); // sqc2 vf23, 464(v1) + goto block_159; // branch always + + +block_215: + // nop // sll r0, r0, 0 + c->lw(t2, 3016, v1); // lw t2, 3016(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf9, 544, v1); // lqc2 vf9, 544(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf10, 560, v1); // lqc2 vf10, 560(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf11, 576, v1); // lqc2 vf11, 576(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf12, 592, v1); // lqc2 vf12, 592(v1) + // nop // sll r0, r0, 0 + c->sw(t2, 3008, v1); // sw t2, 3008(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 672, v1); // sqc2 vf9, 672(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf9, 1056, v1); // sqc2 vf9, 1056(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf10, 688, v1); // sqc2 vf10, 688(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf10, 1072, v1); // sqc2 vf10, 1072(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf11, 704, v1); // sqc2 vf11, 704(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf11, 1088, v1); // sqc2 vf11, 1088(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf12, 720, v1); // sqc2 vf12, 720(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf12, 1104, v1); // sqc2 vf12, 1104(v1) + //beq r0, r0, L91 // beq r0, r0, L91 + c->lqc2(vf23, 464, v1); // lqc2 vf23, 464(v1) + goto block_159; // branch always + + +block_216: + c->daddiu(t3, t2, -3); // daddiu t3, t2, -3 + c->ori(a0, a0, 64); // ori a0, a0, 64 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L110 + c->daddiu(t2, t2, -2); // daddiu t2, t2, -2 + if (bc) {goto block_220;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L109 + c->lqc2(vf14, 384, v1); // lqc2 vf14, 384(v1) + if (bc) {goto block_219;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lqc2(vf14, 368, v1); // lqc2 vf14, 368(v1) + //beq r0, r0, L111 // beq r0, r0, L111 + c->lqc2(vf20, 2960, v1); // lqc2 vf20, 2960(v1) + goto block_221; // branch always + + +block_219: + //beq r0, r0, L111 // beq r0, r0, L111 + c->lqc2(vf20, 2976, v1); // lqc2 vf20, 2976(v1) + goto block_221; // branch always + + +block_220: + // nop // sll r0, r0, 0 + c->lqc2(vf14, 400, v1); // lqc2 vf14, 400(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf20, 2992, v1); // lqc2 vf20, 2992(v1) + +block_221: + c->lbu(t2, 4, t1); // lbu t2, 4(t1) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + c->vadd(DEST::xyz, vf4, vf23, vf15); // vadd.xyz vf4, vf23, vf15 + c->sll(t3, t2, 4); // sll t3, t2, 4 + //beq r0, r0, L114 // beq r0, r0, L114 + c->vsub(DEST::xyzw, vf1, vf25, vf23); // vsub.xyzw vf1, vf25, vf23 + goto block_225; // branch always + + +block_222: + // nop // sll r0, r0, 0 + c->addiu(t3, r0, -65); // addiu t3, r0, -65 + c->and_(a0, a0, t3); // and a0, a0, t3 + c->lqc2(vf14, 352, v1); // lqc2 vf14, 352(v1) + c->vadd(DEST::xyz, vf4, vf23, vf15); // vadd.xyz vf4, vf23, vf15 + c->sll(t3, t2, 4); // sll t3, t2, 4 + c->vsub(DEST::xyzw, vf1, vf25, vf23); // vsub.xyzw vf1, vf25, vf23 + c->daddiu(t4, t2, -10); // daddiu t4, t2, -10 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L113 + c->daddiu(t2, t2, -13); // daddiu t2, t2, -13 + if (bc) {goto block_224;} // branch non-likely + + bc = c->sgpr64(t2) != 0; // bne t2, r0, L114 + // nop // sll r0, r0, 0 + if (bc) {goto block_225;} // branch non-likely + + +block_224: + c->daddiu(t0, t0, 16); // daddiu t0, t0, 16 + // nop // sll r0, r0, 0 + //beq r0, r0, L91 // beq r0, r0, L91 + c->lqc2(vf23, 1184, t0); // lqc2 vf23, 1184(t0) + goto block_159; // branch always + + +block_225: + c->addu(t2, t3, a3); // addu t2, t3, a3 + // nop // sll r0, r0, 0 + c->lqc2(vf5, -96, t2); // lqc2 vf5, -96(t2) + c->mov128_gpr_vf(t2, vf1); // qmfc2.i t2, vf1 + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L117 + c->vadd(DEST::xyz, vf6, vf5, vf16); // vadd.xyz vf6, vf5, vf16 + if (bc) {goto block_236;} // branch non-likely + + c->sra(t2, t2, 31); // sra t2, t2, 31 + c->vadd(DEST::xyz, vf7, vf5, vf17); // vadd.xyz vf7, vf5, vf17 + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L91 + c->vadd(DEST::xyz, vf8, vf5, vf18); // vadd.xyz vf8, vf5, vf18 + if (bc) {goto block_159;} // branch non-likely + + c->vadd(DEST::xyz, vf1, vf23, vf0); // vadd.xyz vf1, vf23, vf0 + // nop // sll r0, r0, 0 + c->vadd(DEST::xyz, vf2, vf23, vf13); // vadd.xyz vf2, vf23, vf13 + // nop // sll r0, r0, 0 + c->vadd(DEST::xyz, vf3, vf23, vf14); // vadd.xyz vf3, vf23, vf14 + c->sqc2(vf5, 736, v1); // sqc2 vf5, 736(v1) + c->vadd(DEST::xyz, vf4, vf23, vf15); // vadd.xyz vf4, vf23, vf15 + c->sqc2(vf6, 752, v1); // sqc2 vf6, 752(v1) + c->vmul(DEST::xyzw, vf19, vf5, vf13); // vmul.xyzw vf19, vf5, vf13 + c->sqc2(vf7, 768, v1); // sqc2 vf7, 768(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf8, 784, v1); // sqc2 vf8, 784(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf1, 608, v1); // sqc2 vf1, 608(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf2, 624, v1); // sqc2 vf2, 624(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf3, 640, v1); // sqc2 vf3, 640(v1) + // nop // sll r0, r0, 0 + c->sqc2(vf4, 656, v1); // sqc2 vf4, 656(v1) + c->lqc2(vf1, 608, v1); // lqc2 vf1, 608(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf2, 624, v1); // lqc2 vf2, 624(v1) + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + c->lqc2(vf3, 640, v1); // lqc2 vf3, 640(v1) + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf1); // vmaddax.xyzw acc, vf28, vf1 + c->lqc2(vf4, 656, v1); // lqc2 vf4, 656(v1) + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf1); // vmadday.xyzw acc, vf29, vf1 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf1, vf30, vf1); // vmaddz.xyzw vf1, vf30, vf1 + // nop // sll r0, r0, 0 + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf2); // vmaddax.xyzw acc, vf28, vf2 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf2); // vmadday.xyzw acc, vf29, vf2 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf2, vf30, vf2); // vmaddz.xyzw vf2, vf30, vf2 + // nop // sll r0, r0, 0 + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf3); // vmaddax.xyzw acc, vf28, vf3 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf3); // vmadday.xyzw acc, vf29, vf3 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf3, vf30, vf3); // vmaddz.xyzw vf3, vf30, vf3 + // nop // sll r0, r0, 0 + c->vmula_bc(DEST::xyzw, BC::w, vf31, vf0); // vmulaw.xyzw acc, vf31, vf0 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::x, vf28, vf4); // vmaddax.xyzw acc, vf28, vf4 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf29, vf4); // vmadday.xyzw acc, vf29, vf4 + // nop // sll r0, r0, 0 + c->vmadd_bc(DEST::xyzw, BC::z, vf4, vf30, vf4); // vmaddz.xyzw vf4, vf30, vf4 + c->vdiv(vf25, BC::z, vf1, BC::w); // vdiv Q, vf25.z, vf1.w + c->lq(t2, 32, v1); // lq t2, 32(v1) + // nop // sll r0, r0, 0 + c->lq(t3, 48, v1); // lq t3, 48(v1) + // nop // sll r0, r0, 0 + c->sq(t2, 0, a1); // sq t2, 0(a1) + // nop // sll r0, r0, 0 + c->sq(t3, 16, a1); // sq t3, 16(a1) + c->lqc2(vf5, 736, v1); // lqc2 vf5, 736(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf6, 752, v1); // lqc2 vf6, 752(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf7, 768, v1); // lqc2 vf7, 768(v1) + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf1, vf1); // vmulq.xyz vf1, vf1, Q + c->sqc2(vf20, 32, a1); // sqc2 vf20, 32(a1) + c->vmulq(DEST::xyz, vf5, vf5); // vmulq.xyz vf5, vf5, Q + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + c->vdiv(vf25, BC::z, vf2, BC::w); // vdiv Q, vf25.z, vf2.w + // nop // sll r0, r0, 0 + c->lqc2(vf8, 784, v1); // lqc2 vf8, 784(v1) + // nop // sll r0, r0, 0 + c->vadd(DEST::xyzw, vf1, vf1, vf27); // vadd.xyzw vf1, vf1, vf27 + // nop // sll r0, r0, 0 + c->lqc2(vf9, 672, v1); // lqc2 vf9, 672(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf10, 688, v1); // lqc2 vf10, 688(v1) + // nop // sll r0, r0, 0 + c->lqc2(vf11, 704, v1); // lqc2 vf11, 704(v1) + // nop // sll r0, r0, 0 + c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1 + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf2, vf2); // vmulq.xyz vf2, vf2, Q + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf6, vf6); // vmulq.xyz vf6, vf6, Q + c->sqc2(vf5, 48, a1); // sqc2 vf5, 48(a1) + // nop // vnop + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + c->vdiv(vf25, BC::z, vf3, BC::w); // vdiv Q, vf25.z, vf3.w + c->sqc2(vf9, 64, a1); // sqc2 vf9, 64(a1) + c->lqc2(vf12, 720, v1); // lqc2 vf12, 720(v1) + c->sqc2(vf1, 80, a1); // sqc2 vf1, 80(a1) + c->vadd(DEST::xyzw, vf2, vf2, vf27); // vadd.xyzw vf2, vf2, vf27 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->vftoi4(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2 + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf3, vf3); // vmulq.xyz vf3, vf3, Q + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf7, vf7); // vmulq.xyz vf7, vf7, Q + c->sqc2(vf6, 96, a1); // sqc2 vf6, 96(a1) + // nop // vnop + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + c->vdiv(vf25, BC::z, vf4, BC::w); // vdiv Q, vf25.z, vf4.w + c->sqc2(vf10, 112, a1); // sqc2 vf10, 112(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf2, 128, a1); // sqc2 vf2, 128(a1) + c->vadd(DEST::xyzw, vf3, vf3, vf27); // vadd.xyzw vf3, vf3, vf27 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->vftoi4(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3 + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf4, vf4); // vmulq.xyz vf4, vf4, Q + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf8, vf8); // vmulq.xyz vf8, vf8, Q + c->sqc2(vf7, 144, a1); // sqc2 vf7, 144(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf11, 160, a1); // sqc2 vf11, 160(a1) + c->vadd(DEST::xyzw, vf4, vf4, vf27); // vadd.xyzw vf4, vf4, vf27 + c->sqc2(vf3, 176, a1); // sqc2 vf3, 176(a1) + c->andi(t2, a0, 2); // andi t2, a0, 2 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L115 + c->andi(t2, a0, 64); // andi t2, a0, 64 + if (bc) {goto block_230;} // branch non-likely + + bc = c->sgpr64(t2) != 0; // bne t2, r0, L115 + // nop // sll r0, r0, 0 + if (bc) {goto block_230;} // branch non-likely + + //beq r0, r0, L116 // beq r0, r0, L116 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf19); // vaddw.x vf23, vf23, vf19 + goto block_231; // branch always + + +block_230: + // nop // sll r0, r0, 0 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14 + +block_231: + c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->sqc2(vf8, 192, a1); // sqc2 vf8, 192(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf12, 208, a1); // sqc2 vf12, 208(a1) + // nop // sll r0, r0, 0 + c->sqc2(vf4, 224, a1); // sqc2 vf4, 224(a1) + // nop // sll r0, r0, 0 + c->lw(t3, 80, a1); // lw t3, 80(a1) + // nop // sll r0, r0, 0 + c->lw(t2, 84, a1); // lw t2, 84(a1) + c->ori(t4, r0, 36864); // ori t4, r0, 36864 + c->dsubu(t3, t3, t4); // dsubu t3, t3, t4 + c->lw(t4, 224, a1); // lw t4, 224(a1) + c->ori(t5, r0, 36096); // ori t5, r0, 36096 + c->dsubu(t2, t2, t5); // dsubu t2, t2, t5 + c->lw(t5, 228, a1); // lw t5, 228(a1) + bc = ((s64)c->sgpr64(t3)) > 0; // bgtz t3, L91 + c->daddiu(t3, t4, -28672); // daddiu t3, t4, -28672 + if (bc) {goto block_159;} // branch non-likely + + bc = ((s64)c->sgpr64(t2)) > 0; // bgtz t2, L91 + c->daddiu(t2, t5, -29440); // daddiu t2, t5, -29440 + if (bc) {goto block_159;} // branch non-likely + + bc = ((s64)c->sgpr64(t3)) < 0; // bltz t3, L91 + // nop // sll r0, r0, 0 + if (bc) {goto block_159;} // branch non-likely + + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L91 + // nop // sll r0, r0, 0 + if (bc) {goto block_159;} // branch non-likely + + //beq r0, r0, L91 // beq r0, r0, L91 + c->daddiu(a1, a1, 240); // daddiu a1, a1, 240 + goto block_159; // branch always + + +block_236: + c->lw(v1, 3020, v1); // lw v1, 3020(v1) + c->sw(a1, 4, v1); // sw a1, 4(v1) + c->lqc2(vf24, 12, a2); // lqc2 vf24, 12(a2) + c->vsub(DEST::xyzw, vf23, vf23, vf24); // vsub.xyzw vf23, vf23, vf24 + c->mov128_gpr_vf(v0, vf23); // qmfc2.i v0, vf23 + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.font_work = intern_from_c(-1, 0, "*font-work*").c(); + cache.font12_table = intern_from_c(-1, 0, "*font12-table*").c(); + cache.font24_table = intern_from_c(-1, 0, "*font24-table*").c(); + cache.math_camera = intern_from_c(-1, 0, "*math-camera*").c(); + cache.video_params = intern_from_c(-1, 0, "*video-params*").c(); + gLinkedFunctionTable.reg("draw-string-asm", execute, 512); +} + +} // namespace draw_string_asm +} // namespace Mips2C +// add draw_string_asm::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace get_string_length { +struct Cache { + void* font_work; // *font-work* + void* font12_table; // *font12-table* + void* font24_table; // *font24-table* + void* video_params; // *video-params* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->lqc2(vf23, 12, a1); // lqc2 vf23, 12(a1) + c->lqc2(vf24, 12, a1); // lqc2 vf24, 12(a1) + c->lw(v1, 64, a1); // lw v1, 64(a1) + c->load_symbol2(a2, cache.font_work); // lw a2, *font-work*(s7) + c->mov64(a2, a2); // or a2, a2, r0 + c->sw(a0, 3024, a2); // sw a0, 3024(a2) + c->sw(v1, 3028, a2); // sw v1, 3028(a2) + c->vmove(DEST::xyzw, vf1, vf0); // vmove.xyzw vf1, vf0 + // nop // sll r0, r0, 0 + c->andi(a3, v1, 32); // andi a3, v1, 32 + // nop // sll r0, r0, 0 + bc = c->sgpr64(a3) != 0; // bne a3, r0, L4 + c->load_symbol2(a3, cache.font12_table); // lw a3, *font12-table*(s7) + if (bc) {goto block_2;} // branch non-likely + + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 208, a2); // lqc2 vf13, 208(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 224, a2); // lqc2 vf14, 224(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, a2); // sqc2 vf14, 352(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, a2); // sqc2 vf14, 368(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, a2); // sqc2 vf14, 384(a2) + //beq r0, r0, L5 // beq r0, r0, L5 + c->sqc2(vf14, 400, a2); // sqc2 vf14, 400(a2) + goto block_3; // branch always + + +block_2: + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font24_table); // lw a3, *font24-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 256, a2); // lqc2 vf13, 256(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 272, a2); // lqc2 vf14, 272(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, a2); // sqc2 vf14, 352(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 288, a2); // lqc2 vf14, 288(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, a2); // sqc2 vf14, 368(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 304, a2); // lqc2 vf14, 304(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, a2); // sqc2 vf14, 384(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 320, a2); // lqc2 vf14, 320(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, a2); // sqc2 vf14, 400(a2) + +block_3: + c->lbu(t0, 4, a0); // lbu t0, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + bc = c->sgpr64(t0) == 0; // beq t0, r0, L22 + c->daddiu(t1, t0, -3); // daddiu t1, t0, -3 + if (bc) {goto block_60;} // branch non-likely + + bc = ((s64)c->sgpr64(t1)) <= 0; // blez t1, L15 + c->daddiu(t1, t0, -126); // daddiu t1, t0, -126 + if (bc) {goto block_48;} // branch non-likely + + bc = c->sgpr64(t1) != 0; // bne t1, r0, L18 + // nop // sll r0, r0, 0 + if (bc) {goto block_53;} // branch non-likely + + c->lbu(t0, 4, a0); // lbu t0, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + c->addiu(t1, r0, 0); // addiu t1, r0, 0 + c->addiu(t2, r0, 0); // addiu t2, r0, 0 + bc = c->sgpr64(t0) == 0; // beq t0, r0, L22 + c->daddiu(t3, t0, -43); // daddiu t3, t0, -43 + if (bc) {goto block_60;} // branch non-likely + + c->movz(t1, t0, t3); // movz t1, t0, t3 + c->daddiu(t3, t0, -45); // daddiu t3, t0, -45 + c->movz(t1, t0, t3); // movz t1, t0, t3 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t1) != 0; // bne t1, r0, L6 + c->daddiu(t3, t0, -121); // daddiu t3, t0, -121 + if (bc) {goto block_15;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L13 + c->daddiu(t2, t0, -89); // daddiu t2, t0, -89 + if (bc) {goto block_46;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L13 + c->daddiu(t2, t0, -122); // daddiu t2, t0, -122 + if (bc) {goto block_46;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L14 + c->daddiu(t2, t0, -90); // daddiu t2, t0, -90 + if (bc) {goto block_47;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L14 + c->daddiu(t2, t0, -48); // daddiu t2, t0, -48 + if (bc) {goto block_47;} // branch non-likely + + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L18 + c->daddiu(t2, t0, -57); // daddiu t2, t0, -57 + if (bc) {goto block_53;} // branch non-likely + + bc = ((s64)c->sgpr64(t2)) > 0; // bgtz t2, L18 + c->daddiu(t2, t0, -126); // daddiu t2, t0, -126 + if (bc) {goto block_53;} // branch non-likely + + bc = c->sgpr64(t2) == 0; // beq t2, r0, L18 + c->daddiu(t2, t0, -48); // daddiu t2, t0, -48 + if (bc) {goto block_53;} // branch non-likely + + +block_15: + c->lbu(t0, 4, a0); // lbu t0, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + bc = c->sgpr64(t0) == 0; // beq t0, r0, L22 + c->daddiu(t3, t0, -110); // daddiu t3, t0, -110 + if (bc) {goto block_60;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L7 + c->daddiu(t3, t0, -78); // daddiu t3, t0, -78 + if (bc) {goto block_36;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L7 + c->daddiu(t3, t0, -108); // daddiu t3, t0, -108 + if (bc) {goto block_36;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -76); // daddiu t3, t0, -76 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -119); // daddiu t3, t0, -119 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -87); // daddiu t3, t0, -87 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -107); // daddiu t3, t0, -107 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L9 + c->daddiu(t3, t0, -75); // daddiu t3, t0, -75 + if (bc) {goto block_39;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L9 + c->daddiu(t3, t0, -106); // daddiu t3, t0, -106 + if (bc) {goto block_39;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -74); // daddiu t3, t0, -74 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -104); // daddiu t3, t0, -104 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L10 + c->daddiu(t3, t0, -72); // daddiu t3, t0, -72 + if (bc) {goto block_41;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L10 + c->daddiu(t3, t0, -118); // daddiu t3, t0, -118 + if (bc) {goto block_41;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -86); // daddiu t3, t0, -86 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -117); // daddiu t3, t0, -117 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -85); // daddiu t3, t0, -85 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -48); // daddiu t3, t0, -48 + if (bc) {goto block_3;} // branch non-likely + + bc = c->sgpr64(t3) == 0; // beq t3, r0, L5 + c->daddiu(t3, t0, -48); // daddiu t3, t0, -48 + if (bc) {goto block_3;} // branch non-likely + + bc = ((s64)c->sgpr64(t3)) < 0; // bltz t3, L18 + c->daddiu(t4, t0, -57); // daddiu t4, t0, -57 + if (bc) {goto block_53;} // branch non-likely + + bc = ((s64)c->sgpr64(t4)) > 0; // bgtz t4, L18 + c->sll(t4, t2, 2); // sll t4, t2, 2 + if (bc) {goto block_53;} // branch non-likely + + c->daddu(t0, t2, t4); // daddu t0, t2, t4 + // nop // sll r0, r0, 0 + c->sll(t0, t0, 1); // sll t0, t0, 1 + // nop // sll r0, r0, 0 + //beq r0, r0, L6 // beq r0, r0, L6 + c->daddu(t2, t0, t3); // daddu t2, t0, t3 + goto block_15; // branch always + + +block_36: + bc = c->sgpr64(t2) != 0; // bne t2, r0, L8 + c->load_symbol2(a3, cache.font12_table); // lw a3, *font12-table*(s7) + if (bc) {goto block_38;} // branch non-likely + + c->mov64(a3, a3); // or a3, a3, r0 + c->addiu(t0, r0, -33); // addiu t0, r0, -33 + c->lqc2(vf13, 208, a2); // lqc2 vf13, 208(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 224, a2); // lqc2 vf14, 224(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, a2); // sqc2 vf14, 352(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, a2); // sqc2 vf14, 368(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, a2); // sqc2 vf14, 384(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, a2); // sqc2 vf14, 400(a2) + //beq r0, r0, L5 // beq r0, r0, L5 + c->and_(v1, v1, t0); // and v1, v1, t0 + goto block_3; // branch always + + +block_38: + // nop // sll r0, r0, 0 + c->load_symbol2(a3, cache.font24_table); // lw a3, *font24-table*(s7) + c->mov64(a3, a3); // or a3, a3, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf13, 256, a2); // lqc2 vf13, 256(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 272, a2); // lqc2 vf14, 272(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 352, a2); // sqc2 vf14, 352(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 288, a2); // lqc2 vf14, 288(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 368, a2); // sqc2 vf14, 368(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 304, a2); // lqc2 vf14, 304(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 384, a2); // sqc2 vf14, 384(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf14, 320, a2); // lqc2 vf14, 320(a2) + // nop // sll r0, r0, 0 + c->sqc2(vf14, 400, a2); // sqc2 vf14, 400(a2) + //beq r0, r0, L5 // beq r0, r0, L5 + c->ori(v1, v1, 32); // ori v1, v1, 32 + goto block_3; // branch always + + +block_39: + c->addiu(t0, r0, -3); // addiu t0, r0, -3 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L5 + c->and_(v1, v1, t0); // and v1, v1, t0 + if (bc) {goto block_3;} // branch non-likely + + //beq r0, r0, L5 // beq r0, r0, L5 + c->ori(v1, v1, 2); // ori v1, v1, 2 + goto block_3; // branch always + + +block_41: + c->mov128_vf_gpr(vf1, t2); // qmtc2.i vf1, t2 + c->daddiu(t0, t1, -45); // daddiu t0, t1, -45 + bc = c->sgpr64(t1) == 0; // beq t1, r0, L12 + c->vitof0(DEST::xyzw, vf1, vf1); // vitof0.xyzw vf1, vf1 + if (bc) {goto block_45;} // branch non-likely + + bc = c->sgpr64(t0) == 0; // beq t0, r0, L11 + // nop // sll r0, r0, 0 + if (bc) {goto block_44;} // branch non-likely + + //beq r0, r0, L5 // beq r0, r0, L5 + c->vadd_bc(DEST::x, BC::x, vf23, vf23, vf1); // vaddx.x vf23, vf23, vf1 + goto block_3; // branch always + + +block_44: + //beq r0, r0, L5 // beq r0, r0, L5 + c->vsub_bc(DEST::x, BC::x, vf23, vf23, vf1); // vsubx.x vf23, vf23, vf1 + goto block_3; // branch always + + +block_45: + //beq r0, r0, L5 // beq r0, r0, L5 + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf1); // vaddx.x vf23, vf0, vf1 + goto block_3; // branch always + + +block_46: + //beq r0, r0, L5 // beq r0, r0, L5 + c->sqc2(vf23, 464, a2); // sqc2 vf23, 464(a2) + goto block_3; // branch always + + +block_47: + //beq r0, r0, L5 // beq r0, r0, L5 + c->lqc2(vf23, 464, a2); // lqc2 vf23, 464(a2) + goto block_3; // branch always + + +block_48: + c->daddiu(t1, t0, -3); // daddiu t1, t0, -3 + c->ori(v1, v1, 64); // ori v1, v1, 64 + bc = c->sgpr64(t1) == 0; // beq t1, r0, L16 + c->daddiu(t0, t0, -2); // daddiu t0, t0, -2 + if (bc) {goto block_51;} // branch non-likely + + bc = c->sgpr64(t0) == 0; // beq t0, r0, L17 + c->lqc2(vf14, 384, a2); // lqc2 vf14, 384(a2) + if (bc) {goto block_52;} // branch non-likely + + //beq r0, r0, L17 // beq r0, r0, L17 + c->lqc2(vf14, 368, a2); // lqc2 vf14, 368(a2) + goto block_52; // branch always + + +block_51: + // nop // sll r0, r0, 0 + c->lqc2(vf14, 400, a2); // lqc2 vf14, 400(a2) + +block_52: + c->lbu(t0, 4, a0); // lbu t0, 4(a0) + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + //beq r0, r0, L20 // beq r0, r0, L20 + c->sll(t1, t0, 4); // sll t1, t0, 4 + goto block_56; // branch always + + +block_53: + // nop // sll r0, r0, 0 + c->addiu(t1, r0, -65); // addiu t1, r0, -65 + c->and_(v1, v1, t1); // and v1, v1, t1 + c->lqc2(vf14, 352, a2); // lqc2 vf14, 352(a2) + // nop // sll r0, r0, 0 + c->sll(t1, t0, 4); // sll t1, t0, 4 + // nop // sll r0, r0, 0 + c->daddiu(t2, t0, -10); // daddiu t2, t0, -10 + bc = c->sgpr64(t2) == 0; // beq t2, r0, L19 + c->daddiu(t0, t0, -13); // daddiu t0, t0, -13 + if (bc) {goto block_55;} // branch non-likely + + bc = c->sgpr64(t0) != 0; // bne t0, r0, L20 + // nop // sll r0, r0, 0 + if (bc) {goto block_56;} // branch non-likely + + +block_55: + //beq r0, r0, L5 // beq r0, r0, L5 + c->vadd_bc(DEST::x, BC::x, vf23, vf0, vf24); // vaddx.x vf23, vf0, vf24 + goto block_3; // branch always + + +block_56: + c->addu(t0, t1, a3); // addu t0, t1, a3 + // nop // sll r0, r0, 0 + c->lqc2(vf5, -96, t0); // lqc2 vf5, -96(t0) + // nop // sll r0, r0, 0 + c->vmul(DEST::xyzw, vf19, vf5, vf13); // vmul.xyzw vf19, vf5, vf13 + c->andi(t0, v1, 2); // andi t0, v1, 2 + bc = c->sgpr64(t0) == 0; // beq t0, r0, L21 + c->andi(t0, v1, 64); // andi t0, v1, 64 + if (bc) {goto block_59;} // branch non-likely + + bc = c->sgpr64(t0) != 0; // bne t0, r0, L21 + // nop // sll r0, r0, 0 + if (bc) {goto block_59;} // branch non-likely + + //beq r0, r0, L5 // beq r0, r0, L5 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf19); // vaddw.x vf23, vf23, vf19 + goto block_3; // branch always + + +block_59: + //beq r0, r0, L5 // beq r0, r0, L5 + c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14 + goto block_3; // branch always + + +block_60: + c->vsub(DEST::xyzw, vf23, vf23, vf24); // vsub.xyzw vf23, vf23, vf24 + c->load_symbol2(v1, cache.video_params); // lw v1, *video-params*(s7) + c->mov64(v1, v1); // or v1, v1, r0 + c->lqc2(vf1, 16, v1); // lqc2 vf1, 16(v1) + c->vmul(DEST::x, vf23, vf23, vf1); // vmul.x vf23, vf23, vf1 + c->lqc2(vf1, 44, a1); // lqc2 vf1, 44(a1) + c->vmul_bc(DEST::x, BC::w, vf23, vf23, vf1); // vmulw.x vf23, vf23, vf1 + c->mov128_gpr_vf(v0, vf23); // qmfc2.i v0, vf23 + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.font_work = intern_from_c(-1, 0, "*font-work*").c(); + cache.font12_table = intern_from_c(-1, 0, "*font12-table*").c(); + cache.font24_table = intern_from_c(-1, 0, "*font24-table*").c(); + cache.video_params = intern_from_c(-1, 0, "*video-params*").c(); + gLinkedFunctionTable.reg("get-string-length", execute, 512); +} + +} // namespace get_string_length +} // namespace Mips2C +// add get_string_length::link to the link callback table for the object file. +// FWD DEC: diff --git a/game/mips2c/jak3_functions/generic_effect.cpp b/game/mips2c/jak3_functions/generic_effect.cpp new file mode 100644 index 0000000000..cdf3737d4d --- /dev/null +++ b/game/mips2c/jak3_functions/generic_effect.cpp @@ -0,0 +1,2646 @@ + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_light_proc { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + +void vcallms0(ExecutionContext* c) { + // move.xyzw vf21, vf17 | mulax.xyzw ACC, vf10, vf01 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf10).vf, c->vf_src(vf01).vf.x()); c->vfs[vf21].vf.move(Mask::xyzw, c->vf_src(vf17).vf); + // move.xyzw vf22, vf18 | madday.xyzw ACC, vf11, vf01 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf11].vf, c->vfs[vf01].vf.y()); c->vfs[vf22].vf.move(Mask::xyzw, c->vf_src(vf18).vf); + // move.xyzw vf23, vf19 | maddz.xyzw vf01, vf12, vf01 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf01].vf, c->vf_src(vf12).vf, c->vf_src(vf01).vf.z()); c->vfs[vf23].vf.move(Mask::xyzw, c->vf_src(vf19).vf); + // move.xyzw vf24, vf20 | mulax.xyzw ACC, vf10, vf02 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf10).vf, c->vf_src(vf02).vf.x()); c->vfs[vf24].vf.move(Mask::xyzw, c->vf_src(vf20).vf); + // nop | itof0.xyzw vf17, vf05 + c->vfs[vf17].vf.itof0(Mask::xyzw, c->vf_src(vf05).vf); + // nop | itof0.xyzw vf18, vf06 + c->vfs[vf18].vf.itof0(Mask::xyzw, c->vf_src(vf06).vf); + // nop | itof0.xyzw vf19, vf07 + c->vfs[vf19].vf.itof0(Mask::xyzw, c->vf_src(vf07).vf); + // nop | itof0.xyzw vf20, vf08 + c->vfs[vf20].vf.itof0(Mask::xyzw, c->vf_src(vf08).vf); + + // nop | madday.xyzw ACC, vf11, vf02 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf11].vf, c->vfs[vf02].vf.y()); + // nop | maddz.xyzw vf02, vf12, vf02 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf02].vf, c->vf_src(vf12).vf, c->vf_src(vf02).vf.z()); + // nop | mulax.xyzw ACC, vf10, vf03 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf10).vf, c->vf_src(vf03).vf.x()); + // nop | madday.xyzw ACC, vf11, vf03 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf11].vf, c->vfs[vf03].vf.y()); + // nop | maddz.xyzw vf03, vf12, vf03 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf03].vf, c->vf_src(vf12).vf, c->vf_src(vf03).vf.z()); + // nop | mulax.xyzw ACC, vf10, vf04 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf10).vf, c->vf_src(vf04).vf.x()); + // nop | madday.xyzw ACC, vf11, vf04 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf11].vf, c->vfs[vf04].vf.y()); + // nop | maddz.xyzw vf04, vf12, vf04 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf04].vf, c->vf_src(vf12).vf, c->vf_src(vf04).vf.z()); + // nop | maxx.xyzw vf01, vf01, vf00 + c->vfs[vf01].vf.max(Mask::xyzw, c->vf_src(vf01).vf, c->vf_src(vf00).vf.x()); + // nop | maxx.xyzw vf02, vf02, vf00 + c->vfs[vf02].vf.max(Mask::xyzw, c->vf_src(vf02).vf, c->vf_src(vf00).vf.x()); + // nop | maxx.xyzw vf03, vf03, vf00 + c->vfs[vf03].vf.max(Mask::xyzw, c->vf_src(vf03).vf, c->vf_src(vf00).vf.x()); + // nop | maxx.xyzw vf04, vf04, vf00 + c->vfs[vf04].vf.max(Mask::xyzw, c->vf_src(vf04).vf, c->vf_src(vf00).vf.x()); + // nop | mulaw.xyzw ACC, vf13, vf00 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf13).vf, c->vf_src(vf00).vf.w()); + // nop | maddax.xyzw ACC, vf14, vf01 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf14].vf, c->vfs[vf01].vf.x()); + // nop | madday.xyzw ACC, vf15, vf01 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf15].vf, c->vfs[vf01].vf.y()); + // nop | maddz.xyzw vf01, vf16, vf01 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf01].vf, c->vf_src(vf16).vf, c->vf_src(vf01).vf.z()); + // nop | mulaw.xyzw ACC, vf13, vf00 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf13).vf, c->vf_src(vf00).vf.w()); + // nop | maddax.xyzw ACC, vf14, vf02 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf14].vf, c->vfs[vf02].vf.x()); + // nop | madday.xyzw ACC, vf15, vf02 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf15].vf, c->vfs[vf02].vf.y()); + // nop | maddz.xyzw vf02, vf16, vf02 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf02].vf, c->vf_src(vf16).vf, c->vf_src(vf02).vf.z()); + // nop | mulaw.xyzw ACC, vf13, vf00 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf13).vf, c->vf_src(vf00).vf.w()); + // nop | maddax.xyzw ACC, vf14, vf03 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf14].vf, c->vfs[vf03].vf.x()); + // nop | madday.xyzw ACC, vf15, vf03 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf15].vf, c->vfs[vf03].vf.y()); + // nop | maddz.xyzw vf03, vf16, vf03 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf03].vf, c->vf_src(vf16).vf, c->vf_src(vf03).vf.z()); + // nop | mulaw.xyzw ACC, vf13, vf00 + c->acc.vf.mula(Mask::xyzw, c->vf_src(vf13).vf, c->vf_src(vf00).vf.w()); + // nop | maddax.xyzw ACC, vf14, vf04 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf14].vf, c->vfs[vf04].vf.x()); + // nop | madday.xyzw ACC, vf15, vf04 + c->acc.vf.madda(Mask::xyzw, c->vfs[vf15].vf, c->vfs[vf04].vf.y()); + // nop | maddz.xyzw vf04, vf16, vf04 + c->acc.vf.madd(Mask::xyzw, c->vfs[vf04].vf, c->vf_src(vf16).vf, c->vf_src(vf04).vf.z()); + // nop | mul.xyzw vf17, vf17, vf01 + c->vfs[vf17].vf.mul(Mask::xyzw, c->vf_src(vf17).vf, c->vf_src(vf01).vf); + // nop | mul.xyzw vf18, vf18, vf02 + c->vfs[vf18].vf.mul(Mask::xyzw, c->vf_src(vf18).vf, c->vf_src(vf02).vf); + // nop | mul.xyzw vf19, vf19, vf03 + c->vfs[vf19].vf.mul(Mask::xyzw, c->vf_src(vf19).vf, c->vf_src(vf03).vf); + // nop | mul.xyzw vf20, vf20, vf04 + c->vfs[vf20].vf.mul(Mask::xyzw, c->vf_src(vf20).vf, c->vf_src(vf04).vf); + // nop | minix.xyzw vf17, vf17, vf09 + c->vfs[vf17].vf.mini(Mask::xyzw, c->vf_src(vf17).vf, c->vf_src(vf09).vf.x()); + // nop | minix.xyzw vf18, vf18, vf09 + c->vfs[vf18].vf.mini(Mask::xyzw, c->vf_src(vf18).vf, c->vf_src(vf09).vf.x()); + // nop | minix.xyzw vf19, vf19, vf09 + c->vfs[vf19].vf.mini(Mask::xyzw, c->vf_src(vf19).vf, c->vf_src(vf09).vf.x()); + // nop | minix.xyzw vf20, vf20, vf09 + c->vfs[vf20].vf.mini(Mask::xyzw, c->vf_src(vf20).vf, c->vf_src(vf09).vf.x()); + //fmt::print("light:\n {}\n {}\n {}\n {}\n\n", c->vf_src(vf17).vf.print(), c->vf_src(vf18).vf.print(), c->vf_src(vf19).vf.print(), c->vf_src(vf20).vf.print()); + + + + // nop | ftoi0.xyzw vf17, vf17 + c->vfs[vf17].vf.ftoi0(Mask::xyzw, c->vf_src(vf17).vf); + // nop | ftoi0.xyzw vf18, vf18 + c->vfs[vf18].vf.ftoi0(Mask::xyzw, c->vf_src(vf18).vf); + // nop | ftoi0.xyzw vf19, vf19 :e + c->vfs[vf19].vf.ftoi0(Mask::xyzw, c->vf_src(vf19).vf); + // nop | ftoi0.xyzw vf20, vf20 + c->vfs[vf20].vf.ftoi0(Mask::xyzw, c->vf_src(vf20).vf); +} + + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + c->daddiu(sp, sp, -96); // daddiu sp, sp, -96 + c->sd(ra, 12432, at); // sd ra, 12432(at) + c->sq(s2, 12448, at); // sq s2, 12448(at) + c->sq(s3, 12464, at); // sq s3, 12464(at) + c->sq(s4, 12480, at); // sq s4, 12480(at) + c->sq(s5, 12496, at); // sq s5, 12496(at) + c->sq(gp, 12512, at); // sq gp, 12512(at) + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->lw(v1, 44, at); // lw v1, 44(at) + // nop // sll r0, r0, 0 + c->lw(a1, 36, at); // lw a1, 36(at) + // nop // sll r0, r0, 0 + c->lw(a0, 4, v1); // lw a0, 4(v1) + // nop // sll r0, r0, 0 + c->lw(t0, 0, v1); // lw t0, 0(v1) + // nop // sll r0, r0, 0 + c->lw(t3, 4, at); // lw t3, 4(at) + // nop // sll r0, r0, 0 + c->lw(v1, 8, at); // lw v1, 8(at) + c->addiu(a3, r0, 255); // addiu a3, r0, 255 + c->lw(t2, 12, at); // lw t2, 12(at) + c->addiu(a2, r0, 256); // addiu a2, r0, 256 + c->lui(t1, -2); // lui t1, -2 + c->mov64(t4, a1); // or t4, a1, r0 + c->lqc2(vf10, 12688, at); // lqc2 vf10, 12688(at) + c->ori(a1, t1, 65534); // ori a1, t1, 65534 + c->lqc2(vf11, 12704, at); // lqc2 vf11, 12704(at) + c->pextlw(a1, a1, a1); // pextlw a1, a1, a1 + c->lqc2(vf12, 12720, at); // lqc2 vf12, 12720(at) + c->pextlw(t1, a0, a0); // pextlw t1, a0, a0 + c->lqc2(vf15, 12752, at); // lqc2 vf15, 12752(at) + c->pextlw(a0, a1, a1); // pextlw a0, a1, a1 + c->lqc2(vf14, 12736, at); // lqc2 vf14, 12736(at) + c->pextlw(a1, t1, t1); // pextlw a1, t1, t1 + c->lqc2(vf16, 12768, at); // lqc2 vf16, 12768(at) + c->pcpyh(a3, a3); // pcpyh a3, a3 + c->lqc2(vf13, 12784, at); // lqc2 vf13, 12784(at) + c->pcpyh(t1, a2); // pcpyh t1, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(a2, a3, a3); // pcpyld a2, a3, a3 + c->lqc2(vf9, 12144, at); // lqc2 vf9, 12144(at) + c->pcpyld(a3, t1, t1); // pcpyld a3, t1, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->ldr(t1, 0, t0); // ldr t1, 0(t0) + // nop // sll r0, r0, 0 + c->ldl(t1, 7, t0); // ldl t1, 7(t0) + // nop // sll r0, r0, 0 + c->daddiu(t0, t0, 8); // daddiu t0, t0, 8 + c->pextlh(t1, r0, t1); // pextlh t1, r0, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t5, t1, a2); // pand t5, t1, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psllw(t5, t5, 5); // psllw t5, t5, 5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->paddw(s5, t5, a1); // paddw s5, t5, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->dsrl32(t9, s5, 0); // dsrl32 t9, s5, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyud(s4, s5, r0); // pcpyud s4, s5, r0 + c->lq(t6, 0, s5); // lq t6, 0(s5) + c->dsrl32(ra, s4, 0); // dsrl32 ra, s4, 0 + c->lq(t7, 0, t9); // lq t7, 0(t9) + c->pand(t8, t1, a3); // pand t8, t1, a3 + c->lq(t5, 0, s4); // lq t5, 0(s4) + c->psraw(gp, t8, 8); // psraw gp, t8, 8 + c->lq(t8, 0, ra); // lq t8, 0(ra) + c->pextuw(s3, t7, t6); // pextuw s3, t7, t6 + c->lq(s5, 16, s5); // lq s5, 16(s5) + c->pextuw(s2, t8, t5); // pextuw s2, t8, t5 + c->lq(t9, 16, t9); // lq t9, 16(t9) + c->pcpyud(s3, s3, s2); // pcpyud s3, s3, s2 + c->lq(s4, 16, s4); // lq s4, 16(s4) + c->pand(s3, s3, a0); // pand s3, s3, a0 + c->lq(ra, 16, ra); // lq ra, 16(ra) + c->por(s3, s3, gp); // por s3, s3, gp + c->mov128_vf_gpr(vf1, s5); // qmtc2.ni vf1, s5 + c->pextub(gp, r0, s5); // pextub gp, r0, s5 + c->sq(s3, 0, t2); // sq s3, 0(t2) + c->pextub(s5, r0, t9); // pextub s5, r0, t9 + c->mov128_vf_gpr(vf2, t9); // qmtc2.ni vf2, t9 + c->pextub(t9, r0, s4); // pextub t9, r0, s4 + c->mov128_vf_gpr(vf3, s4); // qmtc2.ni vf3, s4 + c->pextub(s4, r0, ra); // pextub s4, r0, ra + c->mov128_vf_gpr(vf4, ra); // qmtc2.ni vf4, ra + c->pextuh(ra, r0, gp); // pextuh ra, r0, gp + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextuh(gp, r0, s5); // pextuh gp, r0, s5 + c->mov128_vf_gpr(vf5, ra); // qmtc2.ni vf5, ra + c->pextuh(t9, r0, t9); // pextuh t9, r0, t9 + c->mov128_vf_gpr(vf6, gp); // qmtc2.ni vf6, gp + c->pextuh(ra, r0, s4); // pextuh ra, r0, s4 + c->mov128_vf_gpr(vf7, t9); // qmtc2.ni vf7, t9 + c->prot3w(t8, t8); // prot3w t8, t8 + c->mov128_vf_gpr(vf8, ra); // qmtc2.ni vf8, ra + c->prot3w(t7, t7); // prot3w t7, t7 + // Unknown instr: vcallms 0 + vcallms0(c); + c->pextuw(t9, t7, t6); // pextuw t9, t7, t6 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t7, t5, t7); // pcpyld t7, t5, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t6, t9, t6); // pcpyld t6, t9, t6 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->daddiu(t2, t2, 16); // daddiu t2, t2, 16 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextuw(t5, t8, t5); // pextuw t5, t8, t5 + c->sq(t7, 16, t3); // sq t7, 16(t3) + c->pcpyld(t5, t8, t5); // pcpyld t5, t8, t5 + c->sq(t6, 0, t3); // sq t6, 0(t3) + // nop // sll r0, r0, 0 + c->sq(t5, 32, t3); // sq t5, 32(t3) + c->daddiu(t3, t3, 48); // daddiu t3, t3, 48 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->daddiu(t4, t4, -4); // daddiu t4, t4, -4 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + bc = ((s64)c->sgpr64(t4)) <= 0; // blez t4, L91 + c->mfc1(r0, f31); // mfc1 r0, f31 + if (bc) {goto block_2;} // branch non-likely + + + block_1: + // nop // sll r0, r0, 0 + c->ldr(t1, 0, t0); // ldr t1, 0(t0) + // nop // sll r0, r0, 0 + c->ldl(t1, 7, t0); // ldl t1, 7(t0) + // nop // sll r0, r0, 0 + c->daddiu(t0, t0, 8); // daddiu t0, t0, 8 + c->pextlh(t1, r0, t1); // pextlh t1, r0, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t5, t1, a2); // pand t5, t1, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psllw(t5, t5, 5); // psllw t5, t5, 5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->paddw(s5, t5, a1); // paddw s5, t5, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->dsrl32(t9, s5, 0); // dsrl32 t9, s5, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyud(s4, s5, r0); // pcpyud s4, s5, r0 + c->lq(t6, 0, s5); // lq t6, 0(s5) + c->dsrl32(ra, s4, 0); // dsrl32 ra, s4, 0 + c->lq(t7, 0, t9); // lq t7, 0(t9) + c->pand(t8, t1, a3); // pand t8, t1, a3 + c->lq(t5, 0, s4); // lq t5, 0(s4) + c->psraw(gp, t8, 8); // psraw gp, t8, 8 + c->lq(t8, 0, ra); // lq t8, 0(ra) + c->pextuw(s3, t7, t6); // pextuw s3, t7, t6 + c->lq(s5, 16, s5); // lq s5, 16(s5) + c->pextuw(s2, t8, t5); // pextuw s2, t8, t5 + c->lq(t9, 16, t9); // lq t9, 16(t9) + c->pcpyud(s3, s3, s2); // pcpyud s3, s3, s2 + c->lq(s4, 16, s4); // lq s4, 16(s4) + c->pand(s3, s3, a0); // pand s3, s3, a0 + c->lq(ra, 16, ra); // lq ra, 16(ra) + c->por(s3, s3, gp); // por s3, s3, gp + c->mov128_vf_gpr(vf1, s5); // qmtc2.ni vf1, s5 + c->pextub(gp, r0, s5); // pextub gp, r0, s5 + c->sq(s3, 0, t2); // sq s3, 0(t2) + c->pextub(s5, r0, t9); // pextub s5, r0, t9 + c->mov128_vf_gpr(vf2, t9); // qmtc2.ni vf2, t9 + c->pextub(t9, r0, s4); // pextub t9, r0, s4 + c->mov128_vf_gpr(vf3, s4); // qmtc2.ni vf3, s4 + c->pextub(s4, r0, ra); // pextub s4, r0, ra + c->mov128_vf_gpr(vf4, ra); // qmtc2.ni vf4, ra + c->pextuh(ra, r0, gp); // pextuh ra, r0, gp + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextuh(gp, r0, s5); // pextuh gp, r0, s5 + c->mov128_vf_gpr(vf5, ra); // qmtc2.ni vf5, ra + c->pextuh(t9, r0, t9); // pextuh t9, r0, t9 + c->mov128_vf_gpr(vf6, gp); // qmtc2.ni vf6, gp + c->pextuh(ra, r0, s4); // pextuh ra, r0, s4 + c->mov128_vf_gpr(vf7, t9); // qmtc2.ni vf7, t9 + c->prot3w(t8, t8); // prot3w t8, t8 + c->mov128_vf_gpr(vf8, ra); // qmtc2.ni vf8, ra + c->prot3w(t7, t7); // prot3w t7, t7 + // Unknown instr: vcallms 0 + vcallms0(c); + c->pextuw(t9, t7, t6); // pextuw t9, t7, t6 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t7, t5, t7); // pcpyld t7, t5, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t6, t9, t6); // pcpyld t6, t9, t6 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextuw(t5, t8, t5); // pextuw t5, t8, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t5, t8, t5); // pcpyld t5, t8, t5 + c->sq(t6, 0, t3); // sq t6, 0(t3) + // nop // sll r0, r0, 0 + c->sq(t7, 16, t3); // sq t7, 16(t3) + // nop // sll r0, r0, 0 + c->sq(t5, 32, t3); // sq t5, 32(t3) + c->daddiu(t2, t2, 16); // daddiu t2, t2, 16 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->daddiu(t3, t3, 48); // daddiu t3, t3, 48 + c->mov128_gpr_vf(t7, vf21); // qmfc2.ni t7, vf21 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t8, vf22); // qmfc2.ni t8, vf22 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t5, vf23); // qmfc2.ni t5, vf23 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t6, vf24); // qmfc2.ni t6, vf24 + c->ppach(t7, t8, t7); // ppach t7, t8, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppach(t5, t6, t5); // ppach t5, t6, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppacb(t5, t5, t7); // ppacb t5, t5, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->sq(t5, 0, v1); // sq t5, 0(v1) + c->daddiu(t4, t4, -4); // daddiu t4, t4, -4 + c->daddiu(v1, v1, 16); // daddiu v1, v1, 16 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + bc = ((s64)c->sgpr64(t4)) > 0; // bgtz t4, L90 + // nop // sll r0, r0, 0 + if (bc) {goto block_1;} // branch non-likely + + + block_2: + // nop // sll r0, r0, 0 + // nop // vnop + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(a2, vf17); // qmfc2.ni a2, vf17 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(a3, vf18); // qmfc2.ni a3, vf18 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(a0, vf19); // qmfc2.ni a0, vf19 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(a1, vf20); // qmfc2.ni a1, vf20 + c->ppach(a2, a3, a2); // ppach a2, a3, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppach(a0, a1, a0); // ppach a0, a1, a0 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppacb(a0, a0, a2); // ppacb a0, a0, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->sq(a0, 0, v1); // sq a0, 0(v1) + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(ra, 12432, at); // ld ra, 12432(at) + c->lq(gp, 12512, at); // lq gp, 12512(at) + c->lq(s5, 12496, at); // lq s5, 12496(at) + c->lq(s4, 12480, at); // lq s4, 12480(at) + c->lq(s3, 12464, at); // lq s3, 12464(at) + c->lq(s2, 12448, at); // lq s2, 12448(at) + //jr ra // jr ra + c->daddiu(sp, sp, 96); // daddiu sp, sp, 96 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("generic-light-proc", execute, 128); +} + +} // namespace generic_light_proc +} // namespace Mips2C +// add generic_light_proc::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_envmap_proc { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + + +void vcallms48(ExecutionContext* c) { + // nop | mulx.xyzw vf13, vf09, vf31 + c->vfs[vf13].vf.mul(Mask::xyzw, c->vf_src(vf09).vf, c->vf_src(vf31).vf.x()); + // nop | subw.z vf21, vf21, vf00 + c->vfs[vf21].vf.sub(Mask::z, c->vf_src(vf21).vf, c->vf_src(vf00).vf.w()); + // nop | addy.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.y()); + // nop | mulx.xyz vf08, vf08, vf30 + c->vfs[vf08].vf.mul(Mask::xyz, c->vf_src(vf08).vf, c->vf_src(vf30).vf.x()); + // nop | addw.xy vf05, vf05, vf31 + c->vfs[vf05].vf.add(Mask::xy, c->vf_src(vf05).vf, c->vf_src(vf31).vf.w()); + // nop | mul.xyz vf30, vf21, vf13 + c->vfs[vf30].vf.mul(Mask::xyz, c->vf_src(vf21).vf, c->vf_src(vf13).vf); + // nop | addz.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.z()); + // nop | add.xyz vf08, vf08, vf16 + c->vfs[vf08].vf.add(Mask::xyz, c->vf_src(vf08).vf, c->vf_src(vf16).vf); + // move.xyzw vf28, vf27 | ftoi12.xy vf17, vf05 + c->vfs[vf17].vf.ftoi12(Mask::xy, c->vf_src(vf05).vf); c->vfs[vf28].vf.move(Mask::xyzw, c->vf_src(vf27).vf); + // move.xyzw vf02, vf22 | addy.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.y()); c->vfs[vf02].vf.move(Mask::xyzw, c->vf_src(vf22).vf); + // rsqrt Q, vf31.z, vf29.x | mul.xyz vf06, vf06, Q + c->vfs[vf06].vf.mul(Mask::xyz, c->vf_src(vf06).vf, c->Q); c->Q = c->vf_src(vf31).vf.z() / std::sqrt(c->vf_src(vf29).vf.x()); + // nop | mul.xyz vf29, vf08, vf08 + c->vfs[vf29].vf.mul(Mask::xyz, c->vf_src(vf08).vf, c->vf_src(vf08).vf); + // nop | mulx.xyz vf01, vf21, vf28 + c->vfs[vf01].vf.mul(Mask::xyz, c->vf_src(vf21).vf, c->vf_src(vf28).vf.x()); + // nop | addz.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.z()); + // nop | mulx.xyzw vf14, vf10, vf31 + c->vfs[vf14].vf.mul(Mask::xyzw, c->vf_src(vf10).vf, c->vf_src(vf31).vf.x()); + // nop | subw.z vf02, vf02, vf00 + c->vfs[vf02].vf.sub(Mask::z, c->vf_src(vf02).vf, c->vf_src(vf00).vf.w()); + // nop | addy.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.y()); + // nop | mulx.xyz vf01, vf01, vf30 + c->vfs[vf01].vf.mul(Mask::xyz, c->vf_src(vf01).vf, c->vf_src(vf30).vf.x()); + // nop | addw.xy vf06, vf06, vf31 + c->vfs[vf06].vf.add(Mask::xy, c->vf_src(vf06).vf, c->vf_src(vf31).vf.w()); + // nop | mul.xyz vf30, vf02, vf14 + c->vfs[vf30].vf.mul(Mask::xyz, c->vf_src(vf02).vf, c->vf_src(vf14).vf); + // nop | addz.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.z()); + // nop | add.xyz vf01, vf01, vf13 + c->vfs[vf01].vf.add(Mask::xyz, c->vf_src(vf01).vf, c->vf_src(vf13).vf); + // nop | ftoi12.xy vf18, vf06 + c->vfs[vf18].vf.ftoi12(Mask::xy, c->vf_src(vf06).vf); + // nop | addy.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.y()); + // rsqrt Q, vf31.z, vf29.x | mul.xyz vf07, vf07, Q + c->vfs[vf07].vf.mul(Mask::xyz, c->vf_src(vf07).vf, c->Q); c->Q = c->vf_src(vf31).vf.z() / std::sqrt(c->vf_src(vf29).vf.x()); + // move.xyzw vf03, vf23 | mul.xyz vf29, vf01, vf01 + c->vfs[vf29].vf.mul(Mask::xyz, c->vf_src(vf01).vf, c->vf_src(vf01).vf); c->vfs[vf03].vf.move(Mask::xyzw, c->vf_src(vf23).vf); + // nop | muly.xyz vf02, vf02, vf28 + c->vfs[vf02].vf.mul(Mask::xyz, c->vf_src(vf02).vf, c->vf_src(vf28).vf.y()); + // nop | addz.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.z()); + // nop | mulx.xyzw vf15, vf11, vf31 + c->vfs[vf15].vf.mul(Mask::xyzw, c->vf_src(vf11).vf, c->vf_src(vf31).vf.x()); + // nop | subw.z vf03, vf03, vf00 + c->vfs[vf03].vf.sub(Mask::z, c->vf_src(vf03).vf, c->vf_src(vf00).vf.w()); + // nop | addy.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.y()); + // nop | mulx.xyz vf02, vf02, vf30 + c->vfs[vf02].vf.mul(Mask::xyz, c->vf_src(vf02).vf, c->vf_src(vf30).vf.x()); + // nop | addw.xy vf07, vf07, vf31 + c->vfs[vf07].vf.add(Mask::xy, c->vf_src(vf07).vf, c->vf_src(vf31).vf.w()); + // nop | mul.xyz vf30, vf03, vf15 + c->vfs[vf30].vf.mul(Mask::xyz, c->vf_src(vf03).vf, c->vf_src(vf15).vf); + // nop | addz.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.z()); + // nop | add.xyz vf02, vf02, vf14 + c->vfs[vf02].vf.add(Mask::xyz, c->vf_src(vf02).vf, c->vf_src(vf14).vf); + // nop | ftoi12.xy vf19, vf07 + c->vfs[vf19].vf.ftoi12(Mask::xy, c->vf_src(vf07).vf); + // nop | addy.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.y()); + // rsqrt Q, vf31.z, vf29.x | mul.xyz vf08, vf08, Q + c->vfs[vf08].vf.mul(Mask::xyz, c->vf_src(vf08).vf, c->Q); c->Q = c->vf_src(vf31).vf.z() / std::sqrt(c->vf_src(vf29).vf.x()); + // move.xyzw vf04, vf24 | mul.xyz vf29, vf02, vf02 + c->vfs[vf29].vf.mul(Mask::xyz, c->vf_src(vf02).vf, c->vf_src(vf02).vf); c->vfs[vf04].vf.move(Mask::xyzw, c->vf_src(vf24).vf); + // nop | mulz.xyz vf03, vf03, vf28 + c->vfs[vf03].vf.mul(Mask::xyz, c->vf_src(vf03).vf, c->vf_src(vf28).vf.z()); + // nop | addz.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.z()); + // nop | mulx.xyzw vf16, vf12, vf31 + c->vfs[vf16].vf.mul(Mask::xyzw, c->vf_src(vf12).vf, c->vf_src(vf31).vf.x()); + // nop | subw.z vf04, vf04, vf00 + c->vfs[vf04].vf.sub(Mask::z, c->vf_src(vf04).vf, c->vf_src(vf00).vf.w()); + // nop | addy.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.y()); + // nop | mulx.xyz vf03, vf03, vf30 + c->vfs[vf03].vf.mul(Mask::xyz, c->vf_src(vf03).vf, c->vf_src(vf30).vf.x()); + // nop | addw.xy vf08, vf08, vf31 + c->vfs[vf08].vf.add(Mask::xy, c->vf_src(vf08).vf, c->vf_src(vf31).vf.w()); + // nop | mul.xyz vf30, vf04, vf16 + c->vfs[vf30].vf.mul(Mask::xyz, c->vf_src(vf04).vf, c->vf_src(vf16).vf); + // nop | addz.x vf29, vf29, vf29 + c->vfs[vf29].vf.add(Mask::x, c->vf_src(vf29).vf, c->vf_src(vf29).vf.z()); + // nop | add.xyz vf03, vf03, vf15 + c->vfs[vf03].vf.add(Mask::xyz, c->vf_src(vf03).vf, c->vf_src(vf15).vf); + // nop | ftoi12.xy vf20, vf08 + c->vfs[vf20].vf.ftoi12(Mask::xy, c->vf_src(vf08).vf); + // nop | addy.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.y()); + // rsqrt Q, vf31.z, vf29.x | mul.xyz vf05, vf01, Q + c->vfs[vf05].vf.mul(Mask::xyz, c->vf_src(vf01).vf, c->Q); c->Q = c->vf_src(vf31).vf.z() / std::sqrt(c->vf_src(vf29).vf.x()); + // move.xyzw vf06, vf02 | mul.xyz vf29, vf03, vf03 + c->vfs[vf29].vf.mul(Mask::xyz, c->vf_src(vf03).vf, c->vf_src(vf03).vf); c->vfs[vf06].vf.move(Mask::xyzw, c->vf_src(vf02).vf); + // move.xyzw vf07, vf03 | mulw.xyz vf08, vf04, vf28 :e + c->vfs[vf08].vf.mul(Mask::xyz, c->vf_src(vf04).vf, c->vf_src(vf28).vf.w()); c->vfs[vf07].vf.move(Mask::xyzw, c->vf_src(vf03).vf); + // nop | addz.x vf30, vf30, vf30 + c->vfs[vf30].vf.add(Mask::x, c->vf_src(vf30).vf, c->vf_src(vf30).vf.z()); + +} + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + c->daddiu(sp, sp, -128); // daddiu sp, sp, -128 + c->sd(ra, 12432, at); // sd ra, 12432(at) + c->sq(s0, 12448, at); // sq s0, 12448(at) + c->sq(s1, 12464, at); // sq s1, 12464(at) + c->sq(s2, 12480, at); // sq s2, 12480(at) + c->sq(s3, 12496, at); // sq s3, 12496(at) + c->sq(s4, 12512, at); // sq s4, 12512(at) + c->sq(s5, 12528, at); // sq s5, 12528(at) + c->sq(gp, 12544, at); // sq gp, 12544(at) + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + // nop // sll r0, r0, 0 + c->lw(v1, 44, at); // lw v1, 44(at) + // nop // sll r0, r0, 0 + c->lw(a0, 36, at); // lw a0, 36(at) + // nop // sll r0, r0, 0 + c->lw(t0, 0, v1); // lw t0, 0(v1) + // nop // sll r0, r0, 0 + c->lw(a2, 4, v1); // lw a2, 4(v1) + // nop // sll r0, r0, 0 + c->lw(t3, 16, at); // lw t3, 16(at) + // nop // sll r0, r0, 0 + c->lw(v1, 20, at); // lw v1, 20(at) + // nop // sll r0, r0, 0 + c->addiu(t1, r0, 255); // addiu t1, r0, 255 + c->addiu(a3, r0, 256); // addiu a3, r0, 256 + c->lui(a1, -2); // lui a1, -2 + c->lui(t2, 16256); // lui t2, 16256 + c->ori(a1, a1, 65534); // ori a1, a1, 65534 + c->mtc1(f0, t2); // mtc1 f0, t2 + c->daddiu(t2, a0, 3); // daddiu t2, a0, 3 + c->sra(t5, t2, 2); // sra t5, t2, 2 + c->lq(t2, 12048, at); // lq t2, 12048(at) + c->sra(t4, t5, 2); // sra t4, t5, 2 + c->andi(t5, t5, 3); // andi t5, t5, 3 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L85 + // nop // sll r0, r0, 0 + if (bc) {goto block_2;} // branch non-likely + + + block_1: + c->daddiu(t3, t3, 64); // daddiu t3, t3, 64 + c->sq(t2, -64, t3); // sq t2, -64(t3) + // nop // sll r0, r0, 0 + c->sq(t2, -48, t3); // sq t2, -48(t3) + c->daddiu(t4, t4, -1); // daddiu t4, t4, -1 + c->sq(t2, -32, t3); // sq t2, -32(t3) + bc = ((s64)c->sgpr64(t4)) > 0; // bgtz t4, L84 + c->sq(t2, -16, t3); // sq t2, -16(t3) + if (bc) {goto block_1;} // branch non-likely + + + block_2: + bc = c->sgpr64(t5) == 0; // beq t5, r0, L86 + c->daddiu(t4, t5, -1); // daddiu t4, t5, -1 + if (bc) {goto block_6;} // branch non-likely + + bc = c->sgpr64(t4) == 0; // beq t4, r0, L86 + c->sq(t2, 0, t3); // sq t2, 0(t3) + if (bc) {goto block_6;} // branch non-likely + + c->daddiu(t3, t3, 16); // daddiu t3, t3, 16 + c->daddiu(t4, t4, -1); // daddiu t4, t4, -1 + bc = c->sgpr64(t4) == 0; // beq t4, r0, L86 + c->sq(t2, 0, t3); // sq t2, 0(t3) + if (bc) {goto block_6;} // branch non-likely + + c->daddiu(t3, t3, 16); // daddiu t3, t3, 16 + c->daddiu(t4, t4, -1); // daddiu t4, t4, -1 + // nop // sll r0, r0, 0 + c->sq(t2, 0, t3); // sq t2, 0(t3) + + block_6: + c->daddiu(a0, a0, -4); // daddiu a0, a0, -4 + c->lqc2(vf31, 12016, at); // lqc2 vf31, 12016(at) + c->pextlw(a1, a1, a1); // pextlw a1, a1, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlw(a1, a1, a1); // pextlw a1, a1, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlw(a2, a2, a2); // pextlw a2, a2, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlw(a2, a2, a2); // pextlw a2, a2, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyh(t2, t1); // pcpyh t2, t1 + c->ld(t1, 0, t0); // ld t1, 0(t0) + c->pcpyld(t2, t2, t2); // pcpyld t2, t2, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyh(a3, a3); // pcpyh a3, a3 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(a3, a3, a3); // pcpyld a3, a3, a3 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->daddiu(t0, t0, 8); // daddiu t0, t0, 8 + c->sq(t2, 96, at); // sq t2, 96(at) + c->pextlh(t1, r0, t1); // pextlh t1, r0, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t2, t1, t2); // pand t2, t1, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psllw(t2, t2, 5); // psllw t2, t2, 5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->paddw(t5, t2, a2); // paddw t5, t2, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->dsrl32(t6, t5, 0); // dsrl32 t6, t5, 0 + c->lwc1(f4, 24, t5); // lwc1 f4, 24(t5) + c->pcpyud(t7, t5, r0); // pcpyud t7, t5, r0 + c->lwc1(f3, 24, t6); // lwc1 f3, 24(t6) + c->dsrl32(t8, t7, 0); // dsrl32 t8, t7, 0 + c->lwc1(f2, 24, t7); // lwc1 f2, 24(t7) + c->pand(t1, t1, a3); // pand t1, t1, a3 + c->lwc1(f1, 24, t8); // lwc1 f1, 24(t8) + c->psraw(t2, t1, 8); // psraw t2, t1, 8 + c->lq(t1, 16, t5); // lq t1, 16(t5) + c->mov128_gpr_gpr(s0, t2); // por s0, t2, r0 + c->subs(f4, f4, f0); // sub.s f4, f4, f0 + c->divs(f4, f0, f4); // div.s f4, f0, f4 + c->lq(t2, 16, t6); // lq t2, 16(t6) + // nop // sll r0, r0, 0 + c->lq(t3, 16, t7); // lq t3, 16(t7) + // nop // sll r0, r0, 0 + c->lq(t4, 16, t8); // lq t4, 16(t8) + // nop // sll r0, r0, 0 + c->lq(t5, 0, t5); // lq t5, 0(t5) + // nop // sll r0, r0, 0 + c->lq(t6, 0, t6); // lq t6, 0(t6) + // nop // sll r0, r0, 0 + c->lq(t7, 0, t7); // lq t7, 0(t7) + // nop // sll r0, r0, 0 + c->lq(t8, 0, t8); // lq t8, 0(t8) + c->muls(f4, f4, f0); // mul.s f4, f4, f0 + // nop // sll r0, r0, 0 + c->subs(f3, f3, f0); // sub.s f3, f3, f0 + // nop // sll r0, r0, 0 + c->divs(f3, f0, f3); // div.s f3, f0, f3 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(t9, f4); // mfc1 t9, f4 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->muls(f3, f3, f0); // mul.s f3, f3, f0 + // nop // sll r0, r0, 0 + c->subs(f2, f2, f0); // sub.s f2, f2, f0 + // nop // sll r0, r0, 0 + c->divs(f2, f0, f2); // div.s f2, f0, f2 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(ra, f3); // mfc1 ra, f3 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->muls(f2, f2, f0); // mul.s f2, f2, f0 + // nop // sll r0, r0, 0 + c->subs(f1, f1, f0); // sub.s f1, f1, f0 + // nop // sll r0, r0, 0 + c->divs(f1, f0, f1); // div.s f1, f0, f1 + // nop // sll r0, r0, 0 + c->pextlw(t9, ra, t9); // pextlw t9, ra, t9 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(ra, f2); // mfc1 ra, f2 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(gp, f1); // mfc1 gp, f1 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->pextlw(ra, gp, ra); // pextlw ra, gp, ra + // nop // sll r0, r0, 0 + c->pcpyld(t9, ra, t9); // pcpyld t9, ra, t9 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf21, t1); // qmtc2.ni vf21, t1 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf22, t2); // qmtc2.ni vf22, t2 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf23, t3); // qmtc2.ni vf23, t3 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf24, t4); // qmtc2.ni vf24, t4 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf9, t5); // qmtc2.ni vf9, t5 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf10, t6); // qmtc2.ni vf10, t6 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf11, t7); // qmtc2.ni vf11, t7 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf12, t8); // qmtc2.ni vf12, t8 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf27, t9); // qmtc2.ni vf27, t9 + c->lq(t2, 96, at); // lq t2, 96(at) + // Unknown instr: vcallms 48 + vcallms48(c); + // nop // sll r0, r0, 0 + c->ld(t1, 0, t0); // ld t1, 0(t0) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->daddiu(t0, t0, 8); // daddiu t0, t0, 8 + c->pextlh(t1, r0, t1); // pextlh t1, r0, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t2, t1, t2); // pand t2, t1, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psllw(t2, t2, 5); // psllw t2, t2, 5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->paddw(t5, t2, a2); // paddw t5, t2, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->dsrl32(t6, t5, 0); // dsrl32 t6, t5, 0 + c->lwc1(f3, 24, t5); // lwc1 f3, 24(t5) + c->pcpyud(t7, t5, r0); // pcpyud t7, t5, r0 + c->lwc1(f2, 24, t6); // lwc1 f2, 24(t6) + c->dsrl32(t8, t7, 0); // dsrl32 t8, t7, 0 + c->lwc1(f1, 24, t7); // lwc1 f1, 24(t7) + c->pand(t1, t1, a3); // pand t1, t1, a3 + c->lwc1(f4, 24, t8); // lwc1 f4, 24(t8) + c->psraw(t2, t1, 8); // psraw t2, t1, 8 + c->lq(t1, 16, t5); // lq t1, 16(t5) + c->mov128_gpr_gpr(s1, t2); // por s1, t2, r0 + c->subs(f5, f3, f0); // sub.s f5, f3, f0 + c->subs(f3, f2, f0); // sub.s f3, f2, f0 + // nop // sll r0, r0, 0 + c->subs(f2, f1, f0); // sub.s f2, f1, f0 + // nop // sll r0, r0, 0 + c->subs(f1, f4, f0); // sub.s f1, f4, f0 + // nop // sll r0, r0, 0 + c->divs(f4, f0, f5); // div.s f4, f0, f5 + c->lq(t2, 16, t6); // lq t2, 16(t6) + // nop // sll r0, r0, 0 + c->lq(t3, 16, t7); // lq t3, 16(t7) + // nop // sll r0, r0, 0 + c->lq(t4, 16, t8); // lq t4, 16(t8) + // nop // sll r0, r0, 0 + c->lq(t5, 0, t5); // lq t5, 0(t5) + // nop // sll r0, r0, 0 + c->lq(t6, 0, t6); // lq t6, 0(t6) + // nop // sll r0, r0, 0 + c->lq(t7, 0, t7); // lq t7, 0(t7) + // nop // sll r0, r0, 0 + c->lq(t8, 0, t8); // lq t8, 0(t8) + c->muls(f4, f4, f0); // mul.s f4, f4, f0 + // nop // sll r0, r0, 0 + c->divs(f3, f0, f3); // div.s f3, f0, f3 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(t9, f4); // mfc1 t9, f4 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->muls(f3, f3, f0); // mul.s f3, f3, f0 + // nop // sll r0, r0, 0 + c->divs(f2, f0, f2); // div.s f2, f0, f2 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(ra, f3); // mfc1 ra, f3 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->muls(f2, f2, f0); // mul.s f2, f2, f0 + // nop // sll r0, r0, 0 + c->divs(f1, f0, f1); // div.s f1, f0, f1 + // nop // sll r0, r0, 0 + c->pextlw(t9, ra, t9); // pextlw t9, ra, t9 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(ra, f2); // mfc1 ra, f2 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(gp, f1); // mfc1 gp, f1 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf21, t1); // qmtc2.ni vf21, t1 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf9, t5); // qmtc2.ni vf9, t5 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf10, t6); // qmtc2.ni vf10, t6 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf11, t7); // qmtc2.ni vf11, t7 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf12, t8); // qmtc2.ni vf12, t8 + c->pextlw(t1, gp, ra); // pextlw t1, gp, ra + // nop // sll r0, r0, 0 + c->pcpyld(t1, t1, t9); // pcpyld t1, t1, t9 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf22, t2); // qmtc2.ni vf22, t2 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf23, t3); // qmtc2.ni vf23, t3 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf24, t4); // qmtc2.ni vf24, t4 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf27, t1); // qmtc2.ni vf27, t1 + c->lq(t2, 96, at); // lq t2, 96(at) + // Unknown instr: vcallms 48 + vcallms48(c); + // nop // sll r0, r0, 0 + c->ld(t1, 0, t0); // ld t1, 0(t0) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->daddiu(t0, t0, 8); // daddiu t0, t0, 8 + c->pextlh(t1, r0, t1); // pextlh t1, r0, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t2, t1, t2); // pand t2, t1, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psllw(t2, t2, 5); // psllw t2, t2, 5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->paddw(t2, t2, a2); // paddw t2, t2, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->dsrl32(t3, t2, 0); // dsrl32 t3, t2, 0 + c->lwc1(f3, 24, t2); // lwc1 f3, 24(t2) + c->pcpyud(t7, t2, r0); // pcpyud t7, t2, r0 + c->lwc1(f2, 24, t3); // lwc1 f2, 24(t3) + c->dsrl32(t8, t7, 0); // dsrl32 t8, t7, 0 + c->lwc1(f1, 24, t7); // lwc1 f1, 24(t7) + c->pand(t1, t1, a3); // pand t1, t1, a3 + c->lwc1(f4, 24, t8); // lwc1 f4, 24(t8) + c->psraw(t4, t1, 8); // psraw t4, t1, 8 + c->lq(t1, 16, t2); // lq t1, 16(t2) + c->mov128_gpr_gpr(s2, t4); // por s2, t4, r0 + c->subs(f5, f3, f0); // sub.s f5, f3, f0 + c->subs(f3, f2, f0); // sub.s f3, f2, f0 + // nop // sll r0, r0, 0 + c->subs(f2, f1, f0); // sub.s f2, f1, f0 + // nop // sll r0, r0, 0 + c->subs(f1, f4, f0); // sub.s f1, f4, f0 + // nop // sll r0, r0, 0 + c->divs(f4, f0, f5); // div.s f4, f0, f5 + c->lq(t4, 16, t3); // lq t4, 16(t3) + // nop // sll r0, r0, 0 + c->lq(t5, 16, t7); // lq t5, 16(t7) + // nop // sll r0, r0, 0 + c->lq(t6, 16, t8); // lq t6, 16(t8) + // nop // sll r0, r0, 0 + c->lq(t2, 0, t2); // lq t2, 0(t2) + // nop // sll r0, r0, 0 + c->lq(t3, 0, t3); // lq t3, 0(t3) + // nop // sll r0, r0, 0 + c->lq(t7, 0, t7); // lq t7, 0(t7) + // nop // sll r0, r0, 0 + c->lq(t8, 0, t8); // lq t8, 0(t8) + c->muls(f4, f4, f0); // mul.s f4, f4, f0 + // nop // sll r0, r0, 0 + c->divs(f3, f0, f3); // div.s f3, f0, f3 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(t9, f4); // mfc1 t9, f4 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->muls(f3, f3, f0); // mul.s f3, f3, f0 + // nop // sll r0, r0, 0 + c->divs(f2, f0, f2); // div.s f2, f0, f2 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(ra, f3); // mfc1 ra, f3 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->muls(f2, f2, f0); // mul.s f2, f2, f0 + // nop // sll r0, r0, 0 + c->divs(f1, f0, f1); // div.s f1, f0, f1 + // nop // sll r0, r0, 0 + c->pextlw(t9, ra, t9); // pextlw t9, ra, t9 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->mfc1(ra, f2); // mfc1 ra, f2 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf21, t1); // qmtc2.ni vf21, t1 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf22, t4); // qmtc2.ni vf22, t4 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf23, t5); // qmtc2.ni vf23, t5 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf24, t6); // qmtc2.ni vf24, t6 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(t1, f1); // mfc1 t1, f1 + c->pextlw(t1, t1, ra); // pextlw t1, t1, ra + // nop // sll r0, r0, 0 + c->pcpyld(t1, t1, t9); // pcpyld t1, t1, t9 + c->mov128_vf_gpr(vf9, t2); // qmtc2.ni vf9, t2 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf10, t3); // qmtc2.ni vf10, t3 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf11, t7); // qmtc2.ni vf11, t7 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf12, t8); // qmtc2.ni vf12, t8 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf27, t1); // qmtc2.ni vf27, t1 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t4, vf17); // qmfc2.ni t4, vf17 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t5, vf18); // qmfc2.ni t5, vf18 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t6, vf19); // qmfc2.ni t6, vf19 + bc = ((s64)c->sgpr64(a0)) <= 0; // blez a0, L88 + c->mov128_gpr_vf(t7, vf20); // qmfc2.ni t7, vf20 + if (bc) {goto block_8;} // branch non-likely + + + block_7: + c->lq(t2, 96, at); // lq t2, 96(at) + // Unknown instr: vcallms 48 + vcallms48(c); + c->daddiu(a0, a0, -4); // daddiu a0, a0, -4 + c->ld(t1, 0, t0); // ld t1, 0(t0) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->daddiu(v1, v1, 16); // daddiu v1, v1, 16 + c->daddiu(t0, t0, 8); // daddiu t0, t0, 8 + c->pextlh(t1, r0, t1); // pextlh t1, r0, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t2, t1, t2); // pand t2, t1, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psllw(t2, t2, 5); // psllw t2, t2, 5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->paddw(t9, t2, a2); // paddw t9, t2, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->dsrl32(ra, t9, 0); // dsrl32 ra, t9, 0 + c->lwc1(f1, 24, t9); // lwc1 f1, 24(t9) + c->pcpyud(s4, t9, r0); // pcpyud s4, t9, r0 + c->lwc1(f4, 24, ra); // lwc1 f4, 24(ra) + c->subs(f3, f1, f0); // sub.s f3, f1, f0 + // nop // sll r0, r0, 0 + c->dsrl32(s3, s4, 0); // dsrl32 s3, s4, 0 + c->lwc1(f1, 24, s4); // lwc1 f1, 24(s4) + c->pand(t1, t1, a3); // pand t1, t1, a3 + c->lwc1(f2, 24, s3); // lwc1 f2, 24(s3) + c->psraw(s5, t1, 8); // psraw s5, t1, 8 + c->lq(t1, 16, t9); // lq t1, 16(t9) + c->divs(f3, f0, f3); // div.s f3, f0, f3 + c->lq(t2, 16, ra); // lq t2, 16(ra) + c->mov128_gpr_gpr(gp, s0); // por gp, s0, r0 + c->subs(f4, f4, f0); // sub.s f4, f4, f0 + c->ppach(t4, r0, t4); // ppach t4, r0, t4 + c->lq(t3, 16, s4); // lq t3, 16(s4) + c->ppach(t5, r0, t5); // ppach t5, r0, t5 + c->lq(t8, 16, s3); // lq t8, 16(s3) + c->ppach(t6, r0, t6); // ppach t6, r0, t6 + c->lq(t9, 0, t9); // lq t9, 0(t9) + c->ppach(t7, r0, t7); // ppach t7, r0, t7 + c->lq(ra, 0, ra); // lq ra, 0(ra) + c->pextlw(t4, t5, t4); // pextlw t4, t5, t4 + c->lq(t5, 0, s4); // lq t5, 0(s4) + c->pextlw(t6, t7, t6); // pextlw t6, t7, t6 + c->lq(t7, 0, s3); // lq t7, 0(s3) + c->mov128_gpr_gpr(s0, s1); // por s0, s1, r0 + c->muls(f5, f3, f0); // mul.s f5, f3, f0 + c->mov128_gpr_gpr(s1, s2); // por s1, s2, r0 + c->divs(f3, f0, f4); // div.s f3, f0, f4 + c->pcpyld(t4, t6, t4); // pcpyld t4, t6, t4 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t4, t4, a1); // pand t4, t4, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->mov128_gpr_gpr(s2, s5); // por s2, s5, r0 + c->mfc1(t6, f5); // mfc1 t6, f5 + c->subs(f4, f1, f0); // sub.s f4, f1, f0 + // nop // sll r0, r0, 0 + c->por(t4, t4, gp); // por t4, t4, gp + // nop // sll r0, r0, 0 + c->subs(f1, f2, f0); // sub.s f1, f2, f0 + // nop // sll r0, r0, 0 + c->muls(f2, f3, f0); // mul.s f2, f3, f0 + c->sq(t4, -16, v1); // sq t4, -16(v1) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->divs(f3, f0, f4); // div.s f3, f0, f4 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(t4, f2); // mfc1 t4, f2 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->muls(f2, f3, f0); // mul.s f2, f3, f0 + // nop // sll r0, r0, 0 + c->pextlw(t4, t4, t6); // pextlw t4, t4, t6 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->divs(f1, f0, f1); // div.s f1, f0, f1 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(t6, f2); // mfc1 t6, f2 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf21, t1); // qmtc2.ni vf21, t1 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf22, t2); // qmtc2.ni vf22, t2 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf23, t3); // qmtc2.ni vf23, t3 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf24, t8); // qmtc2.ni vf24, t8 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->mfc1(t1, f1); // mfc1 t1, f1 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf9, t9); // qmtc2.ni vf9, t9 + c->pextlw(t1, t1, t6); // pextlw t1, t1, t6 + c->mov128_vf_gpr(vf10, ra); // qmtc2.ni vf10, ra + c->pcpyld(t1, t1, t4); // pcpyld t1, t1, t4 + c->mov128_vf_gpr(vf11, t5); // qmtc2.ni vf11, t5 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf12, t7); // qmtc2.ni vf12, t7 + // nop // sll r0, r0, 0 + c->mov128_vf_gpr(vf27, t1); // qmtc2.ni vf27, t1 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t4, vf17); // qmfc2.ni t4, vf17 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t5, vf18); // qmfc2.ni t5, vf18 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(t6, vf19); // qmfc2.ni t6, vf19 + bc = ((s64)c->sgpr64(a0)) > 0; // bgtz a0, L87 + c->mov128_gpr_vf(t7, vf20); // qmfc2.ni t7, vf20 + if (bc) {goto block_7;} // branch non-likely + + + block_8: + c->daddiu(v1, v1, 16); // daddiu v1, v1, 16 + // nop // sll r0, r0, 0 + c->ppach(t4, r0, t4); // ppach t4, r0, t4 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppach(t5, r0, t5); // ppach t5, r0, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppach(t6, r0, t6); // ppach t6, r0, t6 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppach(t7, r0, t7); // ppach t7, r0, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlw(t4, t5, t4); // pextlw t4, t5, t4 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlw(t6, t7, t6); // pextlw t6, t7, t6 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t4, t6, t4); // pcpyld t4, t6, t4 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t4, t4, a1); // pand t4, t4, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->por(t4, t4, s0); // por t4, t4, s0 + c->mfc1(r0, f31); // mfc1 r0, f31 + // nop // sll r0, r0, 0 + c->sq(t4, -16, v1); // sq t4, -16(v1) + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(ra, 12432, at); // ld ra, 12432(at) + c->lq(gp, 12544, at); // lq gp, 12544(at) + c->lq(s5, 12528, at); // lq s5, 12528(at) + c->lq(s4, 12512, at); // lq s4, 12512(at) + c->lq(s3, 12496, at); // lq s3, 12496(at) + c->lq(s2, 12480, at); // lq s2, 12480(at) + c->lq(s1, 12464, at); // lq s1, 12464(at) + c->lq(s0, 12448, at); // lq s0, 12448(at) + //jr ra // jr ra + c->daddiu(sp, sp, 128); // daddiu sp, sp, 128 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("generic-envmap-proc", execute, 256); +} + +} // namespace generic_envmap_proc +} // namespace Mips2C +// add generic_envmap_proc::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_prepare_dma_double { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + c->daddiu(sp, sp, -128); // daddiu sp, sp, -128 + c->sd(ra, 12432, at); // sd ra, 12432(at) + c->sq(s0, 12448, at); // sq s0, 12448(at) + c->sq(s1, 12464, at); // sq s1, 12464(at) + c->sq(s2, 12480, at); // sq s2, 12480(at) + c->sq(s3, 12496, at); // sq s3, 12496(at) + c->sq(s4, 12512, at); // sq s4, 12512(at) + c->sq(s5, 12528, at); // sq s5, 12528(at) + c->sq(gp, 12544, at); // sq gp, 12544(at) + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->lw(a3, 44, at); // lw a3, 44(at) + // nop // sll r0, r0, 0 + c->lbu(v1, 16, a3); // lbu v1, 16(a3) + // nop // sll r0, r0, 0 + c->lh(a0, 18, a3); // lh a0, 18(a3) + // nop // sll r0, r0, 0 + c->lw(t7, 24, at); // lw t7, 24(at) + c->sll(a2, v1, 2); // sll a2, v1, 2 + c->daddiu(a1, a0, 3); // daddiu a1, a0, 3 + c->daddu(a2, a2, v1); // daddu a2, a2, v1 + c->addiu(t0, r0, -4); // addiu t0, r0, -4 + c->and_(t6, a1, t0); // and t6, a1, t0 + c->sll(a1, a2, 4); // sll a1, a2, 4 + c->daddu(a2, t6, t6); // daddu a2, t6, t6 + c->daddiu(a1, a1, 112); // daddiu a1, a1, 112 + c->daddu(a2, a2, t6); // daddu a2, a2, t6 + c->dsll(t0, t6, 2); // dsll t0, t6, 2 + // nop // sll r0, r0, 0 + c->daddiu(t0, t0, 15); // daddiu t0, t0, 15 + c->dsll(a2, a2, 2); // dsll a2, a2, 2 + c->dsra(t0, t0, 4); // dsra t0, t0, 4 + c->daddiu(a2, a2, 15); // daddiu a2, a2, 15 + c->dsll(t4, t0, 4); // dsll t4, t0, 4 + c->dsra(t9, a2, 4); // dsra t9, a2, 4 + c->dsll(t1, t9, 4); // dsll t1, t9, 4 + c->mov64(a2, t7); // or a2, t7, r0 + c->dsra(t8, a1, 4); // dsra t8, a1, 4 + c->lq(t0, 11744, at); // lq t0, 11744(at) + c->daddu(t2, a2, a1); // daddu t2, a2, a1 + c->lq(t5, 11760, at); // lq t5, 11760(at) + c->daddu(t1, t2, t1); // daddu t1, t2, t1 + c->sq(t0, 0, a2); // sq t0, 0(a2) + c->daddiu(t0, t2, 32); // daddiu t0, t2, 32 + c->lq(ra, 11776, at); // lq ra, 11776(at) + c->daddu(t2, t1, t4); // daddu t2, t1, t4 + c->sq(r0, -16, t0); // sq r0, -16(t0) + c->daddiu(t1, t1, 64); // daddiu t1, t1, 64 + c->lq(gp, 11792, at); // lq gp, 11792(at) + c->daddu(t3, t2, t4); // daddu t3, t2, t4 + c->sq(r0, -32, t1); // sq r0, -32(t1) + c->daddiu(t2, t2, 80); // daddiu t2, t2, 80 + c->sq(r0, -16, t1); // sq r0, -16(t1) + c->daddu(s5, t3, a1); // daddu s5, t3, a1 + c->sq(r0, -32, t2); // sq r0, -32(t2) + c->daddiu(a1, t3, 80); // daddiu a1, t3, 80 + c->sq(r0, -16, t2); // sq r0, -16(t2) + c->daddu(s4, s5, t4); // daddu s4, s5, t4 + c->sq(r0, -16, a1); // sq r0, -16(a1) + c->daddiu(t3, s5, 112); // daddiu t3, s5, 112 + c->lw(s5, 11984, at); // lw s5, 11984(at) + c->daddu(s3, s4, t4); // daddu s3, s4, t4 + c->sq(r0, -16, t3); // sq r0, -16(t3) + c->daddiu(t4, s4, 128); // daddiu t4, s4, 128 + c->sq(t5, 0, a1); // sq t5, 0(a1) + c->daddiu(t5, s3, 128); // daddiu t5, s3, 128 + c->sq(r0, -32, t4); // sq r0, -32(t4) + c->subu(s4, t5, t7); // subu s4, t5, t7 + c->sq(r0, -16, t4); // sq r0, -16(t4) + c->sra(s4, s4, 4); // sra s4, s4, 4 + c->sq(r0, -16, t5); // sq r0, -16(t5) + c->daddiu(s4, s4, -1); // daddiu s4, s4, -1 + c->sq(ra, 0, t5); // sq ra, 0(t5) + c->sh(t9, 0, t5); // sh t9, 0(t5) + c->sq(gp, 16, t5); // sq gp, 16(t5) + c->sw(s5, 24, t5); // sw s5, 24(t5) + c->sh(s4, 0, t7); // sh s4, 0(t7) + c->daddiu(t7, s4, 3); // daddiu t7, s4, 3 + c->sw(t7, 40, at); // sw t7, 40(at) + c->lw(t7, 60, at); // lw t7, 60(at) + c->dsubu(t9, t0, a2); // dsubu t9, t0, a2 + c->daddu(t7, t7, t9); // daddu t7, t7, t9 + c->lw(t9, 12, a2); // lw t9, 12(a2) + c->sll(ra, t8, 16); // sll ra, t8, 16 + c->lw(t8, 68, at); // lw t8, 68(at) + // nop // sll r0, r0, 0 + c->lw(gp, 12, a1); // lw gp, 12(a1) + c->or_(s4, t9, t8); // or s4, t9, t8 + c->lw(t9, 72, at); // lw t9, 72(at) + c->xori(s5, t8, 38); // xori s5, t8, 38 + // nop // sll r0, r0, 0 + c->or_(s4, s4, ra); // or s4, s4, ra + c->lw(t8, 11968, at); // lw t8, 11968(at) + // nop // sll r0, r0, 0 + c->lw(s3, 11988, at); // lw s3, 11988(at) + c->or_(gp, gp, s5); // or gp, gp, s5 + c->sw(s4, 12, a2); // sw s4, 12(a2) + c->or_(s5, gp, ra); // or s5, gp, ra + c->lw(ra, 11972, at); // lw ra, 11972(at) + c->daddiu(gp, t9, 1); // daddiu gp, t9, 1 + c->sw(s5, 12, a1); // sw s5, 12(a1) + c->daddiu(s4, t9, 2); // daddiu s4, t9, 2 + c->lw(s3, 11976, at); // lw s3, 11976(at) + c->dsll(t6, t6, 16); // dsll t6, t6, 16 + c->lw(s5, 11980, at); // lw s5, 11980(at) + c->or_(s4, ra, s4); // or s4, ra, s4 + c->lw(ra, 11984, at); // lw ra, 11984(at) + c->or_(s3, s3, gp); // or s3, s3, gp + c->lw(gp, 11992, at); // lw gp, 11992(at) + c->mov64(s2, t9); // or s2, t9, r0 + c->sw(t8, -8, t0); // sw t8, -8(t0) + c->or_(s5, s5, s2); // or s5, s5, s2 + c->sw(gp, 4, a1); // sw gp, 4(a1) + c->or_(s4, s4, t6); // or s4, s4, t6 + c->sw(ra, 0, a1); // sw ra, 0(a1) + c->or_(s3, s3, t6); // or s3, s3, t6 + c->sw(s4, -4, t0); // sw s4, -4(t0) + c->or_(s5, s5, t6); // or s5, s5, t6 + c->sw(s3, -4, t1); // sw s3, -4(t1) + c->addiu(s4, r0, 567); // addiu s4, r0, 567 + c->sw(s5, -4, t2); // sw s5, -4(t2) + bc = c->sgpr64(t9) != c->sgpr64(s4); // bne t9, s4, L74 + c->daddiu(t9, t9, 279); // daddiu t9, t9, 279 + if (bc) {goto block_2;} // branch non-likely + + // nop // sll r0, r0, 0 + c->addiu(t9, r0, 9); // addiu t9, r0, 9 + + block_2: + c->daddiu(s1, t9, 1); // daddiu s1, t9, 1 + c->lw(s0, 11976, at); // lw s0, 11976(at) + c->mov64(s3, t9); // or s3, t9, r0 + c->lw(s2, 11980, at); // lw s2, 11980(at) + c->daddiu(s5, t9, 2); // daddiu s5, t9, 2 + c->lw(s4, 11972, at); // lw s4, 11972(at) + c->or_(s1, s0, s1); // or s1, s0, s1 + c->sw(t8, -8, t3); // sw t8, -8(t3) + c->or_(t8, s2, s3); // or t8, s2, s3 + c->sw(gp, 24, t5); // sw gp, 24(t5) + c->or_(gp, s4, s5); // or gp, s4, s5 + // nop // sll r0, r0, 0 + c->or_(s5, s1, t6); // or s5, s1, t6 + c->sw(ra, 28, t5); // sw ra, 28(t5) + c->or_(t8, t8, t6); // or t8, t8, t6 + c->sw(s5, -4, t3); // sw s5, -4(t3) + c->or_(ra, gp, t6); // or ra, gp, t6 + c->sw(t8, -4, t4); // sw t8, -4(t4) + c->addiu(t6, r0, 567); // addiu t6, r0, 567 + c->sw(t7, 4, t5); // sw t7, 4(t5) + // nop // sll r0, r0, 0 + c->sw(ra, 12, t5); // sw ra, 12(t5) + bc = c->sgpr64(t9) != c->sgpr64(t6); // bne t9, t6, L75 + c->daddiu(t5, t9, 279); // daddiu t5, t9, 279 + if (bc) {goto block_4;} // branch non-likely + + // nop // sll r0, r0, 0 + c->addiu(t5, r0, 9); // addiu t5, r0, 9 + + block_4: + // nop // sll r0, r0, 0 + c->sw(t5, 72, at); // sw t5, 72(at) + // nop // sll r0, r0, 0 + c->sw(t0, 4, at); // sw t0, 4(at) + // nop // sll r0, r0, 0 + c->sw(t1, 8, at); // sw t1, 8(at) + // nop // sll r0, r0, 0 + c->sw(t2, 12, at); // sw t2, 12(at) + // nop // sll r0, r0, 0 + c->sw(t3, 16, at); // sw t3, 16(at) + // nop // sll r0, r0, 0 + c->sw(t4, 20, at); // sw t4, 20(at) + // nop // sll r0, r0, 0 + c->lw(t0, 48, at); // lw t0, 48(at) + // nop // sll r0, r0, 0 + c->lq(t1, 11808, at); // lq t1, 11808(at) + bc = c->sgpr64(t0) == 0; // beq t0, r0, L80 + c->lq(t2, 11824, at); // lq t2, 11824(at) + if (bc) {goto block_13;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(t3, 11840, at); // lq t3, 11840(at) + // nop // sll r0, r0, 0 + c->lq(t4, 11856, at); // lq t4, 11856(at) + // nop // sll r0, r0, 0 + c->lh(t5, 58, at); // lh t5, 58(at) + // nop // sll r0, r0, 0 + c->sq(t1, 16, a2); // sq t1, 16(a2) + // nop // sll r0, r0, 0 + c->sq(t2, 32, a2); // sq t2, 32(a2) + // nop // sll r0, r0, 0 + c->sq(t3, 48, a2); // sq t3, 48(a2) + // nop // sll r0, r0, 0 + c->sq(t4, 64, a2); // sq t4, 64(a2) + // nop // sll r0, r0, 0 + c->sq(t1, 16, a1); // sq t1, 16(a1) + // nop // sll r0, r0, 0 + c->sq(t2, 32, a1); // sq t2, 32(a1) + // nop // sll r0, r0, 0 + c->sq(t3, 48, a1); // sq t3, 48(a1) + // nop // sll r0, r0, 0 + c->sq(t4, 64, a1); // sq t4, 64(a1) + bc = c->sgpr64(t5) == 0; // beq t5, r0, L76 + c->lq(t1, 11872, at); // lq t1, 11872(at) + if (bc) {goto block_7;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(t2, 11904, at); // lq t2, 11904(at) + // nop // sll r0, r0, 0 + c->lq(t3, 11936, at); // lq t3, 11936(at) + //beq r0, r0, L77 // beq r0, r0, L77 + c->lq(t4, 12032, at); // lq t4, 12032(at) + goto block_8; // branch always + + + block_7: + // nop // sll r0, r0, 0 + c->lq(t2, 11888, at); // lq t2, 11888(at) + // nop // sll r0, r0, 0 + c->lq(t3, 11936, at); // lq t3, 11936(at) + // nop // sll r0, r0, 0 + c->lq(t4, 12032, at); // lq t4, 12032(at) + + block_8: + // nop // sll r0, r0, 0 + c->sq(t1, 80, a2); // sq t1, 80(a2) + // nop // sll r0, r0, 0 + c->sq(t2, 96, a2); // sq t2, 96(a2) + // nop // sll r0, r0, 0 + c->sq(t3, 112, a2); // sq t3, 112(a2) + // nop // sll r0, r0, 0 + c->sq(t4, 80, a1); // sq t4, 80(a1) + // nop // sll r0, r0, 0 + c->sq(t3, 96, a1); // sq t3, 96(a1) + // nop // sll r0, r0, 0 + c->sq(t3, 112, a1); // sq t3, 112(a1) + c->daddiu(t2, a3, 22); // daddiu t2, a3, 22 + c->addiu(t3, r0, 0); // addiu t3, r0, 0 + c->mov64(t4, v1); // or t4, v1, r0 + c->addiu(t6, r0, 128); // addiu t6, r0, 128 + c->mov64(t1, a2); // or t1, a2, r0 + + block_9: + c->daddu(t1, t1, t6); // daddu t1, t1, t6 + c->lq(t6, 0, t0); // lq t6, 0(t0) + c->daddiu(t4, t4, -1); // daddiu t4, t4, -1 + c->lbu(t5, 0, t2); // lbu t5, 0(t2) + // nop // sll r0, r0, 0 + c->lq(t7, 16, t0); // lq t7, 16(t0) + c->daddu(t9, t5, t5); // daddu t9, t5, t5 + c->lq(t8, 32, t0); // lq t8, 32(t0) + c->daddu(ra, t9, t5); // daddu ra, t9, t5 + c->lq(t9, 48, t0); // lq t9, 48(t0) + c->daddiu(gp, ra, 9); // daddiu gp, ra, 9 + c->lq(ra, 64, t0); // lq ra, 64(t0) + c->daddiu(t0, t0, 80); // daddiu t0, t0, 80 + c->sq(t6, 0, t1); // sq t6, 0(t1) + // nop // sll r0, r0, 0 + c->sw(t3, 12, t1); // sw t3, 12(t1) + c->daddiu(t2, t2, 1); // daddiu t2, t2, 1 + c->sq(t7, 16, t1); // sq t7, 16(t1) + c->daddu(t3, t3, gp); // daddu t3, t3, gp + c->sw(t5, 28, t1); // sw t5, 28(t1) + // nop // sll r0, r0, 0 + c->sq(t8, 32, t1); // sq t8, 32(t1) + c->addiu(t6, r0, 80); // addiu t6, r0, 80 + c->sq(t9, 48, t1); // sq t9, 48(t1) + bc = ((s64)c->sgpr64(t4)) > 0; // bgtz t4, L78 + c->sq(ra, 64, t1); // sq ra, 64(t1) + if (bc) {goto block_9;} // branch non-likely + + c->ori(t0, t5, 32768); // ori t0, t5, 32768 + c->sw(a0, 36, at); // sw a0, 36(at) + // nop // sll r0, r0, 0 + c->sw(t0, 28, t1); // sw t0, 28(t1) + // nop // sll r0, r0, 0 + c->sw(v1, 92, a2); // sw v1, 92(a2) + // nop // sll r0, r0, 0 + c->sw(a0, 108, a2); // sw a0, 108(a2) + // nop // sll r0, r0, 0 + c->sw(r0, 124, a2); // sw r0, 124(a2) + c->daddiu(a3, a3, 22); // daddiu a3, a3, 22 + c->addiu(t0, r0, 0); // addiu t0, r0, 0 + c->mov64(t1, v1); // or t1, v1, r0 + c->lw(t6, 52, at); // lw t6, 52(at) + c->mov64(a2, a1); // or a2, a1, r0 + c->addiu(t8, r0, 128); // addiu t8, r0, 128 + // nop // sll r0, r0, 0 + c->lq(t2, 0, t6); // lq t2, 0(t6) + // nop // sll r0, r0, 0 + c->lq(t3, 16, t6); // lq t3, 16(t6) + // nop // sll r0, r0, 0 + c->lq(t4, 32, t6); // lq t4, 32(t6) + // nop // sll r0, r0, 0 + c->lq(t5, 48, t6); // lq t5, 48(t6) + // nop // sll r0, r0, 0 + c->lq(t6, 64, t6); // lq t6, 64(t6) + + block_11: + c->daddu(a2, a2, t8); // daddu a2, a2, t8 + c->lbu(t7, 0, a3); // lbu t7, 0(a3) + c->daddiu(t1, t1, -1); // daddiu t1, t1, -1 + c->sq(t2, 0, a2); // sq t2, 0(a2) + c->daddu(t8, t7, t7); // daddu t8, t7, t7 + c->sw(t0, 12, a2); // sw t0, 12(a2) + c->daddu(t8, t8, t7); // daddu t8, t8, t7 + c->sq(t3, 16, a2); // sq t3, 16(a2) + c->daddiu(t8, t8, 9); // daddiu t8, t8, 9 + c->sw(t7, 28, a2); // sw t7, 28(a2) + c->daddiu(a3, a3, 1); // daddiu a3, a3, 1 + // nop // sll r0, r0, 0 + c->daddu(t0, t0, t8); // daddu t0, t0, t8 + c->sq(t4, 32, a2); // sq t4, 32(a2) + c->addiu(t8, r0, 80); // addiu t8, r0, 80 + c->sq(t5, 48, a2); // sq t5, 48(a2) + bc = ((s64)c->sgpr64(t1)) > 0; // bgtz t1, L79 + c->sq(t6, 64, a2); // sq t6, 64(a2) + if (bc) {goto block_11;} // branch non-likely + + c->ori(a3, t7, 32768); // ori a3, t7, 32768 + c->sw(a0, 36, at); // sw a0, 36(at) + // nop // sll r0, r0, 0 + c->sw(a3, 28, a2); // sw a3, 28(a2) + // nop // sll r0, r0, 0 + c->sw(v1, 92, a1); // sw v1, 92(a1) + // nop // sll r0, r0, 0 + c->sw(a0, 108, a1); // sw a0, 108(a1) + //beq r0, r0, L82 // beq r0, r0, L82 + c->sw(r0, 124, a1); // sw r0, 124(a1) + goto block_16; // branch always + + + block_13: + // nop // sll r0, r0, 0 + c->lq(a3, 16, a2); // lq a3, 16(a2) + // nop // sll r0, r0, 0 + c->lq(t0, 32, a2); // lq t0, 32(a2) + // nop // sll r0, r0, 0 + c->lq(t1, 48, a2); // lq t1, 48(a2) + // nop // sll r0, r0, 0 + c->lq(t2, 64, a2); // lq t2, 64(a2) + // nop // sll r0, r0, 0 + c->sq(a3, 16, a1); // sq a3, 16(a1) + // nop // sll r0, r0, 0 + c->sq(t0, 32, a1); // sq t0, 32(a1) + // nop // sll r0, r0, 0 + c->sq(t1, 48, a1); // sq t1, 48(a1) + // nop // sll r0, r0, 0 + c->sq(t2, 64, a1); // sq t2, 64(a1) + // nop // sll r0, r0, 0 + c->lq(a3, 12032, at); // lq a3, 12032(at) + // nop // sll r0, r0, 0 + c->lq(t0, 11936, at); // lq t0, 11936(at) + // nop // sll r0, r0, 0 + c->sq(a3, 80, a1); // sq a3, 80(a1) + // nop // sll r0, r0, 0 + c->sq(t0, 96, a1); // sq t0, 96(a1) + // nop // sll r0, r0, 0 + c->sq(t0, 112, a1); // sq t0, 112(a1) + c->mov64(a3, v1); // or a3, v1, r0 + c->lw(t5, 52, at); // lw t5, 52(at) + c->mov64(t0, a1); // or t0, a1, r0 + c->addiu(t7, r0, 128); // addiu t7, r0, 128 + // nop // sll r0, r0, 0 + c->lq(t1, 0, t5); // lq t1, 0(t5) + // nop // sll r0, r0, 0 + c->lq(t2, 16, t5); // lq t2, 16(t5) + // nop // sll r0, r0, 0 + c->lq(t3, 32, t5); // lq t3, 32(t5) + // nop // sll r0, r0, 0 + c->lq(t4, 48, t5); // lq t4, 48(t5) + // nop // sll r0, r0, 0 + c->lq(t5, 64, t5); // lq t5, 64(t5) + c->daddu(a2, a2, t7); // daddu a2, a2, t7 + // nop // sll r0, r0, 0 + + block_14: + c->daddu(t0, t0, t7); // daddu t0, t0, t7 + c->lwu(t8, 12, a2); // lwu t8, 12(a2) + c->daddiu(a3, a3, -1); // daddiu a3, a3, -1 + c->lwu(t7, 28, a2); // lwu t7, 28(a2) + c->daddiu(a2, a2, 80); // daddiu a2, a2, 80 + c->sq(t1, 0, t0); // sq t1, 0(t0) + // nop // sll r0, r0, 0 + c->sw(t8, 12, t0); // sw t8, 12(t0) + // nop // sll r0, r0, 0 + c->sq(t2, 16, t0); // sq t2, 16(t0) + c->daddu(t8, t8, t6); // daddu t8, t8, t6 + c->sw(t7, 28, t0); // sw t7, 28(t0) + // nop // sll r0, r0, 0 + c->sq(t3, 32, t0); // sq t3, 32(t0) + c->addiu(t7, r0, 80); // addiu t7, r0, 80 + c->sq(t4, 48, t0); // sq t4, 48(t0) + bc = ((s64)c->sgpr64(a3)) > 0; // bgtz a3, L81 + c->sq(t5, 64, t0); // sq t5, 64(t0) + if (bc) {goto block_14;} // branch non-likely + + // nop // sll r0, r0, 0 + c->sw(a0, 36, at); // sw a0, 36(at) + // nop // sll r0, r0, 0 + c->sw(v1, 92, a1); // sw v1, 92(a1) + // nop // sll r0, r0, 0 + c->sw(a0, 108, a1); // sw a0, 108(a1) + // nop // sll r0, r0, 0 + c->sw(r0, 124, a1); // sw r0, 124(a1) + + block_16: + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(ra, 12432, at); // ld ra, 12432(at) + c->lq(gp, 12544, at); // lq gp, 12544(at) + c->lq(s5, 12528, at); // lq s5, 12528(at) + c->lq(s4, 12512, at); // lq s4, 12512(at) + c->lq(s3, 12496, at); // lq s3, 12496(at) + c->lq(s2, 12480, at); // lq s2, 12480(at) + c->lq(s1, 12464, at); // lq s1, 12464(at) + c->lq(s0, 12448, at); // lq s0, 12448(at) + //jr ra // jr ra + c->daddiu(sp, sp, 128); // daddiu sp, sp, 128 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("generic-prepare-dma-double", execute, 256); +} + +} // namespace generic_prepare_dma_double +} // namespace Mips2C + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_prepare_dma_single { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + +u64 execute(void*) { + ASSERT(false); + return 0; +} + +u64 execute_real(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + c->daddiu(sp, sp, -32); // daddiu sp, sp, -32 + // get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c); // another guess + c->sq(gp, 12448, at); // sq gp, 12448(at) + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + // nop // sll r0, r0, 0 + c->lw(t1, 44, at); // lw t1, 44(at) + // nop // sll r0, r0, 0 + c->lw(t8, 48, at); // lw t8, 48(at) + // nop // sll r0, r0, 0 + c->lw(v1, 24, at); // lw v1, 24(at) + // nop // sll r0, r0, 0 + c->lh(t3, 56, at); // lh t3, 56(at) + // nop // sll r0, r0, 0 + c->lh(a1, 18, t1); // lh a1, 18(t1) + c->mov64(a0, v1); // or a0, v1, r0 + c->lbu(a2, 16, t1); // lbu a2, 16(t1) + bc = c->sgpr64(t8) == 0; // beq t8, r0, L70 + c->lq(t4, 11744, at); // lq t4, 11744(at) + if (bc) {goto block_10;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(t9, 11808, at); // lq t9, 11808(at) + // nop // sll r0, r0, 0 + c->lq(gp, 11824, at); // lq gp, 11824(at) + c->mov64(a3, a2); // or a3, a2, r0 + c->lq(t7, 11840, at); // lq t7, 11840(at) + bc = c->sgpr64(t3) != 0; // bne t3, r0, L64 + c->lq(t2, 11856, at); // lq t2, 11856(at) + if (bc) {goto block_3;} // branch non-likely + + // nop // sll r0, r0, 0 + c->lq(t0, 11872, at); // lq t0, 11872(at) + // nop // sll r0, r0, 0 + c->lq(t5, 11888, at); // lq t5, 11888(at) + //beq r0, r0, L65 // beq r0, r0, L65 + c->lq(t6, 11936, at); // lq t6, 11936(at) + goto block_4; // branch always + + + block_3: + // nop // sll r0, r0, 0 + c->lq(t0, 12032, at); // lq t0, 12032(at) + // nop // sll r0, r0, 0 + c->lq(t5, 11936, at); // lq t5, 11936(at) + // nop // sll r0, r0, 0 + c->lq(t6, 11936, at); // lq t6, 11936(at) + + block_4: + // nop // sll r0, r0, 0 + c->sq(t4, 0, a0); // sq t4, 0(a0) + // nop // sll r0, r0, 0 + c->sq(t9, 16, a0); // sq t9, 16(a0) + // nop // sll r0, r0, 0 + c->sq(gp, 32, a0); // sq gp, 32(a0) + c->mov64(t4, t8); // or t4, t8, r0 + c->sq(t7, 48, a0); // sq t7, 48(a0) + c->daddiu(t1, t1, 22); // daddiu t1, t1, 22 + c->sq(t2, 64, a0); // sq t2, 64(a0) + c->addiu(t2, r0, 0); // addiu t2, r0, 0 + c->sq(t0, 80, a0); // sq t0, 80(a0) + c->addiu(t0, r0, 128); // addiu t0, r0, 128 + c->sq(t5, 96, a0); // sq t5, 96(a0) + bc = c->sgpr64(t3) != 0; // bne t3, r0, L67 + c->sq(t6, 112, a0); // sq t6, 112(a0) + if (bc) {goto block_7;} // branch non-likely + + + block_5: + c->daddu(a0, a0, t0); // daddu a0, a0, t0 + c->lq(t0, 0, t4); // lq t0, 0(t4) + c->daddiu(a3, a3, -1); // daddiu a3, a3, -1 + c->lbu(t3, 0, t1); // lbu t3, 0(t1) + // nop // sll r0, r0, 0 + c->lq(t5, 16, t4); // lq t5, 16(t4) + c->daddu(t7, t3, t3); // daddu t7, t3, t3 + c->lq(t6, 32, t4); // lq t6, 32(t4) + c->daddu(t8, t7, t3); // daddu t8, t7, t3 + c->lq(t7, 48, t4); // lq t7, 48(t4) + c->daddiu(t9, t8, 9); // daddiu t9, t8, 9 + c->lq(t8, 64, t4); // lq t8, 64(t4) + c->daddiu(t4, t4, 80); // daddiu t4, t4, 80 + c->sq(t0, 0, a0); // sq t0, 0(a0) + // nop // sll r0, r0, 0 + c->sw(t2, 12, a0); // sw t2, 12(a0) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + c->sq(t5, 16, a0); // sq t5, 16(a0) + c->daddu(t2, t2, t9); // daddu t2, t2, t9 + c->sw(t3, 28, a0); // sw t3, 28(a0) + // nop // sll r0, r0, 0 + c->sq(t6, 32, a0); // sq t6, 32(a0) + c->addiu(t0, r0, 80); // addiu t0, r0, 80 + c->sq(t7, 48, a0); // sq t7, 48(a0) + bc = ((s64)c->sgpr64(a3)) > 0; // bgtz a3, L66 + c->sq(t8, 64, a0); // sq t8, 64(a0) + if (bc) {goto block_5;} // branch non-likely + + //beq r0, r0, L69 // beq r0, r0, L69 + // nop // sll r0, r0, 0 + goto block_9; // branch always + + + block_7: + // nop // sll r0, r0, 0 + c->lw(t3, 52, at); // lw t3, 52(at) + // nop // sll r0, r0, 0 + c->lq(t4, 0, t3); // lq t4, 0(t3) + // nop // sll r0, r0, 0 + c->lq(t5, 16, t3); // lq t5, 16(t3) + // nop // sll r0, r0, 0 + c->lq(t6, 32, t3); // lq t6, 32(t3) + // nop // sll r0, r0, 0 + c->lq(t7, 48, t3); // lq t7, 48(t3) + // nop // sll r0, r0, 0 + c->lq(t8, 64, t3); // lq t8, 64(t3) + + block_8: + c->daddu(a0, a0, t0); // daddu a0, a0, t0 + c->lbu(t3, 0, t1); // lbu t3, 0(t1) + c->daddiu(a3, a3, -1); // daddiu a3, a3, -1 + c->sq(t4, 0, a0); // sq t4, 0(a0) + c->daddu(t0, t3, t3); // daddu t0, t3, t3 + c->sw(t2, 12, a0); // sw t2, 12(a0) + c->daddu(t0, t0, t3); // daddu t0, t0, t3 + c->sq(t5, 16, a0); // sq t5, 16(a0) + c->daddiu(t0, t0, 9); // daddiu t0, t0, 9 + c->sw(t3, 28, a0); // sw t3, 28(a0) + c->daddiu(t1, t1, 1); // daddiu t1, t1, 1 + // nop // sll r0, r0, 0 + c->daddu(t2, t2, t0); // daddu t2, t2, t0 + c->sq(t6, 32, a0); // sq t6, 32(a0) + c->addiu(t0, r0, 80); // addiu t0, r0, 80 + c->sq(t7, 48, a0); // sq t7, 48(a0) + bc = ((s64)c->sgpr64(a3)) > 0; // bgtz a3, L68 + c->sq(t8, 64, a0); // sq t8, 64(a0) + if (bc) {goto block_8;} // branch non-likely + + + block_9: + c->ori(a3, t3, 32768); // ori a3, t3, 32768 + c->sw(a1, 36, at); // sw a1, 36(at) + // nop // sll r0, r0, 0 + c->sw(a3, 28, a0); // sw a3, 28(a0) + // nop // sll r0, r0, 0 + c->sw(a2, 92, a0); // sw a2, 92(a0) + // nop // sll r0, r0, 0 + c->sw(a1, 108, v1); // sw a1, 108(v1) + //beq r0, r0, L71 // beq r0, r0, L71 + c->sw(r0, 124, v1); // sw r0, 124(v1) + goto block_11; // branch always + + + block_10: + c->dsll(a3, a2, 2); // dsll a3, a2, 2 + c->sq(t4, 0, a0); // sq t4, 0(a0) + c->daddu(a3, a3, a2); // daddu a3, a3, a2 + c->sw(a1, 108, v1); // sw a1, 108(v1) + c->dsll(a3, a3, 4); // dsll a3, a3, 4 + // nop // sll r0, r0, 0 + c->daddiu(t0, a3, 128); // daddiu t0, a3, 128 + c->sw(a1, 36, at); // sw a1, 36(at) + + block_11: + c->dsll(t1, a2, 2); // dsll t1, a2, 2 + c->lw(a3, 12, v1); // lw a3, 12(v1) + c->daddu(a2, t1, a2); // daddu a2, t1, a2 + c->lw(t1, 68, at); // lw t1, 68(at) + c->daddiu(a2, a2, 7); // daddiu a2, a2, 7 + // nop // sll r0, r0, 0 + c->or_(t2, a3, t1); // or t2, a3, t1 + // nop // sll r0, r0, 0 + c->sll(t3, a2, 16); // sll t3, a2, 16 + c->xori(a3, t1, 38); // xori a3, t1, 38 + c->or_(t1, t2, t3); // or t1, t2, t3 + c->daddiu(a2, a2, 1); // daddiu a2, a2, 1 + // nop // sll r0, r0, 0 + c->sw(t1, 12, v1); // sw t1, 12(v1) + // nop // sll r0, r0, 0 + c->sw(a3, 68, at); // sw a3, 68(at) + c->daddiu(a1, a1, 3); // daddiu a1, a1, 3 + c->daddu(a0, a0, t0); // daddu a0, a0, t0 + c->dsra(a1, a1, 2); // dsra a1, a1, 2 + c->daddiu(a2, a0, 32); // daddiu a2, a0, 32 + c->dsll(t0, a1, 2); // dsll t0, a1, 2 + // nop // sll r0, r0, 0 + c->daddu(a3, t0, t0); // daddu a3, t0, t0 + c->dsll(a1, t0, 2); // dsll a1, t0, 2 + c->daddu(a3, a3, t0); // daddu a3, a3, t0 + c->daddiu(a1, a1, 15); // daddiu a1, a1, 15 + c->dsll(a3, a3, 2); // dsll a3, a3, 2 + c->dsra(a1, a1, 4); // dsra a1, a1, 4 + c->daddiu(a3, a3, 15); // daddiu a3, a3, 15 + c->dsll(t1, a1, 4); // dsll t1, a1, 4 + c->dsra(a3, a3, 4); // dsra a3, a3, 4 + c->lw(a1, 72, at); // lw a1, 72(at) + c->dsll(a3, a3, 4); // dsll a3, a3, 4 + // nop // sll r0, r0, 0 + c->daddu(a3, a2, a3); // daddu a3, a2, a3 + c->lw(t2, 11968, at); // lw t2, 11968(at) + c->daddu(a2, a3, t1); // daddu a2, a3, t1 + c->sq(r0, 0, a3); // sq r0, 0(a3) + c->daddiu(a2, a2, 16); // daddiu a2, a2, 16 + c->sq(r0, -16, a3); // sq r0, -16(a3) + c->daddu(t1, a2, t1); // daddu t1, a2, t1 + c->sq(r0, -32, a3); // sq r0, -32(a3) + c->daddiu(t1, t1, 16); // daddiu t1, t1, 16 + c->sq(r0, 0, a2); // sq r0, 0(a2) + c->subu(t3, t1, v1); // subu t3, t1, v1 + c->sq(r0, -16, a2); // sq r0, -16(a2) + c->sra(t3, t3, 4); // sra t3, t3, 4 + c->sq(r0, 0, a0); // sq r0, 0(a0) + // nop // sll r0, r0, 0 + c->sh(t3, 0, v1); // sh t3, 0(v1) + c->daddiu(v1, t3, 1); // daddiu v1, t3, 1 + c->sq(r0, 0, t1); // sq r0, 0(t1) + // nop // sll r0, r0, 0 + c->sq(r0, -16, t1); // sq r0, -16(t1) + // nop // sll r0, r0, 0 + c->daddiu(t5, a1, 1); // daddiu t5, a1, 1 + c->daddiu(t4, a1, 2); // daddiu t4, a1, 2 + c->lw(t3, 11988, at); // lw t3, 11988(at) + // nop // sll r0, r0, 0 + c->lw(t7, 11972, at); // lw t7, 11972(at) + c->dsll(t0, t0, 16); // dsll t0, t0, 16 + c->lw(t6, 11976, at); // lw t6, 11976(at) + c->or_(t4, t7, t4); // or t4, t7, t4 + c->lw(t7, 11980, at); // lw t7, 11980(at) + c->or_(t5, t6, t5); // or t5, t6, t5 + c->lw(t6, 11984, at); // lw t6, 11984(at) + // nop // sll r0, r0, 0 + c->lw(t8, 11992, at); // lw t8, 11992(at) + c->mov64(t9, a1); // or t9, a1, r0 + c->sw(t2, 8, a0); // sw t2, 8(a0) + c->or_(t2, t7, t9); // or t2, t7, t9 + c->sw(t8, 0, t1); // sw t8, 0(t1) + c->daddiu(a0, a0, 16); // daddiu a0, a0, 16 + c->sw(r0, 4, t1); // sw r0, 4(t1) + c->or_(t4, t4, t0); // or t4, t4, t0 + c->sw(t6, 8, t1); // sw t6, 8(t1) + c->daddiu(a3, a3, 16); // daddiu a3, a3, 16 + c->sw(t3, 12, t1); // sw t3, 12(t1) + c->or_(t1, t5, t0); // or t1, t5, t0 + c->sw(t4, -4, a0); // sw t4, -4(a0) + c->or_(t0, t2, t0); // or t0, t2, t0 + c->sw(t1, -4, a3); // sw t1, -4(a3) + c->daddiu(a2, a2, 16); // daddiu a2, a2, 16 + c->sw(t0, -4, a2); // sw t0, -4(a2) + c->addiu(t0, r0, 567); // addiu t0, r0, 567 + c->sw(v1, 40, at); // sw v1, 40(at) + bc = c->sgpr64(a1) != c->sgpr64(t0); // bne a1, t0, L72 + c->daddiu(v1, a1, 279); // daddiu v1, a1, 279 + if (bc) {goto block_13;} // branch non-likely + + // nop // sll r0, r0, 0 + c->addiu(v1, r0, 9); // addiu v1, r0, 9 + + block_13: + // nop // sll r0, r0, 0 + c->sw(v1, 72, at); // sw v1, 72(at) + // nop // sll r0, r0, 0 + c->sw(a0, 4, at); // sw a0, 4(at) + // nop // sll r0, r0, 0 + c->sw(a3, 8, at); // sw a3, 8(at) + // nop // sll r0, r0, 0 + c->sw(a2, 12, at); // sw a2, 12(at) + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->lq(gp, 12448, at); // lq gp, 12448(at) + //jr ra // jr ra + c->daddiu(sp, sp, 32); // daddiu sp, sp, 32 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("generic-prepare-dma-single", execute, 128); +} + +} // namespace generic_prepare_dma_single +} // namespace Mips2C +// add generic_prepare_dma_single::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_warp_source_proc { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* + void* math_camera; // *math-camera* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + c->daddiu(sp, sp, -16); // daddiu sp, sp, -16 +// annoyingly, a aguess... + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c); + c->sd(fp, 12440, at); // sd fp, 12440(at) + c->mov64(fp, t9); // or fp, t9, r0 + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + c->lw(a1, 44, at); // lw a1, 44(at) + c->lw(v1, 8, a1); // lw v1, 8(a1) + c->lw(a0, 4, a1); // lw a0, 4(a1) + c->lh(a1, 20, a1); // lh a1, 20(a1) + c->load_symbol2(t0, cache.math_camera); // lw t0, *math-camera*(s7) + c->lhu(a3, 6820, at); // lhu a3, 6820(at) + c->lhu(a2, 6822, at); // lhu a2, 6822(at) + c->dsll(t1, a3, 16); // dsll t1, a3, 16 + c->or_(a3, a3, t1); // or a3, a3, t1 + c->lqc2(vf5, 7520, at); // lqc2 vf5, 7520(at) + c->lqc2(vf1, 7136, at); // lqc2 vf1, 7136(at) + c->lqc2(vf2, 7152, at); // lqc2 vf2, 7152(at) + c->lqc2(vf3, 7168, at); // lqc2 vf3, 7168(at) + c->lqc2(vf4, 7184, at); // lqc2 vf4, 7184(at) + c->lui(t1, -16966); // lui t1, -16966 + c->ori(t1, t1, 24117); // ori t1, t1, 24117 + c->lwc1(f0, 0, t0); // lwc1 f0, 0(t0) + c->mfc1(t0, f0); // mfc1 t0, f0 + c->dsll32(t1, t1, 0); // dsll32 t1, t1, 0 + c->or_(t0, t1, t0); // or t0, t1, t0 + c->mov128_vf_gpr(vf6, t0); // qmtc2.i vf6, t0 + // Unknown instr: ld t0, L111(fp) + c->gprs[t0].du64[0] = 0xffff'ffff; + // nop // sll r0, r0, 0 + + block_1: + c->lqc2(vf9, 0, a0); // lqc2 vf9, 0(a0) + c->lwu(t1, 12, a0); // lwu t1, 12(a0) + c->vmax_bc(DEST::z, BC::x, vf9, vf9, vf6); // vmaxx.z vf9, vf9, vf6 + // nop // vnop + c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0 + c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf9); // vmaddax.xyzw acc, vf1, vf9 + c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf9); // vmadday.xyzw acc, vf2, vf9 + c->vmadd_bc(DEST::xyzw, BC::z, vf9, vf3, vf9); // vmaddz.xyzw vf9, vf3, vf9 + // nop // vnop + c->vdiv(vf5, BC::w, vf9, BC::w); // vdiv Q, vf5.w, vf9.w + // nop // vnop + c->vwaitq(); // vwaitq + c->vmulq(DEST::xyz, vf9, vf9); // vmulq.xyz vf9, vf9, Q + c->vmul(DEST::xy, vf9, vf9, vf5); // vmul.xy vf9, vf9, vf5 + c->vadd_bc(DEST::xy, BC::z, vf9, vf9, vf5); // vaddz.xy vf9, vf9, vf5 + c->vadd_bc(DEST::y, BC::y, vf9, vf9, vf6); // vaddy.y vf9, vf9, vf6 + c->vftoi12(DEST::xyzw, vf10, vf9); // vftoi12.xyzw vf10, vf9 + c->psubh(t1, t1, a3); + c->dsrav(t1, t1, a2); // dsrav t1, t1, a2 + c->ppacb(t1, r0, t1); // ppacb t1, r0, t1 + c->and_(t1, t1, t0); // and t1, t1, t0 + bc = ((s64)c->sgpr64(t1)) < 0; // bltz t1, L20 + c->daddiu(t2, t1, -394); // daddiu t2, t1, -394 + if (bc) {goto block_3;} // branch non-likely + + bc = ((s64)c->sgpr64(t2)) < 0; // bltz t2, L21 + // nop // sll r0, r0, 0 + if (bc) {goto block_4;} // branch non-likely + + + block_3: + // nop // sll r0, r0, 0 + + block_4: + c->sll(t1, t1, 2); // sll t1, t1, 2 + c->daddu(t1, v1, t1); // daddu t1, v1, t1 + c->mov128_gpr_vf(t2, vf10); // qmfc2.i t2, vf10 + c->ppach(t2, r0, t2); // ppach t2, r0, t2 + c->daddiu(a1, a1, -1); // daddiu a1, a1, -1 + c->sw(t2, 0, t1); // sw t2, 0(t1) + bc = ((s64)c->sgpr64(a1)) > 0; // bgtz a1, L19 + c->daddiu(a0, a0, 32); // daddiu a0, a0, 32 + if (bc) {goto block_1;} // branch non-likely + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(fp, 12440, at); // ld fp, 12440(at) + //jr ra // jr ra + c->daddiu(sp, sp, 16); // daddiu sp, sp, 16 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + cache.math_camera = intern_from_c(-1, 0, "*math-camera*").c(); + gLinkedFunctionTable.reg("generic-warp-source-proc", execute, 128); +} + +} // namespace generic_warp_source_proc +} // namespace Mips2C +// add generic_warp_source_proc::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_warp_dest_proc { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + c->daddiu(sp, sp, -16); // daddiu sp, sp, -16 + c->sd(fp, 12440, at); // sd fp, 12440(at) + c->mov64(fp, t9); // or fp, t9, r0 + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + c->lw(a1, 44, at); // lw a1, 44(at) + c->lw(v1, 8, a1); // lw v1, 8(a1) + c->lw(a0, 4, a1); // lw a0, 4(a1) + c->lbu(a1, 17, a1); // lbu a1, 17(a1) + c->lhu(a3, 6820, at); // lhu a3, 6820(at) + c->lhu(a2, 6822, at); // lhu a2, 6822(at) + c->dsll(t0, a3, 16); // dsll t0, a3, 16 + c->or_(a3, a3, t0); // or a3, a3, t0 + // Unknown instr: ld t0, L111(fp) + c->gprs[t0].du64[0] = 0xffff'ffff; + + block_1: + c->lwu(t1, 12, a0); // lwu t1, 12(a0) + // Unknown instr: psubh t1, t1, a3 + c->psubh(t1, t1, a3); + c->dsrav(t1, t1, a2); // dsrav t1, t1, a2 + c->ppacb(t1, r0, t1); // ppacb t1, r0, t1 + c->and_(t1, t1, t0); // and t1, t1, t0 + c->sll(t1, t1, 2); // sll t1, t1, 2 + c->daddu(t1, v1, t1); // daddu t1, v1, t1 + c->lw(t1, 0, t1); // lw t1, 0(t1) + c->sw(t1, 12, a0); // sw t1, 12(a0) + c->daddiu(a1, a1, -1); // daddiu a1, a1, -1 + bc = ((s64)c->sgpr64(a1)) > 0; // bgtz a1, L16 + c->daddiu(a0, a0, 32); // daddiu a0, a0, 32 + if (bc) {goto block_1;} // branch non-likely + + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(fp, 12440, at); // ld fp, 12440(at) + //jr ra // jr ra + c->daddiu(sp, sp, 16); // daddiu sp, sp, 16 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("generic-warp-dest-proc", execute, 128); +} + +} // namespace generic_warp_dest_proc +} // namespace Mips2C +// add generic_warp_dest_proc::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_no_light_proc { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + // u32 call_addr = 0; + c->daddiu(sp, sp, -96); // daddiu sp, sp, -96 + c->sd(ra, 12432, at); // sd ra, 12432(at) + c->sq(s2, 12448, at); // sq s2, 12448(at) + c->sq(s3, 12464, at); // sq s3, 12464(at) + c->sq(s4, 12480, at); // sq s4, 12480(at) + c->sq(s5, 12496, at); // sq s5, 12496(at) + c->sq(gp, 12512, at); // sq gp, 12512(at) + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + // nop // sll r0, r0, 0 + c->addiu(t1, r0, 256); // addiu t1, r0, 256 + c->lw(v1, 36, at); // lw v1, 36(at) + c->lui(a0, -2); // lui a0, -2 + c->lw(a1, 44, at); // lw a1, 44(at) + c->daddiu(v1, v1, 3); // daddiu v1, v1, 3 + c->addiu(a3, r0, 255); // addiu a3, r0, 255 + c->dsra(a2, v1, 2); // dsra a2, v1, 2 + c->lw(v1, 0, a1); // lw v1, 0(a1) + c->dsll(t0, a2, 3); // dsll t0, a2, 3 + c->lw(a2, 4, a1); // lw a2, 4(a1) + c->ori(a1, a0, 65534); // ori a1, a0, 65534 + c->daddu(a0, v1, t0); // daddu a0, v1, t0 + c->pextlw(a1, a1, a1); // pextlw a1, a1, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlw(a1, a1, a1); // pextlw a1, a1, a1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlw(a2, a2, a2); // pextlw a2, a2, a2 + c->lw(t2, 4, at); // lw t2, 4(at) + c->pextlw(a2, a2, a2); // pextlw a2, a2, a2 + c->lw(t3, 8, at); // lw t3, 8(at) + c->pcpyh(a3, a3); // pcpyh a3, a3 + c->lw(t4, 12, at); // lw t4, 12(at) + c->pcpyld(a3, a3, a3); // pcpyld a3, a3, a3 + c->lq(t0, 12160, at); // lq t0, 12160(at) + c->pcpyh(t1, t1); // pcpyh t1, t1 + c->ld(t5, 0, v1); // ld t5, 0(v1) + c->pcpyld(t1, t1, t1); // pcpyld t1, t1, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlh(t6, r0, t5); // pextlh t6, r0, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pand(t5, t6, a3); // pand t5, t6, a3 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psllw(t5, t5, 5); // psllw t5, t5, 5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->daddiu(t2, t2, -48); // daddiu t2, t2, -48 + c->daddiu(t3, t3, -16); // daddiu t3, t3, -16 + //beq r0, r0, L55 // beq r0, r0, L55 + c->daddiu(t4, t4, -16); // daddiu t4, t4, -16 + goto block_2; // branch always + + + block_1: + c->pextlh(t6, r0, ra); // pextlh t6, r0, ra + c->sq(t5, 0, t2); // sq t5, 0(t2) + c->pand(t5, t6, a3); // pand t5, t6, a3 + c->sq(t7, 16, t2); // sq t7, 16(t2) + c->psllw(t5, t5, 5); // psllw t5, t5, 5 + c->sq(t8, 32, t2); // sq t8, 32(t2) + + block_2: + c->paddw(gp, t5, a2); // paddw gp, t5, a2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->dsrl32(s4, gp, 0); // dsrl32 s4, gp, 0 + c->daddiu(t2, t2, 48); // daddiu t2, t2, 48 + c->pcpyud(s5, gp, r0); // pcpyud s5, gp, r0 + c->lq(t5, 0, gp); // lq t5, 0(gp) + c->dsrl32(t8, s5, 0); // dsrl32 t8, s5, 0 + c->daddiu(t3, t3, 16); // daddiu t3, t3, 16 + c->pand(t6, t6, t1); // pand t6, t6, t1 + c->lq(t7, 0, s4); // lq t7, 0(s4) + c->psraw(ra, t6, 8); // psraw ra, t6, 8 + c->lq(t6, 0, s5); // lq t6, 0(s5) + c->pextuw(s3, t7, t5); // pextuw s3, t7, t5 + c->lq(t9, 0, t8); // lq t9, 0(t8) + c->daddiu(t4, t4, 16); // daddiu t4, t4, 16 + c->daddiu(v1, v1, 8); // daddiu v1, v1, 8 + c->pextuw(s2, t9, t6); // pextuw s2, t9, t6 + c->lw(gp, 28, gp); // lw gp, 28(gp) + c->pcpyud(s3, s3, s2); // pcpyud s3, s3, s2 + c->lw(s4, 28, s4); // lw s4, 28(s4) + c->paddh(s3, s3, t0); // paddh s3, s3, t0 + c->lw(s5, 28, s5); // lw s5, 28(s5) + c->pand(s3, s3, a1); // pand s3, s3, a1 + c->lw(t8, 28, t8); // lw t8, 28(t8) + c->por(ra, s3, ra); // por ra, s3, ra + c->sw(gp, 0, t3); // sw gp, 0(t3) + c->prot3w(t9, t9); // prot3w t9, t9 + c->sq(ra, 0, t4); // sq ra, 0(t4) + c->prot3w(t7, t7); // prot3w t7, t7 + c->sw(s4, 4, t3); // sw s4, 4(t3) + c->pextuw(gp, t7, t5); // pextuw gp, t7, t5 + c->sw(s5, 8, t3); // sw s5, 8(t3) + c->pcpyld(t7, t6, t7); // pcpyld t7, t6, t7 + c->ld(ra, 0, v1); // ld ra, 0(v1) + c->pcpyld(t5, gp, t5); // pcpyld t5, gp, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextuw(t6, t9, t6); // pextuw t6, t9, t6 + c->sw(t8, 12, t3); // sw t8, 12(t3) + bc = c->sgpr64(v1) != c->sgpr64(a0); // bne v1, a0, L54 + c->pcpyld(t8, t9, t6); // pcpyld t8, t9, t6 + if (bc) {goto block_1;} // branch non-likely + + // nop // sll r0, r0, 0 + c->sq(t5, 0, t2); // sq t5, 0(t2) + // nop // sll r0, r0, 0 + c->sq(t7, 16, t2); // sq t7, 16(t2) + // nop // sll r0, r0, 0 + c->sq(t8, 32, t2); // sq t8, 32(t2) + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(ra, 12432, at); // ld ra, 12432(at) + c->lq(gp, 12512, at); // lq gp, 12512(at) + c->lq(s5, 12496, at); // lq s5, 12496(at) + c->lq(s4, 12480, at); // lq s4, 12480(at) + c->lq(s3, 12464, at); // lq s3, 12464(at) + c->lq(s2, 12448, at); // lq s2, 12448(at) + //jr ra // jr ra + c->daddiu(sp, sp, 96); // daddiu sp, sp, 96 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("generic-no-light-proc", execute, 128); +} + +} // namespace generic_no_light_proc +} // namespace Mips2C +// add generic_no_light_proc::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_warp_dest { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* + void* warp_shader; // *warp-shader* + void* generic_no_light_proc; // generic-no-light-proc + void* generic_warp_dest_proc; // generic-warp-dest-proc +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 madr, sadr, qwc; + [[maybe_unused]] u32 call_addr = 0; + c->daddiu(sp, sp, -32); // daddiu sp, sp, -32 + c->sd(ra, 0, sp); // sd ra, 0(sp) + c->sq(gp, 16, sp); // sq gp, 16(sp) + c->daddiu(v1, s7, 4); // daddiu v1, s7, #t + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L14 + c->mov64(v0, s7); // or v0, s7, r0 + if (bc) {goto block_8;} // branch non-likely + + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + c->mov64(v1, a0); // or v1, a0, r0 + c->load_symbol2(gp, cache.warp_shader); // lw gp, *warp-shader*(s7) + c->addiu(a0, r0, 14); // addiu a0, r0, 14 + c->sh(a0, 11984, at); // sh a0, 11984(at) + c->sw(r0, 48, at); // sw r0, 48(at) + c->sw(v1, 44, at); // sw v1, 44(at) + c->sh(r0, 56, at); // sh r0, 56(at) + c->daddiu(v1, at, 12064); // daddiu v1, at, 12064 + get_fake_spad_addr2(a0, cache.fake_scratchpad_data, 0, c);// lui a0, 28672 + c->lbu(a0, 6842, a0); // lbu a0, 6842(a0) + bc = c->sgpr64(a0) == 0; // beq a0, r0, L11 + c->mov64(a0, s7); // or a0, s7, r0 + if (bc) {goto block_3;} // branch non-likely + + c->addiu(v1, r0, 6960); // addiu v1, r0, 6960 + get_fake_spad_addr2(a0, cache.fake_scratchpad_data, 0, c);// lui a0, 28672 + c->daddu(v1, v1, a0); // daddu v1, v1, a0 + c->mov64(v1, v1); // or v1, v1, r0 + c->mov64(a0, v1); // or a0, v1, r0 + + block_3: + c->sw(v1, 52, at); // sw v1, 52(at) + get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672 + c->lwu(t9, 7464, v1); // lwu t9, 7464(v1) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + // c->jalr(call_addr); // jalr ra, t9 + generic_prepare_dma_single::execute_real(c); + c->ld(v1, 0, gp); // ld v1, 0(gp) + c->ld(a0, 16, gp); // ld a0, 16(gp) + c->ld(a1, 32, gp); // ld a1, 32(gp) + c->ld(a2, 48, gp); // ld a2, 48(gp) + c->ld(a3, 64, gp); // ld a3, 64(gp) + c->ld(t0, 11936, at); // ld t0, 11936(at) + c->lw(t1, 24, at); // lw t1, 24(at) + c->sd(v1, 128, t1); // sd v1, 128(t1) + c->sd(a0, 144, t1); // sd a0, 144(t1) + c->sd(a1, 160, t1); // sd a1, 160(t1) + c->sd(a2, 176, t1); // sd a2, 176(t1) + c->sd(a3, 192, t1); // sd a3, 192(t1) + c->sd(t0, 96, t1); // sd t0, 96(t1) + c->load_symbol2(t9, cache.generic_warp_dest_proc);// lw t9, generic-warp-dest-proc(s7) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + // c->jalr(call_addr); // jalr ra, t9 + generic_warp_dest_proc::execute(c); + c->load_symbol2(t9, cache.generic_no_light_proc); // lw t9, generic-no-light-proc(s7) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + // c->jalr(call_addr); // jalr ra, t9 + generic_no_light_proc::execute(c); + c->lw(v1, 24, at); // lw v1, 24(at) + c->lw(a0, 40, at); // lw a0, 40(at) + c->mov64(a3, v1); // or a3, v1, r0 + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + c->lui(a2, 4096); // lui a2, 4096 + c->lwu(a1, 60, at); // lwu a1, 60(at) + c->ori(a2, a2, 53248); // ori a2, a2, 53248 + // c->lw(t1, 0, a2); // lw t1, 0(a2) + // nop // sll r0, r0, 0 + c->daddiu(t0, at, 92); // daddiu t0, at, 92 + c->andi(a3, a3, 16383); // andi a3, a3, 16383 + c->andi(t1, t1, 256); // andi t1, t1, 256 + // nop // sll r0, r0, 0 +// bc = c->sgpr64(t1) == 0; // beq t1, r0, L13 +// // nop // sll r0, r0, 0 +// if (bc) {goto block_7;} // branch non-likely + + c->mov64(t1, a2); // or t1, a2, r0 + // nop // sll r0, r0, 0 + +// block_5: +// c->lw(t2, 0, t0); // lw t2, 0(t0) +// // nop // sll r0, r0, 0 +// c->lw(t3, 0, t1); // lw t3, 0(t1) +// // nop // sll r0, r0, 0 +// c->andi(t3, t3, 256); // andi t3, t3, 256 +// c->daddiu(t2, t2, 1); // daddiu t2, t2, 1 +// bc = c->sgpr64(t3) != 0; // bne t3, r0, L12 +// c->sw(t2, 0, t0); // sw t2, 0(t0) +// if (bc) {goto block_5;} // branch non-likely +// +// c->gprs[t0].du64[0] = 0; // or t0, r0, r0 + + // block_7: + c->dsll(t0, a0, 4); // dsll t0, a0, 4 + // c->sw(a3, 128, a2); // sw a3, 128(a2) + sadr = c->sgpr64(a3); + // nop // sll r0, r0, 0 + // c->sw(a1, 16, a2); // sw a1, 16(a2) + madr = c->sgpr64(a1); + c->addiu(a3, r0, 256); // addiu a3, r0, 256 + // c->sw(a0, 32, a2); // sw a0, 32(a2) + qwc = c->sgpr64(a0); + c->daddu(a0, a1, t0); // daddu a0, a1, t0 + // c->sw(a3, 0, a2); // sw a3, 0(a2) + spad_from_dma_no_sadr_off(cache.fake_scratchpad_data, madr, sadr, qwc); + // nop // sll r0, r0, 0 + c->sw(a0, 60, at); // sw a0, 60(at) + c->gprs[a0].du64[0] = 0; // or a0, r0, r0 + c->xori(v0, v1, 4608); // xori v0, v1, 4608 + c->sw(v0, 24, at); // sw v0, 24(at) + + block_8: + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->lq(gp, 16, sp); // lq gp, 16(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 32); // daddiu sp, sp, 32 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + cache.warp_shader = intern_from_c(-1, 0, "*warp-shader*").c(); + cache.generic_no_light_proc = intern_from_c(-1, 0, "generic-no-light-proc").c(); + cache.generic_warp_dest_proc = intern_from_c(-1, 0, "generic-warp-dest-proc").c(); + gLinkedFunctionTable.reg("generic-warp-dest", execute, 128); +} + +} // namespace generic_warp_dest +} // namespace Mips2C +// add generic_warp_dest::link to the link callback table for the object file. +// FWD DEC: + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace generic_warp_envmap_dest { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* + void* warp_shader; // *warp-shader* + void* generic_envmap_proc; // generic-envmap-proc + void* generic_no_light_proc; // generic-no-light-proc + void* generic_warp_dest_proc; // generic-warp-dest-proc +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + [[maybe_unused]] u32 call_addr = 0; + u32 qwc = 0; + u32 madr = 0; + u32 sadr = 0; + c->daddiu(sp, sp, -32); // daddiu sp, sp, -32 + c->sd(ra, 0, sp); // sd ra, 0(sp) + c->sq(gp, 16, sp); // sq gp, 16(sp) + c->daddiu(v1, s7, 4); // daddiu v1, s7, #t + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L9 + c->mov64(v0, s7); // or v0, s7, r0 + if (bc) {goto block_11;} // branch non-likely + + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + c->mov64(v1, a0); // or v1, a0, r0 + c->load_symbol2(gp, cache.warp_shader); // lw gp, *warp-shader*(s7) + c->addiu(a0, r0, 14); // addiu a0, r0, 14 + c->sh(a0, 11984, at); // sh a0, 11984(at) + c->sw(r0, 48, at); // sw r0, 48(at) + c->sw(v1, 44, at); // sw v1, 44(at) + c->addiu(v1, r0, 1); // addiu v1, r0, 1 + c->sh(v1, 56, at); // sh v1, 56(at) + c->daddiu(v1, at, 12064); // daddiu v1, at, 12064 + get_fake_spad_addr2(a0, cache.fake_scratchpad_data, 0, c);// lui a0, 28672 + c->lbu(a0, 6842, a0); // lbu a0, 6842(a0) + bc = c->sgpr64(a0) == 0; // beq a0, r0, L4 + c->mov64(a0, s7); // or a0, s7, r0 + if (bc) {goto block_3;} // branch non-likely + + c->addiu(v1, r0, 6960); // addiu v1, r0, 6960 + get_fake_spad_addr2(a0, cache.fake_scratchpad_data, 0, c);// lui a0, 28672 + c->daddu(v1, v1, a0); // daddu v1, v1, a0 + c->mov64(v1, v1); // or v1, v1, r0 + c->mov64(a0, v1); // or a0, v1, r0 + + block_3: + c->sw(v1, 52, at); // sw v1, 52(at) + get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672 + c->lwu(t9, 7468, v1); // lwu t9, 7468(v1) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + // c->jalr(call_addr); // jalr ra, t9 + generic_prepare_dma_double::execute(c); + c->ld(v1, 0, gp); // ld v1, 0(gp) + c->ld(a0, 16, gp); // ld a0, 16(gp) + c->ld(a1, 32, gp); // ld a1, 32(gp) + c->ld(a2, 48, gp); // ld a2, 48(gp) + c->ld(t0, 64, gp); // ld t0, 64(gp) + c->ld(a3, 11936, at); // ld a3, 11936(at) + get_fake_spad_addr2(t1, cache.fake_scratchpad_data, 0, c);// lui t1, 28672 + c->lbu(t1, 6856, t1); // lbu t1, 6856(t1) + c->addiu(t2, r0, 128); // addiu t2, r0, 128 + c->sltu(t2, t2, t1); // sltu t2, t2, t1 + bc = c->sgpr64(t2) != 0; // bne t2, r0, L5 + // nop // sll r0, r0, 0 + if (bc) {goto block_5;} // branch non-likely + + c->addiu(t2, r0, 128); // addiu t2, r0, 128 + c->dsubu(t1, t2, t1); // dsubu t1, t2, t1 + c->dsll32(t1, t1, 24); // dsll32 t1, t1, 24 + c->dsrl(t1, t1, 24); // dsrl t1, t1, 24 + c->ori(t1, t1, 100); // ori t1, t1, 100 + c->mov64(t1, t1); // or t1, t1, r0 + c->mov64(t2, t1); // or t2, t1, r0 + //beq r0, r0, L6 // beq r0, r0, L6 + // nop // sll r0, r0, 0 + goto block_6; // branch always + + + block_5: + c->ld(t1, 11904, at); // ld t1, 11904(at) + c->mov64(t2, t1); // or t2, t1, r0 + + block_6: + c->lw(t2, 24, at); // lw t2, 24(at) + c->sd(v1, 128, t2); // sd v1, 128(t2) + c->sd(a0, 144, t2); // sd a0, 144(t2) + c->sd(a1, 160, t2); // sd a1, 160(t2) + c->sd(a2, 176, t2); // sd a2, 176(t2) + c->sd(t0, 192, t2); // sd t0, 192(t2) + c->addiu(v1, r0, 71); // addiu v1, r0, 71 + c->sd(a3, 96, t2); // sd a3, 96(t2) + c->addiu(a0, r0, 66); // addiu a0, r0, 66 + c->sd(t1, 112, t2); // sd t1, 112(t2) + c->sw(v1, 104, t2); // sw v1, 104(t2) + c->sw(a0, 120, t2); // sw a0, 120(t2) + c->load_symbol2(t9, cache.generic_warp_dest_proc);// lw t9, generic-warp-dest-proc(s7) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + // c->jalr(call_addr); // jalr ra, t9 + generic_warp_dest_proc::execute(c); + c->load_symbol2(t9, cache.generic_no_light_proc); // lw t9, generic-no-light-proc(s7) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + // c->jalr(call_addr); // jalr ra, t9 + generic_no_light_proc::execute(c); + c->load_symbol2(t9, cache.generic_envmap_proc); // lw t9, generic-envmap-proc(s7) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + // c->jalr(call_addr); // jalr ra, t9 + generic_envmap_proc::execute(c); + c->lw(v1, 24, at); // lw v1, 24(at) + c->lw(a0, 40, at); // lw a0, 40(at) + c->mov64(a3, v1); // or a3, v1, r0 + get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672 + c->lui(a2, 4096); // lui a2, 4096 + c->lwu(a1, 60, at); // lwu a1, 60(at) + c->ori(a2, a2, 53248); // ori a2, a2, 53248 + // c->lw(t1, 0, a2); // lw t1, 0(a2) + // nop // sll r0, r0, 0 + c->daddiu(t0, at, 92); // daddiu t0, at, 92 + c->andi(a3, a3, 16383); // andi a3, a3, 16383 + c->andi(t1, t1, 256); // andi t1, t1, 256 + // nop // sll r0, r0, 0 +// bc = c->sgpr64(t1) == 0; // beq t1, r0, L8 +// // nop // sll r0, r0, 0 +// if (bc) {goto block_10;} // branch non-likely +// +// c->mov64(t1, a2); // or t1, a2, r0 +// // nop // sll r0, r0, 0 +// +// block_8: +// c->lw(t2, 0, t0); // lw t2, 0(t0) +// // nop // sll r0, r0, 0 +// c->lw(t3, 0, t1); // lw t3, 0(t1) +// // nop // sll r0, r0, 0 +// c->andi(t3, t3, 256); // andi t3, t3, 256 +// c->daddiu(t2, t2, 1); // daddiu t2, t2, 1 +// bc = c->sgpr64(t3) != 0; // bne t3, r0, L7 +// c->sw(t2, 0, t0); // sw t2, 0(t0) +// if (bc) {goto block_8;} // branch non-likely + + // c->gprs[t0].du64[0] = 0; // or t0, r0, r0 + + // block_10: + c->dsll(t0, a0, 4); // dsll t0, a0, 4 + // c->sw(a3, 128, a2); // sw a3, 128(a2) + sadr = c->sgpr64(a3); + // nop // sll r0, r0, 0 + // c->sw(a1, 16, a2); // sw a1, 16(a2) + madr = c->sgpr64(a1); + c->addiu(a3, r0, 256); // addiu a3, r0, 256 + // c->sw(a0, 32, a2); // sw a0, 32(a2) + qwc = c->sgpr64(a0); + c->daddu(a0, a1, t0); // daddu a0, a1, t0 + // c->sw(a3, 0, a2); // sw a3, 0(a2) + spad_from_dma_no_sadr_off(cache.fake_scratchpad_data, madr, sadr, qwc); + // nop // sll r0, r0, 0 + c->sw(a0, 60, at); // sw a0, 60(at) + c->gprs[a0].du64[0] = 0; // or a0, r0, r0 + c->xori(v0, v1, 4608); // xori v0, v1, 4608 + c->sw(v0, 24, at); // sw v0, 24(at) + + block_11: + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->lq(gp, 16, sp); // lq gp, 16(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 32); // daddiu sp, sp, 32 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c(); + cache.warp_shader = intern_from_c(-1, 0, "*warp-shader*").c(); + cache.generic_envmap_proc = intern_from_c(-1, 0, "generic-envmap-proc").c(); + cache.generic_no_light_proc = intern_from_c(-1, 0, "generic-no-light-proc").c(); + cache.generic_warp_dest_proc = intern_from_c(-1, 0, "generic-warp-dest-proc").c(); + gLinkedFunctionTable.reg("generic-warp-envmap-dest", execute, 128); +} + +} // namespace generic_warp_envmap_dest +} // namespace Mips2C +// add generic_warp_envmap_dest::link to the link callback table for the object file. +// FWD DEC: diff --git a/game/mips2c/mips2c_table.cpp b/game/mips2c/mips2c_table.cpp index 1f6dd9002f..0cf9193a56 100644 --- a/game/mips2c/mips2c_table.cpp +++ b/game/mips2c/mips2c_table.cpp @@ -258,16 +258,29 @@ namespace shadow_calc_dual_verts { extern void link(); } namespace shadow_xform_verts { extern void link(); } } namespace jak3 { - namespace light_hash_get_bucket_index { extern void link(); } - namespace add_light_sphere_to_light_group { extern void link(); } - namespace light_hash_count_items { extern void link(); } - namespace light_hash_add_items { extern void link(); } - namespace debug_line_clip { extern void link(); } - namespace init_boundary_regs { extern void link(); } - namespace draw_boundary_polygon { extern void link(); } - namespace render_boundary_quad { extern void link(); } - namespace render_boundary_tri { extern void link(); } - namespace set_sky_vf27 { extern void link(); } +namespace light_hash_get_bucket_index { extern void link(); } +namespace add_light_sphere_to_light_group { extern void link(); } +namespace light_hash_count_items { extern void link(); } +namespace light_hash_add_items { extern void link(); } +namespace debug_line_clip { extern void link(); } +namespace init_boundary_regs { extern void link(); } +namespace draw_boundary_polygon { extern void link(); } +namespace render_boundary_quad { extern void link(); } +namespace render_boundary_tri { extern void link(); } +namespace set_sky_vf27 { extern void link(); } +namespace generic_light_proc { extern void link(); } +namespace generic_envmap_proc { extern void link(); } +namespace generic_prepare_dma_double { extern void link(); } +namespace generic_prepare_dma_single { extern void link(); } +namespace generic_warp_source_proc { extern void link(); } +namespace generic_warp_dest_proc { extern void link(); } +namespace generic_warp_dest { extern void link(); } +namespace generic_warp_envmap_dest { extern void link(); } +namespace generic_no_light_proc { extern void link(); } +namespace method_9_font_work { extern void link(); } +namespace draw_string_asm { extern void link(); } +namespace get_string_length { extern void link(); } + } // clang-format on @@ -443,7 +456,16 @@ PerGameVersion>> gMips2C {"debug", {jak3::debug_line_clip::link, jak3::init_boundary_regs::link, jak3::draw_boundary_polygon::link, jak3::render_boundary_quad::link, - jak3::render_boundary_tri::link, jak3::set_sky_vf27::link}}}}; + jak3::render_boundary_tri::link, jak3::set_sky_vf27::link}}, + {"generic-effect", + {jak3::generic_light_proc::link, jak3::generic_envmap_proc::link, + jak3::generic_prepare_dma_double::link, jak3::generic_prepare_dma_single::link, + jak3::generic_warp_source_proc::link, jak3::generic_warp_dest_proc::link, + jak3::generic_warp_dest::link, jak3::generic_warp_envmap_dest::link, + jak3::generic_no_light_proc::link}}, + {"font", + {jak3::method_9_font_work::link, jak3::draw_string_asm::link, + jak3::get_string_length::link}}}}; void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) { const auto& it = m_executes.insert({name, {exec, Ptr()}}); diff --git a/goal_src/jak3/engine/camera/cam-update.gc b/goal_src/jak3/engine/camera/cam-update.gc index 32c8eda102..34e06253cb 100644 --- a/goal_src/jak3/engine/camera/cam-update.gc +++ b/goal_src/jak3/engine/camera/cam-update.gc @@ -669,7 +669,7 @@ (defun-debug move-level-by-name ((arg0 symbol) (arg1 float) (arg2 float) (arg3 float)) (let ((v1-1 (level-get *level* arg0))) (when v1-1 - (logior! (-> v1-1 info level-flags) (level-flags lf10)) + (logior! (-> v1-1 info level-flags) (level-flags use-camera-other)) (let ((v0-1 (-> *math-camera* trans-other))) (set! (-> v0-1 x) (* 4096.0 arg1)) (set! (-> v0-1 y) (* 4096.0 arg2)) diff --git a/goal_src/jak3/engine/data/font-data.gc b/goal_src/jak3/engine/data/font-data.gc index 1b62a9084c..20e8f9acd8 100644 --- a/goal_src/jak3/engine/data/font-data.gc +++ b/goal_src/jak3/engine/data/font-data.gc @@ -7,3 +7,510 @@ ;; DECOMP BEGINS +(define *font12-table* (new 'static 'inline-array vector 250 + (new 'static 'vector :x 0.0039 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.1914 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.2851 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.4726 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.6601 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.7539 :y 0.0322 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.8476 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.0634 :z 1.0 :w 22.5) + (new 'static 'vector :x 0.1914 :y 0.0634 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.2851 :y 0.0634 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.3789 :y 0.0634 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.0634 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.6601 :y 0.0634 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.7539 :y 0.0634 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.8476 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.0947 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.0976 :y 0.0947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.1914 :y 0.0947 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.2851 :y 0.0947 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.3789 :y 0.0947 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.0947 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.5664 :y 0.0947 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.0947 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.7539 :y 0.0947 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.8476 :y 0.0947 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0039 :y 0.1259 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.0976 :y 0.1259 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.1914 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.2851 :y 0.1259 :z 1.0 :w 11.25) + (new 'static 'vector :x 0.3789 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.4726 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.5664 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.6601 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.7539 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.8476 :y 0.1259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0039 :y 0.1572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.1572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.1914 :y 0.1572 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.2851 :y 0.1572 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.3789 :y 0.1572 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.1572 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.5664 :y 0.1572 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.1572 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.7539 :y 0.1572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.8476 :y 0.1572 :z 1.0 :w 17.25) + (new 'static 'vector :x 0.0039 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.1884 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.1914 :y 0.1884 :z 1.0 :w 15.75) + (new 'static 'vector :x 0.2851 :y 0.1884 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.3789 :y 0.1884 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.4726 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.1884 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.6601 :y 0.1884 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.7539 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.8476 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.2197 :z 1.0 :w 15.75) + (new 'static 'vector :x 0.0976 :y 0.2197 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.1914 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.2851 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.2197 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.2197 :z 1.0 :w 15.75) + (new 'static 'vector :x 0.6601 :y 0.2197 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.7539 :y 0.2197 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.8476 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.2509 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.2509 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.1914 :y 0.2509 :z 1.0 :w 17.25) + (new 'static 'vector :x 0.2851 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.3789 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.2509 :z 1.0 :w 9.0) + (new 'static 'vector :x 0.5664 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.6601 :y 0.2509 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.7539 :y 0.2509 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.8476 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0039 :y 0.2822 :z 1.0 :w 6.0) + (new 'static 'vector :x 0.0976 :y 0.2822 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.1914 :y 0.2822 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.2851 :y 0.2822 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.3789 :y 0.2822 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.2822 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.5664 :y 0.2822 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.6601 :y 0.2822 :z 1.0 :w 17.25) + (new 'static 'vector :x 0.7539 :y 0.2822 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.8476 :y 0.2822 :z 1.0 :w 9.0) + (new 'static 'vector :x 0.0039 :y 0.3134 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0976 :y 0.3134 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.1914 :y 0.3134 :z 1.0 :w 9.75) + (new 'static 'vector :x 0.2851 :y 0.3134 :z 1.0 :w 18.5) + (new 'static 'vector :x 0.3789 :y 0.3134 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.4726 :y 0.3134 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.5664 :y 0.3134 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.6601 :y 0.3134 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.7539 :y 0.3134 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.8476 :y 0.3134 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.0039 :y 0.3447 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0976 :y 0.3447 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.1914 :y 0.3447 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.2851 :y 0.3447 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.3789 :y 0.3447 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.3447 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.5664 :y 0.3447 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.3447 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.7539 :y 0.3447 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.3447 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0039 :y 0.3759 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0976 :y 0.3759 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.1914 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.7509 :z 1.0 :w 16.0) + ) + ) + +(define *font24-table* (new 'static 'inline-array vector 250 + (new 'static 'vector :x 0.0039 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0976 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.1914 :y 0.0322 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.2851 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.5664 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.0322 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.7539 :y 0.0322 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.8476 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0039 :y 0.0634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.0634 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.1914 :y 0.0634 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.2851 :y 0.0634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.0634 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.4726 :y 0.0634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.6601 :y 0.0634 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.7539 :y 0.0634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.8476 :y 0.0634 :z 1.0 :w 17.5) + (new 'static 'vector :x 0.0039 :y 0.0947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.0947 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.1914 :y 0.0947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.0947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.0947 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.4726 :y 0.0947 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.5664 :y 0.0947 :z 1.0 :w 22.5) + (new 'static 'vector :x 0.6601 :y 0.0947 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.0947 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.8476 :y 0.0947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.1259 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.0976 :y 0.1259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.1914 :y 0.1259 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.1259 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.3789 :y 0.1259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.4726 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.5664 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.6601 :y 0.1259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.8476 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.0039 :y 0.1572 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.0976 :y 0.1572 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.1914 :y 0.1572 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.2851 :y 0.1572 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.3789 :y 0.1572 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.4726 :y 0.1572 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.5664 :y 0.1572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.1572 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.1572 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.8476 :y 0.1572 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.0039 :y 0.1884 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.0976 :y 0.1884 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.1914 :y 0.1884 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.2851 :y 0.1884 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.3789 :y 0.1884 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.4726 :y 0.1884 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.5664 :y 0.1884 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.6601 :y 0.1884 :z 1.0 :w 10.0) + (new 'static 'vector :x 0.7539 :y 0.1884 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.8476 :y 0.1884 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.2197 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.2197 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.1914 :y 0.2197 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.2851 :y 0.2197 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.3789 :y 0.2197 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.4726 :y 0.2197 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.5664 :y 0.2197 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.6601 :y 0.2197 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.7539 :y 0.2197 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.8476 :y 0.2197 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.0039 :y 0.2509 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.0976 :y 0.2509 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.1914 :y 0.2509 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.2851 :y 0.2509 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.3789 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.2509 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.2509 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.8476 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.2822 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.1914 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.2851 :y 0.2822 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.2822 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.5664 :y 0.2822 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.6601 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.7539 :y 0.2822 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.8476 :y 0.2822 :z 1.0 :w 10.0) + (new 'static 'vector :x 0.0039 :y 0.3134 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.3134 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.1914 :y 0.3134 :z 1.0 :w 10.0) + (new 'static 'vector :x 0.2851 :y 0.3134 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.3789 :y 0.3134 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.4726 :y 0.3134 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.5664 :y 0.3134 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.3134 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.7539 :y 0.3134 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.3134 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.0039 :y 0.3447 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.3447 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.1914 :y 0.3447 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.2851 :y 0.3447 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.3789 :y 0.3447 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.4726 :y 0.3447 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.5664 :y 0.3447 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.6601 :y 0.3447 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.3447 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.8476 :y 0.3447 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.5634 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.0976 :y 0.5634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.1914 :y 0.5634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.2851 :y 0.5634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.5634 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.4726 :y 0.5634 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.5664 :y 0.5634 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.6601 :y 0.5634 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.7539 :y 0.5634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.8476 :y 0.5634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.5947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.5947 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.1914 :y 0.5947 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.2851 :y 0.5947 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.3789 :y 0.5947 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.4726 :y 0.5947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.5664 :y 0.5947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.6601 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5947 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.8476 :y 0.5947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.6259 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.0976 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.1914 :y 0.6259 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.2851 :y 0.6259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.3789 :y 0.6259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.4726 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.5664 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.6601 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.8476 :y 0.6259 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.0039 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6572 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.1914 :y 0.6572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.2851 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.6572 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.6572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.7539 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.8476 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.6884 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.6884 :z 1.0 :w 13.0) + (new 'static 'vector :x 0.1914 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.2851 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6884 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.5664 :y 0.6884 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.6601 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.7539 :y 0.6884 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.8476 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.7197 :z 1.0 :w 13.0) + (new 'static 'vector :x 0.1914 :y 0.7197 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.2851 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.7197 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.4726 :y 0.7197 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.5664 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.7539 :y 0.7197 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.8476 :y 0.7197 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.0039 :y 0.7509 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.0976 :y 0.7509 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.1914 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.7509 :z 1.0 :w 13.0) + (new 'static 'vector :x 0.3789 :y 0.7509 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.4726 :y 0.7509 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.5664 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7509 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.7539 :y 0.7509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.7509 :z 1.0 :w 24.0) + ) + ) diff --git a/goal_src/jak3/engine/draw/draw-node.gc b/goal_src/jak3/engine/draw/draw-node.gc index bbe0d67d76..a68108af14 100644 --- a/goal_src/jak3/engine/draw/draw-node.gc +++ b/goal_src/jak3/engine/draw/draw-node.gc @@ -7,3 +7,40 @@ ;; DECOMP BEGINS +(defmethod collect-regions ((this draw-node) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) + "Fill the region-prim-list with regions that intersect the sphere." + (dotimes (s2-0 arg1) + (if (spheres-overlap? arg0 (the-as sphere (-> this bsphere))) + (collect-regions (-> this child) arg0 (the-as int (-> this child-count)) arg2) + ) + (&+! this 32) + ) + 0 + (none) + ) + + +(defmethod mem-usage ((this drawable-inline-array-node) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 65 (-> usage length))) + (set! (-> usage data 64 name) "draw-node") + (+! (-> usage data 64 count) (-> this length)) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 64 used) v1-6) + (+! (-> usage data 64 total) (logand -16 (+ v1-6 15))) + ) + this + ) + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this drawable-inline-array-node)) + (the-as int (+ (-> drawable-inline-array-node size) (* (+ (-> this length) -1) 32))) + ) + +(defmethod collect-regions ((this drawable-inline-array-node) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) + "Fill the region-prim-list with regions that intersect the sphere." + (collect-regions (the-as draw-node (-> this data)) arg0 (-> this length) arg2) + 0 + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. diff --git a/goal_src/jak3/engine/gfx/background/background.gc b/goal_src/jak3/engine/gfx/background/background.gc index 36fa6dbaaf..b5a826e95c 100644 --- a/goal_src/jak3/engine/gfx/background/background.gc +++ b/goal_src/jak3/engine/gfx/background/background.gc @@ -7,3 +7,466 @@ ;; DECOMP BEGINS +(define *background-work* (new 'global 'background-work)) + +(define background-vu0-block (new 'static 'vu-function :length 59 :qlength 30)) + +(defun background-upload-vu0 () + "Upload VU0 functions for background. (believed unused?)" + ;; (upload-vu0-program background-vu0-block (&-> *background-work* wait-to-vu0)) + 0 + (none) + ) + +(defun init-background () + "Reset lists of trees to draw for background rendering." + (dotimes (v1-0 8) + (set! (-> *background-work* tfrag-trees v1-0) #f) + (set! (-> *background-work* tfrag-trans-trees v1-0) #f) + (set! (-> *background-work* tfrag-water-trees v1-0) #f) + ) + (set! (-> *background-work* tfrag-tree-count) 0) + (set! (-> *background-work* tfrag-trans-tree-count) 0) + (set! (-> *background-work* tfrag-water-tree-count) 0) + (set! (-> *background-work* shrub-tree-count) 0) + (set! (-> *background-work* tie-tree-count) 0) + (set! (-> *background-work* wait-to-vu0) (the-as uint 0)) + 0 + (none) + ) + +(defun upload-vis-bits ((arg0 level) (arg1 level) (arg2 bsp-header)) + "Upload vis data to the scratchpad." + (let ((v1-2 (/ (+ (-> arg2 visible-list-length) 15) 16))) + (let ((a0-1 (-> arg0 vis-bits)) + (a1-1 (the-as (pointer uinteger) (-> arg2 all-visible-list))) + ;; (a2-2 (the-as (pointer uint128) (+ #x3800 #x70000000))) + (a2-2 (scratchpad-ptr uint128 :offset #x3800)) + ) + (b! (not *artist-flip-visible*) cfg-5 :delay (nop!)) + (nop!) + (nop!) + (label cfg-2) + (let ((a3-2 (-> (the-as (pointer uint128) a0-1)))) + (&+! a0-1 16) + (let ((t0-0 (-> (the-as (pointer uint128) a1-1) 0))) + (set! a1-1 (&-> (the-as (pointer uint8) a1-1) 16)) + (nop!) + (nop!) + (let ((a3-3 (logxor a3-2 (the-as uint t0-0)))) + (+! v1-2 -1) + (set! (-> a2-2 0) a3-3) + ) + ) + ) + (set! a2-2 (&-> a2-2 1)) + (b! (> v1-2 0) cfg-2 :delay (nop!)) + 0 + (b! #t cfg-8 :delay (nop!)) + (nop!) + (label cfg-5) + (nop!) + (nop!) + (label cfg-6) + (let ((a1-2 (-> (the-as (pointer uint128) a0-1)))) + (&+! a0-1 16) + (nop!) + (+! v1-2 -1) + (set! (-> a2-2 0) a1-2) + ) + (set! a2-2 (&-> a2-2 1)) + ) + (b! (> v1-2 0) cfg-6 :delay (nop!)) + ) + 0 + (label cfg-8) + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. +(defun set-background-regs! ((arg0 level)) + ;; not needed. + (none) + ) + +;; WARN: Return type mismatch plane vs none. +(defun set-tie-quard-planes! ((arg0 level)) + "Set up TIE work guard planes." + (cond + ((logtest? (-> arg0 info level-flags) (level-flags use-camera-other)) + (set! (-> *instance-tie-work* guard-plane 0 quad) (-> *math-camera* guard-plane-other 0 quad)) + (set! (-> *instance-tie-work* guard-plane 1 quad) (-> *math-camera* guard-plane-other 1 quad)) + (set! (-> *instance-tie-work* guard-plane 2 quad) (-> *math-camera* guard-plane-other 2 quad)) + (set! (-> *instance-tie-work* guard-plane 3 quad) (-> *math-camera* guard-plane-other 3 quad)) + ) + (else + (set! (-> *instance-tie-work* guard-plane 0 quad) (-> *math-camera* guard-plane 0 quad)) + (set! (-> *instance-tie-work* guard-plane 1 quad) (-> *math-camera* guard-plane 1 quad)) + (set! (-> *instance-tie-work* guard-plane 2 quad) (-> *math-camera* guard-plane 2 quad)) + (set! (-> *instance-tie-work* guard-plane 3 quad) (-> *math-camera* guard-plane 3 quad)) + ) + ) + (none) + ) + +;; WARN: Return type mismatch plane vs none. +(defun set-shrub-quard-planes! ((arg0 level)) + "Set shrub work guard planes." + (cond + ((logtest? (-> arg0 info level-flags) (level-flags use-camera-other)) + (set! (-> *instance-shrub-work* guard-plane 0 quad) (-> *math-camera* guard-plane-other 0 quad)) + (set! (-> *instance-shrub-work* guard-plane 1 quad) (-> *math-camera* guard-plane-other 1 quad)) + (set! (-> *instance-shrub-work* guard-plane 2 quad) (-> *math-camera* guard-plane-other 2 quad)) + (set! (-> *instance-shrub-work* guard-plane 3 quad) (-> *math-camera* guard-plane-other 3 quad)) + ) + (else + (set! (-> *instance-shrub-work* guard-plane 0 quad) (-> *math-camera* guard-plane 0 quad)) + (set! (-> *instance-shrub-work* guard-plane 1 quad) (-> *math-camera* guard-plane 1 quad)) + (set! (-> *instance-shrub-work* guard-plane 2 quad) (-> *math-camera* guard-plane 2 quad)) + (set! (-> *instance-shrub-work* guard-plane 3 quad) (-> *math-camera* guard-plane 3 quad)) + ) + ) + (none) + ) + +(defun set-subdivide-settings! ((arg0 level)) + "Set subdivide settings from the level." + (if *artist-use-menu-subdiv* + (update-subdivide-settings! *subdivide-settings* *math-camera* 11) + (update-subdivide-settings! *subdivide-settings* *math-camera* (-> arg0 index)) + ) + (none) + ) + +;; WARN: Function finish-background has a return type of none, but the expression builder found a return statement. +(defun finish-background () + "Run all renderers for background data added." + (if (get-menu-mode *blit-displays-work*) + (return #f) + ) + (when (not (paused?)) + (flush-cache 0) + (dotimes (gp-0 (-> *level* length)) + (let ((v1-8 (-> *level* level gp-0))) + (when (= (-> v1-8 status) 'active) + (-> v1-8 bsp wind-array) + (if (nonzero? (-> v1-8 bsp wind-array-length)) + (level-update-wind *wind-work*) + ) + ) + ) + ) + ) + (background-upload-vu0) + (dotimes (v1-14 (-> *level* length)) + (let ((a0-12 (-> *level* level v1-14))) + (when (= (-> a0-12 status) 'active) + (let ((a0-13 (-> a0-12 bsp))) + (when (nonzero? (-> a0-13 tfrag-masks)) + (dotimes (a1-7 (-> a0-13 tfrag-masks length)) + (set! (-> a0-13 tfrag-closest a1-7) 4095996000.0) + ) + ) + (when (nonzero? (-> a0-13 shrub-masks)) + (dotimes (a1-12 (-> a0-13 shrub-masks length)) + (set! (-> a0-13 shrub-closest a1-12) 4095996000.0) + ) + ) + (when (nonzero? (-> a0-13 alpha-masks)) + (dotimes (a1-17 (-> a0-13 alpha-masks length)) + (set! (-> a0-13 alpha-closest a1-17) 4095996000.0) + ) + ) + (when (nonzero? (-> a0-13 water-masks)) + (dotimes (a1-22 (-> a0-13 water-masks length)) + (set! (-> a0-13 water-closest a1-22) 4095996000.0) + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> *background-work* shrub-tree-count)) + (with-profiler 'shrubbery *profile-shrubbery-color* + (dotimes (gp-2 (-> *background-work* shrub-tree-count)) + (set! *draw-index* (-> *background-work* shrub-levels gp-2 draw-index)) + (flush-cache 0) + (let ((s5-1 (-> *background-work* shrub-trees gp-2)) + (s4-1 (-> *background-work* shrub-levels gp-2)) + ) + (if (nonzero? (-> s5-1 colors-added)) + (time-of-day-interp-colors + (-> *instance-shrub-work* colors) + (the-as uint (-> s5-1 colors-added)) + (-> s4-1 mood-context) + ) + ) + (set-background-regs! s4-1) + (set-shrub-quard-planes! s4-1) + (draw-drawable-tree-instance-shrub s5-1 s4-1) + ) + ) + ) + ) + (let ((gp-4 (the-as level #f))) + (when (or (nonzero? (-> *background-work* tfrag-tree-count)) + (nonzero? (-> *background-work* tfrag-trans-tree-count)) + (nonzero? (-> *background-work* tfrag-water-tree-count)) + ) + (let ((s5-5 (max + (max (-> *background-work* tfrag-tree-count) (-> *background-work* tfrag-trans-tree-count)) + (-> *background-work* tfrag-water-tree-count) + ) + ) + (s4-3 (the-as time-of-day-palette #f)) + ) + (with-profiler 'tfrag *profile-tfrag-color* + (dotimes (s3-2 s5-5) + (let ((s2-1 (-> *background-work* tfrag-trees s3-2))) + (when s2-1 + (let ((s1-1 (-> *background-work* tfrag-levels s3-2))) + (let ((a2-23 (-> s1-1 bsp)) + (s0-1 (-> s2-1 time-of-day-pal)) + ) + (upload-vis-bits s1-1 gp-4 a2-23) + (set-subdivide-settings! s1-1) + (when (not (or (zero? s0-1) (= s4-3 s0-1))) + (flush-cache 0) + (time-of-day-interp-colors-scratch (the-as (pointer rgba) (+ 6144 #x70000000)) s0-1 (-> s1-1 mood-context)) + (set! s4-3 s0-1) + ) + ) + (set! *draw-index* (-> s1-1 draw-index)) + (set! (-> *tfrag-work* min-dist z) 4095996000.0) + (set-background-regs! s1-1) + ) + (draw-drawable-tree-tfrag s2-1) + (set! (-> *level* draw-level *draw-index* closest-object 0) (-> *tfrag-work* min-dist z)) + ) + ) + (let ((s2-2 (-> *background-work* tfrag-trans-trees s3-2))) + (when s2-2 + (let ((s1-2 (-> *background-work* tfrag-trans-levels s3-2))) + (let ((a2-25 (-> s1-2 bsp)) + (s0-2 (-> s2-2 time-of-day-pal)) + ) + (upload-vis-bits s1-2 gp-4 a2-25) + (set-subdivide-settings! s1-2) + (when (not (or (zero? s0-2) (= s4-3 s0-2))) + (flush-cache 0) + (time-of-day-interp-colors-scratch (the-as (pointer rgba) (+ 6144 #x70000000)) s0-2 (-> s1-2 mood-context)) + (set! s4-3 s0-2) + ) + ) + (set! *draw-index* (-> s1-2 draw-index)) + (set! (-> *tfrag-work* min-dist z) 4095996000.0) + (set-background-regs! s1-2) + ) + (draw-drawable-tree-tfrag-trans s2-2) + (set! (-> *level* draw-level *draw-index* closest-object 3) (-> *tfrag-work* min-dist z)) + ) + ) + (let ((s2-3 (-> *background-work* tfrag-water-trees s3-2))) + (when s2-3 + (let ((s1-3 (-> *background-work* tfrag-water-levels s3-2))) + (let ((a2-27 (-> s1-3 bsp)) + (s0-3 (-> s2-3 time-of-day-pal)) + ) + (upload-vis-bits s1-3 gp-4 a2-27) + (set-subdivide-settings! s1-3) + (when (not (or (zero? s0-3) (= s4-3 s0-3))) + (flush-cache 0) + (time-of-day-interp-colors-scratch (the-as (pointer rgba) (+ 6144 #x70000000)) s0-3 (-> s1-3 mood-context)) + (set! s4-3 s0-3) + ) + ) + (set! *draw-index* (-> s1-3 draw-index)) + (set! (-> *tfrag-work* min-dist z) 4095996000.0) + (set-background-regs! s1-3) + ) + (draw-drawable-tree-tfrag-water s2-3) + (set! (-> *level* draw-level *draw-index* closest-object 4) (-> *tfrag-work* min-dist z)) + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> *background-work* tie-tree-count)) + (set! (-> *instance-tie-work* tod-env-color quad) (-> *time-of-day-context* current-env-color quad)) + (with-profiler 'tie *profile-tie-color* + (dotimes (s5-8 (-> *background-work* tie-tree-count)) + (let ((s4-6 (-> *background-work* tie-levels s5-8))) + (let ((a2-29 (-> s4-6 bsp))) + (when (!= s4-6 gp-4) + (set! (-> *instance-tie-work* min-dist x) 4095996000.0) + (upload-vis-bits s4-6 gp-4 a2-29) + (set-subdivide-settings! s4-6) + (set! gp-4 s4-6) + ) + ) + (set! *draw-index* (-> s4-6 draw-index)) + (set! (-> *prototype-tie-work* mood) (-> s4-6 mood-context)) + (set-background-regs! s4-6) + (set-tie-quard-planes! s4-6) + (tie-scissor-make-perspective-matrix + (-> *instance-tie-work* tie-scissor-perspective-matrix) + (if (logtest? (-> s4-6 info level-flags) (level-flags use-camera-other)) + (-> *math-camera* camera-temp-other) + (-> *math-camera* camera-temp) + ) + ) + (draw-drawable-tree-instance-tie (-> *background-work* tie-trees s5-8) s4-6) + ) + (set! (-> *background-work* tie-generic s5-8) (the-as basic (-> *prototype-tie-work* generic-next))) + (set! (-> *background-work* tie-generic-trans s5-8) + (the-as basic (-> *prototype-tie-work* generic-trans-next)) + ) + ) + ) + ) + ) + (let ((a0-116 (-> *display* frames (-> *display* on-screen) global-buf))) + (when (< (-> a0-116 real-buffer-end) (the-as int (-> a0-116 base))) + (break!) + 0 + ) + ) + (dotimes (gp-6 (-> *level* draw-level-count)) + (let ((s5-10 (-> *level* draw-level gp-6))) + (when (and s5-10 (= (-> s5-10 status) 'active)) + (when (and (nonzero? (-> s5-10 bsp hfrag-drawable)) (= (-> s5-10 display?) 'display)) + (with-profiler 'hfrag *profile-hfrag-color* + (set! *draw-index* (-> s5-10 draw-index)) + (let ((s4-9 (-> *display* frames (-> *display* on-screen) global-buf base))) + (draw (-> s5-10 bsp hfrag-drawable)) + (let ((v1-293 *dma-mem-usage*)) + (when (nonzero? v1-293) + (set! (-> v1-293 length) (max 44 (-> v1-293 length))) + (set! (-> v1-293 data 43 name) "hfragment") + (+! (-> v1-293 data 43 count) 1) + (+! (-> v1-293 data 43 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-9)) + ) + (set! (-> v1-293 data 43 total) (-> v1-293 data 43 used)) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((a0-139 (-> *display* frames (-> *display* on-screen) global-buf))) + (when (< (-> a0-139 real-buffer-end) (the-as int (-> a0-139 base))) + (break!) + 0 + ) + ) + (dotimes (v1-323 (-> *level* length)) + (let ((a1-55 (-> *level* level v1-323))) + (when (= (-> a1-55 status) 'active) + (let ((a0-145 (-> a1-55 bsp))) + (when (nonzero? (-> a0-145 tfrag-masks)) + (let ((a2-43 (-> a1-55 texture-mask))) + (dotimes (a3-5 (-> a0-145 tfrag-masks length)) + (let ((f0-12 (* (-> a0-145 tfrag-closest a3-5) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-12 4095996000.0) + (let ((t0-8 (-> a0-145 tfrag-masks data a3-5))) + (dotimes (t1-2 3) + (when (or (= t1-2 2) (>= f0-12 (-> t0-8 data t1-2 dist))) + (dotimes (t2-5 3) + (logior! + (-> (&-> a2-43 0 mask data t2-5) 0) + (-> (the-as (pointer int32) (+ (* t2-5 4) (the-as int t0-8) (* t1-2 16))) 0) + ) + ) + (goto cfg-176) + ) + ) + ) + ) + ) + (label cfg-176) + ) + ) + ) + (when (nonzero? (-> a0-145 shrub-masks)) + (let ((a2-48 (-> a1-55 texture-mask 2))) + (dotimes (a3-6 (-> a0-145 shrub-masks length)) + (let ((f0-14 (* (-> a0-145 shrub-closest a3-6) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-14 4095996000.0) + (let ((t0-24 (-> a0-145 shrub-masks data a3-6))) + (dotimes (t1-5 3) + (when (or (= t1-5 2) (>= f0-14 (-> t0-24 data t1-5 dist))) + (dotimes (t2-11 3) + (logior! + (-> a2-48 mask data t2-11) + (-> (the-as (pointer int32) (+ (* t2-11 4) (the-as int t0-24) (* t1-5 16))) 0) + ) + ) + (goto cfg-196) + ) + ) + ) + ) + ) + (label cfg-196) + ) + ) + ) + (when (nonzero? (-> a0-145 alpha-masks)) + (let ((a2-53 (-> a1-55 texture-mask 3))) + (dotimes (a3-7 (-> a0-145 alpha-masks length)) + (let ((f0-16 (* (-> a0-145 alpha-closest a3-7) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-16 4095996000.0) + (let ((t0-40 (-> a0-145 alpha-masks data a3-7))) + (dotimes (t1-8 3) + (when (or (= t1-8 2) (>= f0-16 (-> t0-40 data t1-8 dist))) + (dotimes (t2-17 3) + (logior! + (-> a2-53 mask data t2-17) + (-> (the-as (pointer int32) (+ (* t2-17 4) (the-as int t0-40) (* t1-8 16))) 0) + ) + ) + (goto cfg-216) + ) + ) + ) + ) + ) + (label cfg-216) + ) + ) + ) + (when (nonzero? (-> a0-145 water-masks)) + (let ((a1-56 (-> a1-55 texture-mask 4))) + (dotimes (a2-58 (-> a0-145 water-masks length)) + (let ((f0-18 (* (-> a0-145 water-closest a2-58) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-18 4095996000.0) + (let ((a3-16 (-> a0-145 water-masks data a2-58))) + (dotimes (t0-50 3) + (when (or (= t0-50 2) (>= f0-18 (-> a3-16 data t0-50 dist))) + (dotimes (t1-14 3) + (logior! + (-> a1-56 mask data t1-14) + (-> (the-as (pointer int32) (+ (* t1-14 4) (the-as int a3-16) (* t0-50 16))) 0) + ) + ) + (goto cfg-236) + ) + ) + ) + ) + ) + (label cfg-236) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/gfx/background/prototype-h.gc b/goal_src/jak3/engine/gfx/background/prototype-h.gc index 3d3e995018..2ac7337c2c 100644 --- a/goal_src/jak3/engine/gfx/background/prototype-h.gc +++ b/goal_src/jak3/engine/gfx/background/prototype-h.gc @@ -57,11 +57,12 @@ (deftype prototype-bucket-shrub (prototype-bucket) ((next uint32 4) (count uint16 4) - (mod-count uint16 4) + (count-quad uint128 :overlay-at (-> count 0)) + (mod-count uint16 4 :offset 88) (last dma-packet 4) - (next-clear uint128 :overlay-at (-> next 0)) - (count-clear uint64 :overlay-at (-> count 0)) - (last-clear uint128 :overlay-at (-> last 0)) + (next-clear uint128 :overlay-at (-> next 0)) + (count-clear uint64 :overlay-at (-> count 0)) + (last-clear uint128 :overlay-at (-> last 0)) ) ) diff --git a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc index 62953903a6..3fa932636d 100644 --- a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc +++ b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc @@ -6,7 +6,11 @@ ;; dgos: GAME (declare-type tfrag-work structure) +(declare-type drawable-tree-tfrag structure) (define-extern *tfrag-work* tfrag-work) +(define-extern draw-drawable-tree-tfrag (function drawable-tree-tfrag none)) +(define-extern draw-drawable-tree-tfrag-trans (function drawable-tree-tfrag none)) +(define-extern draw-drawable-tree-tfrag-water (function drawable-tree-tfrag none)) ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/gfx/background/tie/tie-h.gc b/goal_src/jak3/engine/gfx/background/tie/tie-h.gc index 5553750d85..a1cd058a1e 100644 --- a/goal_src/jak3/engine/gfx/background/tie/tie-h.gc +++ b/goal_src/jak3/engine/gfx/background/tie/tie-h.gc @@ -6,7 +6,12 @@ ;; dgos: GAME (declare-type prototype-tie-work structure) +(declare-type instance-tie-work structure) +(declare-type drawable-tree-instance-tie structure) (define-extern *prototype-tie-work* prototype-tie-work) +(define-extern *instance-tie-work* instance-tie-work) +(define-extern tie-scissor-make-perspective-matrix (function matrix matrix none)) +(define-extern draw-drawable-tree-instance-tie (function drawable-tree-instance-tie level none)) ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/gfx/background/wind-h.gc b/goal_src/jak3/engine/gfx/background/wind-h.gc index c1b5187e1f..fa9be41384 100644 --- a/goal_src/jak3/engine/gfx/background/wind-h.gc +++ b/goal_src/jak3/engine/gfx/background/wind-h.gc @@ -5,6 +5,10 @@ ;; name in dgo: wind-h ;; dgos: GAME +(declare-type wind-work structure) + +(define-extern level-update-wind (function wind-work none)) + ;; DECOMP BEGINS (deftype wind-vector (structure) diff --git a/goal_src/jak3/engine/gfx/font-h.gc b/goal_src/jak3/engine/gfx/font-h.gc index 4c448ea76b..de9cdcc9a6 100644 --- a/goal_src/jak3/engine/gfx/font-h.gc +++ b/goal_src/jak3/engine/gfx/font-h.gc @@ -78,7 +78,9 @@ (b float :offset 32)) ) +(declare-type font-context structure) (define-extern draw-string-xy (function string dma-buffer int int font-color font-flags draw-string-result)) +(define-extern draw-string (function string dma-buffer font-context draw-string-result)) ;; DECOMP BEGINS @@ -105,18 +107,19 @@ ) (deftype font-context (basic) - ((origin vector :inline) - (strip-gif vector :inline) - (width float) - (height float) - (projection float) - (scale float) - (color font-color) - (flags font-flags) - (mat matrix) - (start-line uint32) - (alpha float) - (max-x float) + ((origin vector :inline) + (strip-gif vector :inline) + (width float) + (height float) + (projection float) + (scale float) + (color font-color) + (color-signed int32 :overlay-at color) + (flags font-flags) + (mat matrix) + (start-line uint32) + (alpha float) + (max-x float) ) (:methods (new (symbol type matrix int int float font-color font-flags) _type_) @@ -301,7 +304,7 @@ (reg-save uint32 5) ) (:methods - (set-context! (_type_ object) none) + (set-context! (_type_ font-context) none) ) ) @@ -728,6 +731,3 @@ (set! (-> *font-work* color-table arg0 color 3) arg4) 0 ) - - -(define-extern draw-string (function string dma-buffer font-context draw-string-result)) diff --git a/goal_src/jak3/engine/gfx/font.gc b/goal_src/jak3/engine/gfx/font.gc index 50a8996857..46c0310378 100644 --- a/goal_src/jak3/engine/gfx/font.gc +++ b/goal_src/jak3/engine/gfx/font.gc @@ -5,5 +5,57 @@ ;; name in dgo: font ;; dgos: GAME +(deftype draw-string-result (uint64) + ((length float :offset 0) + (b float :offset 32)) + ) + ;; DECOMP BEGINS +(defmethod-mips2c "(method 9 font-work)" 9 font-work) + +(def-mips2c draw-string-asm (function string dma-buffer font-context draw-string-result)) + +;; WARN: Return type mismatch uint vs draw-string-result. +;; ERROR: Failed load: (set! a2-4 (l.wu (+ a2-3 2224))) at op 19 +(defun draw-string ((arg0 string) (arg1 dma-buffer) (arg2 font-context)) + (local-vars (v0-2 uint)) + (let ((v1-1 (the int (* 128.0 (-> arg2 alpha))))) + (-> arg2 origin quad) + (dotimes (a0-2 45) + (dotimes (a1-1 4) + (set! (-> *font-work* color-table a0-2 color a1-1 a) v1-1) + ) + ) + (set! (-> *font-work* color-shadow w) v1-1) + ) + (if (< (the-as uint (dma-buffer-free arg1)) (the-as uint (* (length arg0) 32))) + (set! v0-2 (the-as uint (-> arg2 origin quad))) + (set! v0-2 (the-as uint (draw-string-asm arg0 arg1 arg2))) + ) + (dotimes (v1-7 45) + (dotimes (a0-9 4) + (set! (-> *font-work* color-table v1-7 color a0-9 a) #x80) + ) + ) + (set! (-> *font-work* color-shadow w) 128) + (the-as draw-string-result v0-2) + ) + +(def-mips2c get-string-length (function string font-context draw-string-result)) + +(defun draw-string-xy ((arg0 string) (arg1 dma-buffer) (arg2 int) (arg3 int) (arg4 font-color) (arg5 font-flags)) + (let ((s4-0 (new 'stack 'font-context *font-default-matrix* arg2 arg3 0.0 arg4 arg5))) + (set-context! *font-work* s4-0) + (draw-string arg0 arg1 s4-0) + ) + ) + +;; WARN: Return type mismatch float vs none. +(defun draw-string-adv ((arg0 string) (arg1 dma-buffer) (arg2 font-context)) + (set-context! *font-work* arg2) + (let ((v1-2 (draw-string arg0 arg1 arg2))) + (+! (-> arg2 origin x) (-> v1-2 length)) + ) + (none) + ) diff --git a/goal_src/jak3/engine/gfx/generic/generic-effect.gc b/goal_src/jak3/engine/gfx/generic/generic-effect.gc index 8be16423e3..f4292acb65 100644 --- a/goal_src/jak3/engine/gfx/generic/generic-effect.gc +++ b/goal_src/jak3/engine/gfx/generic/generic-effect.gc @@ -5,5 +5,256 @@ ;; name in dgo: generic-effect ;; dgos: GAME +(define-extern *default-envmap-shader* adgif-shader) + ;; DECOMP BEGINS +(define *target-lock* (the-as object 0)) + +(define *generic-consts* + (new 'static 'generic-consts + :dma-header (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :vif-header (new 'static 'array uint32 4 #x1000404 #x1000404 #x1000404 #x6c000000) + :dma-ref-vtxs (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :dma-cnt-call (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id cnt))) + :matrix (new 'static 'matrix + :rvec (new 'static 'vector :x 1.0) + :uvec (new 'static 'vector :y 1.0) + :fvec (new 'static 'vector :z 1.0) + :trans (new 'static 'vector :w 1.0) + ) + :base-strgif (new 'static 'generic-gif-tag + :fan-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :str-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + :alpha-opaque (new 'static 'gs-adcmd :cmds (gs-reg64 alpha-1)) + :alpha-translucent (new 'static 'gs-adcmd :cmds (gs-reg64 alpha-1) :x #x44) + :ztest-normal (new 'static 'gs-adcmd :cmds (gs-reg64 test-1) :x #x5026b) + :ztest-opaque (new 'static 'gs-adcmd :cmds (gs-reg64 test-1) :x #x5000a) + :adcmd-offsets (new 'static 'array uint8 16 #x0 #x20 #x20 #x20 #x0 #x30 #x30 #x30 #x0 #x30 #x30 #x30 #x0 #x30 #x30 #x30) + :stcycle-tag #x1000103 + :unpack-vtx-tag #x68000000 + :unpack-clr-tag #x6e004000 + :unpack-tex-tag #x65000000 + :mscal-tag #x14000006 + :reset-cycle-tag #x1000404 + :dma-tag-cnt #x10000000 + :envmap (new 'static 'generic-envmap-consts + :consts (new 'static 'vector :x 1.0 :z 0.5 :w 0.5) + :strgif (new 'static 'generic-gif-tag + :fan-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1) + :nreg #x3 + ) + :str-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1) + :nreg #x3 + ) + :regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + :colors (new 'static 'vector4w :x -2139062144 :y -2139062144 :z -2139062144 :w -2139062144) + ) + :light-consts (new 'static 'vector :x 255.0 :y 8388608.0) + ) + ) + +(defun generic-work-init ((arg0 generic-bucket-state)) + "Initialize the scratchpad work for generic." + (quad-copy! + (the-as pointer (-> (scratchpad-object generic-work) fx-buf work)) + (the-as pointer *generic-consts*) + 27 + ) + (set! (-> (scratchpad-object generic-work) saves gifbuf-adr) (-> arg0 gifbuf-adr)) + (set! (-> (scratchpad-object generic-work) saves inbuf-adr) (-> arg0 inbuf-adr)) + (set! (-> (scratchpad-object generic-work) saves cur-outbuf) + (the-as uint (-> (scratchpad-object generic-work) fx-buf)) + ) + (let* ((v1-6 *default-envmap-shader*) + (a0-9 (-> (scratchpad-object generic-work) fx-buf work consts envmap shader)) + (a1-2 (-> v1-6 quad 0 quad)) + (a2-1 (-> v1-6 quad 1 quad)) + (a3-0 (-> v1-6 quad 2 quad)) + (t0-0 (-> v1-6 quad 3 quad)) + (v0-1 (-> v1-6 quad 4 quad)) + ) + (set! (-> a0-9 quad 0 quad) a1-2) + (set! (-> a0-9 quad 1 quad) a2-1) + (set! (-> a0-9 quad 2 quad) a3-0) + (set! (-> a0-9 quad 3 quad) t0-0) + (set! (-> a0-9 quad 4 quad) v0-1) + ) + (none) + ) + +(defun generic-upload-vu0 () + "Upload generic VU0 program." + (none) + ) + +(defun upload-vu0-program ((a0-0 vu-function) (a1-0 pointer)) + "Upload vu-function to VU0." + (none) + ) + +(defun generic-initialize-without-sync ((arg0 matrix) (arg1 vu-lights)) + "Init generic, version for generic-merc, which relies on generic-merc init running after." + ;; (upload-vu0-program generic-vu0-block (the-as pointer #x70000054)) + (let ((a2-0 (-> (scratchpad-object generic-work) fx-buf work consts matrix)) + (v1-1 (-> arg0 rvec quad)) + (a0-3 (-> arg0 uvec quad)) + (a1-2 (-> arg0 fvec quad)) + (a3-0 (-> arg0 trans quad)) + ) + (set! (-> a2-0 rvec quad) v1-1) + (set! (-> a2-0 uvec quad) a0-3) + (set! (-> a2-0 fvec quad) a1-2) + (set! (-> a2-0 trans quad) a3-0) + ) + (if arg1 + (quad-copy! (the-as pointer (-> (scratchpad-object generic-work) fx-buf work lights)) (the-as pointer arg1) 7) + ) + 0 + (none) + ) + +;; definition for function generic-initialize +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun generic-initialize ((arg0 generic-bucket-state) (arg1 matrix) (arg2 vu-lights)) + "Normal init for generic - sets up scratchpad and VU0." + (generic-work-init arg0) + (generic-upload-vu0) + (let ((a2-1 (-> (scratchpad-object generic-work) fx-buf work consts matrix)) + (v1-1 (-> arg1 rvec quad)) + (a0-2 (-> arg1 uvec quad)) + (a1-1 (-> arg1 fvec quad)) + (a3-0 (-> arg1 trans quad)) + ) + (set! (-> a2-1 rvec quad) v1-1) + (set! (-> a2-1 uvec quad) a0-2) + (set! (-> a2-1 fvec quad) a1-1) + (set! (-> a2-1 trans quad) a3-0) + ) + (if arg2 + (quad-copy! (the-as pointer (-> (the-as generic-work #x70000000) fx-buf work lights)) (the-as pointer arg2) 7) + ) + 0 + (none) + ) + +;; definition for function generic-wrapup +;; WARN: Return type mismatch uint vs none. +(defun generic-wrapup ((arg0 generic-bucket-state)) + (set! (-> arg0 gifbuf-adr) (-> (scratchpad-object generic-work) saves gifbuf-adr)) + (set! (-> arg0 inbuf-adr) (-> (scratchpad-object generic-work) saves inbuf-adr)) + (none) + ) + +;; definition for function generic-dma-from-spr +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-light-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-light-proc function) + +;; definition for function generic-envmap-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-envmap-proc function) + +;; definition for function generic-prepare-dma-double +;; INFO: function output is handled by mips2c +(def-mips2c generic-prepare-dma-double function) + +;; definition for function generic-prepare-dma-single +;; INFO: function output is handled by mips2c +(def-mips2c generic-prepare-dma-single function) + +;; definition for function generic-envmap-dproc +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-interp-dproc +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-no-light-proc +;; INFO: function output is handled by mips2c +;; (def-mips2c generic-no-light-proc function) don't need + +;; definition for function generic-no-light-dproc-only +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-no-light-dproc +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-no-light+envmap +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-no-light +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-envmap-only-proc +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-light +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-copy-vtx-dclr-dtex +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-none +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-none-dma-wait +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for symbol *warp-data*, type object +(define *warp-data* (the-as object (malloc 'global 1024))) + +;; definition for function generic-warp-source-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-source-proc (function none)) + +;; definition for function generic-warp-source +;; ERROR: Unsupported inline assembly instruction kind - [lui at, 28672] +(defun generic-warp-source ((arg0 gsf-buffer)) + (set! (-> (scratchpad-object generic-work) saves gsf-buf) arg0) + (generic-warp-source-proc) + (none) + ) + +;; definition for function generic-warp-dest-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-dest-proc function) + +;; definition for function generic-warp-dest +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-dest function) + +;; definition for function generic-warp-envmap-dest +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-envmap-dest function) + +;; definition for function generic-debug-light-proc +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition (debug) for function generic-post-debug +;; ERROR: function has no type analysis. Cannot decompile. + + + + diff --git a/goal_src/jak3/engine/gfx/generic/generic-vu1.gc b/goal_src/jak3/engine/gfx/generic/generic-vu1.gc index 2de717185e..4a2cc0d0a1 100644 --- a/goal_src/jak3/engine/gfx/generic/generic-vu1.gc +++ b/goal_src/jak3/engine/gfx/generic/generic-vu1.gc @@ -46,10 +46,16 @@ ) (defun generic-setup-shrub-constants ((arg0 generic-shrub-constants) (arg1 int) (arg2 int) (arg3 int)) - (set! (-> arg0 shrub-giftag qword vector4w x) (logior #x30004000 (shr (shl arg3 53) 38))) - (set! (-> arg0 shrub-giftag qword vector4w y) (logior #x30004000 (shr (shl arg2 53) 38))) - (set! (-> arg0 shrub-giftag qword vector4w z) 1042) - (set! (-> arg0 shrub-giftag qword vector4w w) 0) + (set! (-> arg0 shrub-giftag fan-prim) + (new 'static 'gif-tag-prim :pre #x1 :nreg #x3 :prim (the-as gs-prim arg3)) + ) + (set! (-> arg0 shrub-giftag str-prim) + (new 'static 'gif-tag-prim :pre #x1 :nreg #x3 :prim (the-as gs-prim arg2)) + ) + (set! (-> arg0 shrub-giftag regs) + (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> arg0 shrub-giftag num-strips) (the-as uint 0)) (set! (-> arg0 shrub-adnop dword 0) (the-as uint arg1)) (set! (-> arg0 shrub-adnop dword 1) (the-as uint 71)) (none) diff --git a/goal_src/jak3/engine/gfx/hw/display-h.gc b/goal_src/jak3/engine/gfx/hw/display-h.gc index c346eaca39..0a612337cd 100644 --- a/goal_src/jak3/engine/gfx/hw/display-h.gc +++ b/goal_src/jak3/engine/gfx/hw/display-h.gc @@ -16,15 +16,15 @@ At any point in time, there are 3 frames in progress: this frame also needs a DMA buffer, which is being filled up. |# -(defconstant DEFAULT_ALL_RENDERERS - (vu1-renderer-mask - sky ocean ocean-wave tfrag tie tie-envmap tie-scissor tie-envmap-scissor - tie-vanish generic merc emerc shrubbery shrub-near billboard shrubbery-vanish - tfrag-trans tie-scissor-trans tie-trans tie-envmap-trans tie-envmap-scissor-trans - tfrag-water tie-scissor-water tie-water tie-envmap-water tie-envmap-scissor-water - sprite shadow rn31 rn32 rn33 depth-cue rn36 - ) - ) +; (defconstant DEFAULT_ALL_RENDERERS +; (vu1-renderer-mask +; sky ocean ocean-wave tfrag tie tie-envmap tie-scissor tie-envmap-scissor +; tie-vanish generic merc emerc shrubbery shrub-near billboard shrubbery-vanish +; tfrag-trans tie-scissor-trans tie-trans tie-envmap-trans tie-envmap-scissor-trans +; tfrag-water tie-scissor-water tie-water tie-envmap-water tie-envmap-scissor-water +; sprite shadow rn31 rn32 rn33 depth-cue rn36 +; ) +; ) ;; DECOMP BEGINS @@ -113,8 +113,78 @@ At any point in time, there are 3 frames in progress: (set! (-> gp-0 frames 1) (new 'global 'display-frame)) (set! (-> gp-0 pmode) (the-as uint 165)) (set! (-> gp-0 run-half-speed) #f) - (set! (-> gp-0 vu1-enable-user-menu) DEFAULT_ALL_RENDERERS) - (set! (-> gp-0 vu1-enable-user) DEFAULT_ALL_RENDERERS) + (set! (-> gp-0 vu1-enable-user-menu) (vu1-renderer-mask + rn3 + rn4 + rn5 + rn6 + rn7 + rn8 + rn9 + rn10 + rn11 + rn12 + rn13 + generic + merc + emerc + shrubbery + shrub-near + billboard + shrub-vanish + rn21 + rn22 + rn23 + rn24 + rn25 + rn26 + rn27 + rn28 + rn29 + rn30 + rn31 + rn32 + rn33 + rn34 + rn36 + ) + ) + (set! (-> gp-0 vu1-enable-user) (vu1-renderer-mask + rn3 + rn4 + rn5 + rn6 + rn7 + rn8 + rn9 + rn10 + rn11 + rn12 + rn13 + generic + merc + emerc + shrubbery + shrub-near + billboard + shrub-vanish + rn21 + rn22 + rn23 + rn24 + rn25 + rn26 + rn27 + rn28 + rn29 + rn30 + rn31 + rn32 + rn33 + rn34 + rn36 + ) + ) gp-0 ) ) diff --git a/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc b/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc index d0b8b2e45e..e7e087ee5c 100644 --- a/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc +++ b/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc @@ -25,6 +25,9 @@ ;; ---time-of-day-palette-id (declare-type sparticle-launch-control inline-array-class) +(declare-type time-of-day-palette structure) +(define-extern time-of-day-interp-colors (function (pointer rgba) uint mood-context none)) +(define-extern time-of-day-interp-colors-scratch (function (pointer rgba) time-of-day-palette mood-context none)) ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/gfx/shrub/shrub-work.gc b/goal_src/jak3/engine/gfx/shrub/shrub-work.gc index 0949c41213..7df7c8a5e2 100644 --- a/goal_src/jak3/engine/gfx/shrub/shrub-work.gc +++ b/goal_src/jak3/engine/gfx/shrub/shrub-work.gc @@ -9,3 +9,313 @@ ;; DECOMP BEGINS +(define *instance-shrub-work* + (new 'static 'instance-shrub-work + :matrix-tmpl (new 'static 'inline-array qword 20 + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050143)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050148)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05014d)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050152)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050157)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05015c)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050161)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050166)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05016b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050170)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050176)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05017b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050180)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050185)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018a)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018f)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050194)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050199)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05019e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c0501a3)) + ) + :count-tmpl (new 'static 'inline-array vector4w 20 + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 9) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 9) + ) + :mscalf-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :mscalf-ret-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ret)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :billboard-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xd :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #xd :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x303e400000008004 #x412) + ) + :shrub-near-packets (new 'static 'inline-array shrub-near-packet 6 + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + ) + :dma-ref (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :dma-end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0) + :constants (new 'static 'vector :x 128.0 :y 1.0) + :color-constant (new 'static 'vector4w :x #x47000000 :y #x47000000 :z #x47000000) + :start-bank (new 'static 'array uint8 20 #x0 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0) + ) + ) + +(set! (-> *instance-shrub-work* mscalf-tmpl vif0 imm) 103) + +(set! (-> *instance-shrub-work* mscalf-ret-tmpl vif0 imm) 103) diff --git a/goal_src/jak3/engine/gfx/shrub/shrubbery-h.gc b/goal_src/jak3/engine/gfx/shrub/shrubbery-h.gc index 1e28f9dddf..ceda23eef7 100644 --- a/goal_src/jak3/engine/gfx/shrub/shrubbery-h.gc +++ b/goal_src/jak3/engine/gfx/shrub/shrubbery-h.gc @@ -6,6 +6,10 @@ ;; dgos: GAME (define-extern shrub-make-perspective-matrix (function matrix matrix matrix)) +(declare-type instance-shrub-work structure) +(declare-type drawable-tree-instance-shrub structure) +(define-extern *instance-shrub-work* instance-shrub-work) +(define-extern draw-drawable-tree-instance-shrub (function drawable-tree-instance-shrub level none)) ;; DECOMP BEGINS @@ -161,7 +165,7 @@ This requires storing the data for all shrubs prototype twice!" (vertex-tmpl dma-packet :inline) (mscal-tmpl dma-packet :inline) (init-tmpl dma-packet :inline) - (init-data qword 8) + (init-data qword 2 :inline) ) ) diff --git a/goal_src/jak3/engine/gfx/shrub/shrubbery.gc b/goal_src/jak3/engine/gfx/shrub/shrubbery.gc index 9f33d75a65..4d42112777 100644 --- a/goal_src/jak3/engine/gfx/shrub/shrubbery.gc +++ b/goal_src/jak3/engine/gfx/shrub/shrubbery.gc @@ -5,5 +5,1079 @@ ;; name in dgo: shrubbery ;; dgos: GAME +(define-extern mem-usage-shrub-walk (function draw-node int memory-usage-block int draw-node)) +(define-extern highres-shrub-login (function draw-node none)) +(define-extern draw-inline-array-instance-shrub (function dma-buffer drawable int (inline-array prototype-bucket-shrub) none)) + ;; DECOMP BEGINS +(defmethod login ((this billboard)) + "Initialize the object after it is loaded." + (adgif-shader-login (-> this flat)) + this + ) + +(defmethod mem-usage ((this billboard) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 34 (-> usage length))) + (set! (-> usage data 33 name) "billboard") + (+! (-> usage data 33 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 33 used) v1-6) + (+! (-> usage data 33 total) (logand -16 (+ v1-6 15))) + ) + this + ) + +(defun mem-usage-shrub-walk ((arg0 draw-node) (arg1 int) (arg2 memory-usage-block) (arg3 int)) + "Walk the shrub tree and compute memory usagbe for draw nodes and shrub instances." + (set! (-> arg2 length) (max 65 (-> arg2 length))) + (set! (-> arg2 data 64 name) "draw-node") + (+! (-> arg2 data 64 count) arg1) + (let ((v1-5 (* arg1 32))) + (+! (-> arg2 data 64 used) v1-5) + (+! (-> arg2 data 64 total) (logand -16 (+ v1-5 15))) + ) + (let ((s2-0 arg0)) + (dotimes (s1-0 arg1) + (let ((a1-2 (-> s2-0 child-count))) + (cond + ((logtest? (-> s2-0 flags) 1) + (mem-usage-shrub-walk (the-as draw-node (-> s2-0 child)) (the-as int a1-2) arg2 arg3) + ) + (else + (set! (-> arg2 length) (max 35 (-> arg2 length))) + (set! (-> arg2 data 34 name) "instance-shrubbery") + (+! (-> arg2 data 34 count) a1-2) + (let ((v1-18 (* (the-as uint 80) a1-2))) + (+! (-> arg2 data 34 used) v1-18) + (+! (-> arg2 data 34 total) (logand -16 (+ v1-18 15))) + ) + ) + ) + ) + (&+! s2-0 32) + ) + ) + arg0 + ) + +(defmethod mem-usage ((this drawable-tree-instance-shrub) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (when (nonzero? (-> this colors-added)) + (set! (-> usage length) (max 33 (-> usage length))) + (set! (-> usage data 32 name) "shrubbery-pal") + (+! (-> usage data 32 count) 1) + (let ((v1-17 (asize-of (-> this colors-added)))) + (+! (-> usage data 32 used) v1-17) + (+! (-> usage data 32 total) (logand -16 (+ v1-17 15))) + ) + ) + (mem-usage-shrub-walk + (the-as draw-node (&+ (-> this data 0) 32)) + (-> (the-as drawable-group (-> this data 0)) length) + usage + flags + ) + (mem-usage (-> this info prototype-inline-array-shrub) usage (logior flags 1)) + this + ) + +(defmethod login ((this generic-shrub-fragment)) + "Initialize the object after it is loaded." + (let ((s5-0 (/ (-> this cnt-qwc) (the-as uint 5)))) + (dotimes (s4-0 (the-as int s5-0)) + (adgif-shader-login-no-remap (-> this textures s4-0)) + ) + ) + this + ) + +(defmethod mem-usage ((this generic-shrub-fragment) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 27 (-> usage length))) + (set! (-> usage data 25 name) "generic-shrub") + (+! (-> usage data 25 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 25 used) v1-6) + (+! (-> usage data 25 total) (logand -16 (+ v1-6 15))) + ) + (set! (-> usage data 26 name) "generic-shrub-data") + (+! (-> usage data 26 count) 1) + (let ((v1-17 (* (+ (-> this cnt-qwc) (-> this vtx-qwc) (-> this col-qwc) (-> this stq-qwc)) 16))) + (+! (-> usage data 26 used) v1-17) + (+! (-> usage data 26 total) (logand -16 (+ v1-17 15))) + ) + this + ) + + +(defmethod mem-usage ((this prototype-shrubbery) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +(defmethod login ((this prototype-shrubbery)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this prototype-shrubbery)) + (the-as int (+ (-> prototype-shrubbery size) (* (+ (-> this length) -1) 32))) + ) + +(defmethod login ((this prototype-generic-shrub)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +(defmethod login ((this shrubbery)) + "Initialize the object after it is loaded." + (let ((s5-0 (* (-> this header data 0) 2))) + (dotimes (s4-0 (the-as int s5-0)) + (let ((v1-3 (adgif-shader-login-no-remap (-> this textures s4-0)))) + (when v1-3 + (dotimes (a0-5 3) + (dotimes (a1-0 3) + (set! (-> (the-as (pointer int32) (+ (+ (* a0-5 16) (* a1-0 4)) (the-as int *texture-masks*)))) + (logior (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int *texture-masks*) (* a0-5 16))) 0) + (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int v1-3) (* a0-5 16))) 15) + ) + ) + ) + (set! (-> *texture-masks* data a0-5 dist) + (fmax (-> *texture-masks* data a0-5 dist) (-> v1-3 masks data a0-5 dist)) + ) + ) + ) + ) + ) + ) + (shrubbery-login-post-texture this) + this + ) + +(defmethod mem-usage ((this shrubbery) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 28 (-> usage length))) + (set! (-> usage data 27 name) "shrubbery") + (+! (-> usage data 27 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 27 used) v1-6) + (+! (-> usage data 27 total) (logand -16 (+ v1-6 15))) + ) + (set! (-> usage length) (max 30 (-> usage length))) + (set! (-> usage data 29 name) "shrubbery-vertex") + (+! (-> usage data 29 count) 1) + (let ((v1-16 (* (-> this vtx-qwc) 16))) + (+! (-> usage data 29 used) v1-16) + (+! (-> usage data 29 total) (logand -16 (+ v1-16 15))) + ) + (set! (-> usage length) (max 31 (-> usage length))) + (set! (-> usage data 30 name) "shrubbery-color") + (+! (-> usage data 30 count) 1) + (let ((v1-26 (* (-> this col-qwc) 16))) + (+! (-> usage data 30 used) v1-26) + (+! (-> usage data 30 total) (logand -16 (+ v1-26 15))) + ) + (set! (-> usage length) (max 29 (-> usage length))) + (set! (-> usage data 28 name) "shrubbery-object") + (+! (-> usage data 28 count) 1) + (let ((v1-36 (* (-> this obj-qwc) 16))) + (+! (-> usage data 28 used) v1-36) + (+! (-> usage data 28 total) (logand -16 (+ v1-36 15))) + ) + (set! (-> usage length) (max 32 (-> usage length))) + (set! (-> usage data 31 name) "shrubbery-stq") + (+! (-> usage data 31 count) 1) + (let ((v1-46 (* (-> this stq-qwc) 16))) + (+! (-> usage data 31 used) v1-46) + (+! (-> usage data 31 total) (logand -16 (+ v1-46 15))) + ) + this + ) + +(defun-debug highres-shrub-login ((arg0 draw-node)) + "Set draw-node's distance to max, to force to always draw." + (set! (-> arg0 distance) 40960000.0) + (when (logtest? (-> arg0 flags) 1) + (dotimes (s5-0 (the-as int (-> arg0 child-count))) + (let ((a0-2 (+ (+ (* s5-0 32) 32) (the-as int (-> arg0 child))))) + (highres-shrub-login (the-as draw-node a0-2)) + ) + ) + ) + 0 + (none) + ) + +(defmethod login ((this drawable-tree-instance-shrub)) + "Initialize the object after it is loaded." + (when (and *debug-segment* (-> *screen-shot-work* highres-enable)) + (dotimes (s5-0 (-> this length)) + (let ((a0-1 (-> this data s5-0))) + (highres-shrub-login (the-as draw-node a0-1)) + ) + ) + ) + (if (nonzero? (-> this info prototype-inline-array-shrub)) + (login (-> this info prototype-inline-array-shrub)) + ) + this + ) + +(define shrub-vu1-block (new 'static 'vu-function :length #x26a :qlength #x135)) + +(defun shrub-num-tris ((arg0 shrubbery)) + "Get the number of triangles in this shrubbery." + (- (-> arg0 header data 2) (* (-> arg0 header data 1) 2)) + ) + +(defun shrub-make-perspective-matrix ((arg0 matrix) (arg1 matrix)) + "Create shrub drawing matrix." + (let* ((v1-0 arg0) + (t0-0 arg1) + (a1-1 (-> t0-0 rvec quad)) + (a2-0 (-> t0-0 uvec quad)) + (a3-0 (-> t0-0 fvec quad)) + (t0-1 (-> t0-0 trans quad)) + ) + (set! (-> v1-0 rvec quad) a1-1) + (set! (-> v1-0 uvec quad) a2-0) + (set! (-> v1-0 fvec quad) a3-0) + (set! (-> v1-0 trans quad) t0-1) + ) + (let ((f0-1 (/ 1.0 (-> *math-camera* pfog0)))) + (set! (-> arg0 rvec w) (* (-> arg0 rvec w) f0-1)) + (set! (-> arg0 uvec w) (* (-> arg0 uvec w) f0-1)) + (set! (-> arg0 fvec w) (* (-> arg0 fvec w) f0-1)) + (set! (-> arg0 trans w) (* (-> arg0 trans w) f0-1)) + ) + (+! (-> arg0 rvec x) (* (-> arg0 rvec w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 uvec x) (* (-> arg0 uvec w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 fvec x) (* (-> arg0 fvec w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 trans x) (* (-> arg0 trans w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 rvec y) (* (-> arg0 rvec w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 uvec y) (* (-> arg0 uvec w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 fvec y) (* (-> arg0 fvec w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 trans y) (* (-> arg0 trans w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 rvec z) (* (-> arg0 rvec w) (-> *math-camera* hvdf-off z))) + (+! (-> arg0 uvec z) (* (-> arg0 uvec w) (-> *math-camera* hvdf-off z))) + (+! (-> arg0 fvec z) (* (-> arg0 fvec w) (-> *math-camera* hvdf-off z))) + (+! (-> arg0 trans z) (* (-> arg0 trans w) (-> *math-camera* hvdf-off z))) + arg0 + ) + +(defun shrub-init-view-data ((arg0 shrub-view-data)) + "Initialize shrub drawing constants." + (set! (-> arg0 texture-giftag tag) (new 'static 'gif-tag64 :nloop #x1 :nreg #x4)) + (set! (-> arg0 texture-giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id a+d) + :regs1 (gif-reg-id a+d) + :regs2 (gif-reg-id a+d) + :regs3 (gif-reg-id a+d) + ) + ) + (set! (-> arg0 texture-giftag word 3) (the-as uint #x40a00000)) + (set! (-> arg0 consts x) 25167696.0) + (set! (-> arg0 consts y) 8388608.0) + (set! (-> arg0 consts z) (-> *math-camera* pfog0)) + (set! (-> arg0 consts w) (-> *math-camera* pfog1)) + (set! (-> arg0 fog-clamp x) (-> *math-camera* fog-min)) + (set! (-> arg0 fog-clamp y) (-> *math-camera* fog-max)) + #f + ) + +(defun shrub-upload-view-data ((arg0 dma-buffer)) + "Create DMA to set shrub vu1 constants." + (let ((s5-0 3)) + (let* ((v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc s5-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :num s5-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (shrub-init-view-data (the-as shrub-view-data (-> arg0 base))) + (&+! (-> arg0 base) (* s5-0 16)) + ) + #f + ) + +(defun shrub-time ((arg0 int) (arg1 int) (arg2 int) (arg3 int) (arg4 int)) + "Unknown. Maybe rough cycle count for a shrub fragment?" + (+ (* arg0 8) 29 (* 22 arg2) (* 11 arg1) (* (+ (* arg4 2) 15 (* 5 arg2) (* 13 arg0)) arg3) 53) + ) + +(defun shrub-do-init-frame ((arg0 dma-buffer)) + "Set up DMA to set up VU1 for shrub rendering." + (dma-buffer-add-vu-function arg0 shrub-vu1-block 1) + (shrub-upload-view-data arg0) + (let* ((v1-0 arg0) + (a0-3 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a0-3) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-3) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm #x0)) + (set! (-> (the-as dma-packet a0-3) vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-0 base) (&+ (the-as pointer a0-3) 16)) + ) + (let* ((v1-1 arg0) + (a0-5 (the-as object (-> v1-1 base))) + ) + (set! (-> (the-as dma-packet a0-5) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-5) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-5) vif1) (new 'static 'vif-tag)) + (set! (-> v1-1 base) (&+ (the-as pointer a0-5) 16)) + ) + (let ((v1-2 (-> arg0 base))) + (set! (-> (the-as (pointer vif-tag) v1-2) 0) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> (the-as (pointer uint32) v1-2) 1) (the-as uint #x8080)) + (set! (-> (the-as (pointer uint32) v1-2) 2) (the-as uint #x8080)) + (set! (-> (the-as (pointer uint32) v1-2) 3) (the-as uint #x8080)) + (set! (-> (the-as (pointer uint32) v1-2) 4) (the-as uint 0)) + (set! (-> (the-as (pointer vif-tag) v1-2) 5) (new 'static 'vif-tag :cmd (vif-cmd stcol) :msk #x1)) + (set! (-> (the-as (pointer uint32) v1-2) 6) (the-as uint 4096)) + (set! (-> (the-as (pointer uint32) v1-2) 7) (the-as uint 4096)) + (set! (-> (the-as (pointer uint32) v1-2) 8) (the-as uint 4096)) + (set! (-> (the-as (pointer uint32) v1-2) 9) (the-as uint 4096)) + (set! (-> (the-as (pointer vif-tag) v1-2) 10) (new 'static 'vif-tag :cmd (vif-cmd stmask))) + (set! (-> (the-as (pointer uint32) v1-2) 11) (the-as uint #xa0a0a0a0)) + (set! (-> arg0 base) (&+ v1-2 48)) + ) + (set! *shrub-state* 2) + #f + ) + +(defun shrub-init-frame ((arg0 dma-buffer) (arg1 gs-test)) + "Set up DMA to set up VU1 and GS for shrub rendering." + (shrub-do-init-frame arg0) + (let* ((v1-0 arg0) + (a0-2 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-2) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-0 base) (&+ (the-as pointer a0-2) 16)) + ) + (let* ((v1-1 arg0) + (a0-4 (the-as object (-> v1-1 base))) + ) + (set! (-> (the-as gs-gif-tag a0-4) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> (the-as gs-gif-tag a0-4) regs) GIF_REGS_ALL_AD) + (set! (-> v1-1 base) (&+ (the-as pointer a0-4) 16)) + ) + (let ((v1-2 (-> arg0 base))) + (set! (-> (the-as (pointer gs-test) v1-2) 0) arg1) + (set! (-> (the-as (pointer gs-reg64) v1-2) 1) (gs-reg64 test-1)) + (set! (-> arg0 base) (&+ v1-2 16)) + ) + #f + ) + +(defun shrub-upload-model ((arg0 shrubbery) (arg1 dma-buffer) (arg2 int)) + "Set up DMA to upload a single shrub model." + (let* ((v1-0 arg1) + (a3-0 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a3-0) dma) + (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (-> arg0 bsphere x)) + :qwc (+ (-> arg0 obj-qwc) (-> arg0 vtx-qwc) (-> arg0 col-qwc) (-> arg0 stq-qwc)) + ) + ) + (set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag :cmd (vif-cmd base) :imm *shrub-state*)) + (set! (-> (the-as dma-packet a3-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd offset))) + (set! (-> v1-0 base) (&+ (the-as pointer a3-0) 16)) + ) + (cond + ((= arg2 1) + (let* ((v1-2 arg1) + (a0-9 (the-as object (-> v1-2 base))) + ) + (set! (-> (the-as dma-packet a0-9) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-9) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-9) vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x11)) + (set! (-> v1-2 base) (&+ (the-as pointer a0-9) 16)) + ) + ) + (else + (let* ((v1-3 arg1) + (a0-11 (the-as object (-> v1-3 base))) + ) + (set! (-> (the-as dma-packet a0-11) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-11) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-11) vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x15)) + (set! (-> v1-3 base) (&+ (the-as pointer a0-11) 16)) + ) + ) + ) + (set! *shrub-state* (- 164 *shrub-state*)) + #f + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: Failed load: (set! a2-11 (l.d (+ a0-14 96))) at op 102 +(defun draw-prototype-inline-array-shrub ((arg0 int) (arg1 (inline-array prototype-bucket-shrub))) + (the pointer 0) + ; (local-vars + ; (sv-16 drawable) + ; (sv-32 uint) + ; (sv-48 int) + ; (sv-64 drawable) + ; (sv-80 int) + ; (sv-96 uint) + ; (sv-112 drawable) + ; (sv-128 int) + ; ) + ; (let ((v1-0 (the-as object arg1)) + ; (a0-6 (-> *display* frames (-> *display* on-screen) global-buf)) + ; ) + ; (countdown (a1-2 arg0) + ; (when (nonzero? (-> (the-as prototype-bucket-shrub v1-0) count 1)) + ; (let ((a2-2 (-> a0-6 base))) + ; (set! (-> (the-as (pointer uint128) a2-2)) + ; (-> *instance-shrub-work* count-tmpl (-> (the-as prototype-bucket-shrub v1-0) mod-count 1) quad) + ; ) + ; (set! (-> (the-as (pointer uint64) a2-2)) + ; (logior (logand (-> (the-as (pointer uint64) a2-2)) (the-as uint #x80000000ffffffff)) + ; (shr (shl (-> (the-as prototype-bucket-shrub v1-0) next 1) 33) 1) + ; ) + ; ) + ; (set! (-> (the-as prototype-bucket-shrub v1-0) next 1) (the-as uint a2-2)) + ; ) + ; (&+! (-> a0-6 base) 16) + ; ) + ; (when (nonzero? (-> (the-as prototype-bucket-shrub v1-0) count 2)) + ; (let ((a2-7 (-> a0-6 base))) + ; (set! (-> (the-as (pointer uint128) a2-7)) + ; (-> *instance-shrub-work* count-tmpl (-> (the-as prototype-bucket-shrub v1-0) mod-count 2) quad) + ; ) + ; (set! (-> (the-as (pointer uint64) a2-7)) + ; (logior (logand (-> (the-as (pointer uint64) a2-7)) (the-as uint #x80000000ffffffff)) + ; (shr (shl (-> (the-as prototype-bucket-shrub v1-0) next 2) 33) 1) + ; ) + ; ) + ; (set! (-> (the-as prototype-bucket-shrub v1-0) next 2) (the-as uint a2-7)) + ; ) + ; (&+! (-> a0-6 base) 16) + ; ) + ; (set! v1-0 (&+ (the-as prototype-bucket-shrub v1-0) 112)) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask shrub-near) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *instance-shrub-work* near-count)) + ; (let ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 12 + ; (bucket-id shrub-near-l0-shrub) + ; (bucket-id shrub-near-l1-shrub) + ; (bucket-id shrub-near-l2-shrub) + ; (bucket-id shrub-near-l3-shrub) + ; (bucket-id shrub-near-l4-shrub) + ; (bucket-id shrub-near-l5-shrub) + ; (bucket-id shrub-near-l6-shrub) + ; (bucket-id shrub-near-l7-shrub) + ; (bucket-id shrub-near-l8-shrub) + ; (bucket-id shrub-near-l9-shrub) + ; (bucket-id bucket0) + ; (bucket-id bucket0) + ; ) + ; *draw-index* + ; ) + ; ) + ; (generic-init-buf s2-0 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + ; (generic-add-shrub-constants s2-0 #x5026b 60 61) + ; (let ((a0-14 (+ (+ (-> *instance-shrub-work* current-shrub-near-packet) 5152) (the-as uint *instance-shrub-work*))) + ; (v1-23 (-> s2-0 base)) + ; (a1-7 (+ (-> *instance-shrub-work* near-last) 176)) + ; ) + ; (let ((a2-13 (logior (logand (l.d (+ a0-14 96)) (the-as uint #x80000000ffffffff)) + ; (shr (shl (-> *instance-shrub-work* near-next) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (+ a0-14 96) a2-13) + ; ) + ; (let ((a2-14 (l.q (+ a0-14 96))) + ; (a3-18 (l.q (+ a0-14 112))) + ; (a0-15 (l.q (+ a0-14 128))) + ; ) + ; (set! (-> (the-as (pointer uint128) v1-23)) a2-14) + ; (s.q! (+ v1-23 16) a3-18) + ; (s.q! (+ v1-23 32) a0-15) + ; ) + ; (let ((v1-24 (&+ v1-23 48))) + ; (s.w! (+ a1-7 4) v1-24) + ; (set! (-> s2-0 base) v1-24) + ; ) + ; ) + ; ) + ; (let ((v1-34 *dma-mem-usage*)) + ; (when (nonzero? v1-34) + ; (set! (-> v1-34 length) (max 28 (-> v1-34 length))) + ; (set! (-> v1-34 data 27 name) "shrubbery") + ; (+! (-> v1-34 data 27 count) 1) + ; (+! (-> v1-34 data 27 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-0)) + ; ) + ; (set! (-> v1-34 data 27 total) (-> v1-34 data 27 used)) + ; ) + ; ) + ; ) + ; ) + ; (when (nonzero? (-> *instance-shrub-work* near-trans-count)) + ; (let ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 12 + ; (bucket-id shrub-near-trans-l0-shrub) + ; (bucket-id shrub-near-trans-l1-shrub) + ; (bucket-id shrub-near-trans-l2-shrub) + ; (bucket-id shrub-near-trans-l3-shrub) + ; (bucket-id shrub-near-trans-l4-shrub) + ; (bucket-id shrub-near-trans-l5-shrub) + ; (bucket-id shrub-near-trans-l6-shrub) + ; (bucket-id shrub-near-trans-l7-shrub) + ; (bucket-id shrub-near-trans-l8-shrub) + ; (bucket-id shrub-near-trans-l9-shrub) + ; (bucket-id bucket0) + ; (bucket-id bucket0) + ; ) + ; *draw-index* + ; ) + ; ) + ; (generic-init-buf s2-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + ; (generic-add-shrub-constants s2-1 #x51001 124 125) + ; (let ((a0-26 + ; (+ (+ (-> *instance-shrub-work* current-shrub-near-trans-packet) 5152) (the-as uint *instance-shrub-work*)) + ; ) + ; (v1-51 (-> s2-1 base)) + ; (a1-24 (+ (-> *instance-shrub-work* near-trans-last) 176)) + ; ) + ; (let ((a2-28 (logior (logand (l.d (+ a0-26 96)) (the-as uint #x80000000ffffffff)) + ; (shr (shl (-> *instance-shrub-work* near-trans-next) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (+ a0-26 96) a2-28) + ; ) + ; (let ((a2-29 (l.q (+ a0-26 96))) + ; (a3-27 (l.q (+ a0-26 112))) + ; (a0-27 (l.q (+ a0-26 128))) + ; ) + ; (set! (-> (the-as (pointer uint128) v1-51)) a2-29) + ; (s.q! (+ v1-51 16) a3-27) + ; (s.q! (+ v1-51 32) a0-27) + ; ) + ; (let ((v1-52 (&+ v1-51 48))) + ; (s.w! (+ a1-24 4) v1-52) + ; (set! (-> s2-1 base) v1-52) + ; ) + ; ) + ; ) + ; (let ((v1-62 *dma-mem-usage*)) + ; (when (nonzero? v1-62) + ; (set! (-> v1-62 length) (max 28 (-> v1-62 length))) + ; (set! (-> v1-62 data 27 name) "shrubbery") + ; (+! (-> v1-62 data 27 count) 1) + ; (+! (-> v1-62 data 27 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-1)) + ; ) + ; (set! (-> v1-62 data 27 total) (-> v1-62 data 27 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask shrubbery) (-> *display* vu1-enable-user)) + ; (let ((s4-2 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((s2-2 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 12 + ; (bucket-id shrub-l0-shrub) + ; (bucket-id shrub-l1-shrub) + ; (bucket-id shrub-l2-shrub) + ; (bucket-id shrub-l3-shrub) + ; (bucket-id shrub-l4-shrub) + ; (bucket-id shrub-l5-shrub) + ; (bucket-id shrub-l6-shrub) + ; (bucket-id shrub-l7-shrub) + ; (bucket-id shrub-l8-shrub) + ; (bucket-id shrub-l9-shrub) + ; (bucket-id bucket0) + ; (bucket-id bucket0) + ; ) + ; *draw-index* + ; ) + ; ) + ; (shrub-init-frame s2-2 (new 'static 'gs-test + ; :ate #x1 + ; :atst (gs-atest greater-equal) + ; :aref #x26 + ; :zte #x1 + ; :ztst (gs-ztest greater-equal) + ; ) + ; ) + ; (let ((s1-0 (the-as prototype-bucket-shrub arg1))) + ; (countdown (s0-0 arg0) + ; (when (nonzero? (-> s1-0 count 1)) + ; (if (logtest? (-> s1-0 flags) (prototype-flags tpage-alpha)) + ; (set! sv-16 (-> s1-0 geometry 2)) + ; (set! sv-16 (-> s1-0 geometry 1)) + ; ) + ; (set! sv-32 (-> s1-0 next 1)) + ; (if (logtest? (-> s1-0 flags) (prototype-flags tpage-alpha)) + ; (set! sv-48 #x51001) + ; (set! sv-48 #x5026b) + ; ) + ; (set! sv-64 (&+ sv-16 32)) + ; (set! sv-80 0) + ; (while (< sv-80 (-> (the-as prototype-shrubbery sv-16) length)) + ; (shrub-upload-model + ; (the-as shrubbery sv-64) + ; s2-2 + ; (the-as int (-> *instance-shrub-work* start-bank (-> s1-0 mod-count 1))) + ; ) + ; (if (zero? sv-80) + ; (dma-buffer-add-gs-set s2-2 (test-1 sv-48)) + ; ) + ; (let* ((v1-98 s2-2) + ; (a0-44 (-> v1-98 base)) + ; ) + ; (set! (-> (the-as (pointer uint64) a0-44)) (logior #x50000000 (shr (shl sv-32 33) 1))) + ; (s.w! (+ a0-44 8) 0) + ; (s.w! (+ a0-44 12) 0) + ; (set! (-> v1-98 base) (&+ a0-44 16)) + ; ) + ; (set! sv-64 (&+ sv-64 32)) + ; (set! sv-80 (+ sv-80 1)) + ; ) + ; ) + ; (&+! s1-0 112) + ; ) + ; ) + ; ) + ; (let ((v1-117 *dma-mem-usage*)) + ; (when (nonzero? v1-117) + ; (set! (-> v1-117 length) (max 28 (-> v1-117 length))) + ; (set! (-> v1-117 data 27 name) "shrubbery") + ; (+! (-> v1-117 data 27 count) 1) + ; (+! (-> v1-117 data 27 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-2)) + ; ) + ; (set! (-> v1-117 data 27 total) (-> v1-117 data 27 used)) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask shrub-vanish) (-> *display* vu1-enable-user)) + ; (let ((s4-3 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((s2-3 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 12 + ; (bucket-id shrub-vanish-l0-shrub) + ; (bucket-id shrub-vanish-l1-shrub) + ; (bucket-id shrub-vanish-l2-shrub) + ; (bucket-id shrub-vanish-l3-shrub) + ; (bucket-id shrub-vanish-l4-shrub) + ; (bucket-id shrub-vanish-l5-shrub) + ; (bucket-id shrub-vanish-l6-shrub) + ; (bucket-id shrub-vanish-l7-shrub) + ; (bucket-id shrub-vanish-l8-shrub) + ; (bucket-id shrub-vanish-l9-shrub) + ; (bucket-id bucket0) + ; (bucket-id bucket0) + ; ) + ; *draw-index* + ; ) + ; ) + ; (shrub-init-frame s2-3 (new 'static 'gs-test + ; :ate #x1 + ; :atst (gs-atest greater-equal) + ; :aref #x26 + ; :afail #x1 + ; :zte #x1 + ; :ztst (gs-ztest greater-equal) + ; ) + ; ) + ; (let ((s1-1 (the-as prototype-bucket-shrub arg1))) + ; (countdown (s0-1 arg0) + ; (when (nonzero? (-> s1-1 count 2)) + ; (let ((v1-134 (-> s1-1 geometry 2))) + ; (set! sv-96 (-> s1-1 next 2)) + ; (set! sv-112 (&+ v1-134 32)) + ; (set! sv-128 (-> (the-as prototype-shrubbery v1-134) length)) + ; ) + ; (while (nonzero? sv-128) + ; (set! sv-128 (+ sv-128 -1)) + ; (shrub-upload-model + ; (the-as shrubbery sv-112) + ; s2-3 + ; (the-as int (-> *instance-shrub-work* start-bank (-> s1-1 mod-count 2))) + ; ) + ; (let* ((v1-140 s2-3) + ; (a0-60 (-> v1-140 base)) + ; ) + ; (set! (-> (the-as (pointer uint64) a0-60)) (logior #x50000000 (shr (shl sv-96 33) 1))) + ; (s.w! (+ a0-60 8) 0) + ; (s.w! (+ a0-60 12) 0) + ; (set! (-> v1-140 base) (&+ a0-60 16)) + ; ) + ; (set! sv-112 (&+ sv-112 32)) + ; ) + ; ) + ; (&+! s1-1 112) + ; ) + ; ) + ; ) + ; (let ((v1-157 *dma-mem-usage*)) + ; (when (nonzero? v1-157) + ; (set! (-> v1-157 length) (max 28 (-> v1-157 length))) + ; (set! (-> v1-157 data 27 name) "shrubbery") + ; (+! (-> v1-157 data 27 count) 1) + ; (+! (-> v1-157 data 27 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-3)) + ; ) + ; (set! (-> v1-157 data 27 total) (-> v1-157 data 27 used)) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask billboard) (-> *display* vu1-enable-user)) + ; (let* ((s4-4 (-> *display* frames (-> *display* on-screen) global-buf base)) + ; (v1-171 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (a2-70 (-> v1-171 base)) + ; ) + ; (dma-buffer-add-gs-set v1-171 (test-1 (new 'static 'gs-test + ; :ate #x1 + ; :atst (gs-atest greater-equal) + ; :aref #x80 + ; :afail #x1 + ; :zte #x1 + ; :ztst (gs-ztest greater-equal) + ; ) + ; ) + ; ) + ; (let ((a0-73 (-> v1-171 base))) + ; (while (nonzero? arg0) + ; (+! arg0 -1) + ; (when (nonzero? (-> (the-as prototype-bucket-shrub arg1) count 3)) + ; (set! (-> *instance-shrub-work* adgif-tmpl dma-vif dma addr) (-> (the-as prototype-bucket-shrub arg1) next 3)) + ; (set! (-> (the-as (pointer uint128) a0-73)) (-> *instance-shrub-work* adgif-tmpl dma-vif quad)) + ; (let ((a1-91 (-> *instance-shrub-work* adgif-tmpl quad 1))) + ; (s.q! (+ a0-73 16) a1-91) + ; ) + ; (let ((a1-92 (the-as prototype-bucket-shrub (-> (the-as prototype-bucket-shrub arg1) geometry 3)))) + ; (let ((a3-46 (-> a1-92 dists quad))) + ; (s.q! (+ a0-73 32) a3-46) + ; ) + ; (let ((a3-47 (-> a1-92 rdists quad))) + ; (s.q! (+ a0-73 48) a3-47) + ; ) + ; (let ((a3-48 (-> a1-92 next-clear))) + ; (s.q! (+ a0-73 64) a3-48) + ; ) + ; (let ((a3-49 (-> a1-92 count-quad))) + ; (s.q! (+ a0-73 80) a3-49) + ; ) + ; (let ((a1-93 (-> a1-92 last-clear))) + ; (s.q! (+ a0-73 96) a1-93) + ; ) + ; ) + ; (&+! a0-73 112) + ; (set! (-> (the-as prototype-bucket-shrub arg1) last 3 dma addr) (the-as int a0-73)) + ; ) + ; (set! arg1 (the-as (inline-array prototype-bucket-shrub) (&+ (the-as prototype-bucket-shrub arg1) 112))) + ; ) + ; (set! (-> v1-171 base) a0-73) + ; ) + ; (let* ((a3-54 (-> v1-171 base)) + ; (v0-12 (when (!= a2-70 a3-54) + ; (let ((a0-74 (-> v1-171 base))) + ; (set! (-> (the-as (pointer int64) a0-74)) #x20000000) + ; (s.w! (+ a0-74 8) 0) + ; (s.w! (+ a0-74 12) 0) + ; (set! (-> v1-171 base) (&+ a0-74 16)) + ; ) + ; (dma-bucket-insert-tag + ; (-> *display* frames (-> *display* on-screen) bucket-group) + ; (-> (new 'static 'array bucket-id 12 + ; (bucket-id billboard-l0-shrub) + ; (bucket-id billboard-l1-shrub) + ; (bucket-id billboard-l2-shrub) + ; (bucket-id billboard-l3-shrub) + ; (bucket-id billboard-l4-shrub) + ; (bucket-id billboard-l5-shrub) + ; (bucket-id billboard-l6-shrub) + ; (bucket-id billboard-l7-shrub) + ; (bucket-id billboard-l8-shrub) + ; (bucket-id billboard-l9-shrub) + ; (bucket-id bucket0) + ; (bucket-id bucket0) + ; ) + ; *draw-index* + ; ) + ; a2-70 + ; (the-as (pointer dma-tag) a3-54) + ; ) + ; ) + ; ) + ; ) + ; (let ((v1-179 *dma-mem-usage*)) + ; (when (nonzero? v1-179) + ; (set! (-> v1-179 length) (max 34 (-> v1-179 length))) + ; (set! (-> v1-179 data 33 name) "billboard") + ; (+! (-> v1-179 data 33 count) 1) + ; (+! (-> v1-179 data 33 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-4)) + ; ) + ; (set! (-> v1-179 data 33 total) (-> v1-179 data 33 used)) + ; ) + ; ) + ; v0-12 + ; ) + ; ) + ; ) + ) + +(defun draw-drawable-tree-instance-shrub ((arg0 drawable-tree-instance-shrub) (arg1 level)) + "Draw a shrub tree!" + (local-vars (a0-4 int) (a0-6 int) (a0-11 int) (a0-13 int)) + (set! (-> *instance-shrub-work* texture-dists) (the-as uint (-> arg1 bsp shrub-closest))) + (set! (-> *instance-shrub-work* near-last) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-next) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-count) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-trans-last) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-trans-next) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-trans-count) (the-as uint 0)) + (set! (-> *instance-shrub-work* wind-vectors) (-> arg0 info wind-vectors)) + (set! (-> *instance-shrub-work* wait-to-spr) (the-as uint 0)) + (set! (-> *instance-shrub-work* wait-from-spr) (the-as uint 0)) + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrub-vanish) (-> *display* vu1-enable-user)) + (let* ((v1-16 (-> arg0 info prototype-inline-array-shrub)) + (s5-0 (-> v1-16 length)) + (s4-0 (-> v1-16 data)) + ) + (countdown (a1-5 s5-0) + (let ((a2-3 (-> v1-16 data a1-5))) + (set! (-> a2-3 next-clear) (the-as uint128 0)) + (set! (-> a2-3 last-clear) (the-as uint128 0)) + (set! (-> a2-3 count-clear) (the-as uint 0)) + ) + 0 + ) + (let ((v1-24 (-> *display* frames (-> *display* on-screen) global-buf))) + (when (nonzero? (-> arg0 length)) + (let ((gp-0 (-> *display* frames (-> *display* on-screen) global-buf base))) + (start-profiling! (-> *perf-stats* data (perf-stat-bucket inst-shrub))) + (draw-inline-array-instance-shrub + v1-24 + (&+ (-> arg0 data 0) 32) + (-> (the-as drawable-group (-> arg0 data 0)) length) + s4-0 + ) + (stop-profiling! (-> *perf-stats* data (perf-stat-bucket inst-shrub))) + + (start-profiling! (-> *perf-stats* data (perf-stat-bucket proto-shrub))) + (draw-prototype-inline-array-shrub s5-0 s4-0) + (stop-profiling! (-> *perf-stats* data (perf-stat-bucket proto-shrub))) + (let ((v1-33 *dma-mem-usage*)) + (when (nonzero? v1-33) + (set! (-> v1-33 length) (max 28 (-> v1-33 length))) + (set! (-> v1-33 data 27 name) "shrubbery") + (+! (-> v1-33 data 27 count) 1) + (+! (-> v1-33 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint gp-0)) + ) + (set! (-> v1-33 data 27 total) (-> v1-33 data 27 used)) + ) + ) + ) + ) + ) + ) + (update-wait-stats + (-> *perf-stats* data 44) + (the-as uint 0) + (-> *instance-shrub-work* wait-to-spr) + (-> *instance-shrub-work* wait-from-spr) + ) + ) + 0 + (none) + ) + +(defmethod draw ((this drawable-tree-instance-shrub)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* shrub-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* shrub-trees v1-1) this) + (set! (-> *background-work* shrub-levels v1-1) a1-3) + ) + (+! (-> *background-work* shrub-tree-count) 1) + 0 + (none) + ) + +(defmethod unpack-vis ((this drawable-tree-instance-shrub) (arg0 (pointer int8)) (arg1 (pointer int8))) + arg1 + ) + +(defmethod collect-stats ((this drawable-tree-instance-shrub)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrub-vanish) (-> *display* vu1-enable-user)) + (let* ((v1-4 (-> this info prototype-inline-array-shrub)) + (gp-0 (the-as object (-> v1-4 data))) + ) + (countdown (s5-0 (-> v1-4 length)) + (when (logtest? (vu1-renderer-mask shrub-near) (-> *display* vu1-enable-user)) + (let ((v1-8 (-> (the-as prototype-bucket-shrub gp-0) count 0)) + (a1-2 (-> (the-as prototype-bucket-shrub gp-0) geometry 0)) + ) + (when (nonzero? v1-8) + (let ((a0-4 (-> (the-as drawable-group a1-2) length))) + (+! (-> *terrain-stats* shrub groups) 1) + (+! (-> *terrain-stats* shrub fragments) (* a0-4 (the-as int v1-8))) + ) + (+! (-> *terrain-stats* shrub instances) v1-8) + ) + ) + ) + (when (logtest? (vu1-renderer-mask shrubbery) (-> *display* vu1-enable-user)) + (let ((s4-0 (-> (the-as prototype-bucket-shrub gp-0) count 1)) + (v1-13 (-> (the-as prototype-bucket-shrub gp-0) geometry 1)) + ) + (when (nonzero? s4-0) + (let ((s3-0 (&+ v1-13 32)) + (s2-0 (-> (the-as drawable-group v1-13) length)) + ) + (+! (-> *terrain-stats* shrub groups) 1) + (+! (-> *terrain-stats* shrub fragments) s2-0) + (+! (-> *terrain-stats* shrub instances) s4-0) + (while (nonzero? s2-0) + (+! s2-0 -1) + (let ((a0-17 (* (shrub-num-tris (the-as shrubbery s3-0)) s4-0)) + (v1-25 (* (-> (the-as shrubbery s3-0) header data 2) s4-0)) + ) + (+! (-> *terrain-stats* shrub tris) a0-17) + (+! (-> *terrain-stats* shrub dverts) v1-25) + ) + (&+! s3-0 32) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask shrub-vanish) (-> *display* vu1-enable-user)) + (let ((s4-1 (-> (the-as prototype-bucket-shrub gp-0) count 2)) + (v1-31 (-> (the-as prototype-bucket-shrub gp-0) geometry 2)) + ) + (when (nonzero? s4-1) + (let ((s3-1 (&+ v1-31 32)) + (s2-1 (-> (the-as drawable-group v1-31) length)) + ) + (+! (-> *terrain-stats* trans-shrub groups) 1) + (+! (-> *terrain-stats* trans-shrub fragments) s2-1) + (+! (-> *terrain-stats* trans-shrub instances) s4-1) + (while (nonzero? s2-1) + (+! s2-1 -1) + (let ((a0-30 (* (shrub-num-tris (the-as shrubbery s3-1)) s4-1)) + (v1-43 (* (-> (the-as shrubbery s3-1) header data 2) s4-1)) + ) + (+! (-> *terrain-stats* trans-shrub tris) a0-30) + (+! (-> *terrain-stats* trans-shrub dverts) v1-43) + ) + (&+! s3-1 32) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask billboard) (-> *display* vu1-enable-user)) + (let ((v1-49 (-> (the-as prototype-bucket-shrub gp-0) count 3))) + (when (nonzero? v1-49) + (+! (-> *terrain-stats* billboard groups) 1) + (+! (-> *terrain-stats* billboard instances) v1-49) + (+! (-> *terrain-stats* billboard tris) (* v1-49 2)) + (+! (-> *terrain-stats* billboard dverts) (* v1-49 4)) + ) + ) + ) + (set! gp-0 (-> (the-as (inline-array prototype-bucket-shrub) gp-0) 1)) + ) + ) + ) + 0 + (none) + ) + +(deftype dma-test (structure) + ((data qword 101 :inline) + ) + ) + + +(define *dma-test* (new 'global 'dma-test)) + +(deftype dma-test-work (structure) + ((upload dma-packet :inline) + (end dma-packet :inline) + ) + ) + + +(define *dma-test-work* + (new 'static 'dma-test-work + :upload (new 'static 'dma-packet :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref))) + :end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + ) + ) + +;; WARN: Return type mismatch uint128 vs none. +;; ERROR: Failed store: (s.q! (+ v1-0 1616) v0-0) at op 29 +; (defun init-dma-test () +; (let ((a0-0 *dma-test-work*) +; (v1-0 *dma-test*) +; ) +; (let ((a1-6 (-> *display* frames (-> *display* on-screen) calc-buf base))) +; (dotimes (a2-1 100) +; (set! (-> a0-0 upload dma addr) (the-as int a1-6)) +; (set! (-> v1-0 data a2-1 quad) (-> a0-0 upload quad)) +; (&+! a1-6 256) +; ) +; ) +; (let ((v0-0 (-> a0-0 end quad))) +; (s.q! (+ v1-0 1616) v0-0) +; ) +; ) +; (none) +; ) + +; (init-dma-test) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: function was not converted to expressions. Cannot decompile. diff --git a/goal_src/jak3/engine/gfx/vu1-user-h.gc b/goal_src/jak3/engine/gfx/vu1-user-h.gc index 27d650e40c..0443b9ce4c 100644 --- a/goal_src/jak3/engine/gfx/vu1-user-h.gc +++ b/goal_src/jak3/engine/gfx/vu1-user-h.gc @@ -168,110 +168,110 @@ (gmerc2-l9-tfrag 129) (tex-l0-shrub 130) - (bucket131 131) - (bucket132 132) - (bucket133 133) - (bucket134 134) - (bucket135 135) + (shrub-l0-shrub 131) + (shrub-near-l0-shrub 132) + (billboard-l0-shrub 133) + (shrub-vanish-l0-shrub 134) + (shrub-near-trans-l0-shrub 135) (merc-l0-shrub 136) (emerc-l0-shrub 137) (gmerc-l0-shrub 138) (gmerc2-l0-shrub 139) (tex-l1-shrub 140) - (bucket141 141) - (bucket142 142) - (bucket143 143) - (bucket144 144) - (bucket145 145) + (shrub-l1-shrub 141) + (shrub-near-l1-shrub 142) + (billboard-l1-shrub 143) + (shrub-vanish-l1-shrub 144) + (shrub-near-trans-l1-shrub 145) (merc-l1-shrub 146) (emerc-l1-shrub 147) (gmerc-l1-shrub 148) (gmerc2-l1-shrub 149) (tex-l2-shrub 150) - (bucket151 151) - (bucket152 152) - (bucket153 153) - (bucket154 154) - (bucket155 155) + (shrub-l2-shrub 151) + (shrub-near-l2-shrub 152) + (billboard-l2-shrub 153) + (shrub-vanish-l2-shrub 154) + (shrub-near-trans-l2-shrub 155) (merc-l2-shrub 156) (emerc-l2-shrub 157) (gmerc-l2-shrub 158) (gmerc2-l2-shrub 159) (tex-l3-shrub 160) - (bucket161 161) - (bucket162 162) - (bucket163 163) - (bucket164 164) - (bucket165 165) + (shrub-l3-shrub 161) + (shrub-near-l3-shrub 162) + (billboard-l3-shrub 163) + (shrub-vanish-l3-shrub 164) + (shrub-near-trans-l3-shrub 165) (merc-l3-shrub 166) (emerc-l3-shrub 167) (gmerc-l3-shrub 168) (gmerc2-l3-shrub 169) (tex-l4-shrub 170) - (bucket171 171) - (bucket172 172) - (bucket173 173) - (bucket174 174) - (bucket175 175) + (shrub-l4-shrub 171) + (shrub-near-l4-shrub 172) + (billboard-l4-shrub 173) + (shrub-vanish-l4-shrub 174) + (shrub-near-trans-l4-shrub 175) (merc-l4-shrub 176) (emerc-l4-shrub 177) (gmerc-l4-shrub 178) (gmerc2-l4-shrub 179) (tex-l5-shrub 180) - (bucket181 181) - (bucket182 182) - (bucket183 183) - (bucket184 184) - (bucket185 185) + (shrub-l5-shrub 181) + (shrub-near-l5-shrub 182) + (billboard-l5-shrub 183) + (shrub-vanish-l5-shrub 184) + (shrub-near-trans-l5-shrub 185) (merc-l5-shrub 186) (emerc-l5-shrub 187) (gmerc-l5-shrub 188) (gmerc2-l5-shrub 189) (tex-l6-shrub 190) - (bucket191 191) - (bucket192 192) - (bucket193 193) - (bucket194 194) - (bucket195 195) + (shrub-l6-shrub 191) + (shrub-near-l6-shrub 192) + (billboard-l6-shrub 193) + (shrub-vanish-l6-shrub 194) + (shrub-near-trans-l6-shrub 195) (merc-l6-shrub 196) (emerc-l6-shrub 197) (gmerc-l6-shrub 198) (gmerc2-l6-shrub 199) (tex-l7-shrub 200) - (bucket201 201) - (bucket202 202) - (bucket203 203) - (bucket204 204) - (bucket205 205) + (shrub-l7-shrub 201) + (shrub-near-l7-shrub 202) + (billboard-l7-shrub 203) + (shrub-vanish-l7-shrub 204) + (shrub-near-trans-l7-shrub 205) (merc-l7-shrub 206) (emerc-l7-shrub 207) (gmerc-l7-shrub 208) (gmerc2-l7-shrub 209) (tex-l8-shrub 210) - (bucket211 211) - (bucket212 212) - (bucket213 213) - (bucket214 214) - (bucket215 215) + (shrub-l8-shrub 211) + (shrub-near-l8-shrub 212) + (billboard-l8-shrub 213) + (shrub-vanish-l8-shrub 214) + (shrub-near-trans-l8-shrub 215) (merc-l8-shrub 216) (emerc-l8-shrub 217) (gmerc-l8-shrub 218) (gmerc2-l8-shrub 219) (tex-l9-shrub 220) - (bucket221 221) - (bucket222 222) - (bucket223 223) - (bucket224 224) - (bucket225 225) + (shrub-l9-shrub 221) + (shrub-near-l9-shrub 222) + (billboard-l9-shrub 223) + (shrub-vanish-l9-shrub 224) + (shrub-near-trans-l9-shrub 225) (merc-l9-shrub 226) (emerc-l9-shrub 227) (gmerc-l9-shrub 228) @@ -693,45 +693,45 @@ ) ;; +++vu1-renderer-mask -;; TODO stolen from Jak 2 +;; TODO stolen from Jak 2 (and it was all wrong...) (defenum vu1-renderer-mask :type uint64 :bitfield #t (rn0) (rn1) (rn2) - (sky) - (ocean) - (ocean-wave) - (tfrag) - (tie) - (tie-envmap) - (tie-scissor) - (tie-envmap-scissor) - (tie-vanish) + (rn3) + (rn4) + (rn5) + (rn6) + (rn7) + (rn8) + (rn9) + (rn10) + (rn11) + (rn12) + (rn13) + (generic) ;; right + (merc) ;; right + (emerc) ;; right (shrubbery) (shrub-near) - (generic) - (merc) - (emerc) (billboard) - (shrubbery-vanish) - (tfrag-trans) - (tie-scissor-trans) - (tie-trans) - (tie-envmap-trans) - (tie-envmap-scissor-trans) - (tfrag-water) - (tie-scissor-water) - (tie-water) - (tie-envmap-water) - (tie-envmap-scissor-water) - (sprite) - (shadow) + (shrub-vanish) + (rn21) + (rn22) + (rn23) + (rn24) + (rn25) + (rn26) + (rn27) + (rn28) + (rn29) + (rn30) (rn31) (rn32) (rn33) - (depth-cue) + (rn34) (rn35) (rn36) (rn37) diff --git a/goal_src/jak3/engine/level/bsp-h.gc b/goal_src/jak3/engine/level/bsp-h.gc index f1d6a49e06..fb63e7ef2f 100644 --- a/goal_src/jak3/engine/level/bsp-h.gc +++ b/goal_src/jak3/engine/level/bsp-h.gc @@ -40,8 +40,9 @@ This is used for precomputed visibility, based on the camera position. This is n "The bsp-header is really an entire level. This probably started as a very simple structure, but now it is extremely complicated." ((info file-info :overlay-at id) - (all-visible-list (pointer uint16) :offset 32) + (all-visible-list (pointer uint8) :offset 32) (visible-list-length int16 :offset 36) + (extra-vis-list-length int16) (drawable-trees drawable-tree-array :offset 40) (pat pointer :offset 44) (pat-length int32 :offset 48) @@ -62,6 +63,8 @@ This probably started as a very simple structure, but now it is extremely compli (actor-birth-order (pointer uint32) :offset 172) (region-trees (array drawable-tree-region-prim) :offset 188) (collide-hash collide-hash :offset 196) + (wind-array uint32 :offset 200) + (wind-array-length int32 :offset 204) (vis-spheres vector-array :offset 216) (vis-spheres-length uint32 :offset 248) (tfrag-masks texture-masks-array :offset 256) @@ -78,7 +81,7 @@ This probably started as a very simple structure, but now it is extremely compli (water-mask-count uint32 :overlay-at water-closest) (bsp-scale vector :inline :offset 288) (bsp-offset vector :inline) - (unk-drawable drawable :offset 320) + (hfrag-drawable drawable :offset 320) (end uint8 :offset 399) ) (:methods diff --git a/goal_src/jak3/engine/level/bsp.gc b/goal_src/jak3/engine/level/bsp.gc index 799ae08ea8..c01012693c 100644 --- a/goal_src/jak3/engine/level/bsp.gc +++ b/goal_src/jak3/engine/level/bsp.gc @@ -105,8 +105,8 @@ (+! (-> usage data 65 used) v1-92) (+! (-> usage data 65 total) (logand -16 (+ v1-92 15))) ) - (if (nonzero? (-> this unk-drawable)) - (mem-usage (-> this unk-drawable) usage flags) + (if (nonzero? (-> this hfrag-drawable)) + (mem-usage (-> this hfrag-drawable) usage flags) ) (when (nonzero? (-> this region-trees)) (let* ((s3-0 (-> this region-trees length)) @@ -150,8 +150,8 @@ ) ) ) - (if (nonzero? (-> this unk-drawable)) - (login (-> this unk-drawable)) + (if (nonzero? (-> this hfrag-drawable)) + (login (-> this hfrag-drawable)) ) this ) @@ -339,8 +339,8 @@ (if (nonzero? (-> this drawable-trees)) (collect-stats (-> this drawable-trees)) ) - (if (nonzero? (-> this unk-drawable)) - (collect-stats (-> this unk-drawable)) + (if (nonzero? (-> this hfrag-drawable)) + (collect-stats (-> this hfrag-drawable)) ) 0 (none) diff --git a/goal_src/jak3/engine/level/level-h.gc b/goal_src/jak3/engine/level/level-h.gc index 7cbe2996ea..0deedde793 100644 --- a/goal_src/jak3/engine/level/level-h.gc +++ b/goal_src/jak3/engine/level/level-h.gc @@ -159,7 +159,7 @@ (lf7 7) (lf8 8) (lf9 9) - (lf10 10) + (use-camera-other 10) (lf11 11) (lf12 12) (lf13 13) diff --git a/goal_src/jak3/engine/level/level-info.gc b/goal_src/jak3/engine/level/level-info.gc index 4cf36ead21..640936f303 100644 --- a/goal_src/jak3/engine/level/level-info.gc +++ b/goal_src/jak3/engine/level/level-info.gc @@ -17725,7 +17725,7 @@ :index #x110 :task-level #x9 :master-level 'factorya - :level-flags (level-flags lf10 lf12 lf13) + :level-flags (level-flags use-camera-other lf12 lf13) :packages '() :run-packages '("common") :memory-mode (level-memory-mode borrow) @@ -17754,7 +17754,7 @@ :index #x111 :task-level #x9 :master-level 'factorya - :level-flags (level-flags lf10 lf12 lf13) + :level-flags (level-flags use-camera-other lf12 lf13) :packages '() :run-packages '("common") :memory-mode (level-memory-mode borrow) diff --git a/goal_src/jak3/engine/load/decomp.gc b/goal_src/jak3/engine/load/decomp.gc index eebe06cea5..4069aa1469 100644 --- a/goal_src/jak3/engine/load/decomp.gc +++ b/goal_src/jak3/engine/load/decomp.gc @@ -7,3 +7,500 @@ ;; DECOMP BEGINS +(defun unpack-comp-rle ((arg0 (pointer int8)) (arg1 (pointer int8))) + "Decompress data compressed with run-length encoding." + (local-vars (v1-2 int) (v1-3 uint)) + (nop!) + (loop + (loop + (set! v1-2 (-> arg1 0)) + (set! arg1 (&-> arg1 1)) + (b! (<= v1-2 0) cfg-5 :delay (nop!)) + (let ((a2-0 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (label cfg-3) + (nop!) + (nop!) + (nop!) + (nop!) + (set! (-> arg0 0) a2-0) + ) + (set! arg0 (&-> arg0 1)) + (b! (> v1-2 0) cfg-3 :delay (set! v1-2 (+ v1-2 -1))) + ) + (label cfg-5) + (b! (zero? v1-2) cfg-8 :delay (set! v1-3 (the-as uint (- v1-2)))) + (label cfg-6) + (let ((a2-1 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (nop!) + (nop!) + (set! (-> arg0 0) a2-1) + ) + (+! v1-3 -1) + (b! (> (the-as int v1-3) 0) cfg-6 :delay (set! arg0 (&-> arg0 1))) + ) + (label cfg-8) + arg1 + ) + +(deftype huf-dictionary-node (structure) + ((zero uint16) + (one uint16) + ) + ) + + +(defun unpack-comp-huf ((arg0 (pointer uint8)) (arg1 (pointer uint8)) (arg2 uint) (arg3 huf-dictionary-node)) + "Decompress data compressed with huffman encoding." + (local-vars (t1-1 uint) (t3-2 (pointer uint16))) + (nop!) + (let ((t1-0 (-> arg3 zero)) + (a2-1 (+ arg2 -1028)) + (t2-0 (-> arg3 one)) + ) + (nop!) + (label cfg-1) + (let ((v1-4 128)) + (nop!) + (let ((t0-0 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (label cfg-2) + (let ((t3-0 (logand t0-0 v1-4))) + (shift-arith-right-32 v1-4 v1-4 1) + (b! (zero? t3-0) cfg-4 :delay (set! t1-1 t1-0)) + ) + ) + (nop!) + (set! t1-1 t2-0) + (label cfg-4) + (let ((t2-1 (+ t1-1 -256))) + (let ((t3-1 (* t1-1 4))) + (b! (< (the-as int t2-1) 0) cfg-8 :delay (set! t3-2 (the-as (pointer uint16) (+ t3-1 a2-1)))) + ) + (b! (zero? t2-1) cfg-10 :delay (set! t1-0 (-> t3-2 0))) + ) + (b! (nonzero? v1-4) cfg-2 :delay (set! t2-0 (-> t3-2 1))) + (b! #t cfg-1 :delay (nop!)) + (label cfg-8) + (set! (-> arg0 0) t1-1) + (set! arg0 (&-> arg0 1)) + (nop!) + (set! t1-0 (-> arg3 zero)) + (b! (nonzero? v1-4) cfg-2 :delay (set! t2-0 (-> arg3 one))) + ) + ) + (b! #t cfg-1 :delay (nop!)) + (label cfg-10) + (nop!) + (nop!) + 0 + (none) + ) + +(defun unpack-comp-lzo ((arg0 (pointer uint8)) (arg1 (pointer uint8))) + "Decompress data compressed with LZO encoding." + 0 + (let ((v1-1 arg0)) + (b! (>= (the-as uint 17) (-> arg1 0)) cfg-5 :delay #f) + (let ((a2-4 (the-as int (+ (-> arg1 0) -17)))) + (set! arg1 (&-> arg1 1)) + (b! (< a2-4 4) cfg-41) + (until (<= a2-4 0) + (set! (-> arg0 0) (-> arg1 0)) + (set! arg0 (&-> arg0 1)) + (set! arg1 (&-> arg1 1)) + (+! a2-4 -1) + ) + (b! #t cfg-15 :delay (nop!)) + (label cfg-5) + (b! #t cfg-45 :delay (nop!)) + (label cfg-6) + (let ((a2-6 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (b! (>= (the-as int a2-6) 16) cfg-18) + (b! (nonzero? a2-6) cfg-12 :delay (empty-form)) + (while (zero? (-> arg1 0)) + (+! a2-6 255) + (set! arg1 (&-> arg1 1)) + ) + (set! a2-6 (+ (-> arg1 0) 15 a2-6)) + (set! arg1 (&-> arg1 1)) + (label cfg-12) + (set! (-> arg0 0) (-> arg1 0)) + (set! (-> arg0 1) (-> arg1 1)) + (set! (-> arg0 2) (-> arg1 2)) + (set! arg0 (&-> arg0 3)) + (set! arg1 (&-> arg1 3)) + (until (<= (the-as int a2-6) 0) + (set! (-> arg0 0) (-> arg1 0)) + (set! arg0 (&-> arg0 1)) + (set! arg1 (&-> arg1 1)) + (+! a2-6 -1) + ) + (label cfg-15) + (set! a2-6 (-> arg1 0)) + (set! arg1 (&-> arg1 1)) + (b! (>= (the-as int a2-6) 16) cfg-18) + (let ((a2-10 (the-as (pointer uint8) (&- (&- (&-> arg0 -2049) (the-as uint (/ (the-as int a2-6) 4))) (the-as uint (* (-> arg1 0) 4)))))) + (set! arg1 (&-> arg1 1)) + (set! (-> arg0 0) (-> a2-10 0)) + (set! (-> arg0 1) (-> a2-10 1)) + (set! (-> arg0 2) (-> a2-10 2)) + (set! arg0 (&-> arg0 3)) + (&-> a2-10 2) + ) + (b! #t cfg-39 :delay (nop!)) + (b! #t cfg-43 :delay (nop!)) + (label cfg-18) + (b! (< (the-as int a2-6) 64) cfg-20) + (let ((a3-23 + (the-as (pointer uint8) (&- (&- (&-> arg0 -1) (the-as uint (logand (/ (the-as int a2-6) 4) 7))) (the-as uint (* (-> arg1 0) 8)))) + ) + ) + (set! arg1 (&-> arg1 1)) + (let ((a2-13 (+ (/ (the-as int a2-6) 32) -1))) + (b! #t cfg-36 :delay (nop!)) + (label cfg-20) + (b! (< (the-as int a2-6) 32) cfg-27) + (set! a2-13 (the-as int (logand a2-6 31))) + (b! (nonzero? a2-13) cfg-26 :delay (empty-form)) + (b! #t cfg-24 :delay (nop!)) + (label cfg-23) + (+! a2-13 255) + (set! arg1 (&-> arg1 1)) + (label cfg-24) + (b! (zero? (-> arg1 0)) cfg-23 :delay (nop!)) + (set! a2-13 (the-as int (+ (-> arg1 0) 31 a2-13))) + (set! arg1 (&-> arg1 1)) + (label cfg-26) + (set! a3-23 (the-as (pointer uint8) (&- (&-> arg0 -1) (the-as uint (+ (shr (-> arg1 0) 2) (* (-> arg1 1) 64)))))) + (set! arg1 (&-> arg1 2)) + (b! #t cfg-36 :delay (nop!)) + (label cfg-27) + (b! (< (the-as int a2-6) 16) cfg-35) + (let ((a3-32 (the-as (pointer uint8) (&- arg0 (the-as uint (shl (logand a2-6 8) 11)))))) + (set! a2-13 (the-as int (logand a2-6 7))) + (b! (nonzero? a2-13) cfg-33 :delay (empty-form)) + (b! #t cfg-31 :delay (nop!)) + (label cfg-30) + (+! a2-13 255) + (set! arg1 (&-> arg1 1)) + (label cfg-31) + (b! (zero? (-> arg1 0)) cfg-30 :delay (nop!)) + (set! a2-13 (the-as int (+ (-> arg1 0) 7 a2-13))) + (set! arg1 (&-> arg1 1)) + (label cfg-33) + (let ((a3-33 (&- a3-32 (the-as uint (+ (shr (-> arg1 0) 2) (* (-> arg1 1) 64)))))) + (set! arg1 (&-> arg1 2)) + (b! (= a3-33 arg0) cfg-47 :delay (nop!)) + (set! a3-23 (&-> (the-as (pointer uint8) a3-33) -16384)) + ) + ) + (b! #t cfg-36 :delay (nop!)) + (label cfg-35) + (let ((a2-16 (the-as (pointer uint8) (&- (&- (&-> arg0 -1) (the-as uint (/ (the-as int a2-6) 4))) (the-as uint (* (-> arg1 0) 4)))))) + (set! arg1 (&-> arg1 1)) + (set! (-> arg0 0) (-> a2-16 0)) + (set! (-> arg0 1) (-> a2-16 1)) + (set! arg0 (&-> arg0 2)) + (&-> a2-16 1) + ) + (b! #t cfg-39 :delay (nop!)) + (label cfg-36) + (set! (-> arg0 0) (-> a3-23 0)) + (set! (-> arg0 1) (-> a3-23 1)) + (set! arg0 (&-> arg0 2)) + (let ((a3-39 (&-> a3-23 2))) + (until (<= (the-as int a2-13) 0) + (set! (-> arg0 0) (-> a3-39 0)) + (set! arg0 (&-> arg0 1)) + (set! a3-39 (&-> a3-39 1)) + (+! a2-13 -1) + ) + ) + ) + ) + (label cfg-39) + (set! a2-4 (the-as int (logand (-> arg1 -2) 3))) + (b! (zero? (the-as uint a2-4)) cfg-45 :delay (nop!)) + (until (<= a2-4 0) + (label cfg-41) + (set! (-> arg0 0) (-> arg1 0)) + (set! arg0 (&-> arg0 1)) + (set! arg1 (&-> arg1 1)) + (set! a2-4 (the-as int (+ (the-as uint a2-4) -1))) + ) + (set! a2-6 (-> arg1 0)) + ) + ) + (set! arg1 (&-> arg1 1)) + (label cfg-43) + (b! #t cfg-18 :delay (nop!)) + (label cfg-45) + (b! #t cfg-6 :delay (nop!)) + (label cfg-47) + (&- arg0 (the-as uint v1-1)) + ) + (none) + ) + +(defmethod update-vis! ((this level) (arg0 level-vis-info) (arg1 uint) (arg2 (pointer uint8))) + "Load/decompress precomputed visibility." + (local-vars (t0-3 uint128) (sv-16 int) (sv-32 (pointer int8))) + (let* ((a0-1 (-> arg0 from-bsp current-leaf-idx)) + (v1-1 (-> arg0 current-vis-string)) + (s3-0 (-> arg0 vis-string a0-1)) + ) + 0 + (+ #x70000000 0) + (+ 2048 #x70000000) + (b! (!= v1-1 s3-0) cfg-8 :delay (empty-form)) + (b! (not (logtest? (vis-info-flag loading) (-> arg0 flags))) cfg-6 :delay (empty-form)) + (if (check-busy *ramdisk-rpc*) + (return #f) + ) + (logclear! (-> arg0 flags) (vis-info-flag loading)) + (let ((s3-1 (the-as (pointer integer) (-> this vis-buffer)))) + (b! #t cfg-16 :delay (nop!)) + (label cfg-6) + (return #t) + (label cfg-8) + (when (logtest? (vis-info-flag loading) (-> arg0 flags)) + (if (check-busy *ramdisk-rpc*) + (return #f) + ) + (logclear! (-> arg0 flags) (vis-info-flag loading)) + ) + (set! (-> arg0 current-vis-string) s3-0) + (b! (logtest? (vis-info-flag in-iop) (-> arg0 flags)) cfg-15 :delay (empty-form)) + (set! s3-1 (&+ arg2 s3-0)) + (b! #t cfg-16 :delay (nop!)) + (label cfg-15) + (format 0 "ERROR: ramdisk vis for level ~A, this is not supported~%" (-> this name)) + (let ((v0-1 #f)) + (b! #t cfg-49 :delay (nop!)) + (label cfg-16) + (let ((s2-0 (the-as int (logand (vis-info-flag + dummy0 + dummy1 + dummy2 + dummy3 + dummy4 + dummy5 + dummy6 + dummy7 + dummy8 + dummy9 + dummy10 + dummy11 + dummy12 + dummy13 + dummy14 + dummy15 + dummy16 + dummy17 + dummy18 + dummy19 + dummy20 + dummy21 + dummy22 + dummy23 + dummy24 + dummy25 + dummy26 + dummy27 + dummy28 + ) + (-> arg0 flags) + ) + ) + ) + (s1-0 (&-> (the-as (pointer int8) #x70000000) 0)) + (s0-0 (the-as (pointer int8) (+ 2048 #x70000000))) + (s4-1 (-> this bsp visible-list-length)) + ) + (when (zero? (the-as vis-info-flag s2-0)) + (let ((v1-30 (/ (+ s4-1 15) 16))) + (dotimes (a0-19 v1-30) + (set! (-> (the-as (pointer int128) (&+ s1-0 (* a0-19 16)))) (the int128 0)) + ) + ) + (mem-copy! s1-0 (the-as (pointer uint8) s3-1) s4-1) + ) + (while (nonzero? s2-0) + (let ((v1-33 (logand s2-0 7))) + (cond + ((= v1-33 1) + (let ((v1-35 (/ (+ s4-1 15) 16))) + (dotimes (a0-23 v1-35) + (set! (-> (the-as (pointer int128) (&+ s1-0 (* a0-23 16)))) (the int128 0)) + ) + ) + (set! sv-16 (-> this bsp extra-vis-list-length)) + (set! sv-32 (&+ s1-0 (- s4-1 sv-16))) + (let ((v1-45 (unpack-vis (-> this bsp drawable-trees) s1-0 (the-as (pointer int8) s3-1)))) + (dotimes (a0-25 sv-16) + (let ((a1-9 (-> v1-45 0))) + (set! v1-45 (&-> v1-45 1)) + (set! (-> sv-32 0) a1-9) + ) + (set! sv-32 (&-> sv-32 1)) + ) + ) + #f + ) + ((= v1-33 2) + (unpack-comp-rle s1-0 (the-as (pointer int8) s3-1)) + ) + ((= v1-33 3) + (unpack-comp-huf + (the-as (pointer uint8) s1-0) + (the-as (pointer uint8) s3-1) + (-> arg0 dictionary) + (the-as huf-dictionary-node (+ (-> arg0 dictionary) (-> arg0 dictionary-length) -4)) + ) + ) + ((= v1-33 4) + (unpack-comp-lzo (the-as (pointer uint8) s1-0) (the-as (pointer uint8) s3-1)) + ) + ) + ) + (set! s3-1 s1-0) + (set! s1-0 s0-0) + (set! s0-0 (the-as (pointer int8) s3-1)) + (shift-arith-right-32 s2-0 s2-0 3) + ) + (let ((s2-1 (the-as (pointer uint8) s3-1)) + (s1-1 (-> this bsp all-visible-list)) + (v1-51 #f) + ) + (dotimes (s0-1 s4-1) + (when (!= (logand (-> s2-1 0) (-> s1-1 0)) (-> s2-1 0)) + (format #t "ERROR: illegal vis bits set [byte ~X] ~X -> ~X~%" s0-1 (-> s2-1 0) (-> s1-1 0)) + (set! v1-51 #t) + ) + (set! s2-1 (&-> s2-1 1)) + (set! s1-1 (&-> s1-1 1)) + ) + (when v1-51 + (format #t "src = #x~x dest = #x~x ~s ~s~%" s3-1 (-> arg0 vis-bits) (-> arg0 level) (-> arg0 from-level)) + (format #t "leaf-index = ~d~%" (-> arg0 from-bsp current-leaf-idx)) + 0 + ) + ) + (let ((v1-55 s3-1) + (a0-42 (the-as object (-> arg0 vis-bits))) + (a1-22 (the-as (pointer uinteger) (-> this bsp all-visible-list))) + (a2-11 (/ (+ s4-1 15) 16)) + ) + (dotimes (a3-6 a2-11) + (let ((t0-2 (-> (the-as (pointer uint128) v1-55) 0)) + (t1-1 (-> (the-as (pointer uint128) a1-22) 0)) + ) + (.pand t0-3 t0-2 t1-1) + ) + (set! (-> (the-as (pointer uint128) a0-42) 0) t0-3) + (set! a0-42 (+ (the-as uint a0-42) 16)) + (set! v1-55 (&-> (the-as (pointer uint8) v1-55) 16)) + (set! a1-22 (&-> (the-as (pointer uint8) a1-22) 16)) + ) + ) + ) + (set! v0-1 #t) + (label cfg-49) + v0-1 + ) + ) + ) + ) + +;; WARN: Return type mismatch int vs (pointer uint8). +(defun pack-comp-rle ((arg0 (pointer uint8)) (arg1 (pointer uint8)) (arg2 int) (arg3 int)) + "Compress data, used for map mask stuff." + (let ((s4-0 0)) + 0 + (while (and (> arg2 0) (< (+ s4-0 131) arg3)) + (cond + ((= (-> arg1 0) (-> arg1 1)) + (let ((v1-2 (-> arg1 0))) + (set! arg1 (&-> arg1 2)) + (let ((a0-2 2)) + (+! arg2 -2) + (while (> arg2 0) + (cond + ((= v1-2 (-> arg1 0)) + (+! a0-2 1) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + (if (>= a0-2 128) + (goto cfg-12) + ) + ) + (else + (goto cfg-12) + ) + ) + ) + (label cfg-12) + (set! (-> arg0 0) (the-as uint (+ a0-2 -1))) + ) + (set! (-> arg0 1) v1-2) + ) + (set! arg0 (&-> arg0 2)) + (+! s4-0 2) + ) + (else + (let ((a0-4 arg1) + (v1-4 1) + ) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + (while (< 1 arg2) + (when (and (= (-> arg1 0) (-> arg1 1)) (< 2 arg2)) + (if (= (-> arg1 0) (-> arg1 2)) + (goto cfg-26) + ) + ) + (+! v1-4 1) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + (if (>= v1-4 127) + (goto cfg-26) + ) + ) + (label cfg-26) + (when (= arg2 1) + (+! v1-4 1) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + ) + (set! (-> arg0 0) (the-as uint (- v1-4))) + (let ((a1-21 (&-> arg0 1)) + (a2-4 (+ s4-0 1)) + ) + (dotimes (t0-0 v1-4) + (set! (-> a1-21 t0-0) (-> a0-4 t0-0)) + ) + (set! arg0 (&+ a1-21 v1-4)) + (set! s4-0 (+ a2-4 v1-4)) + ) + ) + ) + ) + ) + (if (< arg3 (+ s4-0 131)) + (format 0 "(GOMI) Warning: May have run out of bigmap bit mask compression memory~%") + ) + (when (= arg2 1) + (set! (-> arg0 0) (the-as uint -1)) + (set! (-> arg0 1) (-> arg1 0)) + (set! arg0 (&-> arg0 2)) + (+! s4-0 2) + (&-> arg1 1) + ) + (set! (-> arg0 0) (the-as uint 0)) + (&-> arg0 1) + (the-as (pointer uint8) (+ s4-0 1)) + ) + ) diff --git a/test/decompiler/reference/jak3/decompiler-macros.gc b/test/decompiler/reference/jak3/decompiler-macros.gc index 532e548ff4..07ff54d1e8 100644 --- a/test/decompiler/reference/jak3/decompiler-macros.gc +++ b/test/decompiler/reference/jak3/decompiler-macros.gc @@ -1555,3 +1555,29 @@ ) ) ) + +(defmacro defmethod-mips2c (name method-id method-type) + "Define a mips2c method." + `(method-set! ,method-type ,method-id (__pc-get-mips2c ,name)) + ) + +(defconstant GIF_REGS_ALL_AD + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id a+d) + :regs1 (gif-reg-id a+d) + :regs2 (gif-reg-id a+d) + :regs3 (gif-reg-id a+d) + :regs4 (gif-reg-id a+d) + :regs5 (gif-reg-id a+d) + :regs6 (gif-reg-id a+d) + :regs7 (gif-reg-id a+d) + :regs8 (gif-reg-id a+d) + :regs9 (gif-reg-id a+d) + :regs10 (gif-reg-id a+d) + :regs11 (gif-reg-id a+d) + :regs12 (gif-reg-id a+d) + :regs13 (gif-reg-id a+d) + :regs14 (gif-reg-id a+d) + :regs15 (gif-reg-id a+d) + ) + ) \ No newline at end of file diff --git a/test/decompiler/reference/jak3/engine/camera/cam-update_REF.gc b/test/decompiler/reference/jak3/engine/camera/cam-update_REF.gc index d76e0b801a..73b5aa312c 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-update_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/cam-update_REF.gc @@ -683,7 +683,7 @@ (defun-debug move-level-by-name ((arg0 symbol) (arg1 float) (arg2 float) (arg3 float)) (let ((v1-1 (level-get *level* arg0))) (when v1-1 - (logior! (-> v1-1 info level-flags) (level-flags lf10)) + (logior! (-> v1-1 info level-flags) (level-flags use-camera-other)) (let ((v0-1 (-> *math-camera* trans-other))) (set! (-> v0-1 x) (* 4096.0 arg1)) (set! (-> v0-1 y) (* 4096.0 arg2)) @@ -714,7 +714,3 @@ ) 0 ) - - - - diff --git a/test/decompiler/reference/jak3/engine/data/font-data_REF.gc b/test/decompiler/reference/jak3/engine/data/font-data_REF.gc new file mode 100644 index 0000000000..6c3147e3e1 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/data/font-data_REF.gc @@ -0,0 +1,516 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *font12-table*, type (inline-array vector) +(define *font12-table* (new 'static 'inline-array vector 250 + (new 'static 'vector :x 0.0039 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.1914 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.2851 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.4726 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.6601 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.7539 :y 0.0322 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.8476 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.0634 :z 1.0 :w 22.5) + (new 'static 'vector :x 0.1914 :y 0.0634 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.2851 :y 0.0634 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.3789 :y 0.0634 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.0634 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.6601 :y 0.0634 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.7539 :y 0.0634 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.8476 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.0947 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.0976 :y 0.0947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.1914 :y 0.0947 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.2851 :y 0.0947 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.3789 :y 0.0947 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.0947 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.5664 :y 0.0947 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.0947 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.7539 :y 0.0947 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.8476 :y 0.0947 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0039 :y 0.1259 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.0976 :y 0.1259 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.1914 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.2851 :y 0.1259 :z 1.0 :w 11.25) + (new 'static 'vector :x 0.3789 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.4726 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.5664 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.6601 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.7539 :y 0.1259 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.8476 :y 0.1259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0039 :y 0.1572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.1572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.1914 :y 0.1572 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.2851 :y 0.1572 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.3789 :y 0.1572 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.1572 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.5664 :y 0.1572 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.1572 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.7539 :y 0.1572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.8476 :y 0.1572 :z 1.0 :w 17.25) + (new 'static 'vector :x 0.0039 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.1884 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.1914 :y 0.1884 :z 1.0 :w 15.75) + (new 'static 'vector :x 0.2851 :y 0.1884 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.3789 :y 0.1884 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.4726 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.1884 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.6601 :y 0.1884 :z 1.0 :w 7.5) + (new 'static 'vector :x 0.7539 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.8476 :y 0.1884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.2197 :z 1.0 :w 15.75) + (new 'static 'vector :x 0.0976 :y 0.2197 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.1914 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.2851 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.2197 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.2197 :z 1.0 :w 15.75) + (new 'static 'vector :x 0.6601 :y 0.2197 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.7539 :y 0.2197 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.8476 :y 0.2197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.2509 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0976 :y 0.2509 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.1914 :y 0.2509 :z 1.0 :w 17.25) + (new 'static 'vector :x 0.2851 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.3789 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.2509 :z 1.0 :w 9.0) + (new 'static 'vector :x 0.5664 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.6601 :y 0.2509 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.7539 :y 0.2509 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.8476 :y 0.2509 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0039 :y 0.2822 :z 1.0 :w 6.0) + (new 'static 'vector :x 0.0976 :y 0.2822 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.1914 :y 0.2822 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.2851 :y 0.2822 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.3789 :y 0.2822 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.2822 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.5664 :y 0.2822 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.6601 :y 0.2822 :z 1.0 :w 17.25) + (new 'static 'vector :x 0.7539 :y 0.2822 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.8476 :y 0.2822 :z 1.0 :w 9.0) + (new 'static 'vector :x 0.0039 :y 0.3134 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0976 :y 0.3134 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.1914 :y 0.3134 :z 1.0 :w 9.75) + (new 'static 'vector :x 0.2851 :y 0.3134 :z 1.0 :w 18.5) + (new 'static 'vector :x 0.3789 :y 0.3134 :z 1.0 :w 14.25) + (new 'static 'vector :x 0.4726 :y 0.3134 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.5664 :y 0.3134 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.6601 :y 0.3134 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.7539 :y 0.3134 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.8476 :y 0.3134 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.0039 :y 0.3447 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0976 :y 0.3447 :z 1.0 :w 12.75) + (new 'static 'vector :x 0.1914 :y 0.3447 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.2851 :y 0.3447 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.3789 :y 0.3447 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.4726 :y 0.3447 :z 1.0 :w 16.5) + (new 'static 'vector :x 0.5664 :y 0.3447 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.3447 :z 1.0 :w 10.5) + (new 'static 'vector :x 0.7539 :y 0.3447 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.3447 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0039 :y 0.3759 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.0976 :y 0.3759 :z 1.0 :w 13.5) + (new 'static 'vector :x 0.1914 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.3759 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.4072 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.4384 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.4697 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5634 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.6259 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.7509 :z 1.0 :w 16.0) + ) + ) + +;; definition for symbol *font24-table*, type (inline-array vector) +(define *font24-table* (new 'static 'inline-array vector 250 + (new 'static 'vector :x 0.0039 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.0009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0976 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.1914 :y 0.0322 :z 1.0 :w 19.5) + (new 'static 'vector :x 0.2851 :y 0.0322 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.4726 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.5664 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.0322 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.7539 :y 0.0322 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.8476 :y 0.0322 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.0039 :y 0.0634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.0634 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.1914 :y 0.0634 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.2851 :y 0.0634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.0634 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.4726 :y 0.0634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.0634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.6601 :y 0.0634 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.7539 :y 0.0634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.8476 :y 0.0634 :z 1.0 :w 17.5) + (new 'static 'vector :x 0.0039 :y 0.0947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.0947 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.1914 :y 0.0947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.0947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.0947 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.4726 :y 0.0947 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.5664 :y 0.0947 :z 1.0 :w 22.5) + (new 'static 'vector :x 0.6601 :y 0.0947 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.0947 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.8476 :y 0.0947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.1259 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.0976 :y 0.1259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.1914 :y 0.1259 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.1259 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.3789 :y 0.1259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.4726 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.5664 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.6601 :y 0.1259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.8476 :y 0.1259 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.0039 :y 0.1572 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.0976 :y 0.1572 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.1914 :y 0.1572 :z 1.0 :w 11.0) + (new 'static 'vector :x 0.2851 :y 0.1572 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.3789 :y 0.1572 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.4726 :y 0.1572 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.5664 :y 0.1572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.1572 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.1572 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.8476 :y 0.1572 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.0039 :y 0.1884 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.0976 :y 0.1884 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.1914 :y 0.1884 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.2851 :y 0.1884 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.3789 :y 0.1884 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.4726 :y 0.1884 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.5664 :y 0.1884 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.6601 :y 0.1884 :z 1.0 :w 10.0) + (new 'static 'vector :x 0.7539 :y 0.1884 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.8476 :y 0.1884 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.2197 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.2197 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.1914 :y 0.2197 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.2851 :y 0.2197 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.3789 :y 0.2197 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.4726 :y 0.2197 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.5664 :y 0.2197 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.6601 :y 0.2197 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.7539 :y 0.2197 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.8476 :y 0.2197 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.0039 :y 0.2509 :z 1.0 :w 26.0) + (new 'static 'vector :x 0.0976 :y 0.2509 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.1914 :y 0.2509 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.2851 :y 0.2509 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.3789 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.2509 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.2509 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.8476 :y 0.2509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.2822 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.1914 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.2851 :y 0.2822 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.2822 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.5664 :y 0.2822 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.6601 :y 0.2822 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.7539 :y 0.2822 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.8476 :y 0.2822 :z 1.0 :w 10.0) + (new 'static 'vector :x 0.0039 :y 0.3134 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.3134 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.1914 :y 0.3134 :z 1.0 :w 10.0) + (new 'static 'vector :x 0.2851 :y 0.3134 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.3789 :y 0.3134 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.4726 :y 0.3134 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.5664 :y 0.3134 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.3134 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.7539 :y 0.3134 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.3134 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.0039 :y 0.3447 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.3447 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.1914 :y 0.3447 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.2851 :y 0.3447 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.3789 :y 0.3447 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.4726 :y 0.3447 :z 1.0 :w 23.0) + (new 'static 'vector :x 0.5664 :y 0.3447 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.6601 :y 0.3447 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.3447 :z 1.0 :w 27.0) + (new 'static 'vector :x 0.8476 :y 0.3447 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.3759 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.4072 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.4384 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.1914 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.2851 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.3789 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.4697 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.5664 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.8476 :y 0.5009 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0039 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.1914 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.5322 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.4726 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.5664 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.6601 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.7539 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.5322 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.5634 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.0976 :y 0.5634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.1914 :y 0.5634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.2851 :y 0.5634 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.5634 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.4726 :y 0.5634 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.5664 :y 0.5634 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.6601 :y 0.5634 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.7539 :y 0.5634 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.8476 :y 0.5634 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.5947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.0976 :y 0.5947 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.1914 :y 0.5947 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.2851 :y 0.5947 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.3789 :y 0.5947 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.4726 :y 0.5947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.5664 :y 0.5947 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.6601 :y 0.5947 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.7539 :y 0.5947 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.8476 :y 0.5947 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0039 :y 0.6259 :z 1.0 :w 19.0) + (new 'static 'vector :x 0.0976 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.1914 :y 0.6259 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.2851 :y 0.6259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.3789 :y 0.6259 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.4726 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.5664 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.6601 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.7539 :y 0.6259 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.8476 :y 0.6259 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.0039 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.6572 :z 1.0 :w 25.0) + (new 'static 'vector :x 0.1914 :y 0.6572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.2851 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.6572 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.5664 :y 0.6572 :z 1.0 :w 12.0) + (new 'static 'vector :x 0.6601 :y 0.6572 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.7539 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.8476 :y 0.6572 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.6884 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.0976 :y 0.6884 :z 1.0 :w 13.0) + (new 'static 'vector :x 0.1914 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.2851 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.3789 :y 0.6884 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.4726 :y 0.6884 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.5664 :y 0.6884 :z 1.0 :w 18.0) + (new 'static 'vector :x 0.6601 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.7539 :y 0.6884 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.8476 :y 0.6884 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.0039 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.0976 :y 0.7197 :z 1.0 :w 13.0) + (new 'static 'vector :x 0.1914 :y 0.7197 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.2851 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.3789 :y 0.7197 :z 1.0 :w 22.0) + (new 'static 'vector :x 0.4726 :y 0.7197 :z 1.0 :w 14.0) + (new 'static 'vector :x 0.5664 :y 0.7197 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7197 :z 1.0 :w 15.0) + (new 'static 'vector :x 0.7539 :y 0.7197 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.8476 :y 0.7197 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.0039 :y 0.7509 :z 1.0 :w 20.0) + (new 'static 'vector :x 0.0976 :y 0.7509 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.1914 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.2851 :y 0.7509 :z 1.0 :w 13.0) + (new 'static 'vector :x 0.3789 :y 0.7509 :z 1.0 :w 21.0) + (new 'static 'vector :x 0.4726 :y 0.7509 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.5664 :y 0.7509 :z 1.0 :w 16.0) + (new 'static 'vector :x 0.6601 :y 0.7509 :z 1.0 :w 17.0) + (new 'static 'vector :x 0.7539 :y 0.7509 :z 1.0 :w 24.0) + (new 'static 'vector :x 0.8476 :y 0.7509 :z 1.0 :w 24.0) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/draw/draw-node_REF.gc b/test/decompiler/reference/jak3/engine/draw/draw-node_REF.gc new file mode 100644 index 0000000000..037a5a37cc --- /dev/null +++ b/test/decompiler/reference/jak3/engine/draw/draw-node_REF.gc @@ -0,0 +1,64 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 16 of type draw-node +;; WARN: Return type mismatch int vs none. +(defmethod collect-regions ((this draw-node) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) + "Fill the region-prim-list with regions that intersect the sphere." + (dotimes (s2-0 arg1) + (if (spheres-overlap? arg0 (the-as sphere (-> this bsphere))) + (collect-regions (-> this child) arg0 (the-as int (-> this child-count)) arg2) + ) + (&+! this 32) + ) + 0 + (none) + ) + +;; definition for method 3 of type drawable-inline-array-node +(defmethod inspect ((this drawable-inline-array-node)) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~Tlength: ~D~%" (-> this length)) + (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) + (dotimes (s5-0 (-> this length)) + (format #t "~T [~D] ~A~%" s5-0 (-> this data s5-0)) + ) + this + ) + +;; definition for method 8 of type drawable-inline-array-node +(defmethod mem-usage ((this drawable-inline-array-node) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 65 (-> usage length))) + (set! (-> usage data 64 name) "draw-node") + (+! (-> usage data 64 count) (-> this length)) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 64 used) v1-6) + (+! (-> usage data 64 total) (logand -16 (+ v1-6 15))) + ) + this + ) + +;; definition for method 5 of type drawable-inline-array-node +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this drawable-inline-array-node)) + (the-as int (+ (-> drawable-inline-array-node size) (* (+ (-> this length) -1) 32))) + ) + +;; definition for method 16 of type drawable-inline-array-node +;; WARN: Return type mismatch int vs none. +(defmethod collect-regions ((this drawable-inline-array-node) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) + "Fill the region-prim-list with regions that intersect the sphere." + (collect-regions (the-as draw-node (-> this data)) arg0 (-> this length) arg2) + 0 + (none) + ) + +;; definition for function draw-node-cull +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/background/background_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/background_REF.gc new file mode 100644 index 0000000000..ccd3380b71 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/background_REF.gc @@ -0,0 +1,623 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *background-work*, type background-work +(define *background-work* (new 'global 'background-work)) + +;; definition for symbol background-vu0-block, type vu-function +(define background-vu0-block (new 'static 'vu-function :length 59 :qlength 30)) + +;; definition for function background-upload-vu0 +;; WARN: Return type mismatch int vs none. +(defun background-upload-vu0 () + "Upload VU0 functions for background. (believed unused?)" + (upload-vu0-program background-vu0-block (&-> *background-work* wait-to-vu0)) + 0 + (none) + ) + +;; definition for function init-background +;; WARN: Return type mismatch int vs none. +(defun init-background () + "Reset lists of trees to draw for background rendering." + (dotimes (v1-0 8) + (set! (-> *background-work* tfrag-trees v1-0) #f) + (set! (-> *background-work* tfrag-trans-trees v1-0) #f) + (set! (-> *background-work* tfrag-water-trees v1-0) #f) + ) + (set! (-> *background-work* tfrag-tree-count) 0) + (set! (-> *background-work* tfrag-trans-tree-count) 0) + (set! (-> *background-work* tfrag-water-tree-count) 0) + (set! (-> *background-work* shrub-tree-count) 0) + (set! (-> *background-work* tie-tree-count) 0) + (set! (-> *background-work* wait-to-vu0) (the-as uint 0)) + 0 + (none) + ) + +;; definition for function upload-vis-bits +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun upload-vis-bits ((arg0 level) (arg1 level) (arg2 bsp-header)) + "Upload vis data to the scratchpad." + (let ((v1-2 (/ (+ (-> arg2 visible-list-length) 15) 16))) + (let ((a0-1 (-> arg0 vis-bits)) + (a1-1 (the-as (pointer uinteger) (-> arg2 all-visible-list))) + (a2-2 (the-as (pointer uint128) (+ #x3800 #x70000000))) + ) + (b! (not *artist-flip-visible*) cfg-5 :delay (nop!)) + (nop!) + (nop!) + (label cfg-2) + (let ((a3-2 (-> (the-as (pointer uint128) a0-1)))) + (&+! a0-1 16) + (let ((t0-0 (-> (the-as (pointer uint128) a1-1) 0))) + (set! a1-1 (&-> (the-as (pointer uint8) a1-1) 16)) + (nop!) + (nop!) + (let ((a3-3 (logxor a3-2 (the-as uint t0-0)))) + (+! v1-2 -1) + (set! (-> a2-2 0) a3-3) + ) + ) + ) + (set! a2-2 (&-> a2-2 1)) + (b! (> v1-2 0) cfg-2 :delay (nop!)) + 0 + (b! #t cfg-8 :delay (nop!)) + (nop!) + (label cfg-5) + (nop!) + (nop!) + (label cfg-6) + (let ((a1-2 (-> (the-as (pointer uint128) a0-1)))) + (&+! a0-1 16) + (nop!) + (+! v1-2 -1) + (set! (-> a2-2 0) a1-2) + ) + (set! a2-2 (&-> a2-2 1)) + ) + (b! (> v1-2 0) cfg-6 :delay (nop!)) + ) + 0 + (label cfg-8) + (none) + ) + +;; definition for function set-background-regs! +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function set-tie-quard-planes! +;; INFO: Used lq/sq +;; WARN: Return type mismatch plane vs none. +(defun set-tie-quard-planes! ((arg0 level)) + "Set up TIE work guard planes." + (cond + ((logtest? (-> arg0 info level-flags) (level-flags use-camera-other)) + (set! (-> *instance-tie-work* guard-plane 0 quad) (-> *math-camera* guard-plane-other 0 quad)) + (set! (-> *instance-tie-work* guard-plane 1 quad) (-> *math-camera* guard-plane-other 1 quad)) + (set! (-> *instance-tie-work* guard-plane 2 quad) (-> *math-camera* guard-plane-other 2 quad)) + (set! (-> *instance-tie-work* guard-plane 3 quad) (-> *math-camera* guard-plane-other 3 quad)) + ) + (else + (set! (-> *instance-tie-work* guard-plane 0 quad) (-> *math-camera* guard-plane 0 quad)) + (set! (-> *instance-tie-work* guard-plane 1 quad) (-> *math-camera* guard-plane 1 quad)) + (set! (-> *instance-tie-work* guard-plane 2 quad) (-> *math-camera* guard-plane 2 quad)) + (set! (-> *instance-tie-work* guard-plane 3 quad) (-> *math-camera* guard-plane 3 quad)) + ) + ) + (none) + ) + +;; definition for function set-shrub-quard-planes! +;; INFO: Used lq/sq +;; WARN: Return type mismatch plane vs none. +(defun set-shrub-quard-planes! ((arg0 level)) + "Set shrub work guard planes." + (cond + ((logtest? (-> arg0 info level-flags) (level-flags use-camera-other)) + (set! (-> *instance-shrub-work* guard-plane 0 quad) (-> *math-camera* guard-plane-other 0 quad)) + (set! (-> *instance-shrub-work* guard-plane 1 quad) (-> *math-camera* guard-plane-other 1 quad)) + (set! (-> *instance-shrub-work* guard-plane 2 quad) (-> *math-camera* guard-plane-other 2 quad)) + (set! (-> *instance-shrub-work* guard-plane 3 quad) (-> *math-camera* guard-plane-other 3 quad)) + ) + (else + (set! (-> *instance-shrub-work* guard-plane 0 quad) (-> *math-camera* guard-plane 0 quad)) + (set! (-> *instance-shrub-work* guard-plane 1 quad) (-> *math-camera* guard-plane 1 quad)) + (set! (-> *instance-shrub-work* guard-plane 2 quad) (-> *math-camera* guard-plane 2 quad)) + (set! (-> *instance-shrub-work* guard-plane 3 quad) (-> *math-camera* guard-plane 3 quad)) + ) + ) + (none) + ) + +;; definition for function set-subdivide-settings! +(defun set-subdivide-settings! ((arg0 level)) + "Set subdivide settings from the level." + (if *artist-use-menu-subdiv* + (update-subdivide-settings! *subdivide-settings* *math-camera* 11) + (update-subdivide-settings! *subdivide-settings* *math-camera* (-> arg0 index)) + ) + (none) + ) + +;; definition for function finish-background +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: Function finish-background has a return type of none, but the expression builder found a return statement. +(defun finish-background () + "Run all renderers for background data added." + (if (get-menu-mode *blit-displays-work*) + (return #f) + ) + (when (not (paused?)) + (flush-cache 0) + (dotimes (gp-0 (-> *level* length)) + (let ((v1-8 (-> *level* level gp-0))) + (when (= (-> v1-8 status) 'active) + (-> v1-8 bsp wind-array) + (if (nonzero? (-> v1-8 bsp wind-array-length)) + (level-update-wind *wind-work*) + ) + ) + ) + ) + ) + (background-upload-vu0) + (dotimes (v1-14 (-> *level* length)) + (let ((a0-12 (-> *level* level v1-14))) + (when (= (-> a0-12 status) 'active) + (let ((a0-13 (-> a0-12 bsp))) + (when (nonzero? (-> a0-13 tfrag-masks)) + (dotimes (a1-7 (-> a0-13 tfrag-masks length)) + (set! (-> a0-13 tfrag-closest a1-7) 4095996000.0) + ) + ) + (when (nonzero? (-> a0-13 shrub-masks)) + (dotimes (a1-12 (-> a0-13 shrub-masks length)) + (set! (-> a0-13 shrub-closest a1-12) 4095996000.0) + ) + ) + (when (nonzero? (-> a0-13 alpha-masks)) + (dotimes (a1-17 (-> a0-13 alpha-masks length)) + (set! (-> a0-13 alpha-closest a1-17) 4095996000.0) + ) + ) + (when (nonzero? (-> a0-13 water-masks)) + (dotimes (a1-22 (-> a0-13 water-masks length)) + (set! (-> a0-13 water-closest a1-22) 4095996000.0) + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> *background-work* shrub-tree-count)) + (when *debug-segment* + (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-27 'shrubbery) + (s5-0 *profile-shrubbery-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s4-0 (-> gp-1 data (-> gp-1 count)))) + (let ((s3-0 (-> gp-1 base-time))) + (set! (-> s4-0 name) v1-27) + (set! (-> s4-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0)))) + ) + (set! (-> s4-0 depth) (the-as uint (-> gp-1 depth))) + (set! (-> s4-0 color) s5-0) + (set! (-> gp-1 segment (-> gp-1 depth)) s4-0) + ) + (set! (-> gp-1 count) (min 1023 (+ (-> gp-1 count) 1))) + (+! (-> gp-1 depth) 1) + (set! (-> gp-1 max-depth) (max (-> gp-1 max-depth) (-> gp-1 depth))) + ) + ) + 0 + ) + (dotimes (gp-2 (-> *background-work* shrub-tree-count)) + (set! *draw-index* (-> *background-work* shrub-levels gp-2 draw-index)) + (flush-cache 0) + (let ((s5-1 (-> *background-work* shrub-trees gp-2)) + (s4-1 (-> *background-work* shrub-levels gp-2)) + ) + (if (nonzero? (-> s5-1 colors-added)) + (time-of-day-interp-colors + (-> *instance-shrub-work* colors) + (the-as uint (-> s5-1 colors-added)) + (-> s4-1 mood-context) + ) + ) + (set-background-regs! s4-1) + (set-shrub-quard-planes! s4-1) + (draw-drawable-tree-instance-shrub s5-1 s4-1) + ) + ) + (when *debug-segment* + (let ((gp-3 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-68 (+ (-> gp-3 depth) -1)) + (s5-2 (-> gp-3 segment v1-68)) + (s4-2 (-> gp-3 base-time)) + ) + (when (>= v1-68 0) + (set! (-> s5-2 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) + (+! (-> gp-3 depth) -1) + ) + ) + ) + ) + 0 + ) + ) + (let ((gp-4 (the-as level #f))) + (when (or (nonzero? (-> *background-work* tfrag-tree-count)) + (nonzero? (-> *background-work* tfrag-trans-tree-count)) + (nonzero? (-> *background-work* tfrag-water-tree-count)) + ) + (let ((s5-5 (max + (max (-> *background-work* tfrag-tree-count) (-> *background-work* tfrag-trans-tree-count)) + (-> *background-work* tfrag-water-tree-count) + ) + ) + (s4-3 (the-as time-of-day-palette #f)) + ) + (when *debug-segment* + (let ((s3-1 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-94 'tfrag) + (s2-0 *profile-tfrag-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s1-0 (-> s3-1 data (-> s3-1 count)))) + (let ((s0-0 (-> s3-1 base-time))) + (set! (-> s1-0 name) v1-94) + (set! (-> s1-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s0-0)))) + ) + (set! (-> s1-0 depth) (the-as uint (-> s3-1 depth))) + (set! (-> s1-0 color) s2-0) + (set! (-> s3-1 segment (-> s3-1 depth)) s1-0) + ) + (set! (-> s3-1 count) (min 1023 (+ (-> s3-1 count) 1))) + (+! (-> s3-1 depth) 1) + (set! (-> s3-1 max-depth) (max (-> s3-1 max-depth) (-> s3-1 depth))) + ) + ) + 0 + ) + (dotimes (s3-2 s5-5) + (let ((s2-1 (-> *background-work* tfrag-trees s3-2))) + (when s2-1 + (let ((s1-1 (-> *background-work* tfrag-levels s3-2))) + (let ((a2-23 (-> s1-1 bsp)) + (s0-1 (-> s2-1 time-of-day-pal)) + ) + (upload-vis-bits s1-1 gp-4 a2-23) + (set-subdivide-settings! s1-1) + (when (not (or (zero? s0-1) (= s4-3 s0-1))) + (flush-cache 0) + (time-of-day-interp-colors-scratch (the-as (pointer rgba) (+ 6144 #x70000000)) s0-1 (-> s1-1 mood-context)) + (set! s4-3 s0-1) + ) + ) + (set! *draw-index* (-> s1-1 draw-index)) + (set! (-> *tfrag-work* min-dist z) 4095996000.0) + (set-background-regs! s1-1) + ) + (draw-drawable-tree-tfrag s2-1) + (set! (-> *level* draw-level *draw-index* closest-object 0) (-> *tfrag-work* min-dist z)) + ) + ) + (let ((s2-2 (-> *background-work* tfrag-trans-trees s3-2))) + (when s2-2 + (let ((s1-2 (-> *background-work* tfrag-trans-levels s3-2))) + (let ((a2-25 (-> s1-2 bsp)) + (s0-2 (-> s2-2 time-of-day-pal)) + ) + (upload-vis-bits s1-2 gp-4 a2-25) + (set-subdivide-settings! s1-2) + (when (not (or (zero? s0-2) (= s4-3 s0-2))) + (flush-cache 0) + (time-of-day-interp-colors-scratch (the-as (pointer rgba) (+ 6144 #x70000000)) s0-2 (-> s1-2 mood-context)) + (set! s4-3 s0-2) + ) + ) + (set! *draw-index* (-> s1-2 draw-index)) + (set! (-> *tfrag-work* min-dist z) 4095996000.0) + (set-background-regs! s1-2) + ) + (draw-drawable-tree-tfrag-trans s2-2) + (set! (-> *level* draw-level *draw-index* closest-object 3) (-> *tfrag-work* min-dist z)) + ) + ) + (let ((s2-3 (-> *background-work* tfrag-water-trees s3-2))) + (when s2-3 + (let ((s1-3 (-> *background-work* tfrag-water-levels s3-2))) + (let ((a2-27 (-> s1-3 bsp)) + (s0-3 (-> s2-3 time-of-day-pal)) + ) + (upload-vis-bits s1-3 gp-4 a2-27) + (set-subdivide-settings! s1-3) + (when (not (or (zero? s0-3) (= s4-3 s0-3))) + (flush-cache 0) + (time-of-day-interp-colors-scratch (the-as (pointer rgba) (+ 6144 #x70000000)) s0-3 (-> s1-3 mood-context)) + (set! s4-3 s0-3) + ) + ) + (set! *draw-index* (-> s1-3 draw-index)) + (set! (-> *tfrag-work* min-dist z) 4095996000.0) + (set-background-regs! s1-3) + ) + (draw-drawable-tree-tfrag-water s2-3) + (set! (-> *level* draw-level *draw-index* closest-object 4) (-> *tfrag-work* min-dist z)) + ) + ) + ) + ) + (when *debug-segment* + (let ((s5-6 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-174 (+ (-> s5-6 depth) -1)) + (s4-4 (-> s5-6 segment v1-174)) + (s3-3 (-> s5-6 base-time)) + ) + (when (>= v1-174 0) + (set! (-> s4-4 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-3)))) + (+! (-> s5-6 depth) -1) + ) + ) + ) + ) + 0 + ) + ) + (when (nonzero? (-> *background-work* tie-tree-count)) + (set! (-> *instance-tie-work* tod-env-color quad) (-> *time-of-day-context* current-env-color quad)) + (when *debug-segment* + (let ((s5-7 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-192 'tie) + (s4-5 *profile-tie-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s3-4 (-> s5-7 data (-> s5-7 count)))) + (let ((s2-4 (-> s5-7 base-time))) + (set! (-> s3-4 name) v1-192) + (set! (-> s3-4 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s2-4)))) + ) + (set! (-> s3-4 depth) (the-as uint (-> s5-7 depth))) + (set! (-> s3-4 color) s4-5) + (set! (-> s5-7 segment (-> s5-7 depth)) s3-4) + ) + (set! (-> s5-7 count) (min 1023 (+ (-> s5-7 count) 1))) + (+! (-> s5-7 depth) 1) + (set! (-> s5-7 max-depth) (max (-> s5-7 max-depth) (-> s5-7 depth))) + ) + ) + 0 + ) + (dotimes (s5-8 (-> *background-work* tie-tree-count)) + (let ((s4-6 (-> *background-work* tie-levels s5-8))) + (let ((a2-29 (-> s4-6 bsp))) + (when (!= s4-6 gp-4) + (set! (-> *instance-tie-work* min-dist x) 4095996000.0) + (upload-vis-bits s4-6 gp-4 a2-29) + (set-subdivide-settings! s4-6) + (set! gp-4 s4-6) + ) + ) + (set! *draw-index* (-> s4-6 draw-index)) + (set! (-> *prototype-tie-work* mood) (-> s4-6 mood-context)) + (set-background-regs! s4-6) + (set-tie-quard-planes! s4-6) + (tie-scissor-make-perspective-matrix + (-> *instance-tie-work* tie-scissor-perspective-matrix) + (if (logtest? (-> s4-6 info level-flags) (level-flags use-camera-other)) + (-> *math-camera* camera-temp-other) + (-> *math-camera* camera-temp) + ) + ) + (draw-drawable-tree-instance-tie (-> *background-work* tie-trees s5-8) s4-6) + ) + (set! (-> *background-work* tie-generic s5-8) (the-as basic (-> *prototype-tie-work* generic-next))) + (set! (-> *background-work* tie-generic-trans s5-8) + (the-as basic (-> *prototype-tie-work* generic-trans-next)) + ) + ) + (when *debug-segment* + (let ((gp-5 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-240 (+ (-> gp-5 depth) -1)) + (s5-9 (-> gp-5 segment v1-240)) + (s4-7 (-> gp-5 base-time)) + ) + (when (>= v1-240 0) + (set! (-> s5-9 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-7)))) + (+! (-> gp-5 depth) -1) + ) + ) + ) + ) + 0 + ) + ) + ) + (let ((a0-116 (-> *display* frames (-> *display* on-screen) global-buf))) + (when (< (-> a0-116 real-buffer-end) (the-as int (-> a0-116 base))) + (break!) + 0 + ) + ) + (dotimes (gp-6 (-> *level* draw-level-count)) + (let ((s5-10 (-> *level* draw-level gp-6))) + (when (and s5-10 (= (-> s5-10 status) 'active)) + (when (and (nonzero? (-> s5-10 bsp hfrag-drawable)) (= (-> s5-10 display?) 'display)) + (when *debug-segment* + (let ((s4-8 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-271 'hfrag) + (s3-5 *profile-hfrag-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s2-5 (-> s4-8 data (-> s4-8 count)))) + (let ((s1-4 (-> s4-8 base-time))) + (set! (-> s2-5 name) v1-271) + (set! (-> s2-5 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s1-4)))) + ) + (set! (-> s2-5 depth) (the-as uint (-> s4-8 depth))) + (set! (-> s2-5 color) s3-5) + (set! (-> s4-8 segment (-> s4-8 depth)) s2-5) + ) + (set! (-> s4-8 count) (min 1023 (+ (-> s4-8 count) 1))) + (+! (-> s4-8 depth) 1) + (set! (-> s4-8 max-depth) (max (-> s4-8 max-depth) (-> s4-8 depth))) + ) + ) + 0 + ) + (set! *draw-index* (-> s5-10 draw-index)) + (let ((s4-9 (-> *display* frames (-> *display* on-screen) global-buf base))) + (draw (-> s5-10 bsp hfrag-drawable)) + (let ((v1-293 *dma-mem-usage*)) + (when (nonzero? v1-293) + (set! (-> v1-293 length) (max 44 (-> v1-293 length))) + (set! (-> v1-293 data 43 name) "hfragment") + (+! (-> v1-293 data 43 count) 1) + (+! (-> v1-293 data 43 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-9)) + ) + (set! (-> v1-293 data 43 total) (-> v1-293 data 43 used)) + ) + ) + ) + (when *debug-segment* + (let ((s5-11 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-305 (+ (-> s5-11 depth) -1)) + (s4-10 (-> s5-11 segment v1-305)) + (s3-6 (-> s5-11 base-time)) + ) + (when (>= v1-305 0) + (set! (-> s4-10 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-6)))) + (+! (-> s5-11 depth) -1) + ) + ) + ) + ) + 0 + ) + ) + ) + ) + ) + (let ((a0-139 (-> *display* frames (-> *display* on-screen) global-buf))) + (when (< (-> a0-139 real-buffer-end) (the-as int (-> a0-139 base))) + (break!) + 0 + ) + ) + (dotimes (v1-323 (-> *level* length)) + (let ((a1-55 (-> *level* level v1-323))) + (when (= (-> a1-55 status) 'active) + (let ((a0-145 (-> a1-55 bsp))) + (when (nonzero? (-> a0-145 tfrag-masks)) + (let ((a2-43 (-> a1-55 texture-mask))) + (dotimes (a3-5 (-> a0-145 tfrag-masks length)) + (let ((f0-12 (* (-> a0-145 tfrag-closest a3-5) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-12 4095996000.0) + (let ((t0-8 (-> a0-145 tfrag-masks data a3-5))) + (dotimes (t1-2 3) + (when (or (= t1-2 2) (>= f0-12 (-> t0-8 data t1-2 dist))) + (dotimes (t2-5 3) + (logior! + (-> (&-> a2-43 0 mask data t2-5) 0) + (-> (the-as (pointer int32) (+ (* t2-5 4) (the-as int t0-8) (* t1-2 16))) 0) + ) + ) + (goto cfg-176) + ) + ) + ) + ) + ) + (label cfg-176) + ) + ) + ) + (when (nonzero? (-> a0-145 shrub-masks)) + (let ((a2-48 (-> a1-55 texture-mask 2))) + (dotimes (a3-6 (-> a0-145 shrub-masks length)) + (let ((f0-14 (* (-> a0-145 shrub-closest a3-6) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-14 4095996000.0) + (let ((t0-24 (-> a0-145 shrub-masks data a3-6))) + (dotimes (t1-5 3) + (when (or (= t1-5 2) (>= f0-14 (-> t0-24 data t1-5 dist))) + (dotimes (t2-11 3) + (logior! + (-> a2-48 mask data t2-11) + (-> (the-as (pointer int32) (+ (* t2-11 4) (the-as int t0-24) (* t1-5 16))) 0) + ) + ) + (goto cfg-196) + ) + ) + ) + ) + ) + (label cfg-196) + ) + ) + ) + (when (nonzero? (-> a0-145 alpha-masks)) + (let ((a2-53 (-> a1-55 texture-mask 3))) + (dotimes (a3-7 (-> a0-145 alpha-masks length)) + (let ((f0-16 (* (-> a0-145 alpha-closest a3-7) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-16 4095996000.0) + (let ((t0-40 (-> a0-145 alpha-masks data a3-7))) + (dotimes (t1-8 3) + (when (or (= t1-8 2) (>= f0-16 (-> t0-40 data t1-8 dist))) + (dotimes (t2-17 3) + (logior! + (-> a2-53 mask data t2-17) + (-> (the-as (pointer int32) (+ (* t2-17 4) (the-as int t0-40) (* t1-8 16))) 0) + ) + ) + (goto cfg-216) + ) + ) + ) + ) + ) + (label cfg-216) + ) + ) + ) + (when (nonzero? (-> a0-145 water-masks)) + (let ((a1-56 (-> a1-55 texture-mask 4))) + (dotimes (a2-58 (-> a0-145 water-masks length)) + (let ((f0-18 (* (-> a0-145 water-closest a2-58) (-> *math-camera* fov-correction-factor)))) + (when (!= f0-18 4095996000.0) + (let ((a3-16 (-> a0-145 water-masks data a2-58))) + (dotimes (t0-50 3) + (when (or (= t0-50 2) (>= f0-18 (-> a3-16 data t0-50 dist))) + (dotimes (t1-14 3) + (logior! + (-> a1-56 mask data t1-14) + (-> (the-as (pointer int32) (+ (* t1-14 4) (the-as int a3-16) (* t0-50 16))) 0) + ) + ) + (goto cfg-236) + ) + ) + ) + ) + ) + (label cfg-236) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak3/engine/gfx/background/prototype-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/prototype-h_REF.gc index 649c1428a9..d65e034852 100644 --- a/test/decompiler/reference/jak3/engine/gfx/background/prototype-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/background/prototype-h_REF.gc @@ -53,11 +53,12 @@ (deftype prototype-bucket-shrub (prototype-bucket) ((next uint32 4) (count uint16 4) - (mod-count uint16 4) + (count-quad uint128 :overlay-at (-> count 0)) + (mod-count uint16 4 :offset 88) (last dma-packet 4) - (next-clear uint128 :overlay-at (-> next 0)) - (count-clear uint64 :overlay-at (-> count 0)) - (last-clear uint128 :overlay-at (-> last 0)) + (next-clear uint128 :overlay-at (-> next 0)) + (count-clear uint64 :overlay-at (-> count 0)) + (last-clear uint128 :overlay-at (-> last 0)) ) ) @@ -408,7 +409,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc index eaca2ff019..0ca4eecc4f 100644 --- a/test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc @@ -52,18 +52,19 @@ ;; definition of type font-context (deftype font-context (basic) - ((origin vector :inline) - (strip-gif vector :inline) - (width float) - (height float) - (projection float) - (scale float) - (color font-color) - (flags font-flags) - (mat matrix) - (start-line uint32) - (alpha float) - (max-x float) + ((origin vector :inline) + (strip-gif vector :inline) + (width float) + (height float) + (projection float) + (scale float) + (color font-color) + (color-signed int32 :overlay-at color) + (flags font-flags) + (mat matrix) + (start-line uint32) + (alpha float) + (max-x float) ) (:methods (new (symbol type matrix int int float font-color font-flags) _type_) @@ -284,7 +285,7 @@ (reg-save uint32 5) ) (:methods - (set-context! (_type_ object) none) + (set-context! (_type_ font-context) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/font_REF.gc b/test/decompiler/reference/jak3/engine/gfx/font_REF.gc new file mode 100644 index 0000000000..47a4e41d4d --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/font_REF.gc @@ -0,0 +1,80 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type font-work +;; INFO: function output is handled by mips2c +(defmethod-mips2c "(method 9 font-work)" 9 font-work) + +;; definition for function draw-string-asm +;; INFO: function output is handled by mips2c +(def-mips2c draw-string-asm (function string dma-buffer font-context draw-string-result)) + +;; definition for function draw-string +;; INFO: Used lq/sq +;; WARN: Return type mismatch uint vs draw-string-result. +;; ERROR: Failed load: (set! a2-4 (l.wu (+ a2-3 2224))) at op 19 +(defun draw-string ((arg0 string) (arg1 dma-buffer) (arg2 font-context)) + (local-vars (v0-2 uint)) + (let ((v1-1 (the int (* 128.0 (-> arg2 alpha))))) + (-> arg2 origin quad) + (dotimes (a0-2 45) + (dotimes (a1-1 4) + (let ((a2-6 + (logior (logand (l.wu (+ (+ (* a1-1 4) (* a0-2 16)) (the-as int *font-work*) 2224)) (the-as uint #xffffffff00ffffff)) + (shr (shl v1-1 56) 32) + ) + ) + (a3-7 (+ (+ (* a1-1 4) (* a0-2 16)) (the-as int *font-work*))) + ) + (s.w! (+ a3-7 2224) a2-6) + ) + ) + ) + (set! (-> *font-work* color-shadow w) v1-1) + ) + (if (< (the-as uint (dma-buffer-free arg1)) (the-as uint (* (length arg0) 32))) + (set! v0-2 (the-as uint (-> arg2 origin quad))) + (set! v0-2 (the-as uint (draw-string-asm arg0 arg1 arg2))) + ) + (dotimes (v1-7 45) + (dotimes (a0-9 4) + (let ((a1-10 + (logior (logand (l.wu (+ (+ (* a0-9 4) (* v1-7 16)) (the-as int *font-work*) 2224)) (the-as uint #xffffffff00ffffff)) + (shl #x8000 16) + ) + ) + (a2-15 (+ (+ (* a0-9 4) (* v1-7 16)) (the-as int *font-work*))) + ) + (s.w! (+ a2-15 2224) a1-10) + ) + ) + ) + (set! (-> *font-work* color-shadow w) 128) + (the-as draw-string-result v0-2) + ) + +;; definition for function get-string-length +;; INFO: function output is handled by mips2c +(def-mips2c get-string-length (function string font-context draw-string-result)) + +;; definition for function draw-string-xy +(defun draw-string-xy ((arg0 string) (arg1 dma-buffer) (arg2 int) (arg3 int) (arg4 font-color) (arg5 font-flags)) + (let ((s4-0 (new 'stack 'font-context *font-default-matrix* arg2 arg3 0.0 arg4 arg5))) + (set-context! *font-work* s4-0) + (draw-string arg0 arg1 s4-0) + ) + ) + +;; definition for function draw-string-adv +;; WARN: Return type mismatch float vs none. +(defun draw-string-adv ((arg0 string) (arg1 dma-buffer) (arg2 font-context)) + (set-context! *font-work* arg2) + (let ((v1-2 (draw-string arg0 arg1 arg2))) + (+! (-> arg2 origin x) (-> v1-2 length)) + ) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/generic/generic-effect_REF.gc b/test/decompiler/reference/jak3/engine/gfx/generic/generic-effect_REF.gc new file mode 100644 index 0000000000..f5bdb33c66 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/generic/generic-effect_REF.gc @@ -0,0 +1,394 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *target-lock*, type object +(define *target-lock* (the-as object 0)) + +;; definition for symbol *generic-consts*, type generic-consts +(define *generic-consts* + (new 'static 'generic-consts + :dma-header (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :vif-header (new 'static 'array uint32 4 #x1000404 #x1000404 #x1000404 #x6c000000) + :dma-ref-vtxs (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :dma-cnt-call (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id cnt))) + :matrix (new 'static 'matrix + :rvec (new 'static 'vector :x 1.0) + :uvec (new 'static 'vector :y 1.0) + :fvec (new 'static 'vector :z 1.0) + :trans (new 'static 'vector :w 1.0) + ) + :base-strgif (new 'static 'generic-gif-tag + :fan-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :str-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + :alpha-opaque (new 'static 'gs-adcmd :cmds (gs-reg64 alpha-1)) + :alpha-translucent (new 'static 'gs-adcmd :cmds (gs-reg64 alpha-1) :x #x44) + :ztest-normal (new 'static 'gs-adcmd :cmds (gs-reg64 test-1) :x #x5026b) + :ztest-opaque (new 'static 'gs-adcmd :cmds (gs-reg64 test-1) :x #x5000a) + :adcmd-offsets (new 'static 'array uint8 16 #x0 #x20 #x20 #x20 #x0 #x30 #x30 #x30 #x0 #x30 #x30 #x30 #x0 #x30 #x30 #x30) + :stcycle-tag #x1000103 + :unpack-vtx-tag #x68000000 + :unpack-clr-tag #x6e004000 + :unpack-tex-tag #x65000000 + :mscal-tag #x14000006 + :reset-cycle-tag #x1000404 + :dma-tag-cnt #x10000000 + :envmap (new 'static 'generic-envmap-consts + :consts (new 'static 'vector :x 1.0 :z 0.5 :w 0.5) + :strgif (new 'static 'generic-gif-tag + :fan-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1) + :nreg #x3 + ) + :str-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1) + :nreg #x3 + ) + :regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + :colors (new 'static 'vector4w :x -2139062144 :y -2139062144 :z -2139062144 :w -2139062144) + ) + :light-consts (new 'static 'vector :x 255.0 :y 8388608.0) + ) + ) + +;; definition for function generic-work-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch uint128 vs none. +(defun generic-work-init ((arg0 generic-bucket-state)) + "Initialize the scratchpad work for generic." + (quad-copy! + (the-as pointer (-> (the-as generic-work #x70000000) fx-buf work)) + (the-as pointer *generic-consts*) + 27 + ) + (set! (-> (the-as generic-work #x70000000) saves gifbuf-adr) (-> arg0 gifbuf-adr)) + (set! (-> (the-as generic-work #x70000000) saves inbuf-adr) (-> arg0 inbuf-adr)) + (set! (-> (the-as generic-work #x70000000) saves cur-outbuf) + (the-as uint (-> (the-as generic-work #x70000000) fx-buf)) + ) + (let* ((v1-6 *default-envmap-shader*) + (a0-9 (-> (the-as generic-work #x70000000) fx-buf work consts envmap shader)) + (a1-2 (-> v1-6 quad 0 quad)) + (a2-1 (-> v1-6 quad 1 quad)) + (a3-0 (-> v1-6 quad 2 quad)) + (t0-0 (-> v1-6 quad 3 quad)) + (v0-1 (-> v1-6 quad 4 quad)) + ) + (set! (-> a0-9 quad 0 quad) a1-2) + (set! (-> a0-9 quad 1 quad) a2-1) + (set! (-> a0-9 quad 2 quad) a3-0) + (set! (-> a0-9 quad 3 quad) t0-0) + (set! (-> a0-9 quad 4 quad) v0-1) + ) + (none) + ) + +;; definition for function generic-upload-vu0 +;; WARN: Return type mismatch int vs none. +;; ERROR: Failed store: (s.d! (+ a0-5 8) 0) at op 17 +(defun generic-upload-vu0 () + "Upload generic VU0 program." + (let ((gp-0 *vu0-dma-list*)) + (let ((v1-0 gp-0)) + (set! (-> v1-0 base) (-> v1-0 data)) + (set! (-> v1-0 end) (the-as pointer (+ (+ (-> v1-0 allocated-length) 28) (the-as int v1-0)))) + ) + (dma-buffer-add-vu-function gp-0 generic-vu0-block 0) + (let* ((v1-1 gp-0) + (a0-5 (-> v1-1 base)) + ) + (set! (-> (the-as (pointer int64) a0-5)) #x70000000) + (s.d! (+ a0-5 8) 0) + (set! (-> v1-1 base) (&+ a0-5 16)) + ) + (.sync.l) + (dma-buffer-send-chain (the-as dma-bank-source #x10008000) gp-0) + ) + 0 + (none) + ) + +;; definition for function upload-vu0-program +;; ERROR: failed type prop at 2: Could not figure out load: (set! a3 (l.wu (+ a0 8))) +;; ERROR: Unsupported inline assembly instruction kind - [pmaxw t5, t4, r0] +;; ERROR: Unsupported inline assembly instruction kind - [sll t6, t4, 17] +;; ERROR: Unsupported inline assembly instruction kind - [sll t5, t4, 1] +;; ERROR: Unsupported inline assembly instruction kind - [sll t4, t4, 4] +;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin t0, 0] +;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin t0, 1] +;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a0, 0] +;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a0, 1] +(defun upload-vu0-program ((a0-0 vu-function) (a1-0 pointer)) + "Upload vu-function to VU0." + (local-vars + (v0-0 none) + (v1-0 dma-buffer) + (v1-1 none) + (a0-1 none) + (a0-2 none) + (a0-3 none) + (a0-4 none) + (a1-1 none) + (a2-0 int) + (a2-1 none) + (a2-2 none) + (a3-0 none) + (a3-1 none) + (a3-2 none) + (a3-3 none) + (t0-0 none) + (t0-1 none) + (t0-2 none) + (t0-3 none) + (t0-4 none) + (t1-0 none) + (t1-1 none) + (t1-2 none) + (t2-0 none) + (t3-0 none) + (t4-0 uint128) + (t4-1 none) + (t4-2 none) + (t5-0 uint128) + (t5-1 none) + (t5-2 none) + (t6-0 none) + (t6-1 none) + ) + (set! v1-0 *vu0-dma-list*) + (set! a2-0 #x30000000) + (set! a3-0 (the-as none (l.wu (+ a0-0 8)))) + (set! t0-0 (the-as none #x10000000)) + (set! t1-0 (the-as none (l.wu (+ a0-0 4)))) + (set! v1-1 (the-as none (-> v1-0 data))) + (set! t2-0 (the-as none (+ a0-0 16))) + (set! a0-1 (the-as none v1-1)) + (set! t3-0 (the-as none #x4a000000)) + (label cfg-1) + (set! t4-0 (the-as uint128 (+ a3-0 -127))) + (s.w! a0-1 a2-0) + (.pmaxw t5-0 t4-0 r0) + (s.w! (+ a0-1 4) t2-0) + (set! t4-1 (the-as none (- a3-0 t5-0))) + (s.w! (+ a0-1 8) t0-0) + (set! a3-0 (the-as none t5-0)) + (s.b! a0-1 t4-1) + (.sll t6-0 t4-1 17) + (.sll t5-1 t4-1 1) + (set! t6-1 (the-as none (+ t6-0 t1-0))) + (set! t1-0 (the-as none (+ t1-0 t5-1))) + (set! t5-2 (the-as none (+ t6-1 t3-0))) + (.sll t4-2 t4-1 4) + (s.w! (+ a0-1 12) t5-2) + (set! t2-0 (the-as none (+ t2-0 t4-2))) + ((b! (nonzero? a3-0) L101 (set! a0-1 (+ a0-1 16))) (set! a0-1 (the-as none (+ a0-1 16)))) + (set! a2-1 (the-as none #x70000000)) + (set! a3-1 (the-as none #x10000000)) + (s.d! a0-1 a2-1) + (set! a2-2 (the-as none (logior a3-1 #x8000))) + (s.d! (+ a0-1 8) 0) + (set! a3-2 (the-as none (l.w a2-2))) + (set! t0-1 (the-as none v1-1)) + (.sync.l) + (.cache dxwbin t0-1 0) + (.sync.l) + (.cache dxwbin t0-1 1) + (.sync.l) + (set! t0-2 (the-as none 0)) + (.sync.l) + (.cache dxwbin a0-1 0) + (.sync.l) + (.cache dxwbin a0-1 1) + (.sync.l) + (set! a0-2 (the-as none 0)) + (set! a0-3 (the-as none (logand a3-2 256))) + ((b! (zero? a0-3) L103 (set! a0-4 325)) (set! a0-4 (the-as none 325))) + (set! a3-3 (the-as none a2-2)) + (nop!) + (label cfg-4) + (set! t0-3 (the-as none (l.w a1-0))) + (nop!) + (set! t1-1 (the-as none (l.w a3-3))) + (nop!) + (set! t1-2 (the-as none (logand t1-1 256))) + (set! t0-4 (the-as none (+ t0-3 1))) + ((b! (nonzero? t1-2) L102 (s.w! a1-0 t0-4)) (s.w! a1-0 t0-4)) + (set! a1-1 (the-as none 0)) + (label cfg-6) + (.sync.l) + (s.w! (+ a2-2 32) 0) + (s.w! (+ a2-2 48) v1-1) + (.sync.l) + (s.w! a2-2 a0-4) + (.sync.l) + (set! v0-0 (the-as none 0)) + (ret-none) + ) + +;; definition for function generic-initialize-without-sync +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun generic-initialize-without-sync ((arg0 matrix) (arg1 vu-lights)) + "Init generic, version for generic-merc, which relies on generic-merc init running after." + (upload-vu0-program generic-vu0-block (the-as pointer #x70000054)) + (let ((a2-0 (-> (the-as generic-work #x70000000) fx-buf work consts matrix)) + (v1-1 (-> arg0 rvec quad)) + (a0-3 (-> arg0 uvec quad)) + (a1-2 (-> arg0 fvec quad)) + (a3-0 (-> arg0 trans quad)) + ) + (set! (-> a2-0 rvec quad) v1-1) + (set! (-> a2-0 uvec quad) a0-3) + (set! (-> a2-0 fvec quad) a1-2) + (set! (-> a2-0 trans quad) a3-0) + ) + (if arg1 + (quad-copy! (the-as pointer (-> (the-as generic-work #x70000000) fx-buf work lights)) (the-as pointer arg1) 7) + ) + 0 + (none) + ) + +;; definition for function generic-initialize +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun generic-initialize ((arg0 generic-bucket-state) (arg1 matrix) (arg2 vu-lights)) + "Normal init for generic - sets up scratchpad and VU0." + (generic-work-init arg0) + (generic-upload-vu0) + (let ((a2-1 (-> (the-as generic-work #x70000000) fx-buf work consts matrix)) + (v1-1 (-> arg1 rvec quad)) + (a0-2 (-> arg1 uvec quad)) + (a1-1 (-> arg1 fvec quad)) + (a3-0 (-> arg1 trans quad)) + ) + (set! (-> a2-1 rvec quad) v1-1) + (set! (-> a2-1 uvec quad) a0-2) + (set! (-> a2-1 fvec quad) a1-1) + (set! (-> a2-1 trans quad) a3-0) + ) + (if arg2 + (quad-copy! (the-as pointer (-> (the-as generic-work #x70000000) fx-buf work lights)) (the-as pointer arg2) 7) + ) + 0 + (none) + ) + +;; definition for function generic-wrapup +;; WARN: Return type mismatch uint vs none. +(defun generic-wrapup ((arg0 generic-bucket-state)) + (set! (-> arg0 gifbuf-adr) (-> (the-as generic-work #x70000000) saves gifbuf-adr)) + (set! (-> arg0 inbuf-adr) (-> (the-as generic-work #x70000000) saves inbuf-adr)) + (none) + ) + +;; definition for function generic-dma-from-spr +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-light-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-light-proc function) + +;; definition for function generic-envmap-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-envmap-proc function) + +;; definition for function generic-prepare-dma-double +;; INFO: function output is handled by mips2c +(def-mips2c generic-prepare-dma-double function) + +;; definition for function generic-prepare-dma-single +;; INFO: function output is handled by mips2c +(def-mips2c generic-prepare-dma-single function) + +;; definition for function generic-envmap-dproc +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-interp-dproc +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-no-light-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-no-light-proc function) + +;; definition for function generic-no-light-dproc-only +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-no-light-dproc +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-no-light+envmap +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-no-light +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-envmap-only-proc +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-light +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function generic-copy-vtx-dclr-dtex +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-none +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function generic-none-dma-wait +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for symbol *warp-data*, type object +(define *warp-data* (the-as object (malloc 'global 1024))) + +;; definition for function generic-warp-source-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-source-proc (function none)) + +;; definition for function generic-warp-source +;; ERROR: Unsupported inline assembly instruction kind - [lui at, 28672] +(defun generic-warp-source ((arg0 gsf-buffer)) + (local-vars (at-0 object)) + (.lui at-0 28672) + (set! (-> (the-as generic-work at-0) saves gsf-buf) arg0) + (generic-warp-source-proc) + (none) + ) + +;; definition for function generic-warp-dest-proc +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-dest-proc function) + +;; definition for function generic-warp-dest +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-dest function) + +;; definition for function generic-warp-envmap-dest +;; INFO: function output is handled by mips2c +(def-mips2c generic-warp-envmap-dest function) + +;; definition for function generic-debug-light-proc +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition (debug) for function generic-post-debug +;; ERROR: function has no type analysis. Cannot decompile. + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/generic/generic-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/generic/generic-h_REF.gc index 100556a24f..70480508a0 100644 --- a/test/decompiler/reference/jak3/engine/gfx/generic/generic-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/generic/generic-h_REF.gc @@ -372,8 +372,8 @@ the same position/normal." (goto cfg-4) ) (format #t "[~8x] ~A~%" this 'generic-gif-tag) - (format #t "~1Tdata[4] @ #x~X~%" (-> this data)) - (format #t "~1Tqword: #~%" (-> this data)) + (format #t "~1Tdata[4] @ #x~X~%" (&-> this fan-prim)) + (format #t "~1Tqword: #~%" (&-> this fan-prim)) (format #t "~1Tfan-prim: ~D~%" (-> this fan-prim)) (format #t "~1Tstr-prim: ~D~%" (-> this str-prim)) (format #t "~1Tregs: ~D~%" (-> this regs)) @@ -495,7 +495,3 @@ the same position/normal." ;; failed to figure out what this is: (kmemclose) - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/generic/generic-vu1_REF.gc b/test/decompiler/reference/jak3/engine/gfx/generic/generic-vu1_REF.gc index 54947867e3..c36ccef51c 100644 --- a/test/decompiler/reference/jak3/engine/gfx/generic/generic-vu1_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/generic/generic-vu1_REF.gc @@ -44,10 +44,16 @@ ;; definition for function generic-setup-shrub-constants ;; WARN: Return type mismatch int vs none. (defun generic-setup-shrub-constants ((arg0 generic-shrub-constants) (arg1 int) (arg2 int) (arg3 int)) - (set! (-> arg0 shrub-giftag qword vector4w x) (logior #x30004000 (shr (shl arg3 53) 38))) - (set! (-> arg0 shrub-giftag qword vector4w y) (logior #x30004000 (shr (shl arg2 53) 38))) - (set! (-> arg0 shrub-giftag qword vector4w z) 1042) - (set! (-> arg0 shrub-giftag qword vector4w w) 0) + (set! (-> arg0 shrub-giftag fan-prim) + (new 'static 'gif-tag-prim :pre #x1 :nreg #x3 :prim (the-as gs-prim arg3)) + ) + (set! (-> arg0 shrub-giftag str-prim) + (new 'static 'gif-tag-prim :pre #x1 :nreg #x3 :prim (the-as gs-prim arg2)) + ) + (set! (-> arg0 shrub-giftag regs) + (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> arg0 shrub-giftag num-strips) (the-as uint 0)) (set! (-> arg0 shrub-adnop dword 0) (the-as uint arg1)) (set! (-> arg0 shrub-adnop dword 1) (the-as uint 71)) (none) diff --git a/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc index 7ba13ecbd1..cfc3fcc05a 100644 --- a/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc @@ -157,74 +157,74 @@ (set! (-> gp-0 pmode) (the-as uint 165)) (set! (-> gp-0 run-half-speed) #f) (set! (-> gp-0 vu1-enable-user-menu) (vu1-renderer-mask - sky - ocean - ocean-wave - tfrag - tie - tie-envmap - tie-scissor - tie-envmap-scissor - tie-vanish - shrubbery - shrub-near + rn3 + rn4 + rn5 + rn6 + rn7 + rn8 + rn9 + rn10 + rn11 + rn12 + rn13 generic merc emerc + shrubbery + shrub-near billboard - shrubbery-vanish - tfrag-trans - tie-scissor-trans - tie-trans - tie-envmap-trans - tie-envmap-scissor-trans - tfrag-water - tie-scissor-water - tie-water - tie-envmap-water - tie-envmap-scissor-water - sprite - shadow + shrub-vanish + rn21 + rn22 + rn23 + rn24 + rn25 + rn26 + rn27 + rn28 + rn29 + rn30 rn31 rn32 rn33 - depth-cue + rn34 rn36 ) ) (set! (-> gp-0 vu1-enable-user) (vu1-renderer-mask - sky - ocean - ocean-wave - tfrag - tie - tie-envmap - tie-scissor - tie-envmap-scissor - tie-vanish - shrubbery - shrub-near + rn3 + rn4 + rn5 + rn6 + rn7 + rn8 + rn9 + rn10 + rn11 + rn12 + rn13 generic merc emerc + shrubbery + shrub-near billboard - shrubbery-vanish - tfrag-trans - tie-scissor-trans - tie-trans - tie-envmap-trans - tie-envmap-scissor-trans - tfrag-water - tie-scissor-water - tie-water - tie-envmap-water - tie-envmap-scissor-water - sprite - shadow + shrub-vanish + rn21 + rn22 + rn23 + rn24 + rn25 + rn26 + rn27 + rn28 + rn29 + rn30 rn31 rn32 rn33 - depth-cue + rn34 rn36 ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/shrub/shrub-work_REF.gc b/test/decompiler/reference/jak3/engine/gfx/shrub/shrub-work_REF.gc new file mode 100644 index 0000000000..2c932ddc51 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/shrub/shrub-work_REF.gc @@ -0,0 +1,323 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *instance-shrub-work*, type instance-shrub-work +(define *instance-shrub-work* + (new 'static 'instance-shrub-work + :matrix-tmpl (new 'static 'inline-array qword 20 + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050143)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050148)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05014d)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050152)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050157)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05015c)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050161)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050166)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05016b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050170)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050176)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05017b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050180)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050185)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018a)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018f)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050194)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050199)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05019e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c0501a3)) + ) + :count-tmpl (new 'static 'inline-array vector4w 20 + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 9) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 9) + ) + :mscalf-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :mscalf-ret-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ret)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :billboard-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xd :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #xd :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x303e400000008004 #x412) + ) + :shrub-near-packets (new 'static 'inline-array shrub-near-packet 6 + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + ) + :dma-ref (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :dma-end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0) + :constants (new 'static 'vector :x 128.0 :y 1.0) + :color-constant (new 'static 'vector4w :x #x47000000 :y #x47000000 :z #x47000000) + :start-bank (new 'static 'array uint8 20 #x0 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *instance-shrub-work* mscalf-tmpl vif0 imm) 103) + +;; failed to figure out what this is: +(set! (-> *instance-shrub-work* mscalf-ret-tmpl vif0 imm) 103) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery-h_REF.gc index d7c615c679..5207f8aa4e 100644 --- a/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery-h_REF.gc @@ -278,7 +278,7 @@ This requires storing the data for all shrubs prototype twice!" (vertex-tmpl dma-packet :inline) (mscal-tmpl dma-packet :inline) (init-tmpl dma-packet :inline) - (init-data qword 8) + (init-data qword 2 :inline) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery_REF.gc b/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery_REF.gc new file mode 100644 index 0000000000..7f732a746a --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/shrub/shrubbery_REF.gc @@ -0,0 +1,1209 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type billboard +(defmethod login ((this billboard)) + "Initialize the object after it is loaded." + (adgif-shader-login (-> this flat)) + this + ) + +;; definition for method 8 of type billboard +(defmethod mem-usage ((this billboard) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 34 (-> usage length))) + (set! (-> usage data 33 name) "billboard") + (+! (-> usage data 33 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 33 used) v1-6) + (+! (-> usage data 33 total) (logand -16 (+ v1-6 15))) + ) + this + ) + +;; definition for function mem-usage-shrub-walk +(defun mem-usage-shrub-walk ((arg0 draw-node) (arg1 int) (arg2 memory-usage-block) (arg3 int)) + "Walk the shrub tree and compute memory usagbe for draw nodes and shrub instances." + (set! (-> arg2 length) (max 65 (-> arg2 length))) + (set! (-> arg2 data 64 name) "draw-node") + (+! (-> arg2 data 64 count) arg1) + (let ((v1-5 (* arg1 32))) + (+! (-> arg2 data 64 used) v1-5) + (+! (-> arg2 data 64 total) (logand -16 (+ v1-5 15))) + ) + (let ((s2-0 arg0)) + (dotimes (s1-0 arg1) + (let ((a1-2 (-> s2-0 child-count))) + (cond + ((logtest? (-> s2-0 flags) 1) + (mem-usage-shrub-walk (the-as draw-node (-> s2-0 child)) (the-as int a1-2) arg2 arg3) + ) + (else + (set! (-> arg2 length) (max 35 (-> arg2 length))) + (set! (-> arg2 data 34 name) "instance-shrubbery") + (+! (-> arg2 data 34 count) a1-2) + (let ((v1-18 (* (the-as uint 80) a1-2))) + (+! (-> arg2 data 34 used) v1-18) + (+! (-> arg2 data 34 total) (logand -16 (+ v1-18 15))) + ) + ) + ) + ) + (&+! s2-0 32) + ) + ) + arg0 + ) + +;; definition for method 8 of type drawable-tree-instance-shrub +(defmethod mem-usage ((this drawable-tree-instance-shrub) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (when (nonzero? (-> this colors-added)) + (set! (-> usage length) (max 33 (-> usage length))) + (set! (-> usage data 32 name) "shrubbery-pal") + (+! (-> usage data 32 count) 1) + (let ((v1-17 (asize-of (-> this colors-added)))) + (+! (-> usage data 32 used) v1-17) + (+! (-> usage data 32 total) (logand -16 (+ v1-17 15))) + ) + ) + (mem-usage-shrub-walk + (the-as draw-node (&+ (-> this data 0) 32)) + (-> (the-as drawable-group (-> this data 0)) length) + usage + flags + ) + (mem-usage (-> this info prototype-inline-array-shrub) usage (logior flags 1)) + this + ) + +;; definition for method 9 of type generic-shrub-fragment +(defmethod login ((this generic-shrub-fragment)) + "Initialize the object after it is loaded." + (let ((s5-0 (/ (-> this cnt-qwc) (the-as uint 5)))) + (dotimes (s4-0 (the-as int s5-0)) + (adgif-shader-login-no-remap (-> this textures s4-0)) + ) + ) + this + ) + +;; definition for method 8 of type generic-shrub-fragment +(defmethod mem-usage ((this generic-shrub-fragment) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 27 (-> usage length))) + (set! (-> usage data 25 name) "generic-shrub") + (+! (-> usage data 25 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 25 used) v1-6) + (+! (-> usage data 25 total) (logand -16 (+ v1-6 15))) + ) + (set! (-> usage data 26 name) "generic-shrub-data") + (+! (-> usage data 26 count) 1) + (let ((v1-17 (* (+ (-> this cnt-qwc) (-> this vtx-qwc) (-> this col-qwc) (-> this stq-qwc)) 16))) + (+! (-> usage data 26 used) v1-17) + (+! (-> usage data 26 total) (logand -16 (+ v1-17 15))) + ) + this + ) + +;; definition for method 3 of type prototype-shrubbery +(defmethod inspect ((this prototype-shrubbery)) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~Tlength: ~D~%" (-> this length)) + (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) + (dotimes (s5-0 (-> this length)) + (format #t "~T [~D] ~A~%" s5-0 (-> this data s5-0)) + ) + this + ) + +;; definition for method 8 of type prototype-shrubbery +(defmethod mem-usage ((this prototype-shrubbery) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +;; definition for method 9 of type prototype-shrubbery +(defmethod login ((this prototype-shrubbery)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; definition for method 5 of type prototype-shrubbery +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this prototype-shrubbery)) + (the-as int (+ (-> prototype-shrubbery size) (* (+ (-> this length) -1) 32))) + ) + +;; definition for method 9 of type prototype-generic-shrub +(defmethod login ((this prototype-generic-shrub)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; definition for method 9 of type shrubbery +(defmethod login ((this shrubbery)) + "Initialize the object after it is loaded." + (let ((s5-0 (* (-> this header data 0) 2))) + (dotimes (s4-0 (the-as int s5-0)) + (let ((v1-3 (adgif-shader-login-no-remap (-> this textures s4-0)))) + (when v1-3 + (dotimes (a0-5 3) + (dotimes (a1-0 3) + (set! (-> (the-as (pointer int32) (+ (+ (* a0-5 16) (* a1-0 4)) (the-as int *texture-masks*)))) + (logior (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int *texture-masks*) (* a0-5 16))) 0) + (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int v1-3) (* a0-5 16))) 15) + ) + ) + ) + (set! (-> *texture-masks* data a0-5 dist) + (fmax (-> *texture-masks* data a0-5 dist) (-> v1-3 masks data a0-5 dist)) + ) + ) + ) + ) + ) + ) + (shrubbery-login-post-texture this) + this + ) + +;; definition for method 8 of type shrubbery +(defmethod mem-usage ((this shrubbery) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 28 (-> usage length))) + (set! (-> usage data 27 name) "shrubbery") + (+! (-> usage data 27 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 27 used) v1-6) + (+! (-> usage data 27 total) (logand -16 (+ v1-6 15))) + ) + (set! (-> usage length) (max 30 (-> usage length))) + (set! (-> usage data 29 name) "shrubbery-vertex") + (+! (-> usage data 29 count) 1) + (let ((v1-16 (* (-> this vtx-qwc) 16))) + (+! (-> usage data 29 used) v1-16) + (+! (-> usage data 29 total) (logand -16 (+ v1-16 15))) + ) + (set! (-> usage length) (max 31 (-> usage length))) + (set! (-> usage data 30 name) "shrubbery-color") + (+! (-> usage data 30 count) 1) + (let ((v1-26 (* (-> this col-qwc) 16))) + (+! (-> usage data 30 used) v1-26) + (+! (-> usage data 30 total) (logand -16 (+ v1-26 15))) + ) + (set! (-> usage length) (max 29 (-> usage length))) + (set! (-> usage data 28 name) "shrubbery-object") + (+! (-> usage data 28 count) 1) + (let ((v1-36 (* (-> this obj-qwc) 16))) + (+! (-> usage data 28 used) v1-36) + (+! (-> usage data 28 total) (logand -16 (+ v1-36 15))) + ) + (set! (-> usage length) (max 32 (-> usage length))) + (set! (-> usage data 31 name) "shrubbery-stq") + (+! (-> usage data 31 count) 1) + (let ((v1-46 (* (-> this stq-qwc) 16))) + (+! (-> usage data 31 used) v1-46) + (+! (-> usage data 31 total) (logand -16 (+ v1-46 15))) + ) + this + ) + +;; definition (debug) for function highres-shrub-login +;; WARN: Return type mismatch int vs none. +(defun-debug highres-shrub-login ((arg0 draw-node)) + "Set draw-node's distance to max, to force to always draw." + (set! (-> arg0 distance) 40960000.0) + (when (logtest? (-> arg0 flags) 1) + (dotimes (s5-0 (the-as int (-> arg0 child-count))) + (let ((a0-2 (+ (+ (* s5-0 32) 32) (the-as int (-> arg0 child))))) + (highres-shrub-login (the-as draw-node a0-2)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type drawable-tree-instance-shrub +(defmethod login ((this drawable-tree-instance-shrub)) + "Initialize the object after it is loaded." + (when (and *debug-segment* (-> *screen-shot-work* highres-enable)) + (dotimes (s5-0 (-> this length)) + (let ((a0-1 (-> this data s5-0))) + (highres-shrub-login (the-as draw-node a0-1)) + ) + ) + ) + (if (nonzero? (-> this info prototype-inline-array-shrub)) + (login (-> this info prototype-inline-array-shrub)) + ) + this + ) + +;; definition for symbol shrub-vu1-block, type vu-function +(define shrub-vu1-block (new 'static 'vu-function :length #x26a :qlength #x135)) + +;; definition for function shrub-num-tris +(defun shrub-num-tris ((arg0 shrubbery)) + "Get the number of triangles in this shrubbery." + (- (-> arg0 header data 2) (* (-> arg0 header data 1) 2)) + ) + +;; definition for function shrub-make-perspective-matrix +;; INFO: Used lq/sq +(defun shrub-make-perspective-matrix ((arg0 matrix) (arg1 matrix)) + "Create shrub drawing matrix." + (let* ((v1-0 arg0) + (t0-0 arg1) + (a1-1 (-> t0-0 rvec quad)) + (a2-0 (-> t0-0 uvec quad)) + (a3-0 (-> t0-0 fvec quad)) + (t0-1 (-> t0-0 trans quad)) + ) + (set! (-> v1-0 rvec quad) a1-1) + (set! (-> v1-0 uvec quad) a2-0) + (set! (-> v1-0 fvec quad) a3-0) + (set! (-> v1-0 trans quad) t0-1) + ) + (let ((f0-1 (/ 1.0 (-> *math-camera* pfog0)))) + (set! (-> arg0 rvec w) (* (-> arg0 rvec w) f0-1)) + (set! (-> arg0 uvec w) (* (-> arg0 uvec w) f0-1)) + (set! (-> arg0 fvec w) (* (-> arg0 fvec w) f0-1)) + (set! (-> arg0 trans w) (* (-> arg0 trans w) f0-1)) + ) + (+! (-> arg0 rvec x) (* (-> arg0 rvec w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 uvec x) (* (-> arg0 uvec w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 fvec x) (* (-> arg0 fvec w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 trans x) (* (-> arg0 trans w) (-> *math-camera* hvdf-off x))) + (+! (-> arg0 rvec y) (* (-> arg0 rvec w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 uvec y) (* (-> arg0 uvec w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 fvec y) (* (-> arg0 fvec w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 trans y) (* (-> arg0 trans w) (-> *math-camera* hvdf-off y))) + (+! (-> arg0 rvec z) (* (-> arg0 rvec w) (-> *math-camera* hvdf-off z))) + (+! (-> arg0 uvec z) (* (-> arg0 uvec w) (-> *math-camera* hvdf-off z))) + (+! (-> arg0 fvec z) (* (-> arg0 fvec w) (-> *math-camera* hvdf-off z))) + (+! (-> arg0 trans z) (* (-> arg0 trans w) (-> *math-camera* hvdf-off z))) + arg0 + ) + +;; definition for function shrub-init-view-data +(defun shrub-init-view-data ((arg0 shrub-view-data)) + "Initialize shrub drawing constants." + (set! (-> arg0 texture-giftag tag) (new 'static 'gif-tag64 :nloop #x1 :nreg #x4)) + (set! (-> arg0 texture-giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id a+d) + :regs1 (gif-reg-id a+d) + :regs2 (gif-reg-id a+d) + :regs3 (gif-reg-id a+d) + ) + ) + (set! (-> arg0 texture-giftag word 3) (the-as uint #x40a00000)) + (set! (-> arg0 consts x) 25167696.0) + (set! (-> arg0 consts y) 8388608.0) + (set! (-> arg0 consts z) (-> *math-camera* pfog0)) + (set! (-> arg0 consts w) (-> *math-camera* pfog1)) + (set! (-> arg0 fog-clamp x) (-> *math-camera* fog-min)) + (set! (-> arg0 fog-clamp y) (-> *math-camera* fog-max)) + #f + ) + +;; definition for function shrub-upload-view-data +(defun shrub-upload-view-data ((arg0 dma-buffer)) + "Create DMA to set shrub vu1 constants." + (let ((s5-0 3)) + (let* ((v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc s5-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :num s5-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (shrub-init-view-data (the-as shrub-view-data (-> arg0 base))) + (&+! (-> arg0 base) (* s5-0 16)) + ) + #f + ) + +;; definition for function shrub-time +(defun shrub-time ((arg0 int) (arg1 int) (arg2 int) (arg3 int) (arg4 int)) + "Unknown. Maybe rough cycle count for a shrub fragment?" + (+ (* arg0 8) 29 (* 22 arg2) (* 11 arg1) (* (+ (* arg4 2) 15 (* 5 arg2) (* 13 arg0)) arg3) 53) + ) + +;; definition for function shrub-do-init-frame +(defun shrub-do-init-frame ((arg0 dma-buffer)) + "Set up DMA to set up VU1 for shrub rendering." + (dma-buffer-add-vu-function arg0 shrub-vu1-block 1) + (shrub-upload-view-data arg0) + (let* ((v1-0 arg0) + (a0-3 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a0-3) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-3) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm #x0)) + (set! (-> (the-as dma-packet a0-3) vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-0 base) (&+ (the-as pointer a0-3) 16)) + ) + (let* ((v1-1 arg0) + (a0-5 (the-as object (-> v1-1 base))) + ) + (set! (-> (the-as dma-packet a0-5) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-5) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-5) vif1) (new 'static 'vif-tag)) + (set! (-> v1-1 base) (&+ (the-as pointer a0-5) 16)) + ) + (let ((v1-2 (-> arg0 base))) + (set! (-> (the-as (pointer vif-tag) v1-2) 0) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> (the-as (pointer uint32) v1-2) 1) (the-as uint #x8080)) + (set! (-> (the-as (pointer uint32) v1-2) 2) (the-as uint #x8080)) + (set! (-> (the-as (pointer uint32) v1-2) 3) (the-as uint #x8080)) + (set! (-> (the-as (pointer uint32) v1-2) 4) (the-as uint 0)) + (set! (-> (the-as (pointer vif-tag) v1-2) 5) (new 'static 'vif-tag :cmd (vif-cmd stcol) :msk #x1)) + (set! (-> (the-as (pointer uint32) v1-2) 6) (the-as uint 4096)) + (set! (-> (the-as (pointer uint32) v1-2) 7) (the-as uint 4096)) + (set! (-> (the-as (pointer uint32) v1-2) 8) (the-as uint 4096)) + (set! (-> (the-as (pointer uint32) v1-2) 9) (the-as uint 4096)) + (set! (-> (the-as (pointer vif-tag) v1-2) 10) (new 'static 'vif-tag :cmd (vif-cmd stmask))) + (set! (-> (the-as (pointer uint32) v1-2) 11) (the-as uint #xa0a0a0a0)) + (set! (-> arg0 base) (&+ v1-2 48)) + ) + (set! *shrub-state* 2) + #f + ) + +;; definition for function shrub-init-frame +(defun shrub-init-frame ((arg0 dma-buffer) (arg1 gs-test)) + "Set up DMA to set up VU1 and GS for shrub rendering." + (shrub-do-init-frame arg0) + (let* ((v1-0 arg0) + (a0-2 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-2) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-0 base) (&+ (the-as pointer a0-2) 16)) + ) + (let* ((v1-1 arg0) + (a0-4 (the-as object (-> v1-1 base))) + ) + (set! (-> (the-as gs-gif-tag a0-4) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> (the-as gs-gif-tag a0-4) regs) GIF_REGS_ALL_AD) + (set! (-> v1-1 base) (&+ (the-as pointer a0-4) 16)) + ) + (let ((v1-2 (-> arg0 base))) + (set! (-> (the-as (pointer gs-test) v1-2) 0) arg1) + (set! (-> (the-as (pointer gs-reg64) v1-2) 1) (gs-reg64 test-1)) + (set! (-> arg0 base) (&+ v1-2 16)) + ) + #f + ) + +;; definition for function shrub-upload-model +(defun shrub-upload-model ((arg0 shrubbery) (arg1 dma-buffer) (arg2 int)) + "Set up DMA to upload a single shrub model." + (let* ((v1-0 arg1) + (a3-0 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a3-0) dma) + (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (-> arg0 bsphere x)) + :qwc (+ (-> arg0 obj-qwc) (-> arg0 vtx-qwc) (-> arg0 col-qwc) (-> arg0 stq-qwc)) + ) + ) + (set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag :cmd (vif-cmd base) :imm *shrub-state*)) + (set! (-> (the-as dma-packet a3-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd offset))) + (set! (-> v1-0 base) (&+ (the-as pointer a3-0) 16)) + ) + (cond + ((= arg2 1) + (let* ((v1-2 arg1) + (a0-9 (the-as object (-> v1-2 base))) + ) + (set! (-> (the-as dma-packet a0-9) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-9) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-9) vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x11)) + (set! (-> v1-2 base) (&+ (the-as pointer a0-9) 16)) + ) + ) + (else + (let* ((v1-3 arg1) + (a0-11 (the-as object (-> v1-3 base))) + ) + (set! (-> (the-as dma-packet a0-11) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-11) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-11) vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x15)) + (set! (-> v1-3 base) (&+ (the-as pointer a0-11) 16)) + ) + ) + ) + (set! *shrub-state* (- 164 *shrub-state*)) + #f + ) + +;; definition for function draw-inline-array-instance-shrub +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function draw-prototype-inline-array-shrub +;; INFO: Used lq/sq +;; ERROR: Failed load: (set! a2-11 (l.d (+ a0-14 96))) at op 102 +(defun draw-prototype-inline-array-shrub ((arg0 int) (arg1 (inline-array prototype-bucket-shrub))) + (local-vars + (sv-16 drawable) + (sv-32 uint) + (sv-48 int) + (sv-64 drawable) + (sv-80 int) + (sv-96 uint) + (sv-112 drawable) + (sv-128 int) + ) + (let ((v1-0 (the-as object arg1)) + (a0-6 (-> *display* frames (-> *display* on-screen) global-buf)) + ) + (countdown (a1-2 arg0) + (when (nonzero? (-> (the-as prototype-bucket-shrub v1-0) count 1)) + (let ((a2-2 (-> a0-6 base))) + (set! (-> (the-as (pointer uint128) a2-2)) + (-> *instance-shrub-work* count-tmpl (-> (the-as prototype-bucket-shrub v1-0) mod-count 1) quad) + ) + (set! (-> (the-as (pointer uint64) a2-2)) + (logior (logand (-> (the-as (pointer uint64) a2-2)) (the-as uint #x80000000ffffffff)) + (shr (shl (-> (the-as prototype-bucket-shrub v1-0) next 1) 33) 1) + ) + ) + (set! (-> (the-as prototype-bucket-shrub v1-0) next 1) (the-as uint a2-2)) + ) + (&+! (-> a0-6 base) 16) + ) + (when (nonzero? (-> (the-as prototype-bucket-shrub v1-0) count 2)) + (let ((a2-7 (-> a0-6 base))) + (set! (-> (the-as (pointer uint128) a2-7)) + (-> *instance-shrub-work* count-tmpl (-> (the-as prototype-bucket-shrub v1-0) mod-count 2) quad) + ) + (set! (-> (the-as (pointer uint64) a2-7)) + (logior (logand (-> (the-as (pointer uint64) a2-7)) (the-as uint #x80000000ffffffff)) + (shr (shl (-> (the-as prototype-bucket-shrub v1-0) next 2) 33) 1) + ) + ) + (set! (-> (the-as prototype-bucket-shrub v1-0) next 2) (the-as uint a2-7)) + ) + (&+! (-> a0-6 base) 16) + ) + (set! v1-0 (&+ (the-as prototype-bucket-shrub v1-0) 112)) + ) + ) + (when (logtest? (vu1-renderer-mask shrub-near) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *instance-shrub-work* near-count)) + (let ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id shrub-near-l0-shrub) + (bucket-id shrub-near-l1-shrub) + (bucket-id shrub-near-l2-shrub) + (bucket-id shrub-near-l3-shrub) + (bucket-id shrub-near-l4-shrub) + (bucket-id shrub-near-l5-shrub) + (bucket-id shrub-near-l6-shrub) + (bucket-id shrub-near-l7-shrub) + (bucket-id shrub-near-l8-shrub) + (bucket-id shrub-near-l9-shrub) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (generic-init-buf s2-0 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (generic-add-shrub-constants s2-0 #x5026b 60 61) + (let ((a0-14 (+ (+ (-> *instance-shrub-work* current-shrub-near-packet) 5152) (the-as uint *instance-shrub-work*))) + (v1-23 (-> s2-0 base)) + (a1-7 (+ (-> *instance-shrub-work* near-last) 176)) + ) + (let ((a2-13 (logior (logand (l.d (+ a0-14 96)) (the-as uint #x80000000ffffffff)) + (shr (shl (-> *instance-shrub-work* near-next) 33) 1) + ) + ) + ) + (s.d! (+ a0-14 96) a2-13) + ) + (let ((a2-14 (l.q (+ a0-14 96))) + (a3-18 (l.q (+ a0-14 112))) + (a0-15 (l.q (+ a0-14 128))) + ) + (set! (-> (the-as (pointer uint128) v1-23)) a2-14) + (s.q! (+ v1-23 16) a3-18) + (s.q! (+ v1-23 32) a0-15) + ) + (let ((v1-24 (&+ v1-23 48))) + (s.w! (+ a1-7 4) v1-24) + (set! (-> s2-0 base) v1-24) + ) + ) + ) + (let ((v1-34 *dma-mem-usage*)) + (when (nonzero? v1-34) + (set! (-> v1-34 length) (max 28 (-> v1-34 length))) + (set! (-> v1-34 data 27 name) "shrubbery") + (+! (-> v1-34 data 27 count) 1) + (+! (-> v1-34 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-0)) + ) + (set! (-> v1-34 data 27 total) (-> v1-34 data 27 used)) + ) + ) + ) + ) + (when (nonzero? (-> *instance-shrub-work* near-trans-count)) + (let ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id shrub-near-trans-l0-shrub) + (bucket-id shrub-near-trans-l1-shrub) + (bucket-id shrub-near-trans-l2-shrub) + (bucket-id shrub-near-trans-l3-shrub) + (bucket-id shrub-near-trans-l4-shrub) + (bucket-id shrub-near-trans-l5-shrub) + (bucket-id shrub-near-trans-l6-shrub) + (bucket-id shrub-near-trans-l7-shrub) + (bucket-id shrub-near-trans-l8-shrub) + (bucket-id shrub-near-trans-l9-shrub) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (generic-init-buf s2-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (generic-add-shrub-constants s2-1 #x51001 124 125) + (let ((a0-26 + (+ (+ (-> *instance-shrub-work* current-shrub-near-trans-packet) 5152) (the-as uint *instance-shrub-work*)) + ) + (v1-51 (-> s2-1 base)) + (a1-24 (+ (-> *instance-shrub-work* near-trans-last) 176)) + ) + (let ((a2-28 (logior (logand (l.d (+ a0-26 96)) (the-as uint #x80000000ffffffff)) + (shr (shl (-> *instance-shrub-work* near-trans-next) 33) 1) + ) + ) + ) + (s.d! (+ a0-26 96) a2-28) + ) + (let ((a2-29 (l.q (+ a0-26 96))) + (a3-27 (l.q (+ a0-26 112))) + (a0-27 (l.q (+ a0-26 128))) + ) + (set! (-> (the-as (pointer uint128) v1-51)) a2-29) + (s.q! (+ v1-51 16) a3-27) + (s.q! (+ v1-51 32) a0-27) + ) + (let ((v1-52 (&+ v1-51 48))) + (s.w! (+ a1-24 4) v1-52) + (set! (-> s2-1 base) v1-52) + ) + ) + ) + (let ((v1-62 *dma-mem-usage*)) + (when (nonzero? v1-62) + (set! (-> v1-62 length) (max 28 (-> v1-62 length))) + (set! (-> v1-62 data 27 name) "shrubbery") + (+! (-> v1-62 data 27 count) 1) + (+! (-> v1-62 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-1)) + ) + (set! (-> v1-62 data 27 total) (-> v1-62 data 27 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask shrubbery) (-> *display* vu1-enable-user)) + (let ((s4-2 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((s2-2 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id shrub-l0-shrub) + (bucket-id shrub-l1-shrub) + (bucket-id shrub-l2-shrub) + (bucket-id shrub-l3-shrub) + (bucket-id shrub-l4-shrub) + (bucket-id shrub-l5-shrub) + (bucket-id shrub-l6-shrub) + (bucket-id shrub-l7-shrub) + (bucket-id shrub-l8-shrub) + (bucket-id shrub-l9-shrub) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (shrub-init-frame s2-2 (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (let ((s1-0 (the-as prototype-bucket-shrub arg1))) + (countdown (s0-0 arg0) + (when (nonzero? (-> s1-0 count 1)) + (if (logtest? (-> s1-0 flags) (prototype-flags tpage-alpha)) + (set! sv-16 (-> s1-0 geometry 2)) + (set! sv-16 (-> s1-0 geometry 1)) + ) + (set! sv-32 (-> s1-0 next 1)) + (if (logtest? (-> s1-0 flags) (prototype-flags tpage-alpha)) + (set! sv-48 #x51001) + (set! sv-48 #x5026b) + ) + (set! sv-64 (&+ sv-16 32)) + (set! sv-80 0) + (while (< sv-80 (-> (the-as prototype-shrubbery sv-16) length)) + (shrub-upload-model + (the-as shrubbery sv-64) + s2-2 + (the-as int (-> *instance-shrub-work* start-bank (-> s1-0 mod-count 1))) + ) + (if (zero? sv-80) + (dma-buffer-add-gs-set s2-2 (test-1 sv-48)) + ) + (let* ((v1-98 s2-2) + (a0-44 (-> v1-98 base)) + ) + (set! (-> (the-as (pointer uint64) a0-44)) (logior #x50000000 (shr (shl sv-32 33) 1))) + (s.w! (+ a0-44 8) 0) + (s.w! (+ a0-44 12) 0) + (set! (-> v1-98 base) (&+ a0-44 16)) + ) + (set! sv-64 (&+ sv-64 32)) + (set! sv-80 (+ sv-80 1)) + ) + ) + (&+! s1-0 112) + ) + ) + ) + (let ((v1-117 *dma-mem-usage*)) + (when (nonzero? v1-117) + (set! (-> v1-117 length) (max 28 (-> v1-117 length))) + (set! (-> v1-117 data 27 name) "shrubbery") + (+! (-> v1-117 data 27 count) 1) + (+! (-> v1-117 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-2)) + ) + (set! (-> v1-117 data 27 total) (-> v1-117 data 27 used)) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask shrub-vanish) (-> *display* vu1-enable-user)) + (let ((s4-3 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((s2-3 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id shrub-vanish-l0-shrub) + (bucket-id shrub-vanish-l1-shrub) + (bucket-id shrub-vanish-l2-shrub) + (bucket-id shrub-vanish-l3-shrub) + (bucket-id shrub-vanish-l4-shrub) + (bucket-id shrub-vanish-l5-shrub) + (bucket-id shrub-vanish-l6-shrub) + (bucket-id shrub-vanish-l7-shrub) + (bucket-id shrub-vanish-l8-shrub) + (bucket-id shrub-vanish-l9-shrub) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (shrub-init-frame s2-3 (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (let ((s1-1 (the-as prototype-bucket-shrub arg1))) + (countdown (s0-1 arg0) + (when (nonzero? (-> s1-1 count 2)) + (let ((v1-134 (-> s1-1 geometry 2))) + (set! sv-96 (-> s1-1 next 2)) + (set! sv-112 (&+ v1-134 32)) + (set! sv-128 (-> (the-as prototype-shrubbery v1-134) length)) + ) + (while (nonzero? sv-128) + (set! sv-128 (+ sv-128 -1)) + (shrub-upload-model + (the-as shrubbery sv-112) + s2-3 + (the-as int (-> *instance-shrub-work* start-bank (-> s1-1 mod-count 2))) + ) + (let* ((v1-140 s2-3) + (a0-60 (-> v1-140 base)) + ) + (set! (-> (the-as (pointer uint64) a0-60)) (logior #x50000000 (shr (shl sv-96 33) 1))) + (s.w! (+ a0-60 8) 0) + (s.w! (+ a0-60 12) 0) + (set! (-> v1-140 base) (&+ a0-60 16)) + ) + (set! sv-112 (&+ sv-112 32)) + ) + ) + (&+! s1-1 112) + ) + ) + ) + (let ((v1-157 *dma-mem-usage*)) + (when (nonzero? v1-157) + (set! (-> v1-157 length) (max 28 (-> v1-157 length))) + (set! (-> v1-157 data 27 name) "shrubbery") + (+! (-> v1-157 data 27 count) 1) + (+! (-> v1-157 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-3)) + ) + (set! (-> v1-157 data 27 total) (-> v1-157 data 27 used)) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask billboard) (-> *display* vu1-enable-user)) + (let* ((s4-4 (-> *display* frames (-> *display* on-screen) global-buf base)) + (v1-171 (-> *display* frames (-> *display* on-screen) global-buf)) + (a2-70 (-> v1-171 base)) + ) + (dma-buffer-add-gs-set v1-171 (test-1 (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x80 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + ) + (let ((a0-73 (-> v1-171 base))) + (while (nonzero? arg0) + (+! arg0 -1) + (when (nonzero? (-> (the-as prototype-bucket-shrub arg1) count 3)) + (set! (-> *instance-shrub-work* adgif-tmpl dma-vif dma addr) (-> (the-as prototype-bucket-shrub arg1) next 3)) + (set! (-> (the-as (pointer uint128) a0-73)) (-> *instance-shrub-work* adgif-tmpl dma-vif quad)) + (let ((a1-91 (-> *instance-shrub-work* adgif-tmpl quad 1))) + (s.q! (+ a0-73 16) a1-91) + ) + (let ((a1-92 (the-as prototype-bucket-shrub (-> (the-as prototype-bucket-shrub arg1) geometry 3)))) + (let ((a3-46 (-> a1-92 dists quad))) + (s.q! (+ a0-73 32) a3-46) + ) + (let ((a3-47 (-> a1-92 rdists quad))) + (s.q! (+ a0-73 48) a3-47) + ) + (let ((a3-48 (-> a1-92 next-clear))) + (s.q! (+ a0-73 64) a3-48) + ) + (let ((a3-49 (-> a1-92 count-quad))) + (s.q! (+ a0-73 80) a3-49) + ) + (let ((a1-93 (-> a1-92 last-clear))) + (s.q! (+ a0-73 96) a1-93) + ) + ) + (&+! a0-73 112) + (set! (-> (the-as prototype-bucket-shrub arg1) last 3 dma addr) (the-as int a0-73)) + ) + (set! arg1 (the-as (inline-array prototype-bucket-shrub) (&+ (the-as prototype-bucket-shrub arg1) 112))) + ) + (set! (-> v1-171 base) a0-73) + ) + (let* ((a3-54 (-> v1-171 base)) + (v0-12 (when (!= a2-70 a3-54) + (let ((a0-74 (-> v1-171 base))) + (set! (-> (the-as (pointer int64) a0-74)) #x20000000) + (s.w! (+ a0-74 8) 0) + (s.w! (+ a0-74 12) 0) + (set! (-> v1-171 base) (&+ a0-74 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (-> (new 'static 'array bucket-id 12 + (bucket-id billboard-l0-shrub) + (bucket-id billboard-l1-shrub) + (bucket-id billboard-l2-shrub) + (bucket-id billboard-l3-shrub) + (bucket-id billboard-l4-shrub) + (bucket-id billboard-l5-shrub) + (bucket-id billboard-l6-shrub) + (bucket-id billboard-l7-shrub) + (bucket-id billboard-l8-shrub) + (bucket-id billboard-l9-shrub) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + a2-70 + (the-as (pointer dma-tag) a3-54) + ) + ) + ) + ) + (let ((v1-179 *dma-mem-usage*)) + (when (nonzero? v1-179) + (set! (-> v1-179 length) (max 34 (-> v1-179 length))) + (set! (-> v1-179 data 33 name) "billboard") + (+! (-> v1-179 data 33 count) 1) + (+! (-> v1-179 data 33 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-4)) + ) + (set! (-> v1-179 data 33 total) (-> v1-179 data 33 used)) + ) + ) + v0-12 + ) + ) + ) + ) + +;; definition for function draw-drawable-tree-instance-shrub +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun draw-drawable-tree-instance-shrub ((arg0 drawable-tree-instance-shrub) (arg1 level)) + "Draw a shrub tree!" + (local-vars (a0-4 int) (a0-6 int) (a0-11 int) (a0-13 int)) + (set! (-> *instance-shrub-work* texture-dists) (the-as uint (-> arg1 bsp shrub-closest))) + (set! (-> *instance-shrub-work* near-last) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-next) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-count) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-trans-last) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-trans-next) (the-as uint 0)) + (set! (-> *instance-shrub-work* near-trans-count) (the-as uint 0)) + (set! (-> *instance-shrub-work* wind-vectors) (-> arg0 info wind-vectors)) + (set! (-> *instance-shrub-work* wait-to-spr) (the-as uint 0)) + (set! (-> *instance-shrub-work* wait-from-spr) (the-as uint 0)) + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrub-vanish) (-> *display* vu1-enable-user)) + (let* ((v1-16 (-> arg0 info prototype-inline-array-shrub)) + (s5-0 (-> v1-16 length)) + (s4-0 (-> v1-16 data)) + ) + (countdown (a1-5 s5-0) + (let ((a2-3 (-> v1-16 data a1-5))) + (set! (-> a2-3 next-clear) (the-as uint128 0)) + (set! (-> a2-3 last-clear) (the-as uint128 0)) + (set! (-> a2-3 count-clear) (the-as uint 0)) + ) + 0 + ) + (let ((v1-24 (-> *display* frames (-> *display* on-screen) global-buf))) + (when (nonzero? (-> arg0 length)) + (let ((gp-0 (-> *display* frames (-> *display* on-screen) global-buf base))) + (let* ((a1-16 (-> *perf-stats* data 44)) + (a2-6 (-> a1-16 ctrl)) + ) + (+! (-> a1-16 count) 1) + (b! (zero? a2-6) cfg-7 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a2-6) + ) + (.sync.l) + (.sync.p) + (label cfg-7) + 0 + (draw-inline-array-instance-shrub + v1-24 + (&+ (-> arg0 data 0) 32) + (-> (the-as drawable-group (-> arg0 data 0)) length) + s4-0 + ) + (let ((v1-26 (-> *perf-stats* data 44))) + (b! (zero? (-> v1-26 ctrl)) cfg-9 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-4 pcr0) + (+! (-> v1-26 accum0) a0-4) + (.mfpc a0-6 pcr1) + (+! (-> v1-26 accum1) a0-6) + ) + (label cfg-9) + 0 + (let* ((v1-29 (-> *perf-stats* data 45)) + (a0-8 (-> v1-29 ctrl)) + ) + (+! (-> v1-29 count) 1) + (b! (zero? a0-8) cfg-11 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-8) + ) + (.sync.l) + (.sync.p) + (label cfg-11) + 0 + (draw-prototype-inline-array-shrub s5-0 s4-0) + (let ((v1-32 (-> *perf-stats* data 45))) + (b! (zero? (-> v1-32 ctrl)) cfg-13 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-11 pcr0) + (+! (-> v1-32 accum0) a0-11) + (.mfpc a0-13 pcr1) + (+! (-> v1-32 accum1) a0-13) + ) + (label cfg-13) + 0 + (let ((v1-33 *dma-mem-usage*)) + (when (nonzero? v1-33) + (set! (-> v1-33 length) (max 28 (-> v1-33 length))) + (set! (-> v1-33 data 27 name) "shrubbery") + (+! (-> v1-33 data 27 count) 1) + (+! (-> v1-33 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint gp-0)) + ) + (set! (-> v1-33 data 27 total) (-> v1-33 data 27 used)) + ) + ) + ) + ) + ) + ) + (update-wait-stats + (-> *perf-stats* data 44) + (the-as uint 0) + (-> *instance-shrub-work* wait-to-spr) + (-> *instance-shrub-work* wait-from-spr) + ) + ) + 0 + (none) + ) + +;; definition for method 10 of type drawable-tree-instance-shrub +;; WARN: Return type mismatch int vs none. +(defmethod draw ((this drawable-tree-instance-shrub)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* shrub-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* shrub-trees v1-1) this) + (set! (-> *background-work* shrub-levels v1-1) a1-3) + ) + (+! (-> *background-work* shrub-tree-count) 1) + 0 + (none) + ) + +;; definition for method 15 of type drawable-tree-instance-shrub +(defmethod unpack-vis ((this drawable-tree-instance-shrub) (arg0 (pointer int8)) (arg1 (pointer int8))) + arg1 + ) + +;; definition for method 13 of type drawable-tree-instance-shrub +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-tree-instance-shrub)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrub-vanish) (-> *display* vu1-enable-user)) + (let* ((v1-4 (-> this info prototype-inline-array-shrub)) + (gp-0 (the-as object (-> v1-4 data))) + ) + (countdown (s5-0 (-> v1-4 length)) + (when (logtest? (vu1-renderer-mask shrub-near) (-> *display* vu1-enable-user)) + (let ((v1-8 (-> (the-as prototype-bucket-shrub gp-0) count 0)) + (a1-2 (-> (the-as prototype-bucket-shrub gp-0) geometry 0)) + ) + (when (nonzero? v1-8) + (let ((a0-4 (-> (the-as drawable-group a1-2) length))) + (+! (-> *terrain-stats* shrub groups) 1) + (+! (-> *terrain-stats* shrub fragments) (* a0-4 (the-as int v1-8))) + ) + (+! (-> *terrain-stats* shrub instances) v1-8) + ) + ) + ) + (when (logtest? (vu1-renderer-mask shrubbery) (-> *display* vu1-enable-user)) + (let ((s4-0 (-> (the-as prototype-bucket-shrub gp-0) count 1)) + (v1-13 (-> (the-as prototype-bucket-shrub gp-0) geometry 1)) + ) + (when (nonzero? s4-0) + (let ((s3-0 (&+ v1-13 32)) + (s2-0 (-> (the-as drawable-group v1-13) length)) + ) + (+! (-> *terrain-stats* shrub groups) 1) + (+! (-> *terrain-stats* shrub fragments) s2-0) + (+! (-> *terrain-stats* shrub instances) s4-0) + (while (nonzero? s2-0) + (+! s2-0 -1) + (let ((a0-17 (* (shrub-num-tris (the-as shrubbery s3-0)) s4-0)) + (v1-25 (* (-> (the-as shrubbery s3-0) header data 2) s4-0)) + ) + (+! (-> *terrain-stats* shrub tris) a0-17) + (+! (-> *terrain-stats* shrub dverts) v1-25) + ) + (&+! s3-0 32) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask shrub-vanish) (-> *display* vu1-enable-user)) + (let ((s4-1 (-> (the-as prototype-bucket-shrub gp-0) count 2)) + (v1-31 (-> (the-as prototype-bucket-shrub gp-0) geometry 2)) + ) + (when (nonzero? s4-1) + (let ((s3-1 (&+ v1-31 32)) + (s2-1 (-> (the-as drawable-group v1-31) length)) + ) + (+! (-> *terrain-stats* trans-shrub groups) 1) + (+! (-> *terrain-stats* trans-shrub fragments) s2-1) + (+! (-> *terrain-stats* trans-shrub instances) s4-1) + (while (nonzero? s2-1) + (+! s2-1 -1) + (let ((a0-30 (* (shrub-num-tris (the-as shrubbery s3-1)) s4-1)) + (v1-43 (* (-> (the-as shrubbery s3-1) header data 2) s4-1)) + ) + (+! (-> *terrain-stats* trans-shrub tris) a0-30) + (+! (-> *terrain-stats* trans-shrub dverts) v1-43) + ) + (&+! s3-1 32) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask billboard) (-> *display* vu1-enable-user)) + (let ((v1-49 (-> (the-as prototype-bucket-shrub gp-0) count 3))) + (when (nonzero? v1-49) + (+! (-> *terrain-stats* billboard groups) 1) + (+! (-> *terrain-stats* billboard instances) v1-49) + (+! (-> *terrain-stats* billboard tris) (* v1-49 2)) + (+! (-> *terrain-stats* billboard dverts) (* v1-49 4)) + ) + ) + ) + (set! gp-0 (-> (the-as (inline-array prototype-bucket-shrub) gp-0) 1)) + ) + ) + ) + 0 + (none) + ) + +;; definition of type dma-test +(deftype dma-test (structure) + ((data qword 101 :inline) + ) + ) + +;; definition for method 3 of type dma-test +(defmethod inspect ((this dma-test)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'dma-test) + (format #t "~1Tdata[101] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; definition for symbol *dma-test*, type dma-test +(define *dma-test* (new 'global 'dma-test)) + +;; definition of type dma-test-work +(deftype dma-test-work (structure) + ((upload dma-packet :inline) + (end dma-packet :inline) + ) + ) + +;; definition for method 3 of type dma-test-work +(defmethod inspect ((this dma-test-work)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'dma-test-work) + (format #t "~1Tupload: #~%" (-> this upload)) + (format #t "~1Tend: #~%" (-> this end)) + (label cfg-4) + this + ) + +;; definition for symbol *dma-test-work*, type dma-test-work +(define *dma-test-work* + (new 'static 'dma-test-work + :upload (new 'static 'dma-packet :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref))) + :end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + ) + ) + +;; definition for function init-dma-test +;; INFO: Used lq/sq +;; WARN: Return type mismatch uint128 vs none. +;; ERROR: Failed store: (s.q! (+ v1-0 1616) v0-0) at op 29 +(defun init-dma-test () + (let ((a0-0 *dma-test-work*) + (v1-0 *dma-test*) + ) + (let ((a1-6 (-> *display* frames (-> *display* on-screen) calc-buf base))) + (dotimes (a2-1 100) + (set! (-> a0-0 upload dma addr) (the-as int a1-6)) + (set! (-> v1-0 data a2-1 quad) (-> a0-0 upload quad)) + (&+! a1-6 256) + ) + ) + (let ((v0-0 (-> a0-0 end quad))) + (s.q! (+ v1-0 1616) v0-0) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(init-dma-test) + +;; definition for function dma-test-func +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function move-test-func +;; ERROR: function was not converted to expressions. Cannot decompile. + + + + diff --git a/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc b/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc index 057300a88b..5efc74f301 100644 --- a/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc @@ -37,8 +37,9 @@ This is used for precomputed visibility, based on the camera position. This is n "The bsp-header is really an entire level. This probably started as a very simple structure, but now it is extremely complicated." ((info file-info :overlay-at id) - (all-visible-list (pointer uint16) :offset 32) + (all-visible-list (pointer uint8) :offset 32) (visible-list-length int16 :offset 36) + (extra-vis-list-length int16) (drawable-trees drawable-tree-array :offset 40) (pat pointer :offset 44) (pat-length int32 :offset 48) @@ -59,6 +60,8 @@ This probably started as a very simple structure, but now it is extremely compli (actor-birth-order (pointer uint32) :offset 172) (region-trees (array drawable-tree-region-prim) :offset 188) (collide-hash collide-hash :offset 196) + (wind-array uint32 :offset 200) + (wind-array-length int32 :offset 204) (vis-spheres vector-array :offset 216) (vis-spheres-length uint32 :offset 248) (tfrag-masks texture-masks-array :offset 256) @@ -75,7 +78,7 @@ This probably started as a very simple structure, but now it is extremely compli (water-mask-count uint32 :overlay-at water-closest) (bsp-scale vector :inline :offset 288) (bsp-offset vector :inline) - (unk-drawable drawable :offset 320) + (hfrag-drawable drawable :offset 320) (end uint8 :offset 399) ) (:methods diff --git a/test/decompiler/reference/jak3/engine/level/bsp_REF.gc b/test/decompiler/reference/jak3/engine/level/bsp_REF.gc index daf274fcaa..856712631e 100644 --- a/test/decompiler/reference/jak3/engine/level/bsp_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/bsp_REF.gc @@ -101,8 +101,8 @@ (+! (-> usage data 65 used) v1-92) (+! (-> usage data 65 total) (logand -16 (+ v1-92 15))) ) - (if (nonzero? (-> this unk-drawable)) - (mem-usage (-> this unk-drawable) usage flags) + (if (nonzero? (-> this hfrag-drawable)) + (mem-usage (-> this hfrag-drawable) usage flags) ) (when (nonzero? (-> this region-trees)) (let* ((s3-0 (-> this region-trees length)) @@ -147,8 +147,8 @@ ) ) ) - (if (nonzero? (-> this unk-drawable)) - (login (-> this unk-drawable)) + (if (nonzero? (-> this hfrag-drawable)) + (login (-> this hfrag-drawable)) ) this ) @@ -349,8 +349,8 @@ (if (nonzero? (-> this drawable-trees)) (collect-stats (-> this drawable-trees)) ) - (if (nonzero? (-> this unk-drawable)) - (collect-stats (-> this unk-drawable)) + (if (nonzero? (-> this hfrag-drawable)) + (collect-stats (-> this hfrag-drawable)) ) 0 (none) diff --git a/test/decompiler/reference/jak3/engine/level/level-info_REF.gc b/test/decompiler/reference/jak3/engine/level/level-info_REF.gc index b02794a050..42ae4cd18f 100644 --- a/test/decompiler/reference/jak3/engine/level/level-info_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/level-info_REF.gc @@ -17993,7 +17993,7 @@ :index #x110 :task-level #x9 :master-level 'factorya - :level-flags (level-flags lf10 lf12 lf13) + :level-flags (level-flags use-camera-other lf12 lf13) :packages '() :run-packages '("common") :memory-mode (level-memory-mode borrow) @@ -18023,7 +18023,7 @@ :index #x111 :task-level #x9 :master-level 'factorya - :level-flags (level-flags lf10 lf12 lf13) + :level-flags (level-flags use-camera-other lf12 lf13) :packages '() :run-packages '("common") :memory-mode (level-memory-mode borrow) diff --git a/test/decompiler/reference/jak3/engine/load/decomp_REF.gc b/test/decompiler/reference/jak3/engine/load/decomp_REF.gc new file mode 100644 index 0000000000..f58bf62e19 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/load/decomp_REF.gc @@ -0,0 +1,525 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function unpack-comp-rle +(defun unpack-comp-rle ((arg0 (pointer int8)) (arg1 (pointer int8))) + "Decompress data compressed with run-length encoding." + (local-vars (v1-2 int) (v1-3 uint)) + (nop!) + (loop + (loop + (set! v1-2 (-> arg1 0)) + (set! arg1 (&-> arg1 1)) + (b! (<= v1-2 0) cfg-5 :delay (nop!)) + (let ((a2-0 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (label cfg-3) + (nop!) + (nop!) + (nop!) + (nop!) + (set! (-> arg0 0) a2-0) + ) + (set! arg0 (&-> arg0 1)) + (b! (> v1-2 0) cfg-3 :delay (set! v1-2 (+ v1-2 -1))) + ) + (label cfg-5) + (b! (zero? v1-2) cfg-8 :delay (set! v1-3 (the-as uint (- v1-2)))) + (label cfg-6) + (let ((a2-1 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (nop!) + (nop!) + (set! (-> arg0 0) a2-1) + ) + (+! v1-3 -1) + (b! (> (the-as int v1-3) 0) cfg-6 :delay (set! arg0 (&-> arg0 1))) + ) + (label cfg-8) + arg1 + ) + +;; definition of type huf-dictionary-node +(deftype huf-dictionary-node (structure) + ((zero uint16) + (one uint16) + ) + ) + +;; definition for method 3 of type huf-dictionary-node +(defmethod inspect ((this huf-dictionary-node)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'huf-dictionary-node) + (format #t "~1Tzero: ~D~%" (-> this zero)) + (format #t "~1Tone: ~D~%" (-> this one)) + (label cfg-4) + this + ) + +;; definition for function unpack-comp-huf +;; WARN: Return type mismatch int vs none. +(defun unpack-comp-huf ((arg0 (pointer uint8)) (arg1 (pointer uint8)) (arg2 uint) (arg3 huf-dictionary-node)) + "Decompress data compressed with huffman encoding." + (local-vars (t1-1 uint) (t3-2 (pointer uint16))) + (nop!) + (let ((t1-0 (-> arg3 zero)) + (a2-1 (+ arg2 -1028)) + (t2-0 (-> arg3 one)) + ) + (nop!) + (label cfg-1) + (let ((v1-4 128)) + (nop!) + (let ((t0-0 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (label cfg-2) + (let ((t3-0 (logand t0-0 v1-4))) + (shift-arith-right-32 v1-4 v1-4 1) + (b! (zero? t3-0) cfg-4 :delay (set! t1-1 t1-0)) + ) + ) + (nop!) + (set! t1-1 t2-0) + (label cfg-4) + (let ((t2-1 (+ t1-1 -256))) + (let ((t3-1 (* t1-1 4))) + (b! (< (the-as int t2-1) 0) cfg-8 :delay (set! t3-2 (the-as (pointer uint16) (+ t3-1 a2-1)))) + ) + (b! (zero? t2-1) cfg-10 :delay (set! t1-0 (-> t3-2 0))) + ) + (b! (nonzero? v1-4) cfg-2 :delay (set! t2-0 (-> t3-2 1))) + (b! #t cfg-1 :delay (nop!)) + (label cfg-8) + (set! (-> arg0 0) t1-1) + (set! arg0 (&-> arg0 1)) + (nop!) + (set! t1-0 (-> arg3 zero)) + (b! (nonzero? v1-4) cfg-2 :delay (set! t2-0 (-> arg3 one))) + ) + ) + (b! #t cfg-1 :delay (nop!)) + (label cfg-10) + (nop!) + (nop!) + 0 + (none) + ) + +;; definition for function unpack-comp-lzo +;; WARN: Return type mismatch int vs none. +(defun unpack-comp-lzo ((arg0 (pointer uint8)) (arg1 (pointer uint8))) + "Decompress data compressed with LZO encoding." + 0 + (let ((v1-1 arg0)) + (b! (>= (the-as uint 17) (-> arg1 0)) cfg-5 :delay #f) + (let ((a2-4 (the-as int (+ (-> arg1 0) -17)))) + (set! arg1 (&-> arg1 1)) + (b! (< a2-4 4) cfg-41) + (until (<= a2-4 0) + (set! (-> arg0 0) (-> arg1 0)) + (set! arg0 (&-> arg0 1)) + (set! arg1 (&-> arg1 1)) + (+! a2-4 -1) + ) + (b! #t cfg-15 :delay (nop!)) + (label cfg-5) + (b! #t cfg-45 :delay (nop!)) + (label cfg-6) + (let ((a2-6 (-> arg1 0))) + (set! arg1 (&-> arg1 1)) + (b! (>= (the-as int a2-6) 16) cfg-18) + (b! (nonzero? a2-6) cfg-12 :delay (empty-form)) + (while (zero? (-> arg1 0)) + (+! a2-6 255) + (set! arg1 (&-> arg1 1)) + ) + (set! a2-6 (+ (-> arg1 0) 15 a2-6)) + (set! arg1 (&-> arg1 1)) + (label cfg-12) + (set! (-> arg0 0) (-> arg1 0)) + (set! (-> arg0 1) (-> arg1 1)) + (set! (-> arg0 2) (-> arg1 2)) + (set! arg0 (&-> arg0 3)) + (set! arg1 (&-> arg1 3)) + (until (<= (the-as int a2-6) 0) + (set! (-> arg0 0) (-> arg1 0)) + (set! arg0 (&-> arg0 1)) + (set! arg1 (&-> arg1 1)) + (+! a2-6 -1) + ) + (label cfg-15) + (set! a2-6 (-> arg1 0)) + (set! arg1 (&-> arg1 1)) + (b! (>= (the-as int a2-6) 16) cfg-18) + (let ((a2-10 (&- (&- (&-> arg0 -2049) (the-as uint (/ (the-as int a2-6) 4))) (the-as uint (* (-> arg1 0) 4))))) + (set! arg1 (&-> arg1 1)) + (set! (-> arg0 0) (-> a2-10 0)) + (set! (-> arg0 1) (-> a2-10 1)) + (set! (-> arg0 2) (-> a2-10 2)) + (set! arg0 (&-> arg0 3)) + (&-> a2-10 2) + ) + (b! #t cfg-39 :delay (nop!)) + (b! #t cfg-43 :delay (nop!)) + (label cfg-18) + (b! (< (the-as int a2-6) 64) cfg-20) + (let ((a3-23 + (&- (&- (&-> arg0 -1) (the-as uint (logand (/ (the-as int a2-6) 4) 7))) (the-as uint (* (-> arg1 0) 8))) + ) + ) + (set! arg1 (&-> arg1 1)) + (let ((a2-13 (+ (/ (the-as int a2-6) 32) -1))) + (b! #t cfg-36 :delay (nop!)) + (label cfg-20) + (b! (< (the-as int a2-6) 32) cfg-27) + (set! a2-13 (logand a2-6 31)) + (b! (nonzero? a2-13) cfg-26 :delay (empty-form)) + (b! #t cfg-24 :delay (nop!)) + (label cfg-23) + (+! a2-13 255) + (set! arg1 (&-> arg1 1)) + (label cfg-24) + (b! (zero? (-> arg1 0)) cfg-23 :delay (nop!)) + (set! a2-13 (+ (-> arg1 0) 31 a2-13)) + (set! arg1 (&-> arg1 1)) + (label cfg-26) + (set! a3-23 (&- (&-> arg0 -1) (the-as uint (+ (shr (-> arg1 0) 2) (* (-> arg1 1) 64))))) + (set! arg1 (&-> arg1 2)) + (b! #t cfg-36 :delay (nop!)) + (label cfg-27) + (b! (< (the-as int a2-6) 16) cfg-35) + (let ((a3-32 (&- arg0 (the-as uint (shl (logand a2-6 8) 11))))) + (set! a2-13 (logand a2-6 7)) + (b! (nonzero? a2-13) cfg-33 :delay (empty-form)) + (b! #t cfg-31 :delay (nop!)) + (label cfg-30) + (+! a2-13 255) + (set! arg1 (&-> arg1 1)) + (label cfg-31) + (b! (zero? (-> arg1 0)) cfg-30 :delay (nop!)) + (set! a2-13 (+ (-> arg1 0) 7 a2-13)) + (set! arg1 (&-> arg1 1)) + (label cfg-33) + (let ((a3-33 (&- a3-32 (the-as uint (+ (shr (-> arg1 0) 2) (* (-> arg1 1) 64)))))) + (set! arg1 (&-> arg1 2)) + (b! (= a3-33 arg0) cfg-47 :delay (nop!)) + (set! a3-23 (&-> a3-33 -16384)) + ) + ) + (b! #t cfg-36 :delay (nop!)) + (label cfg-35) + (let ((a2-16 (&- (&- (&-> arg0 -1) (the-as uint (/ (the-as int a2-6) 4))) (the-as uint (* (-> arg1 0) 4))))) + (set! arg1 (&-> arg1 1)) + (set! (-> arg0 0) (-> a2-16 0)) + (set! (-> arg0 1) (-> a2-16 1)) + (set! arg0 (&-> arg0 2)) + (&-> a2-16 1) + ) + (b! #t cfg-39 :delay (nop!)) + (label cfg-36) + (set! (-> arg0 0) (-> a3-23 0)) + (set! (-> arg0 1) (-> a3-23 1)) + (set! arg0 (&-> arg0 2)) + (let ((a3-39 (&-> a3-23 2))) + (until (<= (the-as int a2-13) 0) + (set! (-> arg0 0) (-> a3-39 0)) + (set! arg0 (&-> arg0 1)) + (set! a3-39 (&-> a3-39 1)) + (+! a2-13 -1) + ) + ) + ) + ) + (label cfg-39) + (set! a2-4 (the-as int (logand (-> arg1 -2) 3))) + (b! (zero? (the-as uint a2-4)) cfg-45 :delay (nop!)) + (until (<= a2-4 0) + (label cfg-41) + (set! (-> arg0 0) (-> arg1 0)) + (set! arg0 (&-> arg0 1)) + (set! arg1 (&-> arg1 1)) + (set! a2-4 (the-as int (+ (the-as uint a2-4) -1))) + ) + (set! a2-6 (-> arg1 0)) + ) + ) + (set! arg1 (&-> arg1 1)) + (label cfg-43) + (b! #t cfg-18 :delay (nop!)) + (label cfg-45) + (b! #t cfg-6 :delay (nop!)) + (label cfg-47) + (&- arg0 (the-as uint v1-1)) + ) + (none) + ) + +;; definition for method 16 of type level +;; INFO: Used lq/sq +(defmethod update-vis! ((this level) (arg0 level-vis-info) (arg1 uint) (arg2 (pointer uint8))) + "Load/decompress precomputed visibility." + (local-vars (t0-3 uint128) (sv-16 int) (sv-32 (pointer int8))) + (let* ((a0-1 (-> arg0 from-bsp current-leaf-idx)) + (v1-1 (-> arg0 current-vis-string)) + (s3-0 (-> arg0 vis-string a0-1)) + ) + 0 + (+ #x70000000 0) + (+ 2048 #x70000000) + (b! (!= v1-1 s3-0) cfg-8 :delay (empty-form)) + (b! (not (logtest? (vis-info-flag loading) (-> arg0 flags))) cfg-6 :delay (empty-form)) + (if (check-busy *ramdisk-rpc*) + (return #f) + ) + (logclear! (-> arg0 flags) (vis-info-flag loading)) + (let ((s3-1 (the-as (pointer integer) (-> this vis-buffer)))) + (b! #t cfg-16 :delay (nop!)) + (label cfg-6) + (return #t) + (label cfg-8) + (when (logtest? (vis-info-flag loading) (-> arg0 flags)) + (if (check-busy *ramdisk-rpc*) + (return #f) + ) + (logclear! (-> arg0 flags) (vis-info-flag loading)) + ) + (set! (-> arg0 current-vis-string) s3-0) + (b! (logtest? (vis-info-flag in-iop) (-> arg0 flags)) cfg-15 :delay (empty-form)) + (set! s3-1 (&+ arg2 s3-0)) + (b! #t cfg-16 :delay (nop!)) + (label cfg-15) + (format 0 "ERROR: ramdisk vis for level ~A, this is not supported~%" (-> this name)) + (let ((v0-1 #f)) + (b! #t cfg-49 :delay (nop!)) + (label cfg-16) + (let ((s2-0 (the-as int (logand (vis-info-flag + dummy0 + dummy1 + dummy2 + dummy3 + dummy4 + dummy5 + dummy6 + dummy7 + dummy8 + dummy9 + dummy10 + dummy11 + dummy12 + dummy13 + dummy14 + dummy15 + dummy16 + dummy17 + dummy18 + dummy19 + dummy20 + dummy21 + dummy22 + dummy23 + dummy24 + dummy25 + dummy26 + dummy27 + dummy28 + ) + (-> arg0 flags) + ) + ) + ) + (s1-0 (&-> (the-as (pointer int8) #x70000000) 0)) + (s0-0 (the-as (pointer int8) (+ 2048 #x70000000))) + (s4-1 (-> this bsp visible-list-length)) + ) + (when (zero? (the-as vis-info-flag s2-0)) + (let ((v1-30 (/ (+ s4-1 15) 16))) + (dotimes (a0-19 v1-30) + (set! (-> (the-as (pointer int128) (&+ s1-0 (* a0-19 16)))) 0) + ) + ) + (mem-copy! s1-0 (the-as (pointer uint8) s3-1) s4-1) + ) + (while (nonzero? s2-0) + (let ((v1-33 (logand s2-0 7))) + (cond + ((= v1-33 1) + (let ((v1-35 (/ (+ s4-1 15) 16))) + (dotimes (a0-23 v1-35) + (set! (-> (the-as (pointer int128) (&+ s1-0 (* a0-23 16)))) 0) + ) + ) + (set! sv-16 (-> this bsp extra-vis-list-length)) + (set! sv-32 (&+ s1-0 (- s4-1 sv-16))) + (let ((v1-45 (unpack-vis (-> this bsp drawable-trees) s1-0 (the-as (pointer int8) s3-1)))) + (dotimes (a0-25 sv-16) + (let ((a1-9 (-> v1-45 0))) + (set! v1-45 (&-> v1-45 1)) + (set! (-> sv-32 0) a1-9) + ) + (set! sv-32 (&-> sv-32 1)) + ) + ) + #f + ) + ((= v1-33 2) + (unpack-comp-rle s1-0 (the-as (pointer int8) s3-1)) + ) + ((= v1-33 3) + (unpack-comp-huf + (the-as (pointer uint8) s1-0) + (the-as (pointer uint8) s3-1) + (-> arg0 dictionary) + (the-as huf-dictionary-node (+ (-> arg0 dictionary) (-> arg0 dictionary-length) -4)) + ) + ) + ((= v1-33 4) + (unpack-comp-lzo (the-as (pointer uint8) s1-0) (the-as (pointer uint8) s3-1)) + ) + ) + ) + (set! s3-1 s1-0) + (set! s1-0 s0-0) + (set! s0-0 (the-as (pointer int8) s3-1)) + (shift-arith-right-32 s2-0 s2-0 3) + ) + (let ((s2-1 (the-as (pointer uint8) s3-1)) + (s1-1 (-> this bsp all-visible-list)) + (v1-51 #f) + ) + (dotimes (s0-1 s4-1) + (when (!= (logand (-> s2-1 0) (-> s1-1 0)) (-> s2-1 0)) + (format #t "ERROR: illegal vis bits set [byte ~X] ~X -> ~X~%" s0-1 (-> s2-1 0) (-> s1-1 0)) + (set! v1-51 #t) + ) + (set! s2-1 (&-> s2-1 1)) + (set! s1-1 (&-> s1-1 1)) + ) + (when v1-51 + (format #t "src = #x~x dest = #x~x ~s ~s~%" s3-1 (-> arg0 vis-bits) (-> arg0 level) (-> arg0 from-level)) + (format #t "leaf-index = ~d~%" (-> arg0 from-bsp current-leaf-idx)) + 0 + ) + ) + (let ((v1-55 s3-1) + (a0-42 (the-as object (-> arg0 vis-bits))) + (a1-22 (the-as (pointer uinteger) (-> this bsp all-visible-list))) + (a2-11 (/ (+ s4-1 15) 16)) + ) + (dotimes (a3-6 a2-11) + (let ((t0-2 (-> (the-as (pointer uint128) v1-55) 0)) + (t1-1 (-> (the-as (pointer uint128) a1-22) 0)) + ) + (.pand t0-3 t0-2 t1-1) + ) + (set! (-> (the-as (pointer uint128) a0-42) 0) t0-3) + (set! a0-42 (+ (the-as uint a0-42) 16)) + (set! v1-55 (&-> (the-as (pointer uint8) v1-55) 16)) + (set! a1-22 (&-> (the-as (pointer uint8) a1-22) 16)) + ) + ) + ) + (set! v0-1 #t) + (label cfg-49) + v0-1 + ) + ) + ) + ) + +;; definition for function pack-comp-rle +;; WARN: Return type mismatch int vs (pointer uint8). +(defun pack-comp-rle ((arg0 (pointer uint8)) (arg1 (pointer uint8)) (arg2 int) (arg3 int)) + "Compress data, used for map mask stuff." + (let ((s4-0 0)) + 0 + (while (and (> arg2 0) (< (+ s4-0 131) arg3)) + (cond + ((= (-> arg1 0) (-> arg1 1)) + (let ((v1-2 (-> arg1 0))) + (set! arg1 (&-> arg1 2)) + (let ((a0-2 2)) + (+! arg2 -2) + (while (> arg2 0) + (cond + ((= v1-2 (-> arg1 0)) + (+! a0-2 1) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + (if (>= a0-2 128) + (goto cfg-12) + ) + ) + (else + (goto cfg-12) + ) + ) + ) + (label cfg-12) + (set! (-> arg0 0) (the-as uint (+ a0-2 -1))) + ) + (set! (-> arg0 1) v1-2) + ) + (set! arg0 (&-> arg0 2)) + (+! s4-0 2) + ) + (else + (let ((a0-4 arg1) + (v1-4 1) + ) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + (while (< 1 arg2) + (when (and (= (-> arg1 0) (-> arg1 1)) (< 2 arg2)) + (if (= (-> arg1 0) (-> arg1 2)) + (goto cfg-26) + ) + ) + (+! v1-4 1) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + (if (>= v1-4 127) + (goto cfg-26) + ) + ) + (label cfg-26) + (when (= arg2 1) + (+! v1-4 1) + (set! arg1 (&-> arg1 1)) + (+! arg2 -1) + ) + (set! (-> arg0 0) (the-as uint (- v1-4))) + (let ((a1-21 (&-> arg0 1)) + (a2-4 (+ s4-0 1)) + ) + (dotimes (t0-0 v1-4) + (set! (-> a1-21 t0-0) (-> a0-4 t0-0)) + ) + (set! arg0 (&+ a1-21 v1-4)) + (set! s4-0 (+ a2-4 v1-4)) + ) + ) + ) + ) + ) + (if (< arg3 (+ s4-0 131)) + (format 0 "(GOMI) Warning: May have run out of bigmap bit mask compression memory~%") + ) + (when (= arg2 1) + (set! (-> arg0 0) (the-as uint -1)) + (set! (-> arg0 1) (-> arg1 0)) + (set! arg0 (&-> arg0 2)) + (+! s4-0 2) + (&-> arg1 1) + ) + (set! (-> arg0 0) (the-as uint 0)) + (&-> arg0 1) + (the-as (pointer uint8) (+ s4-0 1)) + ) + ) + + + + diff --git a/test/offline/config/jak3/config.jsonc b/test/offline/config/jak3/config.jsonc index 71d77e3109..cfdf05f7a0 100644 --- a/test/offline/config/jak3/config.jsonc +++ b/test/offline/config/jak3/config.jsonc @@ -96,7 +96,20 @@ "v-slrp2!", "slave-set-rotation!", // bones - "bones-mtx-calc-execute" + "bones-mtx-calc-execute", + // generic + "upload-vu0-program", + "generic-upload-vu0", + "generic-warp-source", + // font + "draw-string", + // decomp + "(method 16 level)", + "unpack-comp-lzo", + // shrubbery + "init-dma-test", + "draw-prototype-inline-array-shrub", + "draw-inline-array-instance-shrub" ], "skip_compile_states": {}