diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 69e820829..afd3ce438 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -3529,133 +3529,133 @@ (bucket9 9) ;; hfrag (tex-l0-tfrag 10) ;; texture - (bucket11 11) ;; tfrag - (bucket12 12) ;; tie - (bucket13 13) ;; tie - (bucket14 14) ;; tfrag - (bucket15 15) ;; tie - (bucket16 16) ;; tie + (tfrag-l0-tfrag 11) ;; tfrag + (tie-l0-tfrag 12) ;; tie + (etie-l0-tfrag 13) ;; tie + (tfrag-scissor-l0-tfrag 14) ;; tfrag + (tie-scissor-l0-tfrag 15) ;; tie + (etie-scissor-l0-tfrag 16) ;; tie (merc-l0-tfrag 17) ;; merc (emerc-l0-tfrag 18) ;; emerc (gmerc-l0-tfrag 19) ;; generic - (bucket20 20) ;; tie + (tie-vanish-l0-tfrag 20) ;; tie (gmerc2-l0-tfrag 21) ;; generic (tex-l1-tfrag 22) - (bucket23 23) - (bucket24 24) - (bucket25 25) - (bucket26 26) - (bucket27 27) - (bucket28 28) + (tfrag-l1-tfrag 23) + (tie-l1-tfrag 24) + (etie-l1-tfrag 25) + (tfrag-scissor-l1-tfrag 26) + (tie-scissor-l1-tfrag 27) + (etie-scissor-l1-tfrag 28) (merc-l1-tfrag 29) (emerc-l1-tfrag 30) (gmerc-l1-tfrag 31) - (bucket32 32) + (tie-vanish-l1-tfrag 32) (gmerc2-l1-tfrag 33) (tex-l2-tfrag 34) - (bucket35 35) - (bucket36 36) - (bucket37 37) - (bucket38 38) - (bucket39 39) - (bucket40 40) + (tfrag-l2-tfrag 35) + (tie-l2-tfrag 36) + (etie-l2-tfrag 37) + (tfrag-scissor-l2-tfrag 38) + (tie-scissor-l2-tfrag 39) + (etie-scissor-l2-tfrag 40) (merc-l2-tfrag 41) (emerc-l2-tfrag 42) (gmerc-l2-tfrag 43) - (bucket44 44) + (tie-vanish-l2-tfrag 44) (gmerc2-l2-tfrag 45) (tex-l3-tfrag 46) - (bucket47 47) - (bucket48 48) - (bucket49 49) - (bucket50 50) - (bucket51 51) - (bucket52 52) + (tfrag-l3-tfrag 47) + (tie-l3-tfrag 48) + (etie-l3-tfrag 49) + (tfrag-scissor-l3-tfrag 50) + (tie-scissor-l3-tfrag 51) + (etie-scissor-l3-tfrag 52) (merc-l3-tfrag 53) (emerc-l3-tfrag 54) (gmerc-l3-tfrag 55) - (bucket56 56) + (tie-vanish-l3-tfrag 56) (gmerc2-l3-tfrag 57) (tex-l4-tfrag 58) - (bucket59 59) - (bucket60 60) - (bucket61 61) - (bucket62 62) - (bucket63 63) - (bucket64 64) + (tfrag-l4-tfrag 59) + (tie-l4-tfrag 60) + (etie-l4-tfrag 61) + (tfrag-scissor-l4-tfrag 62) + (tie-scissor-l4-tfrag 63) + (etie-scissor-l4-tfrag 64) (merc-l4-tfrag 65) (emerc-l4-tfrag 66) (gmerc-l4-tfrag 67) - (bucket68 68) + (tie-vanish-l4-tfrag 68) (gmerc2-l4-tfrag 69) (tex-l5-tfrag 70) - (bucket71 71) - (bucket72 72) - (bucket73 73) - (bucket74 74) - (bucket75 75) - (bucket76 76) + (tfrag-l5-tfrag 71) + (tie-l5-tfrag 72) + (etie-l5-tfrag 73) + (tfrag-scissor-l5-tfrag 74) + (tie-scissor-l5-tfrag 75) + (etie-scissor-l5-tfrag 76) (merc-l5-tfrag 77) (emerc-l5-tfrag 78) (gmerc-l5-tfrag 79) - (bucket80 80) + (tie-vanish-l5-tfrag 80) (gmerc2-l5-tfrag 81) (tex-l6-tfrag 82) - (bucket83 83) - (bucket84 84) - (bucket85 85) - (bucket86 86) - (bucket87 87) - (bucket88 88) + (tfrag-l6-tfrag 83) + (tie-l6-tfrag 84) + (etie-l6-tfrag 85) + (tfrag-scissor-l6-tfrag 86) + (tie-scissor-l6-tfrag 87) + (etie-scissor-l6-tfrag 88) (merc-l6-tfrag 89) (emerc-l6-tfrag 90) (gmerc-l6-tfrag 91) - (bucket92 92) + (tie-vanish-l6-tfrag 92) (gmerc2-l6-tfrag 93) (tex-l7-tfrag 94) - (bucket95 95) - (bucket96 96) - (bucket97 97) - (bucket98 98) - (bucket99 99) - (bucket100 100) + (tfrag-l7-tfrag 95) + (tie-l7-tfrag 96) + (etie-l7-tfrag 97) + (tfrag-scissor-l7-tfrag 98) + (tie-scissor-l7-tfrag 99) + (etie-scissor-l7-tfrag 100) (merc-l7-tfrag 101) (emerc-l7-tfrag 102) (gmerc-l7-tfrag 103) - (bucket104 104) + (tie-vanish-l7-tfrag 104) (gmerc2-l7-tfrag 105) (tex-l8-tfrag 106) - (bucket107 107) - (bucket108 108) - (bucket109 109) - (bucket110 110) - (bucket111 111) - (bucket112 112) + (tfrag-l8-tfrag 107) + (tie-l8-tfrag 108) + (etie-l8-tfrag 109) + (tfrag-scissor-l8-tfrag 110) + (tie-scissor-l8-tfrag 111) + (etie-scissor-l8-tfrag 112) (merc-l8-tfrag 113) (emerc-l8-tfrag 114) (gmerc-l8-tfrag 115) - (bucket116 116) + (tie-vanish-l8-tfrag 116) (gmerc2-l8-tfrag 117) (tex-l9-tfrag 118) - (bucket119 119) - (bucket120 120) - (bucket121 121) - (bucket122 122) - (bucket123 123) - (bucket124 124) + (tfrag-l9-tfrag 119) + (tie-l9-tfrag 120) + (etie-l9-tfrag 121) + (tfrag-scissor-l9-tfrag 122) + (tie-scissor-l9-tfrag 123) + (etie-scissor-l9-tfrag 124) (merc-l9-tfrag 125) (emerc-l9-tfrag 126) (gmerc-l9-tfrag 127) - (bucket128 128) + (tie-vanish-l9-tfrag 128) (gmerc2-l9-tfrag 129) (tex-l0-shrub 130) @@ -3769,123 +3769,123 @@ (gmerc2-l9-shrub 229) (tex-l0-alpha 230) - (bucket231 231) - (bucket232 232) - (bucket233 233) + (tfrag-l0-alpha 231) + (tie-l0-alpha 232) + (etie-l0-alpha 233) (merc-l0-alpha 234) (emerc-l0-alpha 235) (gmerc-l0-alpha 236) - (bucket237 237) - (bucket238 238) - (bucket239 239) + (tfrag-scissor-l0-alpha 237) + (tie-scissor-l0-alpha 238) + (etie-scissor-l0-alpha 239) (gmerc2-l0-alpha 240) (tex-l1-alpha 241) - (bucket242 242) - (bucket243 243) - (bucket244 244) + (tfrag-l1-alpha 242) + (tie-l1-alpha 243) + (etie-l1-alpha 244) (merc-l1-alpha 245) (emerc-l1-alpha 246) (gmerc-l1-alpha 247) - (bucket248 248) - (bucket249 249) - (bucket250 250) + (tfrag-scissor-l1-alpha 248) + (tie-scissor-l1-alpha 249) + (etie-scissor-l1-alpha 250) (gmerc2-l1-alpha 251) (tex-l2-alpha 252) - (bucket253 253) - (bucket254 254) - (bucket255 255) + (tfrag-l2-alpha 253) + (tie-l2-alpha 254) + (etie-l02alpha 255) (merc-l2-alpha 256) (emerc-l2-alpha 257) (gmerc-l2-alpha 258) - (bucket259 259) - (bucket260 260) - (bucket261 261) + (tfrag-scissor-l2-alpha 259) + (tie-scissor-l2-alpha 260) + (etie-scissor-l2-alpha 261) (gmerc2-l2-alpha 262) (tex-l3-alpha 263) - (bucket264 264) - (bucket265 265) - (bucket266 266) + (tfrag-l3-alpha 264) + (tie-l3-alpha 265) + (etie-l3-alpha 266) (merc-l3-alpha 267) (emerc-l3-alpha 268) (gmerc-l3-alpha 269) - (bucket270 270) - (bucket271 271) - (bucket272 272) + (tfrag-scissor-l3-alpha 270) + (tie-scissor-l3-alpha 271) + (etie-scissor-l3-alpha 272) (gmerc2-l3-alpha 273) (tex-l4-alpha 274) - (bucket275 275) - (bucket276 276) - (bucket277 277) + (tfrag-l4-alpha 275) + (tie-l4-alpha 276) + (etie-l4-alpha 277) (merc-l4-alpha 278) (emerc-l4-alpha 279) (gmerc-l4-alpha 280) - (bucket281 281) - (bucket282 282) - (bucket283 283) + (tfrag-scissor-l4-alpha 281) + (tie-scissor-l4-alpha 282) + (etie-scissor-l4-alpha 283) (gmerc2-l4-alpha 284) (tex-l5-alpha 285) - (bucket286 286) - (bucket287 287) - (bucket288 288) + (tfrag-l5-alpha 286) + (tie-l5-alpha 287) + (etie-l5-alpha 288) (merc-l5-alpha 289) (emerc-l5-alpha 290) (gmerc-l5-alpha 291) - (bucket292 292) - (bucket293 293) - (bucket294 294) + (tfrag-scissor-l5-alpha 292) + (tie-scissor-l5-alpha 293) + (etie-scissor-l5-alpha 294) (gmerc2-l5-alpha 295) (tex-l6-alpha 296) - (bucket297 297) - (bucket298 298) - (bucket299 299) + (tfrag-l6-alpha 297) + (tie-l6-alpha 298) + (etie-l6-alpha 299) (merc-l6-alpha 300) (emerc-l6-alpha 301) (gmerc-l6-alpha 302) - (bucket303 303) - (bucket304 304) - (bucket305 305) + (tfrag-scissor-l6-alpha 303) + (tie-scissor-l6-alpha 304) + (etie-scissor-l6-alpha 305) (gmerc2-l6-alpha 306) (tex-l7-alpha 307) - (bucket308 308) - (bucket309 309) - (bucket310 310) + (tfrag-l7-alpha 308) + (tie-l7-alpha 309) + (etie-l7-alpha 310) (merc-l7-alpha 311) (emerc-l7-alpha 312) (gmerc-l7-alpha 313) - (bucket314 314) - (bucket315 315) - (bucket316 316) + (tfrag-scissor-l7-alpha 314) + (tie-scissor-l7-alpha 315) + (etie-scissor-l7-alpha 316) (gmerc2-l7-alpha 317) (tex-l8-alpha 318) - (bucket319 319) - (bucket320 320) - (bucket321 321) + (tfrag-l8-alpha 319) + (tie-l8-alpha 320) + (etie-l8-alpha 321) (merc-l8-alpha 322) (emerc-l8-alpha 323) (gmerc-l8-alpha 324) - (bucket325 325) - (bucket326 326) - (bucket327 327) + (tfrag-scissor-l8-alpha 325) + (tie-scissor-l8-alpha 326) + (etie-scissor-l8-alpha 327) (gmerc2-l8-alpha 328) (tex-l9-alpha 329) - (bucket330 330) - (bucket331 331) - (bucket332 332) + (tfrag-l9-alpha 330) + (tie-l9-alpha 331) + (etie-l9-alpha 332) (merc-l9-alpha 333) (emerc-l9-alpha 334) (gmerc-l9-alpha 335) - (bucket336 336) - (bucket337 337) - (bucket338 338) + (tfrag-scissor-l9-alpha 336) + (tie-scissor-l9-alpha 337) + (etie-scissor-l9-alpha 338) (gmerc2-l9-alpha 339) (tex-lcom-tfrag 340) @@ -4040,111 +4040,111 @@ (tex-l0-water 463) (merc-l0-water 464) (gmerc-l0-water 465) - (bucket466 466) - (bucket467 467) - (bucket468 468) - (bucket469 469) - (bucket470 470) - (bucket471 471) + (tfrag-l0-water 466) + (tie-l0-water 467) + (etie-l0-water 468) + (tie-scissor-l0-water 469) + (tfrag-scissor-l0-water 470) + (etie-scissor-l0-water 471) (gmerc2-l0-water 472) (tex-l1-water 473) (merc-l1-water 474) (gmerc-l1-water 475) - (bucket476 476) - (bucket477 477) - (bucket478 478) - (bucket479 479) - (bucket480 480) - (bucket481 481) + (tfrag-l1-water 476) + (tie-l1-water 477) + (etie-l1-water 478) + (tie-scissor-l1-water 479) + (tfrag-scissor-l1-water 480) + (etie-scissor-l1-water 481) (gmerc2-l1-water 482) (tex-l2-water 483) (merc-l2-water 484) (gmerc-l2-water 485) - (bucket486 486) - (bucket487 487) - (bucket488 488) - (bucket489 489) - (bucket490 490) - (bucket491 491) + (tfrag-l2-water 486) + (tie-l2-water 487) + (etie-l2-water 488) + (tie-scissor-l2-water 489) + (tfrag-scissor-l2-water 490) + (etie-scissor-l2-water 491) (gmerc2-l2-water 492) (tex-l3-water 493) (merc-l3-water 494) (gmerc-l3-water 495) - (bucket496 496) - (bucket497 497) - (bucket498 498) - (bucket499 499) - (bucket500 500) - (bucket501 501) + (tfrag-l3-water 496) + (tie-l3-water 497) + (etie-l3-water 498) + (tie-scissor-l3-water 499) + (tfrag-scissor-l3-water 500) + (etie-scissor-l3-water 501) (gmerc2-l3-water 502) (tex-l4-water 503) (merc-l4-water 504) (gmerc-l4-water 505) - (bucket506 506) - (bucket507 507) - (bucket508 508) - (bucket509 509) - (bucket510 510) - (bucket511 511) + (tfrag-l4-water 506) + (tie-l4-water 507) + (etie-l4-water 508) + (tie-scissor-l4-water 509) + (tfrag-scissor-l4-water 510) + (etie-scissor-l4-water 511) (gmerc2-l4-water 512) (tex-l5-water 513) (merc-l5-water 514) (gmerc-l5-water 515) - (bucket516 516) - (bucket517 517) - (bucket518 518) - (bucket519 519) - (bucket520 520) - (bucket521 521) + (tfrag-l5-water 516) + (tie-l5-water 517) + (etie-l5-water 518) + (tie-scissor-l5-water 519) + (tfrag-scissor-l5-water 520) + (etie-scissor-l5-water 521) (gmerc2-l5-water 522) (tex-l6-water 523) (merc-l6-water 524) (gmerc-l6-water 525) - (bucket526 526) - (bucket527 527) - (bucket528 528) - (bucket529 529) - (bucket530 530) - (bucket531 531) + (tfrag-l6-water 526) + (tie-l6-water 527) + (etie-l6-water 528) + (tie-scissor-l6-water 529) + (tfrag-scissor-l6-water 530) + (etie-scissor-l6-water 531) (gmerc2-l6-water 532) (tex-l7-water 533) (merc-l7-water 534) (gmerc-l7-water 535) - (bucket536 536) - (bucket537 537) - (bucket538 538) - (bucket539 539) - (bucket540 540) - (bucket541 541) + (tfrag-l7-water 536) + (tie-l7-water 537) + (etie-l7-water 538) + (tie-scissor-l7-water 539) + (tfrag-scissor-l7-water 540) + (etie-scissor-l7-water 541) (gmerc2-l7-water 542) (tex-l8-water 543) (merc-l8-water 544) (gmerc-l8-water 545) - (bucket546 546) - (bucket547 547) - (bucket548 548) - (bucket549 549) - (bucket550 550) - (bucket551 551) + (tfrag-l8-water 546) + (tie-l8-water 547) + (etie-l8-water 548) + (tie-scissor-l8-water 549) + (tfrag-scissor-l8-water 550) + (etie-scissor-l8-water 551) (gmerc2-l8-water 552) (tex-l9-water 553) (merc-l9-water 554) (gmerc-l9-water 555) - (bucket556 556) - (bucket557 557) - (bucket558 558) - (bucket559 559) - (bucket560 560) - (bucket561 561) + (tfrag-l9-water 556) + (tie-l9-water 557) + (etie-l9-water 558) + (tie-scissor-l9-water 559) + (tfrag-scissor-l9-water 560) + (etie-scissor-l9-water 561) (gmerc2-l9-water 562) (tex-lcom-water 563) @@ -4221,12 +4221,12 @@ (rn5) (rn6) (rn7) - (rn8) - (rn9) - (rn10) - (rn11) - (rn12) - (rn13) + (tfrag) + (tie-scissor) + (tie) + (etie) + (etie-scissor) + (tie-vanish) (generic) ;; right (merc) ;; right (emerc) ;; right @@ -4234,16 +4234,16 @@ (shrub-near) (billboard) (shrub-vanish) - (rn21) - (rn22) - (rn23) - (rn24) - (rn25) - (rn26) - (rn27) - (rn28) - (rn29) - (rn30) + (tfrag-trans) + (tie-scissor-trans) + (tie-trans) + (etie-trans) + (etie-scissor-trans) + (tfrag-water) + (tie-scissor-water) + (tie-water) + (etie-water) + (etie-scissor-water) (rn31) (rn32) (rn33) @@ -7630,6 +7630,7 @@ (loaded-texture-page-count int32 :offset-assert 300) (entity entity-links-array :offset-assert 304) ;; guessed by decompiler (closest-object meters 10 :offset-assert 308) + (tie-min-dist float :offset 352) ;; ??? (upload-size int32 20 :offset 388) ;; guessed by decompiler (inside-boxes? basic :offset-assert 468) @@ -7675,7 +7676,7 @@ (alpha-dists pointer :offset-assert 5188) ;; guessed by decompiler (water-masks texture-masks-array :offset-assert 5192) ;; guessed by decompiler (water-dists pointer :offset-assert 5196) ;; guessed by decompiler - (tfrag-last-calls int32 6 :offset-assert 5200) ;; guessed by decompiler + (tfrag-last-calls uint32 6 :offset-assert 5200) ;; guessed by decompiler (texture-anim-array texture-anim-array 11 :offset-assert 5224) ;; guessed by decompiler (light-hash light-hash :offset-assert 5268) ;; guessed by decompiler (draw-priority float :offset-assert 5272) @@ -10788,6 +10789,32 @@ (drawable-group 0) + (tfragment 1) + (tfragment-base 2) + (tfragment-common 3) + (tfragment-level0 4) + (tfragment-level1 5) + (tfragment-color 6) + (tfragment-debug 7) + (tfragment-pal 8) + + (tie-fragment 9) + (tie-gif 10) + (tie-points 11) + (tie-colors 12) + (tie-draw-points 13) + (tie-debug 14) + (tie-scissor 15) + + (tie-generic 17) + (instance-tie 18) + (instance-tie-colors0 19) ;; somehow used by tfrag too.. + (instance-tie-colors1 20) + (instance-tie-colors2 21) + (instance-tie-colors3 22) + (instance-tie-colors* 23) + + (shrubbery 27) (shrubbery-object 28) (shrubbery-vertex 29) @@ -16095,18 +16122,18 @@ :size-assert #x4 :flag-assert #xa00000004 (:methods - (prim-base-method-9 () none) ;; 9 + (generate-dma! "Generate DMA for prim rendering." (_type_ matrix) none) ;; 9 ) ) (defenum prim-flags :type uint32 :bitfield #t - (pf0 0) ;; set by default - (pf1 1) ;; set by default - (pf2 2) - (pf3 3) - (pf4 4) + (alpha-blend-enable 0) ;; set by default + (texture-enable 1) ;; set by default + (fog-enable 2) + (pf3 3) ;; auto-clear vertices? + (pf4 4) ;; has new verts to draw? (no-texture-name 5) ;; only has the ID. ) @@ -16137,7 +16164,7 @@ (:methods (new "Allocate a new prim-strip and room for vertices. The texture can be specified by name or ID." (symbol type int texture-id string) _type_) - (prim-strip-method-10 (_type_ draw-control) none) ;; 10 + (setup-dma-and-tex "Set up the bucket, prim sink, and texture." (_type_ draw-control) none) ;; 10 ) ) @@ -16161,14 +16188,14 @@ (mask vector4w :inline :offset-assert 208) (in-verts int32 :offset-assert 224) (num-verts int32 :offset-assert 228) - (vert-ptr prim-vertex :offset-assert 232) + (vert-ptr (inline-array prim-vertex) :offset-assert 232) (sinks prim-sink 68 :inline :offset-assert 236) ) :method-count-assert 10 :size-assert #x52c :flag-assert #xa0000052c (:methods - (prim-work-method-9 () none) ;; 9 + (reset! "Reset all pending vertex/control data." (_type_) none) ;; 9 ) ) @@ -24037,6 +24064,7 @@ (dma-base uint32 :offset 36) (dma-level-1 uint32 :offset 40) (dma-qwc uint8 4 :offset 44) ;; guessed by decompiler + (dma-qwc-word uint32 :overlay-at dma-qwc) (shader (inline-array adgif-shader) :offset 48) ;; guessed by decompiler (num-shaders uint8 :offset 52) (num-base-colors uint8 :offset 53) @@ -30230,7 +30258,7 @@ ) |# -;; (define-extern draw-node-cull function) ;; (function pointer pointer (inline-array draw-node) int none) +(define-extern draw-node-cull (function pointer pointer (inline-array draw-node) int none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; shrubbery ;; @@ -30295,9 +30323,9 @@ ;; tfrag-near ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern tnear-vu1-block object) ;; vu-function -;; (define-extern tfrag-details function) ;; (function tfragment none) -;; (define-extern clip-restore function) ;; (function none) +(define-extern tnear-vu1-block vu-function) +(define-extern tfrag-details (function tfragment none)) +(define-extern clip-restore (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tfrag ;; @@ -30315,49 +30343,47 @@ ) |# -;; (define-extern *tfrag-display-stats* object) ;; symbol -;; (define-extern tfrag-vu1-block object) ;; vu-function -;; (define-extern tfrag-data-setup function) ;; (function tfrag-data int int none) -;; (define-extern add-tfrag-mtx-0 function) ;; (function dma-buffer symbol none) -;; (define-extern add-tfrag-mtx-1 function) ;; (function dma-buffer symbol none) -;; (define-extern add-tfrag-data function) ;; (function dma-buffer int int none) -;; (define-extern t-stat object) ;; tfrag-stats -;; (define-extern tfrag-print-stats function) ;; (function symbol none) -;; (define-extern tfrag-init-buffer function) ;; (function dma-buffer gs-test int symbol none) -;; (define-extern tfrag-end-buffer function) ;; (function dma-buffer int none) -;; (define-extern draw-inline-array-tfrag function) ;; (function pointer drawable-inline-array int dma-buffer none) -;; (define-extern tfrag-scissor-init-buffer function) ;; (function dma-buffer gs-test int symbol none) -;; (define-extern tfrag-scissor-end-buffer function) ;; (function dma-buffer uint none) -;; (define-extern draw-inline-array-tfrag-scissor function) ;; (function pointer drawable-inline-array int dma-buffer none) -;; (define-extern stats-tfrag-asm function) ;; (function tfragment none) +(define-extern *tfrag-display-stats* symbol) +(define-extern tfrag-vu1-block vu-function) +(define-extern tfrag-data-setup "Set up VU1 constants" (function tfrag-data int int none)) +(define-extern add-tfrag-mtx-0 "Add DMA for transferring matrix0 (same as matrix1)" (function dma-buffer symbol none)) +(define-extern add-tfrag-mtx-1 "Add DMA for transferring matrix1 (same as matrix0)" (function dma-buffer symbol none)) +(define-extern add-tfrag-data "Add DMA for tfrag constants." (function dma-buffer int int none)) +(define-extern t-stat tfrag-stats) +(define-extern tfrag-print-stats "Print out accumulated tfrag stats." (function symbol none)) +(define-extern tfrag-init-buffer "Initialize DMA bucket for Tfrag rendering." (function dma-buffer gs-test int symbol none)) +(define-extern tfrag-end-buffer "Finalize DMA bucket for tfrag rendering." (function dma-buffer int none)) +(define-extern draw-inline-array-tfrag (function pointer drawable-inline-array int dma-buffer none)) +(define-extern tfrag-scissor-init-buffer (function dma-buffer gs-test int symbol none)) +(define-extern tfrag-scissor-end-buffer (function dma-buffer uint none)) +(define-extern draw-inline-array-tfrag-scissor (function pointer drawable-inline-array int dma-buffer none)) +(define-extern stats-tfrag-asm (function tfragment none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tfrag-methods ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tfrag-init-data (structure) - ((tfrag-bucket int32 :offset-assert 0) ;; bucket-id - (tfrag-scissor-bucket int32 :offset-assert 4) ;; bucket-id - (tfrag-trans-bucket int32 :offset-assert 8) ;; bucket-id - (tfrag-scissor-trans-bucket int32 :offset-assert 12) ;; bucket-id - (tfrag-water-bucket int32 :offset-assert 16) ;; bucket-id - (tfrag-water-scissor-bucket int32 :offset-assert 20) ;; bucket-id + ((tfrag-bucket bucket-id :offset-assert 0) + (tfrag-scissor-bucket bucket-id :offset-assert 4) + (tfrag-trans-bucket bucket-id :offset-assert 8) + (tfrag-scissor-trans-bucket bucket-id :offset-assert 12) + (tfrag-water-bucket bucket-id :offset-assert 16) + (tfrag-water-scissor-bucket bucket-id :offset-assert 20) ) :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -;; (define-extern edge-debug-lines function) ;; (function (array vector-array) none) -(define-extern draw-drawable-tree-tfrag (function drawable-tree-tfrag none)) -(define-extern draw-drawable-tree-tfrag-trans (function drawable-tree-tfrag none)) -(define-extern draw-drawable-tree-tfrag-water (function drawable-tree-tfrag none)) -;; (define-extern tfrag-vu1-init-buf function) ;; (function bucket-id gs-test int uint symbol none) -;; (define-extern tfrag-scissor-vu1-init-buf function) ;; (function bucket-id gs-test int uint symbol none) -;; (define-extern *tfrag-init-table* object) ;; (inline-array tfrag-init-data) -;; (define-extern tfrag-vu1-init-buffers function) ;; (function none) +(define-extern edge-debug-lines "Draw tfrag debug lines. These debug-lines are not stored in retail copies." (function (array vector-array) none)) +(define-extern draw-drawable-tree-tfrag "Top-level function to generate DMA for tfrag." (function drawable-tree-tfrag none)) +(define-extern draw-drawable-tree-tfrag-trans "Top-level function to generate DMA for tfrag." (function drawable-tree-tfrag none)) +(define-extern draw-drawable-tree-tfrag-water "Top-level function to generate DMA for tfrag." (function drawable-tree-tfrag none)) +(define-extern tfrag-vu1-init-buf "Do all tfrag buffer setup for a single bucket." (function bucket-id gs-test int uint symbol none)) +(define-extern tfrag-scissor-vu1-init-buf (function bucket-id gs-test int uint symbol none)) +(define-extern *tfrag-init-table* (inline-array tfrag-init-data)) +(define-extern tfrag-vu1-init-buffers "Initialize all tfrag buckets." (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tfrag-work ;; @@ -30369,28 +30395,26 @@ ;; tie ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tie-consts (structure) ((data uint32 40 :offset-assert 0) ;; guessed by decompiler - (vector vector 10 :offset-assert 0) ;; guessed by decompiler - (quads uint128 10 :offset-assert 0) ;; guessed by decompiler - (adgif qword :inline :offset-assert 0) ;; gs-gif-tag :inline - (strgif qword :inline :offset-assert 16) ;; gs-gif-tag :inline - (extra qword :inline :offset-assert 32) ;; vector :inline - (gifbufs qword :inline :offset-assert 48) ;; vector :inline - (clrbufs qword :inline :offset-assert 64) - (misc qword :inline :offset-assert 80) - (atestgif qword :inline :offset-assert 96) ;; gs-gif-tag :inline - (alpha qword :inline :offset-assert 112) ;; gs-adcmd :inline - (atest gs-adcmd 2 :offset-assert 128) ;; guessed by decompiler - (atest-tra gs-adcmd :inline :offset-assert 128) - (atest-def gs-adcmd :inline :offset-assert 144) + (vector vector 10 :inline :offset 0) ;; guessed by decompiler + (quads uint128 10 :offset 0) ;; guessed by decompiler + (adgif gs-gif-tag :inline :offset 0) ;; gs-gif-tag :inline + (strgif gs-gif-tag :inline :offset 16) ;; gs-gif-tag :inline + (extra vector :inline :offset 32) ;; vector :inline + (gifbufs vector :inline :offset 48) ;; vector :inline + (clrbufs qword :inline :offset 64) + (misc qword :inline :offset 80) + (atestgif gs-gif-tag :inline :offset 96) ;; gs-gif-tag :inline + (alpha gs-adcmd :inline :offset 112) ;; gs-adcmd :inline + (atest gs-adcmd 2 :inline :offset 128 :score -1) ;; guessed by decompiler + (atest-tra gs-adcmd :inline :offset 128) + (atest-def gs-adcmd :inline :offset 144) ) :method-count-assert 9 :size-assert #xa0 :flag-assert #x9000000a0 ) -|# #| (deftype drawable-inline-array-instance-tie (drawable-inline-array) @@ -30416,26 +30440,25 @@ ) |# -;; (define-extern tie-vu1-block object) ;; vu-function -;; (define-extern tie-init-consts function) ;; (function tie-consts gs-alpha gs-test gs-test none) -;; (define-extern tie-init-engine function) ;; (function dma-buffer gs-alpha gs-test gs-test none) -;; (define-extern tie-end-buffer function) ;; (function dma-buffer none) -;; (define-extern tie-int-reg function) ;; (function int string) -;; (define-extern tie-float-reg function) ;; (function int string) -;; (define-extern tie-ints function) ;; (function none) -;; (define-extern tie-floats function) ;; (function none) +(define-extern tie-vu1-block vu-function) +(define-extern tie-init-consts "Set up tie-consts for VU1" (function tie-consts gs-alpha gs-test gs-test none)) +(define-extern tie-init-engine "Set up DMA to initialize TIE vu1." (function dma-buffer gs-alpha gs-test gs-test none)) +(define-extern tie-end-buffer "Set up DMA to finish TIE." (function dma-buffer none)) +(define-extern tie-int-reg "Get the name of TIE VU1 program integer register." (function int string)) +(define-extern tie-float-reg "Get the name of TIE VU1 program float register." (function int string)) +(define-extern tie-ints "Dump TIE integer regs for debug." (function none)) +(define-extern tie-floats "Dump TIE float regs for debug." (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; etie-vu1 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype etie-consts (structure) ((gifbufs qword :inline :offset-assert 0) - (adgif qword :inline :offset-assert 16) ;; gs-gif-tag :inline + (adgif gs-gif-tag :inline :offset-assert 16) ;; :inline (alpha qword :inline :offset-assert 32) - (strgif qword :inline :offset-assert 48) ;; gs-gif-tag :inline - (envgif qword :inline :offset-assert 64) ;; gs-gif-tag :inline + (strgif gs-gif-tag :inline :offset-assert 48) ;; gs-gif-tag :inline + (envgif gs-gif-tag :inline :offset-assert 64) ;; gs-gif-tag :inline (envmap adgif-shader :inline :offset-assert 80) (pers0 vector :inline :offset-assert 160) (pers1 vector :inline :offset-assert 176) @@ -30444,28 +30467,25 @@ :size-assert #xc0 :flag-assert #x9000000c0 ) -|# -#| (deftype etie-matrix (structure) ((rmtx matrix :inline :offset-assert 0) (nmtx matrix3 :inline :offset-assert 64) - (morph float :offset-assert 76) - (fog float :offset-assert 92) - (fade uint32 :offset-assert 108) + (morph float :offset 76) + (fog float :offset 92) + (fade uint32 :offset 108) (tint qword :inline :offset-assert 112) ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ) -|# -;; (define-extern etie-vu1-block object) ;; vu-function -;; (define-extern etie-magic function) ;; (function int int) -;; (define-extern etie-init-consts function) ;; (function etie-consts gs-alpha none) -;; (define-extern etie-init-engine function) ;; (function dma-buffer gs-alpha gs-test none) -;; (define-extern etie-end-buffer function) ;; (function dma-buffer none) +(define-extern etie-vu1-block vu-function) +(define-extern etie-magic (function int int)) +(define-extern etie-init-consts (function etie-consts gs-alpha none)) +(define-extern etie-init-engine (function dma-buffer gs-alpha gs-test none)) +(define-extern etie-end-buffer (function dma-buffer none)) ;; (define-extern etie-float-reg-bp function) ;; (define-extern etie-float-reg function) ;; (define-extern etie-floats function) @@ -30595,7 +30615,6 @@ ;; tie-methods ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tie-debug (structure) ((max-instance uint32 :offset-assert 0) (min-instance uint32 :offset-assert 4) @@ -30606,54 +30625,51 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype tie-init-data (structure) - ((tie-bucket int32 :offset-assert 0) ;; bucket-id - (tie-scissor-bucket int32 :offset-assert 4) ;; bucket-id - (tie-envmap-bucket int32 :offset-assert 8) ;; bucket-id - (tie-envmap-scissor-bucket int32 :offset-assert 12) ;; bucket-id - (tie-vanish-bucket int32 :offset-assert 16) ;; bucket-id - (tie-trans-bucket int32 :offset-assert 20) ;; bucket-id - (tie-scissor-trans-bucket int32 :offset-assert 24) ;; bucket-id - (tie-envmap-trans-bucket int32 :offset-assert 28) ;; bucket-id - (tie-envmap-scissor-trans-bucket int32 :offset-assert 32) ;; bucket-id - (tie-water-bucket int32 :offset-assert 36) ;; bucket-id - (tie-scissor-water-bucket int32 :offset-assert 40) ;; bucket-id - (tie-envmap-water-bucket int32 :offset-assert 44) ;; bucket-id - (tie-envmap-scissor-water-bucket int32 :offset-assert 48) ;; bucket-id + ((tie-bucket bucket-id :offset-assert 0) + (tie-scissor-bucket bucket-id :offset-assert 4) + (tie-envmap-bucket bucket-id :offset-assert 8) + (tie-envmap-scissor-bucket bucket-id :offset-assert 12) + (tie-vanish-bucket bucket-id :offset-assert 16) + (tie-trans-bucket bucket-id :offset-assert 20) + (tie-scissor-trans-bucket bucket-id :offset-assert 24) + (tie-envmap-trans-bucket bucket-id :offset-assert 28) + (tie-envmap-scissor-trans-bucket bucket-id :offset-assert 32) + (tie-water-bucket bucket-id :offset-assert 36) + (tie-scissor-water-bucket bucket-id :offset-assert 40) + (tie-envmap-water-bucket bucket-id :offset-assert 44) + (tie-envmap-scissor-water-bucket bucket-id :offset-assert 48) ) :method-count-assert 9 :size-assert #x34 :flag-assert #x900000034 ) -|# -;; (define-extern *tie* object) ;; tie-debug -;; (define-extern tie-debug-between function) ;; (function uint uint uint) -;; (define-extern tie-debug-one function) ;; (function uint uint uint) -;; (define-extern tie-debug-frag-between function) ;; (function uint uint uint) -;; (define-extern tie-debug-frag-one function) ;; (function uint uint uint) -;; (define-extern walk-tie-generic-prototypes function) ;; (function none) -;; (define-extern *pke-hack* object) ;; vector -;; (define-extern draw-inline-array-instance-tie function) ;; (function pointer (inline-array instance-tie) int dma-buffer none) -;; (define-extern draw-inline-array-prototype-tie-asm function) ;; (function dma-buffer int prototype-array-tie none) -;; (define-extern instance-tie-patch-buckets function) ;; (function dma-buffer level object) +(define-extern *tie* tie-debug) +(define-extern tie-debug-between (function uint uint uint)) +(define-extern tie-debug-one (function uint uint uint)) +(define-extern tie-debug-frag-between (function uint uint uint)) +(define-extern tie-debug-frag-one (function uint uint uint)) +(define-extern walk-tie-generic-prototypes (function none)) +(define-extern *pke-hack* vector) +(define-extern draw-inline-array-instance-tie (function pointer (inline-array instance-tie) int dma-buffer none)) +(define-extern draw-inline-array-prototype-tie-asm (function dma-buffer int prototype-array-tie none)) +(define-extern instance-tie-patch-buckets (function dma-buffer level object)) (define-extern draw-drawable-tree-instance-tie (function drawable-tree-instance-tie level none)) -;; (define-extern tie-init-scissor-buf function) ;; (function bucket-id gs-alpha gs-test gs-test none) -;; (define-extern tie-init-buf function) ;; (function bucket-id gs-alpha gs-test gs-test none) -;; (define-extern tie-init-envmap-buf function) ;; (function bucket-id gs-alpha gs-test none) -;; (define-extern tie-init-envmap-scissor-buf function) ;; (function bucket-id gs-alpha int int none) -;; (define-extern *tie-init-table* object) ;; (inline-array tie-init-data) -;; (define-extern tie-vu1-init-buffers function) ;; (function none) +(define-extern tie-init-scissor-buf (function bucket-id gs-alpha gs-test gs-test none)) +(define-extern tie-init-buf (function bucket-id gs-alpha gs-test gs-test none)) +(define-extern tie-init-envmap-buf (function bucket-id gs-alpha gs-test none)) +(define-extern tie-init-envmap-scissor-buf (function bucket-id gs-alpha int int none)) +(define-extern *tie-init-table* (inline-array tie-init-data)) +(define-extern tie-vu1-init-buffers (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; prim ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *prim-work* object) -;; (define-extern prim-engine-execute function) +(define-extern *prim-work* prim-work) +(define-extern prim-engine-execute "Generate all prim DMA." (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sync-info ;; @@ -37095,7 +37111,7 @@ ;; (define-extern guard-band-cull function) ;; (function vector symbol) (define-extern sphere-in-view-frustum? (function sphere symbol)) (define-extern line-in-view-frustum? (function vector vector symbol)) -;; (define-extern vis-cull function) ;; (function int symbol) +(define-extern vis-cull (function int symbol)) ;; (define-extern vis-cull-debug function) ;; (function work-area int symbol) ;; (define-extern error-sphere function) ;; (function drawable-error string none) ;; (define-extern *edit-instance* object) ;; string diff --git a/decompiler/config/jak3/ntsc_v1/hacks.jsonc b/decompiler/config/jak3/ntsc_v1/hacks.jsonc index 9867676da..b4659eeac 100644 --- a/decompiler/config/jak3/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak3/ntsc_v1/hacks.jsonc @@ -315,7 +315,8 @@ "(method 16 level)": [0, 1, 5, 13, 14, 15], "upload-vis-bits": [2, 6, 3, 0], "set-background-regs!": [4, 3], - "draw-drawable-tree-instance-shrub": [5, 7, 9, 11] + "draw-drawable-tree-instance-shrub": [5, 7, 9, 11], + "draw-drawable-tree-instance-tie": [21, 23, 31, 33] }, // Sometimes the game might use format strings that are fetched dynamically, @@ -453,7 +454,8 @@ "generic-no-light-proc", "(method 21 cloth-system)", "debug-line-clip?", - "(method 9 font-work)" + "(method 9 font-work)", + "(method 9 prim-strip)" ], "mips2c_jump_table_functions": {}, diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index c04cb696f..a698786f6 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -329,6 +329,30 @@ ["L151", "(pointer bucket-id)", 12], ["L150", "(pointer bucket-id)", 12], ["L153", "(pointer bucket-id)", 12] - + ], + "tfrag-methods": [ + ["L89", "(inline-array tfrag-init-data)", 10], + ["L90", "(pointer bucket-id)", 12], + ["L91", "(pointer bucket-id)", 12], + ["L92", "(pointer bucket-id)", 12], + ["L93", "(pointer bucket-id)", 12], + ["L95", "(pointer bucket-id)", 10], + ["L96", "(pointer bucket-id)", 10] + ], + "tie-methods": [ + ["L268", "(inline-array tie-init-data)", 10], + ["L284", "(pointer bucket-id)", 10], + ["L282", "(pointer bucket-id)", 10], + ["L280", "(pointer bucket-id)", 10], + ["L279", "(pointer bucket-id)", 10], + ["L278", "(pointer bucket-id)", 10], + ["L277", "(pointer bucket-id)", 10], + ["L276", "(pointer bucket-id)", 10], + ["L275", "(pointer bucket-id)", 10], + ["L274", "(pointer bucket-id)", 10], + ["L273", "(pointer bucket-id)", 10], + ["L272", "(pointer bucket-id)", 10], + ["L271", "(pointer bucket-id)", 10], + ["L270", "(pointer bucket-id)", 10] ] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 31a0c9ca2..c351a29c5 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -2603,7 +2603,120 @@ [115, "s3", "shrubbery"], [161, "gp", "(inline-array prototype-bucket-shrub)"] ], - "draw-drawable-tree-instance-shrub": [[86, "a0", "drawable-group"]] + "draw-drawable-tree-instance-shrub": [[86, "a0", "drawable-group"]], + "(method 9 tfragment)": [ + [27, "a3", "(pointer int32)"], + [32, "t0", "texture"] + ], + "add-tfrag-mtx-0": [[[3, 17], "a0", "dma-packet"]], + "add-tfrag-mtx-1": [[[3, 17], "a0", "dma-packet"]], + "add-tfrag-data": [ + [[3, 17], "a0", "dma-packet"], + [[24, 31], "v1", "dma-packet"] + ], + "tfrag-init-buffer": [[[73, 81], "v1", "dma-packet"]], + "tfrag-end-buffer": [ + [[21, 28], "a2", "dma-packet"], + [[31, 38], "a0", "(pointer vif-tag)"], + [[38, 42], "a0", "(pointer int32)"], + [[43, 49], "a0", "(pointer vif-tag)"] + ], + "tfrag-vu1-init-buf": [ + [[47, 55], "v1", "dma-packet"], + [[81, 86], "v1", "dma-packet"], + [89, "v1", "(pointer int32)"] + ], + "draw-drawable-tree-tfrag-water": [ + [18, "v1", "drawable-inline-array-node"], + [20, "a0", "drawable-inline-array-node"] + ], + "draw-drawable-tree-tfrag-trans": [ + [18, "v1", "drawable-inline-array-node"], + [20, "a0", "drawable-inline-array-node"] + ], + "draw-drawable-tree-tfrag": [ + [17, "v1", "drawable-inline-array-node"], + [19, "a0", "drawable-inline-array-node"] + ], + "(method 9 tie-fragment)": [ + [21, "a2", "(pointer int32)"], + [26, "a3", "(pointer int32)"], + [[1, 70], "s5", "adgif-shader"] + ], + "tie-init-engine": [ + [[37, 51], "a0", "dma-packet"], + [[63, 71], "a0", "dma-packet"], + [[73, 80], "a0", "dma-packet"], + [[81, 90], "v1", "vector"], + [[91, 98], "v1", "(pointer vif-tag)"] + ], + "tie-end-buffer": [ + [[47, 54], "a1", "dma-packet"], + [[58, 69], "a0", "(pointer vif-tag)"] + ], + "tie-ints": [ + [17, "v1", "(pointer uint32)"], + [21, "v1", "(pointer uint32)"] + ], + "tie-floats": [[[3, 73], "gp", "(pointer uint32)"]], + "instance-tie-patch-buckets": [ + [39, "a0", "(pointer uint64)"], + [137, "a0", "(pointer uint64)"], + [235, "a0", "(pointer uint64)"], + [333, "a0", "(pointer uint64)"], + [431, "a0", "(pointer uint64)"], + [530, "a0", "(pointer uint64)"], + [629, "a0", "(pointer uint64)"], + [728, "a0", "(pointer uint64)"], + [827, "a0", "(pointer uint64)"], + [926, "a0", "(pointer uint64)"], + [1025, "a0", "(pointer uint64)"], + [1124, "a0", "(pointer uint64)"], + [1223, "a0", "(pointer uint64)"] + ], +"draw-drawable-tree-instance-tie": [ + [[23, 37], "v1", "drawable-inline-array-node"], + [25, "a0", "drawable-inline-array-node"], + [120, "s2", "drawable-inline-array-instance-tie"], + [132, "v1", "int"], + [132, "a0", "int"] + ], + "tie-init-buf": [ + [[44, 51], "a0", "dma-packet"], + [[53, 60], "a0", "gs-gif-tag"], + [64, "a0", "(pointer gs-zbuf)"], + [66, "a0", "(pointer gs-reg64)"], + [[71, 79], "v1", "dma-packet"], + [[104, 110], "v1", "dma-packet"], + [112, "v1", "(pointer uint32)"] + ], +"(method 13 drawable-tree-instance-tie)": [ + [[51, 70], "t1", "tie-fragment"], + [[102, 120], "a3", "tie-fragment"], + [[160, 178], "t1", "tie-fragment"], + [[211, 229], "a3", "tie-fragment"], + [[266, 286], "t1", "tie-fragment"], + [[320, 340], "a1", "tie-fragment"], + [[381, 400], "t1", "tie-fragment"], + [[432, 450], "a3", "tie-fragment"], + [[487, 507], "t1", "tie-fragment"], + [[541, 561], "a1", "tie-fragment"], + [[598, 616], "t1", "tie-fragment"], + [[649, 667], "a3", "tie-fragment"], + [[703, 723], "t1", "tie-fragment"], + [[756, 776], "a1", "tie-fragment"] + ], +"(method 9 prim-strip)": [ + [224, "t2", "int"], + [224, "t0", "int"], + [226, "t1", "int"], + [226, "a3", "int"], + [[190, 231], "a1", "(inline-array prim-vertex)"] + ], + "prim-engine-execute": [ + [[15, 21], "v1", "connection"], + [[21, 25], "a0", "prim-strip"] + ] } diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 97fb2ebf2..d655a94e1 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -189,6 +189,7 @@ set(RUNTIME_SOURCE mips2c/jak3_functions/font.cpp mips2c/jak3_functions/generic_effect.cpp mips2c/jak3_functions/lights.cpp + mips2c/jak3_functions/prim.cpp mips2c/jak3_functions/sky.cpp mips2c/mips2c_table.cpp overlord/common/dma.cpp diff --git a/game/mips2c/jak3_functions/font.cpp b/game/mips2c/jak3_functions/font.cpp index e4c17c001..2c12af7fd 100644 --- a/game/mips2c/jak3_functions/font.cpp +++ b/game/mips2c/jak3_functions/font.cpp @@ -13,7 +13,7 @@ struct Cache { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; + // u32 call_addr = 0; c->daddiu(sp, sp, -16); // daddiu sp, sp, -16 c->sd(fp, 8, sp); // sd fp, 8(sp) c->mov64(fp, t9); // or fp, t9, r0 @@ -171,7 +171,7 @@ struct Cache { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; + // u32 call_addr = 0; c->load_symbol2(v1, cache.math_camera); // lw v1, *math-camera*(s7) c->lqc2(vf26, 812, v1); // lqc2 vf26, 812(v1) c->lqc2(vf27, 812, v1); // lqc2 vf27, 812(v1) @@ -2350,7 +2350,7 @@ struct Cache { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; + // u32 call_addr = 0; c->lqc2(vf23, 12, a1); // lqc2 vf23, 12(a1) c->lqc2(vf24, 12, a1); // lqc2 vf24, 12(a1) c->lw(v1, 64, a1); // lw v1, 64(a1) diff --git a/game/mips2c/jak3_functions/prim.cpp b/game/mips2c/jak3_functions/prim.cpp new file mode 100644 index 000000000..75de3d877 --- /dev/null +++ b/game/mips2c/jak3_functions/prim.cpp @@ -0,0 +1,479 @@ +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace method_9_prim_strip { +struct Cache { + void* display; // *display* + void* prim_work; // *prim-work* + void* stdcon; // *stdcon* + void* adgif_shader_texture_simple; // adgif-shader<-texture-simple! + void* dma_bucket_insert_tag; // dma-bucket-insert-tag + void* format; // format + void* lookup_texture_by_id; // lookup-texture-by-id + void* paused; // paused? +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->daddiu(sp, sp, -112); // daddiu sp, sp, -112 + c->sd(ra, 0, sp); // sd ra, 0(sp) + c->sd(fp, 8, sp); // sd fp, 8(sp) + c->mov64(fp, t9); // or fp, t9, r0 + c->sq(s1, 16, sp); // sq s1, 16(sp) + c->sq(s2, 32, sp); // sq s2, 32(sp) + c->sq(s3, 48, sp); // sq s3, 48(sp) + c->sq(s4, 64, sp); // sq s4, 64(sp) + c->sq(s5, 80, sp); // sq s5, 80(sp) + c->sq(gp, 96, sp); // sq gp, 96(sp) + c->mov64(gp, a0); // or gp, a0, r0 + c->mov64(s1, a1); // or s1, a1, r0 + c->load_symbol2(v1, cache.display); // lw v1, *display*(s7) + c->lw(v1, 0, v1); // lw v1, 0(v1) + c->dsll(v1, v1, 2); // dsll v1, v1, 2 + c->load_symbol2(a0, cache.display); // lw a0, *display*(s7) + c->daddu(v1, v1, a0); // daddu v1, v1, a0 + c->lwu(v1, 8, v1); // lwu v1, 8(v1) + c->lwu(v1, 36, v1); // lwu v1, 36(v1) + c->lhu(a0, 8, gp); // lhu a0, 8(gp) + c->daddiu(a0, a0, 79); // daddiu a0, a0, 79 + c->addiu(a1, r0, 80); // addiu a1, r0, 80 + // Unknown instr: divu a0, a1 + // Unknown instr: mflo a0 + c->gprs[a0].du64[0] = c->gprs[a0].du32[0] / c->gprs[a1].du32[0]; + c->addiu(a1, r0, 144); // addiu a1, r0, 144 + c->lhu(a2, 8, gp); // lhu a2, 8(gp) + c->multu3(a1, a1, a2); // multu3 a1, a1, a2 + c->dsll(a0, a0, 7); // dsll a0, a0, 7 + c->daddu(a0, a1, a0); // daddu a0, a1, a0 + c->lwu(a1, 8, v1); // lwu a1, 8(v1) + c->lwu(v1, 4, v1); // lwu v1, 4(v1) + c->dsubu(v1, a1, v1); // dsubu v1, a1, v1 + c->sltu(v1, a0, v1); // sltu v1, a0, v1 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L23 + // nop // sll r0, r0, 0 + if (bc) {goto block_28;} // branch non-likely + + c->load_symbol2(t9, cache.lookup_texture_by_id); // lw t9, lookup-texture-by-id(s7) + c->lwu(a0, 12, gp); // lwu a0, 12(gp) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->mov64(a1, v0); // or a1, v0, r0 + c->load_symbol2(s3, cache.prim_work); // lw s3, *prim-work*(s7) + c->lwu(v1, 80, gp); // lwu v1, 80(gp) + c->dsll(v1, v1, 4); // dsll v1, v1, 4 + c->daddiu(v1, v1, 236); // daddiu v1, v1, 236 + c->daddu(s2, v1, s3); // daddu s2, v1, s3 + c->load_symbol2(v1, cache.display); // lw v1, *display*(s7) + c->lw(v1, 0, v1); // lw v1, 0(v1) + c->dsll(v1, v1, 2); // dsll v1, v1, 2 + c->load_symbol2(a0, cache.display); // lw a0, *display*(s7) + c->daddu(v1, v1, a0); // daddu v1, v1, a0 + c->lwu(v1, 8, v1); // lwu v1, 8(v1) + c->lwu(s4, 36, v1); // lwu s4, 36(v1) + c->lwu(s5, 4, s4); // lwu s5, 4(s4) + c->lhu(v1, 8, gp); // lhu v1, 8(gp) + c->sw(v1, 224, s3); // sw v1, 224(s3) + c->daddiu(v1, gp, 92); // daddiu v1, gp, 92 + c->sw(v1, 232, s3); // sw v1, 232(s3) + c->lwu(v1, 0, gp); // lwu v1, 0(gp) + c->andi(v1, v1, 1); // andi v1, v1, 1 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L8 + // nop // sll r0, r0, 0 + if (bc) {goto block_3;} // branch non-likely + + c->addiu(v1, r0, 1); // addiu v1, r0, 1 + //beq r0, r0, L9 // beq r0, r0, L9 + // nop // sll r0, r0, 0 + goto block_4; // branch always + + +block_3: + c->addiu(v1, r0, 0); // addiu v1, r0, 0 + +block_4: + c->lwu(a0, 0, gp); // lwu a0, 0(gp) + c->andi(a0, a0, 2); // andi a0, a0, 2 + bc = c->sgpr64(a0) == 0; // beq a0, r0, L10 + // nop // sll r0, r0, 0 + if (bc) {goto block_6;} // branch non-likely + + c->addiu(a0, r0, 1); // addiu a0, r0, 1 + //beq r0, r0, L11 // beq r0, r0, L11 + // nop // sll r0, r0, 0 + goto block_7; // branch always + + +block_6: + c->addiu(a0, r0, 0); // addiu a0, r0, 0 + +block_7: + c->lwu(a2, 0, gp); // lwu a2, 0(gp) + c->andi(a2, a2, 4); // andi a2, a2, 4 + bc = c->sgpr64(a2) == 0; // beq a2, r0, L12 + // nop // sll r0, r0, 0 + if (bc) {goto block_9;} // branch non-likely + + c->addiu(a2, r0, 1); // addiu a2, r0, 1 + //beq r0, r0, L13 // beq r0, r0, L13 + // nop // sll r0, r0, 0 + goto block_10; // branch always + + +block_9: + c->addiu(a2, r0, 0); // addiu a2, r0, 0 + +block_10: + c->lui(a3, 12288); // lui a3, 12288 + c->ori(a3, a3, 16384); // ori a3, a3, 16384 + c->dsll32(t0, a2, 31); // dsll32 t0, a2, 31 + c->dsrl32(t0, t0, 26); // dsrl32 t0, t0, 26 + c->ori(t0, t0, 13); // ori t0, t0, 13 + c->dsll32(t1, a0, 31); // dsll32 t1, a0, 31 + c->dsrl32(t1, t1, 27); // dsrl32 t1, t1, 27 + c->or_(t0, t0, t1); // or t0, t0, t1 + c->dsll32(t1, v1, 31); // dsll32 t1, v1, 31 + c->dsrl32(t1, t1, 25); // dsrl32 t1, t1, 25 + c->or_(t0, t0, t1); // or t0, t0, t1 + c->dsll32(t0, t0, 21); // dsll32 t0, t0, 21 + c->dsrl32(t0, t0, 6); // dsrl32 t0, t0, 6 + c->or_(a3, a3, t0); // or a3, a3, t0 + c->sw(a3, 80, s3); // sw a3, 80(s3) + c->lui(a3, 12288); // lui a3, 12288 + c->ori(a3, a3, 16384); // ori a3, a3, 16384 + c->dsll32(a2, a2, 31); // dsll32 a2, a2, 31 + c->dsrl32(a2, a2, 26); // dsrl32 a2, a2, 26 + c->ori(a2, a2, 12); // ori a2, a2, 12 + c->dsll32(a0, a0, 31); // dsll32 a0, a0, 31 + c->dsrl32(a0, a0, 27); // dsrl32 a0, a0, 27 + c->or_(a0, a2, a0); // or a0, a2, a0 + c->dsll32(v1, v1, 31); // dsll32 v1, v1, 31 + c->dsrl32(v1, v1, 25); // dsrl32 v1, v1, 25 + c->or_(v1, a0, v1); // or v1, a0, v1 + c->dsll32(v1, v1, 21); // dsll32 v1, v1, 21 + c->dsrl32(v1, v1, 6); // dsrl32 v1, v1, 6 + c->or_(v1, a3, v1); // or v1, a3, v1 + c->sw(v1, 84, s3); // sw v1, 84(s3) + bc = c->sgpr64(s7) == c->sgpr64(a1); // beq s7, a1, L19 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_20;} // branch non-likely + + c->lwu(v1, 84, gp); // lwu v1, 84(gp) + c->lwu(a0, 88, gp); // lwu a0, 88(gp) + c->lwu(a0, 88, gp); // lwu a0, 88(gp) + c->daddiu(a0, a0, 12); // daddiu a0, a0, 12 + c->addiu(a2, r0, 0); // addiu a2, r0, 0 + //beq r0, r0, L15 // beq r0, r0, L15 + // nop // sll r0, r0, 0 + goto block_13; // branch always + + +block_12: + c->dsll(a3, a0, 4); // dsll a3, a0, 4 + c->daddu(a3, v1, a3); // daddu a3, v1, a3 + c->lq(a3, 4828, a3); // lq a3, 4828(a3) + c->dsll(t0, a2, 4); // dsll t0, a2, 4 + c->daddu(t0, a1, t0); // daddu t0, a1, t0 + c->lq(t0, 60, t0); // lq t0, 60(t0) + c->por(a3, a3, t0); // por a3, a3, t0 + c->dsll(t0, a0, 4); // dsll t0, a0, 4 + c->daddu(t0, v1, t0); // daddu t0, v1, t0 + c->sq(a3, 4828, t0); // sq a3, 4828(t0) + c->daddiu(a2, a2, 1); // daddiu a2, a2, 1 + +block_13: + c->slti(a3, a2, 3); // slti a3, a2, 3 + bc = c->sgpr64(a3) != 0; // bne a3, r0, L14 + // nop // sll r0, r0, 0 + if (bc) {goto block_12;} // branch non-likely + + c->mov64(v1, s7); // or v1, s7, r0 + c->mov64(v1, s7); // or v1, s7, r0 + c->load_symbol2(t9, cache.adgif_shader_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7) + c->daddiu(a0, s3, 128); // daddiu a0, s3, 128 + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->ld(v1, 60, gp); // ld v1, 60(gp) + c->sd(v1, 176, s3); // sd v1, 176(s3) + c->addiu(v1, r0, 8); // addiu v1, r0, 8 + c->sd(v1, 184, s3); // sd v1, 184(s3) + c->ld(v1, 68, gp); // ld v1, 68(gp) + c->sd(v1, 192, s3); // sd v1, 192(s3) + c->addiu(v1, r0, 66); // addiu v1, r0, 66 + c->sb(v1, 200, s3); // sb v1, 200(s3) + c->lqc2(vf1, 0, s1); // lqc2 vf1, 0(s1) + c->lqc2(vf2, 16, s1); // lqc2 vf2, 16(s1) + c->lqc2(vf3, 32, s1); // lqc2 vf3, 32(s1) + c->lqc2(vf4, 48, s1); // lqc2 vf4, 48(s1) + c->lqc2(vf5, 128, s3); // lqc2 vf5, 128(s3) + c->lqc2(vf6, 144, s3); // lqc2 vf6, 144(s3) + c->lqc2(vf7, 160, s3); // lqc2 vf7, 160(s3) + c->lqc2(vf8, 176, s3); // lqc2 vf8, 176(s3) + c->lqc2(vf9, 192, s3); // lqc2 vf9, 192(s3) + c->lqc2(vf10, 80, s3); // lqc2 vf10, 80(s3) + c->lqc2(vf11, 28, gp); // lqc2 vf11, 28(gp) + c->lqc2(vf12, 44, gp); // lqc2 vf12, 44(gp) + //beq r0, r0, L18 // beq r0, r0, L18 + // nop // sll r0, r0, 0 + goto block_18; // branch always + + +block_15: + c->addiu(v1, r0, 80); // addiu v1, r0, 80 + c->lw(a0, 224, s3); // lw a0, 224(s3) + c->slt(a1, v1, a0); // slt a1, v1, a0 + c->movz(v1, a0, a1); // movz v1, a0, a1 + c->sw(v1, 228, s3); // sw v1, 228(s3) + c->lbu(v1, 1, s2); // lbu v1, 1(s2) + c->andi(v1, v1, 1); // andi v1, v1, 1 + c->dsll(v1, v1, 4); // dsll v1, v1, 4 + c->daddiu(v1, v1, 48); // daddiu v1, v1, 48 + c->daddu(a0, v1, s3); // daddu a0, v1, s3 + c->lw(v1, 4, s4); // lw v1, 4(s4) + c->lq(a0, 0, a0); // lq a0, 0(a0) + c->daddiu(a1, v1, 16); // daddiu a1, v1, 16 + c->lw(v1, 228, s3); // lw v1, 228(s3) + c->sq(a0, -16, a1); // sq a0, -16(a1) + c->sqc2(vf1, 0, a1); // sqc2 vf1, 0(a1) + c->sqc2(vf2, 16, a1); // sqc2 vf2, 16(a1) + c->sqc2(vf3, 32, a1); // sqc2 vf3, 32(a1) + c->sqc2(vf4, 48, a1); // sqc2 vf4, 48(a1) + c->sqc2(vf10, 64, a1); // sqc2 vf10, 64(a1) + c->sqc2(vf11, 80, a1); // sqc2 vf11, 80(a1) + c->sqc2(vf12, 96, a1); // sqc2 vf12, 96(a1) + c->sw(v1, 92, a1); // sw v1, 92(a1) + c->sqc2(vf5, 112, a1); // sqc2 vf5, 112(a1) + c->sqc2(vf6, 128, a1); // sqc2 vf6, 128(a1) + c->sqc2(vf7, 144, a1); // sqc2 vf7, 144(a1) + c->sqc2(vf8, 160, a1); // sqc2 vf8, 160(a1) + c->sqc2(vf9, 176, a1); // sqc2 vf9, 176(a1) + c->ori(a0, v1, 32768); // ori a0, v1, 32768 + c->sw(a0, 140, a1); // sw a0, 140(a1) + c->daddiu(a0, a1, 192); // daddiu a0, a1, 192 + c->sw(a0, 4, s4); // sw a0, 4(s4) + c->lbu(a0, 0, s2); // lbu a0, 0(s2) + c->addiu(a1, r0, 3); // addiu a1, r0, 3 + // Unknown instr: divu a0, a1 + // Unknown instr: mfhi a0 + c->gprs[a0].du64[0] = c->gprs[a0].du32[0] % c->gprs[a1].du32[0]; + c->dsll(a0, a0, 4); // dsll a0, a0, 4 + c->daddu(a0, r0, a0); // daddu a0, r0, a0 + c->daddu(a0, a0, s3); // daddu a0, a0, s3 + c->addiu(a1, r0, 3); // addiu a1, r0, 3 + c->mult3(a1, a1, v1); // mult3 a1, a1, v1 + c->ld(a2, 0, a0); // ld a2, 0(a0) + c->lui(a3, -1); // lui a3, -1 + c->and_(a2, a2, a3); // and a2, a2, a3 + c->dsll32(a3, a1, 16); // dsll32 a3, a1, 16 + c->dsrl32(a3, a3, 16); // dsrl32 a3, a3, 16 + c->or_(a2, a2, a3); // or a2, a2, a3 + c->sd(a2, 0, a0); // sd a2, 0(a0) + c->lwu(a2, 12, a0); // lwu a2, 12(a0) + c->lui(a3, -256); // lui a3, -256 + c->ori(a3, a3, 65535); // ori a3, a3, 65535 + c->and_(a2, a2, a3); // and a2, a2, a3 + c->dsll32(a1, a1, 24); // dsll32 a1, a1, 24 + c->dsrl32(a1, a1, 8); // dsrl32 a1, a1, 8 + c->or_(a1, a2, a1); // or a1, a2, a1 + c->sw(a1, 12, a0); // sw a1, 12(a0) + c->lw(a2, 4, s4); // lw a2, 4(s4) + c->lq(a3, 0, a0); // lq a3, 0(a0) + c->lq(a0, 208, s3); // lq a0, 208(s3) + c->lw(a1, 232, s3); // lw a1, 232(s3) + // nop // sll r0, r0, 0 + c->sq(a3, 0, a2); // sq a3, 0(a2) + c->daddiu(a2, a2, 16); // daddiu a2, a2, 16 + c->sw(a2, 4, s4); // sw a2, 4(s4) + // nop // sll r0, r0, 0 + +block_16: + // nop // sll r0, r0, 0 + c->lw(t0, 12, a1); // lw t0, 12(a1) + // nop // sll r0, r0, 0 + c->lw(a3, 44, a1); // lw a3, 44(a1) + c->pextlb(t0, r0, t0); // pextlb t0, r0, t0 + c->lqc2(vf15, 0, a1); // lqc2 vf15, 0(a1) + c->pextlh(t0, r0, t0); // pextlh t0, r0, t0 + c->lqc2(vf16, 32, a1); // lqc2 vf16, 32(a1) + c->pextlb(a3, r0, a3); // pextlb a3, r0, a3 + c->lqc2(vf13, 16, a1); // lqc2 vf13, 16(a1) + c->pextlh(a3, r0, a3); // pextlh a3, r0, a3 + c->lqc2(vf14, 48, a1); // lqc2 vf14, 48(a1) + c->vftoi12(DEST::xyzw, vf15, vf15); // vftoi12.xyzw vf15, vf15 + c->sq(t0, 16, a2); // sq t0, 16(a2) + c->vftoi12(DEST::xyzw, vf16, vf16); // vftoi12.xyzw vf16, vf16 + c->sq(a3, 64, a2); // sq a3, 64(a2) + // nop // sll r0, r0, 0 + c->lw(t0, 8, a1); // lw t0, 8(a1) + // nop // sll r0, r0, 0 + c->lw(a3, 40, a1); // lw a3, 40(a1) + c->daddiu(a1, a1, 64); // daddiu a1, a1, 64 + c->mov128_gpr_vf(t2, vf15); // qmfc2.i t2, vf15 + c->daddiu(v1, v1, -2); // daddiu v1, v1, -2 + c->mov128_gpr_vf(t1, vf16); // qmfc2.i t1, vf16 + c->pand(t2, t2, a0); // pand t2, t2, a0 + c->sqc2(vf13, 32, a2); // sqc2 vf13, 32(a2) + c->pand(t1, t1, a0); // pand t1, t1, a0 + c->sqc2(vf14, 80, a2); // sqc2 vf14, 80(a2) + c->or_(t0, t2, t0); // or t0, t2, t0 + // nop // sll r0, r0, 0 + c->or_(a3, t1, a3); // or a3, t1, a3 + // nop // sll r0, r0, 0 + c->sq(t0, 0, a2); // sq t0, 0(a2) + c->daddiu(a2, a2, 96); // daddiu a2, a2, 96 + bc = ((s64)c->sgpr64(v1)) > 0; // bgtz v1, L17 + c->sq(a3, -48, a2); // sq a3, -48(a2) + if (bc) {goto block_16;} // branch non-likely + + c->lwu(v1, 4, s4); // lwu v1, 4(s4) + c->addiu(a0, r0, 48); // addiu a0, r0, 48 + c->lw(a1, 228, s3); // lw a1, 228(s3) + c->mult3(a0, a0, a1); // mult3 a0, a0, a1 + c->daddu(v1, v1, a0); // daddu v1, v1, a0 + c->sw(v1, 4, s4); // sw v1, 4(s4) + c->lwu(v1, 4, s4); // lwu v1, 4(s4) + c->lq(a0, 96, s3); // lq a0, 96(s3) + c->sq(a0, 0, v1); // sq a0, 0(v1) + c->lwu(v1, 4, s4); // lwu v1, 4(s4) + c->daddiu(v1, v1, 16); // daddiu v1, v1, 16 + c->sw(v1, 4, s4); // sw v1, 4(s4) + c->lw(v1, 224, s3); // lw v1, 224(s3) + c->daddiu(v1, v1, -78); // daddiu v1, v1, -78 + c->sw(v1, 224, s3); // sw v1, 224(s3) + c->lwu(v1, 232, s3); // lwu v1, 232(s3) + c->daddiu(v1, v1, 2496); // daddiu v1, v1, 2496 + c->sw(v1, 232, s3); // sw v1, 232(s3) + c->lbu(v1, 0, s2); // lbu v1, 0(s2) + c->daddiu(v1, v1, 1); // daddiu v1, v1, 1 + c->sb(v1, 0, s2); // sb v1, 0(s2) + c->lbu(v1, 1, s2); // lbu v1, 1(s2) + c->daddiu(v1, v1, 1); // daddiu v1, v1, 1 + c->sb(v1, 1, s2); // sb v1, 1(s2) + +block_18: + c->addiu(v1, r0, 2); // addiu v1, r0, 2 + c->lw(a0, 224, s3); // lw a0, 224(s3) + c->slt(v1, v1, a0); // slt v1, v1, a0 + bc = c->sgpr64(v1) != 0; // bne v1, r0, L16 + // nop // sll r0, r0, 0 + if (bc) {goto block_15;} // branch non-likely + + c->mov64(v1, s7); // or v1, s7, r0 + +block_20: + c->load_symbol2(t9, cache.paused); // lw t9, paused?(s7) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + bc = c->sgpr64(s7) != c->sgpr64(v0); // bne s7, v0, L21 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_25;} // branch non-likely + + c->lwu(v1, 0, gp); // lwu v1, 0(gp) + c->andi(v1, v1, 8); // andi v1, v1, 8 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L21 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_25;} // branch non-likely + + c->lwu(v1, 0, gp); // lwu v1, 0(gp) + c->andi(v1, v1, 16); // andi v1, v1, 16 + bc = c->sgpr64(v1) != 0; // bne v1, r0, L20 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_24;} // branch non-likely + + c->sh(r0, 8, gp); // sh r0, 8(gp) + c->gprs[v1].du64[0] = 0; // or v1, r0, r0 + +block_24: + c->addiu(v1, r0, -17); // addiu v1, r0, -17 + c->lwu(a0, 0, gp); // lwu a0, 0(gp) + c->and_(v1, v1, a0); // and v1, v1, a0 + c->sw(v1, 0, gp); // sw v1, 0(gp) + +block_25: + c->lwu(a3, 4, s4); // lwu a3, 4(s4) + bc = c->sgpr64(s5) == c->sgpr64(a3); // beq s5, a3, L22 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_27;} // branch non-likely + + c->lwu(v1, 4, s4); // lwu v1, 4(s4) + c->lui(a0, 8192); // lui a0, 8192 + c->sd(a0, 0, v1); // sd a0, 0(v1) + c->sw(r0, 8, v1); // sw r0, 8(v1) + c->sw(r0, 12, v1); // sw r0, 12(v1) + c->daddiu(v1, v1, 16); // daddiu v1, v1, 16 + c->sw(v1, 4, s4); // sw v1, 4(s4) + c->load_symbol2(t9, cache.dma_bucket_insert_tag); // lw t9, dma-bucket-insert-tag(s7) + c->load_symbol2(v1, cache.display); // lw v1, *display*(s7) + c->lw(v1, 0, v1); // lw v1, 0(v1) + c->dsll(v1, v1, 2); // dsll v1, v1, 2 + c->load_symbol2(a0, cache.display); // lw a0, *display*(s7) + c->daddu(v1, v1, a0); // daddu v1, v1, a0 + c->lwu(v1, 8, v1); // lwu v1, 8(v1) + c->lwu(a0, 40, v1); // lwu a0, 40(v1) + c->lw(a1, 76, gp); // lw a1, 76(gp) + c->mov64(a2, s5); // or a2, s5, r0 + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->mov64(v1, v0); // or v1, v0, r0 + +block_27: + //beq r0, r0, L24 // beq r0, r0, L24 + // nop // sll r0, r0, 0 + goto block_29; // branch always + + +block_28: + c->load_symbol2(t9, cache.format); // lw t9, format(s7) + c->load_symbol2(a0, cache.stdcon); // lw a0, *stdcon*(s7) + // daddiu a1, fp, L29 // daddiu a1, fp, L29 + ASSERT_NOT_REACHED(); // ran out of memory error print. + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->mov64(v1, v0); // or v1, v0, r0 + +block_29: + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->ld(fp, 8, sp); // ld fp, 8(sp) + c->lq(gp, 96, sp); // lq gp, 96(sp) + c->lq(s5, 80, sp); // lq s5, 80(sp) + c->lq(s4, 64, sp); // lq s4, 64(sp) + c->lq(s3, 48, sp); // lq s3, 48(sp) + c->lq(s2, 32, sp); // lq s2, 32(sp) + c->lq(s1, 16, sp); // lq s1, 16(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 112); // daddiu sp, sp, 112 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.display = intern_from_c(-1, 0, "*display*").c(); + cache.prim_work = intern_from_c(-1, 0, "*prim-work*").c(); + cache.stdcon = intern_from_c(-1, 0, "*stdcon*").c(); + cache.adgif_shader_texture_simple = intern_from_c(-1, 0, "adgif-shader<-texture-simple!").c(); + cache.dma_bucket_insert_tag = intern_from_c(-1, 0, "dma-bucket-insert-tag").c(); + cache.format = intern_from_c(-1, 0, "format").c(); + cache.lookup_texture_by_id = intern_from_c(-1, 0, "lookup-texture-by-id").c(); + cache.paused = intern_from_c(-1, 0, "paused?").c(); + gLinkedFunctionTable.reg("(method 9 prim-strip)", execute, 256); +} + +} // namespace method_9_prim_strip +} // namespace Mips2C +// add method_9_prim_strip::link to the link callback table for the object file. +// FWD DEC: diff --git a/game/mips2c/mips2c_table.cpp b/game/mips2c/mips2c_table.cpp index 0cf9193a5..d564f87a7 100644 --- a/game/mips2c/mips2c_table.cpp +++ b/game/mips2c/mips2c_table.cpp @@ -280,6 +280,7 @@ namespace generic_no_light_proc { extern void link(); } namespace method_9_font_work { extern void link(); } namespace draw_string_asm { extern void link(); } namespace get_string_length { extern void link(); } +namespace method_9_prim_strip { extern void link(); } } // clang-format on @@ -464,8 +465,8 @@ PerGameVersion>> gMips2C jak3::generic_warp_dest::link, jak3::generic_warp_envmap_dest::link, jak3::generic_no_light_proc::link}}, {"font", - {jak3::method_9_font_work::link, jak3::draw_string_asm::link, - jak3::get_string_length::link}}}}; + {jak3::method_9_font_work::link, jak3::draw_string_asm::link, jak3::get_string_length::link}}, + {"prim", {jak3::method_9_prim_strip::link}}}}; void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) { const auto& it = m_executes.insert({name, {exec, Ptr()}}); diff --git a/goal_src/jak3/engine/common-obs/prim-h.gc b/goal_src/jak3/engine/common-obs/prim-h.gc index c0f27cd27..625ec8856 100644 --- a/goal_src/jak3/engine/common-obs/prim-h.gc +++ b/goal_src/jak3/engine/common-obs/prim-h.gc @@ -8,13 +8,14 @@ (defenum prim-flags :type uint32 :bitfield #t - (pf0 0) ;; set by default - (pf1 1) ;; set by default - (pf2 2) - (pf3 3) - (pf4 4) + (alpha-blend-enable 0) ;; set by default + (texture-enable 1) ;; set by default + (fog-enable 2) + (pf3 3) ;; auto-clear vertices? + (pf4 4) ;; has new verts to draw? (no-texture-name 5) ;; only has the ID. ) + (define-extern process-drawable-art-error (state string process-drawable)) (define-extern *prim-engine* engine) @@ -35,7 +36,7 @@ some special effect code, then sent to the prim renderer to be drawn." "Base class for prim-strip." () (:methods - (prim-base-method-9 () none) + (generate-dma! (_type_ matrix) none) ) ) @@ -63,7 +64,7 @@ These are owned by the thing submitting to prim, not the prim renderer itself." ) (:methods (new (symbol type int texture-id string) _type_) - (prim-strip-method-10 (_type_ draw-control) none) + (setup-dma-and-tex (_type_ draw-control) none) ) ) @@ -76,7 +77,7 @@ These are owned by the thing submitting to prim, not the prim renderer itself." (go process-drawable-art-error "prim-strip") ) (add-connection *prim-engine* pp #f pp s5-0 #f) - (set! (-> s5-0 flags) (prim-flags pf0 pf1)) + (set! (-> s5-0 flags) (prim-flags alpha-blend-enable texture-enable)) (set! (-> s5-0 num-verts) (the-as uint num-vertices)) (set! (-> s5-0 allocated-num-verts) (the-as uint num-vertices)) (set! (-> s5-0 data0) (new 'static 'gs-test)) @@ -147,10 +148,10 @@ These are owned by the thing submitting to prim, not the prim renderer itself." (mask vector4w :inline) (in-verts int32) (num-verts int32) - (vert-ptr prim-vertex) + (vert-ptr (inline-array prim-vertex)) (sinks prim-sink 68 :inline) ) (:methods - (prim-work-method-9 () none) + (reset! (_type_) none) ) ) diff --git a/goal_src/jak3/engine/common-obs/prim.gc b/goal_src/jak3/engine/common-obs/prim.gc index 9e06e2480..4cd1d02a7 100644 --- a/goal_src/jak3/engine/common-obs/prim.gc +++ b/goal_src/jak3/engine/common-obs/prim.gc @@ -5,5 +5,124 @@ ;; name in dgo: prim ;; dgos: GAME +;; for now, I made the DMA generation mips2c +;; it's probably possible to rewrite in GOAL, or just totally redo. +;; we'll have to see how much is drawn with this. +;; somewhat annoyingly, it seems to resue generic buckets... + ;; DECOMP BEGINS +(define *prim-work* + (new 'static 'prim-work + :vertex-tmpl (new 'static 'inline-array dma-packet 3 + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v4-32)) + ) + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v4-32)) + ) + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v4-32)) + ) + ) + :control-tmpl (new 'static 'inline-array dma-packet 2 + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xc :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #xc :cmd (vif-cmd unpack-v4-32)) + ) + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xc :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #xc :cmd (vif-cmd unpack-v4-32)) + ) + ) + :giftag (new 'static 'generic-gif-tag + :fan-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :str-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + :num-strips #x1 + ) + :call-scissor (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscalf) :msk #x1) + ) + :call-noclip (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x8 :cmd (vif-cmd mscalf) :msk #x1) + ) + :mask (new 'static 'vector4w :x -2 :y -1 :z -1) + ) + ) + +(defmethod reset! ((this prim-work)) + "Reset all pending vertex/control data." + (dotimes (v1-0 68) + (let ((a1-2 (-> this sinks v1-0))) + (set! (-> a1-2 vertex-count) (the-as uint 0)) + (set! (-> a1-2 control-count) (the-as uint 0)) + ) + 0 + ) + 0 + (none) + ) + +(defmethod-mips2c "(method 9 prim-strip)" 9 prim-strip) + +(defmethod setup-dma-and-tex ((this prim-strip) (arg0 draw-control)) + "Set up the bucket, prim sink, and texture." + (let ((s5-0 (-> *level* level (-> arg0 level-index)))) + (let ((s2-0 (-> s5-0 draw-index)) + (s4-0 (-> arg0 default-texture-page)) + ) + (let ((s3-0 (vu1-bucket-map s2-0 (the-as int s4-0) (merc-mode mercneric2))) + (v1-3 (vu1-bucket-map s2-0 (the-as int s4-0) (merc-mode mm5))) + ) + (set! (-> this bucket) s3-0) + (set! (-> this sink) (the-as uint v1-3)) + ) + (set! (-> this level) s5-0) + (set! (-> this texture-index) s4-0) + ) + (when (not (logtest? (-> this flags) (prim-flags no-texture-name))) + (set! (-> this tex-id) + (lookup-level-texture-id-by-name (the-as string (-> this tex-name)) s5-0 (the-as int (-> this texture-index))) + ) + (logior! (-> this flags) (prim-flags no-texture-name)) + ) + ) + 0 + (none) + ) + +(defun prim-engine-execute () + "Generate all prim DMA." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask generic)) + (when (not (get-menu-mode *blit-displays-work*)) + (let* ((gp-0 *prim-engine*) + (s5-0 (-> *math-camera* camera-temp)) + (v1-9 (-> gp-0 alive-list next0)) + (s4-0 (-> (the-as connection v1-9) next0)) + ) + (while (!= v1-9 (-> gp-0 alive-list-end)) + (-> (the-as connection v1-9) param1) + (generate-dma! (the-as prim-strip (-> (the-as connection v1-9) param2)) s5-0) + (set! v1-9 s4-0) + (set! s4-0 (-> s4-0 next0)) + ) + ) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/draw/draw-node.gc b/goal_src/jak3/engine/draw/draw-node.gc index a68108af1..2a2e04c89 100644 --- a/goal_src/jak3/engine/draw/draw-node.gc +++ b/goal_src/jak3/engine/draw/draw-node.gc @@ -5,6 +5,8 @@ ;; name in dgo: draw-node ;; dgos: GAME +(define-extern draw-node-cull (function pointer pointer (inline-array draw-node) int none)) + ;; DECOMP BEGINS (defmethod collect-regions ((this draw-node) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) diff --git a/goal_src/jak3/engine/draw/drawable-h.gc b/goal_src/jak3/engine/draw/drawable-h.gc index b4846378d..dc3f33120 100644 --- a/goal_src/jak3/engine/draw/drawable-h.gc +++ b/goal_src/jak3/engine/draw/drawable-h.gc @@ -9,6 +9,7 @@ (define-extern sphere-in-view-frustum? (function sphere symbol)) (define-extern line-in-view-frustum? (function vector vector symbol)) +(define-extern vis-cull (function int symbol)) ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc index 3fa932636..c4d5b2ec4 100644 --- a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc +++ b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-h.gc @@ -49,6 +49,7 @@ (dma-base uint32 :overlay-at (-> dma-chain 1)) (dma-level-1 uint32 :overlay-at (-> dma-chain 2)) (dma-qwc uint8 4 :offset 44) + (dma-qwc-word uint32 :overlay-at (-> dma-qwc 0)) (shader (inline-array adgif-shader) :offset 48) (num-shaders uint8 :offset 52) (num-base-colors uint8 :offset 53) diff --git a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-methods.gc b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-methods.gc index ce0538cf1..4579d60b1 100644 --- a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-methods.gc +++ b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-methods.gc @@ -7,3 +7,785 @@ ;; DECOMP BEGINS +;; WARN: Return type mismatch symbol vs none. +(defun edge-debug-lines ((arg0 (array vector-array))) + "Draw tfrag debug lines. These debug-lines are not stored in retail copies." + (when (nonzero? arg0) + (dotimes (s5-0 (-> arg0 length)) + (when (logtest? *display-strip-lines* (ash 1 s5-0)) + (let ((s4-0 (-> arg0 s5-0))) + (dotimes (s3-0 (/ (-> s4-0 length) 2)) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 data (* s3-0 2)) + (-> s4-0 data (+ (* s3-0 2) 1)) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + #f + (the-as rgba -1) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch drawable-tree-tfrag vs none. +(defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag)) + "Top-level function to generate DMA for tfrag." + (local-vars (sv-16 int)) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (let ((s5-0 (+ (-> arg0 length) -1))) + (when (nonzero? s5-0) + (dotimes (s4-0 s5-0) + (let* ((v1-8 (-> arg0 arrays s4-0)) + (a0-4 (-> arg0 arrays (+ s4-0 1))) + (a1-1 (/ (-> (the-as drawable-inline-array-node v1-8) data 0 id) 8)) + (a0-6 (/ (-> (the-as drawable-inline-array-node a0-4) data 0 id) 8)) + (a1-3 (+ a1-1 #x3800 #x70000000)) + (a0-8 (+ a0-6 #x3800 #x70000000)) + ) + (draw-node-cull + (the-as pointer a0-8) + (the-as pointer a1-3) + (the-as (inline-array draw-node) (&+ v1-8 32)) + (-> v1-8 length) + ) + ) + ) + ) + (let* ((v1-14 (-> arg0 arrays s5-0)) + (s4-1 (&+ v1-14 32)) + (s3-0 (-> v1-14 length)) + ) + (set! sv-16 (+ (/ (-> s4-1 id) 8) #x3800 #x70000000)) + (let ((s5-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tfrag-l0-tfrag) + (bucket-id tfrag-l1-tfrag) + (bucket-id tfrag-l2-tfrag) + (bucket-id tfrag-l3-tfrag) + (bucket-id tfrag-l4-tfrag) + (bucket-id tfrag-l5-tfrag) + (bucket-id tfrag-l6-tfrag) + (bucket-id tfrag-l7-tfrag) + (bucket-id tfrag-l8-tfrag) + (bucket-id tfrag-l9-tfrag) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp tfrag-closest))) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag (the-as pointer sv-16) s4-1 s3-0 s1-0) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 0) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 42) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + ) + (with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tfrag-scissor-l0-tfrag) + (bucket-id tfrag-scissor-l1-tfrag) + (bucket-id tfrag-scissor-l2-tfrag) + (bucket-id tfrag-scissor-l3-tfrag) + (bucket-id tfrag-scissor-l4-tfrag) + (bucket-id tfrag-scissor-l5-tfrag) + (bucket-id tfrag-scissor-l6-tfrag) + (bucket-id tfrag-scissor-l7-tfrag) + (bucket-id tfrag-scissor-l8-tfrag) + (bucket-id tfrag-scissor-l9-tfrag) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s4-1 s3-0 s1-1) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 1) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 43) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + ) + (let ((a0-33 *dma-mem-usage*)) + (when (nonzero? a0-33) + (set! (-> a0-33 length) (max 2 (-> a0-33 length))) + (set! (-> a0-33 data 1 name) "tfragment") + (+! (-> a0-33 data 1 count) 1) + (+! (-> a0-33 data 1 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) + ) + (set! (-> a0-33 data 1 total) (-> a0-33 data 1 used)) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch drawable-tree-tfrag vs none. +(defun draw-drawable-tree-tfrag-trans ((arg0 drawable-tree-tfrag)) + "Top-level function to generate DMA for tfrag." + (local-vars (sv-16 int)) + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (let ((s5-0 (+ (-> arg0 length) -1))) + (when (nonzero? s5-0) + (dotimes (s4-0 s5-0) + (let* ((v1-7 (-> arg0 arrays s4-0)) + (a0-6 (-> arg0 arrays (+ s4-0 1))) + (a1-1 (/ (-> (the-as drawable-inline-array-node v1-7) data 0 id) 8)) + (a0-8 (/ (-> (the-as drawable-inline-array-node a0-6) data 0 id) 8)) + (a1-3 (+ a1-1 #x3800 #x70000000)) + (a0-10 (+ a0-8 #x3800 #x70000000)) + ) + (draw-node-cull + (the-as pointer a0-10) + (the-as pointer a1-3) + (the-as (inline-array draw-node) (&+ v1-7 32)) + (-> v1-7 length) + ) + ) + ) + ) + (let* ((v1-13 (-> arg0 arrays s5-0)) + (s5-1 (&+ v1-13 32)) + (s4-1 (-> v1-13 length)) + ) + (set! sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) + (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-l0-alpha) + (bucket-id tfrag-l1-alpha) + (bucket-id tfrag-l2-alpha) + (bucket-id tfrag-l3-alpha) + (bucket-id tfrag-l4-alpha) + (bucket-id tfrag-l5-alpha) + (bucket-id tfrag-l6-alpha) + (bucket-id tfrag-l7-alpha) + (bucket-id tfrag-l8-alpha) + (bucket-id tfrag-l9-alpha) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp alpha-closest))) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag (the-as pointer sv-16) s5-1 s4-1 s2-0) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 2) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 42) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + ) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-scissor-l0-alpha) + (bucket-id tfrag-scissor-l1-alpha) + (bucket-id tfrag-scissor-l2-alpha) + (bucket-id tfrag-scissor-l3-alpha) + (bucket-id tfrag-scissor-l4-alpha) + (bucket-id tfrag-scissor-l5-alpha) + (bucket-id tfrag-scissor-l6-alpha) + (bucket-id tfrag-scissor-l7-alpha) + (bucket-id tfrag-scissor-l8-alpha) + (bucket-id tfrag-scissor-l9-alpha) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s5-1 s4-1 s2-1) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 3) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 43) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch drawable-tree-tfrag vs none. +(defun draw-drawable-tree-tfrag-water ((arg0 drawable-tree-tfrag)) + "Top-level function to generate DMA for tfrag." + (local-vars (sv-16 int)) + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (let ((s5-0 (+ (-> arg0 length) -1))) + (when (nonzero? s5-0) + (dotimes (s4-0 s5-0) + (let* ((v1-7 (-> arg0 arrays s4-0)) + (a0-6 (-> arg0 arrays (+ s4-0 1))) + (a1-1 (/ (-> (the-as drawable-inline-array-node v1-7) data 0 id) 8)) + (a0-8 (/ (-> (the-as drawable-inline-array-node a0-6) data 0 id) 8)) + (a1-3 (+ a1-1 #x3800 #x70000000)) + (a0-10 (+ a0-8 #x3800 #x70000000)) + ) + (draw-node-cull + (the-as pointer a0-10) + (the-as pointer a1-3) + (the-as (inline-array draw-node) (&+ v1-7 32)) + (-> v1-7 length) + ) + ) + ) + ) + (let* ((v1-13 (-> arg0 arrays s5-0)) + (s5-1 (&+ v1-13 32)) + (s4-1 (-> v1-13 length)) + ) + (set! sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) + (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-l0-water) + (bucket-id tfrag-l1-water) + (bucket-id tfrag-l2-water) + (bucket-id tfrag-l3-water) + (bucket-id tfrag-l4-water) + (bucket-id tfrag-l5-water) + (bucket-id tfrag-l6-water) + (bucket-id tfrag-l7-water) + (bucket-id tfrag-l8-water) + (bucket-id tfrag-l9-water) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp water-closest))) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag (the-as pointer sv-16) s5-1 s4-1 s2-0) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 4) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 42) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + ) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-scissor-l0-water) + (bucket-id tfrag-scissor-l1-water) + (bucket-id tfrag-scissor-l2-water) + (bucket-id tfrag-scissor-l3-water) + (bucket-id tfrag-scissor-l4-water) + (bucket-id tfrag-scissor-l5-water) + (bucket-id tfrag-scissor-l6-water) + (bucket-id tfrag-scissor-l7-water) + (bucket-id tfrag-scissor-l8-water) + (bucket-id tfrag-scissor-l9-water) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s5-1 s4-1 s2-1) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 5) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 43) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun tfrag-vu1-init-buf ((arg0 bucket-id) (arg1 gs-test) (arg2 int) (arg3 uint) (arg4 symbol)) + "Do all tfrag buffer setup for a single bucket." + (let ((v1-0 *display*) + (a0-1 32) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t1-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t1-0 real-buffer-end) (the-as int (&+ (-> t1-0 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((s4-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s4-0 (-> s4-0 last)) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s2-1 (-> s3-0 base)) + ) + (tfrag-init-buffer s3-0 arg1 arg2 arg4) + (let ((v1-14 (the-as object (-> s3-0 base)))) + (set! (-> (the-as dma-packet v1-14) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s4-0 next))) + (set! (-> (the-as dma-packet v1-14) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-14) vif1) (new 'static 'vif-tag)) + (set! (-> s3-0 base) (the-as pointer (&+ (the-as dma-packet v1-14) 16))) + ) + (set! (-> s4-0 next) (the-as uint s2-1)) + ) + ) + ) + (let ((s5-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s5-1 (-> s5-1 last)) + (let* ((s3-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s4-1 (-> s3-1 base)) + ) + (tfrag-end-buffer s3-1 (the-as int arg3)) + (let ((v0-5 (-> s3-1 base))) + (let ((v1-28 (the-as object (-> s3-1 base)))) + (set! (-> (the-as dma-packet v1-28) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-28) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-28) vif1) (new 'static 'vif-tag)) + (set! (-> s3-1 base) (&+ (the-as pointer v1-28) 16)) + ) + (set! (-> (the-as (pointer int32) (-> s5-1 last)) 1) (the-as int s4-1)) + (set! (-> s5-1 last) (the-as (pointer dma-tag) v0-5)) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +;; ERROR: Failed store: (s.w! (+ v1-14 8) 0) at op 52 +;; ERROR: Failed store: (s.w! (+ v1-14 12) 0) at op 53 +;; ERROR: Failed store: (s.w! (+ v1-28 8) 0) at op 84 +;; ERROR: Failed store: (s.w! (+ v1-28 12) 0) at op 85 +;; ERROR: Failed store: (s.w! (+ v1-30 4) s4-1) at op 89 +(defun tfrag-scissor-vu1-init-buf ((arg0 bucket-id) (arg1 gs-test) (arg2 int) (arg3 uint) (arg4 symbol)) + (none) + ) + +(deftype tfrag-init-data (structure) + ((tfrag-bucket bucket-id) + (tfrag-scissor-bucket bucket-id) + (tfrag-trans-bucket bucket-id) + (tfrag-scissor-trans-bucket bucket-id) + (tfrag-water-bucket bucket-id) + (tfrag-water-scissor-bucket bucket-id) + ) + ) + + +(define *tfrag-init-table* (new 'static 'inline-array tfrag-init-data 10 + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l0-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l0-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l0-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l0-alpha) + :tfrag-water-bucket (bucket-id tfrag-l0-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l0-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l1-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l1-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l1-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l1-alpha) + :tfrag-water-bucket (bucket-id tfrag-l1-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l1-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l2-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l2-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l2-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l2-alpha) + :tfrag-water-bucket (bucket-id tfrag-l2-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l2-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l3-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l3-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l3-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l3-alpha) + :tfrag-water-bucket (bucket-id tfrag-l3-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l3-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l4-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l4-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l4-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l4-alpha) + :tfrag-water-bucket (bucket-id tfrag-l4-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l4-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l5-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l5-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l5-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l5-alpha) + :tfrag-water-bucket (bucket-id tfrag-l5-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l5-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l6-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l6-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l6-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l6-alpha) + :tfrag-water-bucket (bucket-id tfrag-l6-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l6-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l7-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l7-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l7-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l7-alpha) + :tfrag-water-bucket (bucket-id tfrag-l7-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l7-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l8-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l8-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l8-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l8-alpha) + :tfrag-water-bucket (bucket-id tfrag-l8-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l8-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l9-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l9-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l9-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l9-alpha) + :tfrag-water-bucket (bucket-id tfrag-l9-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l9-water) + ) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-vu1-init-buffers () + "Initialize all tfrag buckets." + (dotimes (gp-0 10) + (let ((s5-0 (-> *level* draw-level gp-0)) + (s4-0 (-> *tfrag-init-table* gp-0)) + ) + (when s5-0 + (set-subdivide-settings! s5-0) + (let ((s3-0 (-> s5-0 tfrag-gs-test))) + (tfrag-vu1-init-buf + (-> s4-0 tfrag-bucket) + s3-0 + 0 + (-> s5-0 tfrag-last-calls 0) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-scissor-vu1-init-buf + (-> s4-0 tfrag-scissor-bucket) + s3-0 + 0 + (-> s5-0 tfrag-last-calls 1) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + ) + (tfrag-vu1-init-buf + (-> s4-0 tfrag-trans-bucket) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 1 + (-> s5-0 tfrag-last-calls 2) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-scissor-vu1-init-buf + (-> s4-0 tfrag-scissor-trans-bucket) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 1 + (-> s5-0 tfrag-last-calls 3) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-vu1-init-buf + (-> s4-0 tfrag-water-bucket) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + 1 + (-> s5-0 tfrag-last-calls 4) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-scissor-vu1-init-buf + (-> s4-0 tfrag-water-scissor-bucket) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + 1 + (-> s5-0 tfrag-last-calls 5) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + ) + ) + ) + (none) + ) + +(defmethod draw ((this drawable-tree-tfrag)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tfrag-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tfrag-trees v1-1) this) + (set! (-> *background-work* tfrag-levels v1-1) a1-3) + ) + (+! (-> *background-work* tfrag-tree-count) 1) + 0 + (none) + ) + +(defmethod draw ((this drawable-tree-tfrag-trans)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tfrag-trans-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tfrag-trans-trees v1-1) this) + (set! (-> *background-work* tfrag-trans-levels v1-1) a1-3) + ) + (+! (-> *background-work* tfrag-trans-tree-count) 1) + 0 + (none) + ) + +(defmethod draw ((this drawable-tree-tfrag-water)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tfrag-water-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tfrag-water-trees v1-1) this) + (set! (-> *background-work* tfrag-water-levels v1-1) a1-3) + ) + (+! (-> *background-work* tfrag-water-tree-count) 1) + 0 + (none) + ) + +(defmethod collect-stats ((this tfragment)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (stats-tfrag-asm this) + 0 + (none) + ) + +(defmethod collect-stats ((this drawable-tree-tfrag)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (set! (-> *tfrag-work* vu1-enable-tfrag) + (the-as int (logand (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag))) + ) + (set! (-> *tfrag-work* vu1-enable-tfrag-scissor) + (the-as int (logand (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag))) + ) + (set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag)) + (set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor)) + (let ((v1-15 (-> *tfrag-work* frag-dists quad))) + (set! (-> *tfrag-work* frag-dists quad) v1-15) + ) + (dotimes (s5-0 (-> this length)) + (collect-stats (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +(defmethod collect-stats ((this drawable-tree-tfrag-trans)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (set! (-> *tfrag-work* vu1-enable-tfrag) + (the-as int (logand (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* vu1-enable-tfrag-scissor) + (the-as int (logand (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag-trans)) + (set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor-trans)) + (let ((v1-12 (-> *tfrag-work* frag-dists quad))) + (set! (-> *tfrag-work* frag-dists quad) v1-12) + ) + (dotimes (s5-0 (-> this length)) + (collect-stats (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +(defmethod collect-stats ((this drawable-tree-tfrag-water)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (set! (-> *tfrag-work* vu1-enable-tfrag) + (the-as int (logand (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* vu1-enable-tfrag-scissor) + (the-as int (logand (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag-water)) + (set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor-water)) + (let ((v1-12 (-> *tfrag-work* frag-dists quad))) + (set! (-> *tfrag-work* frag-dists quad) v1-12) + ) + (dotimes (s5-0 (-> this length)) + (collect-stats (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +(defmethod collect-stats ((this drawable-inline-array-tfrag)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (collect-stats s4-0) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod collect-stats ((this drawable-inline-array-tfrag-trans)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (collect-stats s4-0) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod collect-stats ((this drawable-inline-array-tfrag-water)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (collect-stats s4-0) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw ((this drawable-tree-tfrag)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (dotimes (s5-0 (-> this length)) + (debug-draw (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw ((this drawable-tree-tfrag-trans)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (debug-draw (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw ((this drawable-tree-tfrag-water)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (debug-draw (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw ((this drawable-inline-array-tfrag)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (debug-draw s4-0) + ) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw ((this tfragment)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (-> *display* frames (-> *display* on-screen) global-buf) + (edge-debug-lines (-> this debug-data debug-lines)) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-near.gc b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-near.gc index 6cb3ce9cf..d5fb0a3ea 100644 --- a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-near.gc +++ b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-near.gc @@ -7,3 +7,72 @@ ;; DECOMP BEGINS +(define tnear-vu1-block (new 'static 'vu-function :length #x38b :qlength #x1c6)) + +;; WARN: Return type mismatch symbol vs none. +(defun-debug tfrag-details ((arg0 tfragment)) + (format 0 "id = ~d~%" (-> arg0 id)) + (format 0 "common:~%") + (let ((s5-0 (-> arg0 dma-qwc 0)) + (s4-0 (-> arg0 dma-common)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-0 s4-0) + (disasm-vif-tag (the-as (pointer vif-tag) s4-0) (the-as int (* s5-0 4)) (the-as symbol 0) #t) + ) + (format 0 "base:~%") + (let ((s5-1 (-> arg0 dma-qwc 1)) + (s4-1 (-> arg0 dma-base)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-1 s4-1) + (disasm-vif-tag (the-as (pointer vif-tag) s4-1) (the-as int (* s5-1 4)) (the-as symbol 0) #t) + ) + (format 0 "level-0:~%") + (let ((s5-2 (-> arg0 dma-qwc 3)) + (s4-2 (-> arg0 dma-qwc-word)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-2 s4-2) + (disasm-vif-tag (the-as (pointer vif-tag) s4-2) (the-as int (* s5-2 4)) (the-as symbol 0) #t) + ) + (format 0 "level-1:~%") + (let ((s5-3 (-> arg0 dma-qwc 2)) + (gp-1 (-> arg0 dma-level-1)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-3 gp-1) + (disasm-vif-tag (the-as (pointer vif-tag) gp-1) (the-as int (* s5-3 4)) (the-as symbol 0) #t) + ) + (none) + ) + +;; WARN: Return type mismatch vector vs none. +(defun-debug clip-restore () + (let ((a0-0 (new-stack-vector0)) + (a1-0 (new 'stack-no-clear 'matrix)) + ) + (set! (-> a1-0 rvec quad) (the-as uint128 0)) + (set! (-> a1-0 uvec quad) (the-as uint128 0)) + (set! (-> a1-0 fvec quad) (the-as uint128 0)) + (set! (-> a1-0 trans quad) (the-as uint128 0)) + (set! (-> a0-0 x) 92648.22) + (set! (-> a0-0 y) 238025.03) + (set! (-> a0-0 z) 199836.31) + (set! (-> a0-0 w) 1.0) + (set! (-> a1-0 rvec x) -0.9283) + (set! (-> a1-0 rvec y) 0.0) + (set! (-> a1-0 rvec z) 0.3716) + (set! (-> a1-0 rvec w) 0.0) + (set! (-> a1-0 uvec x) -0.2257) + (set! (-> a1-0 uvec y) 0.7945) + (set! (-> a1-0 uvec z) -0.5637) + (set! (-> a1-0 uvec w) 0.0) + (set! (-> a1-0 fvec x) -0.2952) + (set! (-> a1-0 fvec y) -0.6072) + (set! (-> a1-0 fvec z) -0.7375) + (set! (-> a1-0 fvec w) 0.0) + (set! (-> a1-0 trans x) 0.0) + (set! (-> a1-0 trans y) 0.0) + (set! (-> a1-0 trans z) 0.0) + (set! (-> a1-0 trans w) 1.0) + (debug-set-camera-pos-rot! a0-0 a1-0) + ) + (none) + ) diff --git a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-work.gc b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-work.gc index 960c6a6dd..058af9b84 100644 --- a/goal_src/jak3/engine/gfx/background/tfrag/tfrag-work.gc +++ b/goal_src/jak3/engine/gfx/background/tfrag/tfrag-work.gc @@ -7,3 +7,36 @@ ;; DECOMP BEGINS +(define *tfrag-work* (new 'static 'tfrag-work + :base-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :level-0-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :common-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :level-1-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x102 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xc000 :cmd (vif-cmd unpack-v4-8)) + ) + :max-fragment #xffff + ) + ) + +(set! (-> *tfrag-work* color-ptr x) (+ 6144 #x70000000)) + +(set! (-> *tfrag-work* color-ptr y) (+ 6144 #x70000000)) + +(set! (-> *tfrag-work* color-ptr z) (+ 6144 #x70000000)) + +(set! (-> *tfrag-work* color-ptr w) (+ 6144 #x70000000)) diff --git a/goal_src/jak3/engine/gfx/background/tfrag/tfrag.gc b/goal_src/jak3/engine/gfx/background/tfrag/tfrag.gc index df6bdcdba..41a26d9f5 100644 --- a/goal_src/jak3/engine/gfx/background/tfrag/tfrag.gc +++ b/goal_src/jak3/engine/gfx/background/tfrag/tfrag.gc @@ -5,5 +5,504 @@ ;; name in dgo: tfrag ;; dgos: GAME +(define-extern draw-inline-array-tfrag (function pointer drawable-inline-array int dma-buffer none)) +(define-extern draw-inline-array-tfrag-scissor (function pointer drawable-inline-array int dma-buffer none)) + ;; DECOMP BEGINS +(defmethod login ((this tfragment)) + "Initialize the object after it is loaded." + (when (nonzero? *texture-masks-array*) + (dotimes (s5-0 (the-as int (-> this num-shaders))) + (let ((v1-3 (adgif-shader-login-no-remap (-> this shader s5-0))) + (a0-7 (-> *texture-masks-array* data (-> this texture-masks-index))) + ) + (when v1-3 + (dotimes (a1-3 3) + (dotimes (a2-0 3) + (set! (-> (the-as (pointer int32) (+ (+ (* a1-3 16) (* a2-0 4)) (the-as int a0-7)))) + (logior (-> (the-as (pointer int32) (+ (* a2-0 4) (the-as int a0-7) (* a1-3 16))) 0) + (-> (the-as texture (+ (* a2-0 4) (the-as int v1-3) (* a1-3 16))) masks data 0 mask x) + ) + ) + ) + (set! (-> a0-7 data a1-3 dist) (fmax (-> a0-7 data a1-3 dist) (-> v1-3 masks data a1-3 dist))) + ) + ) + ) + ) + ) + this + ) + +(defmethod mem-usage ((this tfragment) (usage memory-usage-block) (flags int)) + (when (logtest? flags 2) + (+! (-> usage data 19 count) 1) + (let ((v1-6 (+ (-> this num-base-colors) (-> this num-level0-colors) (-> this num-level1-colors)))) + (+! (-> usage data 19 used) v1-6) + (+! (-> usage data 19 total) (logand -4 (+ v1-6 3))) + ) + (set! this this) + (goto cfg-16) + ) + (let ((s4-0 1)) + (set! (-> usage length) (max (-> usage length) (+ s4-0 8))) + (set! (-> usage data s4-0 name) "tfragment") + (+! (-> usage data s4-0 count) 1) + (let ((v1-20 (asize-of this))) + (+! (-> usage data s4-0 used) v1-20) + (+! (-> usage data s4-0 total) (logand -16 (+ v1-20 15))) + ) + (set! (-> usage data (+ s4-0 1) name) "tfragment-base") + (+! (-> usage data (+ s4-0 1) count) 1) + (let ((v1-31 (* (-> this dma-qwc 0) 16))) + (+! (-> usage data (+ s4-0 1) used) v1-31) + (+! (-> usage data (+ s4-0 1) total) v1-31) + ) + (set! (-> usage data (+ s4-0 2) name) "tfragment-common") + (+! (-> usage data (+ s4-0 2) count) 1) + (let ((v1-41 (* (- (-> this dma-qwc 1) (-> this dma-qwc 0)) 16))) + (+! (-> usage data (+ s4-0 2) used) v1-41) + (+! (-> usage data (+ s4-0 2) total) v1-41) + ) + (set! (-> usage data (+ s4-0 3) name) "tfragment-level0") + (when (nonzero? (-> this num-level0-colors)) + (+! (-> usage data (+ s4-0 3) count) 1) + (let ((v1-53 (* (- (-> this dma-qwc 2) (-> this dma-qwc 0)) 16))) + (+! (-> usage data (+ s4-0 3) used) v1-53) + (+! (-> usage data (+ s4-0 3) total) v1-53) + ) + ) + (set! (-> usage data (+ s4-0 4) name) "tfragment-level1") + (when (not (or (= (-> this dma-level-1) (-> this dma-common)) + (= (-> this dma-level-1) (-> this dma-base)) + (zero? (-> this num-level1-colors)) + ) + ) + (+! (-> usage data (+ s4-0 4) count) 1) + (let ((v1-68 (* (- (-> this dma-qwc 3) + (- (/ (the-as int (- (-> this dma-level-1) (-> this dma-common))) 16) (-> this dma-qwc 0)) + ) + 16 + ) + ) + ) + (+! (-> usage data (+ s4-0 4) used) v1-68) + (+! (-> usage data (+ s4-0 4) total) v1-68) + ) + ) + (set! (-> usage data (+ s4-0 5) name) "tfragment-color") + (+! (-> usage data (+ s4-0 5) count) 1) + (let ((v1-77 + (if (logtest? flags 1) + 0 + (the-as int (* (+ (-> this num-base-colors) (-> this num-level0-colors) (-> this num-level1-colors)) 2)) + ) + ) + ) + (+! (-> usage data (+ s4-0 5) used) v1-77) + (+! (-> usage data (+ s4-0 5) total) (logand -16 (+ v1-77 15))) + ) + (set! (-> usage data (+ s4-0 6) name) "tfragment-debug") + ) + (label cfg-16) + this + ) + + +(defmethod login ((this drawable-inline-array-tfrag)) + "Initialize the object after it is loaded." + (set! *texture-masks-array* (-> *level* level *level-index* bsp tfrag-masks)) + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +(defmethod login ((this drawable-inline-array-tfrag-trans)) + "Initialize the object after it is loaded." + (set! *texture-masks-array* (-> *level* level *level-index* bsp alpha-masks)) + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +(defmethod login ((this drawable-inline-array-tfrag-water)) + "Initialize the object after it is loaded." + (set! *texture-masks-array* (-> *level* level *level-index* bsp water-masks)) + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +(defmethod mem-usage ((this drawable-inline-array-tfrag) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +(defmethod mem-usage ((this drawable-tree-tfrag) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 0 used) v1-6) + (+! (-> usage data 0 total) (logand -16 (+ v1-6 15))) + ) + (when (nonzero? (-> this time-of-day-pal)) + (set! (-> usage length) (max 9 (-> usage length))) + (set! (-> usage data 8 name) "tfragment-pal") + (+! (-> usage data 8 count) 1) + (let ((v1-18 (asize-of (-> this time-of-day-pal)))) + (+! (-> usage data 8 used) v1-18) + (+! (-> usage data 8 total) (logand -16 (+ v1-18 15))) + ) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this arrays s3-0) usage flags) + ) + this + ) + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this drawable-inline-array-tfrag)) + (the-as int (+ (-> drawable-inline-array-tfrag size) (* (+ (-> this length) -1) 64))) + ) + +(define *tfrag-display-stats* #f) + +(define tfrag-vu1-block (new 'static 'vu-function :length #x74b :qlength #x3a6)) + +;; WARN: Return type mismatch tfrag-data vs none. +(defun tfrag-data-setup ((arg0 tfrag-data) (arg1 int) (arg2 int)) + "Set up VU1 constants" + (let ((v1-0 *math-camera*)) + (let ((a0-1 (-> arg0 data))) + (set! (-> a0-1 0) (the-as uint (-> v1-0 pfog0))) + (set! (-> a0-1 1) (the-as uint (-> v1-0 fog-min))) + (set! (-> a0-1 2) (the-as uint (-> v1-0 fog-max))) + (set! (-> a0-1 3) (the-as uint 3072.0)) + ) + (set-vector! (-> arg0 val) 0.5 1.0 2048.0 0.0) + (set-vector! (-> arg0 ambient) 1.0 1.0 1.0 1.0) + (let ((a0-4 arg2)) + (cond + ((zero? a0-4) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + ) + ((= a0-4 1) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + ) + ((= a0-4 2) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1 :abe arg1) + ) + ) + ) + ((= a0-4 3) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + ) + ) + ) + (set! (-> arg0 strgif regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> arg0 fangif regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1)) + (set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad)) + (set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad)) + (set! (-> arg0 invh-scale quad) (-> v1-0 inv-hmge-scale quad)) + (set! (-> arg0 guard quad) (-> v1-0 guard quad)) + ) + (set-tfrag-dists! (-> arg0 dists)) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun add-tfrag-mtx-0 ((arg0 dma-buffer) (arg1 symbol)) + "Add DMA for transferring matrix0 (same as matrix1)" + (let* ((a2-0 4) + (v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd unpack-v4-32) :num a2-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (if arg1 + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp-other) + ) + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp) + ) + ) + (&+! (-> arg0 base) 64) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun add-tfrag-mtx-1 ((arg0 dma-buffer) (arg1 symbol)) + "Add DMA for transferring matrix1 (same as matrix0)" + (let* ((a2-0 4) + (v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x14d :cmd (vif-cmd unpack-v4-32) :num a2-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (if arg1 + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp-other) + ) + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp) + ) + ) + (&+! (-> arg0 base) 64) + (none) + ) + +;; WARN: Return type mismatch dma-packet vs none. +(defun add-tfrag-data ((arg0 dma-buffer) (arg1 int) (arg2 int)) + "Add DMA for tfrag constants." + (let* ((a3-0 14) + (v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a3-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x290 :cmd (vif-cmd unpack-v4-32) :num a3-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (tfrag-data-setup (the-as tfrag-data (-> arg0 base)) arg1 arg2) + (&+! (-> arg0 base) 224) + (let ((v1-3 (the-as dma-packet (-> arg0 base)))) + (set! (-> v1-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> v1-3 vif0) (new 'static 'vif-tag)) + (set! (-> v1-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1)) + (set! (-> arg0 base) (the-as pointer (&+ v1-3 16))) + ) + (none) + ) + +(define t-stat (new 'global 'tfrag-stats)) + +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-print-stats ((arg0 symbol)) + "Print out accumulated tfrag stats." + (when (and *tfrag-display-stats* (!= *master-mode* 'menu)) + (format arg0 "~%") + (format arg0 "tris: ~8d~%" (-> t-stat tris)) + (format arg0 "verts: ~8d~%" (+ (-> t-stat base-verts) (-> t-stat level0-verts) (-> t-stat level1-verts))) + (format arg0 " base: ~8d~%" (-> t-stat base-verts)) + (format arg0 " lev0: ~8d~%" (-> t-stat level0-verts)) + (format arg0 " lev1: ~8d~%" (-> t-stat level1-verts)) + (format arg0 "tfaces: ~8d~%" (-> t-stat tfaces)) + (format arg0 "tfrags: ~8d~%" (-> t-stat tfrags)) + (format arg0 "dtris: ~8d~%" (-> t-stat dtris)) + (format arg0 "dps: ~8d~%" (-> t-stat drawpoints)) + (format arg0 "strips: ~8d~%" (-> t-stat strips)) + (format arg0 "shaders:~8d~%" (-> t-stat dma-tex)) + (format arg0 "tri/str:~8f~%" (/ (the float (-> t-stat dtris)) (the float (-> t-stat strips)))) + (format arg0 "dma-cnt:~8d (~8d)~%" (-> t-stat dma-cnt) (* (-> t-stat dma-cnt) 32)) + (format arg0 "dma-dta:~8d (~8d)~%" (-> t-stat dma-dta) (/ (* 33 (-> t-stat dma-dta)) 10)) + (let ((f0-4 (* 32.0 (the float (-> t-stat dma-cnt)))) + (f1-5 (* 3.3 (the float (-> t-stat dma-dta)))) + (f2-3 (* 30.0 (the float (-> t-stat tfrags)))) + ) + (+ f0-4 f1-5 f2-3) + ) + ) + (none) + ) + +(set! (-> t-stat from) 0) + +(set! (-> t-stat to) 0) + +(set! (-> t-stat cnt) 0) + +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-init-buffer ((arg0 dma-buffer) (arg1 gs-test) (arg2 int) (arg3 symbol)) + "Initialize DMA bucket for Tfrag rendering." + (let ((v1-0 *display*) + (a0-6 (+ (* (+ (/ (-> tfrag-vu1-block qlength) 127) 1) 16) 480)) + ) + (+! (-> v1-0 mem-reserve-size) a0-6) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-vu-function arg0 tfrag-vu1-block 1) + (dma-buffer-add-gs-set arg0 (test-1 arg1)) + (add-tfrag-mtx-0 arg0 arg3) + (add-tfrag-mtx-1 arg0 arg3) + (add-tfrag-data arg0 arg2 (the-as int *subdivide-draw-mode*)) + (let ((v1-5 (the-as dma-packet (-> arg0 base)))) + (set! (-> v1-5 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> v1-5 vif0) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> v1-5 vif1) (new 'static 'vif-tag :imm #x148 :cmd (vif-cmd offset))) + (set! (-> arg0 base) (the-as pointer (&+ v1-5 16))) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-end-buffer ((arg0 dma-buffer) (arg1 int)) + "Finalize DMA bucket for tfrag rendering." + (let ((v1-0 *display*) + (a2-0 64) + ) + (+! (-> v1-0 mem-reserve-size) a2-0) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-0))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let* ((v1-2 arg0) + (a2-4 (the-as dma-packet (-> v1-2 base))) + ) + (set! (-> a2-4 dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) + (set! (-> a2-4 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmask))) + (set! (-> a2-4 vif1) (new 'static 'vif-tag)) + (set! (-> v1-2 base) (the-as pointer (&+ a2-4 16))) + ) + (let* ((v1-3 arg0) + (a0-1 (-> v1-3 base)) + ) + (set! (-> (the-as (pointer vif-tag) a0-1) 0) (the-as vif-tag arg1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 2) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> (the-as (pointer vif-tag) a0-1) 3) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> (the-as (pointer int32) a0-1) 4) 0) + (set! (-> (the-as (pointer int32) a0-1) 5) 0) + (set! (-> (the-as (pointer int32) a0-1) 6) 0) + (set! (-> (the-as (pointer int32) a0-1) 7) 0) + (set! (-> (the-as (pointer vif-tag) a0-1) 8) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> (the-as (pointer vif-tag) a0-1) 9) (new 'static 'vif-tag :cmd (vif-cmd offset))) + (set! (-> (the-as (pointer vif-tag) a0-1) 10) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as (pointer vif-tag) a0-1) 11) (new 'static 'vif-tag)) + (set! (-> v1-3 base) (&+ a0-1 48)) + ) + ) + ) + ) + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; WARN: Return type mismatch symbol vs none. +;; ERROR: Failed store: (s.w! (+ v1-5 8) a0-21) at op 77 +;; ERROR: Failed store: (s.w! (+ v1-5 12) a0-22) at op 79 +(defun tfrag-scissor-init-buffer ((arg0 dma-buffer) (arg1 gs-test) (arg2 int) (arg3 symbol)) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +;; ERROR: Failed store: (s.w! (+ a2-4 8) a3-11) at op 25 +;; ERROR: Failed store: (s.w! (+ a2-4 12) 0) at op 26 +;; ERROR: Failed store: (s.w! (+ a0-1 4) a1-1) at op 33 +;; ERROR: Failed store: (s.w! (+ a0-1 8) a1-2) at op 35 +;; ERROR: Failed store: (s.w! (+ a0-1 12) a1-3) at op 37 +;; ERROR: Failed store: (s.w! (+ a0-1 16) 0) at op 38 +;; ERROR: Failed store: (s.w! (+ a0-1 20) 0) at op 39 +;; ERROR: Failed store: (s.w! (+ a0-1 24) 0) at op 40 +;; ERROR: Failed store: (s.w! (+ a0-1 28) 0) at op 41 +;; ERROR: Failed store: (s.w! (+ a0-1 32) a1-4) at op 43 +;; ERROR: Failed store: (s.w! (+ a0-1 36) a1-5) at op 45 +;; ERROR: Failed store: (s.w! (+ a0-1 40) a1-6) at op 47 +;; ERROR: Failed store: (s.w! (+ a0-1 44) 0) at op 48 +(defun tfrag-scissor-end-buffer ((arg0 dma-buffer) (arg1 uint)) + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: function was not converted to expressions. Cannot decompile. +(defun stats-tfrag-asm ((frag tfragment)) + (format 0 "no stats for you~%") + (none) + ) diff --git a/goal_src/jak3/engine/gfx/background/tie/tie-methods.gc b/goal_src/jak3/engine/gfx/background/tie/tie-methods.gc index 4ce35008d..27e6e3b40 100644 --- a/goal_src/jak3/engine/gfx/background/tie/tie-methods.gc +++ b/goal_src/jak3/engine/gfx/background/tie/tie-methods.gc @@ -7,3 +7,1814 @@ ;; DECOMP BEGINS +(deftype tie-debug (structure) + ((max-instance uint32) + (min-instance uint32) + (test-fragment uint32) + (frag-count uint32) + ) + ) + + +(define *tie* (new 'global 'tie-debug)) + +(defun tie-debug-between ((arg0 uint) (arg1 uint)) + (set! (-> *instance-tie-work* test-id) arg1) + (set! (-> *instance-tie-work* test-id2) arg0) + arg0 + ) + +(defun tie-debug-one ((arg0 uint) (arg1 uint)) + (set! (-> *instance-tie-work* test-id) (+ arg1 -1 arg0)) + (set! (-> *instance-tie-work* test-id2) arg0) + arg0 + ) + +(defun tie-debug-frag-between ((arg0 uint) (arg1 uint)) + (set! (-> *tie* test-fragment) arg0) + (let ((v0-0 (- arg1 arg0))) + (set! (-> *tie* frag-count) v0-0) + v0-0 + ) + ) + +(defun tie-debug-frag-one ((arg0 uint) (arg1 uint)) + (set! (-> *tie* test-fragment) arg0) + (set! (-> *tie* frag-count) arg1) + arg1 + ) + +;; WARN: Return type mismatch symbol vs none. +(defun walk-tie-generic-prototypes () + (none) + ) + +(define *pke-hack* (new 'global 'vector)) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; WARN: Return type mismatch pointer vs object. +;; ERROR: Failed store: (s.d! (the-as uint a0-5) a1-5) at op 46 +;; ERROR: Failed store: (s.d! (the-as uint a0-18) a1-23) at op 144 +;; ERROR: Failed store: (s.d! (the-as uint a0-31) a1-41) at op 242 +;; ERROR: Failed store: (s.d! (the-as uint a0-44) a1-59) at op 340 +;; ERROR: Failed store: (s.d! (the-as uint a0-57) a1-77) at op 438 +;; ERROR: Failed store: (s.d! (the-as uint a0-72) a1-95) at op 537 +;; ERROR: Failed store: (s.d! (the-as uint a0-87) a1-113) at op 636 +;; ERROR: Failed store: (s.d! (the-as uint a0-102) a1-131) at op 735 +;; ERROR: Failed store: (s.d! (the-as uint a0-117) a1-149) at op 834 +;; ERROR: Failed store: (s.d! (the-as uint a0-132) a1-167) at op 933 +;; ERROR: Failed store: (s.d! (the-as uint a0-147) a1-185) at op 1032 +;; ERROR: Failed store: (s.d! (the-as uint a0-162) a1-203) at op 1131 +;; ERROR: Failed store: (s.d! (the-as uint a0-176) a1-221) at op 1230 +;; ERROR: Failed store: (s.w! (+ a0-179 8) 0) at op 1239 +;; ERROR: Failed store: (s.w! (+ a0-179 12) 0) at op 1240 +(defun instance-tie-patch-buckets ((arg0 dma-buffer) (arg1 level)) + ; (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + ; (when (nonzero? (-> *prototype-tie-work* scissor-count)) + ; (let ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-17 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id tie-scissor-l0-tfrag) + ; (bucket-id tie-scissor-l1-tfrag) + ; (bucket-id tie-scissor-l2-tfrag) + ; (bucket-id tie-scissor-l3-tfrag) + ; (bucket-id tie-scissor-l4-tfrag) + ; (bucket-id tie-scissor-l5-tfrag) + ; (bucket-id tie-scissor-l6-tfrag) + ; (bucket-id tie-scissor-l7-tfrag) + ; (bucket-id tie-scissor-l8-tfrag) + ; (bucket-id tie-scissor-l9-tfrag) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-1 (-> v1-17 base)) + ; (a0-5 (the-as object (-> *prototype-tie-work* scissor-last))) + ; ) + ; (let ((a3-1 (-> *prototype-tie-work* scissor-next))) + ; (set! (-> (the-as (pointer uint128) a1-1)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-1)) + ; (logior (logand (-> (the-as (pointer uint64) a1-1)) (the-as uint #x80000000ffffffff)) (shr (shl a3-1 33) 1)) + ; ) + ; ) + ; (let ((a1-5 (logior (logand (-> (the-as (pointer uint64) a0-5) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-1 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-5) a1-5) + ; ) + ; ) + ; (&+! (-> v1-17 base) 16) + ; ) + ; (let ((v1-25 *dma-mem-usage*)) + ; (when (nonzero? v1-25) + ; (set! (-> v1-25 length) (max 16 (-> v1-25 length))) + ; (set! (-> v1-25 data 15 name) "tie-scissor") + ; (+! (-> v1-25 data 15 count) 1) + ; (+! (-> v1-25 data 15 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-0)) + ; ) + ; (set! (-> v1-25 data 15 total) (-> v1-25 data 15 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie)) + ; (when (nonzero? (-> *prototype-tie-work* tie-count)) + ; (let ((s5-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-43 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id tie-l0-tfrag) + ; (bucket-id tie-l1-tfrag) + ; (bucket-id tie-l2-tfrag) + ; (bucket-id tie-l3-tfrag) + ; (bucket-id tie-l4-tfrag) + ; (bucket-id tie-l5-tfrag) + ; (bucket-id tie-l6-tfrag) + ; (bucket-id tie-l7-tfrag) + ; (bucket-id tie-l8-tfrag) + ; (bucket-id tie-l9-tfrag) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-19 (-> v1-43 base)) + ; (a0-18 (the-as object (-> *prototype-tie-work* tie-last))) + ; ) + ; (let ((a3-10 (-> *prototype-tie-work* tie-next))) + ; (set! (-> (the-as (pointer uint128) a1-19)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-19)) + ; (logior (logand (-> (the-as (pointer uint64) a1-19)) (the-as uint #x80000000ffffffff)) (shr (shl a3-10 33) 1)) + ; ) + ; ) + ; (let ((a1-23 (logior (logand (-> (the-as (pointer uint64) a0-18) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-19 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-18) a1-23) + ; ) + ; ) + ; (&+! (-> v1-43 base) 16) + ; ) + ; (let ((v1-51 *dma-mem-usage*)) + ; (when (nonzero? v1-51) + ; (set! (-> v1-51 length) (max 10 (-> v1-51 length))) + ; (set! (-> v1-51 data 9 name) "tie-fragment") + ; (+! (-> v1-51 data 9 count) 1) + ; (+! (-> v1-51 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) + ; ) + ; (set! (-> v1-51 data 9 total) (-> v1-51 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie)) + ; (when (nonzero? (-> *prototype-tie-work* envmap-count)) + ; (let ((s5-2 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-69 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id etie-l0-tfrag) + ; (bucket-id etie-l1-tfrag) + ; (bucket-id etie-l2-tfrag) + ; (bucket-id etie-l3-tfrag) + ; (bucket-id etie-l4-tfrag) + ; (bucket-id etie-l5-tfrag) + ; (bucket-id etie-l6-tfrag) + ; (bucket-id etie-l7-tfrag) + ; (bucket-id etie-l8-tfrag) + ; (bucket-id etie-l9-tfrag) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-37 (-> v1-69 base)) + ; (a0-31 (the-as object (-> *prototype-tie-work* envmap-last))) + ; ) + ; (let ((a3-19 (-> *prototype-tie-work* envmap-next))) + ; (set! (-> (the-as (pointer uint128) a1-37)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-37)) + ; (logior (logand (-> (the-as (pointer uint64) a1-37)) (the-as uint #x80000000ffffffff)) (shr (shl a3-19 33) 1)) + ; ) + ; ) + ; (let ((a1-41 (logior (logand (-> (the-as (pointer uint64) a0-31) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-37 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-31) a1-41) + ; ) + ; ) + ; (&+! (-> v1-69 base) 16) + ; ) + ; (let ((v1-77 *dma-mem-usage*)) + ; (when (nonzero? v1-77) + ; (set! (-> v1-77 length) (max 10 (-> v1-77 length))) + ; (set! (-> v1-77 data 9 name) "tie-fragment") + ; (+! (-> v1-77 data 9 count) 1) + ; (+! (-> v1-77 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-2)) + ; ) + ; (set! (-> v1-77 data 9 total) (-> v1-77 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie-scissor)) + ; (when (nonzero? (-> *prototype-tie-work* envmap-scissor-count)) + ; (let ((s5-3 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-95 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id etie-scissor-l0-tfrag) + ; (bucket-id etie-scissor-l1-tfrag) + ; (bucket-id etie-scissor-l2-tfrag) + ; (bucket-id etie-scissor-l3-tfrag) + ; (bucket-id etie-scissor-l4-tfrag) + ; (bucket-id etie-scissor-l5-tfrag) + ; (bucket-id etie-scissor-l6-tfrag) + ; (bucket-id etie-scissor-l7-tfrag) + ; (bucket-id etie-scissor-l8-tfrag) + ; (bucket-id etie-scissor-l9-tfrag) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-55 (-> v1-95 base)) + ; (a0-44 (the-as object (-> *prototype-tie-work* envmap-scissor-last))) + ; ) + ; (let ((a3-28 (-> *prototype-tie-work* envmap-scissor-next))) + ; (set! (-> (the-as (pointer uint128) a1-55)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-55)) + ; (logior (logand (-> (the-as (pointer uint64) a1-55)) (the-as uint #x80000000ffffffff)) (shr (shl a3-28 33) 1)) + ; ) + ; ) + ; (let ((a1-59 (logior (logand (-> (the-as (pointer uint64) a0-44) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-55 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-44) a1-59) + ; ) + ; ) + ; (&+! (-> v1-95 base) 16) + ; ) + ; (let ((v1-103 *dma-mem-usage*)) + ; (when (nonzero? v1-103) + ; (set! (-> v1-103 length) (max 10 (-> v1-103 length))) + ; (set! (-> v1-103 data 9 name) "tie-fragment") + ; (+! (-> v1-103 data 9 count) 1) + ; (+! (-> v1-103 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-3)) + ; ) + ; (set! (-> v1-103 data 9 total) (-> v1-103 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-vanish)) + ; (when (nonzero? (-> *prototype-tie-work* vanish-count)) + ; (let ((s5-4 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-121 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id tie-vanish-l0-tfrag) + ; (bucket-id tie-vanish-l1-tfrag) + ; (bucket-id tie-vanish-l2-tfrag) + ; (bucket-id tie-vanish-l3-tfrag) + ; (bucket-id tie-vanish-l4-tfrag) + ; (bucket-id tie-vanish-l5-tfrag) + ; (bucket-id tie-vanish-l6-tfrag) + ; (bucket-id tie-vanish-l7-tfrag) + ; (bucket-id tie-vanish-l8-tfrag) + ; (bucket-id tie-vanish-l9-tfrag) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-73 (-> v1-121 base)) + ; (a0-57 (the-as object (-> *prototype-tie-work* vanish-last))) + ; ) + ; (let ((a3-37 (-> *prototype-tie-work* vanish-next))) + ; (set! (-> (the-as (pointer uint128) a1-73)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-73)) + ; (logior (logand (-> (the-as (pointer uint64) a1-73)) (the-as uint #x80000000ffffffff)) (shr (shl a3-37 33) 1)) + ; ) + ; ) + ; (let ((a1-77 (logior (logand (-> (the-as (pointer uint64) a0-57) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-73 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-57) a1-77) + ; ) + ; ) + ; (&+! (-> v1-121 base) 16) + ; ) + ; (let ((v1-129 *dma-mem-usage*)) + ; (when (nonzero? v1-129) + ; (set! (-> v1-129 length) (max 10 (-> v1-129 length))) + ; (set! (-> v1-129 data 9 name) "tie-fragment") + ; (+! (-> v1-129 data 9 count) 1) + ; (+! (-> v1-129 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-4)) + ; ) + ; (set! (-> v1-129 data 9 total) (-> v1-129 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask tie-scissor-trans) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* scissor-trans-count)) + ; (let ((s5-5 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-146 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id tie-scissor-l0-alpha) + ; (bucket-id tie-scissor-l1-alpha) + ; (bucket-id tie-scissor-l2-alpha) + ; (bucket-id tie-scissor-l3-alpha) + ; (bucket-id tie-scissor-l4-alpha) + ; (bucket-id tie-scissor-l5-alpha) + ; (bucket-id tie-scissor-l6-alpha) + ; (bucket-id tie-scissor-l7-alpha) + ; (bucket-id tie-scissor-l8-alpha) + ; (bucket-id tie-scissor-l9-alpha) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-91 (-> v1-146 base)) + ; (a0-72 (the-as object (-> *prototype-tie-work* scissor-trans-last))) + ; ) + ; (let ((a3-46 (-> *prototype-tie-work* scissor-trans-next))) + ; (set! (-> (the-as (pointer uint128) a1-91)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-91)) + ; (logior (logand (-> (the-as (pointer uint64) a1-91)) (the-as uint #x80000000ffffffff)) (shr (shl a3-46 33) 1)) + ; ) + ; ) + ; (let ((a1-95 (logior (logand (-> (the-as (pointer uint64) a0-72) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-91 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-72) a1-95) + ; ) + ; ) + ; (&+! (-> v1-146 base) 16) + ; ) + ; (let ((v1-154 *dma-mem-usage*)) + ; (when (nonzero? v1-154) + ; (set! (-> v1-154 length) (max 16 (-> v1-154 length))) + ; (set! (-> v1-154 data 15 name) "tie-scissor") + ; (+! (-> v1-154 data 15 count) 1) + ; (+! (-> v1-154 data 15 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-5)) + ; ) + ; (set! (-> v1-154 data 15 total) (-> v1-154 data 15 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask tie-trans) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* trans-count)) + ; (let ((s5-6 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-171 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id tie-l0-alpha) + ; (bucket-id tie-l1-alpha) + ; (bucket-id tie-l2-alpha) + ; (bucket-id tie-l3-alpha) + ; (bucket-id tie-l4-alpha) + ; (bucket-id tie-l5-alpha) + ; (bucket-id tie-l6-alpha) + ; (bucket-id tie-l7-alpha) + ; (bucket-id tie-l8-alpha) + ; (bucket-id tie-l9-alpha) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-109 (-> v1-171 base)) + ; (a0-87 (the-as object (-> *prototype-tie-work* trans-last))) + ; ) + ; (let ((a3-55 (-> *prototype-tie-work* trans-next))) + ; (set! (-> (the-as (pointer uint128) a1-109)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-109)) + ; (logior (logand (-> (the-as (pointer uint64) a1-109)) (the-as uint #x80000000ffffffff)) + ; (shr (shl a3-55 33) 1) + ; ) + ; ) + ; ) + ; (let ((a1-113 (logior (logand (-> (the-as (pointer uint64) a0-87) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-109 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-87) a1-113) + ; ) + ; ) + ; (&+! (-> v1-171 base) 16) + ; ) + ; (let ((v1-179 *dma-mem-usage*)) + ; (when (nonzero? v1-179) + ; (set! (-> v1-179 length) (max 10 (-> v1-179 length))) + ; (set! (-> v1-179 data 9 name) "tie-fragment") + ; (+! (-> v1-179 data 9 count) 1) + ; (+! (-> v1-179 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-6)) + ; ) + ; (set! (-> v1-179 data 9 total) (-> v1-179 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask etie-trans) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* envmap-trans-count)) + ; (let ((s5-7 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-196 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id etie-l0-alpha) + ; (bucket-id etie-l1-alpha) + ; (bucket-id etie-l02alpha) + ; (bucket-id etie-l3-alpha) + ; (bucket-id etie-l4-alpha) + ; (bucket-id etie-l5-alpha) + ; (bucket-id etie-l6-alpha) + ; (bucket-id etie-l7-alpha) + ; (bucket-id etie-l8-alpha) + ; (bucket-id etie-l9-alpha) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-127 (-> v1-196 base)) + ; (a0-102 (the-as object (-> *prototype-tie-work* envmap-trans-last))) + ; ) + ; (let ((a3-64 (-> *prototype-tie-work* envmap-trans-next))) + ; (set! (-> (the-as (pointer uint128) a1-127)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-127)) + ; (logior (logand (-> (the-as (pointer uint64) a1-127)) (the-as uint #x80000000ffffffff)) + ; (shr (shl a3-64 33) 1) + ; ) + ; ) + ; ) + ; (let ((a1-131 (logior (logand (-> (the-as (pointer uint64) a0-102) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-127 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-102) a1-131) + ; ) + ; ) + ; (&+! (-> v1-196 base) 16) + ; ) + ; (let ((v1-204 *dma-mem-usage*)) + ; (when (nonzero? v1-204) + ; (set! (-> v1-204 length) (max 10 (-> v1-204 length))) + ; (set! (-> v1-204 data 9 name) "tie-fragment") + ; (+! (-> v1-204 data 9 count) 1) + ; (+! (-> v1-204 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-7)) + ; ) + ; (set! (-> v1-204 data 9 total) (-> v1-204 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask etie-scissor-trans) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* envmap-scissor-trans-count)) + ; (let ((s5-8 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-221 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id etie-scissor-l0-alpha) + ; (bucket-id etie-scissor-l1-alpha) + ; (bucket-id etie-scissor-l2-alpha) + ; (bucket-id etie-scissor-l3-alpha) + ; (bucket-id etie-scissor-l4-alpha) + ; (bucket-id etie-scissor-l5-alpha) + ; (bucket-id etie-scissor-l6-alpha) + ; (bucket-id etie-scissor-l7-alpha) + ; (bucket-id etie-scissor-l8-alpha) + ; (bucket-id etie-scissor-l9-alpha) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-145 (-> v1-221 base)) + ; (a0-117 (the-as object (-> *prototype-tie-work* envmap-scissor-trans-last))) + ; ) + ; (let ((a3-73 (-> *prototype-tie-work* envmap-scissor-trans-next))) + ; (set! (-> (the-as (pointer uint128) a1-145)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-145)) + ; (logior (logand (-> (the-as (pointer uint64) a1-145)) (the-as uint #x80000000ffffffff)) + ; (shr (shl a3-73 33) 1) + ; ) + ; ) + ; ) + ; (let ((a1-149 (logior (logand (-> (the-as (pointer uint64) a0-117) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-145 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-117) a1-149) + ; ) + ; ) + ; (&+! (-> v1-221 base) 16) + ; ) + ; (let ((v1-229 *dma-mem-usage*)) + ; (when (nonzero? v1-229) + ; (set! (-> v1-229 length) (max 10 (-> v1-229 length))) + ; (set! (-> v1-229 data 9 name) "tie-fragment") + ; (+! (-> v1-229 data 9 count) 1) + ; (+! (-> v1-229 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-8)) + ; ) + ; (set! (-> v1-229 data 9 total) (-> v1-229 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask tie-scissor-water) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* scissor-water-count)) + ; (let ((s5-9 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-246 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id tie-scissor-l0-water) + ; (bucket-id tie-scissor-l1-water) + ; (bucket-id tie-scissor-l2-water) + ; (bucket-id tie-scissor-l3-water) + ; (bucket-id tie-scissor-l4-water) + ; (bucket-id tie-scissor-l5-water) + ; (bucket-id tie-scissor-l6-water) + ; (bucket-id tie-scissor-l7-water) + ; (bucket-id tie-scissor-l8-water) + ; (bucket-id tie-scissor-l9-water) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-163 (-> v1-246 base)) + ; (a0-132 (the-as object (-> *prototype-tie-work* scissor-water-last))) + ; ) + ; (let ((a3-82 (-> *prototype-tie-work* scissor-water-next))) + ; (set! (-> (the-as (pointer uint128) a1-163)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-163)) + ; (logior (logand (-> (the-as (pointer uint64) a1-163)) (the-as uint #x80000000ffffffff)) + ; (shr (shl a3-82 33) 1) + ; ) + ; ) + ; ) + ; (let ((a1-167 (logior (logand (-> (the-as (pointer uint64) a0-132) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-163 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-132) a1-167) + ; ) + ; ) + ; (&+! (-> v1-246 base) 16) + ; ) + ; (let ((v1-254 *dma-mem-usage*)) + ; (when (nonzero? v1-254) + ; (set! (-> v1-254 length) (max 16 (-> v1-254 length))) + ; (set! (-> v1-254 data 15 name) "tie-scissor") + ; (+! (-> v1-254 data 15 count) 1) + ; (+! (-> v1-254 data 15 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-9)) + ; ) + ; (set! (-> v1-254 data 15 total) (-> v1-254 data 15 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask tie-water) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* water-count)) + ; (let ((s5-10 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-271 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id tie-l0-water) + ; (bucket-id tie-l1-water) + ; (bucket-id tie-l2-water) + ; (bucket-id tie-l3-water) + ; (bucket-id tie-l4-water) + ; (bucket-id tie-l5-water) + ; (bucket-id tie-l6-water) + ; (bucket-id tie-l7-water) + ; (bucket-id tie-l8-water) + ; (bucket-id tie-l9-water) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-181 (-> v1-271 base)) + ; (a0-147 (the-as object (-> *prototype-tie-work* water-last))) + ; ) + ; (let ((a3-91 (-> *prototype-tie-work* water-next))) + ; (set! (-> (the-as (pointer uint128) a1-181)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-181)) + ; (logior (logand (-> (the-as (pointer uint64) a1-181)) (the-as uint #x80000000ffffffff)) + ; (shr (shl a3-91 33) 1) + ; ) + ; ) + ; ) + ; (let ((a1-185 (logior (logand (-> (the-as (pointer uint64) a0-147) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-181 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-147) a1-185) + ; ) + ; ) + ; (&+! (-> v1-271 base) 16) + ; ) + ; (let ((v1-279 *dma-mem-usage*)) + ; (when (nonzero? v1-279) + ; (set! (-> v1-279 length) (max 10 (-> v1-279 length))) + ; (set! (-> v1-279 data 9 name) "tie-fragment") + ; (+! (-> v1-279 data 9 count) 1) + ; (+! (-> v1-279 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-10)) + ; ) + ; (set! (-> v1-279 data 9 total) (-> v1-279 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask etie-water) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* envmap-water-count)) + ; (let ((s5-11 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (with-dma-buffer-add-bucket ((v1-296 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id etie-l0-water) + ; (bucket-id etie-l1-water) + ; (bucket-id etie-l2-water) + ; (bucket-id etie-l3-water) + ; (bucket-id etie-l4-water) + ; (bucket-id etie-l5-water) + ; (bucket-id etie-l6-water) + ; (bucket-id etie-l7-water) + ; (bucket-id etie-l8-water) + ; (bucket-id etie-l9-water) + ; ) + ; (-> arg1 draw-index) + ; ) + ; ) + ; (let ((a1-199 (-> v1-296 base)) + ; (a0-162 (the-as object (-> *prototype-tie-work* envmap-water-last))) + ; ) + ; (let ((a3-100 (-> *prototype-tie-work* envmap-water-next))) + ; (set! (-> (the-as (pointer uint128) a1-199)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-199)) + ; (logior (logand (-> (the-as (pointer uint64) a1-199)) (the-as uint #x80000000ffffffff)) + ; (shr (shl a3-100 33) 1) + ; ) + ; ) + ; ) + ; (let ((a1-203 (logior (logand (-> (the-as (pointer uint64) a0-162) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-199 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-162) a1-203) + ; ) + ; ) + ; (&+! (-> v1-296 base) 16) + ; ) + ; (let ((v1-304 *dma-mem-usage*)) + ; (when (nonzero? v1-304) + ; (set! (-> v1-304 length) (max 10 (-> v1-304 length))) + ; (set! (-> v1-304 data 9 name) "tie-fragment") + ; (+! (-> v1-304 data 9 count) 1) + ; (+! (-> v1-304 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-11)) + ; ) + ; (set! (-> v1-304 data 9 total) (-> v1-304 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (when (logtest? (vu1-renderer-mask etie-scissor-water) (-> *display* vu1-enable-user)) + ; (when (nonzero? (-> *prototype-tie-work* envmap-scissor-water-count)) + ; (let* ((s5-12 (-> *display* frames (-> *display* on-screen) global-buf base)) + ; (v1-320 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (a2-120 (-> v1-320 base)) + ; ) + ; (let ((a1-217 (-> v1-320 base)) + ; (a0-176 (the-as object (-> *prototype-tie-work* envmap-scissor-water-last))) + ; ) + ; (let ((a3-109 (-> *prototype-tie-work* envmap-scissor-water-next))) + ; (set! (-> (the-as (pointer uint128) a1-217)) (-> *prototype-tie-work* model-next quad)) + ; (set! (-> (the-as (pointer uint64) a1-217)) + ; (logior (logand (-> (the-as (pointer uint64) a1-217)) (the-as uint #x80000000ffffffff)) + ; (shr (shl a3-109 33) 1) + ; ) + ; ) + ; ) + ; (let ((a1-221 (logior (logand (-> (the-as (pointer uint64) a0-176) 0) (the-as uint #x80000000ffffffff)) + ; (shr (shl (the-as int (&+ a1-217 16)) 33) 1) + ; ) + ; ) + ; ) + ; (s.d! (the-as uint a0-176) a1-221) + ; ) + ; ) + ; (&+! (-> v1-320 base) 16) + ; (let* ((a3-115 (-> v1-320 base)) + ; (v0-12 (when (!= a2-120 a3-115) + ; (let ((a0-179 (-> v1-320 base))) + ; (set! (-> (the-as (pointer int64) a0-179)) #x20000000) + ; (s.w! (+ a0-179 8) 0) + ; (s.w! (+ a0-179 12) 0) + ; (set! (-> v1-320 base) (&+ a0-179 16)) + ; ) + ; (dma-bucket-insert-tag + ; (-> *display* frames (-> *display* on-screen) bucket-group) + ; (-> (new 'static 'array bucket-id 10 + ; (bucket-id etie-scissor-l0-water) + ; (bucket-id etie-scissor-l1-water) + ; (bucket-id etie-scissor-l2-water) + ; (bucket-id etie-scissor-l3-water) + ; (bucket-id etie-scissor-l4-water) + ; (bucket-id etie-scissor-l5-water) + ; (bucket-id etie-scissor-l6-water) + ; (bucket-id etie-scissor-l7-water) + ; (bucket-id etie-scissor-l8-water) + ; (bucket-id etie-scissor-l9-water) + ; ) + ; (-> arg1 draw-index) + ; ) + ; a2-120 + ; (the-as (pointer dma-tag) a3-115) + ; ) + ; ) + ; ) + ; ) + ; (let ((v1-328 *dma-mem-usage*)) + ; (when (nonzero? v1-328) + ; (set! (-> v1-328 length) (max 10 (-> v1-328 length))) + ; (set! (-> v1-328 data 9 name) "tie-fragment") + ; (+! (-> v1-328 data 9 count) 1) + ; (+! (-> v1-328 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-12)) + ; ) + ; (set! (-> v1-328 data 9 total) (-> v1-328 data 9 used)) + ; ) + ; ) + ; v0-12 + ; ) + ; ) + ; ) + ; ) + (the object 0) + ) + +(defun draw-drawable-tree-instance-tie ((arg0 drawable-tree-instance-tie) (arg1 level)) + ; (local-vars (v0-9 object) (a0-42 int) (a0-44 int) (a0-55 int) (a0-57 int) (sv-16 int)) + ; (when (logtest? (vu1-renderer-mask + ; tie-scissor + ; tie + ; etie + ; etie-scissor + ; tie-vanish + ; generic + ; tie-scissor-trans + ; tie-trans + ; etie-trans + ; etie-scissor-trans + ; ) + ; (-> *display* vu1-enable-user) + ; ) + ; (set! (-> *instance-tie-work* wind-vectors) (-> arg0 prototypes wind-vectors)) + ; (let ((s5-0 (+ (-> arg0 length) -1))) + ; (when (nonzero? s5-0) + ; (dotimes (s4-0 s5-0) + ; (let* ((v1-9 (-> arg0 data s4-0)) + ; (a0-7 (-> arg0 data (+ s4-0 1))) + ; (a1-2 (/ (-> (the-as drawable-inline-array-node v1-9) data 0 id) 8)) + ; (a0-9 (/ (-> (the-as drawable-inline-array-node a0-7) data 0 id) 8)) + ; (a1-4 (+ a1-2 #x3800 #x70000000)) + ; (a0-11 (+ a0-9 #x3800 #x70000000)) + ; ) + ; (draw-node-cull + ; (the-as pointer a0-11) + ; (the-as pointer a1-4) + ; (-> (the-as drawable-inline-array-node v1-9) data) + ; (-> (the-as drawable-inline-array-node v1-9) length) + ; ) + ; ) + ; ) + ; ) + ; (let* ((s2-0 (-> arg0 data s5-0)) + ; (s3-0 (-> arg0 prototypes prototype-array-tie)) + ; (s4-1 (-> s3-0 length)) + ; (s5-1 (-> *display* frames (-> *display* on-screen) global-buf)) + ; (s0-0 (-> s5-1 base)) + ; (s1-1 (&- (-> s5-1 end) (the-as uint (* (-> arg0 prototypes prototype-max-qwc) 16)))) + ; ) + ; (when *debug-segment* + ; (if (>= (the-as uint s0-0) (the-as uint s1-1)) + ; (format *stdcon* "out of tie memory~%") + ; ) + ; ) + ; (when (< (the-as uint s0-0) (the-as uint s1-1)) + ; (set! (-> *instance-tie-work* buffer-start) (the-as uint (-> s5-1 base))) + ; (set! (-> *instance-tie-work* buffer-end) (the-as uint s1-1)) + ; (dotimes (v1-28 16) + ; (set! (-> *prototype-tie-work* last v1-28) (the-as uint 0)) + ; (set! (-> *prototype-tie-work* next v1-28) (the-as uint 0)) + ; (set! (-> *prototype-tie-work* count v1-28) (the-as uint 0)) + ; ) + ; (dotimes (v1-31 s4-1) + ; (let ((a0-26 (-> s3-0 array-data v1-31))) + ; (dotimes (a1-9 3) + ; (set! (-> a0-26 next-clear a1-9) (the-as uint128 0)) + ; (set! (-> a0-26 count-clear a1-9) (the-as uint 0)) + ; ) + ; ) + ; ) + ; (let* ((s1-2 (&+ s2-0 32)) + ; (s0-1 (+ (/ (-> s1-2 id) 8) #x3800 #x70000000)) + ; ) + ; (set! sv-16 (-> (the-as drawable-inline-array-instance-tie s2-0) length)) + ; (when (nonzero? sv-16) + ; (let* ((v1-41 (logand (the-as int *gsf-buffer*) 8191)) + ; (v1-43 + ; (the-as + ; object + ; (logand (the-as int (&- (logand (the-as int (&-> (-> s3-0 data) -640)) 8191) (the-as uint v1-41))) 8191) + ; ) + ; ) + ; ) + ; (set! *instance-tie-work-copy* (the-as instance-tie-work (+ (the-as int *gsf-buffer*) (the-as int v1-43)))) + ; ) + ; (quad-copy! (the-as pointer *instance-tie-work-copy*) (the-as pointer *instance-tie-work*) 35) + ; (let ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + ; (set! (-> *instance-tie-work-copy* wait-to-spr) (the-as uint 0)) + ; (set! (-> *instance-tie-work-copy* wait-from-spr) (the-as uint 0)) + ; (set! (-> *instance-tie-work-copy* tfrag-dists) (the-as uint (-> arg1 bsp tfrag-closest))) + ; (set! (-> *instance-tie-work-copy* alpha-dists) (the-as uint (-> arg1 bsp alpha-closest))) + ; (set! (-> *instance-tie-work-copy* water-dists) (the-as uint (-> arg1 bsp water-closest))) + ; (let* ((v1-61 (-> *perf-stats* data 46)) + ; (a0-39 (-> v1-61 ctrl)) + ; ) + ; (+! (-> v1-61 count) 1) + ; (b! (zero? a0-39) cfg-23 :delay (nop!)) + ; (.mtc0 Perf 0) + ; (.sync.l) + ; (.sync.p) + ; (.mtpc pcr0 0) + ; (.mtpc pcr1 0) + ; (.sync.l) + ; (.sync.p) + ; (.mtc0 Perf a0-39) + ; ) + ; (.sync.l) + ; (.sync.p) + ; (label cfg-23) + ; 0 + ; (let ((t9-3 draw-inline-array-instance-tie) + ; (a3-1 s5-1) + ; ) + ; (t9-3 (the-as pointer s0-1) (the-as (inline-array instance-tie) s1-2) sv-16 a3-1) + ; ) + ; (let ((v1-64 (-> *perf-stats* data 46))) + ; (b! (zero? (-> v1-64 ctrl)) cfg-25 :delay (nop!)) + ; (.mtc0 Perf 0) + ; (.sync.l) + ; (.sync.p) + ; (.mfpc a0-42 pcr0) + ; (+! (-> v1-64 accum0) a0-42) + ; (.mfpc a0-44 pcr1) + ; (+! (-> v1-64 accum1) a0-44) + ; ) + ; (label cfg-25) + ; 0 + ; (update-wait-stats + ; (-> *perf-stats* data 46) + ; (the-as uint 0) + ; (-> *instance-tie-work-copy* wait-to-spr) + ; (-> *instance-tie-work-copy* wait-from-spr) + ; ) + ; (let ((v1-71 (-> *instance-tie-work-copy* min-dist quad))) + ; (set! (-> *instance-tie-work* min-dist quad) v1-71) + ; ) + ; (set! (-> *instance-tie-work* flags) (-> *instance-tie-work-copy* flags)) + ; (if (and *debug-segment* (< (the-as int (-> *instance-tie-work* buffer-end)) (the-as int (-> s5-1 base)))) + ; (format *stdcon* "out of tie memory~%") + ; ) + ; (when (>= (the-as int (-> *instance-tie-work* buffer-end)) (the-as int (-> s5-1 base))) + ; (set! (-> *prototype-tie-work* wait-to-spr) (the-as uint 0)) + ; (set! (-> *prototype-tie-work* wait-from-spr) (the-as uint 0)) + ; (let* ((v1-85 (-> *perf-stats* data 47)) + ; (a0-52 (-> v1-85 ctrl)) + ; ) + ; (+! (-> v1-85 count) 1) + ; (b! (zero? a0-52) cfg-33 :delay (nop!)) + ; (.mtc0 Perf 0) + ; (.sync.l) + ; (.sync.p) + ; (.mtpc pcr0 0) + ; (.mtpc pcr1 0) + ; (.sync.l) + ; (.sync.p) + ; (.mtc0 Perf a0-52) + ; ) + ; (.sync.l) + ; (.sync.p) + ; (label cfg-33) + ; 0 + ; (draw-inline-array-prototype-tie-asm s5-1 s4-1 s3-0) + ; (let ((v1-88 (-> *perf-stats* data 47))) + ; (b! (zero? (-> v1-88 ctrl)) cfg-35 :delay (nop!)) + ; (.mtc0 Perf 0) + ; (.sync.l) + ; (.sync.p) + ; (.mfpc a0-55 pcr0) + ; (+! (-> v1-88 accum0) a0-55) + ; (.mfpc a0-57 pcr1) + ; (+! (-> v1-88 accum1) a0-57) + ; ) + ; (label cfg-35) + ; 0 + ; (update-wait-stats + ; (-> *perf-stats* data 47) + ; (the-as uint 0) + ; (-> *prototype-tie-work* wait-to-spr) + ; (-> *prototype-tie-work* wait-from-spr) + ; ) + ; ) + ; (let ((a0-60 *dma-mem-usage*)) + ; (when (nonzero? a0-60) + ; (set! (-> a0-60 length) (max 10 (-> a0-60 length))) + ; (set! (-> a0-60 data 9 name) "tie-fragment") + ; (+! (-> a0-60 data 9 count) 1) + ; (+! (-> a0-60 data 9 used) + ; (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s2-1)) + ; ) + ; (set! (-> a0-60 data 9 total) (-> a0-60 data 9 used)) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (set! v0-9 (cond + ; ((< (the-as int (-> *instance-tie-work* buffer-end)) (the-as int (-> s5-1 base))) + ; (if *debug-segment* + ; (format *stdcon* "out of tie memory~%") + ; ) + ; (set! v0-9 (-> *instance-tie-work* buffer-start)) + ; (set! (-> s5-1 base) (the-as pointer v0-9)) + ; v0-9 + ; ) + ; (else + ; (instance-tie-patch-buckets s5-1 arg1) + ; ) + ; ) + ; ) + ; ) + ; ) + ; ) + ; ) + ; (set! (-> arg1 tie-min-dist) (-> *instance-tie-work* min-dist x)) + ; 0 + (none) + ) + +;; ERROR: failed type prop at 40: Unknown symbol: tie-near-init-engine +;; WARN: Return type mismatch symbol vs none. +(defun tie-init-scissor-buf ((a0-0 bucket-id) (a1-0 gs-alpha) (a2-0 gs-test) (a3-0 gs-test)) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun tie-init-buf ((arg0 bucket-id) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test)) + (let ((v1-0 *display*) + (a0-1 80) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t1-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t1-0 real-buffer-end) (the-as int (&+ (-> t1-0 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((s5-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s5-0 (-> s5-0 last)) + (let* ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s3-1 (-> s4-0 base)) + ) + (tie-init-engine s4-0 arg1 arg2 arg3) + (let* ((v1-14 s4-0) + (a0-9 (the-as dma-packet (-> v1-14 base))) + ) + (set! (-> a0-9 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-9 vif0) (new 'static 'vif-tag)) + (set! (-> a0-9 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-14 base) (the-as pointer (&+ a0-9 16))) + ) + (let* ((v1-15 s4-0) + (a0-11 (the-as gs-gif-tag (-> v1-15 base))) + ) + (set! (-> a0-11 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-11 regs) GIF_REGS_ALL_AD) + (set! (-> v1-15 base) (the-as pointer (&+ a0-11 16))) + ) + (let* ((v1-16 s4-0) + (a0-13 (-> v1-16 base)) + ) + (set! (-> (the-as (pointer gs-zbuf) a0-13) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (set! (-> (the-as (pointer gs-reg64) a0-13) 1) (gs-reg64 zbuf-1)) + (set! (-> v1-16 base) (&+ a0-13 16)) + ) + (let ((v1-17 (the-as object (-> s4-0 base)))) + (set! (-> (the-as dma-packet v1-17) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s5-0 next))) + (set! (-> (the-as dma-packet v1-17) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-17) vif1) (new 'static 'vif-tag)) + (set! (-> s4-0 base) (the-as pointer (&+ (the-as dma-packet v1-17) 16))) + ) + (set! (-> s5-0 next) (the-as uint s3-1)) + ) + ) + ) + (let ((gp-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= gp-1 (-> gp-1 last)) + (let* ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s5-1 (-> s4-1 base)) + ) + (tie-end-buffer s4-1) + (let ((v0-5 (-> s4-1 base))) + (let ((v1-31 (the-as dma-packet (-> s4-1 base)))) + (set! (-> v1-31 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-31 vif0) (new 'static 'vif-tag)) + (set! (-> v1-31 vif1) (new 'static 'vif-tag)) + (set! (-> s4-1 base) (the-as pointer (&+ v1-31 16))) + ) + (set! (-> (the-as (pointer uint32) (-> gp-1 last)) 1) (the-as uint s5-1)) + (set! (-> gp-1 last) (the-as (pointer dma-tag) v0-5)) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +;; ERROR: Failed store: (s.w! (+ v1-14 8) 0) at op 50 +;; ERROR: Failed store: (s.w! (+ v1-14 12) 0) at op 51 +;; ERROR: Failed store: (s.w! (+ v1-28 8) 0) at op 81 +;; ERROR: Failed store: (s.w! (+ v1-28 12) 0) at op 82 +;; ERROR: Failed store: (s.w! (+ v1-30 4) s5-1) at op 86 +(defun tie-init-envmap-buf ((arg0 bucket-id) (arg1 gs-alpha) (arg2 gs-test)) + (none) + ) + +;; ERROR: failed type prop at 40: Unknown symbol: etn-init-engine +;; WARN: Return type mismatch symbol vs none. +(defun tie-init-envmap-scissor-buf ((a0-0 bucket-id) (a1-0 gs-alpha) (a2-0 int) (a3-0 int)) + (none) + ) + +(deftype tie-init-data (structure) + ((tie-bucket bucket-id) + (tie-scissor-bucket bucket-id) + (tie-envmap-bucket bucket-id) + (tie-envmap-scissor-bucket bucket-id) + (tie-vanish-bucket bucket-id) + (tie-trans-bucket bucket-id) + (tie-scissor-trans-bucket bucket-id) + (tie-envmap-trans-bucket bucket-id) + (tie-envmap-scissor-trans-bucket bucket-id) + (tie-water-bucket bucket-id) + (tie-scissor-water-bucket bucket-id) + (tie-envmap-water-bucket bucket-id) + (tie-envmap-scissor-water-bucket bucket-id) + ) + ) + + +(define *tie-init-table* (new 'static 'inline-array tie-init-data 10 + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l0-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l0-tfrag) + :tie-envmap-bucket (bucket-id etie-l0-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l0-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l0-tfrag) + :tie-trans-bucket (bucket-id tie-l0-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l0-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l0-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l0-alpha) + :tie-water-bucket (bucket-id tie-l0-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l0-water) + :tie-envmap-water-bucket (bucket-id etie-l0-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l0-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l1-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l1-tfrag) + :tie-envmap-bucket (bucket-id etie-l1-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l1-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l1-tfrag) + :tie-trans-bucket (bucket-id tie-l1-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l1-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l1-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l1-alpha) + :tie-water-bucket (bucket-id tie-l1-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l1-water) + :tie-envmap-water-bucket (bucket-id etie-l1-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l1-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l2-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l2-tfrag) + :tie-envmap-bucket (bucket-id etie-l2-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l2-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l2-tfrag) + :tie-trans-bucket (bucket-id tie-l2-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l2-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l02alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l2-alpha) + :tie-water-bucket (bucket-id tie-l2-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l2-water) + :tie-envmap-water-bucket (bucket-id etie-l2-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l2-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l3-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l3-tfrag) + :tie-envmap-bucket (bucket-id etie-l3-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l3-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l3-tfrag) + :tie-trans-bucket (bucket-id tie-l3-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l3-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l3-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l3-alpha) + :tie-water-bucket (bucket-id tie-l3-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l3-water) + :tie-envmap-water-bucket (bucket-id etie-l3-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l3-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l4-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l4-tfrag) + :tie-envmap-bucket (bucket-id etie-l4-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l4-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l4-tfrag) + :tie-trans-bucket (bucket-id tie-l4-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l4-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l4-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l4-alpha) + :tie-water-bucket (bucket-id tie-l4-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l4-water) + :tie-envmap-water-bucket (bucket-id etie-l4-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l4-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l5-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l5-tfrag) + :tie-envmap-bucket (bucket-id etie-l5-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l5-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l5-tfrag) + :tie-trans-bucket (bucket-id tie-l5-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l5-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l5-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l5-alpha) + :tie-water-bucket (bucket-id tie-l5-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l5-water) + :tie-envmap-water-bucket (bucket-id etie-l5-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l5-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l6-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l6-tfrag) + :tie-envmap-bucket (bucket-id etie-l6-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l6-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l6-tfrag) + :tie-trans-bucket (bucket-id tie-l6-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l6-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l6-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l6-alpha) + :tie-water-bucket (bucket-id tie-l6-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l6-water) + :tie-envmap-water-bucket (bucket-id etie-l6-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l6-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l7-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l7-tfrag) + :tie-envmap-bucket (bucket-id etie-l7-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l7-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l7-tfrag) + :tie-trans-bucket (bucket-id tie-l7-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l7-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l7-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l7-alpha) + :tie-water-bucket (bucket-id tie-l7-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l7-water) + :tie-envmap-water-bucket (bucket-id etie-l7-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l7-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l8-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l8-tfrag) + :tie-envmap-bucket (bucket-id etie-l8-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l8-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l8-tfrag) + :tie-trans-bucket (bucket-id tie-l8-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l8-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l8-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l8-alpha) + :tie-water-bucket (bucket-id tie-l8-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l8-water) + :tie-envmap-water-bucket (bucket-id etie-l8-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l8-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l9-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l9-tfrag) + :tie-envmap-bucket (bucket-id etie-l9-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l9-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l9-tfrag) + :tie-trans-bucket (bucket-id tie-l9-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l9-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l9-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l9-alpha) + :tie-water-bucket (bucket-id tie-l9-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l9-water) + :tie-envmap-water-bucket (bucket-id etie-l9-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l9-water) + ) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun tie-vu1-init-buffers () + (let ((gp-0 0) + (s5-0 100) + (s4-0 68) + ) + (dotimes (s3-0 10) + (let ((v1-2 (-> *level* draw-level s3-0)) + (s2-0 (-> *tie-init-table* s3-0)) + ) + (when v1-2 + (tie-init-buf + (-> s2-0 tie-bucket) + (the-as gs-alpha gp-0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (let ((t9-1 tie-init-scissor-buf) + (a0-3 (-> s2-0 tie-scissor-bucket)) + (a1-2 0) + (a2-1 #x5026b) + (a3-1 #x50000) + ) + (t9-1 a0-3 (the-as gs-alpha a1-2) (the-as gs-test a2-1) (the-as gs-test a3-1)) + (tie-init-envmap-buf + (-> s2-0 tie-envmap-bucket) + (the-as gs-alpha gp-0) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-envmap-scissor-buf (-> s2-0 tie-envmap-scissor-bucket) (the-as gs-alpha gp-0) #x50000 a3-1) + ) + (tie-init-buf + (-> s2-0 tie-vanish-bucket) + (the-as gs-alpha s5-0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-buf + (-> s2-0 tie-trans-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (let ((t9-6 tie-init-scissor-buf) + (a0-8 (-> s2-0 tie-scissor-trans-bucket)) + (a1-7 1) + (a2-6 #x5026b) + (a3-4 #x50000) + ) + (t9-6 a0-8 (the-as gs-alpha a1-7) (the-as gs-test a2-6) (the-as gs-test a3-4)) + (tie-init-envmap-buf + (-> s2-0 tie-envmap-trans-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-envmap-scissor-buf (-> s2-0 tie-envmap-scissor-trans-bucket) (the-as gs-alpha s4-0) #x50000 a3-4) + ) + (tie-init-buf + (-> s2-0 tie-water-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (let ((t9-10 tie-init-scissor-buf) + (a0-12 (-> s2-0 tie-scissor-water-bucket)) + (a1-11 1) + (a2-10 #x51001) + (a3-6 #x51001) + ) + (t9-10 a0-12 (the-as gs-alpha a1-11) (the-as gs-test a2-10) (the-as gs-test a3-6)) + (tie-init-envmap-buf + (-> s2-0 tie-envmap-water-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-envmap-scissor-buf (-> s2-0 tie-envmap-scissor-water-bucket) (the-as gs-alpha s4-0) #x51001 a3-6) + ) + ) + ) + ) + ) + (none) + ) + +(defmethod draw ((this drawable-tree-instance-tie)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tie-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tie-trees v1-1) this) + (set! (-> *background-work* tie-levels v1-1) a1-3) + ) + (+! (-> *background-work* tie-tree-count) 1) + 0 + (none) + ) + +(defmethod collect-stats ((this drawable-tree-instance-tie)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask + tie-scissor + tie + etie + tie-vanish + generic + tie-scissor-trans + tie-trans + etie-trans + tie-scissor-water + tie-water + etie-water + ) + (-> *display* vu1-enable-user) + ) + (-> this data (+ (-> this length) -1)) + (let ((v1-9 (-> this prototypes prototype-array-tie))) + (dotimes (a0-1 (-> v1-9 length)) + (let ((a1-4 (-> v1-9 array-data a0-1))) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask generic)) + (let ((a2-4 0) + (a3-0 2) + ) + (while (>= a3-0 a2-4) + (let ((t0-2 (-> a1-4 generic-count a2-4)) + (t2-0 (-> a1-4 tie-geom (+ a2-4 1))) + ) + (when (nonzero? t0-2) + (let ((t1-4 (the-as object (-> t2-0 data))) + (t2-1 (-> t2-0 length)) + ) + (+! (-> *terrain-stats* tie-generic groups) 1) + (+! (-> *terrain-stats* tie-generic fragments) t2-1) + (+! (-> *terrain-stats* tie-generic instances) t0-2) + (dotimes (t3-9 t2-1) + (let ((t5-0 (* (-> (the-as tie-fragment t1-4) debug num-tris) t0-2)) + (t4-7 (* (-> (the-as tie-fragment t1-4) debug num-dverts) t0-2)) + ) + (+! (-> *terrain-stats* tie-generic tris) t5-0) + (+! (-> *terrain-stats* tie-generic dverts) t4-7) + ) + (set! t1-4 (&+ (the-as tie-fragment t1-4) 64)) + ) + ) + ) + ) + (+! a2-4 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-vanish)) + (let ((a2-11 (-> a1-4 vanish-count)) + (t0-4 (-> a1-4 tie-geom 3)) + ) + (when (nonzero? a2-11) + (let ((a3-2 (the-as object (-> t0-4 data))) + (t0-5 (-> t0-4 length)) + ) + (+! (-> *terrain-stats* tie-vanish groups) 1) + (+! (-> *terrain-stats* tie-vanish fragments) t0-5) + (+! (-> *terrain-stats* tie-vanish instances) a2-11) + (dotimes (t1-15 t0-5) + (let ((t3-10 (* (-> (the-as tie-fragment a3-2) debug num-tris) a2-11)) + (t2-9 (* (-> (the-as tie-fragment a3-2) debug num-dverts) a2-11)) + ) + (+! (-> *terrain-stats* tie-vanish tris) t3-10) + (+! (-> *terrain-stats* tie-vanish dverts) t2-9) + ) + (set! a3-2 (&+ (the-as tie-fragment a3-2) 64)) + ) + ) + ) + ) + ) + (cond + ((logtest? (-> a1-4 flags) (prototype-flags tpage-water)) + (when (logtest? (vu1-renderer-mask tie-water) (-> *display* vu1-enable-user)) + (let ((a2-18 1) + (a3-6 3) + ) + (while (>= a3-6 a2-18) + (let ((t0-8 (-> a1-4 count a2-18)) + (t2-11 (-> a1-4 tie-geom a2-18)) + ) + (when (nonzero? t0-8) + (let ((t1-19 (the-as object (-> t2-11 data))) + (t2-12 (-> t2-11 length)) + ) + (+! (-> *terrain-stats* tie-water groups) 1) + (+! (-> *terrain-stats* tie-water fragments) t2-12) + (+! (-> *terrain-stats* tie-water instances) t0-8) + (dotimes (t3-24 t2-12) + (let ((t5-5 (* (-> (the-as tie-fragment t1-19) debug num-tris) t0-8)) + (t4-19 (* (-> (the-as tie-fragment t1-19) debug num-dverts) t0-8)) + ) + (+! (-> *terrain-stats* tie-water tris) t5-5) + (+! (-> *terrain-stats* tie-water dverts) t4-19) + ) + (set! t1-19 (&+ (the-as tie-fragment t1-19) 64)) + ) + ) + ) + ) + (+! a2-18 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + (let ((a2-25 (-> a1-4 tie-scissor-count)) + (t0-10 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-25) + (let ((a3-8 (the-as object (-> t0-10 data))) + (t0-11 (-> t0-10 length)) + ) + (+! (-> *terrain-stats* tie-scissor-water groups) 1) + (+! (-> *terrain-stats* tie-scissor-water fragments) t0-11) + (+! (-> *terrain-stats* tie-scissor-water instances) a2-25) + (dotimes (t1-30 t0-11) + (let ((t3-25 (* (-> (the-as tie-fragment a3-8) debug num-tris) a2-25)) + (t2-20 (* (-> (the-as tie-fragment a3-8) debug num-dverts) a2-25)) + ) + (+! (-> *terrain-stats* tie-scissor-water tris) t3-25) + (+! (-> *terrain-stats* tie-scissor-water dverts) t2-20) + ) + (set! a3-8 (&+ (the-as tie-fragment a3-8) 64)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-water) (-> *display* vu1-enable-user)) + (let ((a2-30 1) + (a3-12 3) + ) + (while (>= a3-12 a2-30) + (let ((t0-14 (-> a1-4 envmap-count a2-30)) + (t2-22 (-> a1-4 tie-geom a2-30)) + ) + (when (nonzero? t0-14) + (let ((t1-34 (the-as object (-> t2-22 data))) + (t2-23 (-> t2-22 length)) + ) + (+! (-> *terrain-stats* tie-envmap-water groups) 1) + (+! (-> *terrain-stats* tie-envmap-water fragments) t2-23) + (+! (-> *terrain-stats* tie-envmap-water instances) t0-14) + (dotimes (t3-39 t2-23) + (let ((t5-10 (* (* t0-14 (-> (the-as tie-fragment t1-34) debug num-tris)) 2)) + (t4-33 (* (* t0-14 (-> (the-as tie-fragment t1-34) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-water tris) t5-10) + (+! (-> *terrain-stats* tie-envmap-water dverts) t4-33) + ) + (set! t1-34 (&+ (the-as tie-fragment t1-34) 64)) + ) + ) + ) + ) + (+! a2-30 1) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-scissor-water) (-> *display* vu1-enable-user)) + (let ((a2-35 (-> a1-4 envmap-scissor-count)) + (t0-16 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-35) + (let ((a1-5 (the-as object (-> t0-16 data))) + (a3-17 (-> t0-16 length)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-water groups) 1) + (+! (-> *terrain-stats* tie-envmap-scissor-water fragments) a3-17) + (+! (-> *terrain-stats* tie-envmap-scissor-water instances) a2-35) + (dotimes (t0-26 a3-17) + (let ((t2-24 (* (* a2-35 (-> (the-as tie-fragment a1-5) debug num-tris)) 2)) + (t1-45 (* (* a2-35 (-> (the-as tie-fragment a1-5) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-water tris) t2-24) + (+! (-> *terrain-stats* tie-envmap-scissor-water dverts) t1-45) + ) + (set! a1-5 (&+ (the-as tie-fragment a1-5) 64)) + ) + ) + ) + ) + ) + ) + ((logtest? (-> a1-4 flags) (prototype-flags tpage-alpha)) + (when (logtest? (vu1-renderer-mask tie-trans) (-> *display* vu1-enable-user)) + (let ((a2-41 1) + (a3-21 3) + ) + (while (>= a3-21 a2-41) + (let ((t0-29 (-> a1-4 count a2-41)) + (t2-29 (-> a1-4 tie-geom a2-41)) + ) + (when (nonzero? t0-29) + (let ((t1-50 (the-as object (-> t2-29 data))) + (t2-30 (-> t2-29 length)) + ) + (+! (-> *terrain-stats* tie-trans groups) 1) + (+! (-> *terrain-stats* tie-trans fragments) t2-30) + (+! (-> *terrain-stats* tie-trans instances) t0-29) + (dotimes (t3-52 t2-30) + (let ((t5-15 (* (-> (the-as tie-fragment t1-50) debug num-tris) t0-29)) + (t4-42 (* (-> (the-as tie-fragment t1-50) debug num-dverts) t0-29)) + ) + (+! (-> *terrain-stats* tie-trans tris) t5-15) + (+! (-> *terrain-stats* tie-trans dverts) t4-42) + ) + (set! t1-50 (&+ (the-as tie-fragment t1-50) 64)) + ) + ) + ) + ) + (+! a2-41 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + (let ((a2-48 (-> a1-4 tie-scissor-count)) + (t0-31 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-48) + (let ((a3-23 (the-as object (-> t0-31 data))) + (t0-32 (-> t0-31 length)) + ) + (+! (-> *terrain-stats* tie-scissor-trans groups) 1) + (+! (-> *terrain-stats* tie-scissor-trans fragments) t0-32) + (+! (-> *terrain-stats* tie-scissor-trans instances) a2-48) + (dotimes (t1-61 t0-32) + (let ((t3-53 (* (-> (the-as tie-fragment a3-23) debug num-tris) a2-48)) + (t2-38 (* (-> (the-as tie-fragment a3-23) debug num-dverts) a2-48)) + ) + (+! (-> *terrain-stats* tie-scissor-trans tris) t3-53) + (+! (-> *terrain-stats* tie-scissor-trans dverts) t2-38) + ) + (set! a3-23 (&+ (the-as tie-fragment a3-23) 64)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-trans) (-> *display* vu1-enable-user)) + (let ((a2-53 1) + (a3-27 3) + ) + (while (>= a3-27 a2-53) + (let ((t0-35 (-> a1-4 envmap-count a2-53)) + (t2-40 (-> a1-4 tie-geom a2-53)) + ) + (when (nonzero? t0-35) + (let ((t1-65 (the-as object (-> t2-40 data))) + (t2-41 (-> t2-40 length)) + ) + (+! (-> *terrain-stats* tie-envmap-trans groups) 1) + (+! (-> *terrain-stats* tie-envmap-trans fragments) t2-41) + (+! (-> *terrain-stats* tie-envmap-trans instances) t0-35) + (dotimes (t3-67 t2-41) + (let ((t5-20 (* (* t0-35 (-> (the-as tie-fragment t1-65) debug num-tris)) 2)) + (t4-56 (* (* t0-35 (-> (the-as tie-fragment t1-65) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-trans tris) t5-20) + (+! (-> *terrain-stats* tie-envmap-trans dverts) t4-56) + ) + (set! t1-65 (&+ (the-as tie-fragment t1-65) 64)) + ) + ) + ) + ) + (+! a2-53 1) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-scissor-trans) (-> *display* vu1-enable-user)) + (let ((a2-58 (-> a1-4 envmap-scissor-count)) + (t0-37 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-58) + (let ((a1-7 (the-as object (-> t0-37 data))) + (a3-32 (-> t0-37 length)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-trans groups) 1) + (+! (-> *terrain-stats* tie-envmap-scissor-trans fragments) a3-32) + (+! (-> *terrain-stats* tie-envmap-scissor-trans instances) a2-58) + (dotimes (t0-47 a3-32) + (let ((t2-42 (* (* a2-58 (-> (the-as tie-fragment a1-7) debug num-tris)) 2)) + (t1-76 (* (* a2-58 (-> (the-as tie-fragment a1-7) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-trans tris) t2-42) + (+! (-> *terrain-stats* tie-envmap-scissor-trans dverts) t1-76) + ) + (set! a1-7 (&+ (the-as tie-fragment a1-7) 64)) + ) + ) + ) + ) + ) + ) + (else + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie)) + (let ((a2-63 1) + (a3-34 3) + ) + (while (>= a3-34 a2-63) + (let ((t0-50 (-> a1-4 count a2-63)) + (t2-47 (-> a1-4 tie-geom a2-63)) + ) + (when (nonzero? t0-50) + (let ((t1-81 (the-as object (-> t2-47 data))) + (t2-48 (-> t2-47 length)) + ) + (+! (-> *terrain-stats* tie groups) 1) + (+! (-> *terrain-stats* tie fragments) t2-48) + (+! (-> *terrain-stats* tie instances) t0-50) + (dotimes (t3-80 t2-48) + (let ((t5-25 (* (-> (the-as tie-fragment t1-81) debug num-tris) t0-50)) + (t4-65 (* (-> (the-as tie-fragment t1-81) debug num-dverts) t0-50)) + ) + (+! (-> *terrain-stats* tie tris) t5-25) + (+! (-> *terrain-stats* tie dverts) t4-65) + ) + (set! t1-81 (&+ (the-as tie-fragment t1-81) 64)) + ) + ) + ) + ) + (+! a2-63 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + (let ((a2-70 (-> a1-4 tie-scissor-count)) + (t0-52 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-70) + (let ((a3-36 (the-as object (-> t0-52 data))) + (t0-53 (-> t0-52 length)) + ) + (+! (-> *terrain-stats* tie-scissor groups) 1) + (+! (-> *terrain-stats* tie-scissor fragments) t0-53) + (+! (-> *terrain-stats* tie-scissor instances) a2-70) + (dotimes (t1-92 t0-53) + (let ((t3-81 (* (-> (the-as tie-fragment a3-36) debug num-tris) a2-70)) + (t2-56 (* (-> (the-as tie-fragment a3-36) debug num-dverts) a2-70)) + ) + (+! (-> *terrain-stats* tie-scissor tris) t3-81) + (+! (-> *terrain-stats* tie-scissor dverts) t2-56) + ) + (set! a3-36 (&+ (the-as tie-fragment a3-36) 64)) + ) + ) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie)) + (let ((a2-76 1) + (a3-38 3) + ) + (while (>= a3-38 a2-76) + (let ((t0-56 (-> a1-4 envmap-count a2-76)) + (t2-58 (-> a1-4 tie-geom a2-76)) + ) + (when (nonzero? t0-56) + (let ((t1-96 (the-as object (-> t2-58 data))) + (t2-59 (-> t2-58 length)) + ) + (+! (-> *terrain-stats* tie-envmap groups) 1) + (+! (-> *terrain-stats* tie-envmap fragments) t2-59) + (+! (-> *terrain-stats* tie-envmap instances) t0-56) + (dotimes (t3-95 t2-59) + (let ((t5-30 (* (* t0-56 (-> (the-as tie-fragment t1-96) debug num-tris)) 2)) + (t4-79 (* (* t0-56 (-> (the-as tie-fragment t1-96) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap tris) t5-30) + (+! (-> *terrain-stats* tie-envmap dverts) t4-79) + ) + (set! t1-96 (&+ (the-as tie-fragment t1-96) 64)) + ) + ) + ) + ) + (+! a2-76 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie-scissor)) + (let ((a2-82 (-> a1-4 envmap-scissor-count)) + (t0-58 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-82) + (let ((a1-9 (the-as object (-> t0-58 data))) + (a3-41 (-> t0-58 length)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor groups) 1) + (+! (-> *terrain-stats* tie-envmap-scissor fragments) a3-41) + (+! (-> *terrain-stats* tie-envmap-scissor instances) a2-82) + (dotimes (t0-68 a3-41) + (let ((t2-60 (* (* a2-82 (-> (the-as tie-fragment a1-9) debug num-tris)) 2)) + (t1-107 (* (* a2-82 (-> (the-as tie-fragment a1-9) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor tris) t2-60) + (+! (-> *terrain-stats* tie-envmap-scissor dverts) t1-107) + ) + (set! a1-9 (&+ (the-as tie-fragment a1-9) 64)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw ((this drawable-tree-instance-tie)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (-> this data (+ (-> this length) -1)) + (let* ((gp-0 (-> this prototypes prototype-array-tie)) + (s5-0 (-> gp-0 length)) + ) + (dotimes (s4-0 s5-0) + (debug-draw (-> gp-0 array-data s4-0 tie-geom 0)) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/gfx/background/tie/tie-near.gc b/goal_src/jak3/engine/gfx/background/tie/tie-near.gc index 779569c7a..af445d29e 100644 --- a/goal_src/jak3/engine/gfx/background/tie/tie-near.gc +++ b/goal_src/jak3/engine/gfx/background/tie/tie-near.gc @@ -7,3 +7,7 @@ ;; DECOMP BEGINS +(defun tie-scissor-make-perspective-matrix ((arg0 matrix) (arg1 matrix)) + (column-scale-matrix! arg0 (-> *math-camera* hmge-scale) arg1) + (none) + ) \ No newline at end of file diff --git a/goal_src/jak3/engine/gfx/background/tie/tie-work.gc b/goal_src/jak3/engine/gfx/background/tie/tie-work.gc index 1f4a6b66e..b23a618ba 100644 --- a/goal_src/jak3/engine/gfx/background/tie/tie-work.gc +++ b/goal_src/jak3/engine/gfx/background/tie/tie-work.gc @@ -9,3 +9,162 @@ ;; DECOMP BEGINS +(define *instance-tie-work* (new 'static 'instance-tie-work + :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0) + :constant (new 'static 'vector :x 4096.0 :y 128.0) + :far-morph (new 'static 'vector :x 1.0 :w 256.0) + :upload-color-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x80c6 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :upload-color-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #xc0cc :cmd (vif-cmd unpack-v4-8)) + ) + :upload-color-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + ) + :upload-color-ret (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ret)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + ) + :generic-color-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x3) + ) + :generic-color-1 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :generic-color-end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + :envmap-color-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x8 :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x8000 :num #x8 :cmd (vif-cmd unpack-v4-32)) + ) + :envmap-color-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #xc008 :cmd (vif-cmd unpack-v4-8)) + ) + :refl-fade-fac -0.000625 + :refl-fade-end 409600.0 + :use-etie #t + ) + ) + +(set! (-> *instance-tie-work* upload-color-2 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1)) + +(set! (-> *instance-tie-work* upload-color-ret vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1)) + +(define *prototype-tie-work* (new 'static 'prototype-tie-work + :upload-flushe (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1) + ) + :upload-palette (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x1 :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #x4346 :num #x80 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :upload-model-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4000 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x32 :cmd (vif-cmd unpack-v4-16)) + ) + :upload-model-3 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id call))) + :upload-model-near-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :upload-model-near-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4000 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-near-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x1e :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-near-3 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x32 :cmd (vif-cmd unpack-v4-16)) + ) + :upload-model-near-4 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id call))) + :envmap-palette (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x1 :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #x4302 :num #x80 :cmd (vif-cmd unpack-v4-8)) + ) + :envmap-shader (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #x387 :num #x5 :cmd (vif-cmd unpack-v4-32)) + ) + :upload-envmap-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #xb8 :cmd (vif-cmd base)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :upload-envmap-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x20 :cmd (vif-cmd offset)) + :vif1 (new 'static 'vif-tag :imm #x4000 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-envmap-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x20 :cmd (vif-cmd unpack-v4-16)) + ) + :upload-envmap-3 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x84 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-envmap-4 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id call))) + :upload-envmap-scissor-4 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xac :cmd (vif-cmd unpack-v4-8)) + ) + :generic-palette (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x1) + ) + :generic-model-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x2) + ) + :generic-model-1 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :generic-model-2 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :model-next (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id next))) + :clamp #x8000ff00ff00ff + ) + ) + +(set! (-> *prototype-tie-work* upload-model-1 vif0) + (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscal) :msk #x1) + ) + +(set! (-> *prototype-tie-work* upload-model-3 vif0) + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1) + ) + +(set! (-> *prototype-tie-work* upload-model-near-1 vif0) + (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscal) :msk #x1) + ) + +(set! (-> *prototype-tie-work* upload-model-near-4 vif0) + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1) + ) + +(set! (-> *prototype-tie-work* upload-envmap-2 vif0) + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscalf) :msk #x1) + ) + +(set! (-> *prototype-tie-work* upload-envmap-4 vif1) + (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) diff --git a/goal_src/jak3/engine/gfx/background/tie/tie.gc b/goal_src/jak3/engine/gfx/background/tie/tie.gc index d690c5ca2..73e7890bf 100644 --- a/goal_src/jak3/engine/gfx/background/tie/tie.gc +++ b/goal_src/jak3/engine/gfx/background/tie/tie.gc @@ -7,3 +7,653 @@ ;; DECOMP BEGINS +(defmethod login ((this tie-fragment)) + "Initialize the object after it is loaded." + (let ((s5-0 (the-as adgif-shader (-> this gif-ref))) + (s4-0 (/ (-> this tex-count) (the-as uint 5))) + ) + (dotimes (s3-0 (the-as int s4-0)) + (let ((v1-1 (adgif-shader-login-no-remap s5-0))) + (when v1-1 + (dotimes (a0-4 3) + (dotimes (a1-0 3) + (set! (-> (the-as (pointer int32) (+ (+ (* a0-4 16) (* a1-0 4)) (the-as int *texture-masks*)))) + (logior (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int *texture-masks*) (* a0-4 16))) 0) + (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int v1-1) (* a0-4 16))) 15) + ) + ) + ) + (set! (-> *texture-masks* data a0-4 dist) + (fmax (-> *texture-masks* data a0-4 dist) (-> v1-1 masks data a0-4 dist)) + ) + ) + ) + ) + (when (= (-> s5-0 reg-4) 66) + (set! (-> s5-0 reg-4) (the-as uint 127)) + (set! (-> s5-0 alpha) (new 'static 'gs-alpha)) + 0 + ) + (&+! s5-0 80) + ) + ) + this + ) + + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this drawable-inline-array-instance-tie)) + (the-as int (+ (-> drawable-inline-array-instance-tie size) (* (+ (-> this length) -1) 64))) + ) + +; (defmethod login ((this drawable-tree-instance-tie)) +; "Initialize the object after it is loaded." +; this +; ) + +(defmethod login ((this drawable-tree-instance-tie)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + + +(defmethod login ((this prototype-tie)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +(defmethod mem-usage ((this drawable-tree-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + (mem-usage (-> this prototypes prototype-array-tie) usage (logior flags 1)) + this + ) + +(defmethod mem-usage ((this tie-fragment) (usage memory-usage-block) (flags int)) + (when (logtest? flags 2) + (let ((v1-3 (* (-> this color-count) 4)) + (a0-2 (cond + ((logtest? flags 4) + 20 + ) + ((logtest? flags 8) + 21 + ) + (else + 22 + ) + ) + ) + ) + (+! (-> usage data a0-2 count) 1) + (+! (-> usage data a0-2 used) v1-3) + (+! (-> usage data a0-2 total) (logand -4 (+ v1-3 3))) + ) + (set! (-> usage length) (max 23 (-> usage length))) + (set! this this) + (goto cfg-13) + ) + (set! (-> usage length) (max 18 (-> usage length))) + (set! (-> usage data 9 name) "tie-fragment") + (set! (-> usage data 10 name) "tie-gif") + (set! (-> usage data 11 name) "tie-points") + (set! (-> usage data 12 name) "tie-colors") + (set! (-> usage data 14 name) "tie-debug") + (set! (-> usage data 13 name) "tie-draw-points") + (set! (-> usage data 17 name) "tie-generic") + (+! (-> usage data 9 count) 1) + (let ((v1-21 (asize-of this))) + (+! (-> usage data 9 used) v1-21) + (+! (-> usage data 9 total) (logand -16 (+ v1-21 15))) + ) + (let ((v1-26 (* (-> this gif-count) 16))) + (+! (-> usage data 10 count) (-> this tex-count)) + (+! (-> usage data 10 used) v1-26) + (+! (-> usage data 10 total) (logand -16 (+ v1-26 15))) + ) + (let ((v1-31 (* (-> this vertex-count) 16))) + (+! (-> usage data 11 count) (-> this vertex-count)) + (+! (-> usage data 11 used) v1-31) + (+! (-> usage data 11 total) (logand -16 (+ v1-31 15))) + ) + (let ((v1-36 (* (-> this dp-qwc) 16))) + (+! (-> usage data 13 count) (* (-> this dp-qwc) 16)) + (+! (-> usage data 13 used) v1-36) + (+! (-> usage data 13 total) (logand -16 (+ v1-36 15))) + ) + (let ((v1-41 (* (-> this generic-count) 16))) + (+! (-> usage data 17 count) 1) + (+! (-> usage data 17 used) v1-41) + (+! (-> usage data 17 total) (logand -16 (+ v1-41 15))) + ) + (let ((s4-0 (-> this debug debug-lines))) + (when (nonzero? s4-0) + (dotimes (s3-0 (-> s4-0 length)) + (+! (-> usage data 14 count) (-> s4-0 s3-0 length)) + (let ((v1-52 (asize-of (-> s4-0 s3-0)))) + (+! (-> usage data 12 used) v1-52) + (+! (-> usage data 12 total) (logand -16 (+ v1-52 15))) + ) + ) + ) + ) + (label cfg-13) + this + ) + +(defmethod mem-usage ((this instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 19 (-> usage length))) + (set! (-> usage data 18 name) "instance-tie") + (+! (-> usage data 18 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 18 used) v1-6) + (+! (-> usage data 18 total) (logand -16 (+ v1-6 15))) + ) + (when (nonzero? (-> this color-indices)) + (set! (-> usage length) (max 24 (-> usage length))) + (set! (-> usage data 23 name) "instance-tie-colors*") + (set! (-> usage data 19 name) "instance-tie-colors0") + (set! (-> usage data 20 name) "instance-tie-colors1") + (set! (-> usage data 21 name) "instance-tie-colors2") + (set! (-> usage data 22 name) "instance-tie-colors3") + (+! (-> usage data 23 count) 1) + (let ((s3-0 (-> this bucket-ptr))) + (+ (-> usage data 19 used) (-> usage data 20 used) (-> usage data 21 used) (-> usage data 22 used)) + (dotimes (s2-0 4) + (let ((a0-10 (-> s3-0 tie-geom s2-0))) + (when (nonzero? a0-10) + (let ((t9-1 (method-of-object a0-10 mem-usage)) + (a1-2 usage) + (v1-29 s2-0) + ) + (t9-1 a0-10 a1-2 (logior (logior (cond + ((= v1-29 1) + 4 + ) + ((= v1-29 2) + 8 + ) + ((= v1-29 3) + 16 + ) + (else + 0 + ) + ) + 2 + ) + flags + ) + ) + ) + ) + ) + ) + ) + ) + this + ) + +(defmethod mem-usage ((this drawable-inline-array-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +(defmethod mem-usage ((this prototype-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this prototype-tie)) + (the-as int (+ (-> prototype-tie size) (* (+ (-> this length) -1) 64))) + ) + +(deftype tie-consts (structure) + ((data uint32 40) + (vector vector 10 :inline :overlay-at (-> data 0)) + (quads uint128 10 :overlay-at (-> data 0)) + (adgif gs-gif-tag :inline :overlay-at (-> data 0)) + (strgif gs-gif-tag :inline :overlay-at (-> data 4)) + (extra vector :inline :overlay-at (-> data 8)) + (gifbufs vector :inline :overlay-at (-> data 12)) + (clrbufs qword :inline :overlay-at (-> data 16)) + (misc qword :inline :overlay-at (-> data 20)) + (atestgif gs-gif-tag :inline :overlay-at (-> data 24)) + (alpha gs-adcmd :inline :overlay-at (-> data 28)) + (atest gs-adcmd 2 :inline :overlay-at (-> data 32)) + (atest-tra gs-adcmd :inline :overlay-at (-> data 32)) + (atest-def gs-adcmd :inline :overlay-at (-> data 36)) + ) + ) + + +(define tie-vu1-block (new 'static 'vu-function :length #x3e7 :qlength #x1f4)) + +(defun tie-init-consts ((arg0 tie-consts) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test)) + "Set up tie-consts for VU1" + (set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1)) + (set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (case *subdivide-draw-mode* + (((subdivide-setting textured)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + (((subdivide-setting outline)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + (((subdivide-setting gouraud)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + (((subdivide-setting hack)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + ) + (set! (-> arg0 strgif regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (let ((f0-0 8388894.0) + (f1-0 8389078.0) + (f2-0 8389262.0) + ) + (set! (-> arg0 gifbufs x) f2-0) + (set! (-> arg0 gifbufs y) f1-0) + (set! (-> arg0 gifbufs z) f2-0) + (set! (-> arg0 gifbufs w) f1-0) + (set! (-> arg0 extra x) (+ f0-0 f1-0 f2-0)) + (set! (-> arg0 extra y) 0.0) + (set! (-> arg0 extra z) (+ f0-0 f1-0 f2-0)) + ) + (set! (-> arg0 clrbufs vector4w x) 198) + (set! (-> arg0 clrbufs vector4w y) 242) + (set! (-> arg0 clrbufs vector4w z) 198) + (set! (-> arg0 clrbufs vector4w w) 242) + (set! (-> arg0 atestgif tag) (new 'static 'gif-tag64 :nloop #x2 :eop #x1 :nreg #x1)) + (set! (-> arg0 atestgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (set! (-> arg0 alpha data) (the-as uint arg1)) + (set! (-> arg0 alpha cmds) (gs-reg64 alpha-1)) + (set! (-> arg0 atest-tra cmds) (gs-reg64 test-1)) + (set! (-> arg0 atest-tra data) (the-as uint arg2)) + (set! (-> arg0 atest-def cmds) (gs-reg64 test-1)) + (set! (-> arg0 atest-def data) (the-as uint arg3)) + (set! (-> arg0 misc vector4w x) 0) + (set! (-> arg0 misc vector4w y) -1) + (none) + ) + +(defun tie-init-engine ((arg0 dma-buffer) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test)) + "Set up DMA to initialize TIE vu1." + (let ((v1-0 *display*) + (a0-6 (+ (* (+ (/ (-> tie-vu1-block qlength) 127) 1) 16) 240)) + ) + (+! (-> v1-0 mem-reserve-size) a0-6) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-vu-function arg0 tie-vu1-block 1) + (let ((s2-0 10)) + (let* ((v1-2 arg0) + (a0-11 (the-as dma-packet (-> v1-2 base))) + ) + (set! (-> a0-11 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc s2-0)) + (set! (-> a0-11 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> a0-11 vif1) (new 'static 'vif-tag :imm #x3c6 :cmd (vif-cmd unpack-v4-32) :num s2-0)) + (set! (-> v1-2 base) (the-as pointer (&+ a0-11 16))) + ) + (tie-init-consts (the-as tie-consts (-> arg0 base)) arg1 arg2 arg3) + (&+! (-> arg0 base) (* s2-0 16)) + ) + (let* ((v1-5 arg0) + (a0-15 (the-as dma-packet (-> v1-5 base))) + ) + (set! (-> a0-15 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> a0-15 vif0) (new 'static 'vif-tag :imm #x8 :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> a0-15 vif1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1)) + (set! (-> v1-5 base) (the-as pointer (&+ a0-15 16))) + ) + (let* ((v1-6 arg0) + (a0-17 (the-as dma-packet (-> v1-6 base))) + ) + (set! (-> a0-17 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-17 vif0) (new 'static 'vif-tag)) + (set! (-> a0-17 vif1) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> v1-6 base) (the-as pointer (&+ a0-17 16))) + ) + (let ((v1-7 (the-as object (-> arg0 base)))) + (set! (-> (the-as vector v1-7) x) 8388608.0) + (set! (-> (the-as vector v1-7) y) 8388608.0) + (set! (-> (the-as vector v1-7) z) 8388608.0) + (set! (-> (the-as vector v1-7) w) 8388608.0) + (set! (-> (the-as (pointer vif-tag) v1-7) 4) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> (the-as (pointer vif-tag) v1-7) 5) (new 'static 'vif-tag :imm #x2c :cmd (vif-cmd offset))) + (set! (-> (the-as (pointer vif-tag) v1-7) 6) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> (the-as (pointer vif-tag) v1-7) 7) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> arg0 base) (&+ (the-as pointer v1-7) 32)) + ) + ) + ) + ) + 0 + (none) + ) + +(defun tie-end-buffer ((arg0 dma-buffer)) + "Set up DMA to finish TIE." + (let ((v1-0 *display*) + (a1-0 96) + ) + (+! (-> v1-0 mem-reserve-size) a1-0) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a3-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a3-0 real-buffer-end) (the-as int (&+ (-> a3-0 base) a1-0))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set arg0 (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)))) + (let* ((v1-5 arg0) + (a1-10 (the-as dma-packet (-> v1-5 base))) + ) + (set! (-> a1-10 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a1-10 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmask))) + (set! (-> a1-10 vif1) (new 'static 'vif-tag)) + (set! (-> v1-5 base) (the-as pointer (&+ a1-10 16))) + ) + (let* ((v1-6 arg0) + (a0-1 (-> v1-6 base)) + ) + (set! (-> (the-as (pointer vif-tag) a0-1) 0) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 1) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> (the-as (pointer vif-tag) a0-1) 2) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 3) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 4) (new 'static 'vif-tag)) + (set! (-> (the-as (pointer vif-tag) a0-1) 5) (new 'static 'vif-tag)) + (set! (-> (the-as (pointer vif-tag) a0-1) 6) (new 'static 'vif-tag)) + (set! (-> (the-as (pointer vif-tag) a0-1) 7) (new 'static 'vif-tag)) + (set! (-> v1-6 base) (&+ a0-1 32)) + ) + ) + ) + ) + 0 + (none) + ) + +(defun-debug tie-int-reg ((arg0 int)) + "Get the name of TIE VU1 program integer register." + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + "zero" + ) + ((= v1-0 1) + "itemp" + ) + ((= v1-0 2) + "point-ptr" + ) + ((= v1-0 3) + "clr-ptr" + ) + ((= v1-0 4) + "target-bp1-ptr" + ) + ((= v1-0 5) + "skip-bp2" + ) + ((= v1-0 6) + "target-bp2-ptr" + ) + ((= v1-0 7) + "target-ip1-ptr" + ) + ((= v1-0 8) + "target-ip2-ptr" + ) + ((= v1-0 9) + "ind/ind0" + ) + ((= v1-0 10) + " ind1" + ) + ((= v1-0 11) + " ind2" + ) + ((= v1-0 12) + "dest-ptr" + ) + ((= v1-0 13) + "dest2-ptr" + ) + ((= v1-0 14) + "skip-ips" + ) + ((= v1-0 15) + "kick-addr" + ) + ) + ) + ) + +(defun-debug tie-float-reg ((arg0 int)) + "Get the name of TIE VU1 program float register." + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + "zero" + ) + ((= v1-0 1) + "t-mtx0" + ) + ((= v1-0 2) + "t-mtx1" + ) + ((= v1-0 3) + "t-mtx2" + ) + ((= v1-0 4) + "t-mtx3" + ) + ((= v1-0 5) + "vtx-0" + ) + ((= v1-0 6) + "vtx-1" + ) + ((= v1-0 7) + "vtx-2" + ) + ((= v1-0 8) + "vtx-3" + ) + ((= v1-0 9) + "pos-0/2" + ) + ((= v1-0 10) + "pos-1/3" + ) + ((= v1-0 11) + "clr-0" + ) + ((= v1-0 12) + "clr-1" + ) + ((= v1-0 13) + "clr-2" + ) + ((= v1-0 14) + "clr-3" + ) + ((= v1-0 15) + "tex-0" + ) + ((= v1-0 16) + "tex-1" + ) + ((= v1-0 17) + "tex-2" + ) + ((= v1-0 18) + "tex-3" + ) + ((= v1-0 19) + "res-0/2" + ) + ((= v1-0 20) + "res-1/3" + ) + ((= v1-0 21) + "gifbuf" + ) + ((= v1-0 22) + "clrbuf" + ) + ((= v1-0 23) + "extra" + ) + ((= v1-0 24) + "inds" + ) + ((= v1-0 25) + "--" + ) + ((= v1-0 26) + "--" + ) + ((= v1-0 27) + "morph" + ) + ((= v1-0 28) + "xyzofs" + ) + ((= v1-0 29) + "clr1" + ) + ((= v1-0 30) + "clr2" + ) + ((= v1-0 31) + "--" + ) + ) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun-debug tie-ints () + "Dump TIE integer regs for debug." + (local-vars (sv-16 uint)) + (let ((gp-0 (+ #x3da0 #x1100c000))) + (dotimes (s5-0 16) + (if (< s5-0 10) + (format 0 " ") + ) + (let ((s4-0 format) + (s3-0 0) + (s2-0 "vi~d: ~6d #x~4,'0X ~s~%") + (s1-0 s5-0) + (s0-0 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) + ) + (set! sv-16 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) + (let ((t1-0 (tie-int-reg s5-0))) + (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun-debug tie-floats () + "Dump TIE float regs for debug." + (local-vars (sv-16 uint) (sv-32 uint)) + (let ((gp-0 (the-as (pointer uint32) (+ #x3da0 #x1100c000)))) + (dotimes (s5-0 32) + (if (< s5-0 10) + (format 0 " ") + ) + (format + 0 + "vf~d: #x~8,'0X #x~8,'0X #x~8,'0X #x~8,'0X " + s5-0 + (-> gp-0 (* s5-0 4)) + (-> gp-0 (+ (* s5-0 4) 1)) + (-> gp-0 (+ (* s5-0 4) 2)) + (-> gp-0 (+ (* s5-0 4) 3)) + ) + (let ((s4-0 format) + (s3-0 0) + (s2-0 "~F ~F ~F ~F ~s~%") + (s1-0 (-> gp-0 (* s5-0 4))) + (s0-0 (-> gp-0 (+ (* s5-0 4) 1))) + ) + (set! sv-16 (-> gp-0 (+ (* s5-0 4) 2))) + (set! sv-32 (-> gp-0 (+ (* s5-0 4) 3))) + (let ((t2-1 (tie-float-reg s5-0))) + (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 sv-32 t2-1) + ) + ) + ) + ) + (none) + ) diff --git a/goal_src/jak3/engine/gfx/foreground/foreground.gc b/goal_src/jak3/engine/gfx/foreground/foreground.gc index a0e1d108d..3176e413c 100644 --- a/goal_src/jak3/engine/gfx/foreground/foreground.gc +++ b/goal_src/jak3/engine/gfx/foreground/foreground.gc @@ -17,6 +17,7 @@ ) ;; ---merc-mode +;; Note: merc mode 5 seems to be totally bogus - the buckets are somewhat random. ;; DECOMP BEGINS @@ -34,7 +35,7 @@ (bucket-id-16 gmerc-l0-pris) (bucket-id-16 tex-l0-pris) (bucket-id-16 gmerc2-l0-pris) - (bucket-id-16 bucket32) + (bucket-id-16 tie-vanish-l1-tfrag) (bucket-id-16 merc-l0-shrub) (bucket-id-16 emerc-l0-shrub) (bucket-id-16 gmerc-l0-shrub) @@ -46,7 +47,7 @@ (bucket-id-16 gmerc-l0-alpha) (bucket-id-16 tex-l0-alpha) (bucket-id-16 gmerc2-l0-alpha) - (bucket-id-16 bucket20) + (bucket-id-16 tie-vanish-l0-tfrag) (bucket-id-16 merc-l0-water) (bucket-id-16 merc-l0-water) (bucket-id-16 gmerc-l0-water) @@ -58,7 +59,7 @@ (bucket-id-16 gmerc-l0-pris) (bucket-id-16 tex-l0-pris) (bucket-id-16 gmerc2-l0-pris) - (bucket-id-16 bucket32) + (bucket-id-16 tie-vanish-l1-tfrag) (bucket-id-16 merc-l0-pris2) (bucket-id-16 emerc-l0-pris2) (bucket-id-16 gmerc-l0-pris2) @@ -82,7 +83,7 @@ (bucket-id-16 gmerc-l1-shrub) (bucket-id-16 tex-l1-shrub) (bucket-id-16 gmerc2-l1-shrub) - (bucket-id-16 bucket11) + (bucket-id-16 tfrag-l0-tfrag) (bucket-id-16 merc-l1-alpha) (bucket-id-16 emerc-l1-alpha) (bucket-id-16 gmerc-l1-alpha) @@ -106,7 +107,7 @@ (bucket-id-16 gmerc-l1-pris2) (bucket-id-16 tex-l1-pris2) (bucket-id-16 gmerc2-l1-pris2) - (bucket-id-16 bucket44) + (bucket-id-16 tie-vanish-l2-tfrag) (bucket-id-16 merc-l2-tfrag) (bucket-id-16 emerc-l2-tfrag) (bucket-id-16 gmerc-l2-tfrag) @@ -124,7 +125,7 @@ (bucket-id-16 gmerc-l2-shrub) (bucket-id-16 tex-l2-shrub) (bucket-id-16 gmerc2-l2-shrub) - (bucket-id-16 bucket12) + (bucket-id-16 tie-l0-tfrag) (bucket-id-16 merc-l2-alpha) (bucket-id-16 emerc-l2-alpha) (bucket-id-16 gmerc-l2-alpha) @@ -136,7 +137,7 @@ (bucket-id-16 gmerc-l2-water) (bucket-id-16 tex-l2-water) (bucket-id-16 gmerc2-l2-water) - (bucket-id-16 bucket56) + (bucket-id-16 tie-vanish-l3-tfrag) (bucket-id-16 merc-l2-pris) (bucket-id-16 emerc-l2-pris) (bucket-id-16 gmerc-l2-pris) @@ -160,19 +161,19 @@ (bucket-id-16 gmerc-l3-pris) (bucket-id-16 tex-l3-pris) (bucket-id-16 gmerc2-l3-pris) - (bucket-id-16 bucket35) + (bucket-id-16 tfrag-l2-tfrag) (bucket-id-16 merc-l3-shrub) (bucket-id-16 emerc-l3-shrub) (bucket-id-16 gmerc-l3-shrub) (bucket-id-16 tex-l3-shrub) (bucket-id-16 gmerc2-l3-shrub) - (bucket-id-16 bucket13) + (bucket-id-16 etie-l0-tfrag) (bucket-id-16 merc-l3-alpha) (bucket-id-16 emerc-l3-alpha) (bucket-id-16 gmerc-l3-alpha) (bucket-id-16 tex-l3-alpha) (bucket-id-16 gmerc2-l3-alpha) - (bucket-id-16 bucket23) + (bucket-id-16 tfrag-l1-tfrag) (bucket-id-16 merc-l3-water) (bucket-id-16 merc-l3-water) (bucket-id-16 gmerc-l3-water) @@ -184,7 +185,7 @@ (bucket-id-16 gmerc-l3-pris) (bucket-id-16 tex-l3-pris) (bucket-id-16 gmerc2-l3-pris) - (bucket-id-16 bucket35) + (bucket-id-16 tfrag-l2-tfrag) (bucket-id-16 merc-l3-pris2) (bucket-id-16 emerc-l3-pris2) (bucket-id-16 gmerc-l3-pris2) @@ -202,19 +203,19 @@ (bucket-id-16 gmerc-l4-pris) (bucket-id-16 tex-l4-pris) (bucket-id-16 gmerc2-l4-pris) - (bucket-id-16 bucket36) + (bucket-id-16 tie-l2-tfrag) (bucket-id-16 merc-l4-shrub) (bucket-id-16 emerc-l4-shrub) (bucket-id-16 gmerc-l4-shrub) (bucket-id-16 tex-l4-shrub) (bucket-id-16 gmerc2-l4-shrub) - (bucket-id-16 bucket14) + (bucket-id-16 tfrag-scissor-l0-tfrag) (bucket-id-16 merc-l4-alpha) (bucket-id-16 emerc-l4-alpha) (bucket-id-16 gmerc-l4-alpha) (bucket-id-16 tex-l4-alpha) (bucket-id-16 gmerc2-l4-alpha) - (bucket-id-16 bucket24) + (bucket-id-16 tie-l1-tfrag) (bucket-id-16 merc-l4-water) (bucket-id-16 merc-l4-water) (bucket-id-16 gmerc-l4-water) @@ -226,13 +227,13 @@ (bucket-id-16 gmerc-l4-pris) (bucket-id-16 tex-l4-pris) (bucket-id-16 gmerc2-l4-pris) - (bucket-id-16 bucket36) + (bucket-id-16 tie-l2-tfrag) (bucket-id-16 merc-l4-pris2) (bucket-id-16 emerc-l4-pris2) (bucket-id-16 gmerc-l4-pris2) (bucket-id-16 tex-l4-pris2) (bucket-id-16 gmerc2-l4-pris2) - (bucket-id-16 bucket47) + (bucket-id-16 tfrag-l3-tfrag) (bucket-id-16 merc-l5-tfrag) (bucket-id-16 emerc-l5-tfrag) (bucket-id-16 gmerc-l5-tfrag) @@ -244,37 +245,37 @@ (bucket-id-16 gmerc-l5-pris) (bucket-id-16 tex-l5-pris) (bucket-id-16 gmerc2-l5-pris) - (bucket-id-16 bucket37) + (bucket-id-16 etie-l2-tfrag) (bucket-id-16 merc-l5-shrub) (bucket-id-16 emerc-l5-shrub) (bucket-id-16 gmerc-l5-shrub) (bucket-id-16 tex-l5-shrub) (bucket-id-16 gmerc2-l5-shrub) - (bucket-id-16 bucket15) + (bucket-id-16 tie-scissor-l0-tfrag) (bucket-id-16 merc-l5-alpha) (bucket-id-16 emerc-l5-alpha) (bucket-id-16 gmerc-l5-alpha) (bucket-id-16 tex-l5-alpha) (bucket-id-16 gmerc2-l5-alpha) - (bucket-id-16 bucket25) + (bucket-id-16 etie-l1-tfrag) (bucket-id-16 merc-l5-water) (bucket-id-16 merc-l5-water) (bucket-id-16 gmerc-l5-water) (bucket-id-16 tex-l5-water) (bucket-id-16 gmerc2-l5-water) - (bucket-id-16 bucket59) + (bucket-id-16 tfrag-l4-tfrag) (bucket-id-16 merc-l5-pris) (bucket-id-16 emerc-l5-pris) (bucket-id-16 gmerc-l5-pris) (bucket-id-16 tex-l5-pris) (bucket-id-16 gmerc2-l5-pris) - (bucket-id-16 bucket37) + (bucket-id-16 etie-l2-tfrag) (bucket-id-16 merc-l5-pris2) (bucket-id-16 emerc-l5-pris2) (bucket-id-16 gmerc-l5-pris2) (bucket-id-16 tex-l5-pris2) (bucket-id-16 gmerc2-l5-pris2) - (bucket-id-16 bucket48) + (bucket-id-16 tie-l3-tfrag) (bucket-id-16 merc-l6-tfrag) (bucket-id-16 emerc-l6-tfrag) (bucket-id-16 gmerc-l6-tfrag) @@ -286,37 +287,37 @@ (bucket-id-16 gmerc-l6-pris) (bucket-id-16 tex-l6-pris) (bucket-id-16 gmerc2-l6-pris) - (bucket-id-16 bucket38) + (bucket-id-16 tfrag-scissor-l2-tfrag) (bucket-id-16 merc-l6-shrub) (bucket-id-16 emerc-l6-shrub) (bucket-id-16 gmerc-l6-shrub) (bucket-id-16 tex-l6-shrub) (bucket-id-16 gmerc2-l6-shrub) - (bucket-id-16 bucket16) + (bucket-id-16 etie-scissor-l0-tfrag) (bucket-id-16 merc-l6-alpha) (bucket-id-16 emerc-l6-alpha) (bucket-id-16 gmerc-l6-alpha) (bucket-id-16 tex-l6-alpha) (bucket-id-16 gmerc2-l6-alpha) - (bucket-id-16 bucket26) + (bucket-id-16 tfrag-scissor-l1-tfrag) (bucket-id-16 merc-l6-water) (bucket-id-16 merc-l6-water) (bucket-id-16 gmerc-l6-water) (bucket-id-16 tex-l6-water) (bucket-id-16 gmerc2-l6-water) - (bucket-id-16 bucket60) + (bucket-id-16 tie-l4-tfrag) (bucket-id-16 merc-l6-pris) (bucket-id-16 emerc-l6-pris) (bucket-id-16 gmerc-l6-pris) (bucket-id-16 tex-l6-pris) (bucket-id-16 gmerc2-l6-pris) - (bucket-id-16 bucket38) + (bucket-id-16 tfrag-scissor-l2-tfrag) (bucket-id-16 merc-l6-pris2) (bucket-id-16 emerc-l6-pris2) (bucket-id-16 gmerc-l6-pris2) (bucket-id-16 tex-l6-pris2) (bucket-id-16 gmerc2-l6-pris2) - (bucket-id-16 bucket49) + (bucket-id-16 etie-l3-tfrag) (bucket-id-16 merc-l7-tfrag) (bucket-id-16 emerc-l7-tfrag) (bucket-id-16 gmerc-l7-tfrag) @@ -328,7 +329,7 @@ (bucket-id-16 gmerc-l7-pris) (bucket-id-16 tex-l7-pris) (bucket-id-16 gmerc2-l7-pris) - (bucket-id-16 bucket39) + (bucket-id-16 tie-scissor-l2-tfrag) (bucket-id-16 merc-l7-shrub) (bucket-id-16 emerc-l7-shrub) (bucket-id-16 gmerc-l7-shrub) @@ -340,25 +341,25 @@ (bucket-id-16 gmerc-l7-alpha) (bucket-id-16 tex-l7-alpha) (bucket-id-16 gmerc2-l7-alpha) - (bucket-id-16 bucket27) + (bucket-id-16 tie-scissor-l1-tfrag) (bucket-id-16 merc-l7-water) (bucket-id-16 merc-l7-water) (bucket-id-16 gmerc-l7-water) (bucket-id-16 tex-l7-water) (bucket-id-16 gmerc2-l7-water) - (bucket-id-16 bucket61) + (bucket-id-16 etie-l4-tfrag) (bucket-id-16 merc-l7-pris) (bucket-id-16 emerc-l7-pris) (bucket-id-16 gmerc-l7-pris) (bucket-id-16 tex-l7-pris) (bucket-id-16 gmerc2-l7-pris) - (bucket-id-16 bucket39) + (bucket-id-16 tie-scissor-l2-tfrag) (bucket-id-16 merc-l7-pris2) (bucket-id-16 emerc-l7-pris2) (bucket-id-16 gmerc-l7-pris2) (bucket-id-16 tex-l7-pris2) (bucket-id-16 gmerc2-l7-pris2) - (bucket-id-16 bucket50) + (bucket-id-16 tfrag-scissor-l3-tfrag) (bucket-id-16 merc-l8-tfrag) (bucket-id-16 emerc-l8-tfrag) (bucket-id-16 gmerc-l8-tfrag) @@ -370,7 +371,7 @@ (bucket-id-16 gmerc-l8-pris) (bucket-id-16 tex-l8-pris) (bucket-id-16 gmerc2-l8-pris) - (bucket-id-16 bucket40) + (bucket-id-16 etie-scissor-l2-tfrag) (bucket-id-16 merc-l8-shrub) (bucket-id-16 emerc-l8-shrub) (bucket-id-16 gmerc-l8-shrub) @@ -382,25 +383,25 @@ (bucket-id-16 gmerc-l8-alpha) (bucket-id-16 tex-l8-alpha) (bucket-id-16 gmerc2-l8-alpha) - (bucket-id-16 bucket28) + (bucket-id-16 etie-scissor-l1-tfrag) (bucket-id-16 merc-l8-water) (bucket-id-16 merc-l8-water) (bucket-id-16 gmerc-l8-water) (bucket-id-16 tex-l8-water) (bucket-id-16 gmerc2-l8-water) - (bucket-id-16 bucket62) + (bucket-id-16 tfrag-scissor-l4-tfrag) (bucket-id-16 merc-l8-pris) (bucket-id-16 emerc-l8-pris) (bucket-id-16 gmerc-l8-pris) (bucket-id-16 tex-l8-pris) (bucket-id-16 gmerc2-l8-pris) - (bucket-id-16 bucket40) + (bucket-id-16 etie-scissor-l2-tfrag) (bucket-id-16 merc-l8-pris2) (bucket-id-16 emerc-l8-pris2) (bucket-id-16 gmerc-l8-pris2) (bucket-id-16 tex-l8-pris2) (bucket-id-16 gmerc2-l8-pris2) - (bucket-id-16 bucket51) + (bucket-id-16 tie-scissor-l3-tfrag) (bucket-id-16 merc-l9-tfrag) (bucket-id-16 emerc-l9-tfrag) (bucket-id-16 gmerc-l9-tfrag) @@ -430,7 +431,7 @@ (bucket-id-16 gmerc-l9-water) (bucket-id-16 tex-l9-water) (bucket-id-16 gmerc2-l9-water) - (bucket-id-16 bucket63) + (bucket-id-16 tie-scissor-l4-tfrag) (bucket-id-16 merc-l9-pris) (bucket-id-16 emerc-l9-pris) (bucket-id-16 gmerc-l9-pris) @@ -442,7 +443,7 @@ (bucket-id-16 gmerc-l9-pris2) (bucket-id-16 tex-l9-pris2) (bucket-id-16 gmerc2-l9-pris2) - (bucket-id-16 bucket52) + (bucket-id-16 etie-scissor-l3-tfrag) (bucket-id-16 merc-lcom-tfrag) (bucket-id-16 emerc-lcom-tfrag) (bucket-id-16 gmerc-lcom-tfrag) @@ -472,7 +473,7 @@ (bucket-id-16 gmerc-lcom-water) (bucket-id-16 tex-lcom-water) (bucket-id-16 gmerc2-lcom-water) - (bucket-id-16 bucket64) + (bucket-id-16 etie-scissor-l4-tfrag) (bucket-id-16 merc-lcom-pris) (bucket-id-16 emerc-lcom-pris) (bucket-id-16 gmerc-lcom-pris) diff --git a/goal_src/jak3/engine/gfx/hw/display-h.gc b/goal_src/jak3/engine/gfx/hw/display-h.gc index 0a612337c..3dfe0b6ef 100644 --- a/goal_src/jak3/engine/gfx/hw/display-h.gc +++ b/goal_src/jak3/engine/gfx/hw/display-h.gc @@ -119,12 +119,12 @@ At any point in time, there are 3 frames in progress: rn5 rn6 rn7 - rn8 - rn9 - rn10 - rn11 - rn12 - rn13 + tfrag + tie-scissor + tie + etie + etie-scissor + tie-vanish generic merc emerc @@ -132,16 +132,16 @@ At any point in time, there are 3 frames in progress: shrub-near billboard shrub-vanish - rn21 - rn22 - rn23 - rn24 - rn25 - rn26 - rn27 - rn28 - rn29 - rn30 + tfrag-trans + tie-scissor-trans + tie-trans + etie-trans + etie-scissor-trans + tfrag-water + tie-scissor-water + tie-water + etie-water + etie-scissor-water rn31 rn32 rn33 @@ -155,12 +155,12 @@ At any point in time, there are 3 frames in progress: rn5 rn6 rn7 - rn8 - rn9 - rn10 - rn11 - rn12 - rn13 + tfrag + tie-scissor + tie + etie + etie-scissor + tie-vanish generic merc emerc @@ -168,16 +168,16 @@ At any point in time, there are 3 frames in progress: shrub-near billboard shrub-vanish - rn21 - rn22 - rn23 - rn24 - rn25 - rn26 - rn27 - rn28 - rn29 - rn30 + tfrag-trans + tie-scissor-trans + tie-trans + etie-trans + etie-scissor-trans + tfrag-water + tie-scissor-water + tie-water + etie-water + etie-scissor-water rn31 rn32 rn33 diff --git a/goal_src/jak3/engine/gfx/vu1-user-h.gc b/goal_src/jak3/engine/gfx/vu1-user-h.gc index 0443b9ce4..ca22a1863 100644 --- a/goal_src/jak3/engine/gfx/vu1-user-h.gc +++ b/goal_src/jak3/engine/gfx/vu1-user-h.gc @@ -38,133 +38,133 @@ (bucket9 9) ;; hfrag (tex-l0-tfrag 10) ;; texture - (bucket11 11) ;; tfrag - (bucket12 12) ;; tie - (bucket13 13) ;; tie - (bucket14 14) ;; tfrag - (bucket15 15) ;; tie - (bucket16 16) ;; tie + (tfrag-l0-tfrag 11) ;; tfrag + (tie-l0-tfrag 12) ;; tie + (etie-l0-tfrag 13) ;; tie + (tfrag-scissor-l0-tfrag 14) ;; tfrag + (tie-scissor-l0-tfrag 15) ;; tie + (etie-scissor-l0-tfrag 16) ;; tie (merc-l0-tfrag 17) ;; merc (emerc-l0-tfrag 18) ;; emerc (gmerc-l0-tfrag 19) ;; generic - (bucket20 20) ;; tie + (tie-vanish-l0-tfrag 20) ;; tie (gmerc2-l0-tfrag 21) ;; generic (tex-l1-tfrag 22) - (bucket23 23) - (bucket24 24) - (bucket25 25) - (bucket26 26) - (bucket27 27) - (bucket28 28) + (tfrag-l1-tfrag 23) + (tie-l1-tfrag 24) + (etie-l1-tfrag 25) + (tfrag-scissor-l1-tfrag 26) + (tie-scissor-l1-tfrag 27) + (etie-scissor-l1-tfrag 28) (merc-l1-tfrag 29) (emerc-l1-tfrag 30) (gmerc-l1-tfrag 31) - (bucket32 32) + (tie-vanish-l1-tfrag 32) (gmerc2-l1-tfrag 33) (tex-l2-tfrag 34) - (bucket35 35) - (bucket36 36) - (bucket37 37) - (bucket38 38) - (bucket39 39) - (bucket40 40) + (tfrag-l2-tfrag 35) + (tie-l2-tfrag 36) + (etie-l2-tfrag 37) + (tfrag-scissor-l2-tfrag 38) + (tie-scissor-l2-tfrag 39) + (etie-scissor-l2-tfrag 40) (merc-l2-tfrag 41) (emerc-l2-tfrag 42) (gmerc-l2-tfrag 43) - (bucket44 44) + (tie-vanish-l2-tfrag 44) (gmerc2-l2-tfrag 45) (tex-l3-tfrag 46) - (bucket47 47) - (bucket48 48) - (bucket49 49) - (bucket50 50) - (bucket51 51) - (bucket52 52) + (tfrag-l3-tfrag 47) + (tie-l3-tfrag 48) + (etie-l3-tfrag 49) + (tfrag-scissor-l3-tfrag 50) + (tie-scissor-l3-tfrag 51) + (etie-scissor-l3-tfrag 52) (merc-l3-tfrag 53) (emerc-l3-tfrag 54) (gmerc-l3-tfrag 55) - (bucket56 56) + (tie-vanish-l3-tfrag 56) (gmerc2-l3-tfrag 57) (tex-l4-tfrag 58) - (bucket59 59) - (bucket60 60) - (bucket61 61) - (bucket62 62) - (bucket63 63) - (bucket64 64) + (tfrag-l4-tfrag 59) + (tie-l4-tfrag 60) + (etie-l4-tfrag 61) + (tfrag-scissor-l4-tfrag 62) + (tie-scissor-l4-tfrag 63) + (etie-scissor-l4-tfrag 64) (merc-l4-tfrag 65) (emerc-l4-tfrag 66) (gmerc-l4-tfrag 67) - (bucket68 68) + (tie-vanish-l4-tfrag 68) (gmerc2-l4-tfrag 69) (tex-l5-tfrag 70) - (bucket71 71) - (bucket72 72) - (bucket73 73) - (bucket74 74) - (bucket75 75) - (bucket76 76) + (tfrag-l5-tfrag 71) + (tie-l5-tfrag 72) + (etie-l5-tfrag 73) + (tfrag-scissor-l5-tfrag 74) + (tie-scissor-l5-tfrag 75) + (etie-scissor-l5-tfrag 76) (merc-l5-tfrag 77) (emerc-l5-tfrag 78) (gmerc-l5-tfrag 79) - (bucket80 80) + (tie-vanish-l5-tfrag 80) (gmerc2-l5-tfrag 81) (tex-l6-tfrag 82) - (bucket83 83) - (bucket84 84) - (bucket85 85) - (bucket86 86) - (bucket87 87) - (bucket88 88) + (tfrag-l6-tfrag 83) + (tie-l6-tfrag 84) + (etie-l6-tfrag 85) + (tfrag-scissor-l6-tfrag 86) + (tie-scissor-l6-tfrag 87) + (etie-scissor-l6-tfrag 88) (merc-l6-tfrag 89) (emerc-l6-tfrag 90) (gmerc-l6-tfrag 91) - (bucket92 92) + (tie-vanish-l6-tfrag 92) (gmerc2-l6-tfrag 93) (tex-l7-tfrag 94) - (bucket95 95) - (bucket96 96) - (bucket97 97) - (bucket98 98) - (bucket99 99) - (bucket100 100) + (tfrag-l7-tfrag 95) + (tie-l7-tfrag 96) + (etie-l7-tfrag 97) + (tfrag-scissor-l7-tfrag 98) + (tie-scissor-l7-tfrag 99) + (etie-scissor-l7-tfrag 100) (merc-l7-tfrag 101) (emerc-l7-tfrag 102) (gmerc-l7-tfrag 103) - (bucket104 104) + (tie-vanish-l7-tfrag 104) (gmerc2-l7-tfrag 105) (tex-l8-tfrag 106) - (bucket107 107) - (bucket108 108) - (bucket109 109) - (bucket110 110) - (bucket111 111) - (bucket112 112) + (tfrag-l8-tfrag 107) + (tie-l8-tfrag 108) + (etie-l8-tfrag 109) + (tfrag-scissor-l8-tfrag 110) + (tie-scissor-l8-tfrag 111) + (etie-scissor-l8-tfrag 112) (merc-l8-tfrag 113) (emerc-l8-tfrag 114) (gmerc-l8-tfrag 115) - (bucket116 116) + (tie-vanish-l8-tfrag 116) (gmerc2-l8-tfrag 117) (tex-l9-tfrag 118) - (bucket119 119) - (bucket120 120) - (bucket121 121) - (bucket122 122) - (bucket123 123) - (bucket124 124) + (tfrag-l9-tfrag 119) + (tie-l9-tfrag 120) + (etie-l9-tfrag 121) + (tfrag-scissor-l9-tfrag 122) + (tie-scissor-l9-tfrag 123) + (etie-scissor-l9-tfrag 124) (merc-l9-tfrag 125) (emerc-l9-tfrag 126) (gmerc-l9-tfrag 127) - (bucket128 128) + (tie-vanish-l9-tfrag 128) (gmerc2-l9-tfrag 129) (tex-l0-shrub 130) @@ -278,123 +278,123 @@ (gmerc2-l9-shrub 229) (tex-l0-alpha 230) - (bucket231 231) - (bucket232 232) - (bucket233 233) + (tfrag-l0-alpha 231) + (tie-l0-alpha 232) + (etie-l0-alpha 233) (merc-l0-alpha 234) (emerc-l0-alpha 235) (gmerc-l0-alpha 236) - (bucket237 237) - (bucket238 238) - (bucket239 239) + (tfrag-scissor-l0-alpha 237) + (tie-scissor-l0-alpha 238) + (etie-scissor-l0-alpha 239) (gmerc2-l0-alpha 240) (tex-l1-alpha 241) - (bucket242 242) - (bucket243 243) - (bucket244 244) + (tfrag-l1-alpha 242) + (tie-l1-alpha 243) + (etie-l1-alpha 244) (merc-l1-alpha 245) (emerc-l1-alpha 246) (gmerc-l1-alpha 247) - (bucket248 248) - (bucket249 249) - (bucket250 250) + (tfrag-scissor-l1-alpha 248) + (tie-scissor-l1-alpha 249) + (etie-scissor-l1-alpha 250) (gmerc2-l1-alpha 251) (tex-l2-alpha 252) - (bucket253 253) - (bucket254 254) - (bucket255 255) + (tfrag-l2-alpha 253) + (tie-l2-alpha 254) + (etie-l02alpha 255) (merc-l2-alpha 256) (emerc-l2-alpha 257) (gmerc-l2-alpha 258) - (bucket259 259) - (bucket260 260) - (bucket261 261) + (tfrag-scissor-l2-alpha 259) + (tie-scissor-l2-alpha 260) + (etie-scissor-l2-alpha 261) (gmerc2-l2-alpha 262) (tex-l3-alpha 263) - (bucket264 264) - (bucket265 265) - (bucket266 266) + (tfrag-l3-alpha 264) + (tie-l3-alpha 265) + (etie-l3-alpha 266) (merc-l3-alpha 267) (emerc-l3-alpha 268) (gmerc-l3-alpha 269) - (bucket270 270) - (bucket271 271) - (bucket272 272) + (tfrag-scissor-l3-alpha 270) + (tie-scissor-l3-alpha 271) + (etie-scissor-l3-alpha 272) (gmerc2-l3-alpha 273) (tex-l4-alpha 274) - (bucket275 275) - (bucket276 276) - (bucket277 277) + (tfrag-l4-alpha 275) + (tie-l4-alpha 276) + (etie-l4-alpha 277) (merc-l4-alpha 278) (emerc-l4-alpha 279) (gmerc-l4-alpha 280) - (bucket281 281) - (bucket282 282) - (bucket283 283) + (tfrag-scissor-l4-alpha 281) + (tie-scissor-l4-alpha 282) + (etie-scissor-l4-alpha 283) (gmerc2-l4-alpha 284) (tex-l5-alpha 285) - (bucket286 286) - (bucket287 287) - (bucket288 288) + (tfrag-l5-alpha 286) + (tie-l5-alpha 287) + (etie-l5-alpha 288) (merc-l5-alpha 289) (emerc-l5-alpha 290) (gmerc-l5-alpha 291) - (bucket292 292) - (bucket293 293) - (bucket294 294) + (tfrag-scissor-l5-alpha 292) + (tie-scissor-l5-alpha 293) + (etie-scissor-l5-alpha 294) (gmerc2-l5-alpha 295) (tex-l6-alpha 296) - (bucket297 297) - (bucket298 298) - (bucket299 299) + (tfrag-l6-alpha 297) + (tie-l6-alpha 298) + (etie-l6-alpha 299) (merc-l6-alpha 300) (emerc-l6-alpha 301) (gmerc-l6-alpha 302) - (bucket303 303) - (bucket304 304) - (bucket305 305) + (tfrag-scissor-l6-alpha 303) + (tie-scissor-l6-alpha 304) + (etie-scissor-l6-alpha 305) (gmerc2-l6-alpha 306) (tex-l7-alpha 307) - (bucket308 308) - (bucket309 309) - (bucket310 310) + (tfrag-l7-alpha 308) + (tie-l7-alpha 309) + (etie-l7-alpha 310) (merc-l7-alpha 311) (emerc-l7-alpha 312) (gmerc-l7-alpha 313) - (bucket314 314) - (bucket315 315) - (bucket316 316) + (tfrag-scissor-l7-alpha 314) + (tie-scissor-l7-alpha 315) + (etie-scissor-l7-alpha 316) (gmerc2-l7-alpha 317) (tex-l8-alpha 318) - (bucket319 319) - (bucket320 320) - (bucket321 321) + (tfrag-l8-alpha 319) + (tie-l8-alpha 320) + (etie-l8-alpha 321) (merc-l8-alpha 322) (emerc-l8-alpha 323) (gmerc-l8-alpha 324) - (bucket325 325) - (bucket326 326) - (bucket327 327) + (tfrag-scissor-l8-alpha 325) + (tie-scissor-l8-alpha 326) + (etie-scissor-l8-alpha 327) (gmerc2-l8-alpha 328) (tex-l9-alpha 329) - (bucket330 330) - (bucket331 331) - (bucket332 332) + (tfrag-l9-alpha 330) + (tie-l9-alpha 331) + (etie-l9-alpha 332) (merc-l9-alpha 333) (emerc-l9-alpha 334) (gmerc-l9-alpha 335) - (bucket336 336) - (bucket337 337) - (bucket338 338) + (tfrag-scissor-l9-alpha 336) + (tie-scissor-l9-alpha 337) + (etie-scissor-l9-alpha 338) (gmerc2-l9-alpha 339) (tex-lcom-tfrag 340) @@ -549,111 +549,111 @@ (tex-l0-water 463) (merc-l0-water 464) (gmerc-l0-water 465) - (bucket466 466) - (bucket467 467) - (bucket468 468) - (bucket469 469) - (bucket470 470) - (bucket471 471) + (tfrag-l0-water 466) + (tie-l0-water 467) + (etie-l0-water 468) + (tie-scissor-l0-water 469) + (tfrag-scissor-l0-water 470) + (etie-scissor-l0-water 471) (gmerc2-l0-water 472) (tex-l1-water 473) (merc-l1-water 474) (gmerc-l1-water 475) - (bucket476 476) - (bucket477 477) - (bucket478 478) - (bucket479 479) - (bucket480 480) - (bucket481 481) + (tfrag-l1-water 476) + (tie-l1-water 477) + (etie-l1-water 478) + (tie-scissor-l1-water 479) + (tfrag-scissor-l1-water 480) + (etie-scissor-l1-water 481) (gmerc2-l1-water 482) (tex-l2-water 483) (merc-l2-water 484) (gmerc-l2-water 485) - (bucket486 486) - (bucket487 487) - (bucket488 488) - (bucket489 489) - (bucket490 490) - (bucket491 491) + (tfrag-l2-water 486) + (tie-l2-water 487) + (etie-l2-water 488) + (tie-scissor-l2-water 489) + (tfrag-scissor-l2-water 490) + (etie-scissor-l2-water 491) (gmerc2-l2-water 492) (tex-l3-water 493) (merc-l3-water 494) (gmerc-l3-water 495) - (bucket496 496) - (bucket497 497) - (bucket498 498) - (bucket499 499) - (bucket500 500) - (bucket501 501) + (tfrag-l3-water 496) + (tie-l3-water 497) + (etie-l3-water 498) + (tie-scissor-l3-water 499) + (tfrag-scissor-l3-water 500) + (etie-scissor-l3-water 501) (gmerc2-l3-water 502) (tex-l4-water 503) (merc-l4-water 504) (gmerc-l4-water 505) - (bucket506 506) - (bucket507 507) - (bucket508 508) - (bucket509 509) - (bucket510 510) - (bucket511 511) + (tfrag-l4-water 506) + (tie-l4-water 507) + (etie-l4-water 508) + (tie-scissor-l4-water 509) + (tfrag-scissor-l4-water 510) + (etie-scissor-l4-water 511) (gmerc2-l4-water 512) (tex-l5-water 513) (merc-l5-water 514) (gmerc-l5-water 515) - (bucket516 516) - (bucket517 517) - (bucket518 518) - (bucket519 519) - (bucket520 520) - (bucket521 521) + (tfrag-l5-water 516) + (tie-l5-water 517) + (etie-l5-water 518) + (tie-scissor-l5-water 519) + (tfrag-scissor-l5-water 520) + (etie-scissor-l5-water 521) (gmerc2-l5-water 522) (tex-l6-water 523) (merc-l6-water 524) (gmerc-l6-water 525) - (bucket526 526) - (bucket527 527) - (bucket528 528) - (bucket529 529) - (bucket530 530) - (bucket531 531) + (tfrag-l6-water 526) + (tie-l6-water 527) + (etie-l6-water 528) + (tie-scissor-l6-water 529) + (tfrag-scissor-l6-water 530) + (etie-scissor-l6-water 531) (gmerc2-l6-water 532) (tex-l7-water 533) (merc-l7-water 534) (gmerc-l7-water 535) - (bucket536 536) - (bucket537 537) - (bucket538 538) - (bucket539 539) - (bucket540 540) - (bucket541 541) + (tfrag-l7-water 536) + (tie-l7-water 537) + (etie-l7-water 538) + (tie-scissor-l7-water 539) + (tfrag-scissor-l7-water 540) + (etie-scissor-l7-water 541) (gmerc2-l7-water 542) (tex-l8-water 543) (merc-l8-water 544) (gmerc-l8-water 545) - (bucket546 546) - (bucket547 547) - (bucket548 548) - (bucket549 549) - (bucket550 550) - (bucket551 551) + (tfrag-l8-water 546) + (tie-l8-water 547) + (etie-l8-water 548) + (tie-scissor-l8-water 549) + (tfrag-scissor-l8-water 550) + (etie-scissor-l8-water 551) (gmerc2-l8-water 552) (tex-l9-water 553) (merc-l9-water 554) (gmerc-l9-water 555) - (bucket556 556) - (bucket557 557) - (bucket558 558) - (bucket559 559) - (bucket560 560) - (bucket561 561) + (tfrag-l9-water 556) + (tie-l9-water 557) + (etie-l9-water 558) + (tie-scissor-l9-water 559) + (tfrag-scissor-l9-water 560) + (etie-scissor-l9-water 561) (gmerc2-l9-water 562) (tex-lcom-water 563) @@ -705,12 +705,12 @@ (rn5) (rn6) (rn7) - (rn8) - (rn9) - (rn10) - (rn11) - (rn12) - (rn13) + (tfrag) + (tie-scissor) + (tie) + (etie) + (etie-scissor) + (tie-vanish) (generic) ;; right (merc) ;; right (emerc) ;; right @@ -718,16 +718,16 @@ (shrub-near) (billboard) (shrub-vanish) - (rn21) - (rn22) - (rn23) - (rn24) - (rn25) - (rn26) - (rn27) - (rn28) - (rn29) - (rn30) + (tfrag-trans) + (tie-scissor-trans) + (tie-trans) + (etie-trans) + (etie-scissor-trans) + (tfrag-water) + (tie-scissor-water) + (tie-water) + (etie-water) + (etie-scissor-water) (rn31) (rn32) (rn33) diff --git a/goal_src/jak3/engine/level/level-h.gc b/goal_src/jak3/engine/level/level-h.gc index 0deedde79..eef22d22e 100644 --- a/goal_src/jak3/engine/level/level-h.gc +++ b/goal_src/jak3/engine/level/level-h.gc @@ -337,6 +337,7 @@ (loaded-texture-page-count int32) (entity entity-links-array) (closest-object meters 10) + (tie-min-dist float :offset 352) (upload-size int32 20 :offset 388) (inside-boxes? basic) (display? symbol) @@ -380,7 +381,7 @@ (alpha-dists pointer) (water-masks texture-masks-array) (water-dists pointer) - (tfrag-last-calls int32 6) + (tfrag-last-calls uint32 6) (texture-anim-array texture-anim-array 11) (light-hash light-hash) (draw-priority float) diff --git a/test/decompiler/reference/jak3/engine/common-obs/prim-h_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/prim-h_REF.gc index 4e5d69c9d..c96e86266 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/prim-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/prim-h_REF.gc @@ -32,7 +32,7 @@ some special effect code, then sent to the prim renderer to be drawn." "Base class for prim-strip." () (:methods - (prim-base-method-9 () none) + (generate-dma! (_type_ matrix) none) ) ) @@ -71,7 +71,7 @@ These are owned by the thing submitting to prim, not the prim renderer itself." ) (:methods (new (symbol type int texture-id string) _type_) - (prim-strip-method-10 (_type_ draw-control) none) + (setup-dma-and-tex (_type_ draw-control) none) ) ) @@ -112,7 +112,7 @@ These are owned by the thing submitting to prim, not the prim renderer itself." (go process-drawable-art-error "prim-strip") ) (add-connection *prim-engine* pp #f pp s5-0 #f) - (set! (-> s5-0 flags) (prim-flags pf0 pf1)) + (set! (-> s5-0 flags) (prim-flags alpha-blend-enable texture-enable)) (set! (-> s5-0 num-verts) (the-as uint num-vertices)) (set! (-> s5-0 allocated-num-verts) (the-as uint num-vertices)) (set! (-> s5-0 data0) (new 'static 'gs-test)) @@ -198,11 +198,11 @@ These are owned by the thing submitting to prim, not the prim renderer itself." (mask vector4w :inline) (in-verts int32) (num-verts int32) - (vert-ptr prim-vertex) + (vert-ptr (inline-array prim-vertex)) (sinks prim-sink 68 :inline) ) (:methods - (prim-work-method-9 () none) + (reset! (_type_) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/prim_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/prim_REF.gc new file mode 100644 index 000000000..e1deabe7c --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/prim_REF.gc @@ -0,0 +1,130 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *prim-work*, type prim-work +(define *prim-work* + (new 'static 'prim-work + :vertex-tmpl (new 'static 'inline-array dma-packet 3 + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v4-32)) + ) + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v4-32)) + ) + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v4-32)) + ) + ) + :control-tmpl (new 'static 'inline-array dma-packet 2 + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xc :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #xc :cmd (vif-cmd unpack-v4-32)) + ) + (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xc :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #xc :cmd (vif-cmd unpack-v4-32)) + ) + ) + :giftag (new 'static 'generic-gif-tag + :fan-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :str-prim (new 'static 'gif-tag-prim + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + :regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + :num-strips #x1 + ) + :call-scissor (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscalf) :msk #x1) + ) + :call-noclip (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x8 :cmd (vif-cmd mscalf) :msk #x1) + ) + :mask (new 'static 'vector4w :x -2 :y -1 :z -1) + ) + ) + +;; definition for method 9 of type prim-work +;; WARN: Return type mismatch int vs none. +(defmethod reset! ((this prim-work)) + "Reset all pending vertex/control data." + (dotimes (v1-0 68) + (let ((a1-2 (-> this sinks v1-0))) + (set! (-> a1-2 vertex-count) (the-as uint 0)) + (set! (-> a1-2 control-count) (the-as uint 0)) + ) + 0 + ) + 0 + (none) + ) + +;; definition for method 9 of type prim-strip +;; INFO: function output is handled by mips2c +(defmethod-mips2c "(method 9 prim-strip)" 9 prim-strip) + +;; definition for method 10 of type prim-strip +;; WARN: Return type mismatch int vs none. +(defmethod setup-dma-and-tex ((this prim-strip) (arg0 draw-control)) + "Set up the bucket, prim sink, and texture." + (let ((s5-0 (-> *level* level (-> arg0 level-index)))) + (let ((s2-0 (-> s5-0 draw-index)) + (s4-0 (-> arg0 default-texture-page)) + ) + (let ((s3-0 (vu1-bucket-map s2-0 (the-as int s4-0) (merc-mode mercneric2))) + (v1-3 (vu1-bucket-map s2-0 (the-as int s4-0) (merc-mode mm5))) + ) + (set! (-> this bucket) s3-0) + (set! (-> this sink) (the-as uint v1-3)) + ) + (set! (-> this level) s5-0) + (set! (-> this texture-index) s4-0) + ) + (when (not (logtest? (-> this flags) (prim-flags no-texture-name))) + (set! (-> this tex-id) + (lookup-level-texture-id-by-name (the-as string (-> this tex-name)) s5-0 (the-as int (-> this texture-index))) + ) + (logior! (-> this flags) (prim-flags no-texture-name)) + ) + ) + 0 + (none) + ) + +;; definition for function prim-engine-execute +;; WARN: Return type mismatch int vs none. +(defun prim-engine-execute () + "Generate all prim DMA." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask generic)) + (when (not (get-menu-mode *blit-displays-work*)) + (let* ((gp-0 *prim-engine*) + (s5-0 (-> *math-camera* camera-temp)) + (v1-9 (-> gp-0 alive-list next0)) + (s4-0 (-> (the-as connection v1-9) next0)) + ) + (while (!= v1-9 (-> gp-0 alive-list-end)) + (-> (the-as connection v1-9) param1) + (generate-dma! (the-as prim-strip (-> (the-as connection v1-9) param2)) s5-0) + (set! v1-9 s4-0) + (set! s4-0 (-> s4-0 next0)) + ) + ) + ) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/tfrag/tfrag-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-h_REF.gc similarity index 99% rename from test/decompiler/reference/jak3/engine/gfx/tfrag/tfrag-h_REF.gc rename to test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-h_REF.gc index 5a9f33349..47a5cdc3f 100644 --- a/test/decompiler/reference/jak3/engine/gfx/tfrag/tfrag-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-h_REF.gc @@ -75,6 +75,7 @@ (dma-base uint32 :overlay-at (-> dma-chain 1)) (dma-level-1 uint32 :overlay-at (-> dma-chain 2)) (dma-qwc uint8 4 :offset 44) + (dma-qwc-word uint32 :overlay-at (-> dma-qwc 0)) (shader (inline-array adgif-shader) :offset 48) (num-shaders uint8 :offset 52) (num-base-colors uint8 :offset 53) @@ -451,7 +452,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-methods_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-methods_REF.gc new file mode 100644 index 000000000..212eb3969 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-methods_REF.gc @@ -0,0 +1,898 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function edge-debug-lines +;; WARN: Return type mismatch symbol vs none. +(defun edge-debug-lines ((arg0 (array vector-array))) + "Draw tfrag debug lines. These debug-lines are not stored in retail copies." + (when (nonzero? arg0) + (dotimes (s5-0 (-> arg0 length)) + (when (logtest? *display-strip-lines* (ash 1 s5-0)) + (let ((s4-0 (-> arg0 s5-0))) + (dotimes (s3-0 (/ (-> s4-0 length) 2)) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 data (* s3-0 2)) + (-> s4-0 data (+ (* s3-0 2) 1)) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + #f + (the-as rgba -1) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-drawable-tree-tfrag +;; WARN: Return type mismatch drawable-tree-tfrag vs none. +(defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag)) + "Top-level function to generate DMA for tfrag." + (local-vars (sv-16 int)) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (let ((s5-0 (+ (-> arg0 length) -1))) + (when (nonzero? s5-0) + (dotimes (s4-0 s5-0) + (let* ((v1-8 (-> arg0 arrays s4-0)) + (a0-4 (-> arg0 arrays (+ s4-0 1))) + (a1-1 (/ (-> (the-as drawable-inline-array-node v1-8) data 0 id) 8)) + (a0-6 (/ (-> (the-as drawable-inline-array-node a0-4) data 0 id) 8)) + (a1-3 (+ a1-1 #x3800 #x70000000)) + (a0-8 (+ a0-6 #x3800 #x70000000)) + ) + (draw-node-cull + (the-as pointer a0-8) + (the-as pointer a1-3) + (the-as (inline-array draw-node) (&+ v1-8 32)) + (-> v1-8 length) + ) + ) + ) + ) + (let* ((v1-14 (-> arg0 arrays s5-0)) + (s4-1 (&+ v1-14 32)) + (s3-0 (-> v1-14 length)) + ) + (set! sv-16 (+ (/ (-> s4-1 id) 8) #x3800 #x70000000)) + (let ((s5-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tfrag-l0-tfrag) + (bucket-id tfrag-l1-tfrag) + (bucket-id tfrag-l2-tfrag) + (bucket-id tfrag-l3-tfrag) + (bucket-id tfrag-l4-tfrag) + (bucket-id tfrag-l5-tfrag) + (bucket-id tfrag-l6-tfrag) + (bucket-id tfrag-l7-tfrag) + (bucket-id tfrag-l8-tfrag) + (bucket-id tfrag-l9-tfrag) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp tfrag-closest))) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag (the-as pointer sv-16) s4-1 s3-0 s1-0) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 0) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 42) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + ) + (with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tfrag-scissor-l0-tfrag) + (bucket-id tfrag-scissor-l1-tfrag) + (bucket-id tfrag-scissor-l2-tfrag) + (bucket-id tfrag-scissor-l3-tfrag) + (bucket-id tfrag-scissor-l4-tfrag) + (bucket-id tfrag-scissor-l5-tfrag) + (bucket-id tfrag-scissor-l6-tfrag) + (bucket-id tfrag-scissor-l7-tfrag) + (bucket-id tfrag-scissor-l8-tfrag) + (bucket-id tfrag-scissor-l9-tfrag) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s4-1 s3-0 s1-1) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 1) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 43) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + ) + (let ((a0-33 *dma-mem-usage*)) + (when (nonzero? a0-33) + (set! (-> a0-33 length) (max 2 (-> a0-33 length))) + (set! (-> a0-33 data 1 name) "tfragment") + (+! (-> a0-33 data 1 count) 1) + (+! (-> a0-33 data 1 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) + ) + (set! (-> a0-33 data 1 total) (-> a0-33 data 1 used)) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-drawable-tree-tfrag-trans +;; WARN: Return type mismatch drawable-tree-tfrag vs none. +(defun draw-drawable-tree-tfrag-trans ((arg0 drawable-tree-tfrag)) + "Top-level function to generate DMA for tfrag." + (local-vars (sv-16 int)) + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (let ((s5-0 (+ (-> arg0 length) -1))) + (when (nonzero? s5-0) + (dotimes (s4-0 s5-0) + (let* ((v1-7 (-> arg0 arrays s4-0)) + (a0-6 (-> arg0 arrays (+ s4-0 1))) + (a1-1 (/ (-> (the-as drawable-inline-array-node v1-7) data 0 id) 8)) + (a0-8 (/ (-> (the-as drawable-inline-array-node a0-6) data 0 id) 8)) + (a1-3 (+ a1-1 #x3800 #x70000000)) + (a0-10 (+ a0-8 #x3800 #x70000000)) + ) + (draw-node-cull + (the-as pointer a0-10) + (the-as pointer a1-3) + (the-as (inline-array draw-node) (&+ v1-7 32)) + (-> v1-7 length) + ) + ) + ) + ) + (let* ((v1-13 (-> arg0 arrays s5-0)) + (s5-1 (&+ v1-13 32)) + (s4-1 (-> v1-13 length)) + ) + (set! sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) + (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-l0-alpha) + (bucket-id tfrag-l1-alpha) + (bucket-id tfrag-l2-alpha) + (bucket-id tfrag-l3-alpha) + (bucket-id tfrag-l4-alpha) + (bucket-id tfrag-l5-alpha) + (bucket-id tfrag-l6-alpha) + (bucket-id tfrag-l7-alpha) + (bucket-id tfrag-l8-alpha) + (bucket-id tfrag-l9-alpha) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp alpha-closest))) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag (the-as pointer sv-16) s5-1 s4-1 s2-0) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 2) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 42) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + ) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-scissor-l0-alpha) + (bucket-id tfrag-scissor-l1-alpha) + (bucket-id tfrag-scissor-l2-alpha) + (bucket-id tfrag-scissor-l3-alpha) + (bucket-id tfrag-scissor-l4-alpha) + (bucket-id tfrag-scissor-l5-alpha) + (bucket-id tfrag-scissor-l6-alpha) + (bucket-id tfrag-scissor-l7-alpha) + (bucket-id tfrag-scissor-l8-alpha) + (bucket-id tfrag-scissor-l9-alpha) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s5-1 s4-1 s2-1) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 3) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 43) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-drawable-tree-tfrag-water +;; WARN: Return type mismatch drawable-tree-tfrag vs none. +(defun draw-drawable-tree-tfrag-water ((arg0 drawable-tree-tfrag)) + "Top-level function to generate DMA for tfrag." + (local-vars (sv-16 int)) + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (let ((s5-0 (+ (-> arg0 length) -1))) + (when (nonzero? s5-0) + (dotimes (s4-0 s5-0) + (let* ((v1-7 (-> arg0 arrays s4-0)) + (a0-6 (-> arg0 arrays (+ s4-0 1))) + (a1-1 (/ (-> (the-as drawable-inline-array-node v1-7) data 0 id) 8)) + (a0-8 (/ (-> (the-as drawable-inline-array-node a0-6) data 0 id) 8)) + (a1-3 (+ a1-1 #x3800 #x70000000)) + (a0-10 (+ a0-8 #x3800 #x70000000)) + ) + (draw-node-cull + (the-as pointer a0-10) + (the-as pointer a1-3) + (the-as (inline-array draw-node) (&+ v1-7 32)) + (-> v1-7 length) + ) + ) + ) + ) + (let* ((v1-13 (-> arg0 arrays s5-0)) + (s5-1 (&+ v1-13 32)) + (s4-1 (-> v1-13 length)) + ) + (set! sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)) + (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-l0-water) + (bucket-id tfrag-l1-water) + (bucket-id tfrag-l2-water) + (bucket-id tfrag-l3-water) + (bucket-id tfrag-l4-water) + (bucket-id tfrag-l5-water) + (bucket-id tfrag-l6-water) + (bucket-id tfrag-l7-water) + (bucket-id tfrag-l8-water) + (bucket-id tfrag-l9-water) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp water-closest))) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag (the-as pointer sv-16) s5-1 s4-1 s2-0) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 4) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 42) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + ) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 12 + (bucket-id tfrag-scissor-l0-water) + (bucket-id tfrag-scissor-l1-water) + (bucket-id tfrag-scissor-l2-water) + (bucket-id tfrag-scissor-l3-water) + (bucket-id tfrag-scissor-l4-water) + (bucket-id tfrag-scissor-l5-water) + (bucket-id tfrag-scissor-l6-water) + (bucket-id tfrag-scissor-l7-water) + (bucket-id tfrag-scissor-l8-water) + (bucket-id tfrag-scissor-l9-water) + (bucket-id bucket0) + (bucket-id bucket0) + ) + *draw-index* + ) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s5-1 s4-1 s2-1) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 5) (-> *tfrag-work* last-call)) + (update-wait-stats + (-> *perf-stats* data 43) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function tfrag-vu1-init-buf +;; WARN: Return type mismatch pointer vs none. +(defun tfrag-vu1-init-buf ((arg0 bucket-id) (arg1 gs-test) (arg2 int) (arg3 uint) (arg4 symbol)) + "Do all tfrag buffer setup for a single bucket." + (let ((v1-0 *display*) + (a0-1 32) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t1-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t1-0 real-buffer-end) (the-as int (&+ (-> t1-0 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((s4-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s4-0 (-> s4-0 last)) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s2-1 (-> s3-0 base)) + ) + (tfrag-init-buffer s3-0 arg1 arg2 arg4) + (let ((v1-14 (the-as object (-> s3-0 base)))) + (set! (-> (the-as dma-packet v1-14) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s4-0 next))) + (set! (-> (the-as dma-packet v1-14) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-14) vif1) (new 'static 'vif-tag)) + (set! (-> s3-0 base) (the-as pointer (&+ (the-as dma-packet v1-14) 16))) + ) + (set! (-> s4-0 next) (the-as uint s2-1)) + ) + ) + ) + (let ((s5-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s5-1 (-> s5-1 last)) + (let* ((s3-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s4-1 (-> s3-1 base)) + ) + (tfrag-end-buffer s3-1 (the-as int arg3)) + (let ((v0-5 (-> s3-1 base))) + (let ((v1-28 (the-as object (-> s3-1 base)))) + (set! (-> (the-as dma-packet v1-28) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-28) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-28) vif1) (new 'static 'vif-tag)) + (set! (-> s3-1 base) (&+ (the-as pointer v1-28) 16)) + ) + (set! (-> (the-as (pointer int32) (-> s5-1 last)) 1) (the-as int s4-1)) + (set! (-> s5-1 last) (the-as (pointer dma-tag) v0-5)) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function tfrag-scissor-vu1-init-buf +;; WARN: Return type mismatch pointer vs none. +;; ERROR: Failed store: (s.w! (+ v1-14 8) 0) at op 52 +;; ERROR: Failed store: (s.w! (+ v1-14 12) 0) at op 53 +;; ERROR: Failed store: (s.w! (+ v1-28 8) 0) at op 84 +;; ERROR: Failed store: (s.w! (+ v1-28 12) 0) at op 85 +;; ERROR: Failed store: (s.w! (+ v1-30 4) s4-1) at op 89 +(defun tfrag-scissor-vu1-init-buf ((arg0 bucket-id) (arg1 gs-test) (arg2 int) (arg3 uint) (arg4 symbol)) + (let ((v1-0 *display*) + (a0-1 32) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t1-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t1-0 real-buffer-end) (the-as int (&+ (-> t1-0 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((s4-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s4-0 (-> s4-0 last)) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s2-1 (-> s3-0 base)) + ) + (tfrag-scissor-init-buffer s3-0 arg1 arg2 arg4) + (let ((v1-14 (-> s3-0 base))) + (set! (-> (the-as (pointer uint64) v1-14)) (logior #x20000000 (shr (shl (-> s4-0 next) 33) 1))) + (s.w! (+ v1-14 8) 0) + (s.w! (+ v1-14 12) 0) + (set! (-> s3-0 base) (&+ v1-14 16)) + ) + (set! (-> s4-0 next) (the-as uint s2-1)) + ) + ) + ) + (let ((s5-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s5-1 (-> s5-1 last)) + (let* ((s3-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s4-1 (-> s3-1 base)) + ) + (tfrag-scissor-end-buffer s3-1 arg3) + (let ((v0-5 (-> s3-1 base))) + (let ((v1-28 (-> s3-1 base))) + (set! (-> (the-as (pointer int64) v1-28)) #x20000000) + (s.w! (+ v1-28 8) 0) + (s.w! (+ v1-28 12) 0) + (set! (-> s3-1 base) (&+ v1-28 16)) + ) + (let ((v1-30 (-> s5-1 last))) + (s.w! (+ v1-30 4) s4-1) + ) + (set! (-> s5-1 last) (the-as (pointer dma-tag) v0-5)) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition of type tfrag-init-data +(deftype tfrag-init-data (structure) + ((tfrag-bucket bucket-id) + (tfrag-scissor-bucket bucket-id) + (tfrag-trans-bucket bucket-id) + (tfrag-scissor-trans-bucket bucket-id) + (tfrag-water-bucket bucket-id) + (tfrag-water-scissor-bucket bucket-id) + ) + ) + +;; definition for method 3 of type tfrag-init-data +(defmethod inspect ((this tfrag-init-data)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'tfrag-init-data) + (format #t "~1Ttfrag-bucket: ~D~%" (-> this tfrag-bucket)) + (format #t "~1Ttfrag-scissor-bucket: ~D~%" (-> this tfrag-scissor-bucket)) + (format #t "~1Ttfrag-trans-bucket: ~D~%" (-> this tfrag-trans-bucket)) + (format #t "~1Ttfrag-scissor-trans-bucket: ~D~%" (-> this tfrag-scissor-trans-bucket)) + (format #t "~1Ttfrag-water-bucket: ~D~%" (-> this tfrag-water-bucket)) + (format #t "~1Ttfrag-water-scissor-bucket: ~D~%" (-> this tfrag-water-scissor-bucket)) + (label cfg-4) + this + ) + +;; definition for symbol *tfrag-init-table*, type (inline-array tfrag-init-data) +(define *tfrag-init-table* (new 'static 'inline-array tfrag-init-data 10 + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l0-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l0-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l0-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l0-alpha) + :tfrag-water-bucket (bucket-id tfrag-l0-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l0-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l1-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l1-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l1-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l1-alpha) + :tfrag-water-bucket (bucket-id tfrag-l1-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l1-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l2-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l2-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l2-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l2-alpha) + :tfrag-water-bucket (bucket-id tfrag-l2-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l2-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l3-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l3-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l3-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l3-alpha) + :tfrag-water-bucket (bucket-id tfrag-l3-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l3-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l4-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l4-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l4-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l4-alpha) + :tfrag-water-bucket (bucket-id tfrag-l4-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l4-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l5-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l5-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l5-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l5-alpha) + :tfrag-water-bucket (bucket-id tfrag-l5-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l5-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l6-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l6-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l6-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l6-alpha) + :tfrag-water-bucket (bucket-id tfrag-l6-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l6-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l7-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l7-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l7-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l7-alpha) + :tfrag-water-bucket (bucket-id tfrag-l7-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l7-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l8-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l8-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l8-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l8-alpha) + :tfrag-water-bucket (bucket-id tfrag-l8-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l8-water) + ) + (new 'static 'tfrag-init-data + :tfrag-bucket (bucket-id tfrag-l9-tfrag) + :tfrag-scissor-bucket (bucket-id tfrag-scissor-l9-tfrag) + :tfrag-trans-bucket (bucket-id tfrag-l9-alpha) + :tfrag-scissor-trans-bucket (bucket-id tfrag-scissor-l9-alpha) + :tfrag-water-bucket (bucket-id tfrag-l9-water) + :tfrag-water-scissor-bucket (bucket-id tfrag-scissor-l9-water) + ) + ) + ) + +;; definition for function tfrag-vu1-init-buffers +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-vu1-init-buffers () + "Initialize all tfrag buckets." + (dotimes (gp-0 10) + (let ((s5-0 (-> *level* draw-level gp-0)) + (s4-0 (-> *tfrag-init-table* gp-0)) + ) + (when s5-0 + (set-subdivide-settings! s5-0) + (let ((s3-0 (-> s5-0 tfrag-gs-test))) + (tfrag-vu1-init-buf + (-> s4-0 tfrag-bucket) + s3-0 + 0 + (-> s5-0 tfrag-last-calls 0) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-scissor-vu1-init-buf + (-> s4-0 tfrag-scissor-bucket) + s3-0 + 0 + (-> s5-0 tfrag-last-calls 1) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + ) + (tfrag-vu1-init-buf + (-> s4-0 tfrag-trans-bucket) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 1 + (-> s5-0 tfrag-last-calls 2) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-scissor-vu1-init-buf + (-> s4-0 tfrag-scissor-trans-bucket) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + 1 + (-> s5-0 tfrag-last-calls 3) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-vu1-init-buf + (-> s4-0 tfrag-water-bucket) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + 1 + (-> s5-0 tfrag-last-calls 4) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + (tfrag-scissor-vu1-init-buf + (-> s4-0 tfrag-water-scissor-bucket) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + 1 + (-> s5-0 tfrag-last-calls 5) + (logtest? (-> s5-0 info level-flags) (level-flags use-camera-other)) + ) + ) + ) + ) + (none) + ) + +;; definition for method 10 of type drawable-tree-tfrag +;; WARN: Return type mismatch int vs none. +(defmethod draw ((this drawable-tree-tfrag)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tfrag-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tfrag-trees v1-1) this) + (set! (-> *background-work* tfrag-levels v1-1) a1-3) + ) + (+! (-> *background-work* tfrag-tree-count) 1) + 0 + (none) + ) + +;; definition for method 10 of type drawable-tree-tfrag-trans +;; WARN: Return type mismatch int vs none. +(defmethod draw ((this drawable-tree-tfrag-trans)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tfrag-trans-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tfrag-trans-trees v1-1) this) + (set! (-> *background-work* tfrag-trans-levels v1-1) a1-3) + ) + (+! (-> *background-work* tfrag-trans-tree-count) 1) + 0 + (none) + ) + +;; definition for method 10 of type drawable-tree-tfrag-water +;; WARN: Return type mismatch int vs none. +(defmethod draw ((this drawable-tree-tfrag-water)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tfrag-water-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tfrag-water-trees v1-1) this) + (set! (-> *background-work* tfrag-water-levels v1-1) a1-3) + ) + (+! (-> *background-work* tfrag-water-tree-count) 1) + 0 + (none) + ) + +;; definition for method 13 of type tfragment +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this tfragment)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (stats-tfrag-asm this) + 0 + (none) + ) + +;; definition for method 13 of type drawable-tree-tfrag +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-tree-tfrag)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (set! (-> *tfrag-work* vu1-enable-tfrag) + (the-as int (logand (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag))) + ) + (set! (-> *tfrag-work* vu1-enable-tfrag-scissor) + (the-as int (logand (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag))) + ) + (set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag)) + (set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor)) + (let ((v1-15 (-> *tfrag-work* frag-dists quad))) + (set! (-> *tfrag-work* frag-dists quad) v1-15) + ) + (dotimes (s5-0 (-> this length)) + (collect-stats (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type drawable-tree-tfrag-trans +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-tree-tfrag-trans)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (set! (-> *tfrag-work* vu1-enable-tfrag) + (the-as int (logand (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* vu1-enable-tfrag-scissor) + (the-as int (logand (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag-trans)) + (set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor-trans)) + (let ((v1-12 (-> *tfrag-work* frag-dists quad))) + (set! (-> *tfrag-work* frag-dists quad) v1-12) + ) + (dotimes (s5-0 (-> this length)) + (collect-stats (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type drawable-tree-tfrag-water +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-tree-tfrag-water)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (set! (-> *tfrag-work* vu1-enable-tfrag) + (the-as int (logand (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* vu1-enable-tfrag-scissor) + (the-as int (logand (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user))) + ) + (set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag-water)) + (set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor-water)) + (let ((v1-12 (-> *tfrag-work* frag-dists quad))) + (set! (-> *tfrag-work* frag-dists quad) v1-12) + ) + (dotimes (s5-0 (-> this length)) + (collect-stats (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type drawable-inline-array-tfrag +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-inline-array-tfrag)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (collect-stats s4-0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type drawable-inline-array-tfrag-trans +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-inline-array-tfrag-trans)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (collect-stats s4-0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type drawable-inline-array-tfrag-water +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-inline-array-tfrag-water)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (collect-stats s4-0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type drawable-tree-tfrag +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw ((this drawable-tree-tfrag)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) + (dotimes (s5-0 (-> this length)) + (debug-draw (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type drawable-tree-tfrag-trans +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw ((this drawable-tree-tfrag-trans)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (debug-draw (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type drawable-tree-tfrag-water +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw ((this drawable-tree-tfrag-water)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) + (dotimes (s5-0 (-> this length)) + (debug-draw (-> this arrays s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type drawable-inline-array-tfrag +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw ((this drawable-inline-array-tfrag)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (dotimes (s5-0 (-> this length)) + (let ((s4-0 (-> this data s5-0))) + (if (vis-cull (-> s4-0 id)) + (debug-draw s4-0) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type tfragment +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw ((this tfragment)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (-> *display* frames (-> *display* on-screen) global-buf) + (edge-debug-lines (-> this debug-data debug-lines)) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-near_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-near_REF.gc new file mode 100644 index 000000000..c5d38dd50 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-near_REF.gc @@ -0,0 +1,80 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol tnear-vu1-block, type vu-function +(define tnear-vu1-block (new 'static 'vu-function :length #x38b :qlength #x1c6)) + +;; definition (debug) for function tfrag-details +;; WARN: Return type mismatch symbol vs none. +(defun-debug tfrag-details ((arg0 tfragment)) + (format 0 "id = ~d~%" (-> arg0 id)) + (format 0 "common:~%") + (let ((s5-0 (-> arg0 dma-qwc 0)) + (s4-0 (-> arg0 dma-common)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-0 s4-0) + (disasm-vif-tag (the-as (pointer vif-tag) s4-0) (the-as int (* s5-0 4)) (the-as symbol 0) #t) + ) + (format 0 "base:~%") + (let ((s5-1 (-> arg0 dma-qwc 1)) + (s4-1 (-> arg0 dma-base)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-1 s4-1) + (disasm-vif-tag (the-as (pointer vif-tag) s4-1) (the-as int (* s5-1 4)) (the-as symbol 0) #t) + ) + (format 0 "level-0:~%") + (let ((s5-2 (-> arg0 dma-qwc 3)) + (s4-2 (-> arg0 dma-qwc-word)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-2 s4-2) + (disasm-vif-tag (the-as (pointer vif-tag) s4-2) (the-as int (* s5-2 4)) (the-as symbol 0) #t) + ) + (format 0 "level-1:~%") + (let ((s5-3 (-> arg0 dma-qwc 2)) + (gp-1 (-> arg0 dma-level-1)) + ) + (format 0 "qwc = ~d, ref = ~x~%" s5-3 gp-1) + (disasm-vif-tag (the-as (pointer vif-tag) gp-1) (the-as int (* s5-3 4)) (the-as symbol 0) #t) + ) + (none) + ) + +;; definition (debug) for function clip-restore +;; INFO: Used lq/sq +;; WARN: Return type mismatch vector vs none. +(defun-debug clip-restore () + (let ((a0-0 (new-stack-vector0)) + (a1-0 (new 'stack-no-clear 'matrix)) + ) + (set! (-> a1-0 rvec quad) (the-as uint128 0)) + (set! (-> a1-0 uvec quad) (the-as uint128 0)) + (set! (-> a1-0 fvec quad) (the-as uint128 0)) + (set! (-> a1-0 trans quad) (the-as uint128 0)) + (set! (-> a0-0 x) 92648.22) + (set! (-> a0-0 y) 238025.03) + (set! (-> a0-0 z) 199836.31) + (set! (-> a0-0 w) 1.0) + (set! (-> a1-0 rvec x) -0.9283) + (set! (-> a1-0 rvec y) 0.0) + (set! (-> a1-0 rvec z) 0.3716) + (set! (-> a1-0 rvec w) 0.0) + (set! (-> a1-0 uvec x) -0.2257) + (set! (-> a1-0 uvec y) 0.7945) + (set! (-> a1-0 uvec z) -0.5637) + (set! (-> a1-0 uvec w) 0.0) + (set! (-> a1-0 fvec x) -0.2952) + (set! (-> a1-0 fvec y) -0.6072) + (set! (-> a1-0 fvec z) -0.7375) + (set! (-> a1-0 fvec w) 0.0) + (set! (-> a1-0 trans x) 0.0) + (set! (-> a1-0 trans y) 0.0) + (set! (-> a1-0 trans z) 0.0) + (set! (-> a1-0 trans w) 1.0) + (debug-set-camera-pos-rot! a0-0 a1-0) + ) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-work_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-work_REF.gc new file mode 100644 index 000000000..8fc6970bd --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag-work_REF.gc @@ -0,0 +1,45 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *tfrag-work*, type tfrag-work +(define *tfrag-work* (new 'static 'tfrag-work + :base-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :level-0-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :common-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :level-1-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x102 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xc000 :cmd (vif-cmd unpack-v4-8)) + ) + :max-fragment #xffff + ) + ) + +;; failed to figure out what this is: +(set! (-> *tfrag-work* color-ptr x) (+ 6144 #x70000000)) + +;; failed to figure out what this is: +(set! (-> *tfrag-work* color-ptr y) (+ 6144 #x70000000)) + +;; failed to figure out what this is: +(set! (-> *tfrag-work* color-ptr z) (+ 6144 #x70000000)) + +;; failed to figure out what this is: +(set! (-> *tfrag-work* color-ptr w) (+ 6144 #x70000000)) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag_REF.gc new file mode 100644 index 000000000..e5902ee12 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/tfrag/tfrag_REF.gc @@ -0,0 +1,618 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type tfragment +(defmethod login ((this tfragment)) + "Initialize the object after it is loaded." + (when (nonzero? *texture-masks-array*) + (dotimes (s5-0 (the-as int (-> this num-shaders))) + (let ((v1-3 (adgif-shader-login-no-remap (-> this shader s5-0))) + (a0-7 (-> *texture-masks-array* data (-> this texture-masks-index))) + ) + (when v1-3 + (dotimes (a1-3 3) + (dotimes (a2-0 3) + (set! (-> (the-as (pointer int32) (+ (+ (* a1-3 16) (* a2-0 4)) (the-as int a0-7)))) + (logior (-> (the-as (pointer int32) (+ (* a2-0 4) (the-as int a0-7) (* a1-3 16))) 0) + (-> (the-as texture (+ (* a2-0 4) (the-as int v1-3) (* a1-3 16))) masks data 0 mask x) + ) + ) + ) + (set! (-> a0-7 data a1-3 dist) (fmax (-> a0-7 data a1-3 dist) (-> v1-3 masks data a1-3 dist))) + ) + ) + ) + ) + ) + this + ) + +;; definition for method 8 of type tfragment +(defmethod mem-usage ((this tfragment) (usage memory-usage-block) (flags int)) + (when (logtest? flags 2) + (+! (-> usage data 19 count) 1) + (let ((v1-6 (+ (-> this num-base-colors) (-> this num-level0-colors) (-> this num-level1-colors)))) + (+! (-> usage data 19 used) v1-6) + (+! (-> usage data 19 total) (logand -4 (+ v1-6 3))) + ) + (set! this this) + (goto cfg-16) + ) + (let ((s4-0 1)) + (set! (-> usage length) (max (-> usage length) (+ s4-0 8))) + (set! (-> usage data s4-0 name) "tfragment") + (+! (-> usage data s4-0 count) 1) + (let ((v1-20 (asize-of this))) + (+! (-> usage data s4-0 used) v1-20) + (+! (-> usage data s4-0 total) (logand -16 (+ v1-20 15))) + ) + (set! (-> usage data (+ s4-0 1) name) "tfragment-base") + (+! (-> usage data (+ s4-0 1) count) 1) + (let ((v1-31 (* (-> this dma-qwc 0) 16))) + (+! (-> usage data (+ s4-0 1) used) v1-31) + (+! (-> usage data (+ s4-0 1) total) v1-31) + ) + (set! (-> usage data (+ s4-0 2) name) "tfragment-common") + (+! (-> usage data (+ s4-0 2) count) 1) + (let ((v1-41 (* (- (-> this dma-qwc 1) (-> this dma-qwc 0)) 16))) + (+! (-> usage data (+ s4-0 2) used) v1-41) + (+! (-> usage data (+ s4-0 2) total) v1-41) + ) + (set! (-> usage data (+ s4-0 3) name) "tfragment-level0") + (when (nonzero? (-> this num-level0-colors)) + (+! (-> usage data (+ s4-0 3) count) 1) + (let ((v1-53 (* (- (-> this dma-qwc 2) (-> this dma-qwc 0)) 16))) + (+! (-> usage data (+ s4-0 3) used) v1-53) + (+! (-> usage data (+ s4-0 3) total) v1-53) + ) + ) + (set! (-> usage data (+ s4-0 4) name) "tfragment-level1") + (when (not (or (= (-> this dma-level-1) (-> this dma-common)) + (= (-> this dma-level-1) (-> this dma-base)) + (zero? (-> this num-level1-colors)) + ) + ) + (+! (-> usage data (+ s4-0 4) count) 1) + (let ((v1-68 (* (- (-> this dma-qwc 3) + (- (/ (the-as int (- (-> this dma-level-1) (-> this dma-common))) 16) (-> this dma-qwc 0)) + ) + 16 + ) + ) + ) + (+! (-> usage data (+ s4-0 4) used) v1-68) + (+! (-> usage data (+ s4-0 4) total) v1-68) + ) + ) + (set! (-> usage data (+ s4-0 5) name) "tfragment-color") + (+! (-> usage data (+ s4-0 5) count) 1) + (let ((v1-77 + (if (logtest? flags 1) + 0 + (the-as int (* (+ (-> this num-base-colors) (-> this num-level0-colors) (-> this num-level1-colors)) 2)) + ) + ) + ) + (+! (-> usage data (+ s4-0 5) used) v1-77) + (+! (-> usage data (+ s4-0 5) total) (logand -16 (+ v1-77 15))) + ) + (set! (-> usage data (+ s4-0 6) name) "tfragment-debug") + ) + (label cfg-16) + this + ) + +;; definition for method 3 of type drawable-inline-array-tfrag +(defmethod inspect ((this drawable-inline-array-tfrag)) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~Tlength: ~D~%" (-> this length)) + (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) + (dotimes (s5-0 (-> this length)) + (format #t "~T [~D] ~A~%" s5-0 (-> this data s5-0)) + ) + this + ) + +;; definition for method 9 of type drawable-inline-array-tfrag +(defmethod login ((this drawable-inline-array-tfrag)) + "Initialize the object after it is loaded." + (set! *texture-masks-array* (-> *level* level *level-index* bsp tfrag-masks)) + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; definition for method 9 of type drawable-inline-array-tfrag-trans +(defmethod login ((this drawable-inline-array-tfrag-trans)) + "Initialize the object after it is loaded." + (set! *texture-masks-array* (-> *level* level *level-index* bsp alpha-masks)) + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; definition for method 9 of type drawable-inline-array-tfrag-water +(defmethod login ((this drawable-inline-array-tfrag-water)) + "Initialize the object after it is loaded." + (set! *texture-masks-array* (-> *level* level *level-index* bsp water-masks)) + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; definition for method 8 of type drawable-inline-array-tfrag +(defmethod mem-usage ((this drawable-inline-array-tfrag) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +;; definition for method 8 of type drawable-tree-tfrag +(defmethod mem-usage ((this drawable-tree-tfrag) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 0 used) v1-6) + (+! (-> usage data 0 total) (logand -16 (+ v1-6 15))) + ) + (when (nonzero? (-> this time-of-day-pal)) + (set! (-> usage length) (max 9 (-> usage length))) + (set! (-> usage data 8 name) "tfragment-pal") + (+! (-> usage data 8 count) 1) + (let ((v1-18 (asize-of (-> this time-of-day-pal)))) + (+! (-> usage data 8 used) v1-18) + (+! (-> usage data 8 total) (logand -16 (+ v1-18 15))) + ) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this arrays s3-0) usage flags) + ) + this + ) + +;; definition for method 5 of type drawable-inline-array-tfrag +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this drawable-inline-array-tfrag)) + (the-as int (+ (-> drawable-inline-array-tfrag size) (* (+ (-> this length) -1) 64))) + ) + +;; definition for symbol *tfrag-display-stats*, type symbol +(define *tfrag-display-stats* #f) + +;; definition for symbol tfrag-vu1-block, type vu-function +(define tfrag-vu1-block (new 'static 'vu-function :length #x74b :qlength #x3a6)) + +;; definition for function tfrag-data-setup +;; INFO: Used lq/sq +;; WARN: Return type mismatch tfrag-data vs none. +(defun tfrag-data-setup ((arg0 tfrag-data) (arg1 int) (arg2 int)) + "Set up VU1 constants" + (let ((v1-0 *math-camera*)) + (let ((a0-1 (-> arg0 data))) + (set! (-> a0-1 0) (the-as uint (-> v1-0 pfog0))) + (set! (-> a0-1 1) (the-as uint (-> v1-0 fog-min))) + (set! (-> a0-1 2) (the-as uint (-> v1-0 fog-max))) + (set! (-> a0-1 3) (the-as uint 3072.0)) + ) + (set-vector! (-> arg0 val) 0.5 1.0 2048.0 0.0) + (set-vector! (-> arg0 ambient) 1.0 1.0 1.0 1.0) + (let ((a0-4 arg2)) + (cond + ((zero? a0-4) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + ) + ((= a0-4 1) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + ) + ((= a0-4 2) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1 :abe arg1) + ) + ) + ) + ((= a0-4 3) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + (set! (-> arg0 fangif tag) + (new 'static 'gif-tag64 + :pre #x1 + :nreg #x3 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe arg1) + ) + ) + ) + ) + ) + (set! (-> arg0 strgif regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> arg0 fangif regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1)) + (set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad)) + (set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad)) + (set! (-> arg0 invh-scale quad) (-> v1-0 inv-hmge-scale quad)) + (set! (-> arg0 guard quad) (-> v1-0 guard quad)) + ) + (set-tfrag-dists! (-> arg0 dists)) + (none) + ) + +;; definition for function add-tfrag-mtx-0 +;; WARN: Return type mismatch pointer vs none. +(defun add-tfrag-mtx-0 ((arg0 dma-buffer) (arg1 symbol)) + "Add DMA for transferring matrix0 (same as matrix1)" + (let* ((a2-0 4) + (v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd unpack-v4-32) :num a2-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (if arg1 + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp-other) + ) + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp) + ) + ) + (&+! (-> arg0 base) 64) + (none) + ) + +;; definition for function add-tfrag-mtx-1 +;; WARN: Return type mismatch pointer vs none. +(defun add-tfrag-mtx-1 ((arg0 dma-buffer) (arg1 symbol)) + "Add DMA for transferring matrix1 (same as matrix0)" + (let* ((a2-0 4) + (v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x14d :cmd (vif-cmd unpack-v4-32) :num a2-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (if arg1 + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp-other) + ) + (column-scale-matrix! + (the-as matrix (-> arg0 base)) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (-> *math-camera* camera-temp) + ) + ) + (&+! (-> arg0 base) 64) + (none) + ) + +;; definition for function add-tfrag-data +;; WARN: Return type mismatch dma-packet vs none. +(defun add-tfrag-data ((arg0 dma-buffer) (arg1 int) (arg2 int)) + "Add DMA for tfrag constants." + (let* ((a3-0 14) + (v1-0 arg0) + (a0-1 (the-as dma-packet (-> v1-0 base))) + ) + (set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a3-0)) + (set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x290 :cmd (vif-cmd unpack-v4-32) :num a3-0)) + (set! (-> v1-0 base) (the-as pointer (&+ a0-1 16))) + ) + (tfrag-data-setup (the-as tfrag-data (-> arg0 base)) arg1 arg2) + (&+! (-> arg0 base) 224) + (let ((v1-3 (the-as dma-packet (-> arg0 base)))) + (set! (-> v1-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> v1-3 vif0) (new 'static 'vif-tag)) + (set! (-> v1-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1)) + (set! (-> arg0 base) (the-as pointer (&+ v1-3 16))) + ) + (none) + ) + +;; definition for symbol t-stat, type tfrag-stats +(define t-stat (new 'global 'tfrag-stats)) + +;; definition for function tfrag-print-stats +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-print-stats ((arg0 symbol)) + "Print out accumulated tfrag stats." + (when (and *tfrag-display-stats* (!= *master-mode* 'menu)) + (format arg0 "~%") + (format arg0 "tris: ~8d~%" (-> t-stat tris)) + (format arg0 "verts: ~8d~%" (+ (-> t-stat base-verts) (-> t-stat level0-verts) (-> t-stat level1-verts))) + (format arg0 " base: ~8d~%" (-> t-stat base-verts)) + (format arg0 " lev0: ~8d~%" (-> t-stat level0-verts)) + (format arg0 " lev1: ~8d~%" (-> t-stat level1-verts)) + (format arg0 "tfaces: ~8d~%" (-> t-stat tfaces)) + (format arg0 "tfrags: ~8d~%" (-> t-stat tfrags)) + (format arg0 "dtris: ~8d~%" (-> t-stat dtris)) + (format arg0 "dps: ~8d~%" (-> t-stat drawpoints)) + (format arg0 "strips: ~8d~%" (-> t-stat strips)) + (format arg0 "shaders:~8d~%" (-> t-stat dma-tex)) + (format arg0 "tri/str:~8f~%" (/ (the float (-> t-stat dtris)) (the float (-> t-stat strips)))) + (format arg0 "dma-cnt:~8d (~8d)~%" (-> t-stat dma-cnt) (* (-> t-stat dma-cnt) 32)) + (format arg0 "dma-dta:~8d (~8d)~%" (-> t-stat dma-dta) (/ (* 33 (-> t-stat dma-dta)) 10)) + (let ((f0-4 (* 32.0 (the float (-> t-stat dma-cnt)))) + (f1-5 (* 3.3 (the float (-> t-stat dma-dta)))) + (f2-3 (* 30.0 (the float (-> t-stat tfrags)))) + ) + (+ f0-4 f1-5 f2-3) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(set! (-> t-stat from) 0) + +;; failed to figure out what this is: +(set! (-> t-stat to) 0) + +;; failed to figure out what this is: +(set! (-> t-stat cnt) 0) + +;; definition for function tfrag-init-buffer +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-init-buffer ((arg0 dma-buffer) (arg1 gs-test) (arg2 int) (arg3 symbol)) + "Initialize DMA bucket for Tfrag rendering." + (let ((v1-0 *display*) + (a0-6 (+ (* (+ (/ (-> tfrag-vu1-block qlength) 127) 1) 16) 480)) + ) + (+! (-> v1-0 mem-reserve-size) a0-6) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-vu-function arg0 tfrag-vu1-block 1) + (dma-buffer-add-gs-set arg0 (test-1 arg1)) + (add-tfrag-mtx-0 arg0 arg3) + (add-tfrag-mtx-1 arg0 arg3) + (add-tfrag-data arg0 arg2 (the-as int *subdivide-draw-mode*)) + (let ((v1-5 (the-as dma-packet (-> arg0 base)))) + (set! (-> v1-5 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> v1-5 vif0) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> v1-5 vif1) (new 'static 'vif-tag :imm #x148 :cmd (vif-cmd offset))) + (set! (-> arg0 base) (the-as pointer (&+ v1-5 16))) + ) + ) + ) + ) + (none) + ) + +;; definition for function tfrag-end-buffer +;; WARN: Return type mismatch symbol vs none. +(defun tfrag-end-buffer ((arg0 dma-buffer) (arg1 int)) + "Finalize DMA bucket for tfrag rendering." + (let ((v1-0 *display*) + (a2-0 64) + ) + (+! (-> v1-0 mem-reserve-size) a2-0) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-0))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let* ((v1-2 arg0) + (a2-4 (the-as dma-packet (-> v1-2 base))) + ) + (set! (-> a2-4 dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) + (set! (-> a2-4 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmask))) + (set! (-> a2-4 vif1) (new 'static 'vif-tag)) + (set! (-> v1-2 base) (the-as pointer (&+ a2-4 16))) + ) + (let* ((v1-3 arg0) + (a0-1 (-> v1-3 base)) + ) + (set! (-> (the-as (pointer vif-tag) a0-1) 0) (the-as vif-tag arg1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 2) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> (the-as (pointer vif-tag) a0-1) 3) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> (the-as (pointer int32) a0-1) 4) 0) + (set! (-> (the-as (pointer int32) a0-1) 5) 0) + (set! (-> (the-as (pointer int32) a0-1) 6) 0) + (set! (-> (the-as (pointer int32) a0-1) 7) 0) + (set! (-> (the-as (pointer vif-tag) a0-1) 8) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> (the-as (pointer vif-tag) a0-1) 9) (new 'static 'vif-tag :cmd (vif-cmd offset))) + (set! (-> (the-as (pointer vif-tag) a0-1) 10) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as (pointer vif-tag) a0-1) 11) (new 'static 'vif-tag)) + (set! (-> v1-3 base) (&+ a0-1 48)) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-inline-array-tfrag +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function tfrag-scissor-init-buffer +;; WARN: Return type mismatch symbol vs none. +;; ERROR: Failed store: (s.w! (+ v1-5 8) a0-21) at op 77 +;; ERROR: Failed store: (s.w! (+ v1-5 12) a0-22) at op 79 +(defun tfrag-scissor-init-buffer ((arg0 dma-buffer) (arg1 gs-test) (arg2 int) (arg3 symbol)) + (let ((v1-0 *display*) + (a0-6 (+ (* (+ (/ (-> tnear-vu1-block qlength) 127) 1) 16) 496)) + ) + (+! (-> v1-0 mem-reserve-size) a0-6) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-vu-function arg0 tnear-vu1-block 1) + (dma-buffer-add-gs-set arg0 (test-1 arg1)) + (add-tfrag-mtx-0 arg0 arg3) + (add-tfrag-mtx-1 arg0 arg3) + (add-tfrag-data arg0 arg2 (the-as int *subdivide-scissor-draw-mode*)) + (let ((v1-5 (-> arg0 base))) + (set! (-> (the-as (pointer int64) v1-5)) #x10000000) + (let ((a0-21 #x3000000)) + (s.w! (+ v1-5 8) a0-21) + ) + (let ((a0-22 #x2000148)) + (s.w! (+ v1-5 12) a0-22) + ) + (set! (-> arg0 base) (&+ v1-5 16)) + ) + ) + ) + ) + (none) + ) + +;; definition for function tfrag-scissor-end-buffer +;; WARN: Return type mismatch symbol vs none. +;; ERROR: Failed store: (s.w! (+ a2-4 8) a3-11) at op 25 +;; ERROR: Failed store: (s.w! (+ a2-4 12) 0) at op 26 +;; ERROR: Failed store: (s.w! (+ a0-1 4) a1-1) at op 33 +;; ERROR: Failed store: (s.w! (+ a0-1 8) a1-2) at op 35 +;; ERROR: Failed store: (s.w! (+ a0-1 12) a1-3) at op 37 +;; ERROR: Failed store: (s.w! (+ a0-1 16) 0) at op 38 +;; ERROR: Failed store: (s.w! (+ a0-1 20) 0) at op 39 +;; ERROR: Failed store: (s.w! (+ a0-1 24) 0) at op 40 +;; ERROR: Failed store: (s.w! (+ a0-1 28) 0) at op 41 +;; ERROR: Failed store: (s.w! (+ a0-1 32) a1-4) at op 43 +;; ERROR: Failed store: (s.w! (+ a0-1 36) a1-5) at op 45 +;; ERROR: Failed store: (s.w! (+ a0-1 40) a1-6) at op 47 +;; ERROR: Failed store: (s.w! (+ a0-1 44) 0) at op 48 +(defun tfrag-scissor-end-buffer ((arg0 dma-buffer) (arg1 uint)) + (let ((v1-0 *display*) + (a2-0 64) + ) + (+! (-> v1-0 mem-reserve-size) a2-0) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-0))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let* ((v1-2 arg0) + (a2-4 (-> v1-2 base)) + ) + (set! (-> (the-as (pointer int64) a2-4)) #x10000003) + (let ((a3-11 #x20000000)) + (s.w! (+ a2-4 8) a3-11) + ) + (s.w! (+ a2-4 12) 0) + (set! (-> v1-2 base) (&+ a2-4 16)) + ) + (let* ((v1-3 arg0) + (a0-1 (-> v1-3 base)) + ) + (set! (-> (the-as (pointer uint32) a0-1)) arg1) + (let ((a1-1 #x13000000)) + (s.w! (+ a0-1 4) a1-1) + ) + (let ((a1-2 #x5000000)) + (s.w! (+ a0-1 8) a1-2) + ) + (let ((a1-3 #x30000000)) + (s.w! (+ a0-1 12) a1-3) + ) + (s.w! (+ a0-1 16) 0) + (s.w! (+ a0-1 20) 0) + (s.w! (+ a0-1 24) 0) + (s.w! (+ a0-1 28) 0) + (let ((a1-4 #x3000000)) + (s.w! (+ a0-1 32) a1-4) + ) + (let ((a1-5 #x2000000)) + (s.w! (+ a0-1 36) a1-5) + ) + (let ((a1-6 #x1000404)) + (s.w! (+ a0-1 40) a1-6) + ) + (s.w! (+ a0-1 44) 0) + (set! (-> v1-3 base) (&+ a0-1 48)) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-inline-array-tfrag-scissor +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function stats-tfrag-asm +;; ERROR: function was not converted to expressions. Cannot decompile. + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/tie/generic-tie-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tie/generic-tie-h_REF.gc similarity index 100% rename from test/decompiler/reference/jak3/engine/gfx/tie/generic-tie-h_REF.gc rename to test/decompiler/reference/jak3/engine/gfx/background/tie/generic-tie-h_REF.gc diff --git a/test/decompiler/reference/jak3/engine/gfx/tie/tie-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-h_REF.gc similarity index 100% rename from test/decompiler/reference/jak3/engine/gfx/tie/tie-h_REF.gc rename to test/decompiler/reference/jak3/engine/gfx/background/tie/tie-h_REF.gc diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-methods_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-methods_REF.gc new file mode 100644 index 000000000..4cadfecef --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-methods_REF.gc @@ -0,0 +1,2317 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type tie-debug +(deftype tie-debug (structure) + ((max-instance uint32) + (min-instance uint32) + (test-fragment uint32) + (frag-count uint32) + ) + ) + +;; definition for method 3 of type tie-debug +(defmethod inspect ((this tie-debug)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'tie-debug) + (format #t "~1Tmax-instance: ~D~%" (-> this max-instance)) + (format #t "~1Tmin-instance: ~D~%" (-> this min-instance)) + (format #t "~1Ttest-fragment: ~D~%" (-> this test-fragment)) + (format #t "~1Tfrag-count: ~D~%" (-> this frag-count)) + (label cfg-4) + this + ) + +;; definition for symbol *tie*, type tie-debug +(define *tie* (new 'global 'tie-debug)) + +;; definition for function tie-debug-between +(defun tie-debug-between ((arg0 uint) (arg1 uint)) + (set! (-> *instance-tie-work* test-id) arg1) + (set! (-> *instance-tie-work* test-id2) arg0) + arg0 + ) + +;; definition for function tie-debug-one +(defun tie-debug-one ((arg0 uint) (arg1 uint)) + (set! (-> *instance-tie-work* test-id) (+ arg1 -1 arg0)) + (set! (-> *instance-tie-work* test-id2) arg0) + arg0 + ) + +;; definition for function tie-debug-frag-between +(defun tie-debug-frag-between ((arg0 uint) (arg1 uint)) + (set! (-> *tie* test-fragment) arg0) + (let ((v0-0 (- arg1 arg0))) + (set! (-> *tie* frag-count) v0-0) + v0-0 + ) + ) + +;; definition for function tie-debug-frag-one +(defun tie-debug-frag-one ((arg0 uint) (arg1 uint)) + (set! (-> *tie* test-fragment) arg0) + (set! (-> *tie* frag-count) arg1) + arg1 + ) + +;; definition for function walk-tie-generic-prototypes +;; WARN: Return type mismatch symbol vs none. +(defun walk-tie-generic-prototypes () + (none) + ) + +;; definition for symbol *pke-hack*, type vector +(define *pke-hack* (new 'global 'vector)) + +;; definition for function draw-inline-array-instance-tie +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function draw-inline-array-prototype-tie-asm +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function instance-tie-patch-buckets +;; INFO: Used lq/sq +;; WARN: Return type mismatch pointer vs object. +;; ERROR: Failed store: (s.d! (the-as uint a0-5) a1-5) at op 46 +;; ERROR: Failed store: (s.d! (the-as uint a0-18) a1-23) at op 144 +;; ERROR: Failed store: (s.d! (the-as uint a0-31) a1-41) at op 242 +;; ERROR: Failed store: (s.d! (the-as uint a0-44) a1-59) at op 340 +;; ERROR: Failed store: (s.d! (the-as uint a0-57) a1-77) at op 438 +;; ERROR: Failed store: (s.d! (the-as uint a0-72) a1-95) at op 537 +;; ERROR: Failed store: (s.d! (the-as uint a0-87) a1-113) at op 636 +;; ERROR: Failed store: (s.d! (the-as uint a0-102) a1-131) at op 735 +;; ERROR: Failed store: (s.d! (the-as uint a0-117) a1-149) at op 834 +;; ERROR: Failed store: (s.d! (the-as uint a0-132) a1-167) at op 933 +;; ERROR: Failed store: (s.d! (the-as uint a0-147) a1-185) at op 1032 +;; ERROR: Failed store: (s.d! (the-as uint a0-162) a1-203) at op 1131 +;; ERROR: Failed store: (s.d! (the-as uint a0-176) a1-221) at op 1230 +;; ERROR: Failed store: (s.w! (+ a0-179 8) 0) at op 1239 +;; ERROR: Failed store: (s.w! (+ a0-179 12) 0) at op 1240 +(defun instance-tie-patch-buckets ((arg0 dma-buffer) (arg1 level)) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + (when (nonzero? (-> *prototype-tie-work* scissor-count)) + (let ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-17 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tie-scissor-l0-tfrag) + (bucket-id tie-scissor-l1-tfrag) + (bucket-id tie-scissor-l2-tfrag) + (bucket-id tie-scissor-l3-tfrag) + (bucket-id tie-scissor-l4-tfrag) + (bucket-id tie-scissor-l5-tfrag) + (bucket-id tie-scissor-l6-tfrag) + (bucket-id tie-scissor-l7-tfrag) + (bucket-id tie-scissor-l8-tfrag) + (bucket-id tie-scissor-l9-tfrag) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-1 (-> v1-17 base)) + (a0-5 (the-as object (-> *prototype-tie-work* scissor-last))) + ) + (let ((a3-1 (-> *prototype-tie-work* scissor-next))) + (set! (-> (the-as (pointer uint128) a1-1)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-1)) + (logior (logand (-> (the-as (pointer uint64) a1-1)) (the-as uint #x80000000ffffffff)) (shr (shl a3-1 33) 1)) + ) + ) + (let ((a1-5 (logior (logand (-> (the-as (pointer uint64) a0-5) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-1 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-5) a1-5) + ) + ) + (&+! (-> v1-17 base) 16) + ) + (let ((v1-25 *dma-mem-usage*)) + (when (nonzero? v1-25) + (set! (-> v1-25 length) (max 16 (-> v1-25 length))) + (set! (-> v1-25 data 15 name) "tie-scissor") + (+! (-> v1-25 data 15 count) 1) + (+! (-> v1-25 data 15 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-0)) + ) + (set! (-> v1-25 data 15 total) (-> v1-25 data 15 used)) + ) + ) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie)) + (when (nonzero? (-> *prototype-tie-work* tie-count)) + (let ((s5-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-43 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tie-l0-tfrag) + (bucket-id tie-l1-tfrag) + (bucket-id tie-l2-tfrag) + (bucket-id tie-l3-tfrag) + (bucket-id tie-l4-tfrag) + (bucket-id tie-l5-tfrag) + (bucket-id tie-l6-tfrag) + (bucket-id tie-l7-tfrag) + (bucket-id tie-l8-tfrag) + (bucket-id tie-l9-tfrag) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-19 (-> v1-43 base)) + (a0-18 (the-as object (-> *prototype-tie-work* tie-last))) + ) + (let ((a3-10 (-> *prototype-tie-work* tie-next))) + (set! (-> (the-as (pointer uint128) a1-19)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-19)) + (logior (logand (-> (the-as (pointer uint64) a1-19)) (the-as uint #x80000000ffffffff)) (shr (shl a3-10 33) 1)) + ) + ) + (let ((a1-23 (logior (logand (-> (the-as (pointer uint64) a0-18) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-19 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-18) a1-23) + ) + ) + (&+! (-> v1-43 base) 16) + ) + (let ((v1-51 *dma-mem-usage*)) + (when (nonzero? v1-51) + (set! (-> v1-51 length) (max 10 (-> v1-51 length))) + (set! (-> v1-51 data 9 name) "tie-fragment") + (+! (-> v1-51 data 9 count) 1) + (+! (-> v1-51 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) + ) + (set! (-> v1-51 data 9 total) (-> v1-51 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie)) + (when (nonzero? (-> *prototype-tie-work* envmap-count)) + (let ((s5-2 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-69 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id etie-l0-tfrag) + (bucket-id etie-l1-tfrag) + (bucket-id etie-l2-tfrag) + (bucket-id etie-l3-tfrag) + (bucket-id etie-l4-tfrag) + (bucket-id etie-l5-tfrag) + (bucket-id etie-l6-tfrag) + (bucket-id etie-l7-tfrag) + (bucket-id etie-l8-tfrag) + (bucket-id etie-l9-tfrag) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-37 (-> v1-69 base)) + (a0-31 (the-as object (-> *prototype-tie-work* envmap-last))) + ) + (let ((a3-19 (-> *prototype-tie-work* envmap-next))) + (set! (-> (the-as (pointer uint128) a1-37)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-37)) + (logior (logand (-> (the-as (pointer uint64) a1-37)) (the-as uint #x80000000ffffffff)) (shr (shl a3-19 33) 1)) + ) + ) + (let ((a1-41 (logior (logand (-> (the-as (pointer uint64) a0-31) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-37 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-31) a1-41) + ) + ) + (&+! (-> v1-69 base) 16) + ) + (let ((v1-77 *dma-mem-usage*)) + (when (nonzero? v1-77) + (set! (-> v1-77 length) (max 10 (-> v1-77 length))) + (set! (-> v1-77 data 9 name) "tie-fragment") + (+! (-> v1-77 data 9 count) 1) + (+! (-> v1-77 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-2)) + ) + (set! (-> v1-77 data 9 total) (-> v1-77 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie-scissor)) + (when (nonzero? (-> *prototype-tie-work* envmap-scissor-count)) + (let ((s5-3 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-95 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id etie-scissor-l0-tfrag) + (bucket-id etie-scissor-l1-tfrag) + (bucket-id etie-scissor-l2-tfrag) + (bucket-id etie-scissor-l3-tfrag) + (bucket-id etie-scissor-l4-tfrag) + (bucket-id etie-scissor-l5-tfrag) + (bucket-id etie-scissor-l6-tfrag) + (bucket-id etie-scissor-l7-tfrag) + (bucket-id etie-scissor-l8-tfrag) + (bucket-id etie-scissor-l9-tfrag) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-55 (-> v1-95 base)) + (a0-44 (the-as object (-> *prototype-tie-work* envmap-scissor-last))) + ) + (let ((a3-28 (-> *prototype-tie-work* envmap-scissor-next))) + (set! (-> (the-as (pointer uint128) a1-55)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-55)) + (logior (logand (-> (the-as (pointer uint64) a1-55)) (the-as uint #x80000000ffffffff)) (shr (shl a3-28 33) 1)) + ) + ) + (let ((a1-59 (logior (logand (-> (the-as (pointer uint64) a0-44) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-55 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-44) a1-59) + ) + ) + (&+! (-> v1-95 base) 16) + ) + (let ((v1-103 *dma-mem-usage*)) + (when (nonzero? v1-103) + (set! (-> v1-103 length) (max 10 (-> v1-103 length))) + (set! (-> v1-103 data 9 name) "tie-fragment") + (+! (-> v1-103 data 9 count) 1) + (+! (-> v1-103 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-3)) + ) + (set! (-> v1-103 data 9 total) (-> v1-103 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-vanish)) + (when (nonzero? (-> *prototype-tie-work* vanish-count)) + (let ((s5-4 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-121 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tie-vanish-l0-tfrag) + (bucket-id tie-vanish-l1-tfrag) + (bucket-id tie-vanish-l2-tfrag) + (bucket-id tie-vanish-l3-tfrag) + (bucket-id tie-vanish-l4-tfrag) + (bucket-id tie-vanish-l5-tfrag) + (bucket-id tie-vanish-l6-tfrag) + (bucket-id tie-vanish-l7-tfrag) + (bucket-id tie-vanish-l8-tfrag) + (bucket-id tie-vanish-l9-tfrag) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-73 (-> v1-121 base)) + (a0-57 (the-as object (-> *prototype-tie-work* vanish-last))) + ) + (let ((a3-37 (-> *prototype-tie-work* vanish-next))) + (set! (-> (the-as (pointer uint128) a1-73)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-73)) + (logior (logand (-> (the-as (pointer uint64) a1-73)) (the-as uint #x80000000ffffffff)) (shr (shl a3-37 33) 1)) + ) + ) + (let ((a1-77 (logior (logand (-> (the-as (pointer uint64) a0-57) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-73 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-57) a1-77) + ) + ) + (&+! (-> v1-121 base) 16) + ) + (let ((v1-129 *dma-mem-usage*)) + (when (nonzero? v1-129) + (set! (-> v1-129 length) (max 10 (-> v1-129 length))) + (set! (-> v1-129 data 9 name) "tie-fragment") + (+! (-> v1-129 data 9 count) 1) + (+! (-> v1-129 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-4)) + ) + (set! (-> v1-129 data 9 total) (-> v1-129 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask tie-scissor-trans) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* scissor-trans-count)) + (let ((s5-5 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-146 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tie-scissor-l0-alpha) + (bucket-id tie-scissor-l1-alpha) + (bucket-id tie-scissor-l2-alpha) + (bucket-id tie-scissor-l3-alpha) + (bucket-id tie-scissor-l4-alpha) + (bucket-id tie-scissor-l5-alpha) + (bucket-id tie-scissor-l6-alpha) + (bucket-id tie-scissor-l7-alpha) + (bucket-id tie-scissor-l8-alpha) + (bucket-id tie-scissor-l9-alpha) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-91 (-> v1-146 base)) + (a0-72 (the-as object (-> *prototype-tie-work* scissor-trans-last))) + ) + (let ((a3-46 (-> *prototype-tie-work* scissor-trans-next))) + (set! (-> (the-as (pointer uint128) a1-91)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-91)) + (logior (logand (-> (the-as (pointer uint64) a1-91)) (the-as uint #x80000000ffffffff)) (shr (shl a3-46 33) 1)) + ) + ) + (let ((a1-95 (logior (logand (-> (the-as (pointer uint64) a0-72) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-91 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-72) a1-95) + ) + ) + (&+! (-> v1-146 base) 16) + ) + (let ((v1-154 *dma-mem-usage*)) + (when (nonzero? v1-154) + (set! (-> v1-154 length) (max 16 (-> v1-154 length))) + (set! (-> v1-154 data 15 name) "tie-scissor") + (+! (-> v1-154 data 15 count) 1) + (+! (-> v1-154 data 15 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-5)) + ) + (set! (-> v1-154 data 15 total) (-> v1-154 data 15 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask tie-trans) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* trans-count)) + (let ((s5-6 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-171 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tie-l0-alpha) + (bucket-id tie-l1-alpha) + (bucket-id tie-l2-alpha) + (bucket-id tie-l3-alpha) + (bucket-id tie-l4-alpha) + (bucket-id tie-l5-alpha) + (bucket-id tie-l6-alpha) + (bucket-id tie-l7-alpha) + (bucket-id tie-l8-alpha) + (bucket-id tie-l9-alpha) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-109 (-> v1-171 base)) + (a0-87 (the-as object (-> *prototype-tie-work* trans-last))) + ) + (let ((a3-55 (-> *prototype-tie-work* trans-next))) + (set! (-> (the-as (pointer uint128) a1-109)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-109)) + (logior (logand (-> (the-as (pointer uint64) a1-109)) (the-as uint #x80000000ffffffff)) + (shr (shl a3-55 33) 1) + ) + ) + ) + (let ((a1-113 (logior (logand (-> (the-as (pointer uint64) a0-87) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-109 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-87) a1-113) + ) + ) + (&+! (-> v1-171 base) 16) + ) + (let ((v1-179 *dma-mem-usage*)) + (when (nonzero? v1-179) + (set! (-> v1-179 length) (max 10 (-> v1-179 length))) + (set! (-> v1-179 data 9 name) "tie-fragment") + (+! (-> v1-179 data 9 count) 1) + (+! (-> v1-179 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-6)) + ) + (set! (-> v1-179 data 9 total) (-> v1-179 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-trans) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* envmap-trans-count)) + (let ((s5-7 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-196 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id etie-l0-alpha) + (bucket-id etie-l1-alpha) + (bucket-id etie-l02alpha) + (bucket-id etie-l3-alpha) + (bucket-id etie-l4-alpha) + (bucket-id etie-l5-alpha) + (bucket-id etie-l6-alpha) + (bucket-id etie-l7-alpha) + (bucket-id etie-l8-alpha) + (bucket-id etie-l9-alpha) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-127 (-> v1-196 base)) + (a0-102 (the-as object (-> *prototype-tie-work* envmap-trans-last))) + ) + (let ((a3-64 (-> *prototype-tie-work* envmap-trans-next))) + (set! (-> (the-as (pointer uint128) a1-127)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-127)) + (logior (logand (-> (the-as (pointer uint64) a1-127)) (the-as uint #x80000000ffffffff)) + (shr (shl a3-64 33) 1) + ) + ) + ) + (let ((a1-131 (logior (logand (-> (the-as (pointer uint64) a0-102) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-127 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-102) a1-131) + ) + ) + (&+! (-> v1-196 base) 16) + ) + (let ((v1-204 *dma-mem-usage*)) + (when (nonzero? v1-204) + (set! (-> v1-204 length) (max 10 (-> v1-204 length))) + (set! (-> v1-204 data 9 name) "tie-fragment") + (+! (-> v1-204 data 9 count) 1) + (+! (-> v1-204 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-7)) + ) + (set! (-> v1-204 data 9 total) (-> v1-204 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-scissor-trans) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* envmap-scissor-trans-count)) + (let ((s5-8 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-221 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id etie-scissor-l0-alpha) + (bucket-id etie-scissor-l1-alpha) + (bucket-id etie-scissor-l2-alpha) + (bucket-id etie-scissor-l3-alpha) + (bucket-id etie-scissor-l4-alpha) + (bucket-id etie-scissor-l5-alpha) + (bucket-id etie-scissor-l6-alpha) + (bucket-id etie-scissor-l7-alpha) + (bucket-id etie-scissor-l8-alpha) + (bucket-id etie-scissor-l9-alpha) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-145 (-> v1-221 base)) + (a0-117 (the-as object (-> *prototype-tie-work* envmap-scissor-trans-last))) + ) + (let ((a3-73 (-> *prototype-tie-work* envmap-scissor-trans-next))) + (set! (-> (the-as (pointer uint128) a1-145)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-145)) + (logior (logand (-> (the-as (pointer uint64) a1-145)) (the-as uint #x80000000ffffffff)) + (shr (shl a3-73 33) 1) + ) + ) + ) + (let ((a1-149 (logior (logand (-> (the-as (pointer uint64) a0-117) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-145 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-117) a1-149) + ) + ) + (&+! (-> v1-221 base) 16) + ) + (let ((v1-229 *dma-mem-usage*)) + (when (nonzero? v1-229) + (set! (-> v1-229 length) (max 10 (-> v1-229 length))) + (set! (-> v1-229 data 9 name) "tie-fragment") + (+! (-> v1-229 data 9 count) 1) + (+! (-> v1-229 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-8)) + ) + (set! (-> v1-229 data 9 total) (-> v1-229 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask tie-scissor-water) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* scissor-water-count)) + (let ((s5-9 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-246 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tie-scissor-l0-water) + (bucket-id tie-scissor-l1-water) + (bucket-id tie-scissor-l2-water) + (bucket-id tie-scissor-l3-water) + (bucket-id tie-scissor-l4-water) + (bucket-id tie-scissor-l5-water) + (bucket-id tie-scissor-l6-water) + (bucket-id tie-scissor-l7-water) + (bucket-id tie-scissor-l8-water) + (bucket-id tie-scissor-l9-water) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-163 (-> v1-246 base)) + (a0-132 (the-as object (-> *prototype-tie-work* scissor-water-last))) + ) + (let ((a3-82 (-> *prototype-tie-work* scissor-water-next))) + (set! (-> (the-as (pointer uint128) a1-163)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-163)) + (logior (logand (-> (the-as (pointer uint64) a1-163)) (the-as uint #x80000000ffffffff)) + (shr (shl a3-82 33) 1) + ) + ) + ) + (let ((a1-167 (logior (logand (-> (the-as (pointer uint64) a0-132) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-163 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-132) a1-167) + ) + ) + (&+! (-> v1-246 base) 16) + ) + (let ((v1-254 *dma-mem-usage*)) + (when (nonzero? v1-254) + (set! (-> v1-254 length) (max 16 (-> v1-254 length))) + (set! (-> v1-254 data 15 name) "tie-scissor") + (+! (-> v1-254 data 15 count) 1) + (+! (-> v1-254 data 15 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-9)) + ) + (set! (-> v1-254 data 15 total) (-> v1-254 data 15 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask tie-water) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* water-count)) + (let ((s5-10 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-271 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id tie-l0-water) + (bucket-id tie-l1-water) + (bucket-id tie-l2-water) + (bucket-id tie-l3-water) + (bucket-id tie-l4-water) + (bucket-id tie-l5-water) + (bucket-id tie-l6-water) + (bucket-id tie-l7-water) + (bucket-id tie-l8-water) + (bucket-id tie-l9-water) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-181 (-> v1-271 base)) + (a0-147 (the-as object (-> *prototype-tie-work* water-last))) + ) + (let ((a3-91 (-> *prototype-tie-work* water-next))) + (set! (-> (the-as (pointer uint128) a1-181)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-181)) + (logior (logand (-> (the-as (pointer uint64) a1-181)) (the-as uint #x80000000ffffffff)) + (shr (shl a3-91 33) 1) + ) + ) + ) + (let ((a1-185 (logior (logand (-> (the-as (pointer uint64) a0-147) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-181 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-147) a1-185) + ) + ) + (&+! (-> v1-271 base) 16) + ) + (let ((v1-279 *dma-mem-usage*)) + (when (nonzero? v1-279) + (set! (-> v1-279 length) (max 10 (-> v1-279 length))) + (set! (-> v1-279 data 9 name) "tie-fragment") + (+! (-> v1-279 data 9 count) 1) + (+! (-> v1-279 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-10)) + ) + (set! (-> v1-279 data 9 total) (-> v1-279 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-water) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* envmap-water-count)) + (let ((s5-11 (-> *display* frames (-> *display* on-screen) global-buf base))) + (with-dma-buffer-add-bucket ((v1-296 (-> *display* frames (-> *display* on-screen) global-buf)) + (-> (new 'static 'array bucket-id 10 + (bucket-id etie-l0-water) + (bucket-id etie-l1-water) + (bucket-id etie-l2-water) + (bucket-id etie-l3-water) + (bucket-id etie-l4-water) + (bucket-id etie-l5-water) + (bucket-id etie-l6-water) + (bucket-id etie-l7-water) + (bucket-id etie-l8-water) + (bucket-id etie-l9-water) + ) + (-> arg1 draw-index) + ) + ) + (let ((a1-199 (-> v1-296 base)) + (a0-162 (the-as object (-> *prototype-tie-work* envmap-water-last))) + ) + (let ((a3-100 (-> *prototype-tie-work* envmap-water-next))) + (set! (-> (the-as (pointer uint128) a1-199)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-199)) + (logior (logand (-> (the-as (pointer uint64) a1-199)) (the-as uint #x80000000ffffffff)) + (shr (shl a3-100 33) 1) + ) + ) + ) + (let ((a1-203 (logior (logand (-> (the-as (pointer uint64) a0-162) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-199 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-162) a1-203) + ) + ) + (&+! (-> v1-296 base) 16) + ) + (let ((v1-304 *dma-mem-usage*)) + (when (nonzero? v1-304) + (set! (-> v1-304 length) (max 10 (-> v1-304 length))) + (set! (-> v1-304 data 9 name) "tie-fragment") + (+! (-> v1-304 data 9 count) 1) + (+! (-> v1-304 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-11)) + ) + (set! (-> v1-304 data 9 total) (-> v1-304 data 9 used)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-scissor-water) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *prototype-tie-work* envmap-scissor-water-count)) + (let* ((s5-12 (-> *display* frames (-> *display* on-screen) global-buf base)) + (v1-320 (-> *display* frames (-> *display* on-screen) global-buf)) + (a2-120 (-> v1-320 base)) + ) + (let ((a1-217 (-> v1-320 base)) + (a0-176 (the-as object (-> *prototype-tie-work* envmap-scissor-water-last))) + ) + (let ((a3-109 (-> *prototype-tie-work* envmap-scissor-water-next))) + (set! (-> (the-as (pointer uint128) a1-217)) (-> *prototype-tie-work* model-next quad)) + (set! (-> (the-as (pointer uint64) a1-217)) + (logior (logand (-> (the-as (pointer uint64) a1-217)) (the-as uint #x80000000ffffffff)) + (shr (shl a3-109 33) 1) + ) + ) + ) + (let ((a1-221 (logior (logand (-> (the-as (pointer uint64) a0-176) 0) (the-as uint #x80000000ffffffff)) + (shr (shl (the-as int (&+ a1-217 16)) 33) 1) + ) + ) + ) + (s.d! (the-as uint a0-176) a1-221) + ) + ) + (&+! (-> v1-320 base) 16) + (let* ((a3-115 (-> v1-320 base)) + (v0-12 (when (!= a2-120 a3-115) + (let ((a0-179 (-> v1-320 base))) + (set! (-> (the-as (pointer int64) a0-179)) #x20000000) + (s.w! (+ a0-179 8) 0) + (s.w! (+ a0-179 12) 0) + (set! (-> v1-320 base) (&+ a0-179 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (-> (new 'static 'array bucket-id 10 + (bucket-id etie-scissor-l0-water) + (bucket-id etie-scissor-l1-water) + (bucket-id etie-scissor-l2-water) + (bucket-id etie-scissor-l3-water) + (bucket-id etie-scissor-l4-water) + (bucket-id etie-scissor-l5-water) + (bucket-id etie-scissor-l6-water) + (bucket-id etie-scissor-l7-water) + (bucket-id etie-scissor-l8-water) + (bucket-id etie-scissor-l9-water) + ) + (-> arg1 draw-index) + ) + a2-120 + (the-as (pointer dma-tag) a3-115) + ) + ) + ) + ) + (let ((v1-328 *dma-mem-usage*)) + (when (nonzero? v1-328) + (set! (-> v1-328 length) (max 10 (-> v1-328 length))) + (set! (-> v1-328 data 9 name) "tie-fragment") + (+! (-> v1-328 data 9 count) 1) + (+! (-> v1-328 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-12)) + ) + (set! (-> v1-328 data 9 total) (-> v1-328 data 9 used)) + ) + ) + v0-12 + ) + ) + ) + ) + ) + +;; definition for function draw-drawable-tree-instance-tie +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun draw-drawable-tree-instance-tie ((arg0 drawable-tree-instance-tie) (arg1 level)) + (local-vars (v0-9 object) (a0-42 int) (a0-44 int) (a0-55 int) (a0-57 int) (sv-16 int)) + (when (logtest? (vu1-renderer-mask + tie-scissor + tie + etie + etie-scissor + tie-vanish + generic + tie-scissor-trans + tie-trans + etie-trans + etie-scissor-trans + ) + (-> *display* vu1-enable-user) + ) + (set! (-> *instance-tie-work* wind-vectors) (-> arg0 prototypes wind-vectors)) + (let ((s5-0 (+ (-> arg0 length) -1))) + (when (nonzero? s5-0) + (dotimes (s4-0 s5-0) + (let* ((v1-9 (-> arg0 data s4-0)) + (a0-7 (-> arg0 data (+ s4-0 1))) + (a1-2 (/ (-> (the-as drawable-inline-array-node v1-9) data 0 id) 8)) + (a0-9 (/ (-> (the-as drawable-inline-array-node a0-7) data 0 id) 8)) + (a1-4 (+ a1-2 #x3800 #x70000000)) + (a0-11 (+ a0-9 #x3800 #x70000000)) + ) + (draw-node-cull + (the-as pointer a0-11) + (the-as pointer a1-4) + (-> (the-as drawable-inline-array-node v1-9) data) + (-> (the-as drawable-inline-array-node v1-9) length) + ) + ) + ) + ) + (let* ((s2-0 (-> arg0 data s5-0)) + (s3-0 (-> arg0 prototypes prototype-array-tie)) + (s4-1 (-> s3-0 length)) + (s5-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s0-0 (-> s5-1 base)) + (s1-1 (&- (-> s5-1 end) (the-as uint (* (-> arg0 prototypes prototype-max-qwc) 16)))) + ) + (when *debug-segment* + (if (>= (the-as uint s0-0) (the-as uint s1-1)) + (format *stdcon* "out of tie memory~%") + ) + ) + (when (< (the-as uint s0-0) (the-as uint s1-1)) + (set! (-> *instance-tie-work* buffer-start) (the-as uint (-> s5-1 base))) + (set! (-> *instance-tie-work* buffer-end) (the-as uint s1-1)) + (dotimes (v1-28 16) + (set! (-> *prototype-tie-work* last v1-28) (the-as uint 0)) + (set! (-> *prototype-tie-work* next v1-28) (the-as uint 0)) + (set! (-> *prototype-tie-work* count v1-28) (the-as uint 0)) + ) + (dotimes (v1-31 s4-1) + (let ((a0-26 (-> s3-0 array-data v1-31))) + (dotimes (a1-9 3) + (set! (-> a0-26 next-clear a1-9) (the-as uint128 0)) + (set! (-> a0-26 count-clear a1-9) (the-as uint 0)) + ) + ) + ) + (let* ((s1-2 (&+ s2-0 32)) + (s0-1 (+ (/ (-> s1-2 id) 8) #x3800 #x70000000)) + ) + (set! sv-16 (-> (the-as drawable-inline-array-instance-tie s2-0) length)) + (when (nonzero? sv-16) + (let* ((v1-41 (logand (the-as int *gsf-buffer*) 8191)) + (v1-43 + (the-as + object + (logand (the-as int (&- (logand (the-as int (&-> (-> s3-0 data) -640)) 8191) (the-as uint v1-41))) 8191) + ) + ) + ) + (set! *instance-tie-work-copy* (the-as instance-tie-work (+ (the-as int *gsf-buffer*) (the-as int v1-43)))) + ) + (quad-copy! (the-as pointer *instance-tie-work-copy*) (the-as pointer *instance-tie-work*) 35) + (let ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + (set! (-> *instance-tie-work-copy* wait-to-spr) (the-as uint 0)) + (set! (-> *instance-tie-work-copy* wait-from-spr) (the-as uint 0)) + (set! (-> *instance-tie-work-copy* tfrag-dists) (the-as uint (-> arg1 bsp tfrag-closest))) + (set! (-> *instance-tie-work-copy* alpha-dists) (the-as uint (-> arg1 bsp alpha-closest))) + (set! (-> *instance-tie-work-copy* water-dists) (the-as uint (-> arg1 bsp water-closest))) + (let* ((v1-61 (-> *perf-stats* data 46)) + (a0-39 (-> v1-61 ctrl)) + ) + (+! (-> v1-61 count) 1) + (b! (zero? a0-39) cfg-23 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-39) + ) + (.sync.l) + (.sync.p) + (label cfg-23) + 0 + (let ((t9-3 draw-inline-array-instance-tie) + (a3-1 s5-1) + ) + (t9-3 (the-as pointer s0-1) (the-as (inline-array instance-tie) s1-2) sv-16 a3-1) + ) + (let ((v1-64 (-> *perf-stats* data 46))) + (b! (zero? (-> v1-64 ctrl)) cfg-25 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-42 pcr0) + (+! (-> v1-64 accum0) a0-42) + (.mfpc a0-44 pcr1) + (+! (-> v1-64 accum1) a0-44) + ) + (label cfg-25) + 0 + (update-wait-stats + (-> *perf-stats* data 46) + (the-as uint 0) + (-> *instance-tie-work-copy* wait-to-spr) + (-> *instance-tie-work-copy* wait-from-spr) + ) + (let ((v1-71 (-> *instance-tie-work-copy* min-dist quad))) + (set! (-> *instance-tie-work* min-dist quad) v1-71) + ) + (set! (-> *instance-tie-work* flags) (-> *instance-tie-work-copy* flags)) + (if (and *debug-segment* (< (the-as int (-> *instance-tie-work* buffer-end)) (the-as int (-> s5-1 base)))) + (format *stdcon* "out of tie memory~%") + ) + (when (>= (the-as int (-> *instance-tie-work* buffer-end)) (the-as int (-> s5-1 base))) + (set! (-> *prototype-tie-work* wait-to-spr) (the-as uint 0)) + (set! (-> *prototype-tie-work* wait-from-spr) (the-as uint 0)) + (let* ((v1-85 (-> *perf-stats* data 47)) + (a0-52 (-> v1-85 ctrl)) + ) + (+! (-> v1-85 count) 1) + (b! (zero? a0-52) cfg-33 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-52) + ) + (.sync.l) + (.sync.p) + (label cfg-33) + 0 + (draw-inline-array-prototype-tie-asm s5-1 s4-1 s3-0) + (let ((v1-88 (-> *perf-stats* data 47))) + (b! (zero? (-> v1-88 ctrl)) cfg-35 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-55 pcr0) + (+! (-> v1-88 accum0) a0-55) + (.mfpc a0-57 pcr1) + (+! (-> v1-88 accum1) a0-57) + ) + (label cfg-35) + 0 + (update-wait-stats + (-> *perf-stats* data 47) + (the-as uint 0) + (-> *prototype-tie-work* wait-to-spr) + (-> *prototype-tie-work* wait-from-spr) + ) + ) + (let ((a0-60 *dma-mem-usage*)) + (when (nonzero? a0-60) + (set! (-> a0-60 length) (max 10 (-> a0-60 length))) + (set! (-> a0-60 data 9 name) "tie-fragment") + (+! (-> a0-60 data 9 count) 1) + (+! (-> a0-60 data 9 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s2-1)) + ) + (set! (-> a0-60 data 9 total) (-> a0-60 data 9 used)) + ) + ) + ) + ) + ) + (set! v0-9 (cond + ((< (the-as int (-> *instance-tie-work* buffer-end)) (the-as int (-> s5-1 base))) + (if *debug-segment* + (format *stdcon* "out of tie memory~%") + ) + (set! v0-9 (-> *instance-tie-work* buffer-start)) + (set! (-> s5-1 base) (the-as pointer v0-9)) + v0-9 + ) + (else + (instance-tie-patch-buckets s5-1 arg1) + ) + ) + ) + ) + ) + ) + ) + (set! (-> arg1 tie-min-dist) (-> *instance-tie-work* min-dist x)) + 0 + (none) + ) + +;; definition for function tie-init-scissor-buf +;; ERROR: failed type prop at 40: Unknown symbol: tie-near-init-engine +;; WARN: Return type mismatch symbol vs none. +(defun tie-init-scissor-buf ((a0-0 bucket-id) (a1-0 gs-alpha) (a2-0 gs-test) (a3-0 gs-test)) + (local-vars + (v0-2 none) + (v0-4 none) + (v0-5 none) + (v1-0 display) + (v1-1 symbol) + (v1-2 display) + (v1-3 int) + (v1-4 int) + (v1-5 int) + (v1-6 display-frame) + (v1-7 (inline-array dma-bucket)) + (v1-8 (pointer dma-tag)) + (v1-9 display) + (v1-10 int) + (v1-11 int) + (v1-12 int) + (v1-13 display-frame) + (v1-14 none) + (v1-15 none) + (v1-16 none) + (v1-17 none) + (v1-18 none) + (v1-19 none) + (v1-20 none) + (v1-21 none) + (v1-22 none) + (v1-23 none) + (v1-24 none) + (v1-25 none) + (v1-26 none) + (v1-27 none) + (v1-28 none) + (v1-29 none) + (v1-30 none) + (v1-31 none) + (v1-32 none) + (v1-33 none) + (a0-1 int) + (a0-2 pointer) + (a0-4 symbol) + (a0-5 display) + (a0-6 uint) + (a0-7 display) + (a0-9 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a0-14 none) + (a0-15 none) + (a0-16 none) + (a0-17 none) + (a0-18 none) + (a0-19 none) + (a0-21 none) + (a1-1 none) + (a1-2 none) + (a1-3 none) + (a1-4 none) + (a1-5 none) + (a1-6 none) + (a1-7 none) + (a1-8 none) + (a1-9 none) + (a1-10 none) + (t0-0 uint) + (t0-1 uint) + (t0-2 symbol) + (t0-3 int) + (t0-4 int) + (t0-5 int) + (t0-6 display-frame) + (t0-7 int) + (t1-0 dma-buffer) + (t1-1 pointer) + (s3-1 pointer) + (s4-0 dma-buffer) + (s4-1 none) + (s5-0 dma-bucket) + (s5-1 none) + (t9-0 none) + (t9-1 none) + (gp-1 none) + ) + (when (begin + (set! v1-0 *display*) + (set! a0-1 80) + (set! t0-0 (-> v1-0 mem-reserve-size)) + (set! t0-1 (+ t0-0 a0-1)) + (set! (-> v1-0 mem-reserve-size) t0-1) + (set! t0-2 (-> v1-0 dma-buffer-overflow)) + (not t0-2) + ) + (when (begin + (when (begin + (set! t0-3 (-> v1-0 on-screen)) + (set! t0-4 (sll t0-3 2)) + (set! t0-5 (+ t0-4 v1-0)) + (set! t0-6 (dynamic-array-field-access t0-5 frames PLACEHOLDER)) + (set! t1-0 (-> t0-6 global-buf)) + (set! t0-7 (-> t1-0 real-buffer-end)) + (set! t1-1 (-> t1-0 base)) + (set! a0-2 (+ t1-1 a0-1)) + (<.si t0-7 a0-2) + ) + (set! a0-4 #t) + (set! (-> v1-0 dma-buffer-overflow) a0-4) + ) + (set! v1-1 (-> v1-0 dma-buffer-overflow)) + (not v1-1) + ) + (when (begin + (when (begin + (set! v1-2 *display*) + (set! v1-3 (-> v1-2 on-screen)) + (set! v1-4 (sll v1-3 2)) + (set! a0-5 *display*) + (set! v1-5 (+ v1-4 a0-5)) + (set! v1-6 (dynamic-array-field-access v1-5 frames PLACEHOLDER)) + (set! v1-7 (-> v1-6 bucket-group)) + (set! a0-6 (sll a0-0 4)) + (set! s5-0 (+ v1-7 a0-6)) + (set! v1-8 (-> s5-0 last)) + (!= s5-0 v1-8) + ) + (set! v1-9 *display*) + (set! v1-10 (-> v1-9 on-screen)) + (set! v1-11 (sll v1-10 2)) + (set! a0-7 *display*) + (set! v1-12 (+ v1-11 a0-7)) + (set! v1-13 (dynamic-array-field-access v1-12 frames PLACEHOLDER)) + (set! s4-0 (-> v1-13 global-buf)) + (set! s3-1 (-> s4-0 base)) + (set! t9-0 (the-as none tie-near-init-engine)) + (set! a0-8 (the-as none s4-0)) + (call!) + (set! v1-14 (the-as none s4-0)) + (set! a0-9 (the-as none (l.wu (+ v1-14 4)))) + (set! a1-1 (the-as none #x10000002)) + (s.d! a0-9 a1-1) + (s.w! (+ a0-9 8) 0) + (set! a1-2 (the-as none #x50000002)) + (s.w! (+ a0-9 12) a1-2) + (set! a0-10 (the-as none (+ a0-9 16))) + (s.w! (+ v1-14 4) a0-10) + (set! v1-15 (the-as none s4-0)) + (set! a0-11 (the-as none (l.wu (+ v1-15 4)))) + (set! a1-3 (the-as none (the-as uint #x1000000000008001))) + (set! a1-4 (the-as none (pcypld 0 a1-3))) + (s.d! a0-11 a1-4) + (set! a1-5 (the-as none (the-as uint #xeeeeeeeeeeeeeeee))) + (s.d! (+ a0-11 8) a1-5) + (set! a0-12 (the-as none (+ a0-11 16))) + (s.w! (+ v1-15 4) a0-12) + (set! v1-16 (the-as none s4-0)) + (set! a0-13 (the-as none (l.wu (+ v1-16 4)))) + (set! a1-6 (the-as none #x1000130)) + (s.d! a0-13 a1-6) + (set! a1-7 (the-as none 78)) + (s.d! (+ a0-13 8) a1-7) + (set! a0-14 (the-as none (+ a0-13 16))) + (s.w! (+ v1-16 4) a0-14) + (set! v1-17 (the-as none (-> s4-0 base))) + (set! a0-15 (the-as none #x20000000)) + (set! a1-8 (the-as none (-> s5-0 next))) + (set! a1-9 (the-as none (sll a1-8 33))) + (set! a1-10 (the-as none (srl a1-9 1))) + (set! a0-16 (the-as none (logior a0-15 a1-10))) + (s.d! v1-17 a0-16) + (s.w! (+ v1-17 8) 0) + (s.w! (+ v1-17 12) 0) + (set! v1-18 (the-as none (+ v1-17 16))) + (set! (-> s4-0 base) (the-as pointer v1-18)) + (set! (-> s5-0 next) (the-as uint s3-1)) + ) + (set! v1-19 (the-as none *display*)) + (set! v1-20 (the-as none (l.w v1-19))) + (set! v1-21 (the-as none (sll v1-20 2))) + (set! a0-17 (the-as none *display*)) + (set! v1-22 (the-as none (+ v1-21 a0-17))) + (set! v1-23 (the-as none (l.wu (+ v1-22 8)))) + (set! v1-24 (the-as none (l.wu (+ v1-23 40)))) + (set! a0-18 (the-as none (sll a0-0 4))) + (set! gp-1 (the-as none (+ v1-24 a0-18))) + (set! v1-25 (the-as none (l.wu (+ gp-1 8)))) + (!= gp-1 v1-25) + ) + (set! v1-26 (the-as none *display*)) + (set! v1-27 (the-as none (l.w v1-26))) + (set! v1-28 (the-as none (sll v1-27 2))) + (set! a0-19 (the-as none *display*)) + (set! v1-29 (the-as none (+ v1-28 a0-19))) + (set! v1-30 (the-as none (l.wu (+ v1-29 8)))) + (set! s4-1 (the-as none (l.wu (+ v1-30 36)))) + (set! s5-1 (the-as none (l.wu (+ s4-1 4)))) + (set! t9-1 (the-as none tie-near-end-buffer)) + (set! a0-20 (the-as none s4-1)) + (call!) + (set! v0-5 (the-as none (l.wu (+ s4-1 4)))) + (set! v1-31 (the-as none (l.wu (+ s4-1 4)))) + (set! a0-21 (the-as none #x20000000)) + (s.d! v1-31 a0-21) + (s.w! (+ v1-31 8) 0) + (s.w! (+ v1-31 12) 0) + (set! v1-32 (the-as none (+ v1-31 16))) + (s.w! (+ s4-1 4) v1-32) + (set! v1-33 (the-as none (l.wu (+ gp-1 8)))) + (s.w! (+ v1-33 4) s5-1) + (s.w! (+ gp-1 8) v0-5) + ) + ) + ) + (ret-none) + ) + +;; definition for function tie-init-buf +;; WARN: Return type mismatch pointer vs none. +(defun tie-init-buf ((arg0 bucket-id) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test)) + (let ((v1-0 *display*) + (a0-1 80) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t1-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t1-0 real-buffer-end) (the-as int (&+ (-> t1-0 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((s5-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s5-0 (-> s5-0 last)) + (let* ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s3-1 (-> s4-0 base)) + ) + (tie-init-engine s4-0 arg1 arg2 arg3) + (let* ((v1-14 s4-0) + (a0-9 (the-as dma-packet (-> v1-14 base))) + ) + (set! (-> a0-9 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-9 vif0) (new 'static 'vif-tag)) + (set! (-> a0-9 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-14 base) (the-as pointer (&+ a0-9 16))) + ) + (let* ((v1-15 s4-0) + (a0-11 (the-as gs-gif-tag (-> v1-15 base))) + ) + (set! (-> a0-11 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-11 regs) GIF_REGS_ALL_AD) + (set! (-> v1-15 base) (the-as pointer (&+ a0-11 16))) + ) + (let* ((v1-16 s4-0) + (a0-13 (-> v1-16 base)) + ) + (set! (-> (the-as (pointer gs-zbuf) a0-13) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (set! (-> (the-as (pointer gs-reg64) a0-13) 1) (gs-reg64 zbuf-1)) + (set! (-> v1-16 base) (&+ a0-13 16)) + ) + (let ((v1-17 (the-as object (-> s4-0 base)))) + (set! (-> (the-as dma-packet v1-17) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s5-0 next))) + (set! (-> (the-as dma-packet v1-17) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-17) vif1) (new 'static 'vif-tag)) + (set! (-> s4-0 base) (the-as pointer (&+ (the-as dma-packet v1-17) 16))) + ) + (set! (-> s5-0 next) (the-as uint s3-1)) + ) + ) + ) + (let ((gp-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= gp-1 (-> gp-1 last)) + (let* ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s5-1 (-> s4-1 base)) + ) + (tie-end-buffer s4-1) + (let ((v0-5 (-> s4-1 base))) + (let ((v1-31 (the-as dma-packet (-> s4-1 base)))) + (set! (-> v1-31 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-31 vif0) (new 'static 'vif-tag)) + (set! (-> v1-31 vif1) (new 'static 'vif-tag)) + (set! (-> s4-1 base) (the-as pointer (&+ v1-31 16))) + ) + (set! (-> (the-as (pointer uint32) (-> gp-1 last)) 1) (the-as uint s5-1)) + (set! (-> gp-1 last) (the-as (pointer dma-tag) v0-5)) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function tie-init-envmap-buf +;; WARN: Return type mismatch pointer vs none. +;; ERROR: Failed store: (s.w! (+ v1-14 8) 0) at op 50 +;; ERROR: Failed store: (s.w! (+ v1-14 12) 0) at op 51 +;; ERROR: Failed store: (s.w! (+ v1-28 8) 0) at op 81 +;; ERROR: Failed store: (s.w! (+ v1-28 12) 0) at op 82 +;; ERROR: Failed store: (s.w! (+ v1-30 4) s5-1) at op 86 +(defun tie-init-envmap-buf ((arg0 bucket-id) (arg1 gs-alpha) (arg2 gs-test)) + (let ((v1-0 *display*) + (a0-1 32) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((s5-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= s5-0 (-> s5-0 last)) + (let* ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s3-1 (-> s4-0 base)) + ) + (etie-init-engine s4-0 arg1 arg2) + (let ((v1-14 (-> s4-0 base))) + (set! (-> (the-as (pointer uint64) v1-14)) (logior #x20000000 (shr (shl (-> s5-0 next) 33) 1))) + (s.w! (+ v1-14 8) 0) + (s.w! (+ v1-14 12) 0) + (set! (-> s4-0 base) (&+ v1-14 16)) + ) + (set! (-> s5-0 next) (the-as uint s3-1)) + ) + ) + ) + (let ((gp-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0))) + (when (!= gp-1 (-> gp-1 last)) + (let* ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s5-1 (-> s4-1 base)) + ) + (etie-end-buffer s4-1) + (let ((v0-5 (-> s4-1 base))) + (let ((v1-28 (-> s4-1 base))) + (set! (-> (the-as (pointer int64) v1-28)) #x20000000) + (s.w! (+ v1-28 8) 0) + (s.w! (+ v1-28 12) 0) + (set! (-> s4-1 base) (&+ v1-28 16)) + ) + (let ((v1-30 (-> gp-1 last))) + (s.w! (+ v1-30 4) s5-1) + ) + (set! (-> gp-1 last) (the-as (pointer dma-tag) v0-5)) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function tie-init-envmap-scissor-buf +;; ERROR: failed type prop at 40: Unknown symbol: etn-init-engine +;; WARN: Return type mismatch symbol vs none. +(defun tie-init-envmap-scissor-buf ((a0-0 bucket-id) (a1-0 gs-alpha) (a2-0 int) (a3-0 int)) + (local-vars + (v0-2 none) + (v0-4 none) + (v0-5 none) + (v1-0 display) + (v1-1 symbol) + (v1-2 display) + (v1-3 int) + (v1-4 int) + (v1-5 int) + (v1-6 display-frame) + (v1-7 (inline-array dma-bucket)) + (v1-8 (pointer dma-tag)) + (v1-9 display) + (v1-10 int) + (v1-11 int) + (v1-12 int) + (v1-13 display-frame) + (v1-14 none) + (v1-15 none) + (v1-16 none) + (v1-17 none) + (v1-18 none) + (v1-19 none) + (v1-20 none) + (v1-21 none) + (v1-22 none) + (v1-23 none) + (v1-24 none) + (v1-25 none) + (v1-26 none) + (v1-27 none) + (v1-28 none) + (v1-29 none) + (v1-30 none) + (a0-1 int) + (a0-2 pointer) + (a0-4 symbol) + (a0-5 display) + (a0-6 uint) + (a0-7 display) + (a0-9 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a0-15 none) + (a1-1 none) + (a1-2 none) + (a1-3 none) + (a3-1 uint) + (a3-2 uint) + (a3-3 symbol) + (a3-4 int) + (a3-5 int) + (a3-6 int) + (a3-7 display-frame) + (a3-8 int) + (t0-0 dma-buffer) + (t0-1 pointer) + (s3-1 pointer) + (s4-0 dma-buffer) + (s4-1 none) + (s5-0 dma-bucket) + (s5-1 none) + (t9-0 none) + (t9-1 none) + (gp-1 none) + ) + (when (begin + (set! v1-0 *display*) + (set! a0-1 32) + (set! a3-1 (-> v1-0 mem-reserve-size)) + (set! a3-2 (+ a3-1 a0-1)) + (set! (-> v1-0 mem-reserve-size) a3-2) + (set! a3-3 (-> v1-0 dma-buffer-overflow)) + (not a3-3) + ) + (when (begin + (when (begin + (set! a3-4 (-> v1-0 on-screen)) + (set! a3-5 (sll a3-4 2)) + (set! a3-6 (+ a3-5 v1-0)) + (set! a3-7 (dynamic-array-field-access a3-6 frames PLACEHOLDER)) + (set! t0-0 (-> a3-7 global-buf)) + (set! a3-8 (-> t0-0 real-buffer-end)) + (set! t0-1 (-> t0-0 base)) + (set! a0-2 (+ t0-1 a0-1)) + (<.si a3-8 a0-2) + ) + (set! a0-4 #t) + (set! (-> v1-0 dma-buffer-overflow) a0-4) + ) + (set! v1-1 (-> v1-0 dma-buffer-overflow)) + (not v1-1) + ) + (when (begin + (when (begin + (set! v1-2 *display*) + (set! v1-3 (-> v1-2 on-screen)) + (set! v1-4 (sll v1-3 2)) + (set! a0-5 *display*) + (set! v1-5 (+ v1-4 a0-5)) + (set! v1-6 (dynamic-array-field-access v1-5 frames PLACEHOLDER)) + (set! v1-7 (-> v1-6 bucket-group)) + (set! a0-6 (sll a0-0 4)) + (set! s5-0 (+ v1-7 a0-6)) + (set! v1-8 (-> s5-0 last)) + (!= s5-0 v1-8) + ) + (set! v1-9 *display*) + (set! v1-10 (-> v1-9 on-screen)) + (set! v1-11 (sll v1-10 2)) + (set! a0-7 *display*) + (set! v1-12 (+ v1-11 a0-7)) + (set! v1-13 (dynamic-array-field-access v1-12 frames PLACEHOLDER)) + (set! s4-0 (-> v1-13 global-buf)) + (set! s3-1 (-> s4-0 base)) + (set! t9-0 (the-as none etn-init-engine)) + (set! a0-8 (the-as none s4-0)) + (call!) + (set! v1-14 (the-as none (-> s4-0 base))) + (set! a0-9 (the-as none #x20000000)) + (set! a1-1 (the-as none (-> s5-0 next))) + (set! a1-2 (the-as none (sll a1-1 33))) + (set! a1-3 (the-as none (srl a1-2 1))) + (set! a0-10 (the-as none (logior a0-9 a1-3))) + (s.d! v1-14 a0-10) + (s.w! (+ v1-14 8) 0) + (s.w! (+ v1-14 12) 0) + (set! v1-15 (the-as none (+ v1-14 16))) + (set! (-> s4-0 base) (the-as pointer v1-15)) + (set! (-> s5-0 next) (the-as uint s3-1)) + ) + (set! v1-16 (the-as none *display*)) + (set! v1-17 (the-as none (l.w v1-16))) + (set! v1-18 (the-as none (sll v1-17 2))) + (set! a0-11 (the-as none *display*)) + (set! v1-19 (the-as none (+ v1-18 a0-11))) + (set! v1-20 (the-as none (l.wu (+ v1-19 8)))) + (set! v1-21 (the-as none (l.wu (+ v1-20 40)))) + (set! a0-12 (the-as none (sll a0-0 4))) + (set! gp-1 (the-as none (+ v1-21 a0-12))) + (set! v1-22 (the-as none (l.wu (+ gp-1 8)))) + (!= gp-1 v1-22) + ) + (set! v1-23 (the-as none *display*)) + (set! v1-24 (the-as none (l.w v1-23))) + (set! v1-25 (the-as none (sll v1-24 2))) + (set! a0-13 (the-as none *display*)) + (set! v1-26 (the-as none (+ v1-25 a0-13))) + (set! v1-27 (the-as none (l.wu (+ v1-26 8)))) + (set! s4-1 (the-as none (l.wu (+ v1-27 36)))) + (set! s5-1 (the-as none (l.wu (+ s4-1 4)))) + (set! t9-1 (the-as none etn-end-buffer)) + (set! a0-14 (the-as none s4-1)) + (call!) + (set! v0-5 (the-as none (l.wu (+ s4-1 4)))) + (set! v1-28 (the-as none (l.wu (+ s4-1 4)))) + (set! a0-15 (the-as none #x20000000)) + (s.d! v1-28 a0-15) + (s.w! (+ v1-28 8) 0) + (s.w! (+ v1-28 12) 0) + (set! v1-29 (the-as none (+ v1-28 16))) + (s.w! (+ s4-1 4) v1-29) + (set! v1-30 (the-as none (l.wu (+ gp-1 8)))) + (s.w! (+ v1-30 4) s5-1) + (s.w! (+ gp-1 8) v0-5) + ) + ) + ) + (ret-none) + ) + +;; definition of type tie-init-data +(deftype tie-init-data (structure) + ((tie-bucket bucket-id) + (tie-scissor-bucket bucket-id) + (tie-envmap-bucket bucket-id) + (tie-envmap-scissor-bucket bucket-id) + (tie-vanish-bucket bucket-id) + (tie-trans-bucket bucket-id) + (tie-scissor-trans-bucket bucket-id) + (tie-envmap-trans-bucket bucket-id) + (tie-envmap-scissor-trans-bucket bucket-id) + (tie-water-bucket bucket-id) + (tie-scissor-water-bucket bucket-id) + (tie-envmap-water-bucket bucket-id) + (tie-envmap-scissor-water-bucket bucket-id) + ) + ) + +;; definition for method 3 of type tie-init-data +(defmethod inspect ((this tie-init-data)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'tie-init-data) + (format #t "~1Ttie-bucket: ~D~%" (-> this tie-bucket)) + (format #t "~1Ttie-scissor-bucket: ~D~%" (-> this tie-scissor-bucket)) + (format #t "~1Ttie-envmap-bucket: ~D~%" (-> this tie-envmap-bucket)) + (format #t "~1Ttie-envmap-scissor-bucket: ~D~%" (-> this tie-envmap-scissor-bucket)) + (format #t "~1Ttie-vanish-bucket: ~D~%" (-> this tie-vanish-bucket)) + (format #t "~1Ttie-trans-bucket: ~D~%" (-> this tie-trans-bucket)) + (format #t "~1Ttie-scissor-trans-bucket: ~D~%" (-> this tie-scissor-trans-bucket)) + (format #t "~1Ttie-envmap-trans-bucket: ~D~%" (-> this tie-envmap-trans-bucket)) + (format #t "~1Ttie-envmap-scissor-trans-bucket: ~D~%" (-> this tie-envmap-scissor-trans-bucket)) + (format #t "~1Ttie-water-bucket: ~D~%" (-> this tie-water-bucket)) + (format #t "~1Ttie-scissor-water-bucket: ~D~%" (-> this tie-scissor-water-bucket)) + (format #t "~1Ttie-envmap-water-bucket: ~D~%" (-> this tie-envmap-water-bucket)) + (format #t "~1Ttie-envmap-scissor-water-bucket: ~D~%" (-> this tie-envmap-scissor-water-bucket)) + (label cfg-4) + this + ) + +;; definition for symbol *tie-init-table*, type (inline-array tie-init-data) +(define *tie-init-table* (new 'static 'inline-array tie-init-data 10 + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l0-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l0-tfrag) + :tie-envmap-bucket (bucket-id etie-l0-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l0-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l0-tfrag) + :tie-trans-bucket (bucket-id tie-l0-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l0-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l0-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l0-alpha) + :tie-water-bucket (bucket-id tie-l0-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l0-water) + :tie-envmap-water-bucket (bucket-id etie-l0-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l0-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l1-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l1-tfrag) + :tie-envmap-bucket (bucket-id etie-l1-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l1-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l1-tfrag) + :tie-trans-bucket (bucket-id tie-l1-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l1-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l1-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l1-alpha) + :tie-water-bucket (bucket-id tie-l1-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l1-water) + :tie-envmap-water-bucket (bucket-id etie-l1-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l1-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l2-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l2-tfrag) + :tie-envmap-bucket (bucket-id etie-l2-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l2-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l2-tfrag) + :tie-trans-bucket (bucket-id tie-l2-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l2-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l02alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l2-alpha) + :tie-water-bucket (bucket-id tie-l2-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l2-water) + :tie-envmap-water-bucket (bucket-id etie-l2-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l2-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l3-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l3-tfrag) + :tie-envmap-bucket (bucket-id etie-l3-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l3-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l3-tfrag) + :tie-trans-bucket (bucket-id tie-l3-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l3-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l3-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l3-alpha) + :tie-water-bucket (bucket-id tie-l3-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l3-water) + :tie-envmap-water-bucket (bucket-id etie-l3-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l3-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l4-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l4-tfrag) + :tie-envmap-bucket (bucket-id etie-l4-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l4-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l4-tfrag) + :tie-trans-bucket (bucket-id tie-l4-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l4-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l4-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l4-alpha) + :tie-water-bucket (bucket-id tie-l4-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l4-water) + :tie-envmap-water-bucket (bucket-id etie-l4-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l4-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l5-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l5-tfrag) + :tie-envmap-bucket (bucket-id etie-l5-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l5-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l5-tfrag) + :tie-trans-bucket (bucket-id tie-l5-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l5-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l5-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l5-alpha) + :tie-water-bucket (bucket-id tie-l5-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l5-water) + :tie-envmap-water-bucket (bucket-id etie-l5-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l5-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l6-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l6-tfrag) + :tie-envmap-bucket (bucket-id etie-l6-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l6-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l6-tfrag) + :tie-trans-bucket (bucket-id tie-l6-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l6-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l6-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l6-alpha) + :tie-water-bucket (bucket-id tie-l6-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l6-water) + :tie-envmap-water-bucket (bucket-id etie-l6-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l6-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l7-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l7-tfrag) + :tie-envmap-bucket (bucket-id etie-l7-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l7-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l7-tfrag) + :tie-trans-bucket (bucket-id tie-l7-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l7-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l7-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l7-alpha) + :tie-water-bucket (bucket-id tie-l7-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l7-water) + :tie-envmap-water-bucket (bucket-id etie-l7-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l7-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l8-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l8-tfrag) + :tie-envmap-bucket (bucket-id etie-l8-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l8-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l8-tfrag) + :tie-trans-bucket (bucket-id tie-l8-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l8-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l8-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l8-alpha) + :tie-water-bucket (bucket-id tie-l8-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l8-water) + :tie-envmap-water-bucket (bucket-id etie-l8-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l8-water) + ) + (new 'static 'tie-init-data + :tie-bucket (bucket-id tie-l9-tfrag) + :tie-scissor-bucket (bucket-id tie-scissor-l9-tfrag) + :tie-envmap-bucket (bucket-id etie-l9-tfrag) + :tie-envmap-scissor-bucket (bucket-id etie-scissor-l9-tfrag) + :tie-vanish-bucket (bucket-id tie-vanish-l9-tfrag) + :tie-trans-bucket (bucket-id tie-l9-alpha) + :tie-scissor-trans-bucket (bucket-id tie-scissor-l9-alpha) + :tie-envmap-trans-bucket (bucket-id etie-l9-alpha) + :tie-envmap-scissor-trans-bucket (bucket-id etie-scissor-l9-alpha) + :tie-water-bucket (bucket-id tie-l9-water) + :tie-scissor-water-bucket (bucket-id tie-scissor-l9-water) + :tie-envmap-water-bucket (bucket-id etie-l9-water) + :tie-envmap-scissor-water-bucket (bucket-id etie-scissor-l9-water) + ) + ) + ) + +;; definition for function tie-vu1-init-buffers +;; WARN: Return type mismatch symbol vs none. +(defun tie-vu1-init-buffers () + (let ((gp-0 0) + (s5-0 100) + (s4-0 68) + ) + (dotimes (s3-0 10) + (let ((v1-2 (-> *level* draw-level s3-0)) + (s2-0 (-> *tie-init-table* s3-0)) + ) + (when v1-2 + (tie-init-buf + (-> s2-0 tie-bucket) + (the-as gs-alpha gp-0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (let ((t9-1 tie-init-scissor-buf) + (a0-3 (-> s2-0 tie-scissor-bucket)) + (a1-2 0) + (a2-1 #x5026b) + (a3-1 #x50000) + ) + (t9-1 a0-3 (the-as gs-alpha a1-2) (the-as gs-test a2-1) (the-as gs-test a3-1)) + (tie-init-envmap-buf + (-> s2-0 tie-envmap-bucket) + (the-as gs-alpha gp-0) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-envmap-scissor-buf (-> s2-0 tie-envmap-scissor-bucket) (the-as gs-alpha gp-0) #x50000 a3-1) + ) + (tie-init-buf + (-> s2-0 tie-vanish-bucket) + (the-as gs-alpha s5-0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-buf + (-> s2-0 tie-trans-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (let ((t9-6 tie-init-scissor-buf) + (a0-8 (-> s2-0 tie-scissor-trans-bucket)) + (a1-7 1) + (a2-6 #x5026b) + (a3-4 #x50000) + ) + (t9-6 a0-8 (the-as gs-alpha a1-7) (the-as gs-test a2-6) (the-as gs-test a3-4)) + (tie-init-envmap-buf + (-> s2-0 tie-envmap-trans-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-envmap-scissor-buf (-> s2-0 tie-envmap-scissor-trans-bucket) (the-as gs-alpha s4-0) #x50000 a3-4) + ) + (tie-init-buf + (-> s2-0 tie-water-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (let ((t9-10 tie-init-scissor-buf) + (a0-12 (-> s2-0 tie-scissor-water-bucket)) + (a1-11 1) + (a2-10 #x51001) + (a3-6 #x51001) + ) + (t9-10 a0-12 (the-as gs-alpha a1-11) (the-as gs-test a2-10) (the-as gs-test a3-6)) + (tie-init-envmap-buf + (-> s2-0 tie-envmap-water-bucket) + (the-as gs-alpha s4-0) + (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) + ) + (tie-init-envmap-scissor-buf (-> s2-0 tie-envmap-scissor-water-bucket) (the-as gs-alpha s4-0) #x51001 a3-6) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 10 of type drawable-tree-instance-tie +;; WARN: Return type mismatch int vs none. +(defmethod draw ((this drawable-tree-instance-tie)) + "Draw the drawable, and typically its children. + This usually means adding stuff to a list to be drawn later, rather than expensive drawing here." + (let ((v1-1 (-> *background-work* tie-tree-count)) + (a1-3 (-> *level* draw-level *draw-index*)) + ) + (set! (-> *background-work* tie-trees v1-1) this) + (set! (-> *background-work* tie-levels v1-1) a1-3) + ) + (+! (-> *background-work* tie-tree-count) 1) + 0 + (none) + ) + +;; definition for method 13 of type drawable-tree-instance-tie +;; WARN: Return type mismatch int vs none. +(defmethod collect-stats ((this drawable-tree-instance-tie)) + "Collect triangle/perf statistics for rendering. + This is only called when viewing stats. + The vis-bits and culling registers are loaded during this time." + (when (logtest? (vu1-renderer-mask + tie-scissor + tie + etie + tie-vanish + generic + tie-scissor-trans + tie-trans + etie-trans + tie-scissor-water + tie-water + etie-water + ) + (-> *display* vu1-enable-user) + ) + (-> this data (+ (-> this length) -1)) + (let ((v1-9 (-> this prototypes prototype-array-tie))) + (dotimes (a0-1 (-> v1-9 length)) + (let ((a1-4 (-> v1-9 array-data a0-1))) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask generic)) + (let ((a2-4 0) + (a3-0 2) + ) + (while (>= a3-0 a2-4) + (let ((t0-2 (-> a1-4 generic-count a2-4)) + (t2-0 (-> a1-4 tie-geom (+ a2-4 1))) + ) + (when (nonzero? t0-2) + (let ((t1-4 (the-as object (-> t2-0 data))) + (t2-1 (-> t2-0 length)) + ) + (+! (-> *terrain-stats* tie-generic groups) 1) + (+! (-> *terrain-stats* tie-generic fragments) t2-1) + (+! (-> *terrain-stats* tie-generic instances) t0-2) + (dotimes (t3-9 t2-1) + (let ((t5-0 (* (-> (the-as tie-fragment t1-4) debug num-tris) t0-2)) + (t4-7 (* (-> (the-as tie-fragment t1-4) debug num-dverts) t0-2)) + ) + (+! (-> *terrain-stats* tie-generic tris) t5-0) + (+! (-> *terrain-stats* tie-generic dverts) t4-7) + ) + (set! t1-4 (&+ (the-as tie-fragment t1-4) 64)) + ) + ) + ) + ) + (+! a2-4 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-vanish)) + (let ((a2-11 (-> a1-4 vanish-count)) + (t0-4 (-> a1-4 tie-geom 3)) + ) + (when (nonzero? a2-11) + (let ((a3-2 (the-as object (-> t0-4 data))) + (t0-5 (-> t0-4 length)) + ) + (+! (-> *terrain-stats* tie-vanish groups) 1) + (+! (-> *terrain-stats* tie-vanish fragments) t0-5) + (+! (-> *terrain-stats* tie-vanish instances) a2-11) + (dotimes (t1-15 t0-5) + (let ((t3-10 (* (-> (the-as tie-fragment a3-2) debug num-tris) a2-11)) + (t2-9 (* (-> (the-as tie-fragment a3-2) debug num-dverts) a2-11)) + ) + (+! (-> *terrain-stats* tie-vanish tris) t3-10) + (+! (-> *terrain-stats* tie-vanish dverts) t2-9) + ) + (set! a3-2 (&+ (the-as tie-fragment a3-2) 64)) + ) + ) + ) + ) + ) + (cond + ((logtest? (-> a1-4 flags) (prototype-flags tpage-water)) + (when (logtest? (vu1-renderer-mask tie-water) (-> *display* vu1-enable-user)) + (let ((a2-18 1) + (a3-6 3) + ) + (while (>= a3-6 a2-18) + (let ((t0-8 (-> a1-4 count a2-18)) + (t2-11 (-> a1-4 tie-geom a2-18)) + ) + (when (nonzero? t0-8) + (let ((t1-19 (the-as object (-> t2-11 data))) + (t2-12 (-> t2-11 length)) + ) + (+! (-> *terrain-stats* tie-water groups) 1) + (+! (-> *terrain-stats* tie-water fragments) t2-12) + (+! (-> *terrain-stats* tie-water instances) t0-8) + (dotimes (t3-24 t2-12) + (let ((t5-5 (* (-> (the-as tie-fragment t1-19) debug num-tris) t0-8)) + (t4-19 (* (-> (the-as tie-fragment t1-19) debug num-dverts) t0-8)) + ) + (+! (-> *terrain-stats* tie-water tris) t5-5) + (+! (-> *terrain-stats* tie-water dverts) t4-19) + ) + (set! t1-19 (&+ (the-as tie-fragment t1-19) 64)) + ) + ) + ) + ) + (+! a2-18 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + (let ((a2-25 (-> a1-4 tie-scissor-count)) + (t0-10 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-25) + (let ((a3-8 (the-as object (-> t0-10 data))) + (t0-11 (-> t0-10 length)) + ) + (+! (-> *terrain-stats* tie-scissor-water groups) 1) + (+! (-> *terrain-stats* tie-scissor-water fragments) t0-11) + (+! (-> *terrain-stats* tie-scissor-water instances) a2-25) + (dotimes (t1-30 t0-11) + (let ((t3-25 (* (-> (the-as tie-fragment a3-8) debug num-tris) a2-25)) + (t2-20 (* (-> (the-as tie-fragment a3-8) debug num-dverts) a2-25)) + ) + (+! (-> *terrain-stats* tie-scissor-water tris) t3-25) + (+! (-> *terrain-stats* tie-scissor-water dverts) t2-20) + ) + (set! a3-8 (&+ (the-as tie-fragment a3-8) 64)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-water) (-> *display* vu1-enable-user)) + (let ((a2-30 1) + (a3-12 3) + ) + (while (>= a3-12 a2-30) + (let ((t0-14 (-> a1-4 envmap-count a2-30)) + (t2-22 (-> a1-4 tie-geom a2-30)) + ) + (when (nonzero? t0-14) + (let ((t1-34 (the-as object (-> t2-22 data))) + (t2-23 (-> t2-22 length)) + ) + (+! (-> *terrain-stats* tie-envmap-water groups) 1) + (+! (-> *terrain-stats* tie-envmap-water fragments) t2-23) + (+! (-> *terrain-stats* tie-envmap-water instances) t0-14) + (dotimes (t3-39 t2-23) + (let ((t5-10 (* (* t0-14 (-> (the-as tie-fragment t1-34) debug num-tris)) 2)) + (t4-33 (* (* t0-14 (-> (the-as tie-fragment t1-34) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-water tris) t5-10) + (+! (-> *terrain-stats* tie-envmap-water dverts) t4-33) + ) + (set! t1-34 (&+ (the-as tie-fragment t1-34) 64)) + ) + ) + ) + ) + (+! a2-30 1) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-scissor-water) (-> *display* vu1-enable-user)) + (let ((a2-35 (-> a1-4 envmap-scissor-count)) + (t0-16 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-35) + (let ((a1-5 (the-as object (-> t0-16 data))) + (a3-17 (-> t0-16 length)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-water groups) 1) + (+! (-> *terrain-stats* tie-envmap-scissor-water fragments) a3-17) + (+! (-> *terrain-stats* tie-envmap-scissor-water instances) a2-35) + (dotimes (t0-26 a3-17) + (let ((t2-24 (* (* a2-35 (-> (the-as tie-fragment a1-5) debug num-tris)) 2)) + (t1-45 (* (* a2-35 (-> (the-as tie-fragment a1-5) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-water tris) t2-24) + (+! (-> *terrain-stats* tie-envmap-scissor-water dverts) t1-45) + ) + (set! a1-5 (&+ (the-as tie-fragment a1-5) 64)) + ) + ) + ) + ) + ) + ) + ((logtest? (-> a1-4 flags) (prototype-flags tpage-alpha)) + (when (logtest? (vu1-renderer-mask tie-trans) (-> *display* vu1-enable-user)) + (let ((a2-41 1) + (a3-21 3) + ) + (while (>= a3-21 a2-41) + (let ((t0-29 (-> a1-4 count a2-41)) + (t2-29 (-> a1-4 tie-geom a2-41)) + ) + (when (nonzero? t0-29) + (let ((t1-50 (the-as object (-> t2-29 data))) + (t2-30 (-> t2-29 length)) + ) + (+! (-> *terrain-stats* tie-trans groups) 1) + (+! (-> *terrain-stats* tie-trans fragments) t2-30) + (+! (-> *terrain-stats* tie-trans instances) t0-29) + (dotimes (t3-52 t2-30) + (let ((t5-15 (* (-> (the-as tie-fragment t1-50) debug num-tris) t0-29)) + (t4-42 (* (-> (the-as tie-fragment t1-50) debug num-dverts) t0-29)) + ) + (+! (-> *terrain-stats* tie-trans tris) t5-15) + (+! (-> *terrain-stats* tie-trans dverts) t4-42) + ) + (set! t1-50 (&+ (the-as tie-fragment t1-50) 64)) + ) + ) + ) + ) + (+! a2-41 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + (let ((a2-48 (-> a1-4 tie-scissor-count)) + (t0-31 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-48) + (let ((a3-23 (the-as object (-> t0-31 data))) + (t0-32 (-> t0-31 length)) + ) + (+! (-> *terrain-stats* tie-scissor-trans groups) 1) + (+! (-> *terrain-stats* tie-scissor-trans fragments) t0-32) + (+! (-> *terrain-stats* tie-scissor-trans instances) a2-48) + (dotimes (t1-61 t0-32) + (let ((t3-53 (* (-> (the-as tie-fragment a3-23) debug num-tris) a2-48)) + (t2-38 (* (-> (the-as tie-fragment a3-23) debug num-dverts) a2-48)) + ) + (+! (-> *terrain-stats* tie-scissor-trans tris) t3-53) + (+! (-> *terrain-stats* tie-scissor-trans dverts) t2-38) + ) + (set! a3-23 (&+ (the-as tie-fragment a3-23) 64)) + ) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-trans) (-> *display* vu1-enable-user)) + (let ((a2-53 1) + (a3-27 3) + ) + (while (>= a3-27 a2-53) + (let ((t0-35 (-> a1-4 envmap-count a2-53)) + (t2-40 (-> a1-4 tie-geom a2-53)) + ) + (when (nonzero? t0-35) + (let ((t1-65 (the-as object (-> t2-40 data))) + (t2-41 (-> t2-40 length)) + ) + (+! (-> *terrain-stats* tie-envmap-trans groups) 1) + (+! (-> *terrain-stats* tie-envmap-trans fragments) t2-41) + (+! (-> *terrain-stats* tie-envmap-trans instances) t0-35) + (dotimes (t3-67 t2-41) + (let ((t5-20 (* (* t0-35 (-> (the-as tie-fragment t1-65) debug num-tris)) 2)) + (t4-56 (* (* t0-35 (-> (the-as tie-fragment t1-65) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-trans tris) t5-20) + (+! (-> *terrain-stats* tie-envmap-trans dverts) t4-56) + ) + (set! t1-65 (&+ (the-as tie-fragment t1-65) 64)) + ) + ) + ) + ) + (+! a2-53 1) + ) + ) + ) + (when (logtest? (vu1-renderer-mask etie-scissor-trans) (-> *display* vu1-enable-user)) + (let ((a2-58 (-> a1-4 envmap-scissor-count)) + (t0-37 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-58) + (let ((a1-7 (the-as object (-> t0-37 data))) + (a3-32 (-> t0-37 length)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-trans groups) 1) + (+! (-> *terrain-stats* tie-envmap-scissor-trans fragments) a3-32) + (+! (-> *terrain-stats* tie-envmap-scissor-trans instances) a2-58) + (dotimes (t0-47 a3-32) + (let ((t2-42 (* (* a2-58 (-> (the-as tie-fragment a1-7) debug num-tris)) 2)) + (t1-76 (* (* a2-58 (-> (the-as tie-fragment a1-7) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor-trans tris) t2-42) + (+! (-> *terrain-stats* tie-envmap-scissor-trans dverts) t1-76) + ) + (set! a1-7 (&+ (the-as tie-fragment a1-7) 64)) + ) + ) + ) + ) + ) + ) + (else + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie)) + (let ((a2-63 1) + (a3-34 3) + ) + (while (>= a3-34 a2-63) + (let ((t0-50 (-> a1-4 count a2-63)) + (t2-47 (-> a1-4 tie-geom a2-63)) + ) + (when (nonzero? t0-50) + (let ((t1-81 (the-as object (-> t2-47 data))) + (t2-48 (-> t2-47 length)) + ) + (+! (-> *terrain-stats* tie groups) 1) + (+! (-> *terrain-stats* tie fragments) t2-48) + (+! (-> *terrain-stats* tie instances) t0-50) + (dotimes (t3-80 t2-48) + (let ((t5-25 (* (-> (the-as tie-fragment t1-81) debug num-tris) t0-50)) + (t4-65 (* (-> (the-as tie-fragment t1-81) debug num-dverts) t0-50)) + ) + (+! (-> *terrain-stats* tie tris) t5-25) + (+! (-> *terrain-stats* tie dverts) t4-65) + ) + (set! t1-81 (&+ (the-as tie-fragment t1-81) 64)) + ) + ) + ) + ) + (+! a2-63 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tie-scissor)) + (let ((a2-70 (-> a1-4 tie-scissor-count)) + (t0-52 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-70) + (let ((a3-36 (the-as object (-> t0-52 data))) + (t0-53 (-> t0-52 length)) + ) + (+! (-> *terrain-stats* tie-scissor groups) 1) + (+! (-> *terrain-stats* tie-scissor fragments) t0-53) + (+! (-> *terrain-stats* tie-scissor instances) a2-70) + (dotimes (t1-92 t0-53) + (let ((t3-81 (* (-> (the-as tie-fragment a3-36) debug num-tris) a2-70)) + (t2-56 (* (-> (the-as tie-fragment a3-36) debug num-dverts) a2-70)) + ) + (+! (-> *terrain-stats* tie-scissor tris) t3-81) + (+! (-> *terrain-stats* tie-scissor dverts) t2-56) + ) + (set! a3-36 (&+ (the-as tie-fragment a3-36) 64)) + ) + ) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie)) + (let ((a2-76 1) + (a3-38 3) + ) + (while (>= a3-38 a2-76) + (let ((t0-56 (-> a1-4 envmap-count a2-76)) + (t2-58 (-> a1-4 tie-geom a2-76)) + ) + (when (nonzero? t0-56) + (let ((t1-96 (the-as object (-> t2-58 data))) + (t2-59 (-> t2-58 length)) + ) + (+! (-> *terrain-stats* tie-envmap groups) 1) + (+! (-> *terrain-stats* tie-envmap fragments) t2-59) + (+! (-> *terrain-stats* tie-envmap instances) t0-56) + (dotimes (t3-95 t2-59) + (let ((t5-30 (* (* t0-56 (-> (the-as tie-fragment t1-96) debug num-tris)) 2)) + (t4-79 (* (* t0-56 (-> (the-as tie-fragment t1-96) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap tris) t5-30) + (+! (-> *terrain-stats* tie-envmap dverts) t4-79) + ) + (set! t1-96 (&+ (the-as tie-fragment t1-96) 64)) + ) + ) + ) + ) + (+! a2-76 1) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie-scissor)) + (let ((a2-82 (-> a1-4 envmap-scissor-count)) + (t0-58 (-> a1-4 tie-geom 0)) + ) + (when (nonzero? a2-82) + (let ((a1-9 (the-as object (-> t0-58 data))) + (a3-41 (-> t0-58 length)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor groups) 1) + (+! (-> *terrain-stats* tie-envmap-scissor fragments) a3-41) + (+! (-> *terrain-stats* tie-envmap-scissor instances) a2-82) + (dotimes (t0-68 a3-41) + (let ((t2-60 (* (* a2-82 (-> (the-as tie-fragment a1-9) debug num-tris)) 2)) + (t1-107 (* (* a2-82 (-> (the-as tie-fragment a1-9) debug num-dverts)) 2)) + ) + (+! (-> *terrain-stats* tie-envmap-scissor tris) t2-60) + (+! (-> *terrain-stats* tie-envmap-scissor dverts) t1-107) + ) + (set! a1-9 (&+ (the-as tie-fragment a1-9) 64)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type drawable-tree-instance-tie +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw ((this drawable-tree-instance-tie)) + "Debug-draw a drawable and its children. Typically uses the debug-draw functions." + (-> this data (+ (-> this length) -1)) + (let* ((gp-0 (-> this prototypes prototype-array-tie)) + (s5-0 (-> gp-0 length)) + ) + (dotimes (s4-0 s5-0) + (debug-draw (-> gp-0 array-data s4-0 tie-geom 0)) + ) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-work_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-work_REF.gc new file mode 100644 index 000000000..a09fa1ba4 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie-work_REF.gc @@ -0,0 +1,176 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *instance-tie-work*, type instance-tie-work +(define *instance-tie-work* (new 'static 'instance-tie-work + :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0) + :constant (new 'static 'vector :x 4096.0 :y 128.0) + :far-morph (new 'static 'vector :x 1.0 :w 256.0) + :upload-color-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x80c6 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :upload-color-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #xc0cc :cmd (vif-cmd unpack-v4-8)) + ) + :upload-color-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + ) + :upload-color-ret (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ret)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + ) + :generic-color-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x3) + ) + :generic-color-1 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :generic-color-end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + :envmap-color-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x8 :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x8000 :num #x8 :cmd (vif-cmd unpack-v4-32)) + ) + :envmap-color-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #xc008 :cmd (vif-cmd unpack-v4-8)) + ) + :refl-fade-fac -0.000625 + :refl-fade-end 409600.0 + :use-etie #t + ) + ) + +;; failed to figure out what this is: +(set! (-> *instance-tie-work* upload-color-2 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1)) + +;; failed to figure out what this is: +(set! (-> *instance-tie-work* upload-color-ret vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1)) + +;; definition for symbol *prototype-tie-work*, type prototype-tie-work +(define *prototype-tie-work* (new 'static 'prototype-tie-work + :upload-flushe (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1) + ) + :upload-palette (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x1 :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #x4346 :num #x80 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :upload-model-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4000 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x32 :cmd (vif-cmd unpack-v4-16)) + ) + :upload-model-3 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id call))) + :upload-model-near-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :upload-model-near-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4000 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-near-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x1e :cmd (vif-cmd unpack-v4-8)) + ) + :upload-model-near-3 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x32 :cmd (vif-cmd unpack-v4-16)) + ) + :upload-model-near-4 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id call))) + :envmap-palette (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x1 :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #x4302 :num #x80 :cmd (vif-cmd unpack-v4-8)) + ) + :envmap-shader (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd stmod)) + :vif1 (new 'static 'vif-tag :imm #x387 :num #x5 :cmd (vif-cmd unpack-v4-32)) + ) + :upload-envmap-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #xb8 :cmd (vif-cmd base)) + :vif1 (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32)) + ) + :upload-envmap-1 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x20 :cmd (vif-cmd offset)) + :vif1 (new 'static 'vif-tag :imm #x4000 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-envmap-2 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x20 :cmd (vif-cmd unpack-v4-16)) + ) + :upload-envmap-3 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x84 :cmd (vif-cmd unpack-v4-8)) + ) + :upload-envmap-4 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id call))) + :upload-envmap-scissor-4 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xac :cmd (vif-cmd unpack-v4-8)) + ) + :generic-palette (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x20 :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x1) + ) + :generic-model-0 (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x2) + ) + :generic-model-1 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :generic-model-2 (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :model-next (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id next))) + :clamp #x8000ff00ff00ff + ) + ) + +;; failed to figure out what this is: +(set! (-> *prototype-tie-work* upload-model-1 vif0) + (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscal) :msk #x1) + ) + +;; failed to figure out what this is: +(set! (-> *prototype-tie-work* upload-model-3 vif0) + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1) + ) + +;; failed to figure out what this is: +(set! (-> *prototype-tie-work* upload-model-near-1 vif0) + (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscal) :msk #x1) + ) + +;; failed to figure out what this is: +(set! (-> *prototype-tie-work* upload-model-near-4 vif0) + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1) + ) + +;; failed to figure out what this is: +(set! (-> *prototype-tie-work* upload-envmap-2 vif0) + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscalf) :msk #x1) + ) + +;; failed to figure out what this is: +(set! (-> *prototype-tie-work* upload-envmap-4 vif1) + (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/background/tie/tie_REF.gc b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie_REF.gc new file mode 100644 index 000000000..c928b4db9 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/background/tie/tie_REF.gc @@ -0,0 +1,728 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type tie-fragment +(defmethod login ((this tie-fragment)) + "Initialize the object after it is loaded." + (let ((s5-0 (the-as adgif-shader (-> this gif-ref))) + (s4-0 (/ (-> this tex-count) (the-as uint 5))) + ) + (dotimes (s3-0 (the-as int s4-0)) + (let ((v1-1 (adgif-shader-login-no-remap s5-0))) + (when v1-1 + (dotimes (a0-4 3) + (dotimes (a1-0 3) + (set! (-> (the-as (pointer int32) (+ (+ (* a0-4 16) (* a1-0 4)) (the-as int *texture-masks*)))) + (logior (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int *texture-masks*) (* a0-4 16))) 0) + (-> (the-as (pointer int32) (+ (* a1-0 4) (the-as int v1-1) (* a0-4 16))) 15) + ) + ) + ) + (set! (-> *texture-masks* data a0-4 dist) + (fmax (-> *texture-masks* data a0-4 dist) (-> v1-1 masks data a0-4 dist)) + ) + ) + ) + ) + (when (= (-> s5-0 reg-4) 66) + (set! (-> s5-0 reg-4) (the-as uint 127)) + (set! (-> s5-0 alpha) (new 'static 'gs-alpha)) + 0 + ) + (&+! s5-0 80) + ) + ) + this + ) + +;; definition for method 3 of type drawable-inline-array-instance-tie +(defmethod inspect ((this drawable-inline-array-instance-tie)) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~Tlength: ~D~%" (-> this length)) + (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) + (dotimes (s5-0 (-> this length)) + (format #t "~T [~D] ~A~%" s5-0 (-> this data s5-0)) + ) + this + ) + +;; definition for method 5 of type drawable-inline-array-instance-tie +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this drawable-inline-array-instance-tie)) + (the-as int (+ (-> drawable-inline-array-instance-tie size) (* (+ (-> this length) -1) 64))) + ) + +;; definition for method 9 of type drawable-tree-instance-tie +;; INFO: this function exists in multiple non-identical object files +(defmethod login ((this drawable-tree-instance-tie)) + "Initialize the object after it is loaded." + this + ) + +;; definition for method 9 of type drawable-tree-instance-tie +;; INFO: this function exists in multiple non-identical object files +(defmethod login ((this drawable-tree-instance-tie)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; definition for method 3 of type prototype-tie +(defmethod inspect ((this prototype-tie)) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~Tlength: ~D~%" (-> this length)) + (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) + (dotimes (s5-0 (-> this length)) + (format #t "~T [~D] ~A~%" s5-0 (-> this data s5-0)) + ) + this + ) + +;; definition for method 9 of type prototype-tie +(defmethod login ((this prototype-tie)) + "Initialize the object after it is loaded." + (dotimes (s5-0 (-> this length)) + (login (-> this data s5-0)) + ) + this + ) + +;; definition for method 8 of type drawable-tree-instance-tie +(defmethod mem-usage ((this drawable-tree-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + (mem-usage (-> this prototypes prototype-array-tie) usage (logior flags 1)) + this + ) + +;; definition for method 8 of type tie-fragment +(defmethod mem-usage ((this tie-fragment) (usage memory-usage-block) (flags int)) + (when (logtest? flags 2) + (let ((v1-3 (* (-> this color-count) 4)) + (a0-2 (cond + ((logtest? flags 4) + 20 + ) + ((logtest? flags 8) + 21 + ) + (else + 22 + ) + ) + ) + ) + (+! (-> usage data a0-2 count) 1) + (+! (-> usage data a0-2 used) v1-3) + (+! (-> usage data a0-2 total) (logand -4 (+ v1-3 3))) + ) + (set! (-> usage length) (max 23 (-> usage length))) + (set! this this) + (goto cfg-13) + ) + (set! (-> usage length) (max 18 (-> usage length))) + (set! (-> usage data 9 name) "tie-fragment") + (set! (-> usage data 10 name) "tie-gif") + (set! (-> usage data 11 name) "tie-points") + (set! (-> usage data 12 name) "tie-colors") + (set! (-> usage data 14 name) "tie-debug") + (set! (-> usage data 13 name) "tie-draw-points") + (set! (-> usage data 17 name) "tie-generic") + (+! (-> usage data 9 count) 1) + (let ((v1-21 (asize-of this))) + (+! (-> usage data 9 used) v1-21) + (+! (-> usage data 9 total) (logand -16 (+ v1-21 15))) + ) + (let ((v1-26 (* (-> this gif-count) 16))) + (+! (-> usage data 10 count) (-> this tex-count)) + (+! (-> usage data 10 used) v1-26) + (+! (-> usage data 10 total) (logand -16 (+ v1-26 15))) + ) + (let ((v1-31 (* (-> this vertex-count) 16))) + (+! (-> usage data 11 count) (-> this vertex-count)) + (+! (-> usage data 11 used) v1-31) + (+! (-> usage data 11 total) (logand -16 (+ v1-31 15))) + ) + (let ((v1-36 (* (-> this dp-qwc) 16))) + (+! (-> usage data 13 count) (* (-> this dp-qwc) 16)) + (+! (-> usage data 13 used) v1-36) + (+! (-> usage data 13 total) (logand -16 (+ v1-36 15))) + ) + (let ((v1-41 (* (-> this generic-count) 16))) + (+! (-> usage data 17 count) 1) + (+! (-> usage data 17 used) v1-41) + (+! (-> usage data 17 total) (logand -16 (+ v1-41 15))) + ) + (let ((s4-0 (-> this debug debug-lines))) + (when (nonzero? s4-0) + (dotimes (s3-0 (-> s4-0 length)) + (+! (-> usage data 14 count) (-> s4-0 s3-0 length)) + (let ((v1-52 (asize-of (-> s4-0 s3-0)))) + (+! (-> usage data 12 used) v1-52) + (+! (-> usage data 12 total) (logand -16 (+ v1-52 15))) + ) + ) + ) + ) + (label cfg-13) + this + ) + +;; definition for method 8 of type instance-tie +(defmethod mem-usage ((this instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 19 (-> usage length))) + (set! (-> usage data 18 name) "instance-tie") + (+! (-> usage data 18 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 18 used) v1-6) + (+! (-> usage data 18 total) (logand -16 (+ v1-6 15))) + ) + (when (nonzero? (-> this color-indices)) + (set! (-> usage length) (max 24 (-> usage length))) + (set! (-> usage data 23 name) "instance-tie-colors*") + (set! (-> usage data 19 name) "instance-tie-colors0") + (set! (-> usage data 20 name) "instance-tie-colors1") + (set! (-> usage data 21 name) "instance-tie-colors2") + (set! (-> usage data 22 name) "instance-tie-colors3") + (+! (-> usage data 23 count) 1) + (let ((s3-0 (-> this bucket-ptr))) + (+ (-> usage data 19 used) (-> usage data 20 used) (-> usage data 21 used) (-> usage data 22 used)) + (dotimes (s2-0 4) + (let ((a0-10 (-> s3-0 tie-geom s2-0))) + (when (nonzero? a0-10) + (let ((t9-1 (method-of-object a0-10 mem-usage)) + (a1-2 usage) + (v1-29 s2-0) + ) + (t9-1 a0-10 a1-2 (logior (logior (cond + ((= v1-29 1) + 4 + ) + ((= v1-29 2) + 8 + ) + ((= v1-29 3) + 16 + ) + (else + 0 + ) + ) + 2 + ) + flags + ) + ) + ) + ) + ) + ) + ) + ) + this + ) + +;; definition for method 8 of type drawable-inline-array-instance-tie +(defmethod mem-usage ((this drawable-inline-array-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +;; definition for method 8 of type prototype-tie +(defmethod mem-usage ((this prototype-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) "drawable-group") + (+! (-> usage data 0 count) 1) + (let ((v1-5 32)) + (+! (-> usage data 0 used) v1-5) + (+! (-> usage data 0 total) (logand -16 (+ v1-5 15))) + ) + (dotimes (s3-0 (-> this length)) + (mem-usage (-> this data s3-0) usage flags) + ) + this + ) + +;; definition for method 5 of type prototype-tie +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this prototype-tie)) + (the-as int (+ (-> prototype-tie size) (* (+ (-> this length) -1) 64))) + ) + +;; definition of type tie-consts +(deftype tie-consts (structure) + ((data uint32 40) + (vector vector 10 :inline :overlay-at (-> data 0)) + (quads uint128 10 :overlay-at (-> data 0)) + (adgif gs-gif-tag :inline :overlay-at (-> data 0)) + (strgif gs-gif-tag :inline :overlay-at (-> data 4)) + (extra vector :inline :overlay-at (-> data 8)) + (gifbufs vector :inline :overlay-at (-> data 12)) + (clrbufs qword :inline :overlay-at (-> data 16)) + (misc qword :inline :overlay-at (-> data 20)) + (atestgif gs-gif-tag :inline :overlay-at (-> data 24)) + (alpha gs-adcmd :inline :overlay-at (-> data 28)) + (atest gs-adcmd 2 :inline :overlay-at (-> data 32)) + (atest-tra gs-adcmd :inline :overlay-at (-> data 32)) + (atest-def gs-adcmd :inline :overlay-at (-> data 36)) + ) + ) + +;; definition for method 3 of type tie-consts +(defmethod inspect ((this tie-consts)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'tie-consts) + (format #t "~1Tdata[40] @ #x~X~%" (-> this data)) + (format #t "~1Tvector[10] @ #x~X~%" (-> this data)) + (format #t "~1Tquads[10] @ #x~X~%" (-> this data)) + (format #t "~1Tadgif: #~%" (-> this data)) + (format #t "~1Tstrgif: #~%" (-> this strgif)) + (format #t "~1Textra: #~%" (-> this extra)) + (format #t "~1Tgifbufs: #~%" (-> this gifbufs)) + (format #t "~1Tclrbufs: #~%" (-> this clrbufs)) + (format #t "~1Tmisc: #~%" (-> this misc)) + (format #t "~1Tatestgif: #~%" (-> this atestgif)) + (format #t "~1Talpha: #~%" (-> this alpha)) + (format #t "~1Tatest[2] @ #x~X~%" (-> this atest-tra)) + (format #t "~1Tatest-tra: #~%" (-> this atest-tra)) + (format #t "~1Tatest-def: #~%" (-> this atest-def)) + (label cfg-4) + this + ) + +;; definition for symbol tie-vu1-block, type vu-function +(define tie-vu1-block (new 'static 'vu-function :length #x3e7 :qlength #x1f4)) + +;; definition for function tie-init-consts +;; WARN: Return type mismatch int vs none. +(defun tie-init-consts ((arg0 tie-consts) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test)) + "Set up tie-consts for VU1" + (set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1)) + (set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (case *subdivide-draw-mode* + (((subdivide-setting textured)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + (((subdivide-setting outline)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + (((subdivide-setting gouraud)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + (((subdivide-setting hack)) + (set! (-> arg0 strgif tag) + (new 'static 'gif-tag64 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1) + :nreg #x3 + ) + ) + ) + ) + (set! (-> arg0 strgif regs) + (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2)) + ) + (let ((f0-0 8388894.0) + (f1-0 8389078.0) + (f2-0 8389262.0) + ) + (set! (-> arg0 gifbufs x) f2-0) + (set! (-> arg0 gifbufs y) f1-0) + (set! (-> arg0 gifbufs z) f2-0) + (set! (-> arg0 gifbufs w) f1-0) + (set! (-> arg0 extra x) (+ f0-0 f1-0 f2-0)) + (set! (-> arg0 extra y) 0.0) + (set! (-> arg0 extra z) (+ f0-0 f1-0 f2-0)) + ) + (set! (-> arg0 clrbufs vector4w x) 198) + (set! (-> arg0 clrbufs vector4w y) 242) + (set! (-> arg0 clrbufs vector4w z) 198) + (set! (-> arg0 clrbufs vector4w w) 242) + (set! (-> arg0 atestgif tag) (new 'static 'gif-tag64 :nloop #x2 :eop #x1 :nreg #x1)) + (set! (-> arg0 atestgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) + (set! (-> arg0 alpha data) (the-as uint arg1)) + (set! (-> arg0 alpha cmds) (gs-reg64 alpha-1)) + (set! (-> arg0 atest-tra cmds) (gs-reg64 test-1)) + (set! (-> arg0 atest-tra data) (the-as uint arg2)) + (set! (-> arg0 atest-def cmds) (gs-reg64 test-1)) + (set! (-> arg0 atest-def data) (the-as uint arg3)) + (set! (-> arg0 misc vector4w x) 0) + (set! (-> arg0 misc vector4w y) -1) + (none) + ) + +;; definition for function tie-init-engine +;; WARN: Return type mismatch int vs none. +(defun tie-init-engine ((arg0 dma-buffer) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test)) + "Set up DMA to initialize TIE vu1." + (let ((v1-0 *display*) + (a0-6 (+ (* (+ (/ (-> tie-vu1-block qlength) 127) 1) 16) 240)) + ) + (+! (-> v1-0 mem-reserve-size) a0-6) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-vu-function arg0 tie-vu1-block 1) + (let ((s2-0 10)) + (let* ((v1-2 arg0) + (a0-11 (the-as dma-packet (-> v1-2 base))) + ) + (set! (-> a0-11 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc s2-0)) + (set! (-> a0-11 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> a0-11 vif1) (new 'static 'vif-tag :imm #x3c6 :cmd (vif-cmd unpack-v4-32) :num s2-0)) + (set! (-> v1-2 base) (the-as pointer (&+ a0-11 16))) + ) + (tie-init-consts (the-as tie-consts (-> arg0 base)) arg1 arg2 arg3) + (&+! (-> arg0 base) (* s2-0 16)) + ) + (let* ((v1-5 arg0) + (a0-15 (the-as dma-packet (-> v1-5 base))) + ) + (set! (-> a0-15 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> a0-15 vif0) (new 'static 'vif-tag :imm #x8 :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> a0-15 vif1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1)) + (set! (-> v1-5 base) (the-as pointer (&+ a0-15 16))) + ) + (let* ((v1-6 arg0) + (a0-17 (the-as dma-packet (-> v1-6 base))) + ) + (set! (-> a0-17 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-17 vif0) (new 'static 'vif-tag)) + (set! (-> a0-17 vif1) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> v1-6 base) (the-as pointer (&+ a0-17 16))) + ) + (let ((v1-7 (the-as object (-> arg0 base)))) + (set! (-> (the-as vector v1-7) x) 8388608.0) + (set! (-> (the-as vector v1-7) y) 8388608.0) + (set! (-> (the-as vector v1-7) z) 8388608.0) + (set! (-> (the-as vector v1-7) w) 8388608.0) + (set! (-> (the-as (pointer vif-tag) v1-7) 4) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> (the-as (pointer vif-tag) v1-7) 5) (new 'static 'vif-tag :imm #x2c :cmd (vif-cmd offset))) + (set! (-> (the-as (pointer vif-tag) v1-7) 6) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> (the-as (pointer vif-tag) v1-7) 7) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> arg0 base) (&+ (the-as pointer v1-7) 32)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function tie-end-buffer +;; WARN: Return type mismatch int vs none. +(defun tie-end-buffer ((arg0 dma-buffer)) + "Set up DMA to finish TIE." + (let ((v1-0 *display*) + (a1-0 96) + ) + (+! (-> v1-0 mem-reserve-size) a1-0) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a3-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a3-0 real-buffer-end) (the-as int (&+ (-> a3-0 base) a1-0))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set arg0 (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)))) + (let* ((v1-5 arg0) + (a1-10 (the-as dma-packet (-> v1-5 base))) + ) + (set! (-> a1-10 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a1-10 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmask))) + (set! (-> a1-10 vif1) (new 'static 'vif-tag)) + (set! (-> v1-5 base) (the-as pointer (&+ a1-10 16))) + ) + (let* ((v1-6 arg0) + (a0-1 (-> v1-6 base)) + ) + (set! (-> (the-as (pointer vif-tag) a0-1) 0) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscalf) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 1) (new 'static 'vif-tag :cmd (vif-cmd stmod))) + (set! (-> (the-as (pointer vif-tag) a0-1) 2) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 3) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1)) + (set! (-> (the-as (pointer vif-tag) a0-1) 4) (new 'static 'vif-tag)) + (set! (-> (the-as (pointer vif-tag) a0-1) 5) (new 'static 'vif-tag)) + (set! (-> (the-as (pointer vif-tag) a0-1) 6) (new 'static 'vif-tag)) + (set! (-> (the-as (pointer vif-tag) a0-1) 7) (new 'static 'vif-tag)) + (set! (-> v1-6 base) (&+ a0-1 32)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition (debug) for function tie-int-reg +(defun-debug tie-int-reg ((arg0 int)) + "Get the name of TIE VU1 program integer register." + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + "zero" + ) + ((= v1-0 1) + "itemp" + ) + ((= v1-0 2) + "point-ptr" + ) + ((= v1-0 3) + "clr-ptr" + ) + ((= v1-0 4) + "target-bp1-ptr" + ) + ((= v1-0 5) + "skip-bp2" + ) + ((= v1-0 6) + "target-bp2-ptr" + ) + ((= v1-0 7) + "target-ip1-ptr" + ) + ((= v1-0 8) + "target-ip2-ptr" + ) + ((= v1-0 9) + "ind/ind0" + ) + ((= v1-0 10) + " ind1" + ) + ((= v1-0 11) + " ind2" + ) + ((= v1-0 12) + "dest-ptr" + ) + ((= v1-0 13) + "dest2-ptr" + ) + ((= v1-0 14) + "skip-ips" + ) + ((= v1-0 15) + "kick-addr" + ) + ) + ) + ) + +;; definition (debug) for function tie-float-reg +(defun-debug tie-float-reg ((arg0 int)) + "Get the name of TIE VU1 program float register." + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + "zero" + ) + ((= v1-0 1) + "t-mtx0" + ) + ((= v1-0 2) + "t-mtx1" + ) + ((= v1-0 3) + "t-mtx2" + ) + ((= v1-0 4) + "t-mtx3" + ) + ((= v1-0 5) + "vtx-0" + ) + ((= v1-0 6) + "vtx-1" + ) + ((= v1-0 7) + "vtx-2" + ) + ((= v1-0 8) + "vtx-3" + ) + ((= v1-0 9) + "pos-0/2" + ) + ((= v1-0 10) + "pos-1/3" + ) + ((= v1-0 11) + "clr-0" + ) + ((= v1-0 12) + "clr-1" + ) + ((= v1-0 13) + "clr-2" + ) + ((= v1-0 14) + "clr-3" + ) + ((= v1-0 15) + "tex-0" + ) + ((= v1-0 16) + "tex-1" + ) + ((= v1-0 17) + "tex-2" + ) + ((= v1-0 18) + "tex-3" + ) + ((= v1-0 19) + "res-0/2" + ) + ((= v1-0 20) + "res-1/3" + ) + ((= v1-0 21) + "gifbuf" + ) + ((= v1-0 22) + "clrbuf" + ) + ((= v1-0 23) + "extra" + ) + ((= v1-0 24) + "inds" + ) + ((= v1-0 25) + "--" + ) + ((= v1-0 26) + "--" + ) + ((= v1-0 27) + "morph" + ) + ((= v1-0 28) + "xyzofs" + ) + ((= v1-0 29) + "clr1" + ) + ((= v1-0 30) + "clr2" + ) + ((= v1-0 31) + "--" + ) + ) + ) + ) + +;; definition (debug) for function tie-ints +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defun-debug tie-ints () + "Dump TIE integer regs for debug." + (local-vars (sv-16 uint)) + (let ((gp-0 (+ #x3da0 #x1100c000))) + (dotimes (s5-0 16) + (if (< s5-0 10) + (format 0 " ") + ) + (let ((s4-0 format) + (s3-0 0) + (s2-0 "vi~d: ~6d #x~4,'0X ~s~%") + (s1-0 s5-0) + (s0-0 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) + ) + (set! sv-16 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) + (let ((t1-0 (tie-int-reg s5-0))) + (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) + ) + ) + ) + ) + (none) + ) + +;; definition (debug) for function tie-floats +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defun-debug tie-floats () + "Dump TIE float regs for debug." + (local-vars (sv-16 uint) (sv-32 uint)) + (let ((gp-0 (the-as (pointer uint32) (+ #x3da0 #x1100c000)))) + (dotimes (s5-0 32) + (if (< s5-0 10) + (format 0 " ") + ) + (format + 0 + "vf~d: #x~8,'0X #x~8,'0X #x~8,'0X #x~8,'0X " + s5-0 + (-> gp-0 (* s5-0 4)) + (-> gp-0 (+ (* s5-0 4) 1)) + (-> gp-0 (+ (* s5-0 4) 2)) + (-> gp-0 (+ (* s5-0 4) 3)) + ) + (let ((s4-0 format) + (s3-0 0) + (s2-0 "~F ~F ~F ~F ~s~%") + (s1-0 (-> gp-0 (* s5-0 4))) + (s0-0 (-> gp-0 (+ (* s5-0 4) 1))) + ) + (set! sv-16 (-> gp-0 (+ (* s5-0 4) 2))) + (set! sv-32 (-> gp-0 (+ (* s5-0 4) 3))) + (let ((t2-1 (tie-float-reg s5-0))) + (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 sv-32 t2-1) + ) + ) + ) + ) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc index 62ff0a38d..5bd4403f0 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc @@ -17,7 +17,7 @@ (bucket-id-16 gmerc-l0-pris) (bucket-id-16 tex-l0-pris) (bucket-id-16 gmerc2-l0-pris) - (bucket-id-16 bucket32) + (bucket-id-16 tie-vanish-l1-tfrag) (bucket-id-16 merc-l0-shrub) (bucket-id-16 emerc-l0-shrub) (bucket-id-16 gmerc-l0-shrub) @@ -29,7 +29,7 @@ (bucket-id-16 gmerc-l0-alpha) (bucket-id-16 tex-l0-alpha) (bucket-id-16 gmerc2-l0-alpha) - (bucket-id-16 bucket20) + (bucket-id-16 tie-vanish-l0-tfrag) (bucket-id-16 merc-l0-water) (bucket-id-16 merc-l0-water) (bucket-id-16 gmerc-l0-water) @@ -41,7 +41,7 @@ (bucket-id-16 gmerc-l0-pris) (bucket-id-16 tex-l0-pris) (bucket-id-16 gmerc2-l0-pris) - (bucket-id-16 bucket32) + (bucket-id-16 tie-vanish-l1-tfrag) (bucket-id-16 merc-l0-pris2) (bucket-id-16 emerc-l0-pris2) (bucket-id-16 gmerc-l0-pris2) @@ -65,7 +65,7 @@ (bucket-id-16 gmerc-l1-shrub) (bucket-id-16 tex-l1-shrub) (bucket-id-16 gmerc2-l1-shrub) - (bucket-id-16 bucket11) + (bucket-id-16 tfrag-l0-tfrag) (bucket-id-16 merc-l1-alpha) (bucket-id-16 emerc-l1-alpha) (bucket-id-16 gmerc-l1-alpha) @@ -89,7 +89,7 @@ (bucket-id-16 gmerc-l1-pris2) (bucket-id-16 tex-l1-pris2) (bucket-id-16 gmerc2-l1-pris2) - (bucket-id-16 bucket44) + (bucket-id-16 tie-vanish-l2-tfrag) (bucket-id-16 merc-l2-tfrag) (bucket-id-16 emerc-l2-tfrag) (bucket-id-16 gmerc-l2-tfrag) @@ -107,7 +107,7 @@ (bucket-id-16 gmerc-l2-shrub) (bucket-id-16 tex-l2-shrub) (bucket-id-16 gmerc2-l2-shrub) - (bucket-id-16 bucket12) + (bucket-id-16 tie-l0-tfrag) (bucket-id-16 merc-l2-alpha) (bucket-id-16 emerc-l2-alpha) (bucket-id-16 gmerc-l2-alpha) @@ -119,7 +119,7 @@ (bucket-id-16 gmerc-l2-water) (bucket-id-16 tex-l2-water) (bucket-id-16 gmerc2-l2-water) - (bucket-id-16 bucket56) + (bucket-id-16 tie-vanish-l3-tfrag) (bucket-id-16 merc-l2-pris) (bucket-id-16 emerc-l2-pris) (bucket-id-16 gmerc-l2-pris) @@ -143,19 +143,19 @@ (bucket-id-16 gmerc-l3-pris) (bucket-id-16 tex-l3-pris) (bucket-id-16 gmerc2-l3-pris) - (bucket-id-16 bucket35) + (bucket-id-16 tfrag-l2-tfrag) (bucket-id-16 merc-l3-shrub) (bucket-id-16 emerc-l3-shrub) (bucket-id-16 gmerc-l3-shrub) (bucket-id-16 tex-l3-shrub) (bucket-id-16 gmerc2-l3-shrub) - (bucket-id-16 bucket13) + (bucket-id-16 etie-l0-tfrag) (bucket-id-16 merc-l3-alpha) (bucket-id-16 emerc-l3-alpha) (bucket-id-16 gmerc-l3-alpha) (bucket-id-16 tex-l3-alpha) (bucket-id-16 gmerc2-l3-alpha) - (bucket-id-16 bucket23) + (bucket-id-16 tfrag-l1-tfrag) (bucket-id-16 merc-l3-water) (bucket-id-16 merc-l3-water) (bucket-id-16 gmerc-l3-water) @@ -167,7 +167,7 @@ (bucket-id-16 gmerc-l3-pris) (bucket-id-16 tex-l3-pris) (bucket-id-16 gmerc2-l3-pris) - (bucket-id-16 bucket35) + (bucket-id-16 tfrag-l2-tfrag) (bucket-id-16 merc-l3-pris2) (bucket-id-16 emerc-l3-pris2) (bucket-id-16 gmerc-l3-pris2) @@ -185,19 +185,19 @@ (bucket-id-16 gmerc-l4-pris) (bucket-id-16 tex-l4-pris) (bucket-id-16 gmerc2-l4-pris) - (bucket-id-16 bucket36) + (bucket-id-16 tie-l2-tfrag) (bucket-id-16 merc-l4-shrub) (bucket-id-16 emerc-l4-shrub) (bucket-id-16 gmerc-l4-shrub) (bucket-id-16 tex-l4-shrub) (bucket-id-16 gmerc2-l4-shrub) - (bucket-id-16 bucket14) + (bucket-id-16 tfrag-scissor-l0-tfrag) (bucket-id-16 merc-l4-alpha) (bucket-id-16 emerc-l4-alpha) (bucket-id-16 gmerc-l4-alpha) (bucket-id-16 tex-l4-alpha) (bucket-id-16 gmerc2-l4-alpha) - (bucket-id-16 bucket24) + (bucket-id-16 tie-l1-tfrag) (bucket-id-16 merc-l4-water) (bucket-id-16 merc-l4-water) (bucket-id-16 gmerc-l4-water) @@ -209,13 +209,13 @@ (bucket-id-16 gmerc-l4-pris) (bucket-id-16 tex-l4-pris) (bucket-id-16 gmerc2-l4-pris) - (bucket-id-16 bucket36) + (bucket-id-16 tie-l2-tfrag) (bucket-id-16 merc-l4-pris2) (bucket-id-16 emerc-l4-pris2) (bucket-id-16 gmerc-l4-pris2) (bucket-id-16 tex-l4-pris2) (bucket-id-16 gmerc2-l4-pris2) - (bucket-id-16 bucket47) + (bucket-id-16 tfrag-l3-tfrag) (bucket-id-16 merc-l5-tfrag) (bucket-id-16 emerc-l5-tfrag) (bucket-id-16 gmerc-l5-tfrag) @@ -227,37 +227,37 @@ (bucket-id-16 gmerc-l5-pris) (bucket-id-16 tex-l5-pris) (bucket-id-16 gmerc2-l5-pris) - (bucket-id-16 bucket37) + (bucket-id-16 etie-l2-tfrag) (bucket-id-16 merc-l5-shrub) (bucket-id-16 emerc-l5-shrub) (bucket-id-16 gmerc-l5-shrub) (bucket-id-16 tex-l5-shrub) (bucket-id-16 gmerc2-l5-shrub) - (bucket-id-16 bucket15) + (bucket-id-16 tie-scissor-l0-tfrag) (bucket-id-16 merc-l5-alpha) (bucket-id-16 emerc-l5-alpha) (bucket-id-16 gmerc-l5-alpha) (bucket-id-16 tex-l5-alpha) (bucket-id-16 gmerc2-l5-alpha) - (bucket-id-16 bucket25) + (bucket-id-16 etie-l1-tfrag) (bucket-id-16 merc-l5-water) (bucket-id-16 merc-l5-water) (bucket-id-16 gmerc-l5-water) (bucket-id-16 tex-l5-water) (bucket-id-16 gmerc2-l5-water) - (bucket-id-16 bucket59) + (bucket-id-16 tfrag-l4-tfrag) (bucket-id-16 merc-l5-pris) (bucket-id-16 emerc-l5-pris) (bucket-id-16 gmerc-l5-pris) (bucket-id-16 tex-l5-pris) (bucket-id-16 gmerc2-l5-pris) - (bucket-id-16 bucket37) + (bucket-id-16 etie-l2-tfrag) (bucket-id-16 merc-l5-pris2) (bucket-id-16 emerc-l5-pris2) (bucket-id-16 gmerc-l5-pris2) (bucket-id-16 tex-l5-pris2) (bucket-id-16 gmerc2-l5-pris2) - (bucket-id-16 bucket48) + (bucket-id-16 tie-l3-tfrag) (bucket-id-16 merc-l6-tfrag) (bucket-id-16 emerc-l6-tfrag) (bucket-id-16 gmerc-l6-tfrag) @@ -269,37 +269,37 @@ (bucket-id-16 gmerc-l6-pris) (bucket-id-16 tex-l6-pris) (bucket-id-16 gmerc2-l6-pris) - (bucket-id-16 bucket38) + (bucket-id-16 tfrag-scissor-l2-tfrag) (bucket-id-16 merc-l6-shrub) (bucket-id-16 emerc-l6-shrub) (bucket-id-16 gmerc-l6-shrub) (bucket-id-16 tex-l6-shrub) (bucket-id-16 gmerc2-l6-shrub) - (bucket-id-16 bucket16) + (bucket-id-16 etie-scissor-l0-tfrag) (bucket-id-16 merc-l6-alpha) (bucket-id-16 emerc-l6-alpha) (bucket-id-16 gmerc-l6-alpha) (bucket-id-16 tex-l6-alpha) (bucket-id-16 gmerc2-l6-alpha) - (bucket-id-16 bucket26) + (bucket-id-16 tfrag-scissor-l1-tfrag) (bucket-id-16 merc-l6-water) (bucket-id-16 merc-l6-water) (bucket-id-16 gmerc-l6-water) (bucket-id-16 tex-l6-water) (bucket-id-16 gmerc2-l6-water) - (bucket-id-16 bucket60) + (bucket-id-16 tie-l4-tfrag) (bucket-id-16 merc-l6-pris) (bucket-id-16 emerc-l6-pris) (bucket-id-16 gmerc-l6-pris) (bucket-id-16 tex-l6-pris) (bucket-id-16 gmerc2-l6-pris) - (bucket-id-16 bucket38) + (bucket-id-16 tfrag-scissor-l2-tfrag) (bucket-id-16 merc-l6-pris2) (bucket-id-16 emerc-l6-pris2) (bucket-id-16 gmerc-l6-pris2) (bucket-id-16 tex-l6-pris2) (bucket-id-16 gmerc2-l6-pris2) - (bucket-id-16 bucket49) + (bucket-id-16 etie-l3-tfrag) (bucket-id-16 merc-l7-tfrag) (bucket-id-16 emerc-l7-tfrag) (bucket-id-16 gmerc-l7-tfrag) @@ -311,7 +311,7 @@ (bucket-id-16 gmerc-l7-pris) (bucket-id-16 tex-l7-pris) (bucket-id-16 gmerc2-l7-pris) - (bucket-id-16 bucket39) + (bucket-id-16 tie-scissor-l2-tfrag) (bucket-id-16 merc-l7-shrub) (bucket-id-16 emerc-l7-shrub) (bucket-id-16 gmerc-l7-shrub) @@ -323,25 +323,25 @@ (bucket-id-16 gmerc-l7-alpha) (bucket-id-16 tex-l7-alpha) (bucket-id-16 gmerc2-l7-alpha) - (bucket-id-16 bucket27) + (bucket-id-16 tie-scissor-l1-tfrag) (bucket-id-16 merc-l7-water) (bucket-id-16 merc-l7-water) (bucket-id-16 gmerc-l7-water) (bucket-id-16 tex-l7-water) (bucket-id-16 gmerc2-l7-water) - (bucket-id-16 bucket61) + (bucket-id-16 etie-l4-tfrag) (bucket-id-16 merc-l7-pris) (bucket-id-16 emerc-l7-pris) (bucket-id-16 gmerc-l7-pris) (bucket-id-16 tex-l7-pris) (bucket-id-16 gmerc2-l7-pris) - (bucket-id-16 bucket39) + (bucket-id-16 tie-scissor-l2-tfrag) (bucket-id-16 merc-l7-pris2) (bucket-id-16 emerc-l7-pris2) (bucket-id-16 gmerc-l7-pris2) (bucket-id-16 tex-l7-pris2) (bucket-id-16 gmerc2-l7-pris2) - (bucket-id-16 bucket50) + (bucket-id-16 tfrag-scissor-l3-tfrag) (bucket-id-16 merc-l8-tfrag) (bucket-id-16 emerc-l8-tfrag) (bucket-id-16 gmerc-l8-tfrag) @@ -353,7 +353,7 @@ (bucket-id-16 gmerc-l8-pris) (bucket-id-16 tex-l8-pris) (bucket-id-16 gmerc2-l8-pris) - (bucket-id-16 bucket40) + (bucket-id-16 etie-scissor-l2-tfrag) (bucket-id-16 merc-l8-shrub) (bucket-id-16 emerc-l8-shrub) (bucket-id-16 gmerc-l8-shrub) @@ -365,25 +365,25 @@ (bucket-id-16 gmerc-l8-alpha) (bucket-id-16 tex-l8-alpha) (bucket-id-16 gmerc2-l8-alpha) - (bucket-id-16 bucket28) + (bucket-id-16 etie-scissor-l1-tfrag) (bucket-id-16 merc-l8-water) (bucket-id-16 merc-l8-water) (bucket-id-16 gmerc-l8-water) (bucket-id-16 tex-l8-water) (bucket-id-16 gmerc2-l8-water) - (bucket-id-16 bucket62) + (bucket-id-16 tfrag-scissor-l4-tfrag) (bucket-id-16 merc-l8-pris) (bucket-id-16 emerc-l8-pris) (bucket-id-16 gmerc-l8-pris) (bucket-id-16 tex-l8-pris) (bucket-id-16 gmerc2-l8-pris) - (bucket-id-16 bucket40) + (bucket-id-16 etie-scissor-l2-tfrag) (bucket-id-16 merc-l8-pris2) (bucket-id-16 emerc-l8-pris2) (bucket-id-16 gmerc-l8-pris2) (bucket-id-16 tex-l8-pris2) (bucket-id-16 gmerc2-l8-pris2) - (bucket-id-16 bucket51) + (bucket-id-16 tie-scissor-l3-tfrag) (bucket-id-16 merc-l9-tfrag) (bucket-id-16 emerc-l9-tfrag) (bucket-id-16 gmerc-l9-tfrag) @@ -413,7 +413,7 @@ (bucket-id-16 gmerc-l9-water) (bucket-id-16 tex-l9-water) (bucket-id-16 gmerc2-l9-water) - (bucket-id-16 bucket63) + (bucket-id-16 tie-scissor-l4-tfrag) (bucket-id-16 merc-l9-pris) (bucket-id-16 emerc-l9-pris) (bucket-id-16 gmerc-l9-pris) @@ -425,7 +425,7 @@ (bucket-id-16 gmerc-l9-pris2) (bucket-id-16 tex-l9-pris2) (bucket-id-16 gmerc2-l9-pris2) - (bucket-id-16 bucket52) + (bucket-id-16 etie-scissor-l3-tfrag) (bucket-id-16 merc-lcom-tfrag) (bucket-id-16 emerc-lcom-tfrag) (bucket-id-16 gmerc-lcom-tfrag) @@ -455,7 +455,7 @@ (bucket-id-16 gmerc-lcom-water) (bucket-id-16 tex-lcom-water) (bucket-id-16 gmerc2-lcom-water) - (bucket-id-16 bucket64) + (bucket-id-16 etie-scissor-l4-tfrag) (bucket-id-16 merc-lcom-pris) (bucket-id-16 emerc-lcom-pris) (bucket-id-16 gmerc-lcom-pris) @@ -1526,7 +1526,3 @@ ;; failed to figure out what this is: (kmemclose) - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc index cfc3fcc05..1c62cb757 100644 --- a/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc @@ -162,12 +162,12 @@ rn5 rn6 rn7 - rn8 - rn9 - rn10 - rn11 - rn12 - rn13 + tfrag + tie-scissor + tie + etie + etie-scissor + tie-vanish generic merc emerc @@ -175,16 +175,16 @@ shrub-near billboard shrub-vanish - rn21 - rn22 - rn23 - rn24 - rn25 - rn26 - rn27 - rn28 - rn29 - rn30 + tfrag-trans + tie-scissor-trans + tie-trans + etie-trans + etie-scissor-trans + tfrag-water + tie-scissor-water + tie-water + etie-water + etie-scissor-water rn31 rn32 rn33 @@ -198,12 +198,12 @@ rn5 rn6 rn7 - rn8 - rn9 - rn10 - rn11 - rn12 - rn13 + tfrag + tie-scissor + tie + etie + etie-scissor + tie-vanish generic merc emerc @@ -211,16 +211,16 @@ shrub-near billboard shrub-vanish - rn21 - rn22 - rn23 - rn24 - rn25 - rn26 - rn27 - rn28 - rn29 - rn30 + tfrag-trans + tie-scissor-trans + tie-trans + etie-trans + etie-scissor-trans + tfrag-water + tie-scissor-water + tie-water + etie-water + etie-scissor-water rn31 rn32 rn33 diff --git a/test/decompiler/reference/jak3/engine/level/level-h_REF.gc b/test/decompiler/reference/jak3/engine/level/level-h_REF.gc index 6d55cbe39..b6d380ada 100644 --- a/test/decompiler/reference/jak3/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/level-h_REF.gc @@ -375,6 +375,7 @@ (loaded-texture-page-count int32) (entity entity-links-array) (closest-object meters 10) + (tie-min-dist float :offset 352) (upload-size int32 20 :offset 388) (inside-boxes? basic) (display? symbol) @@ -418,7 +419,7 @@ (alpha-dists pointer) (water-masks texture-masks-array) (water-dists pointer) - (tfrag-last-calls int32 6) + (tfrag-last-calls uint32 6) (texture-anim-array texture-anim-array 11) (light-hash light-hash) (draw-priority float) diff --git a/test/offline/config/jak3/config.jsonc b/test/offline/config/jak3/config.jsonc index cfdf05f7a..da4b15514 100644 --- a/test/offline/config/jak3/config.jsonc +++ b/test/offline/config/jak3/config.jsonc @@ -10,7 +10,8 @@ "joint", "subdivide", "shadow-cpu-h", - "foreground" + "foreground", + "tie-methods" ], "skip_compile_functions": [ @@ -109,7 +110,12 @@ // shrubbery "init-dma-test", "draw-prototype-inline-array-shrub", - "draw-inline-array-instance-shrub" + "draw-inline-array-instance-shrub", + // tfrag + "tfrag-scissor-end-buffer", + "tfrag-scissor-init-buffer", + "tfrag-scissor-vu1-init-buf", + "(method 9 drawable-tree-instance-tie)" ], "skip_compile_states": {}