diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 2861024b0f..e874b0140e 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -17960,6 +17960,9 @@ (pad uint128 4 :offset-assert 32) ;; guessed by decompiler (data uint128 1 :offset-assert 96) ;; guessed by decompiler ) + (:methods + (new (symbol type int int) _type_ 0) + ) :method-count-assert 9 :size-assert #x70 :flag-assert #x900000070 @@ -17998,6 +18001,9 @@ (adgif-data (inline-array adgif-shader) :offset-assert 24) ;; guessed by decompiler (data uint128 1 :offset-assert 32) ;; guessed by decompiler ) + (:methods + (new (symbol type int int) _type_ 0) + ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 @@ -18038,9 +18044,9 @@ :size-assert #x8 :flag-assert #xc00000008 (:methods - (simple-sprite-system-method-9 () none 9) - (simple-sprite-system-method-10 () none 10) - (simple-sprite-system-method-11 () none 11) + (add! () none 9) + (simple-sprite-system-method-10 (_type_ dma-buffer) none 10) + (clear! (_type_) none 11) ) ) @@ -18395,7 +18401,7 @@ (bit3 3) (bit4 4) (ready-to-launch 6) ;; maybe just just death? - (bit7 7) + (distort 7) ;; distort sprite (aux-list 8) ;; prevents relaunch, adds to aux (bit9 9) (level0 10) @@ -18403,6 +18409,7 @@ (bit12 12) ;; required to relaunch (bit13 13) (bit14 14) + (glow 15) ;; glow sprite (use-global-acc 16) (launch-along-z 17) (left-multiply-quat 18) @@ -18410,6 +18417,7 @@ (set-conerot 20) ) +(declare-type sparticle-system basic) (deftype sparticle-cpuinfo (structure) ((sprite sprite-vec-data-2d :offset-assert 0) (adgif adgif-shader :offset-assert 4) @@ -18433,7 +18441,7 @@ (user-pntr uint32 :offset 108) (user-object basic :offset 108) (user-sprite sprite-vec-data-2d :offset 108) - (sp-func basic :offset-assert 112) + (sp-func (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) :offset-assert 112) (next-time uint32 :offset-assert 116) (next-launcher basic :offset-assert 120) (cache-alpha float :offset-assert 124) @@ -21180,90 +21188,80 @@ ;; sprite ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype sprite-header (structure) - ((header qword 1 :offset-assert 0) ;; guessed by decompiler - (num-sprites int32 :offset-assert 0) + ((header qword 1 :inline :offset-assert 0) + (num-sprites int32 :offset 0) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype sprite-hvdf-data (structure) - ((data qword 76 :offset-assert 0) ;; guessed by decompiler + ((data qword 76 :inline :offset-assert 0) ) :method-count-assert 9 :size-assert #x4c0 :flag-assert #x9000004c0 ) -|# -#| (deftype sprite-hvdf-control (structure) - ((alloc int8 76 :offset-assert 0) ;; guessed by decompiler + ((alloc int8 76 :offset-assert 0) ) :method-count-assert 9 :size-assert #x4c :flag-assert #x90000004c ) -|# -#| +(defenum sprite-aux-type + :bitfield #f + :type uint32 + (distort 0) + (glow 1) + ) + (deftype sprite-aux-elem (structure) - ((aux-type uint32 :offset-assert 0) - (data UNKNOWN 3 :offset-assert 4) - (vec-data sprite-vec-data-2d :offset-assert 4) - (gif-data adgif-shader :offset-assert 8) - (aux-data sparticle-cpuinfo :offset-assert 12) + ((aux-type sprite-aux-type :offset-assert 0) + (data vector 3 :offset-assert 4) + (vec-data sprite-vec-data-2d :offset 4) + (gif-data adgif-shader :offset 8) + (aux-data sparticle-cpuinfo :offset 12) ) + :pack-me :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype sprite-aux-list (basic) - ((num-entries int32 :offset-assert 4) - (entry int32 :offset-assert 8) - (data sprite-vec-data-2d :dynamic :offset-assert 12) ;; guessed by decompiler + ((num-entries int32 :offset-assert 4) + (entry int32 :offset-assert 8) + (data sprite-aux-elem :dynamic :inline :offset-assert 12) ) + (:methods + (new (symbol type int) _type_ 0) + ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -#| -(deftype sprite-aux-list (basic) - () - :method-count-assert 9 - :size-assert #xc - :flag-assert #x90000000c - ;; Failed to read fields. - ) -|# - -#| (deftype sprite-frame-data (structure) - ((data UNKNOWN 42 :offset-assert 0) - (cdata vector 16 :offset-assert 0) ;; guessed by decompiler - (fdata UNKNOWN 26 :offset-assert 256) - (xy-array UNKNOWN 8 :offset-assert 0) - (st-array UNKNOWN 4 :offset-assert 128) - (xyz-array UNKNOWN 4 :offset-assert 192) - (hmge-scale vector :inline :offset-assert 256) - (consts vector :inline :offset-assert 272) - (pfog0 float :offset-assert 272) - (deg-to-rad float :offset-assert 276) - (min-scale float :offset-assert 280) - (inv-area float :offset-assert 284) - (adgif-giftag qword :inline :offset-assert 288) ;; gs-gif-tag :inline - (sprite-2d-giftag qword :inline :offset-assert 304) ;; gs-gif-tag :inline - (sprite-2d-giftag-2 qword :inline :offset-assert 320) ;; gs-gif-tag :inline + (;;(data UNKNOWN 42 :offset-assert 0) + (cdata vector 16 :inline :offset 0) + ;;(fdata UNKNOWN 26 :offset-assert 256) + (xy-array vector 8 :inline :offset 0) ;; 0 - 32 + (st-array vector 4 :inline :offset 128) ;; 128 - 144 + (xyz-array vector 4 :inline :offset 192) ;; 192 - 208 + (hmge-scale vector :inline :offset 256) + (consts vector :inline :offset 272 :score -1) + (pfog0 float :offset 272) + (deg-to-rad float :offset 276) + (min-scale float :offset 280) + (inv-area float :offset 284) + (adgif-giftag gs-gif-tag :inline :offset-assert 288) + (sprite-2d-giftag gs-gif-tag :inline :offset-assert 304) + (sprite-2d-giftag-2 gs-gif-tag :inline :offset-assert 320) (sincos-01 vector :inline :offset-assert 336) (sincos-23 vector :inline :offset-assert 352) (sincos-45 vector :inline :offset-assert 368) @@ -21271,88 +21269,84 @@ (sincos-89 vector :inline :offset-assert 400) (basis-x vector :inline :offset-assert 416) (basis-y vector :inline :offset-assert 432) - (sprite-3d-giftag qword :inline :offset-assert 448) ;; gs-gif-tag :inline - (sprite-3d-giftag-2 qword :inline :offset-assert 464) + (sprite-3d-giftag gs-gif-tag :inline :offset-assert 448) + (sprite-3d-giftag-2 gs-gif-tag :inline :offset-assert 464) (screen-shader adgif-shader :inline :offset-assert 480) - (inv-hmge-scale vector :inline :offset-assert 576) + (inv-hmge-scale vector :inline :offset 576) (stq-offset vector :inline :offset-assert 592) (stq-scale vector :inline :offset-assert 608) (rgba-plain qword :inline :offset-assert 624) - (warp-giftag qword :inline :offset-assert 640) ;; gs-gif-tag :inline + (warp-giftag gs-gif-tag :inline :offset-assert 640) (fog-clamp vector :inline :offset-assert 656) - (fog-min float :offset-assert 656) - (fog-max float :offset-assert 660) - (max-scale float :offset-assert 664) + (fog-min float :offset 656) + (fog-max float :offset 660) + (max-scale float :offset 664 :score 1) ) :method-count-assert 9 :size-assert #x2a0 :flag-assert #x9000002a0 ) -|# -;; (define-extern sprite-setup-header function) ;; (function sprite-header int none) -;; (define-extern clear-sprite-aux-list function) ;; (function none) -;; (define-extern add-to-sprite-aux-list function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d none) -;; (define-extern sprite-setup-frame-data function) ;; (function sprite-frame-data int none) -;; (define-extern sprite-vu1-block object) ;; vu-function -;; (define-extern sprite-set-3d-quaternion! function) ;; (function sprite-vec-data-3d quaternion quaternion) -;; (define-extern sprite-get-3d-quaternion! function) ;; (function quaternion sprite-vec-data-3d quaternion) -;; (define-extern sprite-add-matrix-data function) ;; (function dma-buffer uint none) -;; (define-extern sprite-add-frame-data function) ;; (function dma-buffer uint none) -;; (define-extern sprite-add-2d-chunk function) ;; (function sprite-array-2d int int dma-buffer int none) -;; (define-extern sprite-add-2d-all function) ;; (function sprite-array-2d dma-buffer int none) -;; (define-extern sprite-add-3d-chunk function) ;; (function sprite-array-3d int int dma-buffer none) -;; (define-extern sprite-add-3d-all function) ;; (function sprite-array-3d dma-buffer int none) +(define-extern sprite-setup-header (function sprite-header int none)) +(define-extern clear-sprite-aux-list (function none)) +(define-extern add-to-sprite-aux-list (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none)) +(define-extern sprite-setup-frame-data (function sprite-frame-data uint none)) +(define-extern sprite-vu1-block vu-function) +(define-extern sprite-set-3d-quaternion! (function sprite-vec-data-3d quaternion quaternion)) +(define-extern sprite-get-3d-quaternion! (function quaternion sprite-vec-data-3d quaternion)) +(define-extern sprite-add-matrix-data (function dma-buffer uint none)) +(define-extern sprite-add-frame-data (function dma-buffer uint none)) +(define-extern sprite-add-2d-chunk (function sprite-array-2d int int dma-buffer int none)) +(define-extern sprite-add-2d-all (function sprite-array-2d dma-buffer int none)) +(define-extern sprite-add-3d-chunk (function sprite-array-3d int int dma-buffer none)) +(define-extern sprite-add-3d-all (function sprite-array-3d dma-buffer int none)) (define-extern sprite-draw (function display none)) -;; (define-extern sprite-allocate-user-hvdf function) ;; (function int) -;; (define-extern sprite-release-user-hvdf function) ;; (function int none) -;; (define-extern sprite-get-user-hvdf function) ;; (function int vector) -;; (define-extern *sprite-hvdf-data* object) ;; sprite-hvdf-data -;; (define-extern *sprite-hvdf-control* object) ;; sprite-hvdf-control -;; (define-extern *sprite-aux-list* object) ;; sprite-aux-list -;; (define-extern *sprite-array-2d* object) ;; sprite-array-2d -;; (define-extern *sprite-array-3d* object) ;; sprite-array-3d +(define-extern sprite-allocate-user-hvdf (function int)) +(define-extern sprite-release-user-hvdf (function int none)) +(define-extern sprite-get-user-hvdf (function int vector)) +(define-extern *sprite-hvdf-data* sprite-hvdf-data) +(define-extern *sprite-hvdf-control* sprite-hvdf-control) +(define-extern *sprite-aux-list* sprite-aux-list) +(define-extern *sprite-array-2d* sprite-array-2d) +(define-extern *sprite-array-3d* sprite-array-3d) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sprite-distort ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype sprite-distorter-sine-tables (basic) - ((aspx float :offset-assert 4) - (aspy float :offset-assert 8) - (entry vector 128 :offset-assert 16) ;; guessed by decompiler - (ientry qword 9 :offset-assert 2064) ;; guessed by decompiler - (giftag qword :inline :offset-assert 2208) ;; gs-gif-tag :inline - (color qword :inline :offset-assert 2224) + ((aspx float :offset-assert 4) + (aspy float :offset-assert 8) + (entry vector 128 :inline :offset-assert 16) + (ientry qword 9 :inline :offset-assert 2064) + (giftag gs-gif-tag :inline :offset-assert 2208) + (color qword :inline :offset-assert 2224) ) :method-count-assert 9 :size-assert #x8c0 :flag-assert #x9000008c0 ) -|# -;; (define-extern *sprite-distorter-sine-tables* object) ;; sprite-distorter-sine-tables +(define-extern *sprite-distorter-sine-tables* sprite-distorter-sine-tables) (define-extern sprite-distorter-generate-tables (function none)) -;; (define-extern sprite-distort-vu1-block object) ;; vu-function -;; (define-extern sprite-init-distorter function) ;; (function dma-buffer uint none) -;; (define-extern sprite-draw-distorters function) ;; (function dma-buffer none) +(define-extern sprite-distort-vu1-block vu-function) +(define-extern sprite-init-distorter (function dma-buffer none)) +(define-extern sprite-draw-distorters (function dma-buffer none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sprite-glow ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype sprite-glow-template (structure) ((clear-init-giftag gs-gif-tag :inline :offset-assert 0) - (clear-init-adcmds UNKNOWN 5 :offset-assert 16) + (clear-init-adcmds vector4w 5 :inline :offset-assert 16) ;; gs-adcmd? (clear-draw-giftag gs-gif-tag :inline :offset-assert 96) (clear-draw-clr-0 gs-packed-rgba :inline :offset-assert 112) - (clear-draw-xyz-0 UNKNOWN 2 :offset-assert 128) + (clear-draw-xyz-0 vector 2 :inline :offset-assert 128) (clear-draw-clr-1 gs-packed-rgba :inline :offset-assert 160) - (clear-draw-xyz-1 UNKNOWN 2 :offset-assert 176) + (clear-draw-xyz-1 vector 2 :inline :offset-assert 176) (offscr-setup-giftag gs-gif-tag :inline :offset-assert 208) - (offscr-setup-adcmds UNKNOWN 8 :offset-assert 224) + (offscr-setup-adcmds vector4w 8 :inline :offset-assert 224) ;; gs-adcmd? (offscr-first-giftag gs-gif-tag :inline :offset-assert 352) (offscr-first-clr gs-packed-rgba :inline :offset-assert 368) (offscr-first-uv-0 gs-packed-uv :inline :offset-assert 384) @@ -21360,7 +21354,7 @@ (offscr-first-uv-1 gs-packed-uv :inline :offset-assert 416) (offscr-first-xyzw-1 gs-packed-xyzw :inline :offset-assert 432) (repeat-draw-giftag gs-gif-tag :inline :offset-assert 448) - (repeat-draw-adcmds UNKNOWN 29 :offset-assert 464) + (repeat-draw-adcmds vector4w 29 :inline :offset-assert 464) ;; gs-adcmd? (flare-alpha-giftag gs-gif-tag :inline :offset-assert 928) (flare-alpha-clr gs-packed-rgba :inline :offset-assert 944) (flare-alpha-uv gs-packed-uv :inline :offset-assert 960) @@ -21369,7 +21363,7 @@ (flare-alpha-xyzw-2 gs-packed-xyzw :inline :offset-assert 1008) (flare-alpha-xyzw-3 gs-packed-xyzw :inline :offset-assert 1024) (flare-init-giftag gs-gif-tag :inline :offset-assert 1040) - (flare-init-adcmds UNKNOWN 8 :offset-assert 1056) + (flare-init-adcmds vector4w 8 :inline :offset-assert 1056) ;; gs-adcmd? (flare-draw-giftag gs-gif-tag :inline :offset-assert 1184) (flare-draw-clr gs-packed-rgba :inline :offset-assert 1200) (flare-draw-stq-0 gs-packed-stq :inline :offset-assert 1216) @@ -21385,37 +21379,33 @@ :size-assert #x540 :flag-assert #x900000540 ) -|# -#| (deftype sprite-glow-consts (structure) - ((camera matrix :inline :offset-assert 0) - (perspective matrix :inline :offset-assert 64) - (hvdf-offset vector :inline :offset-assert 128) - (hmge-scale vector :inline :offset-assert 144) - (consts vector :inline :offset-assert 160) - (pfog0 float :offset-assert 160) - (deg-to-rad float :offset-assert 164) - (min-scale float :offset-assert 168) - (inv-area float :offset-assert 172) - (sincos-01 vector :inline :offset-assert 176) - (sincos-23 vector :inline :offset-assert 192) - (sincos-45 vector :inline :offset-assert 208) - (sincos-67 vector :inline :offset-assert 224) - (sincos-89 vector :inline :offset-assert 240) - (basis-x vector :inline :offset-assert 256) - (basis-y vector :inline :offset-assert 272) - (xy-array UNKNOWN 4 :offset-assert 288) - (clamp-min vector :inline :offset-assert 352) - (clamp-max vector :inline :offset-assert 368) + ((camera matrix :inline :offset-assert 0) + (perspective matrix :inline :offset-assert 64) + (hvdf-offset vector :inline :offset-assert 128) + (hmge-scale vector :inline :offset-assert 144) + (consts vector :inline :offset-assert 160 :score -1) + (pfog0 float :offset 160) + (deg-to-rad float :offset 164) + (min-scale float :offset 168) + (inv-area float :offset 172) + (sincos-01 vector :inline :offset-assert 176) + (sincos-23 vector :inline :offset-assert 192) + (sincos-45 vector :inline :offset-assert 208) + (sincos-67 vector :inline :offset-assert 224) + (sincos-89 vector :inline :offset-assert 240) + (basis-x vector :inline :offset-assert 256) + (basis-y vector :inline :offset-assert 272) + (xy-array vector 4 :inline :offset-assert 288) + (clamp-min vector :inline :offset-assert 352) + (clamp-max vector :inline :offset-assert 368) ) :method-count-assert 9 :size-assert #x180 :flag-assert #x900000180 ) -|# -#| (deftype sprite-glow-dma-packet-data (structure) ((control-packet dma-packet :inline :offset-assert 0) (vecdata-packet dma-packet :inline :offset-assert 16) @@ -21427,13 +21417,11 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype sprite-glow-cnt-template (structure) ((control-packet dma-packet :inline :offset-assert 0) (num-sprites uint32 :offset-assert 16) - (dummys UNKNOWN 3 :offset-assert 20) + (dummys uint32 3 :offset-assert 20) (vecdata-packet dma-packet :inline :offset-assert 32) (vecdata sprite-glow-data :inline :offset-assert 48) (shader-packet dma-packet :inline :offset-assert 112) @@ -21444,13 +21432,11 @@ :size-assert #xe0 :flag-assert #x9000000e0 ) -|# -#| (deftype sprite-glow-ref-template (structure) ((control-packet dma-packet :inline :offset-assert 0) (num-sprites uint32 :offset-assert 16) - (dummys UNKNOWN 3 :offset-assert 20) + (dummys uint32 3 :offset-assert 20) (vecdata-packet dma-packet :inline :offset-assert 32) (vecdata sprite-glow-data :inline :offset-assert 48) (shader-packet dma-packet :inline :offset-assert 112) @@ -21460,18 +21446,17 @@ :size-assert #x90 :flag-assert #x900000090 ) -|# -;; (define-extern *sprite-glow-template* object) -;; (define-extern sprite-glow-vu1-block object) -;; (define-extern sprite-glow-init-consts function) -;; (define-extern sprite-glow-init-engine function) -;; (define-extern *sprite-glow-dma-packet-data* object) -;; (define-extern sprite-glow-add-sprite function) +(define-extern *sprite-glow-template* sprite-glow-template) +(define-extern sprite-glow-vu1-block vu-function) +(define-extern sprite-glow-init-consts (function sprite-glow-consts none)) +(define-extern sprite-glow-init-engine (function dma-buffer none)) +(define-extern *sprite-glow-dma-packet-data* sprite-glow-dma-packet-data) +(define-extern sprite-glow-add-sprite (function dma-buffer sprite-vec-data-2d float float float adgif-shader none)) ;; (define-extern sprite-glow-add-simple-sprite function) -;; (define-extern sprite-glow-draw function) -;; (define-extern add-shader-to-dma function) -;; (define-extern *simple-sprite-system* object) +(define-extern sprite-glow-draw (function dma-buffer none)) +(define-extern add-shader-to-dma (function dma-buffer pointer)) +(define-extern *simple-sprite-system* simple-sprite-system) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; debug-sphere ;; diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 4c9a6d656e..7f3bb00219 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -226,6 +226,8 @@ "real-main-draw-hook": [114, 115, 116, 118], + "sprite-draw-distorters": [4,5], + "(method 12 perf-stat)": [0], "(method 11 perf-stat)": [0] }, diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 36b5c595a7..be30b0a352 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -62,6 +62,9 @@ "joint-mod-h": [["L43", "(inline-array vector)", 6]], "rigid-body": [["L163", "rigid-body-object-constants"]], "rigid-body-plat": [["L47", "rigid-body-platform-constants"]], + "sprite": [["L51", "vu-function"]], + "sprite-distort": [["L27", "vu-function"]], + "sprite-glow": [["L29", "vu-function"]], "mood-funcs": [ ["L231", "vector"], ["L358", "(pointer uint64)", 1], diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 300c5094a5..a1dcb9cb72 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -572,6 +572,85 @@ [3, "v1", "target"], [14, "a0", "target"] ], + // sprite + "sprite-add-matrix-data": [ + [[5, 15], "a2", "dma-packet"], + [[24, 28], "a1", "matrix"], + [[47, 57], "a2", "dma-packet"], + [[70, 97], "a2", "vector"], + [[98, 113], "a1", "vector"], + [[119, 133], "a1", "vector"] + ], + "sprite-add-frame-data": [ + [[8, 16], "a0", "dma-packet"] + ], + "sprite-add-2d-chunk": [ + [[12, 20], "a0", "dma-packet"], + [[45, 52], "a0", "dma-packet"], + [[69, 76], "a0", "dma-packet"], + [[80, 87], "v1", "dma-packet"], + [65, "a3", "int"] + ], + "sprite-add-3d-chunk": [ + [[11, 19], "a0", "dma-packet"], + [[44, 51], "a0", "dma-packet"], + [[68, 75], "a0", "dma-packet"], + [[79, 87], "v1", "dma-packet"], + [65, "a3", "int"] + ], + "sprite-draw": [ + [[33, 38], "a0", "dma-packet"], + [[41, 48], "a0", "gs-gif-tag"], + [52, "a0", "(pointer gs-test)"], + [54, "a0", "(pointer gs-reg64)"], + [56, "a0", "(pointer gs-clamp)"], + [58, "a0", "(pointer gs-reg64)"], + [[73, 82], "a0", "dma-packet"], + [[87, 92], "a0", "dma-packet"], + [[111, 115], "a0", "dma-packet"], + [[129, 133], "a0", "dma-packet"], + [[150, 154], "a0", "dma-packet"], + [[159, 162], "v1", "dma-packet"] + ], + // sprite-distort + "sprite-init-distorter": [ + [[3, 7], "a1", "dma-packet"], + [[13, 16], "a1", "gs-gif-tag"], + [21, "a1", "(pointer gs-zbuf)"], + [23, "a1", "(pointer gs-reg64)"], + [25, "a1", "(pointer gs-tex0)"], + [27, "a1", "(pointer gs-reg64)"], + [29, "a1", "(pointer gs-tex1)"], + [31, "a1", "(pointer gs-reg64)"], + [32, "a1", "(pointer gs-miptbp)"], + [34, "a1", "(pointer gs-reg64)"], + [36, "a1", "(pointer gs-clamp)"], + [38, "a1", "(pointer gs-reg64)"], + [40, "a1", "(pointer gs-alpha)"], + [42, "a1", "(pointer gs-reg64)"], + [50, "a3", "uint"], + [[53, 58], "a1", "dma-packet"] + ], + "sprite-draw-distorters": [ + [[73, 93], "a0", "vector"], + [75, "v1", "vector"], + [87, "v1", "vector"], + [96, "v1", "vector"], + [100, "v1", "vector"], + [123, "a0", "(pointer int32)"], + [128, "v1", "vector"], + [130, "v1", "vector"], + [136, "v1", "vector"], + [157, "v1", "vector"], + [[175, 192], "a1", "dma-packet"], + [[200, 206], "a0", "dma-packet"], + [[210, 214], "a0", "vector4w"], + [[219, 224], "a0", "dma-packet"], + [[252, 269], "a1", "dma-packet"], + [[277, 281], "a1", "dma-packet"], + [[285, 289], "a1", "vector4w"], + [[293, 298], "v1", "dma-packet"] + ], "(method 10 history)": [[[8, 10], "a1", "history-elt"]], "(method 10 history-iterator)": [[[20, 35], "a2", "history-elt"]], "command-get-time": [[119, "gp", "(pointer float)"]], diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index bf12ca509c..edebde3feb 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -40,6 +40,181 @@ } }, + // sprite + "(method 0 sprite-aux-list)": { + "args": ["allocation", "type-to-make", "size"] + }, + + "(method 0 sprite-array-2d)": { + "args": ["allocation", "type-to-make", "group-0-size", "group-1-size"], + "vars": { + "v1-0": "sprite-count", + "s4-0": "vec-data-size", + "a2-3": "adgif-data-size" + } + }, + + "(method 0 sprite-array-3d)": { + "args": ["allocation", "type-to-make", "group-0-size", "group-1-size"], + "vars": { + "v1-0": "sprite-count", + "s4-0": "vec-data-size", + "a2-3": "adgif-data-size" + } + }, + + "sprite-setup-header": { + "args": ["hdr", "num-sprites"] + }, + + "add-to-sprite-aux-list": { + "args": ["system", "sprite-info", "sprite-vec", "arg3"], + "vars": { + "v1-3": "aux-list" + } + }, + + "sprite-setup-frame-data": { + "args": ["data", "tbp-offset"] + }, + + "sprite-set-3d-quaternion!": { + "args": ["sprite", "quat"] + }, + + "sprite-get-3d-quaternion!": { + "args": ["out", "sprite"] + }, + + "sprite-add-matrix-data": { + "args": ["dma-buff", "matrix-mode"], + "vars": { + "v1-0": "count", + "a2-1": ["pkt1", "dma-packet"], + "a1-2": ["mtx", "matrix"], + "a2-9": ["pkt2", "dma-packet"], + "a1-11": ["mtx2", "matrix"], + "a1-20": "hvdf-idx" + } + }, + + "sprite-add-frame-data": { + "args": ["dma-buff", "tbp-offset"], + "vars": { + "a0-1": ["pkt", "dma-packet"] + } + }, + + "sprite-add-2d-chunk": { + "args": [ + "sprites", + "start-sprite-idx", + "num-sprites", + "dma-buff", + "mscal-addr" + ], + "vars": { + "a0-1": ["pkt1", "dma-packet"], + "s1-0": "qwc-pkt1", + "a1-7": "qwc-pkt2", + "a0-5": ["pkt2", "dma-packet"], + "a1-11": "qwc-pkt3", + "a0-7": ["pkt3", "dma-packet"], + "v1-7": ["pkt4", "dma-packet"] + } + }, + + "sprite-add-2d-all": { + "args": ["sprites", "dma-buff", "group-idx"], + "vars": { + "s4-0": "current-sprite-idx", + "s2-0": "remaining-sprites", + "s3-0": "mscal-addr" + } + }, + + "sprite-add-3d-chunk": { + "args": ["sprites", "start-sprite-idx", "num-sprites", "dma-buff"], + "vars": { + "a0-1": ["pkt1", "dma-packet"], + "s2-0": "qwc-pkt1", + "a1-7": "qwc-pkt2", + "a0-5": ["pkt2", "dma-packet"], + "a1-11": "qwc-pkt3", + "a0-7": ["pkt3", "dma-packet"], + "v1-7": ["pkt4", "dma-packet"] + } + }, + + "sprite-add-3d-all": { + "args": ["sprites", "dma-buff", "group-idx"], + "vars": { + "s4-0": "current-sprite-idx", + "s3-0": "remaining-sprites" + } + }, + + "sprite-draw": { + "args": ["disp"], + "vars": { + "gp-0": "dma-mem-begin", + "s4-0": "dma-buff", + "s5-0": "dma-bucket-begin", + "a0-6": ["pkt1", "dma-packet"], + "a0-8": "giftag", + "a0-14": ["pkt2", "dma-packet"], + "a0-16": ["pkt3", "dma-packet"], + "a0-21": ["pkt4", "dma-packet"], + "a0-25": ["pkt5", "dma-packet"], + "a0-30": ["pkt6", "dma-packet"], + "v1-27": ["pkt7", "dma-packet"], + "v1-34": "mem-use" + } + }, + + "sprite-release-user-hvdf": { + "args": ["idx"] + }, + + "sprite-get-user-hvdf": { + "args": ["idx"] + }, + + // sprite-distort + "sprite-distorter-generate-tables": { + "vars": { + "gp-0": "tbls", + "f28-0": "cam-aspx", + "f30-0": "cam-aspy", + "f26-0": "rot", + "s4-0": "turns", + "s2-0": "turn", + "s3-0": "entry-idx", + "s5-0": "ientry-idx" + } + }, + + "sprite-init-distorter": { + "args": ["dma-buff"] + }, + + "sprite-draw-distorters": { + "args": ["dma-buff"], + "vars": { + "s0-0": "dma-chunk-start", + "s1-0": "i", + "s2-0": "num-entries", + "v1-5": "aux-elem", + "sv-16": "sprite", + "a0-3": "dma-position", + "sv-32": "dma-st-flag", + "sv-48": "dma-color", + "s4-0": "chunk-sprite-count", + "s5-0": "draw-sprite-count", + "v1-26": "clip-result" + } + }, + "(method 18 mood-control)": { "vars": { "v0-3": ["lightning-sound-id", "sound-id"] diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index 0f56c255b9..d80f54495b 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -7,7 +7,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": [], + "allowed_objects": ["mood-tables"], "banned_objects": ["effect-control"], //////////////////////////// diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc index 40f749b079..5e0af7ded2 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc @@ -5,6 +5,8 @@ ;; name in dgo: sparticle-h ;; dgos: ENGINE, GAME +(declare-type sparticle-system basic) + (defenum sp-cpuinfo-flag :bitfield #t :type uint32 @@ -14,7 +16,7 @@ (bit3 3) (bit4 4) (ready-to-launch 6) ;; maybe just just death? - (bit7 7) + (distort 7) ;; distort sprite (aux-list 8) ;; prevents relaunch, adds to aux (bit9 9) (level0 10) @@ -22,6 +24,7 @@ (bit12 12) ;; required to relaunch (bit13 13) (bit14 14) + (glow 15) ;; glow sprite (use-global-acc 16) (launch-along-z 17) (left-multiply-quat 18) @@ -40,41 +43,41 @@ (define *sp-60-hz* #t) (deftype sparticle-cpuinfo (structure) - ((sprite sprite-vec-data-2d :offset-assert 0) - (adgif adgif-shader :offset-assert 4) - (radius float :offset-assert 8) - (omega float :offset-assert 12) - (vel-sxvel vector :inline :offset-assert 16) - (rot-syvel vector :inline :offset-assert 32) - (fade rgbaf :inline :offset-assert 48) - (acc vector :inline :offset-assert 64) - (rotvel3d quaternion :inline :offset-assert 80) - (vel vector3s :inline :offset 16) - (accel vector3s :inline :offset 64) - (scalevelx float :offset 28) - (scalevely float :offset 44) - (friction float :offset-assert 96) - (timer int32 :offset-assert 100) - (flags sp-cpuinfo-flag :offset-assert 104) - (user-int32 int32 :offset-assert 108) - (user-uint32 uint32 :offset 108) - (user-float float :offset 108) - (user-pntr uint32 :offset 108) - (user-object basic :offset 108) - (user-sprite sprite-vec-data-2d :offset 108) - (sp-func basic :offset-assert 112) - (next-time uint32 :offset-assert 116) - (next-launcher basic :offset-assert 120) - (cache-alpha float :offset-assert 124) - (valid uint8 :offset-assert 128) - (clock-index uint8 :offset-assert 129) - (user1-int16 uint16 :offset-assert 130) - (key sparticle-launch-control :offset-assert 132) - (binding sparticle-launch-state :offset-assert 136) - (data uint32 1 :offset 12) - (datab uint8 4 :offset 12) - (dataf float 1 :offset 12) - (datac uint8 1 :offset 12) + ((sprite sprite-vec-data-2d :offset-assert 0) + (adgif adgif-shader :offset-assert 4) + (radius float :offset-assert 8) + (omega float :offset-assert 12) + (vel-sxvel vector :inline :offset-assert 16) + (rot-syvel vector :inline :offset-assert 32) + (fade rgbaf :inline :offset-assert 48) + (acc vector :inline :offset-assert 64) + (rotvel3d quaternion :inline :offset-assert 80) + (vel vector3s :inline :offset 16) + (accel vector3s :inline :offset 64) + (scalevelx float :offset 28) + (scalevely float :offset 44) + (friction float :offset-assert 96) + (timer int32 :offset-assert 100) + (flags sp-cpuinfo-flag :offset-assert 104) + (user-int32 int32 :offset-assert 108) + (user-uint32 uint32 :offset 108) + (user-float float :offset 108) + (user-pntr uint32 :offset 108) + (user-object basic :offset 108) + (user-sprite sprite-vec-data-2d :offset 108) + (sp-func (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) :offset-assert 112) + (next-time uint32 :offset-assert 116) + (next-launcher basic :offset-assert 120) + (cache-alpha float :offset-assert 124) + (valid uint8 :offset-assert 128) + (clock-index uint8 :offset-assert 129) + (user1-int16 uint16 :offset-assert 130) + (key sparticle-launch-control :offset-assert 132) + (binding sparticle-launch-state :offset-assert 136) + (data uint32 1 :offset 12) + (datab uint8 4 :offset 12) + (dataf float 1 :offset 12) + (datac uint8 1 :offset 12) ) :method-count-assert 9 :size-assert #x8c diff --git a/goal_src/jak2/engine/gfx/sprite/simple-sprite-h.gc b/goal_src/jak2/engine/gfx/sprite/simple-sprite-h.gc index e857dda62f..60b1ac09aa 100644 --- a/goal_src/jak2/engine/gfx/sprite/simple-sprite-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/simple-sprite-h.gc @@ -46,8 +46,8 @@ :size-assert #x8 :flag-assert #xc00000008 (:methods - (simple-sprite-system-method-9 () none 9) - (simple-sprite-system-method-10 () none 10) - (simple-sprite-system-method-11 () none 11) + (add! () none 9) + (simple-sprite-system-method-10 (_type_ dma-buffer) none 10) + (clear! (_type_) none 11) ) ) diff --git a/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc b/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc index b893198f87..53a3244534 100644 --- a/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc +++ b/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc @@ -5,5 +5,471 @@ ;; name in dgo: sprite-distort ;; dgos: ENGINE, GAME +;; Works just like Jak 1 with some exceptions: +;; - Sprite texture source doesn't seem to be the current framebuffer, instead tbp0 is hardcoded to #x3300. +;; - The sprite-aux-list contains more than just distort sprites. Instead of containing sprite-vec-data-2d's +;; directly, it's now a list of sprite-aux-elem. If the aux-type is 0, then that element is a distort sprite. +;; - No longer takes *video-params* screen-sy into account. + +;; Sprite distort works by drawing a circle for each sprite whose texture is the framebuffer contents of what's +;; been drawn so far. The texture coordinates are off slightly to give a "distortion" effect as the sprite moves +;; across the screen. The resolution of the circle is defined by the number of "turns", which can range between +;; 3 and 11. Turns basically define the number of edges that make up the circle, so 3 turns will create a triangle, +;; 5 will create a pentagon, etc. The sprite-vec-data-2d 'warp-turns'/'flag' field contains the number of turns. + ;; DECOMP BEGINS +;; Contains the base mesh of each possible distort sprite shape. Everything excluding aspx and aspy +;; are uploaded to VU memory. +;; +;; See sprite-distorter-generate-tables. +(deftype sprite-distorter-sine-tables (basic) + ((aspx float :offset-assert 4) + (aspy float :offset-assert 8) + (entry vector 128 :inline :offset-assert 16) + (ientry qword 9 :inline :offset-assert 2064) + (giftag gs-gif-tag :inline :offset-assert 2208) + (color qword :inline :offset-assert 2224) + ) + :method-count-assert 9 + :size-assert #x8c0 + :flag-assert #x9000008c0 + ) + +(defmethod inspect sprite-distorter-sine-tables ((obj sprite-distorter-sine-tables)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Taspx: ~f~%" (-> obj aspx)) + (format #t "~1Taspy: ~f~%" (-> obj aspy)) + (format #t "~1Tentry[128] @ #x~X~%" (-> obj entry)) + (format #t "~1Tientry[9] @ #x~X~%" (-> obj ientry)) + (format #t "~1Tgiftag: #~%" (-> obj giftag)) + (format #t "~1Tcolor: #~%" (-> obj color)) + (label cfg-4) + obj + ) + +(kmemopen global "sprite-distort-tables") +(define *sprite-distorter-sine-tables* (new 'global 'sprite-distorter-sine-tables)) +(kmemclose) + +;; Called from update-math-camera. +;; Whenever the camera's aspect ratio changes, recalculates the *sprite-distorter-sine-tables*. +;; +;; Every two vectors in 'entry' contain the position and texture coordinates for a vertex. +;; The vertices for each circular shape made up of a given number of turns/edges are placed into this +;; list. For example, the first 6 vectors in entry will be the 3 vertices of a circle made up of 3 turns. +;; Then the next 8 vectors will be the 4 vertices of one made up of 4 turns, and so on until (and including) 11 turns. +;; +;; This list also cheats a little. When the VU program goes to render one of these shapes, the final vertex +;; of the shape will be connected to the first vertex of the next shape. In other words, when rendering the +;; shape of 3 turns, the final vertex will be connected to the first vertex of the vertices for 4 turns. +;; Because of this, a single extra vertex is added after the 11 turns shape, totalling the 128 vectors. +;; This works because the first vertex is always the same top-center position. +;; +;; The ientry list is given VU memory addresses into the entry list for each shape. +;; For example, ientry[0] is 352 which is the vertex data for 3 turns, ientry[1] is 358 which is the +;; vertex data for 4 turns, etc. +;; +;; Additionally, a giftag is pre-calculated for rendering each shape along with a color. But the giftag +;; never changes and the color is always (1.0, 1.0, 1.0, 1.0). +(defun sprite-distorter-generate-tables () + (let ((tbls *sprite-distorter-sine-tables*)) + (let ((entry-idx 0) + (ientry-idx 0) + (turns 3) + (cam-aspx (- (-> *math-camera* perspective data 0))) + (cam-aspy (- (-> *math-camera* perspective data 5))) + ) + (when (or (!= cam-aspx (-> tbls aspx)) (!= cam-aspy (-> tbls aspy))) + (set! (-> tbls aspx) cam-aspx) + (set! (-> tbls aspy) cam-aspy) + (while (< turns 12) + (set! (-> tbls ientry ientry-idx vector4w x) (+ entry-idx 352)) + (+! ientry-idx 1) + (dotimes (turn turns) + (let ((rot (* 65536.0 (/ (the float turn) (the float turns))))) + (set-vector! (-> tbls entry entry-idx) (* (sin rot) cam-aspx) (* (cos rot) cam-aspy) 0.0 0.0) + (let ((s3-1 (+ entry-idx 1))) + (set-vector! + (-> tbls entry s3-1) + (* 0.001953125 cam-aspx (sin rot)) + (* 0.001953125 cam-aspy (cos rot)) + 0.0 + 0.0 + ) + (set! entry-idx (+ s3-1 1)) + ) + ) + ) + (+! turns 1) + ) + (set-vector! (-> tbls entry entry-idx) 0.0 cam-aspy 0.0 0.0) + (let ((v1-20 (+ entry-idx 1))) + (set-vector! (-> tbls entry v1-20) 0.0 (* 0.001953125 cam-aspy) 0.0 0.0) + (+ v1-20 1) + ) + ) + ) + (set! (-> tbls giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :tme #x1) + :nreg #xf + ) + ) + (set! (-> tbls giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id st) + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id rgbaq) + :regs5 (gif-reg-id xyzf2) + :regs6 (gif-reg-id st) + :regs7 (gif-reg-id rgbaq) + :regs8 (gif-reg-id xyzf2) + :regs9 (gif-reg-id st) + :regs10 (gif-reg-id rgbaq) + :regs11 (gif-reg-id xyzf2) + :regs12 (gif-reg-id st) + :regs13 (gif-reg-id rgbaq) + :regs14 (gif-reg-id xyzf2) + ) + ) + (set! (-> tbls color vector4w x) 128) + (set! (-> tbls color vector4w y) 128) + (set! (-> tbls color vector4w z) 128) + (set! (-> tbls color vector4w w) 128) + ) + 0 + (none) + ) + +(define sprite-distort-vu1-block (new 'static 'vu-function :length 63 :qlength 32)) + +;; Sets up GS registers, adds a reference to *sprite-distorter-sine-tables*, and loads the VU program. +(defun sprite-init-distorter ((dma-buff dma-buffer)) + (let* ((v1-0 dma-buff) + (a1-0 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a1-0) dma) (new 'static 'dma-tag :qwc #x7 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-0) vif1) (new 'static 'vif-tag :imm #x7 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-0 base) (&+ (the-as pointer a1-0) 16)) + ) + (let* ((v1-1 dma-buff) + (a1-2 (the-as object (-> v1-1 base))) + ) + (set! (-> (the-as gs-gif-tag a1-2) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x6)) + (set! (-> (the-as gs-gif-tag a1-2) 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) + :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) + ) + ) + (set! (-> v1-1 base) (&+ (the-as pointer a1-2) 16)) + ) + (let* ((v1-2 dma-buff) + (a1-4 (-> v1-2 base)) + ) + (set! (-> (the-as (pointer gs-zbuf) a1-4) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 1) (gs-reg64 zbuf-1)) + (set! (-> (the-as (pointer gs-tex0) a1-4) 2) (new 'static 'gs-tex0 :tbp0 #x3300 :tbw #x8 :tw #x9 :th #x9)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 3) (gs-reg64 tex0-1)) + (set! (-> (the-as (pointer gs-tex1) a1-4) 4) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 5) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer gs-miptbp) a1-4) 6) (new 'static 'gs-miptbp)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 7) (gs-reg64 miptbp1-1)) + (set! (-> (the-as (pointer gs-clamp) a1-4) 8) (new 'static 'gs-clamp + :wms (gs-tex-wrap-mode region-clamp) + :wmt (gs-tex-wrap-mode region-clamp) + :maxu #x1ff + :maxv #x19f + ) + ) + (set! (-> (the-as (pointer gs-reg64) a1-4) 9) (gs-reg64 clamp-1)) + (set! (-> (the-as (pointer gs-alpha) a1-4) 10) (new 'static 'gs-alpha :b #x1 :d #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 11) (gs-reg64 alpha-1)) + (set! (-> v1-2 base) (&+ a1-4 96)) + ) + (let* ((v1-3 dma-buff) + (a1-6 (the-as object (-> v1-3 base))) + ) + (set! (-> (the-as dma-packet a1-6) dma) + (new 'static 'dma-tag + :qwc #x8b + :id (dma-tag-id ref) + :addr (the-as uint (-> *sprite-distorter-sine-tables* entry)) + ) + ) + (set! (-> (the-as dma-packet a1-6) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet a1-6) vif1) + (new 'static 'vif-tag :imm #x160 :num #x8b :cmd (vif-cmd unpack-v4-32)) + ) + (set! (-> v1-3 base) (&+ (the-as pointer a1-6) 16)) + ) + (dma-buffer-add-vu-function dma-buff sprite-distort-vu1-block 1) + 0 + (none) + ) + +;; Calculates per-sprite data like positions and texture coordinates, puts each sprite onto +;; the DMA chain in chunks, and calls into the VU program to draw. +;; +;; - Only aux sprites with an aux-type of 0 are processed. +;; - Sprites will be skipped if their 'warp-turns'/'flag' is 0 or if they fail the clipping test. +;; - Sprite coordinates are transformed into screen-coordinates ahead of time in GOAL. +;; - If the sprite's 'matrix' field is 1, then the sprite is in screen-space, +;; otherwise it's in world-space. +;; - Sprites are uploaded in chunks of 85. +;; - For every 2 chunks, a call into the VU program is added. +(defun sprite-draw-distorters ((dma-buff dma-buffer)) + (local-vars + (v1-15 float) + (v1-21 float) + (clip-result int) + (v1-63 float) + (sprite sprite-vec-data-2d) + (dma-st-flag pointer) + (dma-color pointer) + ) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf10 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf8 :class vf) + (vf9 :class vf) + ) + (init-vf0-vector) + (.lvf vf8 (&-> *math-camera* hmge-scale quad)) + (let ((dma-chunk-start (-> dma-buff base)) + (chunk-sprite-count 0) + (draw-sprite-count 0) + ) + (&+! (-> dma-buff base) 16) + (let* ((s3-0 *sprite-aux-list*) + (num-entries (-> s3-0 entry)) + ) + (dotimes (i num-entries) + (let ((aux-elem (-> s3-0 data i))) + (when (= (-> aux-elem aux-type) (sprite-aux-type distort)) + (set! sprite (-> aux-elem vec-data)) + (let ((dma-position (the-as object (-> dma-buff base)))) + (set! dma-st-flag (&+ (the-as pointer dma-position) 16)) + (set! dma-color (&+ (the-as pointer dma-position) 32)) + (cond + ((= (-> sprite flag-rot-sy y) 1) + (.lvf vf3 (&-> *math-camera* sprite-2d vector 0 quad)) + (.lvf vf4 (&-> *math-camera* sprite-2d vector 1 quad)) + (.lvf vf5 (&-> *math-camera* sprite-2d vector 2 quad)) + (.lvf vf6 (&-> *math-camera* sprite-2d trans quad)) + (.lvf vf9 (&-> *math-camera* sprite-2d-hvdf quad)) + (.mov v1-15 vf9) + ) + (else + (.lvf vf3 (&-> *math-camera* camera-temp vector 0 quad)) + (.lvf vf4 (&-> *math-camera* camera-temp vector 1 quad)) + (.lvf vf5 (&-> *math-camera* camera-temp vector 2 quad)) + (.lvf vf6 (&-> *math-camera* camera-temp trans quad)) + (.lvf vf9 (&-> *math-camera* hvdf-off quad)) + (.mov v1-21 vf9) + ) + ) + (.lvf vf1 (&-> sprite x-y-z-sx quad)) + (.lvf vf2 (&-> sprite r-g-b-a quad)) + (.mul.w.vf acc vf6 vf0) + (.add.mul.x.vf acc vf3 vf1 acc) + (.add.mul.y.vf acc vf4 vf1 acc) + (.add.mul.z.vf vf1 vf5 vf1 acc) + (.mul.vf vf10 vf1 vf8) + (.div.vf Q vf0 vf10 :fsf #b11 :ftf #b11) + ;;(TODO.VCLIP vf10 vf10) + (b! (zero? (-> sprite flag-rot-sy x)) cfg-22 :delay (nop!)) + (.wait.vf) + (.mul.vf vf1 vf1 Q :mask #b111) + (.mul.vf vf2 vf2 Q :mask #b111) + ;;(.cfc2.i clip-result Clipping) + (set! clip-result (vu-clip vf10 0)) ;; safe to just drop the higher bits. + (b! (logtest? clip-result 63) cfg-22 :delay (.add.vf vf1 vf1 vf9)) + (.max.x.vf vf1 vf1 vf0 :mask #b1000) + (.svf (&-> (the-as vector dma-position) quad) vf1) + (.svf (&-> (the-as vector dma-color) quad) vf2) + (set! (-> (the-as vector dma-position) w) 255.0) + (set! (-> (the-as vector dma-st-flag) x) (* 0.001953125 (+ -1792.0 (-> (the-as vector dma-position) x)))) + (set! (-> (the-as vector dma-st-flag) y) (* 0.001953125 (+ -1840.0 (-> (the-as vector dma-position) y)))) + ) + (set! (-> (the-as vector dma-st-flag) z) 1.0) + (when (or (< (the-as int (-> sprite flag-rot-sy x)) 3) (< 11 (the-as int (-> sprite flag-rot-sy x)))) + (format 0 "Turns = ~D!!!~%" (-> sprite flag-rot-sy x)) + (set! (-> sprite flag-rot-sy x) (the-as float #xb)) + ) + (set! (-> (the-as (pointer int32) dma-st-flag) 3) (the-as int (-> sprite flag-rot-sy x))) + (let* ((f1-4 (- (-> *math-camera* perspective data 5))) + (f2-2 (-> (the-as vector dma-st-flag) y)) + (f4-0 (+ f2-2 (* (-> (the-as vector dma-color) x) f1-4))) + (f3-0 256.0) + (f0-9 (-> (the-as vector dma-color) x)) + ) + (if (< 416.0 f4-0) + (set! f3-0 (/ (- 416.0 f2-2) f1-4)) + ) + (if (< 128.0 f3-0) + (set! f3-0 128.0) + ) + (when (< f3-0 f0-9) + (let ((v1-61 (/ f3-0 f0-9))) + (.mov vf1 v1-61) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> (the-as vector dma-color) quad) vf2) + (.mov v1-63 vf2) + ) + ) + (&+! (-> dma-buff base) 48) + (+! chunk-sprite-count 1) + (when (= chunk-sprite-count 85) + (let ((v1-68 (-> dma-buff base))) + (set! (-> dma-buff base) dma-chunk-start) + (let* ((a0-10 dma-buff) + (a1-3 (the-as object (-> a0-10 base))) + ) + (set! (-> (the-as dma-packet a1-3) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 3 chunk-sprite-count)) + ) + (set! (-> (the-as dma-packet a1-3) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-3) vif1) (new 'static 'vif-tag + :cmd (vif-cmd unpack-v4-32) + :imm (shr (shl (+ (* 3 draw-sprite-count) 512) 54) 54) + :num (* 3 chunk-sprite-count) + ) + ) + (set! (-> a0-10 base) (&+ (the-as pointer a1-3) 16)) + ) + (set! (-> dma-buff base) v1-68) + ) + (set! chunk-sprite-count 0) + (+! draw-sprite-count 85) + (when (= draw-sprite-count 170) + (let* ((v1-71 dma-buff) + (a0-11 (the-as object (-> v1-71 base))) + ) + (set! (-> (the-as dma-packet a0-11) dma) (new 'static 'dma-tag :qwc #x1 :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 :imm #x1ff :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + (set! (-> v1-71 base) (&+ (the-as pointer a0-11) 16)) + ) + (let* ((v1-72 dma-buff) + (a0-13 (the-as object (-> v1-72 base))) + ) + (set! (-> (the-as vector4w a0-13) x) draw-sprite-count) + (set! (-> (the-as vector4w a0-13) y) 0) + (set! (-> (the-as vector4w a0-13) z) 0) + (set! (-> (the-as vector4w a0-13) w) 0) + (set! (-> v1-72 base) (&+ (the-as pointer a0-13) 16)) + ) + (let* ((v1-73 dma-buff) + (a0-15 (the-as object (-> v1-73 base))) + ) + (set! (-> (the-as dma-packet a0-15) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-15) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> (the-as dma-packet a0-15) vif1) (new 'static 'vif-tag :cmd (vif-cmd flush) :msk #x1)) + (set! (-> v1-73 base) (&+ (the-as pointer a0-15) 16)) + ) + (set! draw-sprite-count 0) + ) + (set! dma-chunk-start (-> dma-buff base)) + (&+! (-> dma-buff base) 16) + ) + ) + ) + (label cfg-22) + 0 + ) + ) + (cond + ((zero? chunk-sprite-count) + (set! (-> dma-buff base) dma-chunk-start) + (nop!) + 0 + ) + (else + (let ((v1-81 (-> dma-buff base))) + (set! (-> dma-buff base) dma-chunk-start) + (let* ((a0-17 dma-buff) + (a1-10 (the-as object (-> a0-17 base))) + ) + (set! (-> (the-as dma-packet a1-10) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 3 chunk-sprite-count)) + ) + (set! (-> (the-as dma-packet a1-10) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-10) vif1) (new 'static 'vif-tag + :cmd (vif-cmd unpack-v4-32) + :imm (shr (shl (+ (* 3 draw-sprite-count) 512) 54) 54) + :num (* 3 chunk-sprite-count) + ) + ) + (set! (-> a0-17 base) (&+ (the-as pointer a1-10) 16)) + ) + (set! (-> dma-buff base) v1-81) + ) + ) + ) + (let ((v1-82 (+ chunk-sprite-count draw-sprite-count))) + (when (nonzero? v1-82) + (let* ((a0-19 dma-buff) + (a1-12 (the-as object (-> a0-19 base))) + ) + (set! (-> (the-as dma-packet a1-12) dma) (new 'static 'dma-tag :qwc #x1 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-12) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-12) vif1) + (new 'static 'vif-tag :imm #x1ff :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + (set! (-> a0-19 base) (&+ (the-as pointer a1-12) 16)) + ) + (let* ((a0-20 dma-buff) + (a1-14 (the-as object (-> a0-20 base))) + ) + (set! (-> (the-as vector4w a1-14) x) v1-82) + (set! (-> (the-as vector4w a1-14) y) 0) + (set! (-> (the-as vector4w a1-14) z) 0) + (set! (-> (the-as vector4w a1-14) w) 0) + (set! (-> a0-20 base) (&+ (the-as pointer a1-14) 16)) + ) + (let ((v1-84 (the-as object (-> dma-buff base)))) + (set! (-> (the-as dma-packet v1-84) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet v1-84) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> (the-as dma-packet v1-84) vif1) (new 'static 'vif-tag :cmd (vif-cmd flush) :msk #x1)) + (set! (-> dma-buff base) (&+ (the-as pointer v1-84) 16)) + ) + ) + ) + ) + 0 + (none) + ) + ) diff --git a/goal_src/jak2/engine/gfx/sprite/sprite-h.gc b/goal_src/jak2/engine/gfx/sprite/sprite-h.gc index 41c9c3f7d2..d894aa2789 100644 --- a/goal_src/jak2/engine/gfx/sprite/sprite-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/sprite-h.gc @@ -5,6 +5,11 @@ ;; name in dgo: sprite-h ;; dgos: ENGINE, GAME +(define-extern sprite-init-distorter (function dma-buffer none)) +(define-extern sprite-draw-distorters (function dma-buffer none)) +(define-extern sprite-glow-init-engine (function dma-buffer none)) +(define-extern sprite-glow-draw (function dma-buffer none)) + ;; DECOMP BEGINS (deftype sprite-vec-data-2d (structure) @@ -45,6 +50,9 @@ :method-count-assert 9 :size-assert #x70 :flag-assert #x900000070 + (:methods + (new (symbol type int int) _type_ 0) + ) ) (deftype sprite-vec-data-3d (structure) @@ -83,4 +91,7 @@ :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 + (:methods + (new (symbol type int int) _type_ 0) + ) ) diff --git a/goal_src/jak2/engine/gfx/sprite/sprite.gc b/goal_src/jak2/engine/gfx/sprite/sprite.gc index 0f5536b96c..0f90d02e3e 100644 --- a/goal_src/jak2/engine/gfx/sprite/sprite.gc +++ b/goal_src/jak2/engine/gfx/sprite/sprite.gc @@ -5,5 +5,1073 @@ ;; name in dgo: sprite ;; dgos: ENGINE, GAME +;; the sprite renderer draw 2D or 3D sprites + +(defenum sprite-aux-type + :bitfield #f + :type uint32 + (distort 0) + (glow 1) + ) + +(define-extern paused? (function symbol)) +(define-extern *simple-sprite-system* simple-sprite-system) + ;; DECOMP BEGINS +(kmemopen global "sprite-tables") + +;; This is the first quadword of the data sent to VU1. +;; It contains the number of sprites that should be drawn. +(deftype sprite-header (structure) + ((header qword 1 :inline :offset-assert 0) + (num-sprites int32 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(defmethod inspect sprite-header ((obj sprite-header)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-header) + (format #t "~1Theader[1] @ #x~X~%" (-> obj header)) + (format #t "~1Tnum-sprites: ~D~%" (-> obj num-sprites)) + (label cfg-4) + obj + ) + +(defun sprite-setup-header ((hdr sprite-header) (num-sprites int)) + "Setup a sprite-header for the given number of sprites" + (set! (-> hdr num-sprites) num-sprites) + (none) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; HVDF Data +;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; the meaning of this is unknown. +;; the first one in the list is special and the remaining 75 can be allocated/freed. +(deftype sprite-hvdf-data (structure) + ((data qword 76 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4c0 + :flag-assert #x9000004c0 + ) + +(defmethod inspect sprite-hvdf-data ((obj sprite-hvdf-data)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-hvdf-data) + (format #t "~1Tdata[76] @ #x~X~%" (-> obj data)) + (label cfg-4) + obj + ) + +;; Each byte indicates if the corresponding entry in +;; sprite-hvdf-data is allocated or not. +(deftype sprite-hvdf-control (structure) + ((alloc int8 76 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4c + :flag-assert #x90000004c + ) + +(defmethod inspect sprite-hvdf-control ((obj sprite-hvdf-control)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-hvdf-control) + (format #t "~1Talloc[76] @ #x~X~%" (-> obj alloc)) + (label cfg-4) + obj + ) + +(define *sprite-hvdf-data* (new 'global 'sprite-hvdf-data)) +(define *sprite-hvdf-control* (new 'global 'sprite-hvdf-control)) + +;; make all unallocated... +(dotimes (v1-25 76) + (set! (-> *sprite-hvdf-control* alloc v1-25) 0) + ) + +;; except for the first. +(set! (-> *sprite-hvdf-control* alloc 0) 1) + +;;;;;;;;;;;;;;;;;;;;;;;;;; +;; aux list +;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Represents a particle in *sprite-aux-list*. +;; The aux-type specifies what kind of aux sprite it is (distort, glow, etc.). +(deftype sprite-aux-elem (structure) + ((aux-type sprite-aux-type :offset-assert 0) + (data vector 3 :offset-assert 4) + (vec-data sprite-vec-data-2d :offset 4) + (gif-data adgif-shader :offset 8) + (aux-data sparticle-cpuinfo :offset 12) + ) + :pack-me + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(defmethod inspect sprite-aux-elem ((obj sprite-aux-elem)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-aux-elem) + (format #t "~1Taux-type: ~D~%" (-> obj aux-type)) + (format #t "~1Tdata[3] @ #x~X~%" (-> obj data)) + (format #t "~1Tvec-data: #~%" (-> obj vec-data)) + (format #t "~1Tgif-data: #~%" (-> obj gif-data)) + (format #t "~1Taux-data: #~%" (-> obj aux-data)) + (label cfg-4) + obj + ) + +(deftype sprite-aux-list (basic) + ((num-entries int32 :offset-assert 4) ;; capacity + (entry int32 :offset-assert 8) ;; current size + (data sprite-aux-elem :inline :dynamic :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + (:methods + (new (symbol type int) _type_ 0) + ) + ) + +(defmethod new sprite-aux-list ((allocation symbol) (type-to-make type) (size int)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* size 16)))))) + (set! (-> v0-0 num-entries) size) + (set! (-> v0-0 entry) 0) + v0-0 + ) + ) + +(defmethod inspect sprite-aux-list ((obj sprite-aux-list)) + (format #t "[~X] sprite-aux-list:~%" obj) + (format #t "~Tnum-entries: ~D~%" (-> obj num-entries)) + (format #t "~Tentry: ~D~%" (-> obj entry)) + (dotimes (s5-0 (-> obj entry)) + (format #t "~T~D : ~X~%" s5-0 (-> obj data s5-0)) + ) + (the-as sprite-aux-list #f) + ) + +(define *sprite-aux-list* (new 'global 'sprite-aux-list 256)) + +(defun clear-sprite-aux-list () + "Remove everything from the sprite aux list" + (set! (-> *sprite-aux-list* entry) 0) + (none) + ) + +(defun add-to-sprite-aux-list ((system sparticle-system) (sprite-info sparticle-cpuinfo) (sprite-vec sprite-vec-data-3d) (arg3 uint)) + (let ((s2-0 (-> sprite-info sp-func))) + (if (and (nonzero? s2-0) (not (paused?))) + (s2-0 system sprite-info sprite-vec arg3) + ) + ) + (let ((aux-list *sprite-aux-list*)) + (when (< (-> aux-list entry) (-> aux-list num-entries)) + (cond + ((logtest? (-> sprite-info flags) (sp-cpuinfo-flag distort)) + (set! (-> aux-list data (-> aux-list entry) aux-type) (sprite-aux-type distort)) + (set! (-> aux-list data (-> aux-list entry) vec-data) (-> sprite-info sprite)) + (+! (-> aux-list entry) 1) + (set! (-> sprite-vec r-g-b-a w) 0.0) + ) + ((logtest? (-> sprite-info flags) (sp-cpuinfo-flag glow)) + (let ((a0-18 (-> system cpuinfo-table arg3)) + (a1-11 (-> aux-list data (-> aux-list entry))) + ) + (set! (-> a1-11 aux-type) (sprite-aux-type glow)) + (set! (-> a1-11 vec-data) (-> sprite-info sprite)) + (set! (-> a1-11 gif-data) (-> sprite-info adgif)) + (set! (-> a1-11 aux-data) a0-18) + ) + (+! (-> aux-list entry) 1) + (set! (-> sprite-vec qx-qy-qz-sy y) (the-as float #xffffffff)) + ) + ) + ) + ) + 0 + (none) + ) + +;; The sprite-frame-data is data transferred to VU1 and remains there for all chunks of sprites. +(deftype sprite-frame-data (structure) + ((cdata vector 16 :inline :offset 0) + (xy-array vector 8 :inline :offset 0) + (st-array vector 4 :inline :offset 128) + (xyz-array vector 4 :inline :offset 192) + (hmge-scale vector :inline :offset 256) ;; math camera value + (consts vector :inline :offset 272) + (pfog0 float :offset 272) ;; math camera value + (deg-to-rad float :offset 276) ;; 2*pi / 65,536 + (min-scale float :offset 280) + (inv-area float :offset 284) + (adgif-giftag gs-gif-tag :inline :offset-assert 288) ;; sets adgif shader values + (sprite-2d-giftag gs-gif-tag :inline :offset-assert 304) ;; draws 2d sprites + (sprite-2d-giftag-2 gs-gif-tag :inline :offset-assert 320) ;; 2d with different settings + (sincos-01 vector :inline :offset-assert 336) + (sincos-23 vector :inline :offset-assert 352) + (sincos-45 vector :inline :offset-assert 368) + (sincos-67 vector :inline :offset-assert 384) + (sincos-89 vector :inline :offset-assert 400) + (basis-x vector :inline :offset-assert 416) + (basis-y vector :inline :offset-assert 432) + (sprite-3d-giftag gs-gif-tag :inline :offset-assert 448) ;; draws 3d sprites + (sprite-3d-giftag-2 gs-gif-tag :inline :offset-assert 464) + (screen-shader adgif-shader :inline :offset-assert 480) + (inv-hmge-scale vector :inline :offset 576) ;; math camera value + (stq-offset vector :inline :offset-assert 592) + (stq-scale vector :inline :offset-assert 608) + (rgba-plain qword :inline :offset-assert 624) + (warp-giftag gs-gif-tag :inline :offset-assert 640) + (fog-clamp vector :inline :offset-assert 656) + (fog-min float :offset 656) + (fog-max float :offset 660) + (max-scale float :offset 664) + ) + :method-count-assert 9 + :size-assert #x2a0 + :flag-assert #x9000002a0 + ) + +(defmethod inspect sprite-frame-data ((obj sprite-frame-data)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-frame-data) + (format #t "~1Tdata[42] @ #x~X~%" (-> obj cdata)) + (format #t "~1Tcdata[16] @ #x~X~%" (-> obj cdata)) + (format #t "~1Tfdata[26] @ #x~X~%" (-> obj hmge-scale)) + (format #t "~1Txy-array[8] @ #x~X~%" (-> obj cdata)) + (format #t "~1Tst-array[4] @ #x~X~%" (-> obj st-array)) + (format #t "~1Txyz-array[4] @ #x~X~%" (-> obj xyz-array)) + (format #t "~1Thmge-scale: #~%" (-> obj hmge-scale)) + (format #t "~1Tconsts: #~%" (&-> obj pfog0)) + (format #t "~1Tpfog0: ~f~%" (-> obj pfog0)) + (format #t "~1Tdeg-to-rad: ~f~%" (-> obj deg-to-rad)) + (format #t "~1Tmin-scale: ~f~%" (-> obj min-scale)) + (format #t "~1Tinv-area: ~f~%" (-> obj inv-area)) + (format #t "~1Tadgif-giftag: #~%" (-> obj adgif-giftag)) + (format #t "~1Tsprite-2d-giftag: #~%" (-> obj sprite-2d-giftag)) + (format #t "~1Tsprite-2d-giftag-2: #~%" (-> obj sprite-2d-giftag-2)) + (format #t "~1Tsincos-01: #~%" (-> obj sincos-01)) + (format #t "~1Tsincos-23: #~%" (-> obj sincos-23)) + (format #t "~1Tsincos-45: #~%" (-> obj sincos-45)) + (format #t "~1Tsincos-67: #~%" (-> obj sincos-67)) + (format #t "~1Tsincos-89: #~%" (-> obj sincos-89)) + (format #t "~1Tbasis-x: #~%" (-> obj basis-x)) + (format #t "~1Tbasis-y: #~%" (-> obj basis-y)) + (format #t "~1Tsprite-3d-giftag: #~%" (-> obj sprite-3d-giftag)) + (format #t "~1Tsprite-3d-giftag-2: #~%" (-> obj sprite-3d-giftag-2)) + (format #t "~1Tscreen-shader: #~%" (-> obj screen-shader)) + (format #t "~1Tinv-hmge-scale: #~%" (-> obj inv-hmge-scale)) + (format #t "~1Tstq-offset: #~%" (-> obj stq-offset)) + (format #t "~1Tstq-scale: #~%" (-> obj stq-scale)) + (format #t "~1Trgba-plain: #~%" (-> obj rgba-plain)) + (format #t "~1Twarp-giftag: #~%" (-> obj warp-giftag)) + (format #t "~1Tfog-clamp: #~%" (-> obj fog-clamp)) + (format #t "~1Tfog-min: ~f~%" (-> obj fog-clamp x)) + (format #t "~1Tfog-max: ~f~%" (-> obj fog-clamp y)) + (format #t "~1Tmax-scale: ~f~%" (-> obj max-scale)) + (label cfg-4) + obj + ) + +(defun sprite-setup-frame-data ((data sprite-frame-data) (tbp-offset uint)) + "Build the sprite-frame-data. This should be done once per frame" + (set! (-> data hmge-scale quad) (-> *math-camera* hmge-scale quad)) + (set! (-> data inv-hmge-scale quad) (-> *math-camera* inv-hmge-scale quad)) + (set! (-> data pfog0) (-> *math-camera* pfog0)) + (set! (-> data deg-to-rad) 0.000095873795) + ;; the adgif-giftag sets GS registers according to the adgif shader using + ;; the A+D mode + ;; each adgif has 5x registers, so we set up a tag to do 5x a+d's + (set! (-> data adgif-giftag tag) (new 'static 'gif-tag64 :nloop #x1 :nreg #x5)) + (set! (-> data adgif-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) + :regs4 (gif-reg-id a+d) + ) + ) + ;; I believe this is used for the group 0's in 2d + (set! (-> data sprite-2d-giftag tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :fge #x1 :abe #x1) + :nreg #x9 + ) + ) + (set! (-> data sprite-2d-giftag regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id st) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id xyzf2) + :regs5 (gif-reg-id st) + :regs6 (gif-reg-id xyzf2) + :regs7 (gif-reg-id st) + :regs8 (gif-reg-id xyzf2) + ) + ) + ;; group 1's in 2d + (set! (-> data sprite-2d-giftag-2 tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :abe #x1) + :nreg #x9 + ) + ) + (set! (-> data sprite-2d-giftag-2 regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id st) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id xyzf2) + :regs5 (gif-reg-id st) + :regs6 (gif-reg-id xyzf2) + :regs7 (gif-reg-id st) + :regs8 (gif-reg-id xyzf2) + ) + ) + ;; 3d group 0? + (set! (-> data sprite-3d-giftag tag) + (new 'static 'gif-tag64 + :nloop #x4 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + (set! (-> data sprite-3d-giftag regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + ;; 3d group 1? + (set! (-> data sprite-3d-giftag-2 tag) + (new 'static 'gif-tag64 + :nloop #x4 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :abe #x1) + :nreg #x3 + ) + ) + (set! (-> data sprite-3d-giftag-2 regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + ;; not sure what this is either + (set! (-> data warp-giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri) :tme #x1 :abe #x1) + :nreg #xc + ) + ) + (set! (-> data warp-giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id st) + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id rgbaq) + :regs5 (gif-reg-id xyzf2) + :regs6 (gif-reg-id st) + :regs7 (gif-reg-id rgbaq) + :regs8 (gif-reg-id xyzf2) + ) + ) + ;; set up an adgif. + (set! (-> data screen-shader prims 1) (gs-reg64 tex0-1)) + (set! (-> data screen-shader tex0) (new 'static 'gs-tex0 :tbw #x8 :tw #xa :th #x8 :tbp0 (* tbp-offset 32))) + (set! (-> data screen-shader prims 3) (gs-reg64 tex1-1)) + (set! (-> data screen-shader tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (set! (-> data screen-shader prims 5) (gs-reg64 miptbp1-1)) + (set! (-> data screen-shader miptbp1) (new 'static 'gs-miptbp)) + (set! (-> data screen-shader clamp-reg) (gs-reg64 clamp-1)) + (set! (-> data screen-shader clamp) (new 'static 'gs-clamp + :wms (gs-tex-wrap-mode region-clamp) + :wmt (gs-tex-wrap-mode region-clamp) + :maxu #x27f + :maxv #xef + ) + ) + (set! (-> data screen-shader prims 9) (gs-reg64 alpha-1)) + (set! (-> data screen-shader alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) + ;; sin/cosine table + (set! (-> data sincos-01 z) 0.999998) + (set! (-> data sincos-23 z) -0.16666014) + (set! (-> data sincos-45 z) 0.008326521) + (set! (-> data sincos-67 z) -0.0001956241) + (set! (-> data sincos-89 z) 0.0000023042373) + (set! (-> data sincos-01 w) 1.0) + (set! (-> data sincos-23 w) -0.49998003) + (set! (-> data sincos-45 w) 0.041620404) + (set! (-> data sincos-67 w) -0.0013636408) + (set! (-> data sincos-89 w) 0.000020170546) + ;; math camera stuff + (set! (-> data basis-x quad) (the-as uint128 0)) + (set! (-> data basis-x x) (- (-> *math-camera* perspective data 0))) + (set! (-> data basis-y quad) (the-as uint128 0)) + (set! (-> data basis-y y) (- (-> *math-camera* perspective data 5))) + (set! (-> data min-scale) (sqrtf (* (/ 1.0 (-> data basis-x x)) (/ 1.0 (-> data basis-y y))))) + (set! (-> data inv-area) (/ 1.0 (* (-> data min-scale) (-> data min-scale)))) + ;; ?? + (set-vector! (-> data cdata 0) -0.5 -0.5 0.0 0.0) + (set-vector! (-> data cdata 1) 0.5 -0.5 0.0 0.0) + (set-vector! (-> data cdata 2) 0.5 0.5 0.0 0.0) + (set-vector! (-> data cdata 3) -0.5 0.5 0.0 0.0) + (set-vector! (-> data cdata 4) 0.0 -0.5 0.0 0.0) + (set-vector! (-> data cdata 5) 1.0 -0.5 0.0 0.0) + (set-vector! (-> data cdata 6) 1.0 0.5 0.0 0.0) + (set-vector! (-> data cdata 7) 0.0 0.5 0.0 0.0) + (set-vector! (-> data st-array 0) 0.0 0.0 1.0 0.0) + (set-vector! (-> data cdata 9) 1.0 0.0 1.0 0.0) + (set-vector! (-> data cdata 10) 1.0 1.0 1.0 0.0) + (set-vector! (-> data cdata 11) 0.0 1.0 1.0 0.0) + (set-vector! (-> data xyz-array 0) -0.5 0.0 -0.5 0.0) + (set-vector! (-> data cdata 13) 0.5 0.0 -0.5 0.0) + (set-vector! (-> data cdata 14) 0.5 0.0 0.5 0.0) + (set-vector! (-> data cdata 15) -0.5 0.0 0.5 0.0) + ;; perspective correction stuff + (set-vector! (-> data stq-offset) -1792.0 -1840.0 0.0 0.0) + (set-vector! (-> data stq-scale) 0.0009765625 0.00390625 1.0 1.0) + ;; ?? + (set! (-> data rgba-plain vector4w x) 128) + (set! (-> data rgba-plain vector4w y) 128) + (set! (-> data rgba-plain vector4w z) 128) + (set! (-> data rgba-plain vector4w w) 64) + (set! (-> data fog-clamp x) (-> *math-camera* fog-min)) + (set! (-> data fog-clamp y) (-> *math-camera* fog-max)) + (set! (-> data max-scale) 2048.0) + (none) + ) + +(define sprite-vu1-block (new 'static 'vu-function :length #x35f :qlength #x1b0)) + +;;;;;;;;;;;;;;;;;; +;; sprite-arrays +;;;;;;;;;;;;;;;;;; + +;; There are two global sprite arrays - one for 2d and one for 3d +;; Each array has two groups. +;; Data from these arrays is used in sprite-draw to build DMA lists. + +(defmethod new sprite-array-2d ((allocation symbol) (type-to-make type) (group-0-size int) (group-1-size int)) + "Allocate a sprite-array for 2d sprites. There are two groups, each can contain the given number." + (let* ((sprite-count (+ group-0-size group-1-size)) + (vec-data-size (* 3 sprite-count)) ;; 3 quadwords of vec-data per sprite + (adgif-data-size (* 5 sprite-count)) ;; 5 quadwords of adgif data per sprite + (v0-0 (object-new + allocation + type-to-make + (the-as int (+ (-> type-to-make size) (* (+ adgif-data-size -1 vec-data-size) 16))) + ) + ) + ) + (set! (-> v0-0 num-sprites 0) group-0-size) + (set! (-> v0-0 num-sprites 1) group-1-size) + (set! (-> v0-0 num-valid 0) 0) + (set! (-> v0-0 num-valid 1) 0) + ;; internally, we put the vec-data and then the adgif-data + (set! (-> v0-0 vec-data) (-> v0-0 data)) + (set! (-> v0-0 adgif-data) (the-as (inline-array adgif-shader) (&-> v0-0 data vec-data-size))) + v0-0 + ) + ) + +(defmethod new sprite-array-3d ((allocation symbol) (type-to-make type) (group-0-size int) (group-1-size int)) + "Allocate a sprite-array for 3d sprites. There are two groups, each can contain the given number of sprites. + Group 1 size is zero in practice for 3d." + (let* ((sprite-count (+ group-0-size group-1-size)) + (vec-data-size (* 3 sprite-count)) + (adgif-data-size (* 5 sprite-count)) + (v0-0 (object-new + allocation + type-to-make + (the-as int (+ (-> type-to-make size) (* (+ adgif-data-size -1 vec-data-size) 16))) + ) + ) + ) + (set! (-> v0-0 num-sprites 0) group-0-size) + (set! (-> v0-0 num-sprites 1) group-1-size) + (set! (-> v0-0 num-valid 0) 0) + (set! (-> v0-0 num-valid 1) 0) + (set! (-> v0-0 vec-data) (-> v0-0 data)) + (set! (-> v0-0 adgif-data) (the-as (inline-array adgif-shader) (&-> v0-0 data vec-data-size))) + v0-0 + ) + ) + +(define *sprite-array-2d* (new 'global 'sprite-array-2d 1920 128)) +;; note that there are 0 group 1 3d's +(define *sprite-array-3d* (new 'global 'sprite-array-3d 256 0)) + +(defun sprite-set-3d-quaternion! ((sprite sprite-vec-data-3d) (quat quaternion)) + "Set the quaternion for a 3d sprite. + NOTE: the w component of the quaternion is not stored and + the original w value is preserved." + (local-vars (v1-0 float) (v1-1 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (cond + ((< (-> quat w) 0.0) + (.lvf vf1 (&-> sprite qx-qy-qz-sy quad)) + (.lvf vf2 (&-> quat vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> sprite qx-qy-qz-sy quad) vf1) + (.mov v1-0 vf1) + ) + (else + (.lvf vf1 (&-> sprite qx-qy-qz-sy quad)) + (.lvf vf2 (&-> quat vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> sprite qx-qy-qz-sy quad) vf1) + (.mov v1-1 vf1) + ) + ) + quat + ) + ) + +(defun sprite-get-3d-quaternion! ((out quaternion) (sprite sprite-vec-data-3d)) + "Get a quaternion. It's stored with only 3 components, so qw is + recalculated." + (let ((f0-0 (-> sprite qx-qy-qz-sy x)) + (f1-0 (-> sprite qx-qy-qz-sy y)) + (f2-0 (-> sprite qx-qy-qz-sy z)) + ) + (set! (-> out x) f0-0) + (set! (-> out y) f1-0) + (set! (-> out z) f2-0) + (set! (-> out w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + out + ) + +(defun sprite-add-matrix-data ((dma-buff dma-buffer) (matrix-mode uint)) + "Add matrix data to a dma-buffer. + Mode 0 = send (-> *math-camera* camera-temp) + Mode 1 = screen sprites, like the HUD" + (let ((count 900)) ;; maybe address?? + (cond + ((zero? matrix-mode) + ;; upload to VU1 memory setup + (let* ((a1-1 dma-buff) + (pkt1 (the-as dma-packet (-> a1-1 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) + (set! (-> pkt1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :num #x5 ;; matrix + qword + :cmd (vif-cmd unpack-v4-32) + :imm (shr (shl count 54) 54))) + (set! (-> a1-1 base) (&+ (the-as pointer pkt1) 16)) + ) + ;; send the camera-temp matrix + (let* ((mtx (the-as matrix (-> dma-buff base))) + (t1-0 (-> *math-camera* camera-temp)) + (a2-4 (-> t1-0 vector 0 quad)) + (a3-4 (-> t1-0 vector 1 quad)) + (t0-4 (-> t1-0 vector 2 quad)) + (t1-1 (-> t1-0 trans quad)) + ) + (set! (-> mtx vector 0 quad) a2-4) + (set! (-> mtx vector 1 quad) a3-4) + (set! (-> mtx vector 2 quad) t0-4) + (set! (-> mtx trans quad) t1-1) + ) + (&+! (-> dma-buff base) 64) + ;; also send this thing. + (let ((v1-1 (+ count 4))) + (set! (-> (the-as (pointer uint128) (-> dma-buff base))) (-> *math-camera* hvdf-off quad)) + (&+! (-> dma-buff base) 16) + (+ v1-1 1) + ) + ) + ((= matrix-mode 1) + (let* ((a1-10 dma-buff) + (pkt2 (the-as dma-packet (-> a1-10 base))) + ) + (set! (-> pkt2 dma) (new 'static 'dma-tag :qwc #x50 :id (dma-tag-id cnt))) + (set! (-> pkt2 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt2 vif1) + (new 'static 'vif-tag :num #x50 ;; matrix + qword + 75 qword table + :cmd (vif-cmd unpack-v4-32) + :imm (shr (shl count 54) 54)) + ) + (set! (-> a1-10 base) (&+ (the-as pointer pkt2) 16)) + ) + (let ((mtx2 (the-as matrix (-> dma-buff base))) + (f1-0 (-> *math-camera* perspective data 0)) + (f2-0 (-> *math-camera* perspective data 5)) + (f0-1 (* -1.9996 (-> *math-camera* perspective data 0))) + ) + (set-vector! (the-as vector (&+ (the-as pointer mtx2) 0)) f0-1 0.0 0.0 0.0) + (set-vector! (the-as vector (&+ (the-as pointer mtx2) 16)) 0.0 (- (* (/ f2-0 f1-0) f0-1)) 0.0 0.0) + (set-vector! (the-as vector (&+ (the-as pointer mtx2) 32)) 0.0 0.0 (- f0-1) 0.0) + (set-vector! + (the-as vector (&+ (the-as pointer mtx2) 48)) + 0.0 + 0.0 + (* 500000000.0 f0-1) + (* 60.0 f0-1 (-> *math-camera* pfog0)) + ) + ) + (&+! (-> dma-buff base) 64) + (let ((v1-2 (+ count 4))) + (let ((a1-16 (the-as vector (-> dma-buff base)))) + (set! (-> a1-16 quad) (-> *math-camera* hvdf-off quad)) + (set! (-> a1-16 x) 2048.0) + (set! (-> a1-16 y) 2048.0) + (set! (-> a1-16 z) (-> *math-camera* hvdf-off z)) + ) + (&+! (-> dma-buff base) 16) + (let ((v1-3 (+ v1-2 1))) + (dotimes (hvdf-idx 75) + (set! (-> (the-as (pointer uint128) (-> dma-buff base))) (-> *sprite-hvdf-data* data (+ hvdf-idx 1) quad)) + (&+! (-> dma-buff base) 16) + (+! v1-3 1) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defun sprite-add-frame-data ((dma-buff dma-buffer) (tbp-offset uint)) + (let ((s5-0 42)) + (let* ((v1-0 dma-buff) + (pkt (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc s5-0)) + (set! (-> pkt vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt vif1) (new 'static 'vif-tag :imm #x3d4 :cmd (vif-cmd unpack-v4-32) :num s5-0)) + (set! (-> v1-0 base) (&+ (the-as pointer pkt) 16)) + ) + (sprite-setup-frame-data (the-as sprite-frame-data (-> dma-buff base)) tbp-offset) + (&+! (-> dma-buff base) (* s5-0 16)) + ) + (none) + ) + +(defun sprite-add-2d-chunk ((sprites sprite-array-2d) (start-sprite-idx int) (num-sprites int) (dma-buff dma-buffer) (mscal-addr int)) + "Upload sprite data from elements in the array." + ;; first packet is just the header + (let ((qwc-pkt1 1)) + (let* ((v1-0 dma-buff) + (pkt1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc qwc-pkt1)) + (set! (-> pkt1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt1)) + (set! (-> v1-0 base) (&+ (the-as pointer pkt1) 16)) + ) + ;; set up the header data. + (sprite-setup-header (the-as sprite-header (-> dma-buff base)) num-sprites) + (&+! (-> dma-buff base) (* qwc-pkt1 16)) + ) + + ;; second packet is vector data (3 qw / sprite) + (let* ((qwc-pkt2 (* 3 num-sprites)) + (v1-4 dma-buff) + (pkt2 (the-as dma-packet (-> v1-4 base))) + ) + ;; we do a ref to the vec-data and don't actually copy it into the dma-buffer + (set! (-> pkt2 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (&+ (-> sprites vec-data) (* 48 start-sprite-idx))) + :qwc qwc-pkt2 + ) + ) + (set! (-> pkt2 vif0) (new 'static 'vif-tag)) + (set! (-> pkt2 vif1) (new 'static 'vif-tag :imm #x8001 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt2)) + (set! (-> v1-4 base) (&+ (the-as pointer pkt2) 16)) + ) + + ;; third packet is adgif data (5 qw/sprite) + (let* ((qwc-pkt3 (* 5 num-sprites)) + (v1-6 dma-buff) + (pkt3 (the-as dma-packet (-> v1-6 base))) + ) + (set! (-> pkt3 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (+ (the-as int (-> sprites adgif-data)) (* 80 start-sprite-idx)) + :qwc qwc-pkt3 + ) + ) + (set! (-> pkt3 vif0) (new 'static 'vif-tag)) + (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x8091 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt3)) + (set! (-> v1-6 base) (&+ (the-as pointer pkt3) 16)) + ) + + ;; fourth packet runs the renderer! + (let ((pkt4 (the-as dma-packet (-> dma-buff base)))) + (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt4 vif0) (new 'static 'vif-tag)) + (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm mscal-addr)) + (set! (-> dma-buff base) (&+ (the-as pointer pkt4) 16)) + ) + (none) + ) + +(defun sprite-add-2d-all ((sprites sprite-array-2d) (dma-buff dma-buffer) (group-idx int)) + "Builds a DMA list for sprites" + ;; skip if we have no sprites + (when (> (-> sprites num-valid group-idx) 0) + ;; we'll do batches of up to 48 at a time. + (let ((current-sprite-idx 0) + (mscal-addr 3) + ) + (when (= group-idx 1) + ;; if we're doing group 1 sprites, start at the first sprite in group 1. + (set! current-sprite-idx (-> sprites num-sprites 0)) + ;; and use the other mpg. + (set! mscal-addr 115) + ) + + ;; loop over chunks + (let ((remaining-sprites (-> sprites num-valid group-idx))) + (while (< 48 remaining-sprites) + (sprite-add-2d-chunk sprites current-sprite-idx 48 dma-buff mscal-addr) + (+! current-sprite-idx 48) + (+! remaining-sprites -48) + ) + (sprite-add-2d-chunk sprites current-sprite-idx remaining-sprites dma-buff mscal-addr) + ) + ) + ) + (none) + ) + +(defun sprite-add-3d-chunk ((sprites sprite-array-3d) (start-sprite-idx int) (num-sprites int) (dma-buff dma-buffer)) + "Add DMA list data for up to 48 sprites. This is very similar to the 2D one, see that for more documentation" + ;; first packet is just the header + (let ((qwc-pkt1 1)) + (let* ((v1-0 dma-buff) + (pkt1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc qwc-pkt1)) + (set! (-> pkt1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt1)) + (set! (-> v1-0 base) (&+ (the-as pointer pkt1) 16)) + ) + ;; set up the header data. + (sprite-setup-header (the-as sprite-header (-> dma-buff base)) num-sprites) + (&+! (-> dma-buff base) (* qwc-pkt1 16)) + ) + + ;; second packet is vector data (3 qw / sprite) + (let* ((qwc-pkt2 (* 3 num-sprites)) + (v1-4 dma-buff) + (pkt2 (the-as dma-packet (-> v1-4 base))) + ) + ;; we do a ref to the vec-data and don't actually copy it into the dma-buffer + (set! (-> pkt2 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (&+ (-> sprites vec-data) (* 48 start-sprite-idx))) + :qwc qwc-pkt2 + ) + ) + (set! (-> pkt2 vif0) (new 'static 'vif-tag)) + (set! (-> pkt2 vif1) (new 'static 'vif-tag :imm #x8001 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt2)) + (set! (-> v1-4 base) (&+ (the-as pointer pkt2) 16)) + ) + + ;; third packet is adgif data (5 qw/sprite) + (let* ((qwc-pkt3 (* 5 num-sprites)) + (v1-6 dma-buff) + (pkt3 (the-as dma-packet (-> v1-6 base))) + ) + (set! (-> pkt3 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (-> sprites adgif-data start-sprite-idx)) + :qwc qwc-pkt3 + ) + ) + (set! (-> pkt3 vif0) (new 'static 'vif-tag)) + (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x8091 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt3)) + (set! (-> v1-6 base) (&+ (the-as pointer pkt3) 16)) + ) + + ;; fourth packet runs the renderer! + (let ((pkt4 (the-as dma-packet (-> dma-buff base)))) + (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt4 vif0) (new 'static 'vif-tag)) + (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #xd9)) + (set! (-> dma-buff base) (&+ (the-as pointer pkt4) 16)) + ) + (none) + ) + +(defun sprite-add-3d-all ((sprites sprite-array-3d) (dma-buff dma-buffer) (group-idx int)) + "Set up DMA for all 3d sprites" + (when (> (-> sprites num-valid group-idx) 0) + ;; pick the starting idx + (let ((current-sprite-idx (if (zero? group-idx) + 0 + (-> sprites num-sprites 0) + ) + ) + (remaining-sprites (-> sprites num-valid group-idx)) + ) + + ;; loop over chunks + (while (< 48 remaining-sprites) + (sprite-add-3d-chunk sprites current-sprite-idx 48 dma-buff) + (+! current-sprite-idx 48) + (+! remaining-sprites -48) + ) + (sprite-add-3d-chunk sprites current-sprite-idx remaining-sprites dma-buff) + ) + ) + (none) + ) + +(defun sprite-draw ((disp display)) + "Main sprite draw function." + ;; start of our DMA for all the sprite data + (let ((dma-mem-begin (-> *display* frames (-> *display* on-screen) global-buf base))) + ;; draw in global-buf + (let* ((dma-buff (-> *display* frames (-> *display* on-screen) global-buf)) + (dma-bucket-begin (-> dma-buff base)) + ) + + ;; run the distorters + (when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1)) + (sprite-init-distorter dma-buff) + (sprite-draw-distorters dma-buff) + ) + + ;; first packet - set up the GS registers + (let* ((v1-17 dma-buff) + (pkt1 (the-as dma-packet (-> v1-17 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) + (set! (-> pkt1 vif0) (new 'static 'vif-tag)) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-17 base) (&+ (the-as pointer pkt1) 16)) + ) + (let* ((v1-18 dma-buff) + (giftag (the-as gs-gif-tag (-> v1-18 base))) + ) + (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2)) + (set! (-> 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) + :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) + ) + ) + (set! (-> v1-18 base) (the-as pointer (&+ giftag 16))) + ) + (let* ((v1-19 dma-buff) + (a0-10 (-> v1-19 base)) + ) + (set! (-> (the-as (pointer gs-test) a0-10) 0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (set! (-> (the-as (pointer gs-reg64) a0-10) 1) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-clamp) a0-10) 2) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)) + ) + (set! (-> (the-as (pointer gs-reg64) a0-10) 3) (gs-reg64 clamp-1)) + (set! (-> v1-19 base) (&+ a0-10 32)) + ) + + ;; load the VU1 code + (dma-buffer-add-vu-function dma-buff sprite-vu1-block 1) + + ;; add the common data + (sprite-add-frame-data dma-buff (the-as uint 408)) + + ;; run the init part of the VU1 mpg + (let* ((v1-20 dma-buff) + (pkt2 (the-as dma-packet (-> v1-20 base))) + ) + (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt2 vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm #x0)) ;; wait for mpg and gif, start mpg + (set! (-> pkt2 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) ;; wait for mpg + (set! (-> v1-20 base) (&+ (the-as pointer pkt2) 16)) + ) + + ;; set up double buffer upload and draw + (let* ((v1-21 dma-buff) + (pkt3 (the-as dma-packet (-> v1-21 base))) + ) + (set! (-> pkt3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt3 vif0) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x190 :cmd (vif-cmd offset))) + (set! (-> v1-21 base) (&+ (the-as pointer pkt3) 16)) + ) + + ;;;;;;;;;;;;;;;; + ;; group 0 draw + ;;;;;;;;;;;;;;;; + + ;; add matrix data (not needed for init) + (sprite-add-matrix-data dma-buff (the-as uint 0)) + + ;; ad 3d's (group 0) + (sprite-add-3d-all *sprite-array-3d* dma-buff 0) + ;; add 2d's (group 0) + (sprite-add-2d-all *sprite-array-2d* dma-buff 0) + + ;; draw group 0 + (let* ((v1-22 dma-buff) + (pkt4 (the-as dma-packet (-> v1-22 base))) + ) + (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt4 vif0) (new 'static 'vif-tag)) + (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-22 base) (&+ (the-as pointer pkt4) 16)) + ) + + ;;;;;;;;;;;;;;;; + ;; group 1 draw + ;;;;;;;;;;;;;;;; + + ;; set matrix for group 1 (screen-space sprites) + (sprite-add-matrix-data dma-buff (the-as uint 1)) + + ;; add 2d screen sprites + (sprite-add-2d-all *sprite-array-2d* dma-buff 1) + + ;; draw screen sprites + (let* ((v1-23 dma-buff) + (pkt5 (the-as dma-packet (-> v1-23 base))) + ) + (set! (-> pkt5 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt5 vif0) (new 'static 'vif-tag)) + (set! (-> pkt5 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-23 base) (&+ (the-as pointer pkt5) 16)) + ) + + ;;;;;;;;;;;;;;;; + ;; sprite glow + ;;;;;;;;;;;;;;;; + + ;; TODO: figure out what this is doing + (sprite-glow-init-engine dma-buff) + (sprite-glow-draw dma-buff) + (simple-sprite-system-method-10 *simple-sprite-system* dma-buff) + (let* ((v1-26 dma-buff) + (pkt6 (the-as dma-packet (-> v1-26 base))) + ) + (set! (-> pkt6 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt6 vif0) (new 'static 'vif-tag)) + (set! (-> pkt6 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-26 base) (&+ (the-as pointer pkt6) 16)) + ) + (let ((a3-0 (-> dma-buff base))) + (let ((pkt7 (the-as dma-packet (-> dma-buff base)))) + (set! (-> pkt7 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> pkt7 vif0) (new 'static 'vif-tag)) + (set! (-> pkt7 vif1) (new 'static 'vif-tag)) + (set! (-> dma-buff base) (&+ (the-as pointer pkt7) 16)) + ) + (dma-bucket-insert-tag + (the-as (inline-array dma-bucket) (-> *display* frames (-> *display* on-screen) bucket-group)) + (bucket-id bucket-313) + dma-bucket-begin + (the-as (pointer dma-tag) a3-0) + ) + ) + ) + + ;; update memory usage + (let ((mem-use *dma-mem-usage*)) + (when (nonzero? mem-use) + (set! (-> mem-use length) (max 86 (-> mem-use length))) + (set! (-> mem-use data 85 name) "sprite") + (+! (-> mem-use data 85 count) 1) + (+! (-> mem-use data 85 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint dma-mem-begin)) + ) + (set! (-> mem-use data 85 total) (-> mem-use data 85 used)) + ) + ) + ) + 0 + (none) + ) + +(defun sprite-allocate-user-hvdf () + "Allocate an HVDF entry. Returns the index. Or 0 if it fails" + (dotimes (v1-0 76) + (when (zero? (-> *sprite-hvdf-control* alloc v1-0)) + (set! (-> *sprite-hvdf-control* alloc v1-0) 1) + (return v1-0) + ) + ) + 0 + ) + +(defun sprite-release-user-hvdf ((idx int)) + "Free an HVDF" + (when (and (>= idx 1) (< idx 76)) + (set! (-> *sprite-hvdf-control* alloc idx) 0) + ) + (none) + ) + +(defun sprite-get-user-hvdf ((idx int)) + "Get an HVDF entry by index" + (the-as vector (-> *sprite-hvdf-data* data idx)) + ) + +(kmemclose) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc index 8f2dcab193..c4f5899c3f 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc @@ -6,41 +6,41 @@ ;; definition of type sparticle-cpuinfo (deftype sparticle-cpuinfo (structure) - ((sprite sprite-vec-data-2d :offset-assert 0) - (adgif adgif-shader :offset-assert 4) - (radius float :offset-assert 8) - (omega float :offset-assert 12) - (vel-sxvel vector :inline :offset-assert 16) - (rot-syvel vector :inline :offset-assert 32) - (fade rgbaf :inline :offset-assert 48) - (acc vector :inline :offset-assert 64) - (rotvel3d quaternion :inline :offset-assert 80) - (vel vector3s :inline :offset 16) - (accel vector3s :inline :offset 64) - (scalevelx float :offset 28) - (scalevely float :offset 44) - (friction float :offset-assert 96) - (timer int32 :offset-assert 100) - (flags sp-cpuinfo-flag :offset-assert 104) - (user-int32 int32 :offset-assert 108) - (user-uint32 uint32 :offset 108) - (user-float float :offset 108) - (user-pntr uint32 :offset 108) - (user-object basic :offset 108) - (user-sprite sprite-vec-data-2d :offset 108) - (sp-func basic :offset-assert 112) - (next-time uint32 :offset-assert 116) - (next-launcher basic :offset-assert 120) - (cache-alpha float :offset-assert 124) - (valid uint8 :offset-assert 128) - (clock-index uint8 :offset-assert 129) - (user1-int16 uint16 :offset-assert 130) - (key sparticle-launch-control :offset-assert 132) - (binding sparticle-launch-state :offset-assert 136) - (data uint32 1 :offset 12) - (datab uint8 4 :offset 12) - (dataf float 1 :offset 12) - (datac uint8 1 :offset 12) + ((sprite sprite-vec-data-2d :offset-assert 0) + (adgif adgif-shader :offset-assert 4) + (radius float :offset-assert 8) + (omega float :offset-assert 12) + (vel-sxvel vector :inline :offset-assert 16) + (rot-syvel vector :inline :offset-assert 32) + (fade rgbaf :inline :offset-assert 48) + (acc vector :inline :offset-assert 64) + (rotvel3d quaternion :inline :offset-assert 80) + (vel vector3s :inline :offset 16) + (accel vector3s :inline :offset 64) + (scalevelx float :offset 28) + (scalevely float :offset 44) + (friction float :offset-assert 96) + (timer int32 :offset-assert 100) + (flags sp-cpuinfo-flag :offset-assert 104) + (user-int32 int32 :offset-assert 108) + (user-uint32 uint32 :offset 108) + (user-float float :offset 108) + (user-pntr uint32 :offset 108) + (user-object basic :offset 108) + (user-sprite sprite-vec-data-2d :offset 108) + (sp-func (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) :offset-assert 112) + (next-time uint32 :offset-assert 116) + (next-launcher basic :offset-assert 120) + (cache-alpha float :offset-assert 124) + (valid uint8 :offset-assert 128) + (clock-index uint8 :offset-assert 129) + (user1-int16 uint16 :offset-assert 130) + (key sparticle-launch-control :offset-assert 132) + (binding sparticle-launch-state :offset-assert 136) + (data uint32 1 :offset 12) + (datab uint8 4 :offset 12) + (dataf float 1 :offset 12) + (datac uint8 1 :offset 12) ) :method-count-assert 9 :size-assert #x8c diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/simple-sprite-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/simple-sprite-h_REF.gc index 2af01a5a9a..421529ed3f 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/simple-sprite-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/simple-sprite-h_REF.gc @@ -67,9 +67,9 @@ :size-assert #x8 :flag-assert #xc00000008 (:methods - (simple-sprite-system-method-9 () none 9) - (simple-sprite-system-method-10 () none 10) - (simple-sprite-system-method-11 () none 11) + (add! () none 9) + (simple-sprite-system-method-10 (_type_ dma-buffer) none 10) + (clear! (_type_) none 11) ) ) @@ -89,7 +89,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc new file mode 100644 index 0000000000..c95d0aa999 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc @@ -0,0 +1,442 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type sprite-distorter-sine-tables +(deftype sprite-distorter-sine-tables (basic) + ((aspx float :offset-assert 4) + (aspy float :offset-assert 8) + (entry vector 128 :inline :offset-assert 16) + (ientry qword 9 :inline :offset-assert 2064) + (giftag gs-gif-tag :inline :offset-assert 2208) + (color qword :inline :offset-assert 2224) + ) + :method-count-assert 9 + :size-assert #x8c0 + :flag-assert #x9000008c0 + ) + +;; definition for method 3 of type sprite-distorter-sine-tables +(defmethod inspect sprite-distorter-sine-tables ((obj sprite-distorter-sine-tables)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Taspx: ~f~%" (-> obj aspx)) + (format #t "~1Taspy: ~f~%" (-> obj aspy)) + (format #t "~1Tentry[128] @ #x~X~%" (-> obj entry)) + (format #t "~1Tientry[9] @ #x~X~%" (-> obj ientry)) + (format #t "~1Tgiftag: #~%" (-> obj giftag)) + (format #t "~1Tcolor: #~%" (-> obj color)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(kmemopen global "sprite-distort-tables") + +;; definition for symbol *sprite-distorter-sine-tables*, type sprite-distorter-sine-tables +(define *sprite-distorter-sine-tables* (new 'global 'sprite-distorter-sine-tables)) + +;; failed to figure out what this is: +(kmemclose) + +;; definition for function sprite-distorter-generate-tables +;; INFO: Return type mismatch int vs none. +(defun sprite-distorter-generate-tables () + (let ((tbls *sprite-distorter-sine-tables*)) + (let ((entry-idx 0) + (ientry-idx 0) + (turns 3) + (cam-aspx (- (-> *math-camera* perspective data 0))) + (cam-aspy (- (-> *math-camera* perspective data 5))) + ) + (when (or (!= cam-aspx (-> tbls aspx)) (!= cam-aspy (-> tbls aspy))) + (set! (-> tbls aspx) cam-aspx) + (set! (-> tbls aspy) cam-aspy) + (while (< turns 12) + (set! (-> tbls ientry ientry-idx vector4w x) (+ entry-idx 352)) + (+! ientry-idx 1) + (dotimes (turn turns) + (let ((rot (* 65536.0 (/ (the float turn) (the float turns))))) + (set-vector! (-> tbls entry entry-idx) (* (sin rot) cam-aspx) (* (cos rot) cam-aspy) 0.0 0.0) + (let ((s3-1 (+ entry-idx 1))) + (set-vector! + (-> tbls entry s3-1) + (* 0.001953125 cam-aspx (sin rot)) + (* 0.001953125 cam-aspy (cos rot)) + 0.0 + 0.0 + ) + (set! entry-idx (+ s3-1 1)) + ) + ) + ) + (+! turns 1) + ) + (set-vector! (-> tbls entry entry-idx) 0.0 cam-aspy 0.0 0.0) + (let ((v1-20 (+ entry-idx 1))) + (set-vector! (-> tbls entry v1-20) 0.0 (* 0.001953125 cam-aspy) 0.0 0.0) + (+ v1-20 1) + ) + ) + ) + (set! (-> tbls giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :tme #x1) + :nreg #xf + ) + ) + (set! (-> tbls giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id st) + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id rgbaq) + :regs5 (gif-reg-id xyzf2) + :regs6 (gif-reg-id st) + :regs7 (gif-reg-id rgbaq) + :regs8 (gif-reg-id xyzf2) + :regs9 (gif-reg-id st) + :regs10 (gif-reg-id rgbaq) + :regs11 (gif-reg-id xyzf2) + :regs12 (gif-reg-id st) + :regs13 (gif-reg-id rgbaq) + :regs14 (gif-reg-id xyzf2) + ) + ) + (set! (-> tbls color vector4w x) 128) + (set! (-> tbls color vector4w y) 128) + (set! (-> tbls color vector4w z) 128) + (set! (-> tbls color vector4w w) 128) + ) + 0 + (none) + ) + +;; definition for symbol sprite-distort-vu1-block, type vu-function +(define sprite-distort-vu1-block (new 'static 'vu-function :length 63 :qlength 32)) + +;; definition for function sprite-init-distorter +;; INFO: Return type mismatch int vs none. +(defun sprite-init-distorter ((dma-buff dma-buffer)) + (let* ((v1-0 dma-buff) + (a1-0 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet a1-0) dma) (new 'static 'dma-tag :qwc #x7 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-0) vif1) (new 'static 'vif-tag :imm #x7 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-0 base) (&+ (the-as pointer a1-0) 16)) + ) + (let* ((v1-1 dma-buff) + (a1-2 (the-as object (-> v1-1 base))) + ) + (set! (-> (the-as gs-gif-tag a1-2) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x6)) + (set! (-> (the-as gs-gif-tag a1-2) 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) + :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) + ) + ) + (set! (-> v1-1 base) (&+ (the-as pointer a1-2) 16)) + ) + (let* ((v1-2 dma-buff) + (a1-4 (-> v1-2 base)) + ) + (set! (-> (the-as (pointer gs-zbuf) a1-4) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 1) (gs-reg64 zbuf-1)) + (set! (-> (the-as (pointer gs-tex0) a1-4) 2) (new 'static 'gs-tex0 :tbp0 #x3300 :tbw #x8 :tw #x9 :th #x9)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 3) (gs-reg64 tex0-1)) + (set! (-> (the-as (pointer gs-tex1) a1-4) 4) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 5) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer gs-miptbp) a1-4) 6) (new 'static 'gs-miptbp)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 7) (gs-reg64 miptbp1-1)) + (set! (-> (the-as (pointer gs-clamp) a1-4) 8) (new 'static 'gs-clamp + :wms (gs-tex-wrap-mode region-clamp) + :wmt (gs-tex-wrap-mode region-clamp) + :maxu #x1ff + :maxv #x19f + ) + ) + (set! (-> (the-as (pointer gs-reg64) a1-4) 9) (gs-reg64 clamp-1)) + (set! (-> (the-as (pointer gs-alpha) a1-4) 10) (new 'static 'gs-alpha :b #x1 :d #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-4) 11) (gs-reg64 alpha-1)) + (set! (-> v1-2 base) (&+ a1-4 96)) + ) + (let* ((v1-3 dma-buff) + (a1-6 (the-as object (-> v1-3 base))) + ) + (set! (-> (the-as dma-packet a1-6) dma) + (new 'static 'dma-tag + :qwc #x8b + :id (dma-tag-id ref) + :addr (the-as uint (-> *sprite-distorter-sine-tables* entry)) + ) + ) + (set! (-> (the-as dma-packet a1-6) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet a1-6) vif1) + (new 'static 'vif-tag :imm #x160 :num #x8b :cmd (vif-cmd unpack-v4-32)) + ) + (set! (-> v1-3 base) (&+ (the-as pointer a1-6) 16)) + ) + (dma-buffer-add-vu-function dma-buff sprite-distort-vu1-block 1) + 0 + (none) + ) + +;; definition for function sprite-draw-distorters +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] +;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] +(defun sprite-draw-distorters ((dma-buff dma-buffer)) + (local-vars + (v1-15 float) + (v1-21 float) + (clip-result int) + (v1-63 float) + (sprite sprite-vec-data-2d) + (dma-st-flag pointer) + (dma-color pointer) + ) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf10 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf8 :class vf) + (vf9 :class vf) + ) + (init-vf0-vector) + (.lvf vf8 (&-> *math-camera* hmge-scale quad)) + (let ((dma-chunk-start (-> dma-buff base)) + (chunk-sprite-count 0) + (draw-sprite-count 0) + ) + (&+! (-> dma-buff base) 16) + (let* ((s3-0 *sprite-aux-list*) + (num-entries (-> s3-0 entry)) + ) + (dotimes (i num-entries) + (let ((aux-elem (-> s3-0 data i))) + (when (= (-> aux-elem aux-type) (sprite-aux-type distort)) + (set! sprite (-> aux-elem vec-data)) + (let ((dma-position (the-as object (-> dma-buff base)))) + (set! dma-st-flag (&+ (the-as pointer dma-position) 16)) + (set! dma-color (&+ (the-as pointer dma-position) 32)) + (cond + ((= (-> sprite flag-rot-sy y) 1) + (.lvf vf3 (&-> *math-camera* sprite-2d vector 0 quad)) + (.lvf vf4 (&-> *math-camera* sprite-2d vector 1 quad)) + (.lvf vf5 (&-> *math-camera* sprite-2d vector 2 quad)) + (.lvf vf6 (&-> *math-camera* sprite-2d trans quad)) + (.lvf vf9 (&-> *math-camera* sprite-2d-hvdf quad)) + (.mov v1-15 vf9) + ) + (else + (.lvf vf3 (&-> *math-camera* camera-temp vector 0 quad)) + (.lvf vf4 (&-> *math-camera* camera-temp vector 1 quad)) + (.lvf vf5 (&-> *math-camera* camera-temp vector 2 quad)) + (.lvf vf6 (&-> *math-camera* camera-temp trans quad)) + (.lvf vf9 (&-> *math-camera* hvdf-off quad)) + (.mov v1-21 vf9) + ) + ) + (.lvf vf1 (&-> sprite x-y-z-sx quad)) + (.lvf vf2 (&-> sprite r-g-b-a quad)) + (.mul.w.vf acc vf6 vf0) + (.add.mul.x.vf acc vf3 vf1 acc) + (.add.mul.y.vf acc vf4 vf1 acc) + (.add.mul.z.vf vf1 vf5 vf1 acc) + (.mul.vf vf10 vf1 vf8) + (.div.vf Q vf0 vf10 :fsf #b11 :ftf #b11) + (TODO.VCLIP vf10 vf10) + (b! (zero? (-> sprite flag-rot-sy x)) cfg-22 :delay (nop!)) + (.wait.vf) + (.mul.vf vf1 vf1 Q :mask #b111) + (.mul.vf vf2 vf2 Q :mask #b111) + (.cfc2.i clip-result Clipping) + (b! (logtest? clip-result 63) cfg-22 :delay (.add.vf vf1 vf1 vf9)) + (.max.x.vf vf1 vf1 vf0 :mask #b1000) + (.svf (&-> (the-as vector dma-position) quad) vf1) + (.svf (&-> (the-as vector dma-color) quad) vf2) + (set! (-> (the-as vector dma-position) w) 255.0) + (set! (-> (the-as vector dma-st-flag) x) (* 0.001953125 (+ -1792.0 (-> (the-as vector dma-position) x)))) + (set! (-> (the-as vector dma-st-flag) y) (* 0.001953125 (+ -1840.0 (-> (the-as vector dma-position) y)))) + ) + (set! (-> (the-as vector dma-st-flag) z) 1.0) + (when (or (< (the-as int (-> sprite flag-rot-sy x)) 3) (< 11 (the-as int (-> sprite flag-rot-sy x)))) + (format 0 "Turns = ~D!!!~%" (-> sprite flag-rot-sy x)) + (set! (-> sprite flag-rot-sy x) (the-as float #xb)) + ) + (set! (-> (the-as (pointer int32) dma-st-flag) 3) (the-as int (-> sprite flag-rot-sy x))) + (let* ((f1-4 (- (-> *math-camera* perspective data 5))) + (f2-2 (-> (the-as vector dma-st-flag) y)) + (f4-0 (+ f2-2 (* (-> (the-as vector dma-color) x) f1-4))) + (f3-0 256.0) + (f0-9 (-> (the-as vector dma-color) x)) + ) + (if (< 416.0 f4-0) + (set! f3-0 (/ (- 416.0 f2-2) f1-4)) + ) + (if (< 128.0 f3-0) + (set! f3-0 128.0) + ) + (when (< f3-0 f0-9) + (let ((v1-61 (/ f3-0 f0-9))) + (.mov vf1 v1-61) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> (the-as vector dma-color) quad) vf2) + (.mov v1-63 vf2) + ) + ) + (&+! (-> dma-buff base) 48) + (+! chunk-sprite-count 1) + (when (= chunk-sprite-count 85) + (let ((v1-68 (-> dma-buff base))) + (set! (-> dma-buff base) dma-chunk-start) + (let* ((a0-10 dma-buff) + (a1-3 (the-as object (-> a0-10 base))) + ) + (set! (-> (the-as dma-packet a1-3) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 3 chunk-sprite-count)) + ) + (set! (-> (the-as dma-packet a1-3) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-3) vif1) (new 'static 'vif-tag + :cmd (vif-cmd unpack-v4-32) + :imm (shr (shl (+ (* 3 draw-sprite-count) 512) 54) 54) + :num (* 3 chunk-sprite-count) + ) + ) + (set! (-> a0-10 base) (&+ (the-as pointer a1-3) 16)) + ) + (set! (-> dma-buff base) v1-68) + ) + (set! chunk-sprite-count 0) + (+! draw-sprite-count 85) + (when (= draw-sprite-count 170) + (let* ((v1-71 dma-buff) + (a0-11 (the-as object (-> v1-71 base))) + ) + (set! (-> (the-as dma-packet a0-11) dma) (new 'static 'dma-tag :qwc #x1 :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 :imm #x1ff :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + (set! (-> v1-71 base) (&+ (the-as pointer a0-11) 16)) + ) + (let* ((v1-72 dma-buff) + (a0-13 (the-as object (-> v1-72 base))) + ) + (set! (-> (the-as vector4w a0-13) x) draw-sprite-count) + (set! (-> (the-as vector4w a0-13) y) 0) + (set! (-> (the-as vector4w a0-13) z) 0) + (set! (-> (the-as vector4w a0-13) w) 0) + (set! (-> v1-72 base) (&+ (the-as pointer a0-13) 16)) + ) + (let* ((v1-73 dma-buff) + (a0-15 (the-as object (-> v1-73 base))) + ) + (set! (-> (the-as dma-packet a0-15) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-15) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> (the-as dma-packet a0-15) vif1) (new 'static 'vif-tag :cmd (vif-cmd flush) :msk #x1)) + (set! (-> v1-73 base) (&+ (the-as pointer a0-15) 16)) + ) + (set! draw-sprite-count 0) + ) + (set! dma-chunk-start (-> dma-buff base)) + (&+! (-> dma-buff base) 16) + ) + ) + ) + (label cfg-22) + 0 + ) + ) + (cond + ((zero? chunk-sprite-count) + (set! (-> dma-buff base) dma-chunk-start) + (nop!) + 0 + ) + (else + (let ((v1-81 (-> dma-buff base))) + (set! (-> dma-buff base) dma-chunk-start) + (let* ((a0-17 dma-buff) + (a1-10 (the-as object (-> a0-17 base))) + ) + (set! (-> (the-as dma-packet a1-10) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 3 chunk-sprite-count)) + ) + (set! (-> (the-as dma-packet a1-10) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-10) vif1) (new 'static 'vif-tag + :cmd (vif-cmd unpack-v4-32) + :imm (shr (shl (+ (* 3 draw-sprite-count) 512) 54) 54) + :num (* 3 chunk-sprite-count) + ) + ) + (set! (-> a0-17 base) (&+ (the-as pointer a1-10) 16)) + ) + (set! (-> dma-buff base) v1-81) + ) + ) + ) + (let ((v1-82 (+ chunk-sprite-count draw-sprite-count))) + (when (nonzero? v1-82) + (let* ((a0-19 dma-buff) + (a1-12 (the-as object (-> a0-19 base))) + ) + (set! (-> (the-as dma-packet a1-12) dma) (new 'static 'dma-tag :qwc #x1 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-12) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-12) vif1) + (new 'static 'vif-tag :imm #x1ff :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + (set! (-> a0-19 base) (&+ (the-as pointer a1-12) 16)) + ) + (let* ((a0-20 dma-buff) + (a1-14 (the-as object (-> a0-20 base))) + ) + (set! (-> (the-as vector4w a1-14) x) v1-82) + (set! (-> (the-as vector4w a1-14) y) 0) + (set! (-> (the-as vector4w a1-14) z) 0) + (set! (-> (the-as vector4w a1-14) w) 0) + (set! (-> a0-20 base) (&+ (the-as pointer a1-14) 16)) + ) + (let ((v1-84 (the-as object (-> dma-buff base)))) + (set! (-> (the-as dma-packet v1-84) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet v1-84) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> (the-as dma-packet v1-84) vif1) (new 'static 'vif-tag :cmd (vif-cmd flush) :msk #x1)) + (set! (-> dma-buff base) (&+ (the-as pointer v1-84) 16)) + ) + ) + ) + ) + 0 + (none) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-h_REF.gc index 73482edc1d..572be15b94 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-h_REF.gc @@ -72,6 +72,9 @@ :method-count-assert 9 :size-assert #x70 :flag-assert #x900000070 + (:methods + (new (symbol type int int) _type_ 0) + ) ) ;; definition for method 3 of type sprite-array-2d @@ -159,6 +162,9 @@ :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 + (:methods + (new (symbol type int int) _type_ 0) + ) ) ;; definition for method 3 of type sprite-array-3d @@ -179,7 +185,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc new file mode 100644 index 0000000000..57d9270655 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc @@ -0,0 +1,993 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type sprite-header +(deftype sprite-header (structure) + ((header qword 1 :inline :offset-assert 0) + (num-sprites int32 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type sprite-header +(defmethod inspect sprite-header ((obj sprite-header)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-header) + (format #t "~1Theader[1] @ #x~X~%" (-> obj header)) + (format #t "~1Tnum-sprites: ~D~%" (-> obj num-sprites)) + (label cfg-4) + obj + ) + +;; definition for function sprite-setup-header +;; INFO: Return type mismatch int vs none. +(defun sprite-setup-header ((hdr sprite-header) (num-sprites int)) + (set! (-> hdr num-sprites) num-sprites) + (none) + ) + +;; definition of type sprite-hvdf-data +(deftype sprite-hvdf-data (structure) + ((data qword 76 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4c0 + :flag-assert #x9000004c0 + ) + +;; definition for method 3 of type sprite-hvdf-data +(defmethod inspect sprite-hvdf-data ((obj sprite-hvdf-data)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-hvdf-data) + (format #t "~1Tdata[76] @ #x~X~%" (-> obj data)) + (label cfg-4) + obj + ) + +;; definition of type sprite-hvdf-control +(deftype sprite-hvdf-control (structure) + ((alloc int8 76 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4c + :flag-assert #x90000004c + ) + +;; definition for method 3 of type sprite-hvdf-control +(defmethod inspect sprite-hvdf-control ((obj sprite-hvdf-control)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-hvdf-control) + (format #t "~1Talloc[76] @ #x~X~%" (-> obj alloc)) + (label cfg-4) + obj + ) + +;; definition of type sprite-aux-elem +(deftype sprite-aux-elem (structure) + ((aux-type sprite-aux-type :offset-assert 0) + (data vector 3 :offset-assert 4) + (vec-data sprite-vec-data-2d :offset 4) + (gif-data adgif-shader :offset 8) + (aux-data sparticle-cpuinfo :offset 12) + ) + :pack-me + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type sprite-aux-elem +(defmethod inspect sprite-aux-elem ((obj sprite-aux-elem)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-aux-elem) + (format #t "~1Taux-type: ~D~%" (-> obj aux-type)) + (format #t "~1Tdata[3] @ #x~X~%" (-> obj data)) + (format #t "~1Tvec-data: #~%" (-> obj vec-data)) + (format #t "~1Tgif-data: #~%" (-> obj gif-data)) + (format #t "~1Taux-data: #~%" (-> obj aux-data)) + (label cfg-4) + obj + ) + +;; definition of type sprite-aux-list +(deftype sprite-aux-list (basic) + ((num-entries int32 :offset-assert 4) + (entry int32 :offset-assert 8) + (data sprite-aux-elem :inline :dynamic :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + (:methods + (new (symbol type int) _type_ 0) + ) + ) + +;; definition for method 3 of type sprite-aux-list +;; INFO: this function exists in multiple non-identical object files +(defmethod inspect sprite-aux-list ((obj sprite-aux-list)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tnum-entries: ~D~%" (-> obj num-entries)) + (format #t "~1Tentry: ~D~%" (-> obj entry)) + (format #t "~1Tdata[0] @ #x~X~%" (-> obj data)) + (label cfg-4) + obj + ) + +;; definition for method 0 of type sprite-aux-list +(defmethod new sprite-aux-list ((allocation symbol) (type-to-make type) (size int)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* size 16)))))) + (set! (-> v0-0 num-entries) size) + (set! (-> v0-0 entry) 0) + v0-0 + ) + ) + +;; definition for method 3 of type sprite-aux-list +;; INFO: this function exists in multiple non-identical object files +;; INFO: Return type mismatch symbol vs sprite-aux-list. +(defmethod inspect sprite-aux-list ((obj sprite-aux-list)) + (format #t "[~X] sprite-aux-list:~%" obj) + (format #t "~Tnum-entries: ~D~%" (-> obj num-entries)) + (format #t "~Tentry: ~D~%" (-> obj entry)) + (dotimes (s5-0 (-> obj entry)) + (format #t "~T~D : ~X~%" s5-0 (-> obj data s5-0)) + ) + (the-as sprite-aux-list #f) + ) + +;; definition for function clear-sprite-aux-list +;; INFO: Return type mismatch int vs none. +(defun clear-sprite-aux-list () + (set! (-> *sprite-aux-list* entry) 0) + 0 + (none) + ) + +;; definition for function add-to-sprite-aux-list +;; INFO: Return type mismatch int vs none. +(defun add-to-sprite-aux-list ((system sparticle-system) (sprite-info sparticle-cpuinfo) (sprite-vec sprite-vec-data-3d) (arg3 uint)) + (let ((s2-0 (-> sprite-info sp-func))) + (if (and (nonzero? s2-0) (not (paused?))) + (s2-0 system sprite-info sprite-vec arg3) + ) + ) + (let ((aux-list *sprite-aux-list*)) + (when (< (-> aux-list entry) (-> aux-list num-entries)) + (cond + ((logtest? (-> sprite-info flags) (sp-cpuinfo-flag distort)) + (set! (-> aux-list data (-> aux-list entry) aux-type) (sprite-aux-type distort)) + (set! (-> aux-list data (-> aux-list entry) vec-data) (-> sprite-info sprite)) + (+! (-> aux-list entry) 1) + (set! (-> sprite-vec r-g-b-a w) 0.0) + ) + ((logtest? (-> sprite-info flags) (sp-cpuinfo-flag glow)) + (let ((a0-18 (-> system cpuinfo-table arg3)) + (a1-11 (-> aux-list data (-> aux-list entry))) + ) + (set! (-> a1-11 aux-type) (sprite-aux-type glow)) + (set! (-> a1-11 vec-data) (-> sprite-info sprite)) + (set! (-> a1-11 gif-data) (-> sprite-info adgif)) + (set! (-> a1-11 aux-data) a0-18) + ) + (+! (-> aux-list entry) 1) + (set! (-> sprite-vec qx-qy-qz-sy y) (the-as float #xffffffff)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition of type sprite-frame-data +(deftype sprite-frame-data (structure) + ((cdata vector 16 :inline :offset 0) + (xy-array vector 8 :inline :offset 0) + (st-array vector 4 :inline :offset 128) + (xyz-array vector 4 :inline :offset 192) + (hmge-scale vector :inline :offset 256) + (consts vector :inline :offset 272) + (pfog0 float :offset 272) + (deg-to-rad float :offset 276) + (min-scale float :offset 280) + (inv-area float :offset 284) + (adgif-giftag gs-gif-tag :inline :offset-assert 288) + (sprite-2d-giftag gs-gif-tag :inline :offset-assert 304) + (sprite-2d-giftag-2 gs-gif-tag :inline :offset-assert 320) + (sincos-01 vector :inline :offset-assert 336) + (sincos-23 vector :inline :offset-assert 352) + (sincos-45 vector :inline :offset-assert 368) + (sincos-67 vector :inline :offset-assert 384) + (sincos-89 vector :inline :offset-assert 400) + (basis-x vector :inline :offset-assert 416) + (basis-y vector :inline :offset-assert 432) + (sprite-3d-giftag gs-gif-tag :inline :offset-assert 448) + (sprite-3d-giftag-2 gs-gif-tag :inline :offset-assert 464) + (screen-shader adgif-shader :inline :offset-assert 480) + (inv-hmge-scale vector :inline :offset 576) + (stq-offset vector :inline :offset-assert 592) + (stq-scale vector :inline :offset-assert 608) + (rgba-plain qword :inline :offset-assert 624) + (warp-giftag gs-gif-tag :inline :offset-assert 640) + (fog-clamp vector :inline :offset-assert 656) + (fog-min float :offset 656) + (fog-max float :offset 660) + (max-scale float :offset 664) + ) + :method-count-assert 9 + :size-assert #x2a0 + :flag-assert #x9000002a0 + ) + +;; definition for method 3 of type sprite-frame-data +(defmethod inspect sprite-frame-data ((obj sprite-frame-data)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sprite-frame-data) + (format #t "~1Tdata[42] @ #x~X~%" (-> obj cdata)) + (format #t "~1Tcdata[16] @ #x~X~%" (-> obj cdata)) + (format #t "~1Tfdata[26] @ #x~X~%" (-> obj hmge-scale)) + (format #t "~1Txy-array[8] @ #x~X~%" (-> obj cdata)) + (format #t "~1Tst-array[4] @ #x~X~%" (-> obj st-array)) + (format #t "~1Txyz-array[4] @ #x~X~%" (-> obj xyz-array)) + (format #t "~1Thmge-scale: #~%" (-> obj hmge-scale)) + (format #t "~1Tconsts: #~%" (&-> obj pfog0)) + (format #t "~1Tpfog0: ~f~%" (-> obj pfog0)) + (format #t "~1Tdeg-to-rad: ~f~%" (-> obj deg-to-rad)) + (format #t "~1Tmin-scale: ~f~%" (-> obj min-scale)) + (format #t "~1Tinv-area: ~f~%" (-> obj inv-area)) + (format #t "~1Tadgif-giftag: #~%" (-> obj adgif-giftag)) + (format #t "~1Tsprite-2d-giftag: #~%" (-> obj sprite-2d-giftag)) + (format #t "~1Tsprite-2d-giftag-2: #~%" (-> obj sprite-2d-giftag-2)) + (format #t "~1Tsincos-01: #~%" (-> obj sincos-01)) + (format #t "~1Tsincos-23: #~%" (-> obj sincos-23)) + (format #t "~1Tsincos-45: #~%" (-> obj sincos-45)) + (format #t "~1Tsincos-67: #~%" (-> obj sincos-67)) + (format #t "~1Tsincos-89: #~%" (-> obj sincos-89)) + (format #t "~1Tbasis-x: #~%" (-> obj basis-x)) + (format #t "~1Tbasis-y: #~%" (-> obj basis-y)) + (format #t "~1Tsprite-3d-giftag: #~%" (-> obj sprite-3d-giftag)) + (format #t "~1Tsprite-3d-giftag-2: #~%" (-> obj sprite-3d-giftag-2)) + (format #t "~1Tscreen-shader: #~%" (-> obj screen-shader)) + (format #t "~1Tinv-hmge-scale: #~%" (-> obj inv-hmge-scale)) + (format #t "~1Tstq-offset: #~%" (-> obj stq-offset)) + (format #t "~1Tstq-scale: #~%" (-> obj stq-scale)) + (format #t "~1Trgba-plain: #~%" (-> obj rgba-plain)) + (format #t "~1Twarp-giftag: #~%" (-> obj warp-giftag)) + (format #t "~1Tfog-clamp: #~%" (-> obj fog-clamp)) + (format #t "~1Tfog-min: ~f~%" (-> obj fog-clamp x)) + (format #t "~1Tfog-max: ~f~%" (-> obj fog-clamp y)) + (format #t "~1Tmax-scale: ~f~%" (-> obj max-scale)) + (label cfg-4) + obj + ) + +;; definition for function sprite-setup-frame-data +;; INFO: Used lq/sq +;; INFO: Return type mismatch float vs none. +(defun sprite-setup-frame-data ((data sprite-frame-data) (tbp-offset uint)) + (set! (-> data hmge-scale quad) (-> *math-camera* hmge-scale quad)) + (set! (-> data inv-hmge-scale quad) (-> *math-camera* inv-hmge-scale quad)) + (set! (-> data pfog0) (-> *math-camera* pfog0)) + (set! (-> data deg-to-rad) 0.000095873795) + (set! (-> data adgif-giftag tag) (new 'static 'gif-tag64 :nloop #x1 :nreg #x5)) + (set! (-> data adgif-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) + :regs4 (gif-reg-id a+d) + ) + ) + (set! (-> data sprite-2d-giftag tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :fge #x1 :abe #x1) + :nreg #x9 + ) + ) + (set! (-> data sprite-2d-giftag regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id st) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id xyzf2) + :regs5 (gif-reg-id st) + :regs6 (gif-reg-id xyzf2) + :regs7 (gif-reg-id st) + :regs8 (gif-reg-id xyzf2) + ) + ) + (set! (-> data sprite-2d-giftag-2 tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :abe #x1) + :nreg #x9 + ) + ) + (set! (-> data sprite-2d-giftag-2 regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id st) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id xyzf2) + :regs5 (gif-reg-id st) + :regs6 (gif-reg-id xyzf2) + :regs7 (gif-reg-id st) + :regs8 (gif-reg-id xyzf2) + ) + ) + (set! (-> data sprite-3d-giftag tag) + (new 'static 'gif-tag64 + :nloop #x4 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + (set! (-> data sprite-3d-giftag regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> data sprite-3d-giftag-2 tag) + (new 'static 'gif-tag64 + :nloop #x4 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :tme #x1 :abe #x1) + :nreg #x3 + ) + ) + (set! (-> data sprite-3d-giftag-2 regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> data warp-giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri) :tme #x1 :abe #x1) + :nreg #xc + ) + ) + (set! (-> data warp-giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id st) + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id st) + :regs4 (gif-reg-id rgbaq) + :regs5 (gif-reg-id xyzf2) + :regs6 (gif-reg-id st) + :regs7 (gif-reg-id rgbaq) + :regs8 (gif-reg-id xyzf2) + ) + ) + (set! (-> data screen-shader prims 1) (gs-reg64 tex0-1)) + (set! (-> data screen-shader tex0) (new 'static 'gs-tex0 :tbw #x8 :tw #xa :th #x8 :tbp0 (* tbp-offset 32))) + (set! (-> data screen-shader prims 3) (gs-reg64 tex1-1)) + (set! (-> data screen-shader tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (set! (-> data screen-shader prims 5) (gs-reg64 miptbp1-1)) + (set! (-> data screen-shader miptbp1) (new 'static 'gs-miptbp)) + (set! (-> data screen-shader clamp-reg) (gs-reg64 clamp-1)) + (set! (-> data screen-shader clamp) (new 'static 'gs-clamp + :wms (gs-tex-wrap-mode region-clamp) + :wmt (gs-tex-wrap-mode region-clamp) + :maxu #x27f + :maxv #xef + ) + ) + (set! (-> data screen-shader prims 9) (gs-reg64 alpha-1)) + (set! (-> data screen-shader alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) + (set! (-> data sincos-01 z) 0.999998) + (set! (-> data sincos-23 z) -0.16666014) + (set! (-> data sincos-45 z) 0.008326521) + (set! (-> data sincos-67 z) -0.0001956241) + (set! (-> data sincos-89 z) 0.0000023042373) + (set! (-> data sincos-01 w) 1.0) + (set! (-> data sincos-23 w) -0.49998003) + (set! (-> data sincos-45 w) 0.041620404) + (set! (-> data sincos-67 w) -0.0013636408) + (set! (-> data sincos-89 w) 0.000020170546) + (set! (-> data basis-x quad) (the-as uint128 0)) + (set! (-> data basis-x x) (- (-> *math-camera* perspective data 0))) + (set! (-> data basis-y quad) (the-as uint128 0)) + (set! (-> data basis-y y) (- (-> *math-camera* perspective data 5))) + (set! (-> data min-scale) (sqrtf (* (/ 1.0 (-> data basis-x x)) (/ 1.0 (-> data basis-y y))))) + (set! (-> data inv-area) (/ 1.0 (* (-> data min-scale) (-> data min-scale)))) + (set-vector! (-> data cdata 0) -0.5 -0.5 0.0 0.0) + (set-vector! (-> data cdata 1) 0.5 -0.5 0.0 0.0) + (set-vector! (-> data cdata 2) 0.5 0.5 0.0 0.0) + (set-vector! (-> data cdata 3) -0.5 0.5 0.0 0.0) + (set-vector! (-> data cdata 4) 0.0 -0.5 0.0 0.0) + (set-vector! (-> data cdata 5) 1.0 -0.5 0.0 0.0) + (set-vector! (-> data cdata 6) 1.0 0.5 0.0 0.0) + (set-vector! (-> data cdata 7) 0.0 0.5 0.0 0.0) + (set-vector! (-> data st-array 0) 0.0 0.0 1.0 0.0) + (set-vector! (-> data cdata 9) 1.0 0.0 1.0 0.0) + (set-vector! (-> data cdata 10) 1.0 1.0 1.0 0.0) + (set-vector! (-> data cdata 11) 0.0 1.0 1.0 0.0) + (set-vector! (-> data xyz-array 0) -0.5 0.0 -0.5 0.0) + (set-vector! (-> data cdata 13) 0.5 0.0 -0.5 0.0) + (set-vector! (-> data cdata 14) 0.5 0.0 0.5 0.0) + (set-vector! (-> data cdata 15) -0.5 0.0 0.5 0.0) + (set-vector! (-> data stq-offset) -1792.0 -1840.0 0.0 0.0) + (set-vector! (-> data stq-scale) 0.0009765625 0.00390625 1.0 1.0) + (set! (-> data rgba-plain vector4w x) 128) + (set! (-> data rgba-plain vector4w y) 128) + (set! (-> data rgba-plain vector4w z) 128) + (set! (-> data rgba-plain vector4w w) 64) + (set! (-> data fog-clamp x) (-> *math-camera* fog-min)) + (set! (-> data fog-clamp y) (-> *math-camera* fog-max)) + (set! (-> data max-scale) 2048.0) + (none) + ) + +;; definition for symbol sprite-vu1-block, type vu-function +(define sprite-vu1-block (new 'static 'vu-function :length #x35f :qlength #x1b0)) + +;; definition for method 0 of type sprite-array-2d +(defmethod new sprite-array-2d ((allocation symbol) (type-to-make type) (group-0-size int) (group-1-size int)) + (let* ((sprite-count (+ group-0-size group-1-size)) + (vec-data-size (* 3 sprite-count)) + (adgif-data-size (* 5 sprite-count)) + (v0-0 (object-new + allocation + type-to-make + (the-as int (+ (-> type-to-make size) (* (+ adgif-data-size -1 vec-data-size) 16))) + ) + ) + ) + (set! (-> v0-0 num-sprites 0) group-0-size) + (set! (-> v0-0 num-sprites 1) group-1-size) + (set! (-> v0-0 num-valid 0) 0) + (set! (-> v0-0 num-valid 1) 0) + (set! (-> v0-0 vec-data) (-> v0-0 data)) + (set! (-> v0-0 adgif-data) (the-as (inline-array adgif-shader) (&-> v0-0 data vec-data-size))) + v0-0 + ) + ) + +;; definition for method 0 of type sprite-array-3d +(defmethod new sprite-array-3d ((allocation symbol) (type-to-make type) (group-0-size int) (group-1-size int)) + (let* ((sprite-count (+ group-0-size group-1-size)) + (vec-data-size (* 3 sprite-count)) + (adgif-data-size (* 5 sprite-count)) + (v0-0 (object-new + allocation + type-to-make + (the-as int (+ (-> type-to-make size) (* (+ adgif-data-size -1 vec-data-size) 16))) + ) + ) + ) + (set! (-> v0-0 num-sprites 0) group-0-size) + (set! (-> v0-0 num-sprites 1) group-1-size) + (set! (-> v0-0 num-valid 0) 0) + (set! (-> v0-0 num-valid 1) 0) + (set! (-> v0-0 vec-data) (-> v0-0 data)) + (set! (-> v0-0 adgif-data) (the-as (inline-array adgif-shader) (&-> v0-0 data vec-data-size))) + v0-0 + ) + ) + +;; definition for function sprite-set-3d-quaternion! +(defun sprite-set-3d-quaternion! ((sprite sprite-vec-data-3d) (quat quaternion)) + (local-vars (v1-0 float) (v1-1 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (cond + ((< (-> quat w) 0.0) + (.lvf vf1 (&-> sprite qx-qy-qz-sy quad)) + (.lvf vf2 (&-> quat vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> sprite qx-qy-qz-sy quad) vf1) + (.mov v1-0 vf1) + ) + (else + (.lvf vf1 (&-> sprite qx-qy-qz-sy quad)) + (.lvf vf2 (&-> quat vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> sprite qx-qy-qz-sy quad) vf1) + (.mov v1-1 vf1) + ) + ) + quat + ) + ) + +;; definition for function sprite-get-3d-quaternion! +(defun sprite-get-3d-quaternion! ((out quaternion) (sprite sprite-vec-data-3d)) + (let ((f0-0 (-> sprite qx-qy-qz-sy x)) + (f1-0 (-> sprite qx-qy-qz-sy y)) + (f2-0 (-> sprite qx-qy-qz-sy z)) + ) + (set! (-> out x) f0-0) + (set! (-> out y) f1-0) + (set! (-> out z) f2-0) + (set! (-> out w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + out + ) + +;; definition for function sprite-add-matrix-data +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun sprite-add-matrix-data ((dma-buff dma-buffer) (matrix-mode uint)) + (let ((count 900)) + (cond + ((zero? matrix-mode) + (let* ((a1-1 dma-buff) + (pkt1 (the-as dma-packet (-> a1-1 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) + (set! (-> pkt1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :num #x5 :cmd (vif-cmd unpack-v4-32) :imm (shr (shl count 54) 54))) + (set! (-> a1-1 base) (&+ (the-as pointer pkt1) 16)) + ) + (let* ((mtx (the-as matrix (-> dma-buff base))) + (t1-0 (-> *math-camera* camera-temp)) + (a2-4 (-> t1-0 vector 0 quad)) + (a3-4 (-> t1-0 vector 1 quad)) + (t0-4 (-> t1-0 vector 2 quad)) + (t1-1 (-> t1-0 trans quad)) + ) + (set! (-> mtx vector 0 quad) a2-4) + (set! (-> mtx vector 1 quad) a3-4) + (set! (-> mtx vector 2 quad) t0-4) + (set! (-> mtx trans quad) t1-1) + ) + (&+! (-> dma-buff base) 64) + (let ((v1-1 (+ count 4))) + (set! (-> (the-as (pointer uint128) (-> dma-buff base))) (-> *math-camera* hvdf-off quad)) + (&+! (-> dma-buff base) 16) + (+ v1-1 1) + ) + ) + ((= matrix-mode 1) + (let* ((a1-10 dma-buff) + (pkt2 (the-as dma-packet (-> a1-10 base))) + ) + (set! (-> pkt2 dma) (new 'static 'dma-tag :qwc #x50 :id (dma-tag-id cnt))) + (set! (-> pkt2 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt2 vif1) + (new 'static 'vif-tag :num #x50 :cmd (vif-cmd unpack-v4-32) :imm (shr (shl count 54) 54)) + ) + (set! (-> a1-10 base) (&+ (the-as pointer pkt2) 16)) + ) + (let ((mtx2 (the-as matrix (-> dma-buff base))) + (f1-0 (-> *math-camera* perspective data 0)) + (f2-0 (-> *math-camera* perspective data 5)) + (f0-1 (* -1.9996 (-> *math-camera* perspective data 0))) + ) + (set-vector! (the-as vector (&+ (the-as pointer mtx2) 0)) f0-1 0.0 0.0 0.0) + (set-vector! (the-as vector (&+ (the-as pointer mtx2) 16)) 0.0 (- (* (/ f2-0 f1-0) f0-1)) 0.0 0.0) + (set-vector! (the-as vector (&+ (the-as pointer mtx2) 32)) 0.0 0.0 (- f0-1) 0.0) + (set-vector! + (the-as vector (&+ (the-as pointer mtx2) 48)) + 0.0 + 0.0 + (* 500000000.0 f0-1) + (* 60.0 f0-1 (-> *math-camera* pfog0)) + ) + ) + (&+! (-> dma-buff base) 64) + (let ((v1-2 (+ count 4))) + (let ((a1-16 (the-as vector (-> dma-buff base)))) + (set! (-> a1-16 quad) (-> *math-camera* hvdf-off quad)) + (set! (-> a1-16 x) 2048.0) + (set! (-> a1-16 y) 2048.0) + (set! (-> a1-16 z) (-> *math-camera* hvdf-off z)) + ) + (&+! (-> dma-buff base) 16) + (let ((v1-3 (+ v1-2 1))) + (dotimes (hvdf-idx 75) + (set! (-> (the-as (pointer uint128) (-> dma-buff base))) (-> *sprite-hvdf-data* data (+ hvdf-idx 1) quad)) + (&+! (-> dma-buff base) 16) + (+! v1-3 1) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function sprite-add-frame-data +;; INFO: Return type mismatch pointer vs none. +(defun sprite-add-frame-data ((dma-buff dma-buffer) (tbp-offset uint)) + (let ((s5-0 42)) + (let* ((v1-0 dma-buff) + (pkt (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc s5-0)) + (set! (-> pkt vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt vif1) (new 'static 'vif-tag :imm #x3d4 :cmd (vif-cmd unpack-v4-32) :num s5-0)) + (set! (-> v1-0 base) (&+ (the-as pointer pkt) 16)) + ) + (sprite-setup-frame-data (the-as sprite-frame-data (-> dma-buff base)) tbp-offset) + (&+! (-> dma-buff base) (* s5-0 16)) + ) + (none) + ) + +;; definition for function sprite-add-2d-chunk +;; INFO: Return type mismatch pointer vs none. +(defun sprite-add-2d-chunk ((sprites sprite-array-2d) (start-sprite-idx int) (num-sprites int) (dma-buff dma-buffer) (mscal-addr int)) + (let ((qwc-pkt1 1)) + (let* ((v1-0 dma-buff) + (pkt1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc qwc-pkt1)) + (set! (-> pkt1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt1)) + (set! (-> v1-0 base) (&+ (the-as pointer pkt1) 16)) + ) + (sprite-setup-header (the-as sprite-header (-> dma-buff base)) num-sprites) + (&+! (-> dma-buff base) (* qwc-pkt1 16)) + ) + (let* ((qwc-pkt2 (* 3 num-sprites)) + (v1-4 dma-buff) + (pkt2 (the-as dma-packet (-> v1-4 base))) + ) + (set! (-> pkt2 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (&+ (-> sprites vec-data) (* 48 start-sprite-idx))) + :qwc qwc-pkt2 + ) + ) + (set! (-> pkt2 vif0) (new 'static 'vif-tag)) + (set! (-> pkt2 vif1) (new 'static 'vif-tag :imm #x8001 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt2)) + (set! (-> v1-4 base) (&+ (the-as pointer pkt2) 16)) + ) + (let* ((qwc-pkt3 (* 5 num-sprites)) + (v1-6 dma-buff) + (pkt3 (the-as dma-packet (-> v1-6 base))) + ) + (set! (-> pkt3 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (+ (the-as int (-> sprites adgif-data)) (* 80 start-sprite-idx)) + :qwc qwc-pkt3 + ) + ) + (set! (-> pkt3 vif0) (new 'static 'vif-tag)) + (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x8091 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt3)) + (set! (-> v1-6 base) (&+ (the-as pointer pkt3) 16)) + ) + (let ((pkt4 (the-as dma-packet (-> dma-buff base)))) + (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt4 vif0) (new 'static 'vif-tag)) + (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm mscal-addr)) + (set! (-> dma-buff base) (&+ (the-as pointer pkt4) 16)) + ) + (none) + ) + +;; definition for function sprite-add-2d-all +(defun sprite-add-2d-all ((sprites sprite-array-2d) (dma-buff dma-buffer) (group-idx int)) + (when (> (-> sprites num-valid group-idx) 0) + (let ((current-sprite-idx 0) + (mscal-addr 3) + ) + (when (= group-idx 1) + (set! current-sprite-idx (-> sprites num-sprites 0)) + (set! mscal-addr 115) + ) + (let ((remaining-sprites (-> sprites num-valid group-idx))) + (while (< 48 remaining-sprites) + (sprite-add-2d-chunk sprites current-sprite-idx 48 dma-buff mscal-addr) + (+! current-sprite-idx 48) + (+! remaining-sprites -48) + ) + (sprite-add-2d-chunk sprites current-sprite-idx remaining-sprites dma-buff mscal-addr) + ) + ) + ) + (none) + ) + +;; definition for function sprite-add-3d-chunk +;; INFO: Return type mismatch pointer vs none. +(defun sprite-add-3d-chunk ((sprites sprite-array-3d) (start-sprite-idx int) (num-sprites int) (dma-buff dma-buffer)) + (let ((qwc-pkt1 1)) + (let* ((v1-0 dma-buff) + (pkt1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc qwc-pkt1)) + (set! (-> pkt1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt1)) + (set! (-> v1-0 base) (&+ (the-as pointer pkt1) 16)) + ) + (sprite-setup-header (the-as sprite-header (-> dma-buff base)) num-sprites) + (&+! (-> dma-buff base) (* qwc-pkt1 16)) + ) + (let* ((qwc-pkt2 (* 3 num-sprites)) + (v1-4 dma-buff) + (pkt2 (the-as dma-packet (-> v1-4 base))) + ) + (set! (-> pkt2 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (&+ (-> sprites vec-data) (* 48 start-sprite-idx))) + :qwc qwc-pkt2 + ) + ) + (set! (-> pkt2 vif0) (new 'static 'vif-tag)) + (set! (-> pkt2 vif1) (new 'static 'vif-tag :imm #x8001 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt2)) + (set! (-> v1-4 base) (&+ (the-as pointer pkt2) 16)) + ) + (let* ((qwc-pkt3 (* 5 num-sprites)) + (v1-6 dma-buff) + (pkt3 (the-as dma-packet (-> v1-6 base))) + ) + (set! (-> pkt3 dma) (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (-> sprites adgif-data start-sprite-idx)) + :qwc qwc-pkt3 + ) + ) + (set! (-> pkt3 vif0) (new 'static 'vif-tag)) + (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x8091 :cmd (vif-cmd unpack-v4-32) :num qwc-pkt3)) + (set! (-> v1-6 base) (&+ (the-as pointer pkt3) 16)) + ) + (let ((pkt4 (the-as dma-packet (-> dma-buff base)))) + (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt4 vif0) (new 'static 'vif-tag)) + (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #xd9)) + (set! (-> dma-buff base) (&+ (the-as pointer pkt4) 16)) + ) + (none) + ) + +;; definition for function sprite-add-3d-all +(defun sprite-add-3d-all ((sprites sprite-array-3d) (dma-buff dma-buffer) (group-idx int)) + (when (> (-> sprites num-valid group-idx) 0) + (let ((current-sprite-idx (if (zero? group-idx) + 0 + (-> sprites num-sprites 0) + ) + ) + (remaining-sprites (-> sprites num-valid group-idx)) + ) + (while (< 48 remaining-sprites) + (sprite-add-3d-chunk sprites current-sprite-idx 48 dma-buff) + (+! current-sprite-idx 48) + (+! remaining-sprites -48) + ) + (sprite-add-3d-chunk sprites current-sprite-idx remaining-sprites dma-buff) + ) + ) + (none) + ) + +;; definition for function sprite-draw +;; INFO: Return type mismatch int vs none. +(defun sprite-draw ((disp display)) + (let ((dma-mem-begin (-> *display* frames (-> *display* on-screen) global-buf base))) + (let* ((dma-buff (-> *display* frames (-> *display* on-screen) global-buf)) + (dma-bucket-begin (-> dma-buff base)) + ) + (when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1)) + (sprite-init-distorter dma-buff) + (sprite-draw-distorters dma-buff) + ) + (let* ((v1-17 dma-buff) + (pkt1 (the-as dma-packet (-> v1-17 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) + (set! (-> pkt1 vif0) (new 'static 'vif-tag)) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-17 base) (&+ (the-as pointer pkt1) 16)) + ) + (let* ((v1-18 dma-buff) + (giftag (the-as gs-gif-tag (-> v1-18 base))) + ) + (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2)) + (set! (-> 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) + :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) + ) + ) + (set! (-> v1-18 base) (the-as pointer (&+ giftag 16))) + ) + (let* ((v1-19 dma-buff) + (a0-10 (-> v1-19 base)) + ) + (set! (-> (the-as (pointer gs-test) a0-10) 0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (set! (-> (the-as (pointer gs-reg64) a0-10) 1) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-clamp) a0-10) 2) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)) + ) + (set! (-> (the-as (pointer gs-reg64) a0-10) 3) (gs-reg64 clamp-1)) + (set! (-> v1-19 base) (&+ a0-10 32)) + ) + (dma-buffer-add-vu-function dma-buff sprite-vu1-block 1) + (sprite-add-frame-data dma-buff (the-as uint 408)) + (let* ((v1-20 dma-buff) + (pkt2 (the-as dma-packet (-> v1-20 base))) + ) + (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt2 vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm #x0)) + (set! (-> pkt2 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-20 base) (&+ (the-as pointer pkt2) 16)) + ) + (let* ((v1-21 dma-buff) + (pkt3 (the-as dma-packet (-> v1-21 base))) + ) + (set! (-> pkt3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt3 vif0) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x190 :cmd (vif-cmd offset))) + (set! (-> v1-21 base) (&+ (the-as pointer pkt3) 16)) + ) + (sprite-add-matrix-data dma-buff (the-as uint 0)) + (sprite-add-3d-all *sprite-array-3d* dma-buff 0) + (sprite-add-2d-all *sprite-array-2d* dma-buff 0) + (let* ((v1-22 dma-buff) + (pkt4 (the-as dma-packet (-> v1-22 base))) + ) + (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt4 vif0) (new 'static 'vif-tag)) + (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-22 base) (&+ (the-as pointer pkt4) 16)) + ) + (sprite-add-matrix-data dma-buff (the-as uint 1)) + (sprite-add-2d-all *sprite-array-2d* dma-buff 1) + (let* ((v1-23 dma-buff) + (pkt5 (the-as dma-packet (-> v1-23 base))) + ) + (set! (-> pkt5 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt5 vif0) (new 'static 'vif-tag)) + (set! (-> pkt5 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-23 base) (&+ (the-as pointer pkt5) 16)) + ) + (sprite-glow-init-engine dma-buff) + (sprite-glow-draw dma-buff) + (simple-sprite-system-method-10 *simple-sprite-system* dma-buff) + (let* ((v1-26 dma-buff) + (pkt6 (the-as dma-packet (-> v1-26 base))) + ) + (set! (-> pkt6 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt6 vif0) (new 'static 'vif-tag)) + (set! (-> pkt6 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-26 base) (&+ (the-as pointer pkt6) 16)) + ) + (let ((a3-0 (-> dma-buff base))) + (let ((pkt7 (the-as dma-packet (-> dma-buff base)))) + (set! (-> pkt7 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> pkt7 vif0) (new 'static 'vif-tag)) + (set! (-> pkt7 vif1) (new 'static 'vif-tag)) + (set! (-> dma-buff base) (&+ (the-as pointer pkt7) 16)) + ) + (dma-bucket-insert-tag + (the-as (inline-array dma-bucket) (-> *display* frames (-> *display* on-screen) bucket-group)) + (bucket-id bucket-313) + dma-bucket-begin + (the-as (pointer dma-tag) a3-0) + ) + ) + ) + (let ((mem-use *dma-mem-usage*)) + (when (nonzero? mem-use) + (set! (-> mem-use length) (max 86 (-> mem-use length))) + (set! (-> mem-use data 85 name) "sprite") + (+! (-> mem-use data 85 count) 1) + (+! (-> mem-use data 85 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint dma-mem-begin)) + ) + (set! (-> mem-use data 85 total) (-> mem-use data 85 used)) + ) + ) + ) + 0 + (none) + ) + +;; definition for function sprite-allocate-user-hvdf +(defun sprite-allocate-user-hvdf () + (dotimes (v1-0 76) + (when (zero? (-> *sprite-hvdf-control* alloc v1-0)) + (set! (-> *sprite-hvdf-control* alloc v1-0) 1) + (return v1-0) + ) + ) + 0 + ) + +;; definition for function sprite-release-user-hvdf +;; INFO: Return type mismatch int vs none. +(defun sprite-release-user-hvdf ((idx int)) + (when (and (>= idx 1) (< idx 76)) + (set! (-> *sprite-hvdf-control* alloc idx) 0) + 0 + ) + 0 + (none) + ) + +;; definition for function sprite-get-user-hvdf +;; INFO: Return type mismatch qword vs vector. +(defun sprite-get-user-hvdf ((idx int)) + (the-as vector (-> *sprite-hvdf-data* data idx)) + ) + +;; failed to figure out what this is: +(kmemopen global "sprite-tables") + +;; definition for symbol *sprite-hvdf-data*, type sprite-hvdf-data +(define *sprite-hvdf-data* (new 'global 'sprite-hvdf-data)) + +;; definition for symbol *sprite-hvdf-control*, type sprite-hvdf-control +(define *sprite-hvdf-control* (new 'global 'sprite-hvdf-control)) + +;; failed to figure out what this is: +(dotimes (v1-25 76) + (set! (-> *sprite-hvdf-control* alloc v1-25) 0) + ) + +;; failed to figure out what this is: +(set! (-> *sprite-hvdf-control* alloc 0) 1) + +;; definition for symbol *sprite-aux-list*, type sprite-aux-list +(define *sprite-aux-list* (new 'global 'sprite-aux-list 256)) + +;; definition for symbol *sprite-array-2d*, type sprite-array-2d +(define *sprite-array-2d* (new 'global 'sprite-array-2d 1920 128)) + +;; definition for symbol *sprite-array-3d*, type sprite-array-3d +(define *sprite-array-3d* (new 'global 'sprite-array-3d 256 0)) + +;; failed to figure out what this is: +(kmemclose) diff --git a/test/decompiler/test_VuDisasm.cpp b/test/decompiler/test_VuDisasm.cpp index 160bcb86db..8986ccda8b 100644 --- a/test/decompiler/test_VuDisasm.cpp +++ b/test/decompiler/test_VuDisasm.cpp @@ -30,6 +30,27 @@ std::string get_expected(const std::string& name) { } } // namespace +TEST(VuDisasm, Sprite_Jak2) { + auto data = get_test_data("jak2/sprite"); + VuDisassembler disasm(VuDisassembler::VuKind::VU1); + auto prog = disasm.disassemble(data.data(), data.size() * 4, false); + EXPECT_EQ(disasm.to_string(prog), get_expected("jak2/sprite")); +} + +TEST(VuDisasm, SpriteDistort_Jak2) { + auto data = get_test_data("jak2/sprite-distort"); + VuDisassembler disasm(VuDisassembler::VuKind::VU1); + auto prog = disasm.disassemble(data.data(), data.size() * 4, false); + EXPECT_EQ(disasm.to_string(prog), get_expected("jak2/sprite-distort")); +} + +TEST(VuDisasm, SpriteGlow_Jak2) { + auto data = get_test_data("jak2/sprite-glow"); + VuDisassembler disasm(VuDisassembler::VuKind::VU1); + auto prog = disasm.disassemble(data.data(), data.size() * 4, false); + EXPECT_EQ(disasm.to_string(prog), get_expected("jak2/sprite-glow")); +} + TEST(VuDisasm, SpriteDistort) { auto data = get_test_data("sprite-distort"); VuDisassembler disasm(VuDisassembler::VuKind::VU1); @@ -215,4 +236,4 @@ TEST(VuDisasm, MercToC) { auto prog = disasm.disassemble(data.data(), data.size() * 4, false); // fmt::print("{}\n", disasm.to_string_with_cpp(prog)); // EXPECT_EQ(disasm.to_string_with_cpp(prog), get_expected("merc")); -} \ No newline at end of file +} diff --git a/test/decompiler/vu_reference/jak2/sprite-distort-result.txt b/test/decompiler/vu_reference/jak2/sprite-distort-result.txt new file mode 100644 index 0000000000..96584eeda7 --- /dev/null +++ b/test/decompiler/vu_reference/jak2/sprite-distort-result.txt @@ -0,0 +1,65 @@ + lq.xyzw vf01, 489(vi00) | nop + lq.xyzw vf05, 490(vi00) | nop + ilw.x vi01, 511(vi00) | nop + iaddiu vi04, vi00, 0x200 | nop + iaddi vi02, vi00, 0x0 | nop +L1: + ilw.w vi07, 1(vi04) | nop + ior vi05, vi02, vi00 | nop + ilw.x vi06, 477(vi07) | nop + sqi.xyzw vf01, vi05 | nop + iaddiu vi08, vi07, 0x4000 | nop + iaddiu vi08, vi08, 0x4000 | nop + isw.x vi08, -1(vi05) | nop + lqi.xyzw vf02, vi04 | nop + lqi.xyzw vf03, vi04 | nop + lqi.xyzw vf04, vi04 | nop + nop | ftoi4.xyzw vf14, vf02 +L2: + lqi.xyzw vf06, vi06 | nop + lqi.xyzw vf07, vi06 | nop + lq.xyzw vf08, 0(vi06) | nop + lq.xyzw vf09, 1(vi06) | nop + iaddi vi07, vi07, -0x1 | muly.xyzw vf10, vf06, vf04 + nop | mulz.xyzw vf11, vf07, vf04 + nop | muly.xyzw vf12, vf08, vf04 + nop | mulz.xyzw vf13, vf09, vf04 + nop | mulx.xyzw vf06, vf06, vf04 + nop | mulx.xyzw vf07, vf07, vf04 + nop | mulx.xyzw vf08, vf08, vf04 + nop | mulx.xyzw vf09, vf09, vf04 + nop | add.xyzw vf10, vf10, vf02 + nop | add.xyzw vf11, vf11, vf03 + nop | add.xyzw vf12, vf12, vf02 + nop | add.xyzw vf13, vf13, vf03 + nop | add.xyzw vf06, vf06, vf02 + nop | add.xyzw vf07, vf07, vf03 + nop | add.xyzw vf08, vf08, vf02 + nop | add.xyzw vf09, vf09, vf03 + nop | ftoi4.xyzw vf10, vf10 + nop | ftoi4.xyzw vf12, vf12 + nop | ftoi4.xyzw vf06, vf06 + nop | ftoi4.xyzw vf08, vf08 + sqi.xyzw vf07, vi05 | nop + sqi.xyzw vf05, vi05 | nop + sqi.xyzw vf06, vi05 | nop + sqi.xyzw vf09, vi05 | nop + sqi.xyzw vf05, vi05 | nop + sqi.xyzw vf08, vi05 | nop + sqi.xyzw vf11, vi05 | nop + sqi.xyzw vf05, vi05 | nop + sqi.xyzw vf10, vi05 | nop + sqi.xyzw vf13, vi05 | nop + sqi.xyzw vf05, vi05 | nop + sqi.xyzw vf12, vi05 | nop + sqi.xyzw vf03, vi05 | nop + sqi.xyzw vf05, vi05 | nop + ibne vi00, vi07, L2 | nop + sqi.xyzw vf14, vi05 | nop + xgkick vi02 | nop + iaddi vi01, vi01, -0x1 | nop + iaddiu vi03, vi00, 0xb0 | nop + ibne vi00, vi01, L1 | nop + isub vi02, vi03, vi02 | nop + nop | nop :e + nop | nop diff --git a/test/decompiler/vu_reference/jak2/sprite-distort.txt b/test/decompiler/vu_reference/jak2/sprite-distort.txt new file mode 100644 index 0000000000..c20959c1b9 --- /dev/null +++ b/test/decompiler/vu_reference/jak2/sprite-distort.txt @@ -0,0 +1,126 @@ +.word 0x1e101e9 +.word 0x2ff +.word 0x1e501ea +.word 0x2ff +.word 0x90101ff +.word 0x2ff +.word 0x10040200 +.word 0x2ff +.word 0x80020032 +.word 0x2ff +.word 0x8272001 +.word 0x2ff +.word 0x80001175 +.word 0x2ff +.word 0x90639dd +.word 0x2ff +.word 0x81e50b7d +.word 0x2ff +.word 0x11083800 +.word 0x2ff +.word 0x11084000 +.word 0x2ff +.word 0xb082fff +.word 0x2ff +.word 0x81e2237c +.word 0x2ff +.word 0x81e3237c +.word 0x2ff +.word 0x81e4237c +.word 0x2ff +.word 0x80000030 +.word 0x1ee117d +.word 0x81e6337c +.word 0x2ff +.word 0x81e7337c +.word 0x2ff +.word 0x1e83000 +.word 0x2ff +.word 0x1e93001 +.word 0x2ff +.word 0x80073ff2 +.word 0x1e43299 +.word 0x80000030 +.word 0x1e43ada +.word 0x80000030 +.word 0x1e44319 +.word 0x80000030 +.word 0x1e44b5a +.word 0x80000030 +.word 0x1e43198 +.word 0x80000030 +.word 0x1e439d8 +.word 0x80000030 +.word 0x1e44218 +.word 0x80000030 +.word 0x1e44a58 +.word 0x80000030 +.word 0x1e252a8 +.word 0x80000030 +.word 0x1e35ae8 +.word 0x80000030 +.word 0x1e26328 +.word 0x80000030 +.word 0x1e36b68 +.word 0x80000030 +.word 0x1e231a8 +.word 0x80000030 +.word 0x1e339e8 +.word 0x80000030 +.word 0x1e24228 +.word 0x80000030 +.word 0x1e34a68 +.word 0x80000030 +.word 0x1ea517d +.word 0x80000030 +.word 0x1ec617d +.word 0x80000030 +.word 0x1e6317d +.word 0x80000030 +.word 0x1e8417d +.word 0x81e53b7d +.word 0x2ff +.word 0x81e52b7d +.word 0x2ff +.word 0x81e5337d +.word 0x2ff +.word 0x81e54b7d +.word 0x2ff +.word 0x81e52b7d +.word 0x2ff +.word 0x81e5437d +.word 0x2ff +.word 0x81e55b7d +.word 0x2ff +.word 0x81e52b7d +.word 0x2ff +.word 0x81e5537d +.word 0x2ff +.word 0x81e56b7d +.word 0x2ff +.word 0x81e52b7d +.word 0x2ff +.word 0x81e5637d +.word 0x2ff +.word 0x81e51b7d +.word 0x2ff +.word 0x81e52b7d +.word 0x2ff +.word 0x52003fd9 +.word 0x2ff +.word 0x81e5737d +.word 0x2ff +.word 0x800016fc +.word 0x2ff +.word 0x80010ff2 +.word 0x2ff +.word 0x100300b0 +.word 0x2ff +.word 0x52000fc9 +.word 0x2ff +.word 0x800218b1 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff \ No newline at end of file diff --git a/test/decompiler/vu_reference/jak2/sprite-glow-result.txt b/test/decompiler/vu_reference/jak2/sprite-glow-result.txt new file mode 100644 index 0000000000..d7b2372438 --- /dev/null +++ b/test/decompiler/vu_reference/jak2/sprite-glow-result.txt @@ -0,0 +1,136 @@ + iaddiu vi05, vi00, 0x320 | nop + lq.xyzw vf25, 988(vi00) | nop + lq.xyzw vf26, 989(vi00) | nop + lq.xyzw vf27, 990(vi00) | nop + lq.xyzw vf30, 996(vi00) | nop + lq.xyzw vf31, 997(vi00) | nop + lq.xyzw vf28, 1002(vi00) | nop + lq.xyzw vf29, 1003(vi00) | nop + nop | nop :e + nop | nop + xtop vi02 | nop + nop | nop + ilwr.x vi03, vi02 | nop + iaddi vi02, vi02, 0x1 | nop + iaddiu vi04, vi02, 0x90 | nop +L1: + lq.xyzw vf03, 2(vi02) | nop + lq.xyzw vf02, 1(vi02) | nop + lq.xyzw vf01, 0(vi02) | nop + lq.xyzw vf24, 983(vi00) | nop + lq.xyzw vf21, 980(vi00) | nop + lq.xyzw vf22, 981(vi00) | nop + lq.xyzw vf23, 982(vi00) | nop + lq.xyzw vf04, 3(vi02) | mulaw.xyz ACC, vf24, vf00 + lq.xyzw vf24, 987(vi00) | maddax.xyz ACC, vf21, vf01 + lq.xyzw vf21, 984(vi00) | madday.xyz ACC, vf22, vf01 + lq.xyzw vf22, 985(vi00) | maddz.xyz vf01, vf23, vf01 + lq.xyzw vf23, 986(vi00) | nop + lq.xyzw vf09, 0(vi04) | nop + lq.xyzw vf10, 1(vi04) | mulw.xyz vf03, vf03, vf03 + div Q, vf02.y, vf01.z | mulz.x vf04, vf04, vf01 + lq.xyzw vf11, 2(vi04) | nop + 0.0078125 | nop :i + lq.xyzw vf12, 3(vi04) | nop + lq.xyzw vf13, 4(vi04) | addy.x vf04, vf04, vf04 + sq.xyzw vf09, 68(vi05) | muly.z vf05, vf02, vf27 + move.w vf05, vf00 | addw.z vf02, vf00, vf01 + sq.xyzw vf10, 69(vi05) | mul.w vf09, vf00, Q + sq.xyzw vf11, 70(vi05) | nop + sq.xyzw vf12, 71(vi05) | miniw.x vf04, vf04, vf00 + sq.xyzw vf13, 72(vi05) | nop + nop | subw.w vf09, vf00, vf09 + nop | maxx.x vf04, vf04, vf00 + nop | mulw.xyz vf01, vf01, vf09 + nop | mulx.xyz vf03, vf03, vf04 + nop | mulaw.xyzw ACC, vf24, vf00 + nop | maddax.xyzw ACC, vf21, vf01 + nop | madday.xyzw ACC, vf22, vf01 + nop | muli.xyz vf03, vf03, I + nop | maddz.xyzw vf01, vf23, vf01 + nop | nop + iaddi vi03, vi03, -0x1 | mulz.z vf06, vf05, vf05 + lq.xyzw vf15, 991(vi00) | nop + iaddi vi02, vi02, 0x3 | nop + fcset 0x0 | mul.xyzw vf07, vf01, vf26 + nop | mulz.zw vf09, vf05, vf06 + lq.xyzw vf15, 992(vi00) | mula.zw ACC, vf05, vf15 + nop | nop + div Q, vf00.w, vf07.w | clipw.xyz vf07, vf07 + nop | mulz.zw vf10, vf09, vf06 + lq.xyzw vf15, 993(vi00) | madda.zw ACC, vf09, vf15 + nop | nop + fcand vi01, 0x3f | nop + ibne vi00, vi01, L2 | mulz.zw vf09, vf10, vf06 + lq.xyzw vf15, 994(vi00) | madda.zw ACC, vf10, vf15 + nop | mul.xyz vf01, vf01, Q + nop | mul.xyzw vf02, vf02, Q + nop | mulz.zw vf10, vf09, vf06 + lq.xyzw vf15, 995(vi00) | madda.zw ACC, vf09, vf15 + nop | add.xyzw vf01, vf01, vf25 + nop | maxw.x vf02, vf02, vf00 + nop | miniw.x vf02, vf02, vf29 + nop | miniz.zw vf02, vf02, vf29 + nop | madd.zw vf05, vf10, vf15 + nop | ftoi0.xyzw vf03, vf03 + nop | addx.xy vf09, vf28, vf02 + nop | subx.xy vf11, vf01, vf02 + nop | addx.xy vf12, vf01, vf02 + nop | subx.xy vf10, vf29, vf02 + nop | mulaz.xyzw ACC, vf30, vf05 + nop | msubw.xyzw vf15, vf31, vf05 + nop | max.xy vf20, vf01, vf09 + nop | addx.zw vf11, vf01, vf00 + nop | addx.zw vf12, vf01, vf00 + nop | subw.xy vf17, vf28, vf00 + nop | mulz.xyzw vf15, vf15, vf02 + nop | addw.xy vf18, vf28, vf00 + nop | ftoi4.xyzw vf11, vf11 + nop | ftoi4.xyzw vf12, vf12 + nop | mini.xy vf20, vf20, vf10 + nop | mulaw.xyzw ACC, vf30, vf05 + sq.xyzw vf03, 75(vi05) | maddz.xyzw vf16, vf31, vf05 + sq.xyz vf11, 11(vi05) | sub.xy vf17, vf20, vf17 + sq.xyz vf12, 12(vi05) | sub.xy vf18, vf20, vf18 + lq.xyzw vf11, 998(vi00) | subx.xy vf19, vf20, vf02 + lq.xyzw vf12, 999(vi00) | mulw.xyzw vf16, vf16, vf02 + lq.xyzw vf13, 1000(vi00) | addx.xy vf20, vf20, vf02 + lq.xyzw vf14, 1001(vi00) | mulaw.xyzw ACC, vf01, vf00 + nop | maddax.xyzw ACC, vf15, vf11 + nop | maddy.xyzw vf11, vf16, vf11 + nop | mulaw.xyzw ACC, vf01, vf00 + nop | maddax.xyzw ACC, vf15, vf12 + nop | maddy.xyzw vf12, vf16, vf12 + nop | mulaw.xyzw ACC, vf01, vf00 + nop | maddax.xyzw ACC, vf15, vf13 + nop | maddy.xyzw vf13, vf16, vf13 + nop | mulaw.xyzw ACC, vf01, vf00 + nop | maddax.xyzw ACC, vf15, vf14 + nop | maddy.xyzw vf14, vf16, vf14 + nop | subx.xy vf17, vf17, vf02 + nop | addx.xy vf18, vf18, vf02 + iaddiu vi04, vi04, 0x50 | subw.xy vf19, vf19, vf00 + nop | addw.xy vf20, vf20, vf00 + nop | ftoi4.xyzw vf11, vf11 + nop | ftoi4.xyzw vf12, vf12 + nop | ftoi4.xyzw vf13, vf13 + nop | ftoi4.xyzw vf14, vf14 + sq.xy vf11, 61(vi05) | ftoi4.xyzw vf17, vf17 + sq.xy vf12, 62(vi05) | ftoi4.xyzw vf18, vf18 + sq.xy vf13, 63(vi05) | ftoi4.xyzw vf19, vf19 + sq.xy vf14, 64(vi05) | ftoi4.xyzw vf20, vf20 + sq.xy vf17, 24(vi05) | nop + sq.xy vf18, 26(vi05) | nop + sq.xy vf19, 8(vi05) | nop + sq.xy vf20, 9(vi05) | nop + sq.xy vf11, 77(vi05) | nop + sq.xy vf12, 79(vi05) | nop + sq.xy vf13, 81(vi05) | nop + sq.xy vf14, 83(vi05) | nop + xgkick vi05 | nop +L2: + iaddiu vi01, vi00, 0x694 | nop + ibne vi00, vi03, L1 | nop + isub vi05, vi01, vi05 | nop + nop | nop :e + nop | nop diff --git a/test/decompiler/vu_reference/jak2/sprite-glow.txt b/test/decompiler/vu_reference/jak2/sprite-glow.txt new file mode 100644 index 0000000000..9ca4b71d2b --- /dev/null +++ b/test/decompiler/vu_reference/jak2/sprite-glow.txt @@ -0,0 +1,268 @@ +.word 0x10050320 +.word 0x2ff +.word 0x1f903dc +.word 0x2ff +.word 0x1fa03dd +.word 0x2ff +.word 0x1fb03de +.word 0x2ff +.word 0x1fe03e4 +.word 0x2ff +.word 0x1ff03e5 +.word 0x2ff +.word 0x1fc03ea +.word 0x2ff +.word 0x1fd03eb +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800206bc +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x810313fe +.word 0x2ff +.word 0x80021072 +.word 0x2ff +.word 0x10041090 +.word 0x2ff +.word 0x1e31002 +.word 0x2ff +.word 0x1e21001 +.word 0x2ff +.word 0x1e11000 +.word 0x2ff +.word 0x1f803d7 +.word 0x2ff +.word 0x1f503d4 +.word 0x2ff +.word 0x1f603d5 +.word 0x2ff +.word 0x1f703d6 +.word 0x2ff +.word 0x1e41003 +.word 0x1c0c1bf +.word 0x1f803db +.word 0x1c1a8bc +.word 0x1f503d8 +.word 0x1c1b0bd +.word 0x1f603d9 +.word 0x1c1b84a +.word 0x1f703da +.word 0x2ff +.word 0x1e92000 +.word 0x2ff +.word 0x1ea2001 +.word 0x1c318db +.word 0x812113bc +.word 0x101211a +.word 0x1eb2002 +.word 0x2ff +.word 0x3c000000 +.word 0x800002ff +.word 0x1ec2003 +.word 0x2ff +.word 0x1ed2004 +.word 0x1042101 +.word 0x3e54844 +.word 0x5b1159 +.word 0x8025033c +.word 0x410083 +.word 0x3e55045 +.word 0x20025c +.word 0x3e55846 +.word 0x2ff +.word 0x3e56047 +.word 0x1002117 +.word 0x3e56848 +.word 0x2ff +.word 0x80000030 +.word 0x290247 +.word 0x80000030 +.word 0x1002110 +.word 0x80000030 +.word 0x1c9085b +.word 0x80000030 +.word 0x1c418d8 +.word 0x80000030 +.word 0x1e0c1bf +.word 0x80000030 +.word 0x1e1a8bc +.word 0x80000030 +.word 0x1e1b0bd +.word 0x80000030 +.word 0x1c018de +.word 0x80000030 +.word 0x1e1b84a +.word 0x80000030 +.word 0x2ff +.word 0x80031ff2 +.word 0x45299a +.word 0x1ef03df +.word 0x2ff +.word 0x800210f2 +.word 0x2ff +.word 0x22000000 +.word 0x1fa09ea +.word 0x80000030 +.word 0x662a5a +.word 0x1ef03e0 +.word 0x6f2abe +.word 0x80000030 +.word 0x2ff +.word 0x81e703bc +.word 0x1c739ff +.word 0x80000030 +.word 0x664a9a +.word 0x1ef03e1 +.word 0x6f4abd +.word 0x80000030 +.word 0x2ff +.word 0x2400003f +.word 0x2ff +.word 0x52000842 +.word 0x66525a +.word 0x1ef03e2 +.word 0x6f52bd +.word 0x80000030 +.word 0x1c0085c +.word 0x80000030 +.word 0x1e0109c +.word 0x80000030 +.word 0x664a9a +.word 0x1ef03e3 +.word 0x6f4abd +.word 0x80000030 +.word 0x1f90868 +.word 0x80000030 +.word 0x1001093 +.word 0x80000030 +.word 0x11d1097 +.word 0x80000030 +.word 0x7d1096 +.word 0x80000030 +.word 0x6f5169 +.word 0x80000030 +.word 0x1e3197c +.word 0x80000030 +.word 0x182e240 +.word 0x80000030 +.word 0x1820ac4 +.word 0x80000030 +.word 0x1820b00 +.word 0x80000030 +.word 0x182ea84 +.word 0x80000030 +.word 0x1e5f1be +.word 0x80000030 +.word 0x1e5fbcf +.word 0x80000030 +.word 0x1890d2b +.word 0x80000030 +.word 0x600ac0 +.word 0x80000030 +.word 0x600b00 +.word 0x80000030 +.word 0x180e447 +.word 0x80000030 +.word 0x1e27bda +.word 0x80000030 +.word 0x180e483 +.word 0x80000030 +.word 0x1eb597d +.word 0x80000030 +.word 0x1ec617d +.word 0x80000030 +.word 0x18aa52f +.word 0x80000030 +.word 0x1e5f1bf +.word 0x3e5184b +.word 0x1e5fc0a +.word 0x3c5580b +.word 0x191a46c +.word 0x3c5600c +.word 0x192a4ac +.word 0x1eb03e6 +.word 0x182a4c4 +.word 0x1ec03e7 +.word 0x1e2841b +.word 0x1ed03e8 +.word 0x182a500 +.word 0x1ee03e9 +.word 0x1e009bf +.word 0x80000030 +.word 0x1eb78bc +.word 0x80000030 +.word 0x1eb82c9 +.word 0x80000030 +.word 0x1e009bf +.word 0x80000030 +.word 0x1ec78bc +.word 0x80000030 +.word 0x1ec8309 +.word 0x80000030 +.word 0x1e009bf +.word 0x80000030 +.word 0x1ed78bc +.word 0x80000030 +.word 0x1ed8349 +.word 0x80000030 +.word 0x1e009bf +.word 0x80000030 +.word 0x1ee78bc +.word 0x80000030 +.word 0x1ee8389 +.word 0x80000030 +.word 0x1828c44 +.word 0x80000030 +.word 0x1829480 +.word 0x10042050 +.word 0x1809cc7 +.word 0x80000030 +.word 0x180a503 +.word 0x80000030 +.word 0x1eb597d +.word 0x80000030 +.word 0x1ec617d +.word 0x80000030 +.word 0x1ed697d +.word 0x80000030 +.word 0x1ee717d +.word 0x385583d +.word 0x1f1897d +.word 0x385603e +.word 0x1f2917d +.word 0x385683f +.word 0x1f3997d +.word 0x3857040 +.word 0x1f4a17d +.word 0x3858818 +.word 0x2ff +.word 0x385901a +.word 0x2ff +.word 0x3859808 +.word 0x2ff +.word 0x385a009 +.word 0x2ff +.word 0x385584d +.word 0x2ff +.word 0x385604f +.word 0x2ff +.word 0x3856851 +.word 0x2ff +.word 0x3857053 +.word 0x2ff +.word 0x80002efc +.word 0x2ff +.word 0x10010694 +.word 0x2ff +.word 0x52001f8c +.word 0x2ff +.word 0x80050971 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff \ No newline at end of file diff --git a/test/decompiler/vu_reference/jak2/sprite-result.txt b/test/decompiler/vu_reference/jak2/sprite-result.txt new file mode 100644 index 0000000000..eeddd9152a --- /dev/null +++ b/test/decompiler/vu_reference/jak2/sprite-result.txt @@ -0,0 +1,908 @@ + lq.xyzw vf29, 996(vi00) | nop + lq.xyzw vf31, 997(vi00) | nop :e + iaddiu vi15, vi00, 0x320 | nop + xtop vi02 | nop + nop | nop + ilwr.x vi04, vi02 | nop + iaddi vi02, vi02, 0x1 | nop + iaddiu vi03, vi02, 0x90 | nop +L1: + ilw.y vi08, 1(vi02) | nop + lq.xyzw vf25, 900(vi00) | nop + lq.xyzw vf26, 901(vi00) | nop + lq.xyzw vf27, 902(vi00) | nop + lq.xyzw vf28, 903(vi00) | nop + lq.xyzw vf30, 904(vi00) | nop + lqi.xyzw vf01, vi02 | nop + lqi.xyzw vf05, vi02 | nop + lqi.xyzw vf11, vi02 | nop + lq.xyzw vf12, 1021(vi00) | mulaw.xyzw ACC, vf28, vf00 + nop | maddax.xyzw ACC, vf25, vf01 + nop | madday.xyzw ACC, vf26, vf01 + nop | maddz.xyzw vf02, vf27, vf01 + move.w vf05, vf00 | addw.z vf01, vf00, vf05 + nop | nop + div Q, vf31.x, vf02.w | muly.z vf05, vf05, vf31 + nop | mul.xyzw vf03, vf02, vf29 + nop | nop + nop | nop + nop | mulz.z vf04, vf05, vf05 + lq.xyzw vf14, 1001(vi00) | clipw.xyz vf03, vf03 + iaddi vi06, vi00, 0x1 | adda.xyzw ACC, vf11, vf11 +L2: + ior vi05, vi15, vi00 | mul.zw vf01, vf01, Q + lq.xyzw vf06, 998(vi00) | mulz.xyzw vf15, vf05, vf04 + lq.xyzw vf14, 1002(vi00) | mula.xyzw ACC, vf05, vf14 + fmand vi01, vi06 | mul.xyz vf02, vf02, Q + ibne vi00, vi01, L6 | addz.x vf01, vf00, vf01 + lqi.xyzw vf07, vi03 | mulz.xyzw vf16, vf15, vf04 + lq.xyzw vf14, 1003(vi00) | madda.xyzw ACC, vf15, vf14 + lqi.xyzw vf08, vi03 | add.xyzw vf10, vf02, vf30 + lqi.xyzw vf09, vi03 | mulw.x vf01, vf01, vf01 + sqi.xyzw vf06, vi05 | mulz.xyzw vf15, vf16, vf04 + lq.xyzw vf14, 1004(vi00) | madda.xyzw ACC, vf16, vf14 + sqi.xyzw vf07, vi05 | maxx.w vf10, vf10, vf12 + sqi.xyzw vf08, vi05 | maxz.zw vf01, vf01, vf31 + sqi.xyzw vf09, vi05 | mulz.xyzw vf16, vf15, vf04 + lq.xyzw vf14, 1005(vi00) | madda.xyzw ACC, vf15, vf14 + ilw.x vi07, -2(vi02) | mulw.x vf01, vf01, vf31 + lqi.xyzw vf06, vi03 | miniy.w vf10, vf10, vf12 + lqi.xyzw vf07, vi03 | miniz.zw vf01, vf01, vf12 + lq.xyzw vf08, 999(vi08) | madd.xyzw vf05, vf16, vf14 + lqi.xyzw vf23, vi02 | miniw.x vf01, vf01, vf00 + ibltz vi08, L4 | suby.w vf02, vf10, vf12 + lqi.xyzw vf24, vi02 | mulx.w vf11, vf11, vf01 + fcand vi01, 0x3f | mulaw.xyzw ACC, vf28, vf00 + lq.xyzw vf17, 1006(vi00) | maddax.xyzw ACC, vf25, vf23 + fmand vi09, vi06 | nop + ibne vi00, vi09, L7 | nop + lq.xyzw vf18, 1007(vi00) | madday.xyzw ACC, vf26, vf23 +L3: + lq.xyzw vf19, 980(vi07) | ftoi0.xyzw vf11, vf11 + lq.xyzw vf20, 981(vi07) | maddz.xyzw vf02, vf27, vf23 + lq.xyzw vf21, 982(vi07) | mulaw.xyzw ACC, vf17, vf05 + lq.xyzw vf22, 983(vi07) | msubz.xyzw vf12, vf18, vf05 + sq.xyzw vf11, 3(vi05) | mulaz.xyzw ACC, vf17, vf05 + lqi.xyzw vf11, vi02 | maddw.xyzw vf13, vf18, vf05 + move.w vf24, vf00 | addw.z vf23, vf00, vf24 + div Q, vf31.x, vf02.w | mulw.xyzw vf12, vf12, vf01 + ibne vi00, vi01, L5 | muly.z vf24, vf24, vf31 + ilw.y vi08, -2(vi02) | mulz.xyzw vf13, vf13, vf01 + sqi.xyzw vf06, vi05 | mul.xyzw vf03, vf02, vf29 + sqi.xyzw vf07, vi05 | mulaw.xyzw ACC, vf10, vf00 + sqi.xyzw vf08, vi05 | maddax.xyzw ACC, vf12, vf19 + lq.xyzw vf06, 988(vi00) | maddy.xyzw vf19, vf13, vf19 + lq.xyzw vf07, 989(vi00) | mulaw.xyzw ACC, vf10, vf00 + lq.xyzw vf08, 990(vi00) | maddax.xyzw ACC, vf12, vf20 + lq.xyzw vf09, 991(vi00) | maddy.xyzw vf20, vf13, vf20 + sq.xyzw vf06, 1(vi05) | mulaw.xyzw ACC, vf10, vf00 + sq.xyzw vf07, 3(vi05) | maddax.xyzw ACC, vf12, vf21 + sq.xyzw vf08, 5(vi05) | maddy.xyzw vf21, vf13, vf21 + sq.xyzw vf09, 7(vi05) | mulaw.xyzw ACC, vf10, vf00 + nop | maddax.xyzw ACC, vf12, vf22 + nop | maddy.xyzw vf22, vf13, vf22 + lq.xyzw vf12, 1021(vi00) | ftoi4.xyzw vf19, vf19 + lq.xyzw vf14, 1001(vi00) | ftoi4.xyzw vf20, vf20 + move.xyzw vf05, vf24 | ftoi4.xyzw vf21, vf21 + move.xyzw vf01, vf23 | ftoi4.xyzw vf22, vf22 + sq.xyzw vf19, 2(vi05) | mulz.z vf04, vf24, vf24 + sq.xyzw vf20, 4(vi05) | clipw.xyz vf03, vf03 + sq.xyzw vf21, 6(vi05) | nop + sq.xyzw vf22, 8(vi05) | nop + xgkick vi15 | nop + iaddi vi04, vi04, -0x1 | nop + iaddiu vi01, vi00, 0x672 | nop + ibne vi00, vi04, L2 | nop + isub vi15, vi01, vi15 | adda.xyzw ACC, vf11, vf11 + nop | nop :e + nop | nop +L4: + iaddi vi04, vi04, -0x1 | nop + iaddi vi02, vi02, -0x2 | nop + ibne vi00, vi04, L1 | nop + nop | nop + nop | nop :e + nop | nop +L5: + iaddi vi04, vi04, -0x1 | nop + iaddi vi02, vi02, -0x3 | nop + ibne vi00, vi04, L1 | nop + nop | nop + nop | nop :e + nop | nop +L6: + iaddi vi04, vi04, -0x1 | nop + iaddi vi03, vi03, 0x4 | nop + ibne vi00, vi04, L1 | nop + nop | nop + nop | nop :e + nop | nop +L7: + b L3 | nop + lq.xyzw vf08, 1000(vi00) | nop + xtop vi02 | nop + nop | nop + ilwr.x vi04, vi02 | nop + iaddi vi02, vi02, 0x1 | nop + iaddiu vi03, vi02, 0x90 | nop +L8: + ilw.y vi08, 1(vi02) | nop + lq.xyzw vf25, 900(vi00) | nop + lq.xyzw vf26, 901(vi00) | nop + lq.xyzw vf27, 902(vi00) | nop + lq.xyzw vf28, 903(vi00) | nop + lq.xyzw vf30, 904(vi08) | nop + lqi.xyzw vf01, vi02 | nop + lqi.xyzw vf05, vi02 | nop + lqi.xyzw vf11, vi02 | nop + lq.xyzw vf12, 1021(vi00) | mulaw.xyzw ACC, vf28, vf00 + ilw.y vi08, 1(vi02) | maddax.xyzw ACC, vf25, vf01 + nop | madday.xyzw ACC, vf26, vf01 + nop | maddz.xyzw vf02, vf27, vf01 + move.w vf05, vf00 | addw.z vf01, vf00, vf05 + nop | nop + div Q, vf31.x, vf02.w | muly.z vf05, vf05, vf31 + nop | mul.xyzw vf03, vf02, vf29 + nop | nop + nop | nop + nop | mulz.z vf04, vf05, vf05 + lq.xyzw vf14, 1001(vi00) | clipw.xyz vf03, vf03 + iaddi vi06, vi00, 0x1 | adda.xyzw ACC, vf11, vf11 +L9: + ior vi05, vi15, vi00 | mul.zw vf01, vf01, Q + lq.xyzw vf06, 998(vi00) | mulz.xyzw vf15, vf05, vf04 + lq.xyzw vf14, 1002(vi00) | mula.xyzw ACC, vf05, vf14 + fmand vi01, vi06 | mul.xyz vf02, vf02, Q + ibne vi00, vi01, L11 | addz.x vf01, vf00, vf01 + lqi.xyzw vf07, vi03 | mulz.xyzw vf16, vf15, vf04 + lq.xyzw vf14, 1003(vi00) | madda.xyzw ACC, vf15, vf14 + lqi.xyzw vf08, vi03 | add.xyzw vf10, vf02, vf30 + lqi.xyzw vf09, vi03 | mulw.x vf01, vf01, vf01 + sqi.xyzw vf06, vi05 | mulz.xyzw vf15, vf16, vf04 + lq.xyzw vf14, 1004(vi00) | madda.xyzw ACC, vf16, vf14 + sqi.xyzw vf07, vi05 | maxx.w vf10, vf10, vf12 + sqi.xyzw vf08, vi05 | maxz.zw vf01, vf01, vf31 + sqi.xyzw vf09, vi05 | mulz.xyzw vf16, vf15, vf04 + lq.xyzw vf14, 1005(vi00) | madda.xyzw ACC, vf15, vf14 + lqi.xyzw vf06, vi03 | mulw.x vf01, vf01, vf31 + lqi.xyzw vf07, vi03 | miniy.w vf10, vf10, vf12 + lq.xyzw vf08, 1000(vi00) | nop + ilw.x vi07, -2(vi02) | madd.xyzw vf05, vf16, vf14 + lq.xyzw vf30, 904(vi08) | nop + lqi.xyzw vf23, vi02 | miniw.x vf01, vf01, vf00 + lqi.xyzw vf24, vi02 | mulx.w vf11, vf11, vf01 + fcand vi01, 0x3f | mulaw.xyzw ACC, vf28, vf00 + lq.xyzw vf17, 1006(vi00) | maddax.xyzw ACC, vf25, vf23 + lq.xyzw vf18, 1007(vi00) | madday.xyzw ACC, vf26, vf23 + lq.xyzw vf19, 980(vi07) | ftoi0.xyzw vf11, vf11 + lq.xyzw vf20, 981(vi07) | maddz.xyzw vf02, vf27, vf23 + lq.xyzw vf21, 982(vi07) | mulaw.xyzw ACC, vf17, vf05 + lq.xyzw vf22, 983(vi07) | msubz.xyzw vf12, vf18, vf05 + sq.xyzw vf11, 3(vi05) | mulaz.xyzw ACC, vf17, vf05 + lqi.xyzw vf11, vi02 | maddw.xyzw vf13, vf18, vf05 + move.w vf24, vf00 | addw.z vf23, vf00, vf24 + div Q, vf31.x, vf02.w | mulw.xyzw vf12, vf12, vf01 + ibne vi00, vi01, L10 | muly.z vf24, vf24, vf31 + ilw.y vi08, 1(vi02) | mulz.xyzw vf13, vf13, vf01 + sqi.xyzw vf06, vi05 | mul.xyzw vf03, vf02, vf29 + sqi.xyzw vf07, vi05 | mulaw.xyzw ACC, vf10, vf00 + sqi.xyzw vf08, vi05 | maddax.xyzw ACC, vf12, vf19 + lq.xyzw vf06, 988(vi00) | maddy.xyzw vf19, vf13, vf19 + lq.xyzw vf07, 989(vi00) | mulaw.xyzw ACC, vf10, vf00 + lq.xyzw vf08, 990(vi00) | maddax.xyzw ACC, vf12, vf20 + lq.xyzw vf09, 991(vi00) | maddy.xyzw vf20, vf13, vf20 + sq.xyzw vf06, 1(vi05) | mulaw.xyzw ACC, vf10, vf00 + sq.xyzw vf07, 3(vi05) | maddax.xyzw ACC, vf12, vf21 + sq.xyzw vf08, 5(vi05) | maddy.xyzw vf21, vf13, vf21 + sq.xyzw vf09, 7(vi05) | mulaw.xyzw ACC, vf10, vf00 + nop | maddax.xyzw ACC, vf12, vf22 + nop | maddy.xyzw vf22, vf13, vf22 + lq.xyzw vf12, 1021(vi00) | ftoi4.xyzw vf19, vf19 + lq.xyzw vf14, 1001(vi00) | ftoi4.xyzw vf20, vf20 + move.xyzw vf05, vf24 | ftoi4.xyzw vf21, vf21 + move.xyzw vf01, vf23 | ftoi4.xyzw vf22, vf22 + sq.xyzw vf19, 2(vi05) | mulz.z vf04, vf24, vf24 + sq.xyzw vf20, 4(vi05) | clipw.xyz vf03, vf03 + sq.xyzw vf21, 6(vi05) | nop + sq.xyzw vf22, 8(vi05) | nop + xgkick vi15 | nop + iaddi vi04, vi04, -0x1 | nop + iaddiu vi01, vi00, 0x672 | nop + ibne vi00, vi04, L9 | nop + isub vi15, vi01, vi15 | adda.xyzw ACC, vf11, vf11 + nop | nop :e + nop | nop +L10: + iaddi vi04, vi04, -0x1 | nop + iaddi vi02, vi02, -0x3 | nop + ibne vi00, vi04, L8 | nop + nop | nop + nop | nop :e + nop | nop +L11: + iaddi vi04, vi04, -0x1 | nop + iaddi vi03, vi03, 0x4 | nop + ibne vi00, vi04, L8 | nop + nop | nop + nop | nop :e + nop | nop + lq.xyzw vf25, 900(vi00) | nop + lq.xyzw vf26, 901(vi00) | nop + lq.xyzw vf27, 902(vi00) | nop + lq.xyzw vf28, 903(vi00) | nop + lq.xyzw vf30, 904(vi00) | nop + xtop vi02 | nop + nop | nop + ilwr.x vi04, vi02 | nop + iaddi vi02, vi02, 0x1 | nop + iaddiu vi03, vi02, 0x90 | nop + lq.xyzw vf23, 1021(vi00) | nop + iaddi vi06, vi00, 0x1 | nop +L12: + lq.xyzw vf06, 1(vi02) | nop + lq.xyzw vf07, 2(vi02) | nop + iaddi vi01, vi00, 0x2 | nop + nop | nop + nop | mul.xyzw vf05, vf06, vf06 + nop | addw.y vf08, vf00, vf06 + nop | subw.w vf06, vf06, vf06 + nop | adda.xyzw ACC, vf07, vf07 + nop | addy.x vf05, vf05, vf05 + nop | nop + nop | nop + fmand vi01, vi06 | nop + ibne vi00, vi01, L16 | addz.x vf05, vf05, vf05 + nop | nop + nop | nop + nop | nop + nop | subx.w vf05, vf00, vf05 + nop | nop + nop | nop + nop | nop + sqrt Q, vf05.w | nop + nop | nop + nop | nop + nop | nop + nop | nop + nop | nop + nop | nop + nop | addq.w vf06, vf06, Q + nop | nop + nop | nop + nop | nop + nop | add.xyzw vf13, vf06, vf06 + nop | addw.x vf09, vf00, vf06 + nop | addz.y vf09, vf00, vf06 + nop | suby.z vf09, vf00, vf06 + nop | subw.w vf09, vf00, vf00 + nop | subz.x vf10, vf00, vf06 + nop | addw.y vf10, vf00, vf06 + nop | addx.z vf10, vf00, vf06 + nop | subw.w vf10, vf00, vf00 + nop | addy.x vf11, vf00, vf06 + nop | subx.y vf11, vf00, vf06 + nop | addw.z vf11, vf00, vf06 + nop | subw.w vf11, vf00, vf00 +L13: + lq.xyzw vf12, 0(vi02) | opmula.xyz ACC, vf13, vf09 + lq.xyzw vf07, 2(vi02) | opmsub.xyz vf09, vf09, vf13 + iaddi vi02, vi02, 0x3 | opmula.xyz ACC, vf13, vf10 + lq.xyzw vf06, 1(vi02) | opmsub.xyz vf10, vf10, vf13 + ior vi05, vi15, vi00 | opmula.xyz ACC, vf13, vf11 + lq.xyzw vf01, 998(vi00) | opmsub.xyz vf11, vf11, vf13 + iaddi vi01, vi00, 0x1 | nop + mtir vi12, vf07.x | nop + iand vi12, vi12, vi01 | nop + lqi.xyzw vf02, vi03 | addw.x vf09, vf09, vf00 + lqi.xyzw vf03, vi03 | addw.y vf10, vf10, vf00 + lqi.xyzw vf04, vi03 | addw.z vf11, vf11, vf00 + sqi.xyzw vf01, vi05 | mul.xyzw vf05, vf06, vf06 + move.w vf12, vf00 | mulw.xyzw vf09, vf09, vf12 + iaddi vi06, vi00, 0x1 | muly.xyzw vf11, vf11, vf08 + lq.xyzw vf14, 992(vi00) | adda.xyzw ACC, vf07, vf07 + lq.xyzw vf15, 993(vi00) | ftoi0.xyzw vf07, vf07 + lq.xyzw vf16, 994(vi00) | addw.y vf08, vf00, vf06 + lq.xyzw vf17, 995(vi00) | subw.w vf06, vf06, vf06 + fmand vi01, vi06 | mulax.xyzw ACC, vf09, vf14 + ibne vi00, vi01, L15 | madday.xyzw ACC, vf10, vf14 + sq.xyzw vf07, 7(vi05) | maddaz.xyzw ACC, vf11, vf14 + sq.xyzw vf07, 10(vi05) | maddw.xyzw vf14, vf12, vf00 + sqi.xyzw vf02, vi05 | addy.x vf05, vf05, vf05 + sq.xyzw vf07, 12(vi05) | mulax.xyzw ACC, vf09, vf15 + sq.xyzw vf07, 15(vi05) | madday.xyzw ACC, vf10, vf15 + sqi.xyzw vf03, vi05 | maddaz.xyzw ACC, vf11, vf15 + sqi.xyzw vf04, vi05 | addz.x vf05, vf05, vf05 + lqi.xyzw vf01, vi03 | maddw.xyzw vf15, vf12, vf00 + lqi.xyzw vf02, vi03 | mulax.xyzw ACC, vf09, vf16 + lq.xyzw vf03, 1008(vi12) | madday.xyzw ACC, vf10, vf16 + nop | subx.w vf05, vf00, vf05 + sqi.xyzw vf01, vi05 | maddaz.xyzw ACC, vf11, vf16 + sqi.xyzw vf02, vi05 | maddw.xyzw vf16, vf12, vf00 + sqi.xyzw vf03, vi05 | mulax.xyzw ACC, vf09, vf17 + sqrt Q, vf05.w | madday.xyzw ACC, vf10, vf17 + nop | maddaz.xyzw ACC, vf11, vf17 + nop | maddw.xyzw vf17, vf12, vf00 + lq.xyzw vf18, 988(vi00) | mulax.xyzw ACC, vf25, vf14 + lq.xyzw vf19, 989(vi00) | madday.xyzw ACC, vf26, vf14 + lq.xyzw vf20, 990(vi00) | maddaz.xyzw ACC, vf27, vf14 + lq.xyzw vf21, 991(vi00) | maddw.xyzw vf14, vf28, vf00 + nop | addq.w vf06, vf06, Q + nop | mulax.xyzw ACC, vf25, vf15 + nop | madday.xyzw ACC, vf26, vf15 + nop | maddaz.xyzw ACC, vf27, vf15 + div Q, vf31.x, vf14.w | mul.xyzw vf09, vf14, vf29 + nop | maddw.xyzw vf15, vf28, vf00 + nop | mulax.xyzw ACC, vf25, vf16 + nop | madday.xyzw ACC, vf26, vf16 + nop | maddaz.xyzw ACC, vf27, vf16 + nop | mul.xyzw vf10, vf15, vf29 + nop | maddw.xyzw vf16, vf28, vf00 + div Q, vf31.x, vf15.w | mul.xyz vf14, vf14, Q + nop | mul.xyzw vf18, vf18, Q + nop | mulax.xyzw ACC, vf25, vf17 + nop | madday.xyzw ACC, vf26, vf17 + nop | maddaz.xyzw ACC, vf27, vf17 + sq.xyzw vf18, 0(vi05) | mul.xyzw vf11, vf16, vf29 + nop | maddw.xyzw vf17, vf28, vf00 + div Q, vf31.x, vf16.w | mul.xyz vf15, vf15, Q + nop | mul.xyzw vf19, vf19, Q + nop | add.xyzw vf14, vf14, vf30 + nop | add.xyzw vf15, vf15, vf30 + nop | mul.xyzw vf12, vf17, vf29 + sq.xyzw vf19, 3(vi05) | clipw.xyz vf09, vf09 + nop | clipw.xyz vf10, vf10 + div Q, vf31.x, vf17.w | mul.xyz vf16, vf16, Q + nop | mul.xyzw vf20, vf20, Q + nop | clipw.xyz vf11, vf11 + nop | clipw.xyz vf12, vf12 + nop | add.xyzw vf16, vf16, vf30 + sq.xyzw vf20, 6(vi05) | maxx.w vf14, vf14, vf23 + nop | maxx.w vf15, vf15, vf23 + fcand vi01, 0x410410 | mul.xyz vf17, vf17, Q + ibne vi00, vi01, L14 | mul.xyzw vf21, vf21, Q + fcand vi01, 0xffffff | maxx.w vf16, vf16, vf23 + ibne vi00, vi01, L17 | miniy.w vf14, vf14, vf23 + nop | add.xyzw vf17, vf17, vf30 + sq.xyzw vf21, 9(vi05) | miniy.w vf15, vf15, vf23 + nop | miniy.w vf16, vf16, vf23 + nop | ftoi4.xyzw vf14, vf14 + nop | maxx.w vf17, vf17, vf23 + nop | ftoi4.xyzw vf15, vf15 + nop | ftoi4.xyzw vf16, vf16 + sq.xyzw vf14, 2(vi05) | add.xyzw vf13, vf06, vf06 + nop | miniy.w vf17, vf17, vf23 + sq.xyzw vf15, 5(vi05) | addw.x vf09, vf00, vf06 + sq.xyzw vf16, 8(vi05) | addz.y vf09, vf00, vf06 + nop | suby.z vf09, vf00, vf06 + nop | ftoi4.xyzw vf17, vf17 + nop | subw.w vf09, vf00, vf00 + nop | subz.x vf10, vf00, vf06 + nop | addw.y vf10, vf00, vf06 + sq.xyzw vf17, 11(vi05) | addx.z vf10, vf00, vf06 + xgkick vi15 | subw.w vf10, vf00, vf00 + iaddi vi04, vi04, -0x1 | addy.x vf11, vf00, vf06 + iaddiu vi01, vi00, 0x672 | subx.y vf11, vf00, vf06 + ibne vi00, vi04, L13 | addw.z vf11, vf00, vf06 + isub vi15, vi01, vi15 | subw.w vf11, vf00, vf00 + nop | nop :e + nop | nop +L14: + iaddi vi04, vi04, -0x1 | nop + nop | nop + ibne vi00, vi04, L12 | nop + nop | nop + nop | nop :e + nop | nop +L15: + iaddi vi04, vi04, -0x1 | nop + iaddi vi03, vi03, 0x2 | nop + ibne vi00, vi04, L12 | nop + nop | nop + nop | nop :e + nop | nop +L16: + iaddi vi04, vi04, -0x1 | nop + iaddi vi03, vi03, 0x5 | nop + ibne vi00, vi04, L12 | nop + iaddi vi02, vi02, 0x3 | nop + nop | nop :e + nop | nop +L17: + fcor vi01, 0x7df7df | nop + ibne vi00, vi01, L14 | nop + fcor vi01, 0xdf7df7 | nop + ibne vi00, vi01, L14 | nop + fcor vi01, 0xefbefb | nop + ibne vi00, vi01, L14 | nop + fcor vi01, 0xf7df7d | nop + ibne vi00, vi01, L14 | nop + fcor vi01, 0xfbefbe | nop + ibne vi00, vi01, L14 | nop + ior vi07, vi05, vi00 | nop + nop | itof0.xyzw vf07, vf07 + sq.xyzw vf09, 2(vi07) | nop + sq.xyzw vf10, 5(vi07) | nop + sq.xyzw vf11, 8(vi07) | nop + sq.xyzw vf12, 11(vi07) | nop + sq.xyzw vf09, 14(vi07) | nop + lq.xyzw vf18, 988(vi00) | nop + lq.xyzw vf19, 989(vi00) | nop + lq.xyzw vf20, 990(vi00) | nop + lq.xyzw vf21, 991(vi00) | nop + sq.xyzw vf18, 0(vi07) | nop + sq.xyzw vf19, 3(vi07) | nop + sq.xyzw vf20, 6(vi07) | nop + sq.xyzw vf21, 9(vi07) | nop + sq.xyzw vf18, 12(vi07) | nop + sq.xyzw vf07, 1(vi07) | nop + sq.xyzw vf07, 4(vi07) | nop + sq.xyzw vf07, 7(vi07) | nop + sq.xyzw vf07, 10(vi07) | nop + sq.xyzw vf07, 13(vi07) | nop + iaddi vi09, vi00, 0x4 | nop + bal vi11, L19 | nop + nop | nop + lq.xyzw vf01, 1008(vi00) | nop + ibeq vi00, vi09, L14 | nop + iaddiu vi10, vi09, 0x4000 | nop + iaddiu vi10, vi10, 0x4000 | nop + sqd.xyzw vf01, vi05 | nop + iswr.x vi10, vi05 | nop + iaddi vi05, vi05, 0x1 | nop + lq.xyzw vf29, 1016(vi00) | nop +L18: + lqi.xyzw vf17, vi05 | nop + lqi.xyzw vf20, vi05 | nop + lqi.xyzw vf14, vi05 | nop + nop | nop + nop | nop + nop | nop + div Q, vf00.w, vf14.w | mul.xyzw vf14, vf14, vf29 + nop | nop + nop | nop + nop | nop + nop | nop + nop | nop + nop | nop + nop | mul.xyz vf14, vf14, Q + nop | mul.xyzw vf17, vf17, Q + nop | nop + nop | nop + nop | add.xyzw vf14, vf14, vf30 + nop | nop + nop | nop + nop | nop + nop | maxx.w vf14, vf14, vf23 + nop | nop + nop | nop + nop | nop + nop | miniy.w vf14, vf14, vf23 + nop | nop + nop | nop + nop | ftoi0.xyzw vf20, vf20 + nop | ftoi4.xyzw vf14, vf14 + nop | nop + sq.xyzw vf17, -3(vi05) | nop + sq.xyzw vf20, -2(vi05) | nop + sq.xyzw vf14, -1(vi05) | nop + iaddi vi09, vi09, -0x1 | nop + nop | nop + ibne vi00, vi09, L18 | nop + nop | nop + lq.xyzw vf29, 996(vi00) | nop + xgkick vi15 | nop + iaddi vi04, vi04, -0x1 | nop + iaddiu vi01, vi00, 0x672 | nop + ibne vi00, vi04, L12 | nop + isub vi15, vi01, vi15 | nop + nop | nop :e + nop | nop +L19: + ior vi08, vi07, vi00 | nop + lq.xyzw vf14, 2(vi07) | nop + ior vi10, vi09, vi00 | nop + lq.xyzw vf17, 0(vi07) | nop + lq.xyzw vf20, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | clipw.xyz vf14, vf14 +L20: + lq.xyzw vf15, 2(vi07) | nop + lq.xyzw vf18, 0(vi07) | nop + lq.xyzw vf21, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | nop + nop | clipw.xyz vf15, vf15 + nop | nop + nop | nop + nop | nop + fcor vi01, 0xfff7df | nop + ibne vi00, vi01, L31 | nop + fcand vi01, 0x20 | nop + ibne vi00, vi01, L32 | nop + fcand vi01, 0x800 | nop + ibne vi00, vi01, L33 | nop + nop | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop +L21: + move.xyzw vf17, vf18 | nop + iaddi vi09, vi09, -0x1 | nop + move.xyzw vf20, vf21 | nop + ibne vi00, vi09, L20 | nop + move.xyzw vf14, vf15 | nop + lq.xyzw vf17, 0(vi05) | nop + lq.xyzw vf20, 1(vi05) | nop + lq.xyzw vf14, 2(vi05) | nop + ior vi07, vi05, vi00 | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop + ibeq vi00, vi10, L30 | nop + ior vi09, vi10, vi00 | nop + ior vi08, vi07, vi00 | nop + lq.xyzw vf14, 2(vi07) | nop + ior vi10, vi09, vi00 | nop + lq.xyzw vf17, 0(vi07) | nop + lq.xyzw vf20, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | clipw.xyz vf14, vf14 +L22: + lq.xyzw vf15, 2(vi07) | nop + lq.xyzw vf18, 0(vi07) | nop + lq.xyzw vf21, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | nop + nop | clipw.xyz vf15, vf15 + nop | nop + nop | nop + nop | nop + fcor vi01, 0xfffdf7 | nop + ibne vi00, vi01, L34 | nop + fcand vi01, 0x8 | nop + ibne vi00, vi01, L35 | nop + fcand vi01, 0x200 | nop + ibne vi00, vi01, L36 | nop + nop | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop +L23: + move.xyzw vf17, vf18 | nop + iaddi vi09, vi09, -0x1 | nop + move.xyzw vf20, vf21 | nop + ibne vi00, vi09, L22 | nop + move.xyzw vf14, vf15 | nop + lq.xyzw vf17, 0(vi05) | nop + lq.xyzw vf20, 1(vi05) | nop + lq.xyzw vf14, 2(vi05) | nop + ior vi07, vi05, vi00 | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop + ibeq vi00, vi10, L30 | nop + ior vi09, vi10, vi00 | nop + ior vi08, vi07, vi00 | nop + lq.xyzw vf14, 2(vi07) | nop + ior vi10, vi09, vi00 | nop + lq.xyzw vf17, 0(vi07) | nop + lq.xyzw vf20, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | clipw.xyz vf14, vf14 +L24: + lq.xyzw vf15, 2(vi07) | nop + lq.xyzw vf18, 0(vi07) | nop + lq.xyzw vf21, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | nop + nop | clipw.xyz vf15, vf15 + nop | nop + nop | nop + nop | nop + fcor vi01, 0xfffefb | nop + ibne vi00, vi01, L37 | nop + fcand vi01, 0x4 | nop + ibne vi00, vi01, L38 | nop + fcand vi01, 0x100 | nop + ibne vi00, vi01, L39 | nop + nop | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop +L25: + move.xyzw vf17, vf18 | nop + iaddi vi09, vi09, -0x1 | nop + move.xyzw vf20, vf21 | nop + ibne vi00, vi09, L24 | nop + move.xyzw vf14, vf15 | nop + lq.xyzw vf17, 0(vi05) | nop + lq.xyzw vf20, 1(vi05) | nop + lq.xyzw vf14, 2(vi05) | nop + ior vi07, vi05, vi00 | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop + ibeq vi00, vi10, L30 | nop + ior vi09, vi10, vi00 | nop + ior vi08, vi07, vi00 | nop + lq.xyzw vf14, 2(vi07) | nop + ior vi10, vi09, vi00 | nop + lq.xyzw vf17, 0(vi07) | nop + lq.xyzw vf20, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | clipw.xyz vf14, vf14 +L26: + lq.xyzw vf15, 2(vi07) | nop + lq.xyzw vf18, 0(vi07) | nop + lq.xyzw vf21, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | nop + nop | clipw.xyz vf15, vf15 + nop | nop + nop | nop + nop | nop + fcor vi01, 0xffff7d | nop + ibne vi00, vi01, L40 | nop + fcand vi01, 0x2 | nop + ibne vi00, vi01, L41 | nop + fcand vi01, 0x80 | nop + ibne vi00, vi01, L42 | nop + nop | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop +L27: + move.xyzw vf17, vf18 | nop + iaddi vi09, vi09, -0x1 | nop + move.xyzw vf20, vf21 | nop + ibne vi00, vi09, L26 | nop + move.xyzw vf14, vf15 | nop + lq.xyzw vf17, 0(vi05) | nop + lq.xyzw vf20, 1(vi05) | nop + lq.xyzw vf14, 2(vi05) | nop + ior vi07, vi05, vi00 | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop + ibeq vi00, vi10, L30 | nop + ior vi09, vi10, vi00 | nop + ior vi08, vi07, vi00 | nop + lq.xyzw vf14, 2(vi07) | nop + ior vi10, vi09, vi00 | nop + lq.xyzw vf17, 0(vi07) | nop + lq.xyzw vf20, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | clipw.xyz vf14, vf14 +L28: + lq.xyzw vf15, 2(vi07) | nop + lq.xyzw vf18, 0(vi07) | nop + lq.xyzw vf21, 1(vi07) | nop + iaddi vi07, vi07, 0x3 | nop + nop | clipw.xyz vf15, vf15 + nop | nop + nop | nop + nop | nop + fcor vi01, 0xffffbe | nop + ibne vi00, vi01, L43 | nop + fcand vi01, 0x1 | nop + ibne vi00, vi01, L44 | nop + fcand vi01, 0x40 | nop + ibne vi00, vi01, L45 | nop + nop | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop +L29: + move.xyzw vf17, vf18 | nop + iaddi vi09, vi09, -0x1 | nop + move.xyzw vf20, vf21 | nop + ibne vi00, vi09, L28 | nop + move.xyzw vf14, vf15 | nop + lq.xyzw vf17, 0(vi05) | nop + lq.xyzw vf20, 1(vi05) | nop + lq.xyzw vf14, 2(vi05) | nop + ior vi07, vi05, vi00 | nop + sqi.xyzw vf17, vi08 | nop + sqi.xyzw vf20, vi08 | nop + sqi.xyzw vf14, vi08 | nop + ibeq vi00, vi10, L30 | nop + ior vi09, vi10, vi00 | nop +L30: + jr vi11 | nop + nop | nop +L31: + b L21 | nop + iaddi vi10, vi10, -0x1 | nop +L32: + sqi.xyzw vf17, vi08 | sub.xyzw vf16, vf15, vf14 + sqi.xyzw vf20, vi08 | sub.xyzw vf19, vf18, vf17 + sqi.xyzw vf14, vi08 | sub.xyzw vf22, vf21, vf20 + ibeq vi07, vi08, L21 | nop + nop | addz.w vf13, vf16, vf16 + nop | addw.z vf13, vf14, vf14 + div Q, vf13.z, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | sub.xyzw vf19, vf17, vf19 + nop | sub.xyzw vf22, vf20, vf22 + nop | sub.xyzw vf16, vf14, vf16 + iaddi vi10, vi10, 0x1 | nop + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L21 | nop + sqi.xyzw vf16, vi08 | nop +L33: + nop | sub.xyzw vf16, vf14, vf15 + nop | sub.xyzw vf19, vf17, vf18 + nop | sub.xyzw vf22, vf20, vf21 + nop | addz.w vf13, vf16, vf16 + nop | addw.z vf13, vf15, vf15 + div Q, vf13.z, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | sub.xyzw vf19, vf18, vf19 + nop | sub.xyzw vf22, vf21, vf22 + nop | sub.xyzw vf16, vf15, vf16 + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L21 | nop + sqi.xyzw vf16, vi08 | nop +L34: + b L23 | nop + iaddi vi10, vi10, -0x1 | nop +L35: + sqi.xyzw vf17, vi08 | sub.xyzw vf16, vf15, vf14 + sqi.xyzw vf20, vi08 | sub.xyzw vf19, vf18, vf17 + sqi.xyzw vf14, vi08 | sub.xyzw vf22, vf21, vf20 + ibeq vi07, vi08, L23 | nop + nop | addy.w vf13, vf16, vf16 + nop | addw.y vf13, vf14, vf14 + div Q, vf13.y, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | sub.xyzw vf19, vf17, vf19 + nop | sub.xyzw vf22, vf20, vf22 + nop | sub.xyzw vf16, vf14, vf16 + iaddi vi10, vi10, 0x1 | nop + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L23 | nop + sqi.xyzw vf16, vi08 | nop +L36: + nop | sub.xyzw vf16, vf14, vf15 + nop | sub.xyzw vf19, vf17, vf18 + nop | sub.xyzw vf22, vf20, vf21 + nop | addy.w vf13, vf16, vf16 + nop | addw.y vf13, vf15, vf15 + div Q, vf13.y, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | sub.xyzw vf19, vf18, vf19 + nop | sub.xyzw vf22, vf21, vf22 + nop | sub.xyzw vf16, vf15, vf16 + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L23 | nop + sqi.xyzw vf16, vi08 | nop +L37: + b L25 | nop + iaddi vi10, vi10, -0x1 | nop +L38: + sqi.xyzw vf17, vi08 | sub.xyzw vf16, vf15, vf14 + sqi.xyzw vf20, vi08 | sub.xyzw vf19, vf18, vf17 + sqi.xyzw vf14, vi08 | sub.xyzw vf22, vf21, vf20 + ibeq vi07, vi08, L25 | nop + nop | suby.w vf13, vf16, vf16 + nop | subw.y vf13, vf14, vf14 + div Q, vf13.y, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | add.xyzw vf19, vf17, vf19 + nop | add.xyzw vf22, vf20, vf22 + nop | add.xyzw vf16, vf14, vf16 + iaddi vi10, vi10, 0x1 | nop + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L25 | nop + sqi.xyzw vf16, vi08 | nop +L39: + nop | sub.xyzw vf16, vf14, vf15 + nop | sub.xyzw vf19, vf17, vf18 + nop | sub.xyzw vf22, vf20, vf21 + nop | suby.w vf13, vf16, vf16 + nop | subw.y vf13, vf15, vf15 + div Q, vf13.y, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | add.xyzw vf19, vf18, vf19 + nop | add.xyzw vf22, vf21, vf22 + nop | add.xyzw vf16, vf15, vf16 + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L25 | nop + sqi.xyzw vf16, vi08 | nop +L40: + b L27 | nop + iaddi vi10, vi10, -0x1 | nop +L41: + sqi.xyzw vf17, vi08 | sub.xyzw vf16, vf15, vf14 + sqi.xyzw vf20, vi08 | sub.xyzw vf19, vf18, vf17 + sqi.xyzw vf14, vi08 | sub.xyzw vf22, vf21, vf20 + ibeq vi07, vi08, L27 | nop + nop | addx.w vf13, vf16, vf16 + nop | addw.x vf13, vf14, vf14 + div Q, vf13.x, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | sub.xyzw vf19, vf17, vf19 + nop | sub.xyzw vf22, vf20, vf22 + nop | sub.xyzw vf16, vf14, vf16 + iaddi vi10, vi10, 0x1 | nop + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L27 | nop + sqi.xyzw vf16, vi08 | nop +L42: + nop | sub.xyzw vf16, vf14, vf15 + nop | sub.xyzw vf19, vf17, vf18 + nop | sub.xyzw vf22, vf20, vf21 + nop | addx.w vf13, vf16, vf16 + nop | addw.x vf13, vf15, vf15 + div Q, vf13.x, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | sub.xyzw vf19, vf18, vf19 + nop | sub.xyzw vf22, vf21, vf22 + nop | sub.xyzw vf16, vf15, vf16 + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L27 | nop + sqi.xyzw vf16, vi08 | nop +L43: + b L29 | nop + iaddi vi10, vi10, -0x1 | nop +L44: + sqi.xyzw vf17, vi08 | sub.xyzw vf16, vf15, vf14 + sqi.xyzw vf20, vi08 | sub.xyzw vf19, vf18, vf17 + sqi.xyzw vf14, vi08 | sub.xyzw vf22, vf21, vf20 + ibeq vi07, vi08, L29 | nop + nop | subx.w vf13, vf16, vf16 + nop | subw.x vf13, vf14, vf14 + div Q, vf13.x, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | add.xyzw vf19, vf17, vf19 + nop | add.xyzw vf22, vf20, vf22 + nop | add.xyzw vf16, vf14, vf16 + iaddi vi10, vi10, 0x1 | nop + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L29 | nop + sqi.xyzw vf16, vi08 | nop +L45: + nop | sub.xyzw vf16, vf14, vf15 + nop | sub.xyzw vf19, vf17, vf18 + nop | sub.xyzw vf22, vf20, vf21 + nop | subx.w vf13, vf16, vf16 + nop | subw.x vf13, vf15, vf15 + div Q, vf13.x, vf13.w | nop + waitq | nop + nop | mul.xyzw vf19, vf19, Q + nop | mul.xyzw vf22, vf22, Q + nop | mul.xyzw vf16, vf16, Q + nop | add.xyzw vf19, vf18, vf19 + nop | add.xyzw vf22, vf21, vf22 + nop | add.xyzw vf16, vf15, vf16 + sqi.xyzw vf19, vi08 | nop + sqi.xyzw vf22, vi08 | nop + b L29 | nop + sqi.xyzw vf16, vi08 | nop diff --git a/test/decompiler/vu_reference/jak2/sprite.txt b/test/decompiler/vu_reference/jak2/sprite.txt new file mode 100644 index 0000000000..7f546570ce --- /dev/null +++ b/test/decompiler/vu_reference/jak2/sprite.txt @@ -0,0 +1,1726 @@ +.word 0x1fd03e4 +.word 0x2ff +.word 0x1ff03e5 +.word 0x400002ff +.word 0x100f0320 +.word 0x2ff +.word 0x800206bc +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x810413fe +.word 0x2ff +.word 0x80021072 +.word 0x2ff +.word 0x10031090 +.word 0x2ff +.word 0x8881001 +.word 0x2ff +.word 0x1f90384 +.word 0x2ff +.word 0x1fa0385 +.word 0x2ff +.word 0x1fb0386 +.word 0x2ff +.word 0x1fc0387 +.word 0x2ff +.word 0x1fe0388 +.word 0x2ff +.word 0x81e1137c +.word 0x2ff +.word 0x81e5137c +.word 0x2ff +.word 0x81eb137c +.word 0x2ff +.word 0x1ec03fd +.word 0x1e0e1bf +.word 0x80000030 +.word 0x1e1c8bc +.word 0x80000030 +.word 0x1e1d0bd +.word 0x80000030 +.word 0x1e1d88a +.word 0x8025033c +.word 0x450043 +.word 0x80000030 +.word 0x2ff +.word 0x8182fbbc +.word 0x5f2959 +.word 0x80000030 +.word 0x1fd10ea +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x45291a +.word 0x1ee03e9 +.word 0x1c319ff +.word 0x80060072 +.word 0x1eb5abc +.word 0x80007975 +.word 0x60085c +.word 0x1e603e6 +.word 0x1e42bda +.word 0x1ee03ea +.word 0x1ee2abe +.word 0x34013000 +.word 0x1c0109c +.word 0x52000848 +.word 0x1010042 +.word 0x81e71b7c +.word 0x1e47c1a +.word 0x1ee03eb +.word 0x1ee7abd +.word 0x81e81b7c +.word 0x1fe12a8 +.word 0x81e91b7c +.word 0x101085b +.word 0x81e5337d +.word 0x1e483da +.word 0x1ee03ec +.word 0x1ee82bd +.word 0x81e53b7d +.word 0x2c5290 +.word 0x81e5437d +.word 0x7f0852 +.word 0x81e54b7d +.word 0x1e47c1a +.word 0x1ee03ed +.word 0x1ee7abd +.word 0x90717fe +.word 0x11f085b +.word 0x81e61b7c +.word 0x2c5295 +.word 0x81e71b7c +.word 0x6c0856 +.word 0x1e843e7 +.word 0x1ee8169 +.word 0x81f7137c +.word 0x1000857 +.word 0x5800402c +.word 0x2c5085 +.word 0x81f8137c +.word 0x215ad8 +.word 0x2400003f +.word 0x1e0e1bf +.word 0x1f103ee +.word 0x1f7c8bc +.word 0x34093000 +.word 0x2ff +.word 0x52004839 +.word 0x2ff +.word 0x1f203ef +.word 0x1f7d0bd +.word 0x1f33bd4 +.word 0x1eb597c +.word 0x1f43bd5 +.word 0x1f7d88a +.word 0x1f53bd6 +.word 0x1e589bf +.word 0x1f63bd7 +.word 0x1e5930e +.word 0x3e55803 +.word 0x1e589be +.word 0x81eb137c +.word 0x1e5934b +.word 0x8038033c +.word 0x5805c3 +.word 0x8182fbbc +.word 0x1e1631b +.word 0x52000823 +.word 0x5fc619 +.word 0x88817fe +.word 0x1e16b5a +.word 0x81e5337d +.word 0x1fd10ea +.word 0x81e53b7d +.word 0x1e051bf +.word 0x81e5437d +.word 0x1f360bc +.word 0x1e603dc +.word 0x1f36cc9 +.word 0x1e703dd +.word 0x1e051bf +.word 0x1e803de +.word 0x1f460bc +.word 0x1e903df +.word 0x1f46d09 +.word 0x3e53001 +.word 0x1e051bf +.word 0x3e53803 +.word 0x1f560bc +.word 0x3e54005 +.word 0x1f56d49 +.word 0x3e54807 +.word 0x1e051bf +.word 0x80000030 +.word 0x1f660bc +.word 0x80000030 +.word 0x1f66d89 +.word 0x1ec03fd +.word 0x1f3997d +.word 0x1ee03e9 +.word 0x1f4a17d +.word 0x81e5c33c +.word 0x1f5a97d +.word 0x81e1bb3c +.word 0x1f6b17d +.word 0x3e59802 +.word 0x58c11a +.word 0x3e5a004 +.word 0x1c319ff +.word 0x3e5a806 +.word 0x2ff +.word 0x3e5b008 +.word 0x2ff +.word 0x80007efc +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x10010672 +.word 0x2ff +.word 0x520027c2 +.word 0x2ff +.word 0x800f0bf1 +.word 0x1eb5abc +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x800217b2 +.word 0x2ff +.word 0x520027a6 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x80021772 +.word 0x2ff +.word 0x520027a0 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x80031932 +.word 0x2ff +.word 0x5200279a +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x400007c7 +.word 0x2ff +.word 0x1e803e8 +.word 0x2ff +.word 0x800206bc +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x810413fe +.word 0x2ff +.word 0x80021072 +.word 0x2ff +.word 0x10031090 +.word 0x2ff +.word 0x8881001 +.word 0x2ff +.word 0x1f90384 +.word 0x2ff +.word 0x1fa0385 +.word 0x2ff +.word 0x1fb0386 +.word 0x2ff +.word 0x1fc0387 +.word 0x2ff +.word 0x1fe4388 +.word 0x2ff +.word 0x81e1137c +.word 0x2ff +.word 0x81e5137c +.word 0x2ff +.word 0x81eb137c +.word 0x2ff +.word 0x1ec03fd +.word 0x1e0e1bf +.word 0x8881001 +.word 0x1e1c8bc +.word 0x80000030 +.word 0x1e1d0bd +.word 0x80000030 +.word 0x1e1d88a +.word 0x8025033c +.word 0x450043 +.word 0x80000030 +.word 0x2ff +.word 0x8182fbbc +.word 0x5f2959 +.word 0x80000030 +.word 0x1fd10ea +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x45291a +.word 0x1ee03e9 +.word 0x1c319ff +.word 0x80060072 +.word 0x1eb5abc +.word 0x80007975 +.word 0x60085c +.word 0x1e603e6 +.word 0x1e42bda +.word 0x1ee03ea +.word 0x1ee2abe +.word 0x34013000 +.word 0x1c0109c +.word 0x52000840 +.word 0x1010042 +.word 0x81e71b7c +.word 0x1e47c1a +.word 0x1ee03eb +.word 0x1ee7abd +.word 0x81e81b7c +.word 0x1fe12a8 +.word 0x81e91b7c +.word 0x101085b +.word 0x81e5337d +.word 0x1e483da +.word 0x1ee03ec +.word 0x1ee82bd +.word 0x81e53b7d +.word 0x2c5290 +.word 0x81e5437d +.word 0x7f0852 +.word 0x81e54b7d +.word 0x1e47c1a +.word 0x1ee03ed +.word 0x1ee7abd +.word 0x81e61b7c +.word 0x11f085b +.word 0x81e71b7c +.word 0x2c5295 +.word 0x1e803e8 +.word 0x2ff +.word 0x90717fe +.word 0x1ee8169 +.word 0x1fe4388 +.word 0x2ff +.word 0x81f7137c +.word 0x1000857 +.word 0x81f8137c +.word 0x215ad8 +.word 0x2400003f +.word 0x1e0e1bf +.word 0x1f103ee +.word 0x1f7c8bc +.word 0x1f203ef +.word 0x1f7d0bd +.word 0x1f33bd4 +.word 0x1eb597c +.word 0x1f43bd5 +.word 0x1f7d88a +.word 0x1f53bd6 +.word 0x1e589bf +.word 0x1f63bd7 +.word 0x1e5930e +.word 0x3e55803 +.word 0x1e589be +.word 0x81eb137c +.word 0x1e5934b +.word 0x8038033c +.word 0x5805c3 +.word 0x8182fbbc +.word 0x1e1631b +.word 0x5200081d +.word 0x5fc619 +.word 0x8881001 +.word 0x1e16b5a +.word 0x81e5337d +.word 0x1fd10ea +.word 0x81e53b7d +.word 0x1e051bf +.word 0x81e5437d +.word 0x1f360bc +.word 0x1e603dc +.word 0x1f36cc9 +.word 0x1e703dd +.word 0x1e051bf +.word 0x1e803de +.word 0x1f460bc +.word 0x1e903df +.word 0x1f46d09 +.word 0x3e53001 +.word 0x1e051bf +.word 0x3e53803 +.word 0x1f560bc +.word 0x3e54005 +.word 0x1f56d49 +.word 0x3e54807 +.word 0x1e051bf +.word 0x80000030 +.word 0x1f660bc +.word 0x80000030 +.word 0x1f66d89 +.word 0x1ec03fd +.word 0x1f3997d +.word 0x1ee03e9 +.word 0x1f4a17d +.word 0x81e5c33c +.word 0x1f5a97d +.word 0x81e1bb3c +.word 0x1f6b17d +.word 0x3e59802 +.word 0x58c11a +.word 0x3e5a004 +.word 0x1c319ff +.word 0x3e5a806 +.word 0x2ff +.word 0x3e5b008 +.word 0x2ff +.word 0x80007efc +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x10010672 +.word 0x2ff +.word 0x520027c4 +.word 0x2ff +.word 0x800f0bf1 +.word 0x1eb5abc +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x80021772 +.word 0x2ff +.word 0x520027a8 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x80031932 +.word 0x2ff +.word 0x520027a2 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x1f90384 +.word 0x2ff +.word 0x1fa0385 +.word 0x2ff +.word 0x1fb0386 +.word 0x2ff +.word 0x1fc0387 +.word 0x2ff +.word 0x1fe0388 +.word 0x2ff +.word 0x800206bc +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x810413fe +.word 0x2ff +.word 0x80021072 +.word 0x2ff +.word 0x10031090 +.word 0x2ff +.word 0x1f703fd +.word 0x2ff +.word 0x80060072 +.word 0x2ff +.word 0x1e61001 +.word 0x2ff +.word 0x1e71002 +.word 0x2ff +.word 0x800100b2 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x1e6316a +.word 0x80000030 +.word 0x860203 +.word 0x80000030 +.word 0x263187 +.word 0x80000030 +.word 0x1e73abc +.word 0x80000030 +.word 0x1052941 +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x34013000 +.word 0x2ff +.word 0x52000891 +.word 0x1052942 +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x250144 +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x818503bd +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2031a0 +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x1e63368 +.word 0x80000030 +.word 0x1060243 +.word 0x80000030 +.word 0x860242 +.word 0x80000030 +.word 0x460245 +.word 0x80000030 +.word 0x200247 +.word 0x80000030 +.word 0x1060286 +.word 0x80000030 +.word 0x860283 +.word 0x80000030 +.word 0x460280 +.word 0x80000030 +.word 0x200287 +.word 0x80000030 +.word 0x10602c1 +.word 0x80000030 +.word 0x8602c4 +.word 0x80000030 +.word 0x4602c3 +.word 0x80000030 +.word 0x2002c7 +.word 0x1ec1000 +.word 0x1c96afe +.word 0x1e71002 +.word 0x1cd4a6e +.word 0x800210f2 +.word 0x1ca6afe +.word 0x1e61001 +.word 0x1cd52ae +.word 0x80007975 +.word 0x1cb6afe +.word 0x1e103e6 +.word 0x1cd5aee +.word 0x80010072 +.word 0x2ff +.word 0x800c3bfc +.word 0x2ff +.word 0x80016334 +.word 0x2ff +.word 0x81e21b7c +.word 0x1004a43 +.word 0x81e31b7c +.word 0x805283 +.word 0x81e41b7c +.word 0x405ac3 +.word 0x81e50b7d +.word 0x1e6316a +.word 0x802c033c +.word 0x1ec4a5b +.word 0x80060072 +.word 0x1e85ad9 +.word 0x1ee03e0 +.word 0x1e73abc +.word 0x1ef03e1 +.word 0x1e7397c +.word 0x1f003e2 +.word 0x860203 +.word 0x1f103e3 +.word 0x263187 +.word 0x34013000 +.word 0x1ee49bc +.word 0x52000857 +.word 0x1ee50bd +.word 0x3e53807 +.word 0x1ee58be +.word 0x3e5380a +.word 0x1e0638b +.word 0x81e5137d +.word 0x1052941 +.word 0x3e5380c +.word 0x1ef49bc +.word 0x3e5380f +.word 0x1ef50bd +.word 0x81e51b7d +.word 0x1ef58be +.word 0x81e5237d +.word 0x1052942 +.word 0x81e11b7c +.word 0x1e063cb +.word 0x81e21b7c +.word 0x1f049bc +.word 0x1e363f0 +.word 0x1f050bd +.word 0x80000030 +.word 0x250144 +.word 0x81e50b7d +.word 0x1f058be +.word 0x81e5137d +.word 0x1e0640b +.word 0x81e51b7d +.word 0x1f149bc +.word 0x818503bd +.word 0x1f150bd +.word 0x80000030 +.word 0x1f158be +.word 0x80000030 +.word 0x1e0644b +.word 0x1f203dc +.word 0x1eec9bc +.word 0x1f303dd +.word 0x1eed0bd +.word 0x1f403de +.word 0x1eed8be +.word 0x1f503df +.word 0x1e0e38b +.word 0x80000030 +.word 0x2031a0 +.word 0x80000030 +.word 0x1efc9bc +.word 0x80000030 +.word 0x1efd0bd +.word 0x80000030 +.word 0x1efd8be +.word 0x818efbbc +.word 0x1fd726a +.word 0x80000030 +.word 0x1e0e3cb +.word 0x80000030 +.word 0x1f0c9bc +.word 0x80000030 +.word 0x1f0d0bd +.word 0x80000030 +.word 0x1f0d8be +.word 0x80000030 +.word 0x1fd7aaa +.word 0x80000030 +.word 0x1e0e40b +.word 0x818ffbbc +.word 0x1c0739c +.word 0x80000030 +.word 0x1e0949c +.word 0x80000030 +.word 0x1f1c9bc +.word 0x80000030 +.word 0x1f1d0bd +.word 0x80000030 +.word 0x1f1d8be +.word 0x3e59000 +.word 0x1fd82ea +.word 0x80000030 +.word 0x1e0e44b +.word 0x8190fbbc +.word 0x1c07bdc +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1fe73a8 +.word 0x80000030 +.word 0x1fe7be8 +.word 0x80000030 +.word 0x1fd8b2a +.word 0x3e59803 +.word 0x1c949ff +.word 0x80000030 +.word 0x1ca51ff +.word 0x8191fbbc +.word 0x1c0841c +.word 0x80000030 +.word 0x1e0a51c +.word 0x80000030 +.word 0x1cb59ff +.word 0x80000030 +.word 0x1cc61ff +.word 0x80000030 +.word 0x1fe8428 +.word 0x3e5a006 +.word 0x377390 +.word 0x80000030 +.word 0x377bd0 +.word 0x24410410 +.word 0x1c08c5c +.word 0x5200081a +.word 0x1e0ad5c +.word 0x24ffffff +.word 0x378410 +.word 0x5200082a +.word 0x377395 +.word 0x80000030 +.word 0x1fe8c68 +.word 0x3e5a809 +.word 0x377bd5 +.word 0x80000030 +.word 0x378415 +.word 0x80000030 +.word 0x1ee717d +.word 0x80000030 +.word 0x378c50 +.word 0x80000030 +.word 0x1ef797d +.word 0x80000030 +.word 0x1f0817d +.word 0x3e57002 +.word 0x1e63368 +.word 0x80000030 +.word 0x378c55 +.word 0x3e57805 +.word 0x1060243 +.word 0x3e58008 +.word 0x860242 +.word 0x80000030 +.word 0x460245 +.word 0x80000030 +.word 0x1f1897d +.word 0x80000030 +.word 0x200247 +.word 0x80000030 +.word 0x1060286 +.word 0x80000030 +.word 0x860283 +.word 0x3e5880b +.word 0x460280 +.word 0x80007efc +.word 0x200287 +.word 0x800427f2 +.word 0x10602c1 +.word 0x10010672 +.word 0x8602c4 +.word 0x5200279d +.word 0x4602c3 +.word 0x800f0bf1 +.word 0x2002c7 +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x5200276b +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x800318b2 +.word 0x2ff +.word 0x52002765 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x80031972 +.word 0x2ff +.word 0x5200275f +.word 0x2ff +.word 0x800210f2 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x267df7df +.word 0x2ff +.word 0x52000fec +.word 0x2ff +.word 0x26df7df7 +.word 0x2ff +.word 0x52000fea +.word 0x2ff +.word 0x26efbefb +.word 0x2ff +.word 0x52000fe8 +.word 0x2ff +.word 0x26f7df7d +.word 0x2ff +.word 0x52000fe6 +.word 0x2ff +.word 0x26fbefbe +.word 0x2ff +.word 0x52000fe4 +.word 0x2ff +.word 0x800029f5 +.word 0x2ff +.word 0x80000030 +.word 0x1e7393c +.word 0x3e74802 +.word 0x2ff +.word 0x3e75005 +.word 0x2ff +.word 0x3e75808 +.word 0x2ff +.word 0x3e7600b +.word 0x2ff +.word 0x3e7480e +.word 0x2ff +.word 0x1f203dc +.word 0x2ff +.word 0x1f303dd +.word 0x2ff +.word 0x1f403de +.word 0x2ff +.word 0x1f503df +.word 0x2ff +.word 0x3e79000 +.word 0x2ff +.word 0x3e79803 +.word 0x2ff +.word 0x3e7a006 +.word 0x2ff +.word 0x3e7a809 +.word 0x2ff +.word 0x3e7900c +.word 0x2ff +.word 0x3e73801 +.word 0x2ff +.word 0x3e73804 +.word 0x2ff +.word 0x3e73807 +.word 0x2ff +.word 0x3e7380a +.word 0x2ff +.word 0x3e7380d +.word 0x2ff +.word 0x80090132 +.word 0x2ff +.word 0x420b0037 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x1e103f0 +.word 0x2ff +.word 0x50004fca +.word 0x2ff +.word 0x110a4800 +.word 0x2ff +.word 0x110a5000 +.word 0x2ff +.word 0x81e50b7f +.word 0x2ff +.word 0x810a2bff +.word 0x2ff +.word 0x80052872 +.word 0x2ff +.word 0x1fd03f8 +.word 0x2ff +.word 0x81f12b7c +.word 0x2ff +.word 0x81f42b7c +.word 0x2ff +.word 0x81ee2b7c +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x81ee03bc +.word 0x1fd73aa +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x1c0739c +.word 0x80000030 +.word 0x1e08c5c +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x1fe73a8 +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x377390 +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x377395 +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x1f4a17c +.word 0x80000030 +.word 0x1ee717d +.word 0x80000030 +.word 0x2ff +.word 0x3e58ffd +.word 0x2ff +.word 0x3e5a7fe +.word 0x2ff +.word 0x3e577ff +.word 0x2ff +.word 0x80094ff2 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x52004fdb +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x1fd03e4 +.word 0x2ff +.word 0x80007efc +.word 0x2ff +.word 0x800427f2 +.word 0x2ff +.word 0x10010672 +.word 0x2ff +.word 0x52002707 +.word 0x2ff +.word 0x800f0bf1 +.word 0x2ff +.word 0x80000030 +.word 0x400002ff +.word 0x80000030 +.word 0x2ff +.word 0x80003a35 +.word 0x2ff +.word 0x1ee3802 +.word 0x2ff +.word 0x80004ab5 +.word 0x2ff +.word 0x1f13800 +.word 0x2ff +.word 0x1f43801 +.word 0x2ff +.word 0x800738f2 +.word 0x1ce71ff +.word 0x1ef3802 +.word 0x2ff +.word 0x1f23800 +.word 0x2ff +.word 0x1f53801 +.word 0x2ff +.word 0x800738f2 +.word 0x2ff +.word 0x80000030 +.word 0x1cf79ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x26fff7df +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000020 +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000800 +.word 0x2ff +.word 0x520008c1 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x81f1933c +.word 0x2ff +.word 0x80094ff2 +.word 0x2ff +.word 0x81f4ab3c +.word 0x2ff +.word 0x52004fea +.word 0x2ff +.word 0x81ee7b3c +.word 0x2ff +.word 0x1f12800 +.word 0x2ff +.word 0x1f42801 +.word 0x2ff +.word 0x1ee2802 +.word 0x2ff +.word 0x800029f5 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x50005099 +.word 0x2ff +.word 0x80005275 +.word 0x2ff +.word 0x80003a35 +.word 0x2ff +.word 0x1ee3802 +.word 0x2ff +.word 0x80004ab5 +.word 0x2ff +.word 0x1f13800 +.word 0x2ff +.word 0x1f43801 +.word 0x2ff +.word 0x800738f2 +.word 0x1ce71ff +.word 0x1ef3802 +.word 0x2ff +.word 0x1f23800 +.word 0x2ff +.word 0x1f53801 +.word 0x2ff +.word 0x800738f2 +.word 0x2ff +.word 0x80000030 +.word 0x1cf79ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x26fffdf7 +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000008 +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000200 +.word 0x2ff +.word 0x520008c1 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x81f1933c +.word 0x2ff +.word 0x80094ff2 +.word 0x2ff +.word 0x81f4ab3c +.word 0x2ff +.word 0x52004fea +.word 0x2ff +.word 0x81ee7b3c +.word 0x2ff +.word 0x1f12800 +.word 0x2ff +.word 0x1f42801 +.word 0x2ff +.word 0x1ee2802 +.word 0x2ff +.word 0x800029f5 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x50005073 +.word 0x2ff +.word 0x80005275 +.word 0x2ff +.word 0x80003a35 +.word 0x2ff +.word 0x1ee3802 +.word 0x2ff +.word 0x80004ab5 +.word 0x2ff +.word 0x1f13800 +.word 0x2ff +.word 0x1f43801 +.word 0x2ff +.word 0x800738f2 +.word 0x1ce71ff +.word 0x1ef3802 +.word 0x2ff +.word 0x1f23800 +.word 0x2ff +.word 0x1f53801 +.word 0x2ff +.word 0x800738f2 +.word 0x2ff +.word 0x80000030 +.word 0x1cf79ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x26fffefb +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000004 +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000100 +.word 0x2ff +.word 0x520008c1 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x81f1933c +.word 0x2ff +.word 0x80094ff2 +.word 0x2ff +.word 0x81f4ab3c +.word 0x2ff +.word 0x52004fea +.word 0x2ff +.word 0x81ee7b3c +.word 0x2ff +.word 0x1f12800 +.word 0x2ff +.word 0x1f42801 +.word 0x2ff +.word 0x1ee2802 +.word 0x2ff +.word 0x800029f5 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x5000504d +.word 0x2ff +.word 0x80005275 +.word 0x2ff +.word 0x80003a35 +.word 0x2ff +.word 0x1ee3802 +.word 0x2ff +.word 0x80004ab5 +.word 0x2ff +.word 0x1f13800 +.word 0x2ff +.word 0x1f43801 +.word 0x2ff +.word 0x800738f2 +.word 0x1ce71ff +.word 0x1ef3802 +.word 0x2ff +.word 0x1f23800 +.word 0x2ff +.word 0x1f53801 +.word 0x2ff +.word 0x800738f2 +.word 0x2ff +.word 0x80000030 +.word 0x1cf79ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x26ffff7d +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000002 +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000080 +.word 0x2ff +.word 0x520008c1 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x81f1933c +.word 0x2ff +.word 0x80094ff2 +.word 0x2ff +.word 0x81f4ab3c +.word 0x2ff +.word 0x52004fea +.word 0x2ff +.word 0x81ee7b3c +.word 0x2ff +.word 0x1f12800 +.word 0x2ff +.word 0x1f42801 +.word 0x2ff +.word 0x1ee2802 +.word 0x2ff +.word 0x800029f5 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x50005027 +.word 0x2ff +.word 0x80005275 +.word 0x2ff +.word 0x80003a35 +.word 0x2ff +.word 0x1ee3802 +.word 0x2ff +.word 0x80004ab5 +.word 0x2ff +.word 0x1f13800 +.word 0x2ff +.word 0x1f43801 +.word 0x2ff +.word 0x800738f2 +.word 0x1ce71ff +.word 0x1ef3802 +.word 0x2ff +.word 0x1f23800 +.word 0x2ff +.word 0x1f53801 +.word 0x2ff +.word 0x800738f2 +.word 0x2ff +.word 0x80000030 +.word 0x1cf79ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x26ffffbe +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000001 +.word 0x2ff +.word 0x520008b0 +.word 0x2ff +.word 0x24000040 +.word 0x2ff +.word 0x520008c1 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x81f1933c +.word 0x2ff +.word 0x80094ff2 +.word 0x2ff +.word 0x81f4ab3c +.word 0x2ff +.word 0x52004fea +.word 0x2ff +.word 0x81ee7b3c +.word 0x2ff +.word 0x1f12800 +.word 0x2ff +.word 0x1f42801 +.word 0x2ff +.word 0x1ee2802 +.word 0x2ff +.word 0x800029f5 +.word 0x2ff +.word 0x81e88b7d +.word 0x2ff +.word 0x81e8a37d +.word 0x2ff +.word 0x81e8737d +.word 0x2ff +.word 0x50005001 +.word 0x2ff +.word 0x80005275 +.word 0x2ff +.word 0x48005800 +.word 0x2ff +.word 0x80000030 +.word 0x2ff +.word 0x40000757 +.word 0x2ff +.word 0x800a57f2 +.word 0x2ff +.word 0x81e88b7d +.word 0x1ee7c2c +.word 0x81e8a37d +.word 0x1f194ec +.word 0x81e8737d +.word 0x1f4adac +.word 0x50074752 +.word 0x2ff +.word 0x80000030 +.word 0x308342 +.word 0x80000030 +.word 0x4e7343 +.word 0x81cd6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f38cec +.word 0x80000030 +.word 0x1f6a5ac +.word 0x80000030 +.word 0x1f0742c +.word 0x800a5072 +.word 0x2ff +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000744 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x80000030 +.word 0x1ef742c +.word 0x80000030 +.word 0x1f28cec +.word 0x80000030 +.word 0x1f5a5ac +.word 0x80000030 +.word 0x308342 +.word 0x80000030 +.word 0x4f7b43 +.word 0x81cd6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f394ec +.word 0x80000030 +.word 0x1f6adac +.word 0x80000030 +.word 0x1f07c2c +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000733 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x40000757 +.word 0x2ff +.word 0x800a57f2 +.word 0x2ff +.word 0x81e88b7d +.word 0x1ee7c2c +.word 0x81e8a37d +.word 0x1f194ec +.word 0x81e8737d +.word 0x1f4adac +.word 0x50074752 +.word 0x2ff +.word 0x80000030 +.word 0x308341 +.word 0x80000030 +.word 0x8e7343 +.word 0x81ad6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f38cec +.word 0x80000030 +.word 0x1f6a5ac +.word 0x80000030 +.word 0x1f0742c +.word 0x800a5072 +.word 0x2ff +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000744 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x80000030 +.word 0x1ef742c +.word 0x80000030 +.word 0x1f28cec +.word 0x80000030 +.word 0x1f5a5ac +.word 0x80000030 +.word 0x308341 +.word 0x80000030 +.word 0x8f7b43 +.word 0x81ad6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f394ec +.word 0x80000030 +.word 0x1f6adac +.word 0x80000030 +.word 0x1f07c2c +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000733 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x40000757 +.word 0x2ff +.word 0x800a57f2 +.word 0x2ff +.word 0x81e88b7d +.word 0x1ee7c2c +.word 0x81e8a37d +.word 0x1f194ec +.word 0x81e8737d +.word 0x1f4adac +.word 0x50074752 +.word 0x2ff +.word 0x80000030 +.word 0x308345 +.word 0x80000030 +.word 0x8e7347 +.word 0x81ad6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f38ce8 +.word 0x80000030 +.word 0x1f6a5a8 +.word 0x80000030 +.word 0x1f07428 +.word 0x800a5072 +.word 0x2ff +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000744 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x80000030 +.word 0x1ef742c +.word 0x80000030 +.word 0x1f28cec +.word 0x80000030 +.word 0x1f5a5ac +.word 0x80000030 +.word 0x308345 +.word 0x80000030 +.word 0x8f7b47 +.word 0x81ad6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f394e8 +.word 0x80000030 +.word 0x1f6ada8 +.word 0x80000030 +.word 0x1f07c28 +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000733 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x40000757 +.word 0x2ff +.word 0x800a57f2 +.word 0x2ff +.word 0x81e88b7d +.word 0x1ee7c2c +.word 0x81e8a37d +.word 0x1f194ec +.word 0x81e8737d +.word 0x1f4adac +.word 0x50074752 +.word 0x2ff +.word 0x80000030 +.word 0x308340 +.word 0x80000030 +.word 0x10e7343 +.word 0x818d6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f38cec +.word 0x80000030 +.word 0x1f6a5ac +.word 0x80000030 +.word 0x1f0742c +.word 0x800a5072 +.word 0x2ff +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000744 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x80000030 +.word 0x1ef742c +.word 0x80000030 +.word 0x1f28cec +.word 0x80000030 +.word 0x1f5a5ac +.word 0x80000030 +.word 0x308340 +.word 0x80000030 +.word 0x10f7b43 +.word 0x818d6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f394ec +.word 0x80000030 +.word 0x1f6adac +.word 0x80000030 +.word 0x1f07c2c +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000733 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x40000757 +.word 0x2ff +.word 0x800a57f2 +.word 0x2ff +.word 0x81e88b7d +.word 0x1ee7c2c +.word 0x81e8a37d +.word 0x1f194ec +.word 0x81e8737d +.word 0x1f4adac +.word 0x50074752 +.word 0x2ff +.word 0x80000030 +.word 0x308344 +.word 0x80000030 +.word 0x10e7347 +.word 0x818d6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f38ce8 +.word 0x80000030 +.word 0x1f6a5a8 +.word 0x80000030 +.word 0x1f07428 +.word 0x800a5072 +.word 0x2ff +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000744 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff +.word 0x80000030 +.word 0x1ef742c +.word 0x80000030 +.word 0x1f28cec +.word 0x80000030 +.word 0x1f5a5ac +.word 0x80000030 +.word 0x308344 +.word 0x80000030 +.word 0x10f7b47 +.word 0x818d6bbc +.word 0x2ff +.word 0x800003bf +.word 0x2ff +.word 0x80000030 +.word 0x1e09cdc +.word 0x80000030 +.word 0x1e0b59c +.word 0x80000030 +.word 0x1e0841c +.word 0x80000030 +.word 0x1f394e8 +.word 0x80000030 +.word 0x1f6ada8 +.word 0x80000030 +.word 0x1f07c28 +.word 0x81e89b7d +.word 0x2ff +.word 0x81e8b37d +.word 0x2ff +.word 0x40000733 +.word 0x2ff +.word 0x81e8837d +.word 0x2ff \ No newline at end of file diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 14c12b579e..7cb435f207 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -35,6 +35,11 @@ "(method 3 sky-vertex)", // cache asm "invalidate-cache-line", + // sprite + // multiple defined + "(method 3 sprite-aux-list)", + // sprite-distort + "sprite-draw-distorters", // uses clipping flag. // asm, weird vector dot "(method 17 trsqv)", // history - rgba issues