From edecac9f0912aafcecbeabb55036193cd75506ae Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sat, 24 Sep 2022 17:46:13 -0400 Subject: [PATCH] [decomp] add shrubbery renderer (#1914) as with last time, fog and time of day are still garbage, but it still works: ![image](https://user-images.githubusercontent.com/48171810/192119423-91b80500-a161-42ce-b734-0c528cc721cf.png) The shrub near render is just falling back to generic again. --- decompiler/config/jak2/all-types.gc | 117 ++-- decompiler/config/jak2/hacks.jsonc | 2 - decompiler/config/jak2/type_casts.jsonc | 10 + decompiler/level_extractor/BspHeader.cpp | 16 +- decompiler/level_extractor/extract_level.cpp | 14 +- .../opengl_renderer/OpenGLRenderer.cpp | 2 + .../opengl_renderer/background/Shrub.cpp | 8 +- game/graphics/opengl_renderer/buckets.h | 2 + .../opengl_renderer/shaders/shrub.vert | 2 +- .../opengl_renderer/shaders/tfrag3.vert | 4 +- .../engine/gfx/background/background-h.gc | 2 +- .../jak2/engine/gfx/background/background.gc | 78 ++- goal_src/jak2/engine/gfx/hw/display-h.gc | 8 +- goal_src/jak2/engine/gfx/shrub/shrub-work.gc | 418 +++++++++++++ goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc | 3 + goal_src/jak2/engine/gfx/shrub/shrubbery.gc | 66 +- goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc | 1 + goal_src/jak2/engine/gfx/tfrag/tfrag.gc | 35 -- goal_src/jak2/engine/gfx/vu1-user-h.gc | 108 ++-- goal_src/jak2/engine/level/level.gc | 3 +- .../compilation/ConstantPropagation.cpp | 3 +- .../jak2/engine/gfx/hw/display-h_REF.gc | 96 +-- .../jak2/engine/gfx/shrub/shrub-work_REF.gc | 418 +++++++++++++ .../jak2/engine/gfx/shrub/shrubbery_REF.gc | 582 +++++++++++++++++- .../jak2/engine/gfx/tfrag/tfrag-h_REF.gc | 1 + test/offline/config/jak2/config.jsonc | 2 + 26 files changed, 1732 insertions(+), 269 deletions(-) create mode 100644 test/decompiler/reference/jak2/engine/gfx/shrub/shrub-work_REF.gc diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 552645c99b..57bac2aab1 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -2797,61 +2797,61 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (tex-l0-shrub 73) ;; tex - (bucket-74 74) ;; shrub - (bucket-75 75) ;; shrub - (bucket-76 76) ;; shrub - (bucket-77 77) ;; shrub - (bucket-78 78) ;; shrub + (shrub-l0-shrub 74) ;; shrub + (shrub-n-l0-shrub 75) ;; shrub + (billboard-l0-shrub 76) ;; shrub + (shrub-v-l0-shrub 77) ;; shrub + (shrub-nt-l0-shrub 78) ;; shrub (merc-l0-shrub 79) ;; merc (emerc-l0-shrub 80) ;; emerc (bucket-81 81) ;; mercneric (tex-l1-shrub 82) ;; tex - (bucket-83 83) ;; shrub - (bucket-84 84) ;; shrub - (bucket-85 85) ;; shrub - (bucket-86 86) ;; shrub - (bucket-87 87) ;; shrub + (shrub-l1-shrub 83) ;; shrub + (shrub-n-l1-shrub 84) ;; shrub + (billboard-l1-shrub 85) ;; shrub + (shrub-v-l1-shrub 86) ;; shrub + (shrub-nt-l1-shrub 87) ;; shrub (merc-l1-shrub 88) ;; merc (emerc-l1-shrub 89) ;; emerc (bucket-90 90) ;; mercneric (tex-l2-shrub 91) ;; tex - (bucket-92 92) ;; shrub - (bucket-93 93) ;; shrub - (bucket-94 94) ;; shrub - (bucket-95 95) ;; shrub - (bucket-96 96) ;; shrub + (shrub-l2-shrub 92) ;; shrub + (shrub-n-l2-shrub 93) ;; shrub + (billboard-l2-shrub 94) ;; shrub + (shrub-v-l2-shrub 95) ;; shrub + (shrub-nt-l2-shrub 96) ;; shrub (merc-l2-shrub 97) ;; merc (emerc-l2-shrub 98) ;; emerc (bucket-99 99) ;; mercneric (tex-l3-shrub 100) ;; tex - (bucket-101 101) ;; shrub - (bucket-102 102) ;; shrub - (bucket-103 103) ;; shrub - (bucket-104 104) ;; shrub - (bucket-105 105) ;; shrub + (shrub-l3-shrub 101) ;; shrub + (shrub-n-l3-shrub 102) ;; shrub + (billboard-l3-shrub 103) ;; shrub + (shrub-v-l3-shrub 104) ;; shrub + (shrub-nt-l3-shrub 105) ;; shrub (merc-l3-shrub 106) ;; merc (emerc-l3-shrub 107) ;; emerc (bucket-108 108) ;; mercneric (tex-l4-shrub 109) ;; tex - (bucket-110 110) ;; shrub - (bucket-111 111) ;; shrub - (bucket-112 112) ;; shrub - (bucket-113 113) ;; shrub - (bucket-114 114) ;; shrub + (shrub-l4-shrub 110) ;; shrub + (shrub-n-l4-shrub 111) ;; shrub + (billboard-l4-shrub 112) ;; shrub + (shrub-v-l4-shrub 113) ;; shrub + (shrub-nt-l4-shrub 114) ;; shrub (merc-l4-shrub 115) ;; merc (emerc-l4-shrub 116) ;; emerc (bucket-117 117) ;; mercneric (tex-l5-shrub 118) ;; tex - (bucket-119 119) ;; shrub - (bucket-120 120) ;; shrub - (bucket-121 121) ;; shrub - (bucket-122 122) ;; shrub - (bucket-123 123) ;; shrub + (shrub-l5-shrub 119) ;; shrub + (shrub-n-l5-shrub 120) ;; shrub + (billboard-l5-shrub 121) ;; shrub + (shrub-v-l5-shrub 122) ;; shrub + (shrub-nt-l5-shrub 123) ;; shrub (merc-l5-shrub 124) ;; merc (emerc-l5-shrub 125) ;; emerc (bucket-126 126) ;; mercneric @@ -3098,38 +3098,38 @@ (rn0) (rn1) (rn2) - (rn3) - (rn4) - (rn5) + (sky) + (ocean) + (ocean-wave) (tfrag) - (rn7) - (rn8) - (rn9) - (rn10) - (rn11) - (rn12) + (tie) + (tie-envmap) + (tie-scissor) + (tie-envmap-scissor) + (tie-vanish) + (generic) (merc) (emerc) - (rn15) - (rn16) - (rn17) - (rn18) + (shrubbery) + (shrub-near) + (billboard) + (shrubbery-vanish) (tfrag-trans) - (rn20) - (rn21) - (rn22) - (rn23) + (tie-scissor-trans) + (tie-trans) + (tie-envmap-trans) + (tie-envmap-scissor-trans) (tfrag-water) - (rn25) - (rn26) - (rn27) - (rn28) - (rn29) - (rn30) + (tie-scissor-water) + (tie-water) + (tie-envmap-water) + (tie-envmap-scissor-water) + (sprite) + (shadow) (rn31) (rn32) (rn33) - (rn34) + (depth-cue) ) (defenum tpage-category @@ -17904,6 +17904,7 @@ (color-count uint8 :offset 57) (texture-masks-index uint16 :offset 58) (generic generic-tfragment :offset 60) + (generic-u32 uint32 :offset 60) ;; added ) :method-count-assert 17 :size-assert #x40 @@ -23063,7 +23064,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern *instance-shrub-work* instance-shrub-work) ;; -;; (define-extern upload-generic-shrub function) ;; (function dma-buffer generic-shrub-fragment int int dma-buffer) +(define-extern upload-generic-shrub (function dma-buffer generic-shrub-fragment int int dma-buffer)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tfrag-near ;; @@ -26387,7 +26388,7 @@ (define-extern process-grab? (function process symbol symbol :behavior process)) (define-extern process-release? (function process symbol :behavior process)) ;; (define-extern camera-look-at function) ;; (function pair uint process :behavior camera-tracker) -(define-extern ja-anim-done? (function process symbol)) ;; +(define-extern ja-anim-done? (function process symbol)) ;; ;; (define-extern camera-pov-from function) ;; (function pair uint process :behavior camera-tracker) ;; (define-extern cam-launcher-joystick function) ;; (function vector :behavior camera-slave) ;; (define-extern cam-launcher-shortfall state) ;; (state camera-slave) @@ -28833,8 +28834,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern pov-camera-play-and-reposition (function art-joint-anim vector float none :behavior pov-camera)) -(define-extern pov-camera-init-by-other (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) ;; -(define-extern othercam-calc (function float float)) ;; +(define-extern pov-camera-init-by-other (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) ;; +(define-extern othercam-calc (function float float)) ;; (define-extern othercam-running (state othercam)) (define-extern othercam-init-by-other (function pov-camera int symbol symbol none :behavior othercam)) ;; (function process-taskable symbol symbol symbol none :behavior othercam) diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 96ed8490d9..215a9d629a 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -118,8 +118,6 @@ "bugfix?", // CFG failed "draw-inline-array-instance-shrub", - // todo - "draw-prototype-inline-array-shrub", // "reset-target-tracking", "(anon-function 1 target)", diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 8b881c077a..fad9f327db 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -2408,6 +2408,16 @@ [24, "v0", "joint"], [41, "a0", "process"] ], + "upload-generic-shrub": [ + [[3, 13], "t0", "dma-packet"], + [[15, 26], "v1", "matrix"], + [[31, 44], "t0", "vector4w-2"], + [[47, 71], "t0", "dma-packet"], + [[74, 98], "a2", "dma-packet"], + [[101, 125], "a2", "dma-packet"], + [[128, 152], "a2", "dma-packet"], + [[157, 162], "a1", "dma-packet"] + ], "(enter othercam-running)": [[[50, 60], "gp", "process-drawable"]], "(code othercam-running)": [[[2, 65], "s2", "process-drawable"]] } diff --git a/decompiler/level_extractor/BspHeader.cpp b/decompiler/level_extractor/BspHeader.cpp index 8f9699d3ee..6644fc39e3 100644 --- a/decompiler/level_extractor/BspHeader.cpp +++ b/decompiler/level_extractor/BspHeader.cpp @@ -410,7 +410,7 @@ void TFragment::read_from_file(TypedRef ref, ASSERT(read_plain_data_field(ref, "pad1", dts) == 0); ASSERT(read_plain_data_field(ref, "generic-u32", dts) == 0); } else { - lg::warn("Skipping padding check in TFragment"); + ASSERT(read_plain_data_field(ref, "generic-u32", dts) == 0); } } @@ -1416,7 +1416,7 @@ void InstanceShrubbery::read_from_file(TypedRef ref, id = read_plain_data_field(ref, "id", dts); origin.read_from_file(get_field_ref(ref, "origin", dts)); wind_index = read_plain_data_field(ref, "wind-index", dts); - color_indices = read_plain_data_field(ref, "color-indices", dts); + color_indices = read_plain_data_field(ref, "color", dts); flat_normal.read_from_file(get_field_ref(ref, "flat-normal", dts)); } @@ -1778,14 +1778,10 @@ std::unique_ptr make_drawable_tree(TypedRef ref, return tree; } - if (version == GameVersion::Jak2) { - lg::warn("skipping drawable-tree-instance-shrub reading for jak 2"); - } else { - if (ref.type->get_name() == "drawable-tree-instance-shrub") { - auto tree = std::make_unique(); - tree->read_from_file(ref, dts, stats, version); - return tree; - } + if (ref.type->get_name() == "drawable-tree-instance-shrub") { + auto tree = std::make_unique(); + tree->read_from_file(ref, dts, stats, version); + return tree; } if (ref.type->get_name() == "drawable-tree-collide-fragment") { diff --git a/decompiler/level_extractor/extract_level.cpp b/decompiler/level_extractor/extract_level.cpp index dc432a7b1a..b20ce552af 100644 --- a/decompiler/level_extractor/extract_level.cpp +++ b/decompiler/level_extractor/extract_level.cpp @@ -175,15 +175,11 @@ std::vector extract_bsp_from_level(const ObjectFileDB extract_tie(as_tie_tree, fmt::format("{}-{}-tie", dgo_name, i++), bsp_header.texture_remap_table, tex_db, level_data, false); } else if (draw_tree->my_type() == "drawable-tree-instance-shrub") { - if (db.version() == GameVersion::Jak2) { - lg::warn("skipping drawable-tree-instance-shrub extraction for jak 2"); - } else { - auto as_shrub_tree = - dynamic_cast(draw_tree.get()); - ASSERT(as_shrub_tree); - extract_shrub(as_shrub_tree, fmt::format("{}-{}-shrub", dgo_name, i++), - bsp_header.texture_remap_table, tex_db, {}, level_data, false); - } + auto as_shrub_tree = + dynamic_cast(draw_tree.get()); + ASSERT(as_shrub_tree); + extract_shrub(as_shrub_tree, fmt::format("{}-{}-shrub", dgo_name, i++), + bsp_header.texture_remap_table, tex_db, {}, level_data, false); } else if (draw_tree->my_type() == "drawable-tree-collide-fragment" && extract_collision) { auto as_collide_frags = dynamic_cast(draw_tree.get()); diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index 1b89970631..0eff1e9a08 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -92,6 +92,8 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { std::vector{tfrag3::TFragmentTreeKind::NORMAL}, false, 0); init_bucket_renderer("tfrag-l1-tfrag", BucketCategory::TFRAG, BucketId::TFRAG_L1_TFRAG, std::vector{tfrag3::TFragmentTreeKind::NORMAL}, false, 0); + init_bucket_renderer("shrub-l0-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L0_SHRUB); + init_bucket_renderer("shrub-l1-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L1_SHRUB); init_bucket_renderer("tfrag-t-l0-alpha", BucketCategory::TFRAG, BucketId::TFRAG_T_L0_ALPHA, std::vector{tfrag3::TFragmentTreeKind::TRANS}, false, 0); diff --git a/game/graphics/opengl_renderer/background/Shrub.cpp b/game/graphics/opengl_renderer/background/Shrub.cpp index ed6ea85bd2..5943e918e5 100644 --- a/game/graphics/opengl_renderer/background/Shrub.cpp +++ b/game/graphics/opengl_renderer/background/Shrub.cpp @@ -17,8 +17,9 @@ void Shrub::render(DmaFollower& dma, SharedRenderState* render_state, ScopedProf } auto data0 = dma.read_and_advance(); - ASSERT(data0.vif1() == 0); - ASSERT(data0.vif0() == 0); + ASSERT(data0.vif1() == 0 || data0.vifcode1().kind == VifCode::Kind::NOP); + ASSERT(data0.vif0() == 0 || data0.vifcode0().kind == VifCode::Kind::NOP || + data0.vifcode0().kind == VifCode::Kind::MARK); ASSERT(data0.size_bytes == 0); if (dma.current_tag().kind == DmaTag::Kind::CALL) { @@ -29,6 +30,9 @@ void Shrub::render(DmaFollower& dma, SharedRenderState* render_state, ScopedProf ASSERT(dma.current_tag_offset() == render_state->next_bucket); return; } + if (dma.current_tag_offset() == render_state->next_bucket) { + return; + } auto pc_port_data = dma.read_and_advance(); ASSERT(pc_port_data.size_bytes == sizeof(TfragPcPortData)); diff --git a/game/graphics/opengl_renderer/buckets.h b/game/graphics/opengl_renderer/buckets.h index 63a4bd62a0..789ad3776f 100644 --- a/game/graphics/opengl_renderer/buckets.h +++ b/game/graphics/opengl_renderer/buckets.h @@ -83,6 +83,8 @@ namespace jak2 { enum class BucketId { TFRAG_L0_TFRAG = 8, TFRAG_L1_TFRAG = 19, + SHRUB_L0_SHRUB = 74, + SHRUB_L1_SHRUB = 83, TFRAG_T_L0_ALPHA = 128, DEBUG_NO_ZBUF1 = 318, DEBUG_NO_ZBUF2 = 325, diff --git a/game/graphics/opengl_renderer/shaders/shrub.vert b/game/graphics/opengl_renderer/shaders/shrub.vert index 368fdf08b8..3fa560e6b7 100644 --- a/game/graphics/opengl_renderer/shaders/shrub.vert +++ b/game/graphics/opengl_renderer/shaders/shrub.vert @@ -16,7 +16,7 @@ out vec4 fragment_color; out vec3 tex_coord; out float fogginess; -const float SCISSOR_ADJUST = 512.0/448.0; +const float SCISSOR_ADJUST = HEIGHT_SCALE * 512.0/448.0; void main() { diff --git a/game/graphics/opengl_renderer/shaders/tfrag3.vert b/game/graphics/opengl_renderer/shaders/tfrag3.vert index f4fbb24f74..9b1515d425 100644 --- a/game/graphics/opengl_renderer/shaders/tfrag3.vert +++ b/game/graphics/opengl_renderer/shaders/tfrag3.vert @@ -15,7 +15,7 @@ out vec4 fragment_color; out vec3 tex_coord; out float fogginess; -const float SCISSOR_ADJUST = 512.0/448.0; +const float SCISSOR_ADJUST = HEIGHT_SCALE * 512.0/448.0; void main() { @@ -61,7 +61,7 @@ void main() { // hack transformed.xyz *= transformed.w; // scissoring area adjust - transformed.y *= SCISSOR_ADJUST * HEIGHT_SCALE; + transformed.y *= SCISSOR_ADJUST; gl_Position = transformed; // time of day lookup diff --git a/goal_src/jak2/engine/gfx/background/background-h.gc b/goal_src/jak2/engine/gfx/background/background-h.gc index 2b47b21ab2..875137ed65 100644 --- a/goal_src/jak2/engine/gfx/background/background-h.gc +++ b/goal_src/jak2/engine/gfx/background/background-h.gc @@ -34,4 +34,4 @@ ;; DECOMP ENDS -(define-extern *background-work* background-work) \ No newline at end of file +(define-extern *background-work* background-work) diff --git a/goal_src/jak2/engine/gfx/background/background.gc b/goal_src/jak2/engine/gfx/background/background.gc index 0e7713ceb2..45e5dfe5f8 100644 --- a/goal_src/jak2/engine/gfx/background/background.gc +++ b/goal_src/jak2/engine/gfx/background/background.gc @@ -285,28 +285,28 @@ ) - ; (when (nonzero? (-> *background-work* shrub-tree-count)) - ; (with-profiler 'instance-shrubbery *profile-instance-shrubbery-color* - ; (dotimes (gp-4 (-> *background-work* shrub-tree-count)) - ; (set! *draw-index* (-> *background-work* shrub-levels gp-4 draw-index)) - ; (flush-cache 0) - ; (let ((s5-3 (-> *background-work* shrub-trees gp-4)) - ; (s4-3 (-> *background-work* shrub-levels gp-4)) - ; ) - ; (if (nonzero? (-> s5-3 colors-added)) - ; (time-of-day-interp-colors - ; (-> *instance-shrub-work* colors) - ; (the-as uint (-> s5-3 colors-added)) - ; (-> s4-3 mood-context) - ; ) - ; ) - ; (set-background-regs! s4-3) - ; (set-shrub-quard-planes! s4-3) - ; (draw-drawable-tree-instance-shrub s5-3 s4-3) - ; ) - ; ) - ; ) - ; ) + (when (nonzero? (-> *background-work* shrub-tree-count)) + (with-profiler 'instance-shrubbery *profile-instance-shrubbery-color* + (dotimes (gp-4 (-> *background-work* shrub-tree-count)) + (set! *draw-index* (-> *background-work* shrub-levels gp-4 draw-index)) + (flush-cache 0) + (let ((s5-3 (-> *background-work* shrub-trees gp-4)) + (s4-3 (-> *background-work* shrub-levels gp-4)) + ) + ; (if (nonzero? (-> s5-3 colors-added)) + ; (time-of-day-interp-colors + ; (-> *instance-shrub-work* colors) + ; (the-as uint (-> s5-3 colors-added)) + ; (-> s4-3 mood-context) + ; ) + ; ) + (set-background-regs! s4-3) + (set-shrub-quard-planes! s4-3) + (draw-drawable-tree-instance-shrub s5-3 s4-3) + ) + ) + ) + ) (let ((gp-6 (the-as level #f))) (when (or (nonzero? (-> *background-work* tfrag-tree-count)) @@ -549,5 +549,37 @@ ) +(defun add-pc-tfrag3-data ((dma-buf dma-buffer) (lev level)) + "Add PC-port specific tfrag data" + (let ((packet (the-as dma-packet (-> dma-buf base)))) + (set! (-> packet dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc 16)) + (set! (-> packet vif0) (new 'static 'vif-tag)) + (set! (-> packet vif1) (new 'static 'vif-tag :cmd (vif-cmd pc-port))) + (set! (-> dma-buf base) (the pointer (&+ packet 16))) + ) - + ;; first 4 quadwords are planes, then itimes + (let ((data-ptr (the-as (pointer uint128) (-> dma-buf base)))) + (set! (-> data-ptr 0) (-> *math-camera* plane 0 quad)) + (set! (-> data-ptr 1) (-> *math-camera* plane 1 quad)) + (set! (-> data-ptr 2) (-> *math-camera* plane 2 quad)) + (set! (-> data-ptr 3) (-> *math-camera* plane 3 quad)) + ; (set! (-> data-ptr 4) (-> lev mood itimes 0 quad)) todo, time of dayl + ; (set! (-> data-ptr 5) (-> lev mood itimes 1 quad)) + ; (set! (-> data-ptr 6) (-> lev mood itimes 2 quad)) + ; (set! (-> data-ptr 7) (-> lev mood itimes 3 quad)) + (set! (-> data-ptr 8) (-> *math-camera* camera-temp vector 0 quad)) + (set! (-> data-ptr 9) (-> *math-camera* camera-temp vector 1 quad)) + (set! (-> data-ptr 10) (-> *math-camera* camera-temp vector 2 quad)) + (set! (-> data-ptr 11) (-> *math-camera* camera-temp vector 3 quad)) + (set! (-> data-ptr 12) (-> *math-camera* hvdf-off quad)) + (let ((vec (-> (the (inline-array vector) data-ptr) 13))) + (set! (-> vec x) (-> *math-camera* pfog0)) + (set! (-> vec y) (-> *math-camera* fog-min)) + (set! (-> vec z) (-> *math-camera* fog-max)) + ) + (set! (-> data-ptr 14) (-> (math-camera-pos) quad)) + (charp<-string (the (pointer uint8) (&-> data-ptr 15)) (symbol->string (-> lev nickname))) + ) + (&+! (-> dma-buf base) (* 16 16)) + ) diff --git a/goal_src/jak2/engine/gfx/hw/display-h.gc b/goal_src/jak2/engine/gfx/hw/display-h.gc index 3371f3c428..dff98ee3e9 100644 --- a/goal_src/jak2/engine/gfx/hw/display-h.gc +++ b/goal_src/jak2/engine/gfx/hw/display-h.gc @@ -94,9 +94,11 @@ (defconstant DEFAULT_ALL_RENDERERS (vu1-renderer-mask - rn3 rn4 rn5 tfrag rn7 rn8 rn9 rn10 rn11 rn12 merc emerc rn15 rn16 - rn17 rn18 tfrag-trans rn20 rn21 rn22 rn23 tfrag-water rn25 rn26 rn27 rn28 rn29 - rn30 rn31 rn32 rn34 + sky ocean ocean-wave tfrag tie tie-envmap tie-scissor tie-envmap-scissor + tie-vanish generic merc emerc shrubbery shrub-near billboard shrubbery-vanish + tfrag-trans tie-scissor-trans tie-trans tie-envmap-trans tie-envmap-scissor-trans + tfrag-water tie-scissor-water tie-water tie-envmap-water tie-envmap-scissor-water + sprite shadow rn31 rn32 depth-cue ) ) diff --git a/goal_src/jak2/engine/gfx/shrub/shrub-work.gc b/goal_src/jak2/engine/gfx/shrub/shrub-work.gc index 0c64fc9c1d..4b0241580d 100644 --- a/goal_src/jak2/engine/gfx/shrub/shrub-work.gc +++ b/goal_src/jak2/engine/gfx/shrub/shrub-work.gc @@ -7,3 +7,421 @@ ;; DECOMP BEGINS +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *instance-shrub-work*, type instance-shrub-work +(define *instance-shrub-work* + (new 'static 'instance-shrub-work + :matrix-tmpl (new 'static 'inline-array qword 20 + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050143)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050148)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05014d)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050152)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050157)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05015c)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050161)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050166)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05016b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050170)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050176)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05017b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050180)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050185)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018a)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018f)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050194)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050199)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05019e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c0501a3)) + ) + :count-tmpl (new 'static 'inline-array vector4w 20 + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 9) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 9) + ) + :mscalf-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :mscalf-ret-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ret)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :billboard-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xd :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #xd :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x303e400000008004 #x412) + ) + :shrub-near-packets (new 'static 'inline-array shrub-near-packet 6 + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + ) + :dma-ref (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :dma-end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0) + :constants (new 'static 'vector :x 128.0 :y 1.0) + :color-constant (new 'static 'vector4w :x #x47000000 :y #x47000000 :z #x47000000) + :start-bank (new 'static 'array uint8 20 #x0 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *instance-shrub-work* mscalf-tmpl vif0 imm) 103) + +;; failed to figure out what this is: +(set! (-> *instance-shrub-work* mscalf-ret-tmpl vif0 imm) 103) + +;; definition for function upload-generic-shrub +;; INFO: Used lq/sq +(defun upload-generic-shrub ((arg0 dma-buffer) (arg1 generic-shrub-fragment) (arg2 int) (arg3 int)) + (let* ((v1-0 arg0) + (t0-0 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet t0-0) dma) (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t0-0) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet t0-0) vif1) + (new 'static 'vif-tag :num #x6 :cmd (vif-cmd unpack-v4-32) :imm (shr (shl arg2 54) 54)) + ) + (set! (-> v1-0 base) (&+ (the-as pointer t0-0) 16)) + ) + (let* ((v1-1 (the-as matrix (-> arg0 base))) + (t3-0 (-> *math-camera* camera-temp)) + (t0-3 (-> t3-0 vector 0 quad)) + (t1-4 (-> t3-0 vector 1 quad)) + (t2-4 (-> t3-0 vector 2 quad)) + (t3-1 (-> t3-0 trans quad)) + ) + (set! (-> v1-1 vector 0 quad) t0-3) + (set! (-> v1-1 vector 1 quad) t1-4) + (set! (-> v1-1 vector 2 quad) t2-4) + (set! (-> v1-1 trans quad) t3-1) + ) + (&+! (-> arg0 base) 64) + (let* ((v1-4 arg0) + (t0-4 (the-as object (-> v1-4 base))) + ) + (set! (-> (the-as vector4w-2 t0-4) vector 0 x) #x3f800000) + (set! (-> (the-as vector4w-2 t0-4) vector 0 y) #x3f800000) + (set! (-> (the-as vector4w-2 t0-4) vector 0 z) #x3f800000) + (set! (-> (the-as vector4w-2 t0-4) vector 0 w) 128) + (set! (-> (the-as vector4w-2 t0-4) vector 1 x) (the-as int (-> arg1 vtx-cnt))) + (set! (-> (the-as vector4w-2 t0-4) vector 1 y) 0) + (set! (-> (the-as vector4w-2 t0-4) vector 1 z) 0) + (set! (-> (the-as vector4w-2 t0-4) vector 1 w) 0) + (set! (-> v1-4 base) (&+ (the-as pointer t0-4) 32)) + ) + (let* ((v1-5 arg0) + (t0-6 (the-as object (-> v1-5 base))) + ) + (set! (-> (the-as dma-packet t0-6) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere x)) :qwc (-> arg1 cnt-qwc)) + ) + (set! (-> (the-as dma-packet t0-6) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t0-6) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (+ arg2 6) 54) 54) :num (-> arg1 cnt-qwc)) + ) + (set! (-> v1-5 base) (&+ (the-as pointer t0-6) 16)) + ) + (let* ((v1-6 arg0) + (a2-8 (the-as object (-> v1-6 base))) + ) + (set! (-> (the-as dma-packet a2-8) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere w)) :qwc (-> arg1 stq-qwc)) + ) + (set! (-> (the-as dma-packet a2-8) vif0) (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet a2-8) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v2-16) :imm (shr (shl arg3 54) 54) :num (-> arg1 vtx-cnt)) + ) + (set! (-> v1-6 base) (&+ (the-as pointer a2-8) 16)) + ) + (let* ((v1-7 arg0) + (a2-10 (the-as object (-> v1-7 base))) + ) + (set! (-> (the-as dma-packet a2-10) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere z)) :qwc (-> arg1 col-qwc)) + ) + (set! (-> (the-as dma-packet a2-10) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a2-10) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v3-8) :imm (shr (shl (+ arg3 1) 54) 54) :num (-> arg1 vtx-cnt)) + ) + (set! (-> v1-7 base) (&+ (the-as pointer a2-10) 16)) + ) + (let* ((v1-8 arg0) + (a2-12 (the-as object (-> v1-8 base))) + ) + (set! (-> (the-as dma-packet a2-12) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere y)) :qwc (-> arg1 vtx-qwc)) + ) + (set! (-> (the-as dma-packet a2-12) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a2-12) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v3-16) :imm (shr (shl (+ arg3 2) 54) 54) :num (-> arg1 vtx-cnt)) + ) + (set! (-> v1-8 base) (&+ (the-as pointer a2-12) 16)) + ) + (let* ((v1-9 arg0) + (a1-7 (the-as object (-> v1-9 base))) + ) + (set! (-> (the-as dma-packet a1-7) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-7) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet a1-7) vif1) (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1)) + (set! (-> v1-9 base) (&+ (the-as pointer a1-7) 16)) + ) + arg0 + ) + + + + diff --git a/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc b/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc index 68869bcff6..292870b2c9 100644 --- a/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc +++ b/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc @@ -265,3 +265,6 @@ :size-assert #x38a0 :flag-assert #x9000038a0 ) + +;; DECOMP ENDS +(define-extern draw-drawable-tree-instance-shrub (function drawable-tree-instance-shrub level none)) diff --git a/goal_src/jak2/engine/gfx/shrub/shrubbery.gc b/goal_src/jak2/engine/gfx/shrub/shrubbery.gc index e569135e9a..6e639d90b6 100644 --- a/goal_src/jak2/engine/gfx/shrub/shrubbery.gc +++ b/goal_src/jak2/engine/gfx/shrub/shrubbery.gc @@ -456,7 +456,7 @@ (set! (-> *instance-shrub-work* wind-vectors) (-> tree info wind-vectors)) (set! (-> *instance-shrub-work* wait-to-spr) (the-as uint 0)) (set! (-> *instance-shrub-work* wait-from-spr) (the-as uint 0)) - (when (logtest? (vu1-renderer-mask rn15 rn16 rn17 rn18) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrubbery-vanish) (-> *display* vu1-enable-user)) (let* ((proto-array (-> tree info prototype-inline-array-shrub)) (proto-array-len (-> proto-array length)) (proto-array-data (-> proto-array data)) @@ -473,18 +473,62 @@ (when (nonzero? (-> tree length)) (let ((dma-start (-> *display* frames (-> *display* on-screen) global-buf base))) + ;; remove PS2 drawing + #| (reset! (-> *perf-stats* data (perf-stat-bucket inst-shrub))) (draw-inline-array-instance-shrub - dma-buff - (&+ (-> tree data 0) 32) - (-> (the-as drawable-group (-> tree data 0)) length) - proto-array-data - ) + dma-buff + (&+ (-> tree data 0) 32) + (-> (the-as drawable-group (-> tree data 0)) length) + proto-array-data + ) (read! (-> *perf-stats* data (perf-stat-bucket inst-shrub))) (reset! (-> *perf-stats* data (perf-stat-bucket proto-shrub))) (draw-prototype-inline-array-shrub proto-array-len proto-array-data) (read! (-> *perf-stats* data (perf-stat-bucket proto-shrub))) + |# + + ;; PC port drawing for shrubs + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask shrubbery)) + (let* ((shrub-dma-buff (-> *display* frames (-> *display* on-screen) global-buf)) + (dma-start (-> shrub-dma-buff base))) + (add-pc-tfrag3-data shrub-dma-buff (-> *level* draw-level *draw-index*)) + (let ((a3-22 (-> shrub-dma-buff base))) + (let ((v1-57 (the-as object (-> shrub-dma-buff base)))) + (set! (-> (the-as dma-packet v1-57) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-57) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-57) vif1) (new 'static 'vif-tag)) + (set! (-> shrub-dma-buff base) (&+ (the-as pointer v1-57) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (cond + ((zero? *draw-index*) + (bucket-id shrub-l0-shrub) + ) + ((= *draw-index* 1) + (bucket-id shrub-l1-shrub) + ) + ((= *draw-index* 2) + (bucket-id shrub-l2-shrub) + ) + ((= *draw-index* 3) + (bucket-id shrub-l3-shrub) + ) + ((= *draw-index* 4) + (bucket-id shrub-l4-shrub) + ) + (else + (bucket-id shrub-l5-shrub) + ) + ) + dma-start + (the-as (pointer dma-tag) a3-22) + ) + ) + ) + ) (let ((v1-33 *dma-mem-usage*)) (when (nonzero? v1-33) @@ -529,12 +573,12 @@ ) (defmethod collect-stats drawable-tree-instance-shrub ((obj drawable-tree-instance-shrub)) - (when (logtest? (vu1-renderer-mask rn15 rn16 rn17 rn18) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrubbery-vanish) (-> *display* vu1-enable-user)) (let* ((v1-4 (-> obj info prototype-inline-array-shrub)) (gp-0 (the-as object (-> v1-4 data))) ) (countdown (s5-0 (-> v1-4 length)) - (when (logtest? (vu1-renderer-mask rn16) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrub-near) (-> *display* vu1-enable-user)) (let ((v1-8 (-> (the-as prototype-bucket-shrub gp-0) count 0)) (a1-2 (-> (the-as prototype-bucket-shrub gp-0) geometry 0)) ) @@ -547,7 +591,7 @@ ) ) ) - (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask rn15)) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask shrubbery)) (let ((s4-0 (-> (the-as prototype-bucket-shrub gp-0) count 1)) (v1-14 (-> (the-as prototype-bucket-shrub gp-0) geometry 1)) ) @@ -572,7 +616,7 @@ ) ) ) - (when (logtest? (vu1-renderer-mask rn18) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrubbery-vanish) (-> *display* vu1-enable-user)) (let ((s4-1 (-> (the-as prototype-bucket-shrub gp-0) count 2)) (v1-32 (-> (the-as prototype-bucket-shrub gp-0) geometry 2)) ) @@ -597,7 +641,7 @@ ) ) ) - (when (logtest? (vu1-renderer-mask rn17) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask billboard) (-> *display* vu1-enable-user)) (let ((v1-50 (-> (the-as prototype-bucket-shrub gp-0) count 3))) (when (nonzero? v1-50) (+! (-> *terrain-stats* billboard groups) 1) diff --git a/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc b/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc index 15804ed5b2..db555eda58 100644 --- a/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc +++ b/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc @@ -60,6 +60,7 @@ (color-count uint8 :offset 57) (texture-masks-index uint16 :offset 58) (generic generic-tfragment :offset 60) + (generic-u32 uint32 :offset 60) ) :method-count-assert 17 :size-assert #x40 diff --git a/goal_src/jak2/engine/gfx/tfrag/tfrag.gc b/goal_src/jak2/engine/gfx/tfrag/tfrag.gc index d4f76c6a29..317623c261 100644 --- a/goal_src/jak2/engine/gfx/tfrag/tfrag.gc +++ b/goal_src/jak2/engine/gfx/tfrag/tfrag.gc @@ -351,41 +351,6 @@ (none) ) -(defun add-pc-tfrag3-data ((dma-buf dma-buffer) (lev level)) - "Add PC-port specific tfrag data" - (let ((packet (the-as dma-packet (-> dma-buf base)))) - (set! (-> packet dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc 16)) - (set! (-> packet vif0) (new 'static 'vif-tag)) - (set! (-> packet vif1) (new 'static 'vif-tag :cmd (vif-cmd pc-port))) - (set! (-> dma-buf base) (the pointer (&+ packet 16))) - ) - - ;; first 4 quadwords are planes, then itimes - (let ((data-ptr (the-as (pointer uint128) (-> dma-buf base)))) - (set! (-> data-ptr 0) (-> *math-camera* plane 0 quad)) - (set! (-> data-ptr 1) (-> *math-camera* plane 1 quad)) - (set! (-> data-ptr 2) (-> *math-camera* plane 2 quad)) - (set! (-> data-ptr 3) (-> *math-camera* plane 3 quad)) - ; (set! (-> data-ptr 4) (-> lev mood itimes 0 quad)) todo, time of dayl - ; (set! (-> data-ptr 5) (-> lev mood itimes 1 quad)) - ; (set! (-> data-ptr 6) (-> lev mood itimes 2 quad)) - ; (set! (-> data-ptr 7) (-> lev mood itimes 3 quad)) - (set! (-> data-ptr 8) (-> *math-camera* camera-temp vector 0 quad)) - (set! (-> data-ptr 9) (-> *math-camera* camera-temp vector 1 quad)) - (set! (-> data-ptr 10) (-> *math-camera* camera-temp vector 2 quad)) - (set! (-> data-ptr 11) (-> *math-camera* camera-temp vector 3 quad)) - (set! (-> data-ptr 12) (-> *math-camera* hvdf-off quad)) - (let ((vec (-> (the (inline-array vector) data-ptr) 13))) - (set! (-> vec x) (-> *math-camera* pfog0)) - (set! (-> vec y) (-> *math-camera* fog-min)) - (set! (-> vec z) (-> *math-camera* fog-max)) - ) - (set! (-> data-ptr 14) (-> (math-camera-pos) quad)) - (charp<-string (the (pointer uint8) (&-> data-ptr 15)) (symbol->string (-> lev nickname))) - ) - (&+! (-> dma-buf base) (* 16 16)) - ) - (define t-stat (new 'global 'tfrag-stats)) (defun tfrag-print-stats ((arg0 symbol)) diff --git a/goal_src/jak2/engine/gfx/vu1-user-h.gc b/goal_src/jak2/engine/gfx/vu1-user-h.gc index 2fe7dcb4e8..ebb23fb604 100644 --- a/goal_src/jak2/engine/gfx/vu1-user-h.gc +++ b/goal_src/jak2/engine/gfx/vu1-user-h.gc @@ -103,61 +103,61 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (tex-l0-shrub 73) ;; tex - (bucket-74 74) ;; shrub - (bucket-75 75) ;; shrub - (bucket-76 76) ;; shrub - (bucket-77 77) ;; shrub - (bucket-78 78) ;; shrub + (shrub-l0-shrub 74) ;; shrub + (shrub-n-l0-shrub 75) ;; shrub + (billboard-l0-shrub 76) ;; shrub + (shrub-v-l0-shrub 77) ;; shrub + (shrub-nt-l0-shrub 78) ;; shrub (merc-l0-shrub 79) ;; merc (emerc-l0-shrub 80) ;; emerc (bucket-81 81) ;; mercneric (tex-l1-shrub 82) ;; tex - (bucket-83 83) ;; shrub - (bucket-84 84) ;; shrub - (bucket-85 85) ;; shrub - (bucket-86 86) ;; shrub - (bucket-87 87) ;; shrub + (shrub-l1-shrub 83) ;; shrub + (shrub-n-l1-shrub 84) ;; shrub + (billboard-l1-shrub 85) ;; shrub + (shrub-v-l1-shrub 86) ;; shrub + (shrub-nt-l1-shrub 87) ;; shrub (merc-l1-shrub 88) ;; merc (emerc-l1-shrub 89) ;; emerc (bucket-90 90) ;; mercneric (tex-l2-shrub 91) ;; tex - (bucket-92 92) ;; shrub - (bucket-93 93) ;; shrub - (bucket-94 94) ;; shrub - (bucket-95 95) ;; shrub - (bucket-96 96) ;; shrub + (shrub-l2-shrub 92) ;; shrub + (shrub-n-l2-shrub 93) ;; shrub + (billboard-l2-shrub 94) ;; shrub + (shrub-v-l2-shrub 95) ;; shrub + (shrub-nt-l2-shrub 96) ;; shrub (merc-l2-shrub 97) ;; merc (emerc-l2-shrub 98) ;; emerc (bucket-99 99) ;; mercneric (tex-l3-shrub 100) ;; tex - (bucket-101 101) ;; shrub - (bucket-102 102) ;; shrub - (bucket-103 103) ;; shrub - (bucket-104 104) ;; shrub - (bucket-105 105) ;; shrub + (shrub-l3-shrub 101) ;; shrub + (shrub-n-l3-shrub 102) ;; shrub + (billboard-l3-shrub 103) ;; shrub + (shrub-v-l3-shrub 104) ;; shrub + (shrub-nt-l3-shrub 105) ;; shrub (merc-l3-shrub 106) ;; merc (emerc-l3-shrub 107) ;; emerc (bucket-108 108) ;; mercneric (tex-l4-shrub 109) ;; tex - (bucket-110 110) ;; shrub - (bucket-111 111) ;; shrub - (bucket-112 112) ;; shrub - (bucket-113 113) ;; shrub - (bucket-114 114) ;; shrub + (shrub-l4-shrub 110) ;; shrub + (shrub-n-l4-shrub 111) ;; shrub + (billboard-l4-shrub 112) ;; shrub + (shrub-v-l4-shrub 113) ;; shrub + (shrub-nt-l4-shrub 114) ;; shrub (merc-l4-shrub 115) ;; merc (emerc-l4-shrub 116) ;; emerc (bucket-117 117) ;; mercneric (tex-l5-shrub 118) ;; tex - (bucket-119 119) ;; shrub - (bucket-120 120) ;; shrub - (bucket-121 121) ;; shrub - (bucket-122 122) ;; shrub - (bucket-123 123) ;; shrub + (shrub-l5-shrub 119) ;; shrub + (shrub-n-l5-shrub 120) ;; shrub + (billboard-l5-shrub 121) ;; shrub + (shrub-v-l5-shrub 122) ;; shrub + (shrub-nt-l5-shrub 123) ;; shrub (merc-l5-shrub 124) ;; merc (emerc-l5-shrub 125) ;; emerc (bucket-126 126) ;; mercneric @@ -403,38 +403,38 @@ (rn0) (rn1) (rn2) - (rn3) - (rn4) - (rn5) + (sky) + (ocean) + (ocean-wave) (tfrag) - (rn7) - (rn8) - (rn9) - (rn10) - (rn11) - (rn12) + (tie) + (tie-envmap) + (tie-scissor) + (tie-envmap-scissor) + (tie-vanish) + (generic) (merc) (emerc) - (rn15) - (rn16) - (rn17) - (rn18) + (shrubbery) + (shrub-near) + (billboard) + (shrubbery-vanish) (tfrag-trans) - (rn20) - (rn21) - (rn22) - (rn23) + (tie-scissor-trans) + (tie-trans) + (tie-envmap-trans) + (tie-envmap-scissor-trans) (tfrag-water) - (rn25) - (rn26) - (rn27) - (rn28) - (rn29) - (rn30) + (tie-scissor-water) + (tie-water) + (tie-envmap-water) + (tie-envmap-scissor-water) + (sprite) + (shadow) (rn31) (rn32) (rn33) - (rn34) + (depth-cue) ) (defenum texture-enable-mask diff --git a/goal_src/jak2/engine/level/level.gc b/goal_src/jak2/engine/level/level.gc index 23b2036115..3a46d0da7f 100644 --- a/goal_src/jak2/engine/level/level.gc +++ b/goal_src/jak2/engine/level/level.gc @@ -2153,7 +2153,8 @@ 'demo ) (*debug-segment* - 'prison ;; 'ctysluma + ;;'prison + 'ctysluma ) (else 'title diff --git a/goalc/compiler/compilation/ConstantPropagation.cpp b/goalc/compiler/compilation/ConstantPropagation.cpp index 900baa400e..6603c0c95b 100644 --- a/goalc/compiler/compilation/ConstantPropagation.cpp +++ b/goalc/compiler/compilation/ConstantPropagation.cpp @@ -263,8 +263,7 @@ s64 Compiler::get_constant_integer_or_error(const goos::Object& in, Env* env) { } if (prop.has_side_effects) { - throw_compiler_error(in, "Value {} cannot be used as a constant - it has side effects.", - in.print()); + throw_compiler_error(in, "Value {} cannot be used as a constant.", in.print()); } else { if (prop.value.is_int()) { return prop.value.as_int(); diff --git a/test/decompiler/reference/jak2/engine/gfx/hw/display-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/hw/display-h_REF.gc index a78e23ff08..6ea9a53e38 100644 --- a/test/decompiler/reference/jak2/engine/gfx/hw/display-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/hw/display-h_REF.gc @@ -143,71 +143,71 @@ (set! (-> gp-0 pmode) (new 'static 'gs-pmode :en1 #x1 :crtmd #x1 :mmod #x1 :slbg #x1)) (set! (-> gp-0 run-half-speed) #f) (set! (-> gp-0 vu1-enable-user-menu) (vu1-renderer-mask - rn3 - rn4 - rn5 + sky + ocean + ocean-wave tfrag - rn7 - rn8 - rn9 - rn10 - rn11 - rn12 + tie + tie-envmap + tie-scissor + tie-envmap-scissor + tie-vanish + generic merc emerc - rn15 - rn16 - rn17 - rn18 + shrubbery + shrub-near + billboard + shrubbery-vanish tfrag-trans - rn20 - rn21 - rn22 - rn23 + tie-scissor-trans + tie-trans + tie-envmap-trans + tie-envmap-scissor-trans tfrag-water - rn25 - rn26 - rn27 - rn28 - rn29 - rn30 + tie-scissor-water + tie-water + tie-envmap-water + tie-envmap-scissor-water + sprite + shadow rn31 rn32 - rn34 + depth-cue ) ) (set! (-> gp-0 vu1-enable-user) (vu1-renderer-mask - rn3 - rn4 - rn5 + sky + ocean + ocean-wave tfrag - rn7 - rn8 - rn9 - rn10 - rn11 - rn12 + tie + tie-envmap + tie-scissor + tie-envmap-scissor + tie-vanish + generic merc emerc - rn15 - rn16 - rn17 - rn18 + shrubbery + shrub-near + billboard + shrubbery-vanish tfrag-trans - rn20 - rn21 - rn22 - rn23 + tie-scissor-trans + tie-trans + tie-envmap-trans + tie-envmap-scissor-trans tfrag-water - rn25 - rn26 - rn27 - rn28 - rn29 - rn30 + tie-scissor-water + tie-water + tie-envmap-water + tie-envmap-scissor-water + sprite + shadow rn31 rn32 - rn34 + depth-cue ) ) gp-0 diff --git a/test/decompiler/reference/jak2/engine/gfx/shrub/shrub-work_REF.gc b/test/decompiler/reference/jak2/engine/gfx/shrub/shrub-work_REF.gc new file mode 100644 index 0000000000..f9993f8614 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/gfx/shrub/shrub-work_REF.gc @@ -0,0 +1,418 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *instance-shrub-work*, type instance-shrub-work +(define *instance-shrub-work* + (new 'static 'instance-shrub-work + :matrix-tmpl (new 'static 'inline-array qword 20 + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050143)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050148)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05014d)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050152)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050157)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05015c)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050161)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050166)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05016b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050170)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c050176)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05017b)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050180)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050185)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018a)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05018f)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050194)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c050199)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x20000005 #x0 #x0 #x6c05019e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x10000005 #x0 #x0 #x6c0501a3)) + ) + :count-tmpl (new 'static 'inline-array vector4w 20 + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 9) + (new 'static 'vector4w :x #x20000000 :z #x60010142 :w 10) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 1) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 2) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 3) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 4) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 5) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 6) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 7) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 8) + (new 'static 'vector4w :x #x20000000 :z #x60010175 :w 9) + ) + :mscalf-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :mscalf-ret-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ret)) + :vif0 (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1) + ) + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :billboard-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xd :id (dma-tag-id next)) + :vif1 (new 'static 'vif-tag :imm #xd :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x303e400000008004 #x412) + ) + :shrub-near-packets (new 'static 'inline-array shrub-near-packet 6 + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x400a :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #xb :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x117)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x345 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x34c :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4121 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x122 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x345 #x22e)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + (new 'static 'shrub-near-packet + :matrix-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x363 :num #x6 :cmd (vif-cmd unpack-v4-32)) + ) + :header-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x36a :cmd (vif-cmd unpack-v4-32)) + ) + :stq-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif0 (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v2-16)) + ) + :color-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x4238 :cmd (vif-cmd unpack-v3-8)) + ) + :vertex-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id ref)) + :vif1 (new 'static 'vif-tag :imm #x239 :cmd (vif-cmd unpack-v3-16)) + ) + :mscal-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1) + ) + :init-tmpl (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id next)) + :vif0 (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + :vif1 (new 'static 'vif-tag :imm #x388 :num #x1 :cmd (vif-cmd unpack-v4-32)) + ) + :init-data (new 'static 'inline-array qword 2 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x363 #x0)) + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x1500000c)) + ) + ) + ) + :dma-ref (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id ref))) + :dma-end (new 'static 'dma-packet :dma (new 'static 'dma-tag :id (dma-tag-id end))) + :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0) + :constants (new 'static 'vector :x 128.0 :y 1.0) + :color-constant (new 'static 'vector4w :x #x47000000 :y #x47000000 :z #x47000000) + :start-bank (new 'static 'array uint8 20 #x0 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x1 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *instance-shrub-work* mscalf-tmpl vif0 imm) 103) + +;; failed to figure out what this is: +(set! (-> *instance-shrub-work* mscalf-ret-tmpl vif0 imm) 103) + +;; definition for function upload-generic-shrub +;; INFO: Used lq/sq +(defun upload-generic-shrub ((arg0 dma-buffer) (arg1 generic-shrub-fragment) (arg2 int) (arg3 int)) + (let* ((v1-0 arg0) + (t0-0 (the-as object (-> v1-0 base))) + ) + (set! (-> (the-as dma-packet t0-0) dma) (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t0-0) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet t0-0) vif1) + (new 'static 'vif-tag :num #x6 :cmd (vif-cmd unpack-v4-32) :imm (shr (shl arg2 54) 54)) + ) + (set! (-> v1-0 base) (&+ (the-as pointer t0-0) 16)) + ) + (let* ((v1-1 (the-as matrix (-> arg0 base))) + (t3-0 (-> *math-camera* camera-temp)) + (t0-3 (-> t3-0 vector 0 quad)) + (t1-4 (-> t3-0 vector 1 quad)) + (t2-4 (-> t3-0 vector 2 quad)) + (t3-1 (-> t3-0 trans quad)) + ) + (set! (-> v1-1 vector 0 quad) t0-3) + (set! (-> v1-1 vector 1 quad) t1-4) + (set! (-> v1-1 vector 2 quad) t2-4) + (set! (-> v1-1 trans quad) t3-1) + ) + (&+! (-> arg0 base) 64) + (let* ((v1-4 arg0) + (t0-4 (the-as object (-> v1-4 base))) + ) + (set! (-> (the-as vector4w-2 t0-4) vector 0 x) #x3f800000) + (set! (-> (the-as vector4w-2 t0-4) vector 0 y) #x3f800000) + (set! (-> (the-as vector4w-2 t0-4) vector 0 z) #x3f800000) + (set! (-> (the-as vector4w-2 t0-4) vector 0 w) 128) + (set! (-> (the-as vector4w-2 t0-4) vector 1 x) (the-as int (-> arg1 vtx-cnt))) + (set! (-> (the-as vector4w-2 t0-4) vector 1 y) 0) + (set! (-> (the-as vector4w-2 t0-4) vector 1 z) 0) + (set! (-> (the-as vector4w-2 t0-4) vector 1 w) 0) + (set! (-> v1-4 base) (&+ (the-as pointer t0-4) 32)) + ) + (let* ((v1-5 arg0) + (t0-6 (the-as object (-> v1-5 base))) + ) + (set! (-> (the-as dma-packet t0-6) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere x)) :qwc (-> arg1 cnt-qwc)) + ) + (set! (-> (the-as dma-packet t0-6) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t0-6) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (+ arg2 6) 54) 54) :num (-> arg1 cnt-qwc)) + ) + (set! (-> v1-5 base) (&+ (the-as pointer t0-6) 16)) + ) + (let* ((v1-6 arg0) + (a2-8 (the-as object (-> v1-6 base))) + ) + (set! (-> (the-as dma-packet a2-8) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere w)) :qwc (-> arg1 stq-qwc)) + ) + (set! (-> (the-as dma-packet a2-8) vif0) (new 'static 'vif-tag :imm #x103 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet a2-8) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v2-16) :imm (shr (shl arg3 54) 54) :num (-> arg1 vtx-cnt)) + ) + (set! (-> v1-6 base) (&+ (the-as pointer a2-8) 16)) + ) + (let* ((v1-7 arg0) + (a2-10 (the-as object (-> v1-7 base))) + ) + (set! (-> (the-as dma-packet a2-10) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere z)) :qwc (-> arg1 col-qwc)) + ) + (set! (-> (the-as dma-packet a2-10) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a2-10) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v3-8) :imm (shr (shl (+ arg3 1) 54) 54) :num (-> arg1 vtx-cnt)) + ) + (set! (-> v1-7 base) (&+ (the-as pointer a2-10) 16)) + ) + (let* ((v1-8 arg0) + (a2-12 (the-as object (-> v1-8 base))) + ) + (set! (-> (the-as dma-packet a2-12) dma) + (new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int (-> arg1 bsphere y)) :qwc (-> arg1 vtx-qwc)) + ) + (set! (-> (the-as dma-packet a2-12) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a2-12) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v3-16) :imm (shr (shl (+ arg3 2) 54) 54) :num (-> arg1 vtx-cnt)) + ) + (set! (-> v1-8 base) (&+ (the-as pointer a2-12) 16)) + ) + (let* ((v1-9 arg0) + (a1-7 (the-as object (-> v1-9 base))) + ) + (set! (-> (the-as dma-packet a1-7) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-7) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl))) + (set! (-> (the-as dma-packet a1-7) vif1) (new 'static 'vif-tag :imm #xa :cmd (vif-cmd mscal) :msk #x1)) + (set! (-> v1-9 base) (&+ (the-as pointer a1-7) 16)) + ) + arg0 + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc b/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc index 675963ec7f..905357eb7a 100644 --- a/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc @@ -427,7 +427,575 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition for function draw-prototype-inline-array-shrub -;; ERROR: function was not converted to expressions. Cannot decompile. +;; INFO: Used lq/sq +;; ERROR: Function may read a register that is not set: a2 +(defun draw-prototype-inline-array-shrub ((proto-array-len int) (proto-array (inline-array prototype-bucket-shrub))) + (local-vars + (dma-ptr object) + (sv-16 drawable) + (sv-32 uint) + (sv-48 int) + (sv-64 drawable) + (sv-80 int) + (sv-96 uint) + (sv-112 drawable) + (sv-128 int) + ) + (let ((v1-0 (the-as prototype-bucket-shrub proto-array)) + (a0-6 (-> *display* frames (-> *display* on-screen) global-buf)) + ) + (countdown (a1-2 proto-array-len) + (when (nonzero? (-> v1-0 count 1)) + (let ((a2-2 (-> a0-6 base))) + (set! (-> (the-as (pointer uint128) a2-2)) (-> *instance-shrub-work* count-tmpl (-> v1-0 mod-count 1) quad)) + (set! (-> (the-as (pointer uint64) a2-2)) + (logior (logand (-> (the-as (pointer uint64) a2-2)) (the-as uint #x80000000ffffffff)) + (shr (shl (-> v1-0 next 1) 33) 1) + ) + ) + (set! (-> v1-0 next 1) (the-as uint a2-2)) + ) + (&+! (-> a0-6 base) 16) + ) + (set! dma-ptr + (when (nonzero? (-> v1-0 count 2)) + (let ((a2-7 (-> a0-6 base))) + (set! (-> (the-as (pointer uint128) a2-7)) (-> *instance-shrub-work* count-tmpl (-> v1-0 mod-count 2) quad)) + (set! (-> (the-as (pointer uint64) a2-7)) + (logior (logand (-> (the-as (pointer uint64) a2-7)) (the-as uint #x80000000ffffffff)) + (shr (shl (-> v1-0 next 2) 33) 1) + ) + ) + (set! (-> v1-0 next 2) (the-as uint a2-7)) + ) + (set! dma-ptr (&+ (-> a0-6 base) 16)) + (set! (-> a0-6 base) (the-as pointer dma-ptr)) + dma-ptr + ) + ) + (&+! v1-0 112) + ) + ) + (when (logtest? (vu1-renderer-mask shrub-near) (-> *display* vu1-enable-user)) + (when (nonzero? (-> *instance-shrub-work* near-count)) + (let ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf base))) + (let* ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s3-0 (-> s2-0 base)) + ) + (generic-init-buf s2-0 #x1000130 (the-as gs-zbuf dma-ptr)) + (generic-add-shrub-constants s2-0 #x5026b 60 61) + (let ((a0-14 + (the-as + shrub-near-packet + (+ (+ (-> *instance-shrub-work* current-shrub-near-packet) 5152) (the-as uint *instance-shrub-work*)) + ) + ) + (v1-23 (the-as object (-> s2-0 base))) + (a1-7 (the-as object (+ (-> *instance-shrub-work* near-last) 176))) + ) + (set! (-> a0-14 init-tmpl dma addr) (-> *instance-shrub-work* near-next)) + (let ((a2-13 (-> a0-14 init-tmpl quad)) + (a3-18 (-> a0-14 init-data 0 quad)) + (a0-15 (-> a0-14 init-data 1 quad)) + ) + (set! (-> (the-as vector4w-3 v1-23) vector 0 quad) a2-13) + (set! (-> (the-as vector4w-3 v1-23) vector 1 quad) a3-18) + (set! (-> (the-as vector4w-3 v1-23) vector 2 quad) a0-15) + ) + (let ((v1-24 (&+ (the-as pointer v1-23) 48))) + (set! (-> (the-as vector4w a1-7) y) (the-as int v1-24)) + (set! (-> s2-0 base) v1-24) + ) + ) + (let ((a3-19 (-> s2-0 base))) + (let ((v1-25 (the-as object (-> s2-0 base)))) + (set! (-> (the-as dma-packet v1-25) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as vector4w v1-25) z) 0) + (set! (-> (the-as vector4w v1-25) w) 0) + (set! (-> s2-0 base) (&+ (the-as pointer v1-25) 16)) + ) + (let ((t9-2 dma-bucket-insert-tag) + (a0-18 (-> *display* frames (-> *display* on-screen) bucket-group)) + (v1-32 *draw-index*) + ) + (set! dma-ptr s3-0) + (t9-2 + a0-18 + (cond + ((zero? v1-32) + (bucket-id shrub-n-l0-shrub) + ) + ((= v1-32 1) + (bucket-id shrub-n-l1-shrub) + ) + ((= v1-32 2) + (bucket-id shrub-n-l2-shrub) + ) + ((= v1-32 3) + (bucket-id shrub-n-l3-shrub) + ) + ((= v1-32 4) + (bucket-id shrub-n-l4-shrub) + ) + (else + (bucket-id shrub-n-l5-shrub) + ) + ) + (the-as pointer dma-ptr) + (the-as (pointer dma-tag) a3-19) + ) + ) + ) + ) + (let ((v1-33 *dma-mem-usage*)) + (when (nonzero? v1-33) + (set! (-> v1-33 length) (max 28 (-> v1-33 length))) + (set! (-> v1-33 data 27 name) "shrubbery") + (+! (-> v1-33 data 27 count) 1) + (let ((a1-19 (-> v1-33 data 27 used))) + (set! dma-ptr (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-0))) + (set! (-> v1-33 data 27 used) (+ a1-19 (the-as int dma-ptr))) + ) + (set! (-> v1-33 data 27 total) (-> v1-33 data 27 used)) + ) + ) + ) + ) + (when (nonzero? (-> *instance-shrub-work* near-trans-count)) + (let ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf base))) + (let* ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s3-1 (-> s2-1 base)) + ) + (generic-init-buf s2-1 #x1000130 (the-as gs-zbuf dma-ptr)) + (generic-add-shrub-constants s2-1 #x51001 124 125) + (let ((a0-26 + (+ (+ (-> *instance-shrub-work* current-shrub-near-trans-packet) 5152) (the-as uint *instance-shrub-work*)) + ) + (v1-50 (-> s2-1 base)) + (a1-26 (+ (-> *instance-shrub-work* near-trans-last) 176)) + ) + (let ((a2-25 (logior (logand (l.d (+ a0-26 96)) (the-as uint #x80000000ffffffff)) + (shr (shl (-> *instance-shrub-work* near-trans-next) 33) 1) + ) + ) + ) + (s.d! (+ a0-26 96) a2-25) + ) + (let ((a2-26 (l.q (+ a0-26 96))) + (a3-27 (l.q (+ a0-26 112))) + (a0-27 (l.q (+ a0-26 128))) + ) + (set! (-> (the-as (pointer uint128) v1-50)) a2-26) + (s.q! (+ v1-50 16) a3-27) + (s.q! (+ v1-50 32) a0-27) + ) + (let ((v1-51 (&+ v1-50 48))) + (s.w! (+ a1-26 4) v1-51) + (set! (-> s2-1 base) v1-51) + ) + ) + (let ((a3-28 (-> s2-1 base))) + (let ((v1-52 (-> s2-1 base))) + (set! (-> (the-as (pointer int64) v1-52)) #x20000000) + (s.w! (+ v1-52 8) 0) + (s.w! (+ v1-52 12) 0) + (set! (-> s2-1 base) (&+ v1-52 16)) + ) + (let ((t9-5 dma-bucket-insert-tag) + (a0-30 (-> *display* frames (-> *display* on-screen) bucket-group)) + (v1-59 *draw-index*) + ) + (t9-5 + a0-30 + (cond + ((zero? v1-59) + (bucket-id shrub-nt-l0-shrub) + ) + ((= v1-59 1) + (bucket-id shrub-nt-l1-shrub) + ) + ((= v1-59 2) + (bucket-id shrub-nt-l2-shrub) + ) + ((= v1-59 3) + (bucket-id shrub-nt-l3-shrub) + ) + ((= v1-59 4) + (bucket-id shrub-nt-l4-shrub) + ) + (else + (bucket-id shrub-nt-l5-shrub) + ) + ) + s3-1 + (the-as (pointer dma-tag) a3-28) + ) + ) + ) + ) + (let ((v1-60 *dma-mem-usage*)) + (when (nonzero? v1-60) + (set! (-> v1-60 length) (max 28 (-> v1-60 length))) + (set! (-> v1-60 data 27 name) "shrubbery") + (+! (-> v1-60 data 27 count) 1) + (+! (-> v1-60 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-1)) + ) + (set! (-> v1-60 data 27 total) (-> v1-60 data 27 used)) + ) + ) + ) + ) + ) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask shrubbery)) + (let ((s4-2 (-> *display* frames (-> *display* on-screen) global-buf base))) + (let* ((s2-2 (-> *display* frames (-> *display* on-screen) global-buf)) + (s3-2 (-> s2-2 base)) + ) + (shrub-init-frame s2-2 (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (let ((s1-0 (the-as object proto-array))) + (countdown (s0-0 proto-array-len) + (when (nonzero? (-> (the-as prototype-bucket-shrub s1-0) count 1)) + (if (logtest? (-> (the-as prototype-bucket-shrub s1-0) flags) (prototype-flags tpage-alpha)) + (set! sv-16 (-> (the-as prototype-bucket-shrub s1-0) geometry 2)) + (set! sv-16 (-> (the-as prototype-bucket-shrub s1-0) geometry 1)) + ) + (set! sv-32 (-> (the-as prototype-bucket-shrub s1-0) next 1)) + (if (logtest? (-> (the-as prototype-bucket-shrub s1-0) flags) (prototype-flags tpage-alpha)) + (set! sv-48 #x51001) + (set! sv-48 #x5026b) + ) + (set! sv-64 (&+ sv-16 32)) + (set! sv-80 0) + (while (< sv-80 (-> (the-as drawable-group sv-16) length)) + (shrub-upload-model + (the-as shrubbery sv-64) + s2-2 + (the-as int (-> *instance-shrub-work* start-bank (-> (the-as prototype-bucket-shrub s1-0) mod-count 1))) + ) + (when (zero? sv-80) + (let* ((v1-94 s2-2) + (a0-36 (-> v1-94 base)) + ) + (set! (-> (the-as (pointer int64) a0-36)) #x10000002) + (s.w! (+ a0-36 8) 0) + (let ((a1-44 #x50000002)) + (s.w! (+ a0-36 12) a1-44) + ) + (set! (-> v1-94 base) (&+ a0-36 16)) + ) + (let* ((v1-95 s2-2) + (a0-38 (-> v1-95 base)) + ) + (set! (-> (the-as (pointer uint64) a0-38)) (make-u128 0 (the-as uint #x1000000000008001))) + (let ((a1-47 (the-as uint #xeeeeeeeeeeeeeeee))) + (s.d! (+ a0-38 8) a1-47) + ) + (set! (-> v1-95 base) (&+ a0-38 16)) + ) + (let* ((v1-96 s2-2) + (a0-40 (-> v1-96 base)) + ) + (set! (-> (the-as (pointer int64) a0-40)) sv-48) + (let ((a1-49 71)) + (s.d! (+ a0-40 8) a1-49) + ) + (set! (-> v1-96 base) (&+ a0-40 16)) + ) + ) + (let* ((v1-97 s2-2) + (a0-42 (-> v1-97 base)) + ) + (set! (-> (the-as (pointer uint64) a0-42)) (logior #x50000000 (shr (shl sv-32 33) 1))) + (s.w! (+ a0-42 8) 0) + (s.w! (+ a0-42 12) 0) + (set! (-> v1-97 base) (&+ a0-42 16)) + ) + (set! sv-64 (&+ sv-64 32)) + (set! sv-80 (+ sv-80 1)) + ) + ) + (set! s1-0 (&+ (the-as prototype-bucket-shrub s1-0) 112)) + ) + ) + (let ((a3-30 (-> s2-2 base))) + (let ((v1-107 (-> s2-2 base))) + (set! (-> (the-as (pointer int64) v1-107)) #x20000000) + (s.w! (+ v1-107 8) 0) + (s.w! (+ v1-107 12) 0) + (set! (-> s2-2 base) (&+ v1-107 16)) + ) + (let ((t9-8 dma-bucket-insert-tag) + (a0-48 (-> *display* frames (-> *display* on-screen) bucket-group)) + (v1-114 *draw-index*) + ) + (t9-8 + a0-48 + (cond + ((zero? v1-114) + (bucket-id shrub-l0-shrub) + ) + ((= v1-114 1) + (bucket-id shrub-l1-shrub) + ) + ((= v1-114 2) + (bucket-id shrub-l2-shrub) + ) + ((= v1-114 3) + (bucket-id shrub-l3-shrub) + ) + ((= v1-114 4) + (bucket-id shrub-l4-shrub) + ) + (else + (bucket-id shrub-l5-shrub) + ) + ) + s3-2 + (the-as (pointer dma-tag) a3-30) + ) + ) + ) + ) + (let ((v1-115 *dma-mem-usage*)) + (when (nonzero? v1-115) + (set! (-> v1-115 length) (max 28 (-> v1-115 length))) + (set! (-> v1-115 data 27 name) "shrubbery") + (+! (-> v1-115 data 27 count) 1) + (+! (-> v1-115 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-2)) + ) + (set! (-> v1-115 data 27 total) (-> v1-115 data 27 used)) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask shrubbery-vanish) (-> *display* vu1-enable-user)) + (let ((s4-3 (-> *display* frames (-> *display* on-screen) global-buf base))) + (let* ((s2-3 (-> *display* frames (-> *display* on-screen) global-buf)) + (s3-3 (-> s2-3 base)) + ) + (shrub-init-frame s2-3 (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (let ((s1-1 (the-as object proto-array))) + (countdown (s0-1 proto-array-len) + (when (nonzero? (-> (the-as prototype-bucket-shrub s1-1) count 2)) + (let ((v1-132 (-> (the-as prototype-bucket-shrub s1-1) geometry 2))) + (set! sv-96 (-> (the-as prototype-bucket-shrub s1-1) next 2)) + (set! sv-112 (&+ v1-132 32)) + (set! sv-128 (-> (the-as drawable-group v1-132) length)) + ) + (while (nonzero? sv-128) + (set! sv-128 (+ sv-128 -1)) + (shrub-upload-model + (the-as shrubbery sv-112) + s2-3 + (the-as int (-> *instance-shrub-work* start-bank (-> (the-as prototype-bucket-shrub s1-1) mod-count 2))) + ) + (let* ((v1-138 s2-3) + (a0-58 (-> v1-138 base)) + ) + (set! (-> (the-as (pointer uint64) a0-58)) (logior #x50000000 (shr (shl sv-96 33) 1))) + (s.w! (+ a0-58 8) 0) + (s.w! (+ a0-58 12) 0) + (set! (-> v1-138 base) (&+ a0-58 16)) + ) + (set! sv-112 (&+ sv-112 32)) + ) + ) + (set! s1-1 (&+ (the-as prototype-bucket-shrub s1-1) 112)) + ) + ) + (let ((a3-32 (-> s2-3 base))) + (let ((v1-146 (-> s2-3 base))) + (set! (-> (the-as (pointer int64) v1-146)) #x20000000) + (s.w! (+ v1-146 8) 0) + (s.w! (+ v1-146 12) 0) + (set! (-> s2-3 base) (&+ v1-146 16)) + ) + (let ((t9-11 dma-bucket-insert-tag) + (a0-62 (-> *display* frames (-> *display* on-screen) bucket-group)) + (v1-153 *draw-index*) + ) + (t9-11 + a0-62 + (cond + ((zero? v1-153) + (bucket-id shrub-v-l0-shrub) + ) + ((= v1-153 1) + (bucket-id shrub-v-l1-shrub) + ) + ((= v1-153 2) + (bucket-id shrub-v-l2-shrub) + ) + ((= v1-153 3) + (bucket-id shrub-v-l3-shrub) + ) + ((= v1-153 4) + (bucket-id shrub-v-l4-shrub) + ) + (else + (bucket-id shrub-v-l5-shrub) + ) + ) + s3-3 + (the-as (pointer dma-tag) a3-32) + ) + ) + ) + ) + (let ((v1-154 *dma-mem-usage*)) + (when (nonzero? v1-154) + (set! (-> v1-154 length) (max 28 (-> v1-154 length))) + (set! (-> v1-154 data 27 name) "shrubbery") + (+! (-> v1-154 data 27 count) 1) + (+! (-> v1-154 data 27 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-3)) + ) + (set! (-> v1-154 data 27 total) (-> v1-154 data 27 used)) + ) + ) + ) + ) + (when (logtest? (vu1-renderer-mask billboard) (-> *display* vu1-enable-user)) + (let* ((s4-4 (-> *display* frames (-> *display* on-screen) global-buf base)) + (v1-168 (-> *display* frames (-> *display* on-screen) global-buf)) + (a2-67 (-> v1-168 base)) + ) + (let* ((a0-68 v1-168) + (a1-84 (-> a0-68 base)) + ) + (set! (-> (the-as (pointer int64) a1-84)) #x10000002) + (s.w! (+ a1-84 8) 0) + (let ((a3-35 #x50000002)) + (s.w! (+ a1-84 12) a3-35) + ) + (set! (-> a0-68 base) (&+ a1-84 16)) + ) + (let* ((a0-69 v1-168) + (a1-86 (-> a0-69 base)) + ) + (set! (-> (the-as (pointer uint64) a1-86)) (make-u128 0 (the-as uint #x1000000000008001))) + (let ((a3-38 (the-as uint #xeeeeeeeeeeeeeeee))) + (s.d! (+ a1-86 8) a3-38) + ) + (set! (-> a0-69 base) (&+ a1-86 16)) + ) + (let* ((a0-70 v1-168) + (a1-88 (-> a0-70 base)) + ) + (set! (-> (the-as (pointer int64) a1-88)) #x5180b) + (let ((a3-40 71)) + (s.d! (+ a1-88 8) a3-40) + ) + (set! (-> a0-70 base) (&+ a1-88 16)) + ) + (let ((a0-71 (-> v1-168 base))) + (while (nonzero? proto-array-len) + (+! proto-array-len -1) + (when (nonzero? (-> (the-as prototype-bucket-shrub proto-array) count 3)) + (set! (-> *instance-shrub-work* adgif-tmpl dma-vif dma addr) + (-> (the-as prototype-bucket-shrub proto-array) next 3) + ) + (set! (-> (the-as (pointer uint128) a0-71)) (-> *instance-shrub-work* adgif-tmpl dma-vif quad)) + (let ((a1-99 (-> *instance-shrub-work* adgif-tmpl quad 1))) + (s.q! (+ a0-71 16) a1-99) + ) + (let ((a1-100 (the-as prototype-bucket-shrub (-> (the-as prototype-bucket-shrub proto-array) geometry 3)))) + (let ((a3-46 (-> a1-100 dists quad))) + (s.q! (+ a0-71 32) a3-46) + ) + (let ((a3-47 (-> a1-100 rdists quad))) + (s.q! (+ a0-71 48) a3-47) + ) + (let ((a3-48 (-> a1-100 next-clear))) + (s.q! (+ a0-71 64) a3-48) + ) + (let ((a3-49 (-> a1-100 count-clear-qword))) + (s.q! (+ a0-71 80) a3-49) + ) + (let ((a1-101 (the-as prototype-bucket-shrub (-> a1-100 last-clear)))) + (s.q! (+ a0-71 96) a1-101) + ) + ) + (&+! a0-71 112) + (set! (-> (the-as prototype-bucket-shrub proto-array) last 3 dma addr) (the-as int a0-71)) + ) + (set! proto-array + (the-as (inline-array prototype-bucket-shrub) (&+ (the-as prototype-bucket-shrub proto-array) 112)) + ) + ) + (set! (-> v1-168 base) a0-71) + ) + (let ((a3-54 (-> v1-168 base))) + (let ((a0-72 (-> v1-168 base))) + (set! (-> (the-as (pointer int64) a0-72)) #x20000000) + (s.w! (+ a0-72 8) 0) + (s.w! (+ a0-72 12) 0) + (set! (-> v1-168 base) (&+ a0-72 16)) + ) + (let* ((t9-12 dma-bucket-insert-tag) + (a0-75 (-> *display* frames (-> *display* on-screen) bucket-group)) + (v1-174 *draw-index*) + (v0-12 (t9-12 + a0-75 + (cond + ((zero? v1-174) + (bucket-id billboard-l0-shrub) + ) + ((= v1-174 1) + (bucket-id billboard-l1-shrub) + ) + ((= v1-174 2) + (bucket-id billboard-l2-shrub) + ) + ((= v1-174 3) + (bucket-id billboard-l3-shrub) + ) + ((= v1-174 4) + (bucket-id billboard-l4-shrub) + ) + (else + (bucket-id billboard-l5-shrub) + ) + ) + a2-67 + (the-as (pointer dma-tag) a3-54) + ) + ) + ) + (let ((v1-175 *dma-mem-usage*)) + (when (nonzero? v1-175) + (set! (-> v1-175 length) (max 34 (-> v1-175 length))) + (set! (-> v1-175 data 33 name) "billboard") + (+! (-> v1-175 data 33 count) 1) + (+! (-> v1-175 data 33 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s4-4)) + ) + (set! (-> v1-175 data 33 total) (-> v1-175 data 33 used)) + ) + ) + v0-12 + ) + ) + ) + ) + ) ;; definition for function draw-drawable-tree-instance-shrub ;; INFO: Used lq/sq @@ -474,7 +1042,7 @@ (set! (-> *instance-shrub-work* wind-vectors) (-> tree info wind-vectors)) (set! (-> *instance-shrub-work* wait-to-spr) (the-as uint 0)) (set! (-> *instance-shrub-work* wait-from-spr) (the-as uint 0)) - (when (logtest? (vu1-renderer-mask rn15 rn16 rn17 rn18) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrubbery-vanish) (-> *display* vu1-enable-user)) (let* ((proto-array (-> tree info prototype-inline-array-shrub)) (proto-array-len (-> proto-array length)) (proto-array-data (-> proto-array data)) @@ -605,12 +1173,12 @@ ;; definition for method 13 of type drawable-tree-instance-shrub ;; WARN: Return type mismatch int vs none. (defmethod collect-stats drawable-tree-instance-shrub ((obj drawable-tree-instance-shrub)) - (when (logtest? (vu1-renderer-mask rn15 rn16 rn17 rn18) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrubbery shrub-near billboard shrubbery-vanish) (-> *display* vu1-enable-user)) (let* ((v1-4 (-> obj info prototype-inline-array-shrub)) (gp-0 (the-as object (-> v1-4 data))) ) (countdown (s5-0 (-> v1-4 length)) - (when (logtest? (vu1-renderer-mask rn16) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrub-near) (-> *display* vu1-enable-user)) (let ((v1-8 (-> (the-as prototype-bucket-shrub gp-0) count 0)) (a1-2 (-> (the-as prototype-bucket-shrub gp-0) geometry 0)) ) @@ -623,7 +1191,7 @@ ) ) ) - (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask rn15)) + (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask shrubbery)) (let ((s4-0 (-> (the-as prototype-bucket-shrub gp-0) count 1)) (v1-14 (-> (the-as prototype-bucket-shrub gp-0) geometry 1)) ) @@ -648,7 +1216,7 @@ ) ) ) - (when (logtest? (vu1-renderer-mask rn18) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask shrubbery-vanish) (-> *display* vu1-enable-user)) (let ((s4-1 (-> (the-as prototype-bucket-shrub gp-0) count 2)) (v1-32 (-> (the-as prototype-bucket-shrub gp-0) geometry 2)) ) @@ -673,7 +1241,7 @@ ) ) ) - (when (logtest? (vu1-renderer-mask rn17) (-> *display* vu1-enable-user)) + (when (logtest? (vu1-renderer-mask billboard) (-> *display* vu1-enable-user)) (let ((v1-50 (-> (the-as prototype-bucket-shrub gp-0) count 3))) (when (nonzero? v1-50) (+! (-> *terrain-stats* billboard groups) 1) diff --git a/test/decompiler/reference/jak2/engine/gfx/tfrag/tfrag-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/tfrag/tfrag-h_REF.gc index 6e8c20671f..066bc32e01 100644 --- a/test/decompiler/reference/jak2/engine/gfx/tfrag/tfrag-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/tfrag/tfrag-h_REF.gc @@ -90,6 +90,7 @@ (color-count uint8 :offset 57) (texture-masks-index uint16 :offset 58) (generic generic-tfragment :offset 60) + (generic-u32 uint32 :offset 60) ) :method-count-assert 17 :size-assert #x40 diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index f082d21715..5bba917d1f 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -153,6 +153,8 @@ "bsp-camera-asm", "build-masks", + "draw-prototype-inline-array-shrub", + "i-hopefully-will-never-exist-dont-add-anything-after-me-please" ],