diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index ca80d723f5..e783255d6c 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -750,8 +750,11 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, auto rd = env.dts->ts.reverse_field_lookup(rd_in); if (rd.success) { - auto arg1_matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::MULTIPLICATION), - {Matcher::any(0), Matcher::integer(rd_in.stride)}); + auto arg1_matcher = Matcher::match_or( + {Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::MULTIPLICATION), + {Matcher::any(0), Matcher::integer(rd_in.stride)}), + Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::MULTIPLICATION), + {Matcher::integer(rd_in.stride), Matcher::any(0)})}); auto match_result = match(arg1_matcher, args.at(1)); if (match_result.matched) { bool used_index = false; diff --git a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp index dd6b7d5100..0e267b0f86 100644 --- a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp +++ b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp @@ -622,7 +622,9 @@ std::string ObjectFileDB::ir2_to_file(ObjectFileData& data, const Config& config try { result += ir2_function_to_string(data, func, seg); } catch (std::exception& e) { - result += "Failed to write: "; + result += "Failed to write"; + result += func.guessed_name.to_string(); + result += ": "; result += e.what(); result += "\n"; } diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index f8aa873335..aee1c3dc46 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -4250,7 +4250,7 @@ ) (deftype adgif-shader (structure) - ((quad uint128 5 :offset 0) + ((quad qword 5 :inline :offset 0) (prims uint64 10 :offset 0) (tex0 uint64 :offset 0) (tex1 uint64 :offset 16) @@ -4371,6 +4371,8 @@ :flag-assert #x900000050 ) +(declare-type bsp-header basic) + (deftype level (basic) ((name basic :offset-assert 4) (load-name basic :offset-assert 8) @@ -4379,7 +4381,7 @@ (status basic :offset-assert 20) (other basic :offset-assert 24) (heap kheap :inline :offset-assert 32) - (bsp basic :offset-assert 48) + (bsp bsp-header :offset-assert 48) (art-group basic :offset-assert 52) (info basic :offset-assert 56) (texture-page texture-page 9 :offset-assert 60) @@ -5159,8 +5161,8 @@ (define-extern *shader-list* pair) ;; unknown type (define-extern *edit-shader* int) ;; unknown type (define-extern adgif-shader-update! function) -(define-extern adgif-shader-login function) -(define-extern adgif-shader-login-no-remap function) +(define-extern adgif-shader-login (function adgif-shader none)) +(define-extern adgif-shader-login-no-remap (function adgif-shader none)) (define-extern adgif-shader-login-fast function) (define-extern adgif-shader-login-no-remap-fast function) ;;;; unknown type @@ -5391,7 +5393,7 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) + (dummy-9 (_type_) _type_ 9) ;; probably login or init. (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -5410,7 +5412,6 @@ :size-assert #x24 :flag-assert #x1200000024 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -5456,7 +5457,6 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -5488,7 +5488,6 @@ :flag-assert #x1200000020 ;; field distance is a float printed as hex? (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -5563,7 +5562,6 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -5581,7 +5579,8 @@ ) (deftype drawable-inline-array-actor (drawable-inline-array) - ((paid uint8 36)) + ((data drawable-actor 1 :inline) + (pad uint8 4)) :flag-assert #x1200000044 ) @@ -5601,7 +5600,6 @@ :size-assert #x20 :flag-assert #x1300000020 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -5620,7 +5618,8 @@ ) (deftype drawable-inline-array-ambient (drawable-inline-array) - ((paid uint8 36)) + ((data drawable-ambient 1 :inline) + (pad uint8 4)) :flag-assert #x1200000044 ) @@ -7060,7 +7059,7 @@ ;; figured out manually from custom inspect. ((speed float :offset 20) (artist-base float :offset 24) - (artiest-step float :offset 28) + (artist-step float :offset 28) (master-art-group-name basic :offset 32) (master-art-group-index int32 :offset 36) (frames pointer :offset 44) @@ -8649,7 +8648,6 @@ :size-assert #x40 :flag-assert #x1200000040 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -10938,6 +10936,7 @@ (strip-data-len uint16 :offset-assert 12) (poly-count uint16 :offset-assert 14) (base-trans vector :inline :offset-assert 16) + ;; these go in the w of the vector above. (vertex-count uint8 :offset 28) (vertex-data-qwc uint8 :offset 29) (total-qwc uint8 :offset 30) @@ -10955,7 +10954,6 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) (dummy-11 () none 11) (dummy-12 () none 12) (dummy-13 () none 13) @@ -10973,7 +10971,6 @@ :size-assert #x44 :flag-assert #x1200000044 (:methods - (dummy-9 () none 9) (dummy-11 () none 11) (dummy-12 () none 12) (dummy-13 () none 13) @@ -10985,10 +10982,11 @@ (deftype drawable-tree-collide-fragment (drawable-tree) () - :flag-assert #x1200000024 + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 ) - ;; ---------------------- ;; File - projectiles-h ;; Source Path - engine/game/projectiles-h.gc @@ -11254,30 +11252,59 @@ :flag-assert #x900000020 ) -; (deftype bsp-header (drawable) -; ((all-visible-list pointer :offset-assert 32) -; (visible-list-length int32 :offset-assert 36) -; (drawable-trees basic :offset-assert 40) -; (pat uint32 :offset-assert 44) -; (pat-length int32 :offset-asert 48) -; ) -; :method-count-assert 20 -; :size-assert #x190 -; :flag-assert #x1400000190 -; (:methods -; (dummy-9 () none 9) -; (dummy-10 (_type_) int 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; ) -; ) + +(declare-type entity-camera basic) + +(deftype bsp-header (drawable) + ( + (info file-info :offset 4) + (all-visible-list (pointer uint16) :offset-assert 32) + (visible-list-length int32 :offset-assert 36) + (drawable-trees drawable-tree-array :offset-assert 40) + (pat pointer :offset-assert 44) + (pat-length int32 :offset-assert 48) + + ;; not sure what this is + (unk-data-0 pointer :offset-assert 52) + (unk-data-0-len int32 :offset-assert 56) + + (unk-data-1 pointer :offset-assert 60) + (unk-data-1-len int32 :offset-assert 64) + + (unk-zero-0 uint32 :offset-assert 68) + + (name symbol :offset-assert 72) + (nickname symbol :offset-assert 76) + (vis-info level-vis-info 8 :offset-assert 80) + (actors drawable-inline-array-actor :offset-assert 112) + (cameras (array entity-camera) :offset-assert 116) + (nodes (inline-array bsp-node) :offset-assert 120) + + (level level :offset-assert 124) + (unk-data-2 uint32 5 :offset-assert 128) + + (boxes box8s-array :offset-assert 148) + (unk-data-3 uint32 :offset-assert 152) + (ambients drawable-inline-array-ambient :offset-assert 156) + (unk-data-4 uint32 :offset-assert 160) + (unk-data-5 uint32 :offset-assert 164) + (adgifs adgif-shader-array :offset-assert 168) + (unk-data-6 pointer :offset-assert 172) + (unk-data-7 pointer :offset-assert 176) + (unk-data-8 uint32 55 :offset-assert 180) + + + ) + :method-count-assert 20 + :size-assert #x190 + :flag-assert #x1400000190 + (:methods + (relocate (_type_ int) _type_ 7) + (dummy-17 () none 17) + (dummy-18 () none 18) + (dummy-19 () none 19) + ) + ) (deftype game-level (basic) ((master-bsp basic :offset-assert 4) @@ -11313,25 +11340,26 @@ :flag-assert #x90000000c ) -; (deftype collide-stats (structure) -; ((other cl-stat :inline :offset-assert 0) -; (total cl-stat :inline :offset-assert 12) -; (nodes uint32 :offset-assert 24) -; (calls uint32 :offset-assert 28) -; (total-target stopwatch :inline :offset-assert 36) -; (target-cache-fill stopwatch :inline :offset-assert 68) -; (target-ray-poly stopwatch :inline :offset-assert 100) -; ) -; :method-count-assert 9 -; :size-assert #x80 -; :flag-assert #x900000080 -; ) +(deftype collide-stats (structure) + ((other cl-stat :inline :offset-assert 0) + (total cl-stat :inline :offset-assert 12) + (nodes uint32 :offset-assert 24) + (calls uint32 :offset-assert 28) + (total-target stopwatch :inline :offset-assert 32) + (target-cache-fill stopwatch :inline :offset-assert 64) + (target-ray-poly stopwatch :inline :offset-assert 96) + (pad uint32) ;; end with inline basic + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) -;; - Symbols +;; - Functions -(define-extern map-bsp-tree function) -(define-extern inspect-bsp-tree function) +(define-extern map-bsp-tree (function (function bsp-node none) bsp-header bsp-node none)) +(define-extern inspect-bsp-tree (function bsp-header bsp-node none)) ;; ---------------------- @@ -11511,9 +11539,9 @@ ;; Containing DGOs - ['GAME', 'ENGINE'] ;; Version - 3 -;; - Unknowns +;; - Symbols -;;(define-extern *collide-test-flag* object) ;; unknown type +(define-extern *collide-test-flag* symbol) ;; ---------------------- @@ -11531,7 +11559,6 @@ :size-assert #x70 :flag-assert #x1200000070 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -11543,27 +11570,27 @@ ) ) -; (deftype shrub-view-data (structure) -; ((data UNKNOWN 3 :offset-assert 0) -; (texture-giftag qword :inline :offset-assert 0) -; (consts vector :inline :offset-assert 16) -; (fog-clamp vector :inline :offset-assert 32) -; (tex-start-ptr int32 :offset-assert 16) -; (gifbufsum float :offset-assert 16) -; (mtx-buf-ptr int32 :offset-assert 20) -; (exp23 float :offset-assert 20) -; (fog-0 float :offset-assert 24) -; (fog-1 float :offset-assert 28) -; (fog-min float :offset-assert 32) -; (fog-max float :offset-assert 36) -; ) -; :method-count-assert 9 -; :size-assert #x30 -; :flag-assert #x900000030 -; ) +(deftype shrub-view-data (structure) + ((data uint128 3 :offset-assert 0) + (texture-giftag qword :inline :offset 0) + (consts vector :inline :offset 16) + (fog-clamp vector :inline :offset 32) + (tex-start-ptr int32 :offset 16) + (gifbufsum float :offset 16) + (mtx-buf-ptr int32 :offset 20) + (exp23 float :offset 20) + (fog-0 float :offset 24) + (fog-1 float :offset 28) + (fog-min float :offset 32) + (fog-max float :offset 36) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) (deftype shrubbery (drawable) - ((textures uint32 :offset 4) + ((textures (inline-array adgif-shader) :offset 4) (header qword :offset 8) (obj-qwc uint8 :offset 12) (vtx-qwc uint8 :offset 13) @@ -11578,7 +11605,6 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -11599,7 +11625,6 @@ :size-assert #x50 :flag-assert #x1200000050 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -11611,8 +11636,17 @@ ) ) +(deftype drawable-inline-array-instance-shrub (drawable-inline-array) + ((data instance-shrubbery 1 :inline :offset-assert 32) + (pad uint32) + ) + :method-count-assert #x12 + :size-assert #x74 + :flag-assert #x1200000074 + ) + (deftype generic-shrub-fragment (drawable) - ((textures uint32 :offset 4) + ((textures (inline-array adgif-shader) :offset 4) (vtx-cnt uint32 :offset 8) (cnt-qwc uint8 :offset 12) (vtx-qwc uint8 :offset 13) @@ -11627,7 +11661,7 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) + (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -11639,24 +11673,35 @@ ) ) -; (deftype prototype-shrubbery (drawable-inline-array) -; () -; :method-count-assert 18 -; :size-assert #x44 -; :flag-assert #x1200000044 -; ;; too many basic blocks -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype prototype-shrubbery (drawable-inline-array) + ((data generic-shrub-fragment 1 :inline :offset-assert 32) + (pad uint32) + ) + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +(deftype prototype-trans-shrubbery (prototype-shrubbery) + () + :method-count-assert #x12 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +(deftype prototype-generic-shrub (drawable-group) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-instance-shrub (drawable-tree) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) (deftype shrubbery-matrix (structure) ((mat matrix :inline :offset-assert 0) @@ -11667,114 +11712,110 @@ :flag-assert #x900000050 ) -; (deftype shrub-near-packet (structure) -; ((matrix-tmpl dma-packet :inline :offset-assert 0) -; (header-tmpl dma-packet :inline :offset-assert 16) -; (stq-tmpl dma-packet :inline :offset-assert 32) -; (color-tmpl dma-packet :inline :offset-assert 48) -; (vertex-tmpl dma-packet :inline :offset-assert 64) -; (mscal-tmpl dma-packet :inline :offset-assert 80) -; (init-tmpl dma-packet :inline :offset-assert 96) -; (init-data UNKNOWN 8 :offset-assert 112) -; ) -; :method-count-assert 9 -; :size-assert #x90 -; :flag-assert #x900000090 -; ) +(deftype shrub-near-packet (structure) + ((matrix-tmpl dma-packet :inline :offset-assert 0) + (header-tmpl dma-packet :inline :offset-assert 16) + (stq-tmpl dma-packet :inline :offset-assert 32) + (color-tmpl dma-packet :inline :offset-assert 48) + (vertex-tmpl dma-packet :inline :offset-assert 64) + (mscal-tmpl dma-packet :inline :offset-assert 80) + (init-tmpl dma-packet :inline :offset-assert 96) + (init-data uint32 8 :offset-assert 112) + ) + :method-count-assert 9 + :size-assert #x90 + :flag-assert #x900000090 + ) -; (deftype instance-shrub-work (structure) -; ((dummy UNKNOWN 3 :offset-assert 0) -; (chaina UNKNOWN 8 :offset-assert 48) -; (chainb UNKNOWN 8 :offset-assert 176) -; (colors UNKNOWN 1024 :offset-assert 304) -; (matrix-tmpl UNKNOWN 20 :offset-assert 4400) -; (count-tmpl UNKNOWN 20 :offset-assert 4720) -; (mscalf-tmpl dma-packet :inline :offset-assert 5040) -; (mscalf-ret-tmpl dma-packet :inline :offset-assert 5056) -; (adgif-tmpl dma-gif-packet :inline :offset-assert 5072) -; (billboard-tmpl dma-gif-packet :inline :offset-assert 5104) -; (billboard-const vector :inline :offset-assert 5136) -; (shrub-near-packets UNKNOWN 6 :offset-assert 5152) -; (dma-ref dma-packet :inline :offset-assert 6016) -; (dma-end dma-packet :inline :offset-assert 6032) -; (wind-const vector :inline :offset-assert 6048) -; (constants vector :inline :offset-assert 6064) -; (color-constant vector4w :inline :offset-assert 6080) -; (hmge-d vector :inline :offset-assert 6096) -; (hvdf-offset vector :inline :offset-assert 6112) -; (wind-force vector :inline :offset-assert 6128) -; (color vector :inline :offset-assert 6144) -; (bb-color vector :inline :offset-assert 6160) -; (min-dist vector :inline :offset-assert 6176) -; (temp-vec vector :inline :offset-assert 6192) -; (guard-plane UNKNOWN 4 :offset-assert 6208) -; (plane UNKNOWN 4 :offset-assert 6272) -; (last UNKNOWN 4 :offset-assert 6336) -; (next UNKNOWN 4 :offset-assert 6352) -; (count UNKNOWN 4 :offset-assert 6368) -; (mod-count UNKNOWN 4 :offset-assert 6376) -; (wind-vectors uint32 :offset-assert 6384) -; (instance-ptr uint32 :offset-assert 6388) -; (chain-ptr uint32 :offset-assert 6392) -; (chain-ptr-next uint32 :offset-assert 6396) -; (stack-ptr uint32 :offset-assert 6400) -; (bucket-ptr uint32 :offset-assert 6404) -; (src-ptr uint32 :offset-assert 6408) -; (to-spr uint32 :offset-assert 6412) -; (from-spr uint32 :offset-assert 6416) -; (shrub-count uint32 :offset-assert 6420) -; (stack-ptr uint32 :offset-assert 6400) -; (node UNKNOWN 6 :offset-assert 6428) -; (length UNKNOWN 6 :offset-assert 6452) -; (prototypes uint32 :offset-assert 6476) -; (bucket-ptr uint32 :offset-assert 6404) -; (start-bank UNKNOWN 20 :offset-assert 6484) -; (buffer-index uint32 :offset-assert 6504) -; (current-spr uint32 :offset-assert 6508) -; (current-mem uint32 :offset-assert 6512) -; (current-shrub-near-packet uint32 :offset-assert 6516) -; (to-spr uint32 :offset-assert 6412) -; (dma-buffer basic :offset-assert 6524) -; (near-last uint32 :offset-assert 6528) -; (near-next uint32 :offset-assert 6532) -; (near-count uint32 :offset-assert 6536) -; (last-shrubs uint32 :offset-assert 6540) -; (chains uint32 :offset-assert 6544) -; (flags uint32 :offset-assert 6548) -; (paused basic :offset-assert 6552) -; (node-count uint32 :offset-assert 6556) -; (inst-count uint32 :offset-assert 6560) -; (wait-from-spr uint32 :offset-assert 6564) -; (wait-to-spr uint32 :offset-assert 6568) -; ) -; :method-count-assert 9 -; :size-assert #x19ac -; :flag-assert #x9000019ac -; ) +(deftype instance-shrub-work (structure) + ((dummy uint128 3 :offset-assert 0) + (chaina uint128 8 :offset-assert 48) + (chainb uint128 8 :offset-assert 176) + (colors rgba 1024 :offset-assert 304) + (matrix-tmpl uint128 20 :offset-assert 4400) + (count-tmpl uint128 20 :offset-assert 4720) + (mscalf-tmpl dma-packet :inline :offset-assert 5040) + (mscalf-ret-tmpl dma-packet :inline :offset-assert 5056) + (adgif-tmpl dma-gif-packet :inline :offset-assert 5072) + (billboard-tmpl dma-gif-packet :inline :offset-assert 5104) + (billboard-const vector :inline :offset-assert 5136) + (shrub-near-packets shrub-near-packet 6 :inline :offset-assert 5152) + (dma-ref dma-packet :inline :offset-assert 6016) + (dma-end dma-packet :inline :offset-assert 6032) + (wind-const vector :inline :offset-assert 6048) + (constants vector :inline :offset-assert 6064) + (color-constant vector4w :inline :offset-assert 6080) + (hmge-d vector :inline :offset-assert 6096) + (hvdf-offset vector :inline :offset-assert 6112) + (wind-force vector :inline :offset-assert 6128) + (color vector :inline :offset-assert 6144) + (bb-color vector :inline :offset-assert 6160) + (min-dist vector :inline :offset-assert 6176) + (temp-vec vector :inline :offset-assert 6192) + (guard-plane plane 4 :inline :offset-assert 6208) + (plane plane 4 :inline :offset-assert 6272) + (last uint32 4 :offset-assert 6336) + (next uint32 4 :offset-assert 6352) + (count uint16 4 :offset-assert 6368) + (mod-count uint16 4 :offset-assert 6376) + (wind-vectors uint32 :offset-assert 6384) + (instance-ptr uint32 :offset-assert 6388) + (chain-ptr uint32 :offset-assert 6392) + (chain-ptr-next uint32 :offset-assert 6396) + (stack-ptr uint32 :offset-assert 6400) + (bucket-ptr uint32 :offset-assert 6404) + (src-ptr uint32 :offset-assert 6408) + (to-spr uint32 :offset-assert 6412) + (from-spr uint32 :offset-assert 6416) + (shrub-count uint32 :offset-assert 6420) + ;;(stack-ptr uint32 :offset-assert 6400) ;; this field appears twice? + (node uint32 6 :offset 6428) + (length uint32 6 :offset-assert 6452) + (prototypes uint32 :offset-assert 6476) + ;;(bucket-ptr uint32 :offset-assert 6404) appears twice + + (start-bank uint8 20 :offset 6484) + (buffer-index uint32 :offset-assert 6504) + (current-spr uint32 :offset-assert 6508) + (current-mem uint32 :offset-assert 6512) + (current-shrub-near-packet uint32 :offset-assert 6516) + ;;(to-spr uint32 :offset-assert 6412) + (dma-buffer basic :offset 6524) + (near-last uint32 :offset-assert 6528) + (near-next uint32 :offset-assert 6532) + (near-count uint32 :offset-assert 6536) + (last-shrubs uint32 :offset-assert 6540) + (chains uint32 :offset-assert 6544) + (flags uint32 :offset-assert 6548) + (paused basic :offset-assert 6552) + (node-count uint32 :offset-assert 6556) + (inst-count uint32 :offset-assert 6560) + (wait-from-spr uint32 :offset-assert 6564) + (wait-to-spr uint32 :offset-assert 6568) + ) + :method-count-assert 9 + :size-assert #x19ac + :flag-assert #x9000019ac + ) -; (deftype instance-shrub-dma (structure) -; ((instancea UNKNOWN 325 :offset-assert 0) -; (instanceb UNKNOWN 325 :offset-assert 5200) -; (outa UNKNOWN 128 :offset-assert 10400) -; (outb UNKNOWN 128 :offset-assert 12448) -; ) -; :method-count-assert 9 -; :size-assert #x38a0 -; :flag-assert #x9000038a0 -; ) +(deftype instance-shrub-dma (structure) + ((instancea uint128 325 :offset-assert 0) + (instanceb uint128 325 :offset-assert 5200) + (outa uint128 128 :offset-assert 10400) + (outb uint128 128 :offset-assert 12448) + ) + :method-count-assert 9 + :size-assert #x38a0 + :flag-assert #x9000038a0 + ) +;; - Functions + +(define-extern shrubbery-login-post-texture (function shrubbery none)) ;; - Symbols -(define-extern shrubbery-login-post-texture function) -(define-extern drawable-inline-array-instance-shrub type) -(define-extern drawable-tree-instance-shrub type) -(define-extern prototype-trans-shrubbery type) -(define-extern prototype-generic-shrub type) - -;; - Unknowns - -;;(define-extern *shrub-state* object) ;; unknown type +(define-extern *shrub-state* int) ;; ---------------------- @@ -11785,245 +11826,225 @@ ;; - Types -; (deftype tie-fragment (drawable) -; ((id int16 :offset-assert 4) -; (bsphere vector :inline :offset-assert 16) -; (gif-ref uint32 :offset-assert 4) -; (point-ref uint32 :offset-assert 8) -; (color-index uint16 :offset-assert 12) -; (base-colors uint8 :offset-assert 14) -; (tex-count uint16 :offset-assert 32) -; (gif-count uint16 :offset-assert 34) -; (vertex-count uint16 :offset-assert 36) -; (color-count uint16 :offset-assert 38) -; (num-tris uint16 :offset-assert 40) -; (num-dverts uint16 :offset-assert 42) -; (dp-ref uint32 :offset-assert 44) -; (dp-qwc uint32 :offset-assert 48) -; (generic-ref uint32 :offset-assert 52) -; (generic-count uint32 :offset-assert 56) -; (debug-lines basic :offset-assert 60) -; ) -; :method-count-assert 18 -; :size-assert #x40 -; :flag-assert #x1200000040 -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype tie-fragment (drawable) + ((gif-ref uint32 :offset 4) + (point-ref uint32 :offset 8) + (color-index uint16 :offset 12) + (base-colors uint8 :offset 14) + (tex-count uint16 :offset-assert 32) + (gif-count uint16 :offset-assert 34) + (vertex-count uint16 :offset-assert 36) + (color-count uint16 :offset-assert 38) + (num-tris uint16 :offset-assert 40) + (num-dverts uint16 :offset-assert 42) + (dp-ref uint32 :offset-assert 44) + (dp-qwc uint32 :offset-assert 48) + (generic-ref uint32 :offset-assert 52) + (generic-count uint32 :offset-assert 56) + (debug-lines basic :offset-assert 60) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + (:methods + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-17 () none 17) + ) + ) -; (deftype instance-tie (instance) -; ((id int16 :offset-assert 4) -; (bsphere vector :inline :offset-assert 16) -; (bucket-index uint16 :offset-assert 6) -; (origin matrix4h :inline :offset-assert 32) -; (wind-index uint16 :offset-assert 62) -; (color-indices uint32 :offset-assert 8) -; (bucket-ptr basic :offset-assert 12) -; (max-scale uint16 :offset-assert 38) -; (flags uint16 :offset-assert 46) -; ) -; :method-count-assert 18 -; :size-assert #x40 -; :flag-assert #x1200000040 -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype instance-tie (instance) + ((color-indices uint32 :offset 8) + (bucket-ptr basic :offset 12) + (max-scale uint16 :offset 38) + (flags uint16 :offset 46) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + (:methods + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-17 () none 17) + ) + ) -; (deftype drawable-inline-array-instance-tie (drawable-inline-array) -; () -; :method-count-assert 18 -; :size-assert #x64 -; :flag-assert #x1200000064 -; ;; too many basic blocks -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype drawable-inline-array-instance-tie (drawable-inline-array) + ((data instance-tie 1 :inline :offset-assert 32) ;; not sure on type here + (pad uint32) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + (:methods + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-17 () none 17) + ) + ) -; (deftype drawable-tree-instance-tie (drawable-tree) -; ((id int16 :offset-assert 4) -; (bsphere vector :inline :offset-assert 16) -; (length int16 :offset-assert 6) -; (data UNKNOWN 1 :offset-assert 32) -; (prototypes basic :offset-assert 8) -; ) -; :method-count-assert 18 -; :size-assert #x24 -; :flag-assert #x1200000024 -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype drawable-tree-instance-tie (drawable-tree) + ((length int16 :offset 6) + (prototypes basic :offset 8) + ) + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + (:methods + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-17 () none 17) + ) + ) -; (deftype prototype-tie (drawable-inline-array) -; () -; :method-count-assert 18 -; :size-assert #x64 -; :flag-assert #x1200000064 -; ;; too many basic blocks -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype prototype-tie (drawable-inline-array) + ((data instance-tie 1 :inline :offset-assert 32) ;; not sure on type here + (pad uint32) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + (:methods + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-17 () none 17) + ) + ) -; (deftype tie-matrix (structure) -; ((mat matrix :inline :offset-assert 0) -; (morph qword :inline :offset-assert 64) -; (fog qword :inline :offset-assert 80) -; ) -; :method-count-assert 9 -; :size-assert #x60 -; :flag-assert #x900000060 -; ) +(deftype tie-matrix (structure) + ((mat matrix :inline :offset-assert 0) + (morph qword :inline :offset-assert 64) + (fog qword :inline :offset-assert 80) + ) + :method-count-assert 9 + :size-assert #x60 + :flag-assert #x900000060 + ) -; (deftype instance-tie-work (structure) -; ((wind-const vector :inline :offset-assert 0) -; (hmge-d vector :inline :offset-assert 16) -; (hvdf-offset vector :inline :offset-assert 32) -; (wind-force vector :inline :offset-assert 48) -; (constant vector :inline :offset-assert 64) -; (far-morph vector :inline :offset-assert 80) -; (dist-test vector :inline :offset-assert 96) -; (min-dist vector :inline :offset-assert 112) -; (guard-plane UNKNOWN 4 :offset-assert 128) -; (upload-color-0 dma-packet :inline :offset-assert 192) -; (upload-color-1 dma-packet :inline :offset-assert 208) -; (upload-color-2 dma-packet :inline :offset-assert 224) -; (upload-color-ret dma-packet :inline :offset-assert 240) -; (upload-color-temp dma-packet :inline :offset-assert 256) -; (generic-color-0 dma-packet :inline :offset-assert 272) -; (generic-color-1 dma-packet :inline :offset-assert 288) -; (generic-color-end dma-packet :inline :offset-assert 304) -; (tie-near-perspective-matrix matrix :inline :offset-assert 320) -; (wind-vectors uint32 :offset-assert 384) -; (test-id uint32 :offset-assert 388) -; (test-id2 uint32 :offset-assert 392) -; (dma-buffer basic :offset-assert 396) -; (to-spr uint32 :offset-assert 400) -; (from-spr uint32 :offset-assert 404) -; (wind-work uint32 :offset-assert 408) -; (cur-vis-bits uint32 :offset-assert 412) -; (end-vis-bits uint32 :offset-assert 416) -; (first-generic-prototype uint32 :offset-assert 420) -; (refl-fade-fac float :offset-assert 424) -; (refl-fade-end float :offset-assert 428) -; (flags uint32 :offset-assert 432) -; (paused basic :offset-assert 436) -; (wait-from-spr uint32 :offset-assert 440) -; (wait-to-spr uint32 :offset-assert 444) -; ) -; :method-count-assert 9 -; :size-assert #x1c0 -; :flag-assert #x9000001c0 -; ) +(deftype instance-tie-work (structure) + ((wind-const vector :inline :offset-assert 0) + (hmge-d vector :inline :offset-assert 16) + (hvdf-offset vector :inline :offset-assert 32) + (wind-force vector :inline :offset-assert 48) + (constant vector :inline :offset-assert 64) + (far-morph vector :inline :offset-assert 80) + (dist-test vector :inline :offset-assert 96) + (min-dist vector :inline :offset-assert 112) + (guard-plane plane 4 :inline :offset-assert 128) + (upload-color-0 dma-packet :inline :offset-assert 192) + (upload-color-1 dma-packet :inline :offset-assert 208) + (upload-color-2 dma-packet :inline :offset-assert 224) + (upload-color-ret dma-packet :inline :offset-assert 240) + (upload-color-temp dma-packet :inline :offset-assert 256) + (generic-color-0 dma-packet :inline :offset-assert 272) + (generic-color-1 dma-packet :inline :offset-assert 288) + (generic-color-end dma-packet :inline :offset-assert 304) + (tie-near-perspective-matrix matrix :inline :offset-assert 320) + (wind-vectors uint32 :offset-assert 384) + (test-id uint32 :offset-assert 388) + (test-id2 uint32 :offset-assert 392) + (dma-buffer basic :offset-assert 396) + (to-spr uint32 :offset-assert 400) + (from-spr uint32 :offset-assert 404) + (wind-work uint32 :offset-assert 408) + (cur-vis-bits uint32 :offset-assert 412) + (end-vis-bits uint32 :offset-assert 416) + (first-generic-prototype uint32 :offset-assert 420) + (refl-fade-fac float :offset-assert 424) + (refl-fade-end float :offset-assert 428) + (flags uint32 :offset-assert 432) + (paused basic :offset-assert 436) + (wait-from-spr uint32 :offset-assert 440) + (wait-to-spr uint32 :offset-assert 444) + ) + :method-count-assert 9 + :size-assert #x1c0 + :flag-assert #x9000001c0 + ) -; (deftype instance-tie-dma (structure) -; ((banka UNKNOWN 32 :offset-assert 4) -; (bankb UNKNOWN 32 :offset-assert 2052) -; (outa UNKNOWN 256 :offset-assert 4096) -; (outb UNKNOWN 256 :offset-assert 8192) -; (work instance-tie-work :offset-assert 12288) -; ) -; :method-count-assert 9 -; :size-assert #x3000 -; :flag-assert #x900003000 -; ) +(deftype instance-tie-dma (structure) + ((banka instance-tie 32 :inline :offset-assert 0) + (bankb instance-tie 32 :inline :offset-assert 2048) + (outa uint128 256 :offset-assert 4096) + (outb uint128 256 :offset-assert 8192) + ;; this is outside the type???? + (work instance-tie-work :dynamic :offset-assert 12288) + ) + :method-count-assert 9 + :size-assert #x3000 + :flag-assert #x900003000 + ) -; (deftype prototype-tie-work (structure) -; ((upload-palette-0 dma-packet :inline :offset-assert 0) -; (upload-palette-1 dma-packet :inline :offset-assert 16) -; (upload-model-0 dma-packet :inline :offset-assert 32) -; (upload-model-1 dma-packet :inline :offset-assert 48) -; (upload-model-2 dma-packet :inline :offset-assert 64) -; (upload-model-3 dma-packet :inline :offset-assert 80) -; (upload-model-near-0 dma-packet :inline :offset-assert 96) -; (upload-model-near-1 dma-packet :inline :offset-assert 112) -; (upload-model-near-2 dma-packet :inline :offset-assert 128) -; (upload-model-near-3 dma-packet :inline :offset-assert 144) -; (upload-model-near-4 dma-packet :inline :offset-assert 160) -; (generic-envmap-shader dma-packet :inline :offset-assert 176) -; (generic-palette dma-packet :inline :offset-assert 192) -; (generic-model-0 dma-packet :inline :offset-assert 208) -; (generic-model-1 dma-packet :inline :offset-assert 224) -; (generic-model-2 dma-packet :inline :offset-assert 240) -; (generic-model-next dma-packet :inline :offset-assert 256) -; (clamp uint64 :offset-assert 272) -; (prototype-array basic :offset-assert 280) -; (generic-wait-from-spr uint32 :offset-assert 284) -; (generic-wait-to-spr uint32 :offset-assert 288) -; (wait-from-spr uint32 :offset-assert 292) -; (wait-to-spr uint32 :offset-assert 296) -; (near-wait-from-spr uint32 :offset-assert 300) -; (near-wait-to-spr uint32 :offset-assert 304) -; ) -; :method-count-assert 9 -; :size-assert #x134 -; :flag-assert #x900000134 -; ) +(deftype prototype-tie-work (structure) + ((upload-palette-0 dma-packet :inline :offset-assert 0) + (upload-palette-1 dma-packet :inline :offset-assert 16) + (upload-model-0 dma-packet :inline :offset-assert 32) + (upload-model-1 dma-packet :inline :offset-assert 48) + (upload-model-2 dma-packet :inline :offset-assert 64) + (upload-model-3 dma-packet :inline :offset-assert 80) + (upload-model-near-0 dma-packet :inline :offset-assert 96) + (upload-model-near-1 dma-packet :inline :offset-assert 112) + (upload-model-near-2 dma-packet :inline :offset-assert 128) + (upload-model-near-3 dma-packet :inline :offset-assert 144) + (upload-model-near-4 dma-packet :inline :offset-assert 160) + (generic-envmap-shader dma-packet :inline :offset-assert 176) + (generic-palette dma-packet :inline :offset-assert 192) + (generic-model-0 dma-packet :inline :offset-assert 208) + (generic-model-1 dma-packet :inline :offset-assert 224) + (generic-model-2 dma-packet :inline :offset-assert 240) + (generic-model-next dma-packet :inline :offset-assert 256) + (clamp uint64 :offset-assert 272) + (prototype-array basic :offset-assert 280) + (generic-wait-from-spr uint32 :offset-assert 284) + (generic-wait-to-spr uint32 :offset-assert 288) + (wait-from-spr uint32 :offset-assert 292) + (wait-to-spr uint32 :offset-assert 296) + (near-wait-from-spr uint32 :offset-assert 300) + (near-wait-to-spr uint32 :offset-assert 304) + ) + :method-count-assert 9 + :size-assert #x134 + :flag-assert #x900000134 + ) -; (deftype prototype-tie-dma (structure) -; ((colora UNKNOWN 256 :offset-assert 0) -; (colorb UNKNOWN 256 :offset-assert 1024) -; (outa UNKNOWN 256 :offset-assert 2048) -; (outb UNKNOWN 256 :offset-assert 6144) -; (length uint32 :offset-assert 10240) -; (dma-buffer basic :offset-assert 10244) -; (this-frag-count uint32 :offset-assert 10248) -; (next UNKNOWN 4 :offset-assert 10256) -; (geometry UNKNOWN 4 :offset-assert 10272) -; (frag-count UNKNOWN 4 :offset-assert 10288) -; ) -; :method-count-assert 9 -; :size-assert #x2834 -; :flag-assert #x900002834 -; ) +(deftype prototype-tie-dma (structure) + ((colora rgba 256 :offset-assert 0) + (colorb rgba 256 :offset-assert 1024) + (outa uint128 256 :offset-assert 2048) + (outb uint128 256 :offset-assert 6144) + (length uint32 :offset-assert 10240) + (dma-buffer basic :offset-assert 10244) + (this-frag-count uint32 :offset-assert 10248) + + (next uint32 4 :offset 10256) + + (geometry uint32 4 :offset-assert 10272) + (frag-count uint8 4 :offset-assert 10288) + ) + :method-count-assert 9 + :size-assert #x2834 + :flag-assert #x900002834 + ) -;; - Unknowns +;; - Symbols -;;(define-extern *instance-tie-work-copy* object) ;; unknown type +(define-extern *instance-tie-work-copy* basic) ;; ---------------------- @@ -12034,123 +12055,167 @@ ;; - Types -; (deftype tfragment-stats (structure) -; ((num-tris UNKNOWN 4 :offset-assert 0) -; (num-dverts UNKNOWN 4 :offset-assert 8) -; ) -; :method-count-assert 9 -; :size-assert #x10 -; :flag-assert #x900000010 -; ) +(deftype tfragment-stats (structure) + ((num-tris uint16 4 :offset-assert 0) + (num-dverts uint16 4 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) -; (deftype tfragment-debug-data (structure) -; ((stats tfragment-stats :inline :offset-assert 0) -; (debug-lines basic :offset-assert 16) -; ) -; :method-count-assert 9 -; :size-assert #x14 -; :flag-assert #x900000014 -; ) +(deftype tfragment-debug-data (structure) + ((stats tfragment-stats :inline :offset-assert 0) + (debug-lines basic :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) -; (deftype generic-tfragment (structure) -; ((dummy int32 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x4 -; :flag-assert #x900000004 -; ) +(deftype generic-tfragment (structure) + ((dummy int32 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) -; (deftype tfragment (drawable) -; ((id int16 :offset-assert 4) -; (bsphere vector :inline :offset-assert 16) -; (color-index uint16 :offset-assert 6) -; (debug-data tfragment-debug-data :offset-assert 8) -; (color-indices uint32 :offset-assert 12) -; (colors uint32 :offset-assert 12) -; (dma-chain UNKNOWN 3 :offset-assert 32) -; (dma-common uint32 :offset-assert 32) -; (dma-level-0 uint32 :offset-assert 32) -; (dma-base uint32 :offset-assert 36) -; (dma-level-1 uint32 :offset-assert 40) -; (dma-qwc UNKNOWN 4 :offset-assert 44) -; (shader uint32 :offset-assert 48) -; (num-shaders uint8 :offset-assert 52) -; (num-base-colors uint8 :offset-assert 53) -; (num-level0-colors uint8 :offset-assert 54) -; (num-level1-colors uint8 :offset-assert 55) -; (color-offset uint8 :offset-assert 56) -; (color-count uint8 :offset-assert 57) -; (pad0 uint8 :offset-assert 58) -; (pad1 uint8 :offset-assert 59) -; (generic generic-tfragment :offset-assert 60) -; ) -; :method-count-assert 18 -; :size-assert #x40 -; :flag-assert #x1200000040 -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype tfragment (drawable) + ( + (color-index uint16 :offset 6) + (debug-data tfragment-debug-data :offset 8) + (color-indices uint32 :offset 12) + (colors uint32 :offset 12) + (dma-chain uint32 3 :offset-assert 32) + (dma-common uint32 :offset 32) + (dma-level-0 uint32 :offset 32) + (dma-base uint32 :offset 36) + (dma-level-1 uint32 :offset 40) + (dma-qwc uint32 4 :offset-assert 44) + (shader uint32 :offset 48) + (num-shaders uint8 :offset 52) + (num-base-colors uint8 :offset 53) + (num-level0-colors uint8 :offset 54) + (num-level1-colors uint8 :offset 55) + (color-offset uint8 :offset 56) + (color-count uint8 :offset 57) + (pad0 uint8 :offset 58) + (pad1 uint8 :offset 59) + (generic generic-tfragment :offset-assert 60) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + (:methods + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-17 () none 17) + ) + ) -; (deftype drawable-inline-array-tfrag (drawable-inline-array) -; () -; :method-count-assert 18 -; :size-assert #x64 -; :flag-assert #x1200000064 -; ;; too many basic blocks -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; ) -; ) +(deftype drawable-inline-array-tfrag (drawable-inline-array) + ((data tfragment 1 :inline :offset-assert 32) + (pad uint32)) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + (:methods + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-17 () none 17) + ) + ) -; (deftype tfrag-dists (structure) -; ((data UNKNOWN 16 :offset-assert 0) -; (vector UNKNOWN 4 :offset-assert 0) -; (k0s UNKNOWN 2 :offset-assert 0) -; (k1s UNKNOWN 2 :offset-assert 32) -; ) -; :method-count-assert 9 -; :size-assert #x40 -; :flag-assert #x900000040 -; ) +(deftype drawable-inline-array-trans-tfrag (drawable-inline-array-tfrag) + ;; I think this is a bug. + ((data2 tfragment 1 :inline :offset-assert 112) + (pad2 uint32)) + :method-count-assert #x12 + :size-assert #xb4 + :flag-assert #x12000000b4 + ) -; (deftype tfrag-data (structure) -; ((data UNKNOWN 56 :offset-assert 0) -; (vector UNKNOWN 14 :offset-assert 0) -; (fog vector :inline :offset-assert 0) -; (val vector :inline :offset-assert 16) -; (strgif qword :inline :offset-assert 32) -; (fangif qword :inline :offset-assert 48) -; (adgif qword :inline :offset-assert 64) -; (hvdf-offset vector :inline :offset-assert 80) -; (hmge-scale vector :inline :offset-assert 96) -; (invh-scale vector :inline :offset-assert 112) -; (ambient vector :inline :offset-assert 128) -; (guard vector :inline :offset-assert 144) -; (dists tfrag-dists :inline :offset-assert 160) -; (k0s UNKNOWN 2 :offset-assert 160) -; (k1s UNKNOWN 2 :offset-assert 192) -; ) -; :method-count-assert 9 -; :size-assert #xe0 -; :flag-assert #x9000000e0 -; ) +(deftype drawable-tree-tfrag (drawable-tree) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-trans-tfrag (drawable-tree-tfrag) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-dirt-tfrag (drawable-tree-tfrag) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-ice-tfrag (drawable-tree-tfrag) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-lowres-tfrag (drawable-tree-tfrag) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-lowres-trans-tfrag (drawable-tree-trans-tfrag) + () + :method-count-assert #x12 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype tfrag-dists (structure) + ((data uint32 16 :offset-assert 0) + (vector vector 4 :inline :offset 0) + (k0s uint128 2 :offset 0) + (k1s uint128 2 :offset 32) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +(deftype tfrag-data (structure) + ((data uint32 56 :offset 0) + (vector vector 14 :inline :offset 0) + (fog vector :inline :offset 0) + (val vector :inline :offset 16) + (strgif qword :inline :offset 32) + (fangif qword :inline :offset 48) + (adgif qword :inline :offset 64) + (hvdf-offset vector :inline :offset 80) + (hmge-scale vector :inline :offset 96) + (invh-scale vector :inline :offset 112) + (ambient vector :inline :offset 128) + (guard vector :inline :offset 144) + (dists tfrag-dists :inline :offset 160) + (k0s uint128 2 :offset 160) + (k1s uint128 2 :offset 192) + ) + :method-count-assert 9 + :size-assert #xe0 + :flag-assert #x9000000e0 + ) (deftype tfrag-control (structure) ((num-base-points uint32 :offset-assert 0) @@ -12202,13 +12267,13 @@ :flag-assert #x900000040 ) -; (deftype tfrag-packet (structure) -; ((tag UNKNOWN 2 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x20 -; :flag-assert #x900000020 -; ) +(deftype tfrag-packet (structure) + ((tag uint128 2 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) (deftype tfrag-work (structure) ((base-tmpl dma-packet :inline :offset-assert 0) @@ -12240,31 +12305,17 @@ :flag-assert #x9000000c8 ) -; (deftype tfrag-dma (structure) -; ((banka UNKNOWN 16 :offset-assert 4) -; (bankb UNKNOWN 16 :offset-assert 1028) -; (outa UNKNOWN 128 :offset-assert 2048) -; (outb UNKNOWN 128 :offset-assert 4096) -; (colors UNKNOWN 2048 :offset-assert 6144) -; ) -; :method-count-assert 9 -; :size-assert #x37fc -; :flag-assert #x9000037fc -; ) - - -;; - Symbols - -(define-extern drawable-inline-array-trans-tfrag type) -(define-extern drawable-tree-tfrag type) -(define-extern drawable-tree-trans-tfrag type) -(define-extern drawable-tree-dirt-tfrag type) -(define-extern drawable-tree-ice-tfrag type) -(define-extern drawable-tree-lowres-tfrag type) - -;; - Unknowns - -;;(define-extern drawable-tree-lowres-trans-tfrag object) ;; unknown type +(deftype tfrag-dma (structure) + ((banka tfragment 16 :inline :offset-assert 0) + (bankb tfragment 16 :inline :offset-assert 1024) + (outa uint128 128 :offset-assert 2048) + (outb uint128 128 :offset-assert 4096) + (colors rgba 2047 :offset-assert 6144) ;; why is this one short!!! + ) + :method-count-assert 9 + :size-assert #x37fc + :flag-assert #x9000037fc + ) ;; ---------------------- @@ -12275,38 +12326,38 @@ ;; - Types -; (deftype background-work (basic) -; ((tfrag-tree-count int32 :offset-assert 4) -; (tfrag-trees UNKNOWN 8 :offset-assert 8) -; (tfrag-levels UNKNOWN 8 :offset-assert 40) -; (trans-tfrag-tree-count int32 :offset-assert 72) -; (trans-tfrag-trees UNKNOWN 8 :offset-assert 76) -; (trans-tfrag-levels UNKNOWN 8 :offset-assert 108) -; (dirt-tfrag-tree-count int32 :offset-assert 140) -; (dirt-tfrag-trees UNKNOWN 8 :offset-assert 144) -; (dirt-tfrag-levels UNKNOWN 8 :offset-assert 176) -; (ice-tfrag-tree-count int32 :offset-assert 208) -; (ice-tfrag-trees UNKNOWN 8 :offset-assert 212) -; (ice-tfrag-levels UNKNOWN 8 :offset-assert 244) -; (lowres-tfrag-tree-count int32 :offset-assert 276) -; (lowres-tfrag-trees UNKNOWN 8 :offset-assert 280) -; (lowres-tfrag-levels UNKNOWN 8 :offset-assert 312) -; (lowres-trans-tfrag-tree-count int32 :offset-assert 344) -; (lowres-trans-tfrag-trees UNKNOWN 8 :offset-assert 348) -; (lowres-trans-tfrag-levels UNKNOWN 8 :offset-assert 380) -; (shrub-tree-count int32 :offset-assert 412) -; (shrub-trees UNKNOWN 8 :offset-assert 416) -; (shrub-levels UNKNOWN 8 :offset-assert 448) -; (tie-tree-count int32 :offset-assert 480) -; (tie-trees UNKNOWN 8 :offset-assert 484) -; (tie-levels UNKNOWN 8 :offset-assert 516) -; (tie-generic UNKNOWN 8 :offset-assert 548) -; (wait-to-vu0 uint32 :offset-assert 580) -; ) -; :method-count-assert 9 -; :size-assert #x248 -; :flag-assert #x900000248 -; ) +(deftype background-work (basic) + ((tfrag-tree-count int32 :offset-assert 4) + (tfrag-trees drawable-tree-tfrag 8 :offset-assert 8) + (tfrag-levels level 8 :offset-assert 40) + (trans-tfrag-tree-count int32 :offset-assert 72) + (trans-tfrag-trees drawable-tree-trans-tfrag 8 :offset-assert 76) + (trans-tfrag-levels level 8 :offset-assert 108) + (dirt-tfrag-tree-count int32 :offset-assert 140) + (dirt-tfrag-trees drawable-tree-dirt-tfrag 8 :offset-assert 144) + (dirt-tfrag-levels level 8 :offset-assert 176) + (ice-tfrag-tree-count int32 :offset-assert 208) + (ice-tfrag-trees drawable-tree-ice-tfrag 8 :offset-assert 212) + (ice-tfrag-levels level 8 :offset-assert 244) + (lowres-tfrag-tree-count int32 :offset-assert 276) + (lowres-tfrag-trees drawable-tree-lowres-tfrag 8 :offset-assert 280) + (lowres-tfrag-levels level 8 :offset-assert 312) + (lowres-trans-tfrag-tree-count int32 :offset-assert 344) + (lowres-trans-tfrag-trees drawable-tree-trans-tfrag 8 :offset-assert 348) + (lowres-trans-tfrag-levels level 8 :offset-assert 380) + (shrub-tree-count int32 :offset-assert 412) + (shrub-trees drawable-tree-instance-shrub 8 :offset-assert 416) + (shrub-levels level 8 :offset-assert 448) + (tie-tree-count int32 :offset-assert 480) + (tie-trees drawable-tree-instance-tie 8 :offset-assert 484) + (tie-levels level 8 :offset-assert 516) + (tie-generic basic 8 :offset-assert 548) + (wait-to-vu0 uint32 :offset-assert 580) + ) + :method-count-assert 9 + :size-assert #x248 + :flag-assert #x900000248 + ) @@ -12318,82 +12369,86 @@ ;; - Types -; (deftype subdivide-settings (basic) -; ((dist UNKNOWN 5 :offset-assert 4) -; (meters UNKNOWN 5 :offset-assert 24) -; (close UNKNOWN 4 :offset-assert 44) -; (far UNKNOWN 4 :offset-assert 60) -; ) -; :method-count-assert 9 -; :size-assert #x4c -; :flag-assert #x90000004c -; ) +(deftype subdivide-settings (basic) + ;; guess on these being floats + ((dist float 5 :offset-assert 4) + (meters float 5 :offset-assert 24) + (close float 4 :offset-assert 44) + (far float 4 :offset-assert 60) + ) + (:methods + (new (symbol type float float) _type_) + ) + :method-count-assert 9 + :size-assert #x4c + :flag-assert #x90000004c + ) -; (deftype subdivide-dists (structure) -; ((data UNKNOWN 32 :offset-assert 0) -; (vector UNKNOWN 8 :offset-assert 0) -; (k0s UNKNOWN 4 :offset-assert 0) -; (k1s UNKNOWN 4 :offset-assert 64) -; ) -; :method-count-assert 9 -; :size-assert #x80 -; :flag-assert #x900000080 -; ) +(deftype subdivide-dists (structure) + ((data uint32 32 :offset 0) + (vector vector 8 :inline :offset 0) + (k0s uint128 4 :offset 0) + (k1s uint128 4 :offset 64) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) -; (deftype gs-packed-rgba (structure) -; ((data UNKNOWN 4 :offset-assert 0) -; (red int32 :offset-assert 0) -; (green int32 :offset-assert 4) -; (blue int32 :offset-assert 8) -; (alpha int32 :offset-assert 12) -; ) -; :method-count-assert 9 -; :size-assert #x10 -; :flag-assert #x900000010 -; ) +(deftype gs-packed-rgba (structure) + ((data int32 4 :offset-assert 0) + (red int32 :offset 0) + (green int32 :offset 4) + (blue int32 :offset 8) + (alpha int32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) -; (deftype gs-packed-xyzw (structure) -; ((data UNKNOWN 4 :offset-assert 0) -; (x int32 :offset-assert 0) -; (y int32 :offset-assert 4) -; (z int32 :offset-assert 8) -; (w int32 :offset-assert 12) -; (quad uint128 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x10 -; :flag-assert #x900000010 -; ) +(deftype gs-packed-xyzw (structure) + ((data int32 4 :offset-assert 0) + (x int32 :offset 0) + (y int32 :offset 4) + (z int32 :offset 8) + (w int32 :offset 12) + (quad uint128 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) -; (deftype gs-packed-stq (structure) -; ((data UNKNOWN 4 :offset-assert 0) -; (tex-s float :offset-assert 0) -; (tex-t float :offset-assert 4) -; (tex-q float :offset-assert 8) -; (quad uint128 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x10 -; :flag-assert #x900000010 -; ) +(deftype gs-packed-stq (structure) + ((data float 4 :offset-assert 0) + (tex-s float :offset 0) + (tex-t float :offset 4) + (tex-q float :offset 8) + (quad uint128 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) -; (deftype gs-packed-gt (structure) -; ((stq gs-packed-stq :inline :offset-assert 0) -; (rgba gs-packed-rgba :inline :offset-assert 16) -; (xyzw gs-packed-xyzw :inline :offset-assert 32) -; ) -; :method-count-assert 9 -; :size-assert #x30 -; :flag-assert #x900000030 -; ) +(deftype gs-packed-gt (structure) + ((stq gs-packed-stq :inline :offset-assert 0) + (rgba gs-packed-rgba :inline :offset-assert 16) + (xyzw gs-packed-xyzw :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) -; (deftype gs-packed-gt4 (structure) -; ((data UNKNOWN 4 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #xc0 -; :flag-assert #x9000000c0 -; ) +(deftype gs-packed-gt4 (structure) + ((data gs-packed-gt 4 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #xc0 + :flag-assert #x9000000c0 + ) (deftype terrain-bsp (structure) ((lev-index int32 :offset-assert 0) @@ -12427,73 +12482,73 @@ :flag-assert #x900000100 ) -; (deftype dma-area (structure) -; ((draw-node-dma draw-node-dma :inline :offset-assert 0) -; (tfrag-dma tfrag-dma :inline :offset-assert 0) -; (instance-shrub-dma instance-shrub-dma :inline :offset-assert 0) -; (instance-tie-dma instance-tie-dma :inline :offset-assert 0) -; (prototype-tie-dma prototype-tie-dma :inline :offset-assert 0) -; (time-of-day-dma time-of-day-dma :inline :offset-assert 0) -; (decomp-work decomp-work :inline :offset-assert 0) -; (ocean-vertex UNKNOWN 4 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x38a0 -; :flag-assert #x9000038a0 -; ) +(deftype dma-area (structure) + ((draw-node-dma draw-node-dma :inline :offset 0) + (tfrag-dma tfrag-dma :inline :offset 0) + (instance-shrub-dma instance-shrub-dma :inline :offset 0) + (instance-tie-dma instance-tie-dma :inline :offset 0) + (prototype-tie-dma prototype-tie-dma :inline :offset 0) + (time-of-day-dma time-of-day-dma :inline :offset 0) + (decomp-work decomp-work :inline :offset 0) + (ocean-vertex ocean-vertex 4 :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x38a0 + :flag-assert #x9000038a0 + ) -; (deftype background-area (structure) -; ((dma-area dma-area :inline :offset-assert 0) -; (vis-list UNKNOWN 2048 :offset-assert 14496) -; ) -; :method-count-assert 9 -; :size-assert #x40a0 -; :flag-assert #x9000040a0 -; ) +(deftype background-area (structure) + ((dma-area dma-area :inline :offset-assert 0) + (vis-list uint8 2048 :offset-assert 14496) + ) + :method-count-assert 9 + :size-assert #x40a0 + :flag-assert #x9000040a0 + ) -; (deftype foreground-area (structure) -; ((joint-work joint-work :inline :offset-assert 0) -; (generic-work generic-work :inline :offset-assert 0) -; (bone-mem bone-memory :inline :offset-assert 0) -; (shadow-work shadow-work :inline :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x3fd0 -; :flag-assert #x900003fd0 -; ) +(deftype foreground-area (structure) + ((joint-work joint-work :inline :offset-assert 0) + (generic-work generic-work :inline :offset 0) + (bone-mem bone-memory :inline :offset 0) + (shadow-work shadow-work :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x3fd0 + :flag-assert #x900003fd0 + ) -; (deftype ambient-area (structure) -; ((ambient-list ambient-list :inline :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x2004 -; :flag-assert #x900002004 -; ) +(deftype ambient-area (structure) + ((ambient-list ambient-list :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x2004 + :flag-assert #x900002004 + ) -; (deftype work-area (structure) -; ((background background-area :inline :offset-assert 0) -; (foreground foreground-area :inline :offset-assert 0) -; (ambient ambient-area :inline :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x40a0 -; :flag-assert #x9000040a0 -; ) +(deftype work-area (structure) + ((background background-area :inline :offset-assert 0) + (foreground foreground-area :inline :offset 0) + (ambient ambient-area :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x40a0 + :flag-assert #x9000040a0 + ) -; (deftype terrain-context (structure) -; ((bsp terrain-bsp :inline :offset-assert 0) -; (work work-area :inline :offset-assert 16) -; ) -; :method-count-assert 9 -; :size-assert #x40b0 -; :flag-assert #x9000040b0 -; ) +(deftype terrain-context (structure) + ((bsp terrain-bsp :inline :offset-assert 0) + (work work-area :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x40b0 + :flag-assert #x9000040b0 + ) -;; - Unknowns +;; - Symbols -;;(define-extern *terrain-stats* object) ;; unknown type -;;(define-extern *collide-stats* object) ;; unknown type +(define-extern *terrain-stats* terrain-stats) +(define-extern *collide-stats* collide-stats) ;; ---------------------- @@ -12621,8 +12676,8 @@ :flag-assert #x1f00000050 ;; unrecognized get op: (set! t9 find-parent-method) parent was entity (:methods - (dummy-27 () none 27) - (dummy-28 () none 28) + (next-actor (_type_) entity-actor 27) + (prev-actor (_type_) entity-actor 28) (dummy-29 () none 29) (dummy-30 () none 30) ) @@ -12689,83 +12744,83 @@ ;; - Types -; (deftype sprite-vec-data-2d (structure) -; ((x-y-z-sx vector :inline :offset-assert 0) -; (flag-rot-sy vector :inline :offset-assert 16) -; (r-g-b-a vector :inline :offset-assert 32) -; (x float :offset-assert 0) -; (y float :offset-assert 4) -; (z float :offset-assert 8) -; (sx float :offset-assert 12) -; (sy float :offset-assert 28) -; (rot float :offset-assert 24) -; (flag int32 :offset-assert 16) -; (matrix int32 :offset-assert 20) -; (warp-turns int32 :offset-assert 16) -; (r float :offset-assert 32) -; (g float :offset-assert 36) -; (b float :offset-assert 40) -; (a float :offset-assert 44) -; (trans vector3s :inline :offset-assert 0) -; (color rgbaf :inline :offset-assert 32) -; (data UNKNOWN 1 :offset-assert 0) -; (data64 UNKNOWN 6 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x30 -; :flag-assert #x900000030 -; ) +(deftype sprite-vec-data-2d (structure) + ((x-y-z-sx vector :inline :offset-assert 0) + (flag-rot-sy vector :inline :offset-assert 16) + (r-g-b-a vector :inline :offset-assert 32) + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (rot float :offset 24) + (flag int32 :offset 16) + (matrix int32 :offset 20) + (warp-turns int32 :offset 16) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) + (data64 uint64 6 :offset 0) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) -; (deftype sprite-array-2d (basic) -; ((num-sprites UNKNOWN 2 :offset-assert 4) -; (num-valid UNKNOWN 2 :offset-assert 12) -; (vec-data uint32 :offset-assert 20) -; (adgif-data uint32 :offset-assert 24) -; (pad UNKNOWN 4 :offset-assert 32) -; (data UNKNOWN 1 :offset-assert 96) -; ) -; :method-count-assert 9 -; :size-assert #x70 -; :flag-assert #x900000070 -; ) +(deftype sprite-array-2d (basic) + ((num-sprites uint32 2 :offset-assert 4) + (num-valid uint32 2 :offset-assert 12) + (vec-data uint32 :offset-assert 20) + (adgif-data uint32 :offset-assert 24) + (pad uint128 4 :offset-assert 32) + (data uint128 1 :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) -; (deftype sprite-vec-data-3d (structure) -; ((x-y-z-sx vector :inline :offset-assert 0) -; (qx-qy-qz-sy vector :inline :offset-assert 16) -; (r-g-b-a vector :inline :offset-assert 32) -; (x float :offset-assert 0) -; (y float :offset-assert 4) -; (z float :offset-assert 8) -; (sx float :offset-assert 12) -; (sy float :offset-assert 28) -; (qx float :offset-assert 16) -; (qy float :offset-assert 20) -; (qz float :offset-assert 24) -; (r float :offset-assert 32) -; (g float :offset-assert 36) -; (b float :offset-assert 40) -; (a float :offset-assert 44) -; (trans vector3s :inline :offset-assert 0) -; (rot vector3s :inline :offset-assert 16) -; (color rgbaf :inline :offset-assert 32) -; (data UNKNOWN 1 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x30 -; :flag-assert #x900000030 -; ) +(deftype sprite-vec-data-3d (structure) + ((x-y-z-sx vector :inline :offset-assert 0) + (qx-qy-qz-sy vector :inline :offset-assert 16) + (r-g-b-a vector :inline :offset-assert 32) + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (qx float :offset 16) + (qy float :offset 20) + (qz float :offset 24) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (rot vector3s :inline :offset 16) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) -; (deftype sprite-array-3d (basic) -; ((num-sprites UNKNOWN 2 :offset-assert 4) -; (num-valid UNKNOWN 2 :offset-assert 12) -; (vec-data uint32 :offset-assert 20) -; (adgif-data uint32 :offset-assert 24) -; (data UNKNOWN 1 :offset-assert 32) -; ) -; :method-count-assert 9 -; :size-assert #x30 -; :flag-assert #x900000030 -; ) +(deftype sprite-array-3d (basic) + ((num-sprites uint32 2 :offset-assert 4) + (num-valid uint32 2 :offset-assert 12) + (vec-data uint32 :offset-assert 20) + (adgif-data uint32 :offset-assert 24) + (data uint128 1 :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) @@ -12866,7 +12921,7 @@ ;; - Symbols -(define-extern *eye-control-array* eye-control-array) ;; unknown type +(define-extern *eye-control-array* eye-control-array) ;; ---------------------- @@ -12923,26 +12978,26 @@ :flag-assert #x90000001c ) -; (deftype sparticle-launch-state (structure) -; ((group-item sparticle-group-item :offset-assert 0) -; (flags uint16 :offset-assert 4) -; (randomize uint16 :offset-assert 6) -; (origin vector :offset-assert 8) -; (sprite3d sprite-vec-data-3d :offset-assert 12) -; (sprite basic :offset-assert 16) -; (offset uint32 :offset-assert 20) -; (accum float :offset-assert 24) -; (spawn-time uint32 :offset-assert 28) -; (swarm basic :offset-assert 20) -; (seed uint32 :offset-assert 24) -; (time uint32 :offset-assert 28) -; (spec basic :offset-assert 16) -; (id uint32 :offset-assert 12) -; ) -; :method-count-assert 9 -; :size-assert #x20 -; :flag-assert #x900000020 -; ) +(deftype sparticle-launch-state (structure) + ((group-item sparticle-group-item :offset-assert 0) + (flags uint16 :offset-assert 4) + (randomize uint16 :offset-assert 6) + (origin vector :offset-assert 8) + (sprite3d sprite-vec-data-3d :offset-assert 12) + (sprite basic :offset-assert 16) + (offset uint32 :offset-assert 20) + (accum float :offset-assert 24) + (spawn-time uint32 :offset-assert 28) + (swarm basic :offset 20) + (seed uint32 :offset 24) + (time uint32 :offset 28) + (spec basic :offset 16) + (id uint32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) (deftype sparticle-launch-group (basic) ((length int16 :offset-assert 4) @@ -12961,30 +13016,30 @@ ) ) -; (deftype sparticle-launch-control (inline-array-class) -; ((length int32 :offset-assert 4) -; (allocated-length int32 :offset-assert 8) -; (group basic :offset-assert 16) -; (proc basic :offset-assert 20) -; (local-clock int32 :offset-assert 24) -; (fade float :offset-assert 28) -; (matrix int32 :offset-assert 32) -; (last-spawn-frame int32 :offset-assert 36) -; (last-spawn-time int32 :offset-assert 40) -; (center vector :inline :offset-assert 48) -; (data UNKNOWN :dynamic :offset-assert 64) -; ) -; :method-count-assert 14 -; :size-assert #x40 -; :flag-assert #xe00000040 -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; ) -; ) +(deftype sparticle-launch-control (inline-array-class) + ((group basic :offset-assert 16) + (proc basic :offset-assert 20) + (local-clock int32 :offset-assert 24) + (fade float :offset-assert 28) + (matrix int32 :offset-assert 32) + (last-spawn-frame int32 :offset-assert 36) + (last-spawn-time int32 :offset-assert 40) + (center vector :inline :offset-assert 48) + ;; todo - what's the real type? + ;; maybe its sparticle-launch-state based on heap-base. + (data uint8 :dynamic :offset-assert 64) + ) + :method-count-assert 14 + :size-assert #x40 + :flag-assert #xe00000040 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + ) + ) @@ -12996,78 +13051,78 @@ ;; - Types -; (deftype sparticle-cpuinfo (structure) -; ((sprite sprite-vec-data-2d :offset-assert 0) -; (adgif adgif-shader :offset-assert 4) -; (radius float :offset-assert 8) -; (omega float :offset-assert 12) -; (vel-sxvel vector :inline :offset-assert 16) -; (rot-syvel vector :inline :offset-assert 32) -; (fade rgbaf :inline :offset-assert 48) -; (acc vector :inline :offset-assert 64) -; (rotvel3d quaternion :inline :offset-assert 80) -; (vel vector3s :inline :offset-assert 16) -; (accel vector3s :inline :offset-assert 64) -; (scalevelx float :offset-assert 28) -; (scalevely float :offset-assert 44) -; (friction float :offset-assert 96) -; (timer int32 :offset-assert 100) -; (flags uint32 :offset-assert 104) -; (user-int32 int32 :offset-assert 108) -; (user-uint32 uint32 :offset-assert 108) -; (user-float float :offset-assert 108) -; (user-pntr uint32 :offset-assert 108) -; (user-sprite sprite-vec-data-2d :offset-assert 108) -; (func basic :offset-assert 112) -; (next-time uint32 :offset-assert 116) -; (next-launcher basic :offset-assert 120) -; (cache-alpha float :offset-assert 124) -; (valid basic :offset-assert 128) -; (key basic :offset-assert 132) -; (binding sparticle-launch-state :offset-assert 136) -; (data UNKNOWN 1 :offset-assert 12) -; (dataf UNKNOWN 1 :offset-assert 12) -; (datac UNKNOWN 1 :offset-assert 12) -; ) -; :method-count-assert 9 -; :size-assert #x8c -; :flag-assert #x90000008c -; ;; field key is a basic loaded with a signed load -; ) +(deftype sparticle-cpuinfo (structure) + ((sprite sprite-vec-data-2d :offset-assert 0) + (adgif adgif-shader :offset-assert 4) + (radius float :offset-assert 8) + (omega float :offset-assert 12) + (vel-sxvel vector :inline :offset-assert 16) + (rot-syvel vector :inline :offset-assert 32) + (fade rgbaf :inline :offset-assert 48) + (acc vector :inline :offset-assert 64) + (rotvel3d quaternion :inline :offset-assert 80) + (vel vector3s :inline :offset 16) + (accel vector3s :inline :offset 64) + (scalevelx float :offset 28) + (scalevely float :offset 44) + (friction float :offset-assert 96) + (timer int32 :offset-assert 100) + (flags uint32 :offset-assert 104) + (user-int32 int32 :offset-assert 108) + (user-uint32 uint32 :offset 108) + (user-float float :offset 108) + (user-pntr uint32 :offset 108) + (user-sprite sprite-vec-data-2d :offset 108) + (func basic :offset-assert 112) + (next-time uint32 :offset-assert 116) + (next-launcher basic :offset-assert 120) + (cache-alpha float :offset-assert 124) + (valid basic :offset-assert 128) + (key basic :offset-assert 132) + (binding sparticle-launch-state :offset-assert 136) + (data uint32 1 :offset 12) + (dataf float 1 :offset 12) + (datac uint8 1 :offset 12) + ) + :method-count-assert 9 + :size-assert #x8c + :flag-assert #x90000008c + ;; field key is a basic loaded with a signed load + ) -; (deftype sparticle-launchinfo (structure) -; ((launchrot vector :inline :offset-assert 0) -; (conerot vector :inline :offset-assert 16) -; (coneradius float :offset-assert 32) -; (rotate-y float :offset-assert 36) -; (data UNKNOWN 1 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x28 -; :flag-assert #x900000028 -; ) +(deftype sparticle-launchinfo (structure) + ((launchrot vector :inline :offset-assert 0) + (conerot vector :inline :offset-assert 16) + (coneradius float :offset-assert 32) + (rotate-y float :offset-assert 36) + (data uint8 1 :offset 0) + ) + :method-count-assert 9 + :size-assert #x28 + :flag-assert #x900000028 + ) -; (deftype sparticle-system (basic) -; ((blocks UNKNOWN 2 :offset-assert 4) -; (length UNKNOWN 2 :offset-assert 12) -; (num-alloc UNKNOWN 2 :offset-assert 20) -; (is-3d basic :offset-assert 28) -; (flags uint32 :offset-assert 32) -; (alloc-table uint32 :offset-assert 36) -; (cpuinfo-table uint32 :offset-assert 40) -; (vecdata-table uint32 :offset-assert 44) -; (adgifdata-table uint32 :offset-assert 48) -; ) -; :method-count-assert 9 -; :size-assert #x34 -; :flag-assert #x900000034 -; ) +(deftype sparticle-system (basic) + ((blocks uint32 2 :offset-assert 4) + (length uint32 2 :offset-assert 12) + (num-alloc uint32 2 :offset-assert 20) + (is-3d basic :offset-assert 28) + (flags uint32 :offset-assert 32) + (alloc-table uint32 :offset-assert 36) + (cpuinfo-table uint32 :offset-assert 40) + (vecdata-table uint32 :offset-assert 44) + (adgifdata-table uint32 :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) -;; - Unknowns +;; - Symbols -;;(define-extern *sp-frame-time* object) ;; unknown type -;;(define-extern *sp-60-hz* object) ;; unknown type +(define-extern *sp-frame-time* vector) +(define-extern *sp-60-hz* symbol) ;; ---------------------- @@ -13080,19 +13135,21 @@ (deftype actor-link-info (basic) ((process basic :offset-assert 4) - (next basic :offset-assert 8) - (prev basic :offset-assert 12) + (next entity-actor :offset-assert 8) + ;; prev is a guess here. + (prev entity-actor :offset-assert 12) ) :method-count-assert 26 :size-assert #x10 :flag-assert #x1a00000010 (:methods + (new (symbol type process) _type_) (dummy-9 () none 9) (dummy-10 () none 10) (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) + (get-next (_type_) entity-actor 12) + (get-prev (_type_) entity-actor 13) + (dummy-14 (_type_) none 14) ;; decompiler broken... (dummy-15 () none 15) (dummy-16 () none 16) (dummy-17 () none 17) @@ -13110,15 +13167,15 @@ ;; - Symbols (define-extern entity-actor-count (function res-lump symbol int)) -(define-extern entity-by-name function) -(define-extern entity-by-aid function) +(define-extern entity-by-name (function string entity)) +(define-extern entity-by-aid (function int entity)) (define-extern actor-link-subtask-complete-hook function) (define-extern actor-link-dead-hook function) (define-extern alt-actor-list-subtask-incomplete-count function) ;; - Functions -(define-extern entity-actor-lookup (function entity symbol int process-drawable)) ;; NOTE - return value is not confirmed +(define-extern entity-actor-lookup (function res-lump symbol int entity-actor)) ;; NOTE - return value is not confirmed ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index 7fd5654b12..76230f1af0 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -523,5 +523,8 @@ "generic": [ ["L11", "(array generic-dma-foreground-sink)", true], ["L12", "uint64", true] + ], + "entity": [ + ["L324", "float", true] ] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index d5d8c651ce..27f8b688e7 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -474,6 +474,10 @@ "entity-actor-count": [["_stack_", 16, "res-tag"]], + "entity-actor-lookup": [["_stack_", 16, "res-tag"], + [[10, 33], "v1", "(pointer uint32)"] +], + "(method 11 joint-mod)": [ [15, "s3", "process-drawable"], [[26, 66], "s3", "fact-info-enemy"], @@ -502,12 +506,29 @@ [[1, 20], "a1", "touching-prims-entry"] ], - "(method 0 touching-list)": [ - [[6, 9], "v0", "touching-list"] + "(method 0 touching-list)": [[[6, 9], "v0", "touching-list"]], + + "num-func-chan": [[8, "v1", "joint-control-channel"]], + + "cspace-by-name-no-fail": [[[0, 100], "v0", "cspace"]], + + "shrubbery-login-post-texture": [ + //[[13, 41], "a3", "qword"], + // [[13, 41], "a2", "qword"] + [[13, 15], "a3", "qword"], + [16, "a3", "pointer"], + [24, "a3", "pointer"], + [[17, 23], "a3", "qword"], + [[13, 23], "a1", "qword"], + [14, "a2", "qword"], + [[27, 29], "a3", "qword"], + [[27, 29], "a1", "qword"], + [[35, 37], "a3", "qword"], + [[35, 37], "a2", "qword"] ], - "num-func-chan": [ - [8, "v1", "joint-control-channel"] + "(method 3 sparticle-cpuinfo)": [ + [106, "f0", "float"] ], "cspace-by-name-no-fail": [ diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index dbca456252..49ecab190c 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -1569,6 +1569,19 @@ "vars": { "f0-1": "duration", "f1-2": "after-inc", "f0-3": "wrapped" } }, + "shrubbery-login-post-texture": { + "args": ["obj"], + "vars": { + "v1-1":"shader-count", + "a1-1":["dst", "qword"], + "a2-5":["tex-dst", "qword"], + "a3-0":["src", "qword"], + "a2-6":["text-dst2", "qword"], + "a3-1":["src-2", "qword"], + "a3-2":["src-3", "qword"] + } + }, + // LEVEL "lookup-level-info": { "args": ["name"], diff --git a/goal_src/engine/data/art-h.gc b/goal_src/engine/data/art-h.gc index 9fd0538acf..54f6e95ac3 100644 --- a/goal_src/engine/data/art-h.gc +++ b/goal_src/engine/data/art-h.gc @@ -157,7 +157,7 @@ ;; figured out manually from custom inspect. ((speed float :offset 20) (artist-base float :offset 24) - (artiest-step float :offset 28) + (artist-step float :offset 28) (master-art-group-name basic :offset 32) (master-art-group-index int32 :offset 36) (frames pointer :offset 44) diff --git a/goal_src/engine/debug/stats-h.gc b/goal_src/engine/debug/stats-h.gc index 86eb9b5a14..3df795f6b2 100644 --- a/goal_src/engine/debug/stats-h.gc +++ b/goal_src/engine/debug/stats-h.gc @@ -68,25 +68,22 @@ ;; failed to figure out what this is: (set! (-> perf-stat-array heap-base) (the-as uint 52)) -;; definition for method 11 of type perf-stat -;; ERROR: function was not converted to expressions. Cannot decompile. +(defmethod PERF-COUNTER-REG-ACCESS-11 perf-stat ((obj perf-stat)) + "Perfomance counters are not implemented, so this does nothing." + (none) + ) -;; definition for method 12 of type perf-stat -;; ERROR: function was not converted to expressions. Cannot decompile. +(defmethod PERF-COUNTER-REG-ACCESS-12 perf-stat ((obj perf-stat)) + "Perfomance counters are not implemented, so this does nothing." + (none) + ) -;; definition for method 13 of type perf-stat -;; INFO: Return type mismatch int vs none. -(defmethod - update-wait-stats-13 - perf-stat - ((obj perf-stat) (arg0 uint) (arg1 uint) (arg2 uint)) +(defmethod update-wait-stats-13 perf-stat ((obj perf-stat) (arg0 uint) (arg1 uint) (arg2 uint)) (when (nonzero? (-> obj ctrl)) (set! (-> obj to-vu0-waits) (+ (-> obj to-vu0-waits) arg0)) (set! (-> obj to-spr-waits) (+ (-> obj to-spr-waits) arg1)) (set! (-> obj from-spr-waits) (+ (-> obj from-spr-waits) arg2)) ) - (let ((v0-0 0)) - ) (none) ) diff --git a/goal_src/engine/draw/drawable-actor-h.gc b/goal_src/engine/draw/drawable-actor-h.gc index bcac80f625..c3463ba01c 100644 --- a/goal_src/engine/draw/drawable-actor-h.gc +++ b/goal_src/engine/draw/drawable-actor-h.gc @@ -20,10 +20,12 @@ ) (deftype drawable-inline-array-actor (drawable-inline-array) - ((paid uint8 36)) + ((data drawable-actor 1 :inline) + (pad uint8 4)) :flag-assert #x1200000044 ) + (defmethod dummy-10 drawable-tree-actor ((obj _type_)) 0 ) diff --git a/goal_src/engine/draw/drawable-ambient-h.gc b/goal_src/engine/draw/drawable-ambient-h.gc index c232b6333c..593b16eab3 100644 --- a/goal_src/engine/draw/drawable-ambient-h.gc +++ b/goal_src/engine/draw/drawable-ambient-h.gc @@ -39,11 +39,9 @@ ;; definition of type drawable-inline-array-ambient (deftype drawable-inline-array-ambient (drawable-inline-array) - ((paid uint8 36 :offset-assert 32) - ) - :method-count-assert 18 - :size-assert #x44 - :flag-assert #x1200000044 + ((data drawable-ambient 1 :inline) + (pad uint8 4)) + :flag-assert #x1200000044 ) ;; definition for method 10 of type drawable-tree-ambient diff --git a/goal_src/engine/draw/drawable-h.gc b/goal_src/engine/draw/drawable-h.gc index fee5a0f0c0..dbd91c6a7d 100644 --- a/goal_src/engine/draw/drawable-h.gc +++ b/goal_src/engine/draw/drawable-h.gc @@ -15,7 +15,7 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) + (dummy-9 (_type_) _type_ 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) @@ -34,7 +34,6 @@ :size-assert #x24 :flag-assert #x1200000024 (:methods - (dummy-9 () none 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) diff --git a/goal_src/engine/entity/entity-h.gc b/goal_src/engine/entity/entity-h.gc index dec48318ad..7810b3d3a2 100644 --- a/goal_src/engine/entity/entity-h.gc +++ b/goal_src/engine/entity/entity-h.gc @@ -162,11 +162,11 @@ :size-assert #x50 :flag-assert #x1f00000050 (:methods - (dummy-27 () none 27) - (dummy-28 () none 28) - (dummy-29 () none 29) - (dummy-30 () none 30) - ) + (next-actor (_type_) entity-actor 27) + (prev-actor (_type_) entity-actor 28) + (dummy-29 () none 29) + (dummy-30 () none 30) + ) ) ;; definition of type entity-info @@ -201,11 +201,10 @@ ) ;; definition for symbol *ACTOR-bank*, type actor-bank -(define - *ACTOR-bank* - (new 'static 'actor-bank - :pause-dist 204800.0 - :birth-dist 901120.0 - :birth-max 10 - ) +(define *ACTOR-bank* + (new 'static 'actor-bank + :pause-dist 204800.0 + :birth-dist 901120.0 + :birth-max 10 + ) ) diff --git a/goal_src/engine/entity/entity.gc b/goal_src/engine/entity/entity.gc index ef1056b7d1..500749b924 100644 --- a/goal_src/engine/entity/entity.gc +++ b/goal_src/engine/entity/entity.gc @@ -5,3 +5,90 @@ ;; name in dgo: entity ;; dgos: GAME, ENGINE +;; needs cleanup, but this does work! +(defun entity-by-name ((arg0 string)) + (dotimes (s5-0 (-> *level* length)) + (let ((s4-0 (the-as basic (-> *level* level s5-0)))) + (when (= (-> (the-as level s4-0) status) 'active) + (let ((s3-0 (-> (the-as level s4-0) bsp actors))) + (when (nonzero? s3-0) + (dotimes (s2-0 (-> s3-0 length)) + (let ((s1-0 (-> s3-0 data s2-0 actor))) + (if + (name= + (the-as + basic + ((method-of-type res-lump get-property-struct) + (the-as res-lump s1-0) + 'name + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + arg0 + ) + (return (the entity s1-0)) + ) + ) + ) + ) + ) + (let ((s3-1 (-> (the-as level s4-0) bsp ambients))) + (when (nonzero? s3-1) + (dotimes (s2-1 (-> s3-1 length)) + (let ((s1-1 (-> s3-1 data s2-1 ambient))) + (if + (name= + (the-as + basic + ((method-of-type res-lump get-property-struct) + (the-as res-lump s1-1) + 'name + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + arg0 + ) + (return (the entity s1-1)) + ) + ) + ) + ) + ) + (set! s4-0 (-> (the-as level s4-0) bsp cameras)) + (when (nonzero? (the-as (array entity-camera) s4-0)) + (dotimes (s3-2 (-> (the-as (array entity-camera) s4-0) length)) + (let ((s2-2 (-> (the-as (array entity-camera) s4-0) s3-2))) + (if + (name= + (the-as + basic + ((method-of-type res-lump get-property-struct) + s2-2 + 'name + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + arg0 + ) + (return (the entity s2-2)) + ) + ) + ) + ) + ) + ) + ) + (the-as entity #f) + ) diff --git a/goal_src/engine/gfx/background-h.gc b/goal_src/engine/gfx/background-h.gc index d463172fad..37dd1ad61b 100644 --- a/goal_src/engine/gfx/background-h.gc +++ b/goal_src/engine/gfx/background-h.gc @@ -5,3 +5,35 @@ ;; name in dgo: background-h ;; dgos: GAME, ENGINE +(deftype background-work (basic) + ((tfrag-tree-count int32 :offset-assert 4) + (tfrag-trees drawable-tree-tfrag 8 :offset-assert 8) + (tfrag-levels level 8 :offset-assert 40) + (trans-tfrag-tree-count int32 :offset-assert 72) + (trans-tfrag-trees drawable-tree-trans-tfrag 8 :offset-assert 76) + (trans-tfrag-levels level 8 :offset-assert 108) + (dirt-tfrag-tree-count int32 :offset-assert 140) + (dirt-tfrag-trees drawable-tree-dirt-tfrag 8 :offset-assert 144) + (dirt-tfrag-levels level 8 :offset-assert 176) + (ice-tfrag-tree-count int32 :offset-assert 208) + (ice-tfrag-trees drawable-tree-ice-tfrag 8 :offset-assert 212) + (ice-tfrag-levels level 8 :offset-assert 244) + (lowres-tfrag-tree-count int32 :offset-assert 276) + (lowres-tfrag-trees drawable-tree-lowres-tfrag 8 :offset-assert 280) + (lowres-tfrag-levels level 8 :offset-assert 312) + (lowres-trans-tfrag-tree-count int32 :offset-assert 344) + (lowres-trans-tfrag-trees drawable-tree-trans-tfrag 8 :offset-assert 348) + (lowres-trans-tfrag-levels level 8 :offset-assert 380) + (shrub-tree-count int32 :offset-assert 412) + (shrub-trees drawable-tree-instance-shrub 8 :offset-assert 416) + (shrub-levels level 8 :offset-assert 448) + (tie-tree-count int32 :offset-assert 480) + (tie-trees drawable-tree-instance-tie 8 :offset-assert 484) + (tie-levels level 8 :offset-assert 516) + (tie-generic basic 8 :offset-assert 548) + (wait-to-vu0 uint32 :offset-assert 580) + ) + :method-count-assert 9 + :size-assert #x248 + :flag-assert #x900000248 + ) diff --git a/goal_src/engine/gfx/shrub/shrubbery-h.gc b/goal_src/engine/gfx/shrub/shrubbery-h.gc index 9e438a914c..62e711c8b3 100644 --- a/goal_src/engine/gfx/shrub/shrubbery-h.gc +++ b/goal_src/engine/gfx/shrub/shrubbery-h.gc @@ -5,3 +5,267 @@ ;; name in dgo: shrubbery-h ;; dgos: GAME, ENGINE +(deftype billboard (drawable) + ((flat adgif-shader :inline :offset-assert 32) + ) + :method-count-assert 18 + :size-assert #x70 + :flag-assert #x1200000070 + ) + +(deftype shrub-view-data (structure) + ((data uint128 3 :offset-assert 0) + (texture-giftag qword :inline :offset 0) + (consts vector :inline :offset 16) + (fog-clamp vector :inline :offset 32) + (tex-start-ptr int32 :offset 16) + (gifbufsum float :offset 16) + (mtx-buf-ptr int32 :offset 20) + (exp23 float :offset 20) + (fog-0 float :offset 24) + (fog-1 float :offset 28) + (fog-min float :offset 32) + (fog-max float :offset 36) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +(deftype shrubbery (drawable) + ((textures (inline-array adgif-shader) :offset 4) + (header qword :offset 8) + (obj-qwc uint8 :offset 12) + (vtx-qwc uint8 :offset 13) + (col-qwc uint8 :offset 14) + (stq-qwc uint8 :offset 15) + (obj uint32 :offset 16) + (vtx uint32 :offset 20) + (col uint32 :offset 24) + (stq uint32 :offset 28) + ) + :method-count-assert 18 + :size-assert #x20 + :flag-assert #x1200000020 + ) + +(deftype instance-shrubbery (instance) + ((flat-normal vector :inline :offset-assert 64) + (flat-hwidth float :offset 76) + (color uint32 :offset 8) + ) + :method-count-assert 18 + :size-assert #x50 + :flag-assert #x1200000050 + ) + +(deftype drawable-inline-array-instance-shrub (drawable-inline-array) + ((data instance-shrubbery 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 112) + ) + :method-count-assert 18 + :size-assert #x74 + :flag-assert #x1200000074 + ) + +(deftype drawable-tree-instance-shrub (drawable-tree) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype generic-shrub-fragment (drawable) + ((textures (inline-array adgif-shader) :offset 4) + (vtx-cnt uint32 :offset 8) + (cnt-qwc uint8 :offset 12) + (vtx-qwc uint8 :offset 13) + (col-qwc uint8 :offset 14) + (stq-qwc uint8 :offset 15) + (cnt uint32 :offset 16) + (vtx uint32 :offset 20) + (col uint32 :offset 24) + (stq uint32 :offset 28) + ) + :method-count-assert 18 + :size-assert #x20 + :flag-assert #x1200000020 + ) + +(deftype prototype-shrubbery (drawable-inline-array) + ((data generic-shrub-fragment 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 64) + ) + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +(deftype prototype-trans-shrubbery (prototype-shrubbery) + () + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +(deftype prototype-generic-shrub (drawable-group) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype shrubbery-matrix (structure) + ((mat matrix :inline :offset-assert 0) + (color qword :inline :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + ) + +(defun shrubbery-login-post-texture ((obj shrubbery)) + "Copies adgif shader crap to somewhere" + ;; total number of adgif shaders for this shrubbery object. + (let* ((shader-count (-> obj header data 0)) + ;; one destination to place the data. + (dst (the-as qword + (+ (the-as uint (-> obj header)) + (the-as uint (* (+ (-> obj header data 1) 1) 16)) + ) + ) + ) + ;; the second destination to place the data + (tex-dst (the-as qword (+ (the-as int dst) (the-as int (* shader-count 64))))) + ;; the input data (adgif shaders, each is 0x50 bytes, or 5 quads) + (src (the-as qword (-> obj textures))) + ) + ;; iterate over all shaders + (dotimes (a0-1 (the-as int shader-count)) + ;; copy the first quadword directly to the second destination + (set! (-> tex-dst quad) (-> src quad)) + ;; advance dst and src + (let ((text-dst2 (the-as qword (+ (the-as int tex-dst) 16))) + (src-2 (the-as qword (&+ (the-as pointer src) 16))) + ) + ;; copy second quadword, but only the first three words + (set! (-> dst data 0) (-> src-2 data 0)) + (set! (-> dst data 1) (-> src-2 data 1)) + (set! (-> dst data 2) (-> src-2 data 2)) + ;; advance dst and src + (set! dst (the-as qword (+ (the-as int dst) 16))) + (let ((src-3 (the-as qword (&+ (the-as pointer src-2) 16)))) + ;; copy 3rd, 4th, and 5th quadwords + (dotimes (t0-4 3) + (set! (-> dst quad) (-> src-3 quad)) + (set! dst (the-as qword (+ (the-as int dst) 16))) + (set! src-3 (the-as qword (&+ (the-as pointer src-3) 16))) + ) + ;; more texture data (isn't this reading off of the end of the source?) + (set! (-> text-dst2 quad) (-> src-3 quad)) + (set! tex-dst (the-as qword (+ (the-as int text-dst2) 16))) + + ;; advance to next source + (set! src (the-as qword (&+ (the-as pointer src-3) 80))) + ) + ) + ) + ) + (none) + ) + +(define *shrub-state* 0) + +(deftype shrub-near-packet (structure) + ((matrix-tmpl dma-packet :inline :offset-assert 0) + (header-tmpl dma-packet :inline :offset-assert 16) + (stq-tmpl dma-packet :inline :offset-assert 32) + (color-tmpl dma-packet :inline :offset-assert 48) + (vertex-tmpl dma-packet :inline :offset-assert 64) + (mscal-tmpl dma-packet :inline :offset-assert 80) + (init-tmpl dma-packet :inline :offset-assert 96) + (init-data uint32 8 :offset-assert 112) + ) + :method-count-assert 9 + :size-assert #x90 + :flag-assert #x900000090 + ) + +(deftype instance-shrub-work (structure) + ((dummy uint128 3 :offset-assert 0) + (chaina uint128 8 :offset-assert 48) + (chainb uint128 8 :offset-assert 176) + (colors rgba 1024 :offset-assert 304) + (matrix-tmpl uint128 20 :offset-assert 4400) + (count-tmpl uint128 20 :offset-assert 4720) + (mscalf-tmpl dma-packet :inline :offset-assert 5040) + (mscalf-ret-tmpl dma-packet :inline :offset-assert 5056) + (adgif-tmpl dma-gif-packet :inline :offset-assert 5072) + (billboard-tmpl dma-gif-packet :inline :offset-assert 5104) + (billboard-const vector :inline :offset-assert 5136) + (shrub-near-packets shrub-near-packet 6 :inline :offset-assert 5152) + (dma-ref dma-packet :inline :offset-assert 6016) + (dma-end dma-packet :inline :offset-assert 6032) + (wind-const vector :inline :offset-assert 6048) + (constants vector :inline :offset-assert 6064) + (color-constant vector4w :inline :offset-assert 6080) + (hmge-d vector :inline :offset-assert 6096) + (hvdf-offset vector :inline :offset-assert 6112) + (wind-force vector :inline :offset-assert 6128) + (color vector :inline :offset-assert 6144) + (bb-color vector :inline :offset-assert 6160) + (min-dist vector :inline :offset-assert 6176) + (temp-vec vector :inline :offset-assert 6192) + (guard-plane plane 4 :inline :offset-assert 6208) + (plane plane 4 :inline :offset-assert 6272) + (last uint32 4 :offset-assert 6336) + (next uint32 4 :offset-assert 6352) + (count uint16 4 :offset-assert 6368) + (mod-count uint16 4 :offset-assert 6376) + (wind-vectors uint32 :offset-assert 6384) + (instance-ptr uint32 :offset-assert 6388) + (chain-ptr uint32 :offset-assert 6392) + (chain-ptr-next uint32 :offset-assert 6396) + (stack-ptr uint32 :offset-assert 6400) + (bucket-ptr uint32 :offset-assert 6404) + (src-ptr uint32 :offset-assert 6408) + (to-spr uint32 :offset-assert 6412) + (from-spr uint32 :offset-assert 6416) + (shrub-count uint32 :offset-assert 6420) + (node uint32 6 :offset 6428) + (length uint32 6 :offset-assert 6452) + (prototypes uint32 :offset-assert 6476) + (start-bank uint8 20 :offset 6484) + (buffer-index uint32 :offset-assert 6504) + (current-spr uint32 :offset-assert 6508) + (current-mem uint32 :offset-assert 6512) + (current-shrub-near-packet uint32 :offset-assert 6516) + (dma-buffer basic :offset 6524) + (near-last uint32 :offset-assert 6528) + (near-next uint32 :offset-assert 6532) + (near-count uint32 :offset-assert 6536) + (last-shrubs uint32 :offset-assert 6540) + (chains uint32 :offset-assert 6544) + (flags uint32 :offset-assert 6548) + (paused basic :offset-assert 6552) + (node-count uint32 :offset-assert 6556) + (inst-count uint32 :offset-assert 6560) + (wait-from-spr uint32 :offset-assert 6564) + (wait-to-spr uint32 :offset-assert 6568) + ) + :method-count-assert 9 + :size-assert #x19ac + :flag-assert #x9000019ac + ) + +(deftype instance-shrub-dma (structure) + ((instancea uint128 325 :offset-assert 0) + (instanceb uint128 325 :offset-assert 5200) + (outa uint128 128 :offset-assert 10400) + (outb uint128 128 :offset-assert 12448) + ) + :method-count-assert 9 + :size-assert #x38a0 + :flag-assert #x9000038a0 + ) + diff --git a/goal_src/engine/gfx/sprite/sprite-h.gc b/goal_src/engine/gfx/sprite/sprite-h.gc index c80df0079e..dc05a3ca29 100644 --- a/goal_src/engine/gfx/sprite/sprite-h.gc +++ b/goal_src/engine/gfx/sprite/sprite-h.gc @@ -5,3 +5,81 @@ ;; name in dgo: sprite-h ;; dgos: GAME, ENGINE +;; definition of type sprite-vec-data-2d +(deftype sprite-vec-data-2d (structure) + ((x-y-z-sx vector :inline :offset-assert 0) + (flag-rot-sy vector :inline :offset-assert 16) + (r-g-b-a vector :inline :offset-assert 32) + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (rot float :offset 24) + (flag int32 :offset 16) + (matrix int32 :offset 20) + (warp-turns int32 :offset 16) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) + (data64 uint64 6 :offset 0) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +(deftype sprite-array-2d (basic) + ((num-sprites uint32 2 :offset-assert 4) + (num-valid uint32 2 :offset-assert 12) + (vec-data uint32 :offset-assert 20) + (adgif-data uint32 :offset-assert 24) + (pad uint128 4 :offset-assert 32) + (data uint128 1 :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +(deftype sprite-vec-data-3d (structure) + ((x-y-z-sx vector :inline :offset-assert 0) + (qx-qy-qz-sy vector :inline :offset-assert 16) + (r-g-b-a vector :inline :offset-assert 32) + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (qx float :offset 16) + (qy float :offset 20) + (qz float :offset 24) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (rot vector3s :inline :offset 16) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +(deftype sprite-array-3d (basic) + ((num-sprites uint32 2 :offset-assert 4) + (num-valid uint32 2 :offset-assert 12) + (vec-data uint32 :offset-assert 20) + (adgif-data uint32 :offset-assert 24) + (data uint128 1 :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) diff --git a/goal_src/engine/gfx/texture-h.gc b/goal_src/engine/gfx/texture-h.gc index 9238cb63d5..1f4eefc162 100644 --- a/goal_src/engine/gfx/texture-h.gc +++ b/goal_src/engine/gfx/texture-h.gc @@ -196,7 +196,7 @@ (define *texture-page-dir* (the texture-page-dir #f)) (deftype adgif-shader (structure) - ((quad uint128 5 :offset 0) + ((quad qword 5 :inline :offset 0) (prims uint64 10 :offset 0) (tex0 uint64 :offset 0) (tex1 uint64 :offset 16) diff --git a/goal_src/engine/gfx/tfrag/subdivide-h.gc b/goal_src/engine/gfx/tfrag/subdivide-h.gc index a57dcf7639..37850a19ae 100644 --- a/goal_src/engine/gfx/tfrag/subdivide-h.gc +++ b/goal_src/engine/gfx/tfrag/subdivide-h.gc @@ -5,3 +5,190 @@ ;; name in dgo: subdivide-h ;; dgos: GAME, ENGINE +(deftype subdivide-settings (basic) + ((dist float 5 :offset-assert 4) + (meters float 5 :offset-assert 24) + (close float 4 :offset-assert 44) + (far float 4 :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x4c + :flag-assert #x90000004c + (:methods + (new (symbol type float float) _type_ 0) + ) + ) + +(defmethod new subdivide-settings ((allocation symbol) (type-to-make type) (arg0 float) (arg1 float)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (dotimes (v1-2 3) + (set! (-> v0-0 close v1-2) arg0) + (set! (-> v0-0 far v1-2) arg1) + ) + v0-0 + ) + ) + +(deftype subdivide-dists (structure) + ((data uint32 32 :offset 0) + (vector vector 8 :inline :offset 0) + (k0s uint128 4 :offset 0) + (k1s uint128 4 :offset 64) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) + +(deftype gs-packed-rgba (structure) + ((data int32 4 :offset-assert 0) + (red int32 :offset 0) + (green int32 :offset 4) + (blue int32 :offset 8) + (alpha int32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype gs-packed-xyzw (structure) + ((data int32 4 :offset-assert 0) + (x int32 :offset 0) + (y int32 :offset 4) + (z int32 :offset 8) + (w int32 :offset 12) + (quad uint128 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype gs-packed-stq (structure) + ((data float 4 :offset-assert 0) + (tex-s float :offset 0) + (tex-t float :offset 4) + (tex-q float :offset 8) + (quad uint128 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype gs-packed-gt (structure) + ((stq gs-packed-stq :inline :offset-assert 0) + (rgba gs-packed-rgba :inline :offset-assert 16) + (xyzw gs-packed-xyzw :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +(deftype gs-packed-gt4 (structure) + ((data gs-packed-gt 4 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #xc0 + :flag-assert #x9000000c0 + ) + +(deftype terrain-bsp (structure) + ((lev-index int32 :offset-assert 0) + (mood basic :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +(deftype terrain-stats (structure) + ((pris tr-stat :inline :offset-assert 0) + (tie-generic tr-stat :inline :offset-assert 16) + (tie tr-stat :inline :offset-assert 32) + (tie-near tr-stat :inline :offset-assert 48) + (shrub-near tr-stat :inline :offset-assert 64) + (shrub tr-stat :inline :offset-assert 80) + (tfrag-near tr-stat :inline :offset-assert 96) + (tfrag tr-stat :inline :offset-assert 112) + (billboard tr-stat :inline :offset-assert 128) + (trans-tfrag tr-stat :inline :offset-assert 144) + (trans-tfrag-near tr-stat :inline :offset-assert 160) + (trans-pris tr-stat :inline :offset-assert 176) + (trans-shrub tr-stat :inline :offset-assert 192) + (ocean-mid tr-stat :inline :offset-assert 208) + (ocean-near tr-stat :inline :offset-assert 224) + (total tr-stat :inline :offset-assert 240) + ) + :method-count-assert 9 + :size-assert #x100 + :flag-assert #x900000100 + ) + +(deftype dma-area (structure) + ((draw-node-dma draw-node-dma :inline :offset 0) + (tfrag-dma tfrag-dma :inline :offset 0) + (instance-shrub-dma instance-shrub-dma :inline :offset 0) + (instance-tie-dma instance-tie-dma :inline :offset 0) + (prototype-tie-dma prototype-tie-dma :inline :offset 0) + (time-of-day-dma time-of-day-dma :inline :offset 0) + (decomp-work decomp-work :inline :offset 0) + (ocean-vertex ocean-vertex 4 :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x38a0 + :flag-assert #x9000038a0 + ) + +(deftype background-area (structure) + ((dma-area dma-area :inline :offset-assert 0) + (vis-list uint8 2048 :offset-assert 14496) + ) + :method-count-assert 9 + :size-assert #x40a0 + :flag-assert #x9000040a0 + ) + +(deftype foreground-area (structure) + ((joint-work joint-work :inline :offset-assert 0) + (generic-work generic-work :inline :offset 0) + (bone-mem bone-memory :inline :offset 0) + (shadow-work shadow-work :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x3fd0 + :flag-assert #x900003fd0 + ) + +(deftype ambient-area (structure) + ((ambient-list ambient-list :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x2004 + :flag-assert #x900002004 + ) + +(deftype work-area (structure) + ((background background-area :inline :offset-assert 0) + (foreground foreground-area :inline :offset 0) + (ambient ambient-area :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x40a0 + :flag-assert #x9000040a0 + ) + +(deftype terrain-context (structure) + ((bsp terrain-bsp :inline :offset-assert 0) + (work work-area :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x40b0 + :flag-assert #x9000040b0 + ) + +(define *terrain-stats* (new 'global 'terrain-stats)) + +(define *collide-stats* (new 'global 'collide-stats)) diff --git a/goal_src/engine/gfx/tfrag/tfrag-h.gc b/goal_src/engine/gfx/tfrag/tfrag-h.gc index 39b5b5d24b..2115333595 100644 --- a/goal_src/engine/gfx/tfrag/tfrag-h.gc +++ b/goal_src/engine/gfx/tfrag/tfrag-h.gc @@ -5,3 +5,249 @@ ;; name in dgo: tfrag-h ;; dgos: GAME, ENGINE +;; definition of type tfragment-stats +(deftype tfragment-stats (structure) + ((num-tris uint16 4 :offset-assert 0) + (num-dverts uint16 4 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype tfragment-debug-data (structure) + ((stats tfragment-stats :inline :offset-assert 0) + (debug-lines basic :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +(deftype generic-tfragment (structure) + ((dummy int32 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +(deftype tfragment (drawable) + ((color-index uint16 :offset 6) + (debug-data tfragment-debug-data :offset 8) + (color-indices uint32 :offset 12) + (colors uint32 :offset 12) + (dma-chain uint32 3 :offset-assert 32) + (dma-common uint32 :offset 32) + (dma-level-0 uint32 :offset 32) + (dma-base uint32 :offset 36) + (dma-level-1 uint32 :offset 40) + (dma-qwc uint32 4 :offset-assert 44) + (shader uint32 :offset 48) + (num-shaders uint8 :offset 52) + (num-base-colors uint8 :offset 53) + (num-level0-colors uint8 :offset 54) + (num-level1-colors uint8 :offset 55) + (color-offset uint8 :offset 56) + (color-count uint8 :offset 57) + (pad0 uint8 :offset 58) + (pad1 uint8 :offset 59) + (generic generic-tfragment :offset-assert 60) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + ) + +(deftype drawable-inline-array-tfrag (drawable-inline-array) + ((data tfragment 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 96) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + ) + +(deftype drawable-inline-array-trans-tfrag (drawable-inline-array-tfrag) + ((data2 tfragment 1 :inline :offset-assert 112) + (pad2 uint32 :offset-assert 176) + ) + :method-count-assert 18 + :size-assert #xb4 + :flag-assert #x12000000b4 + ) + +(deftype drawable-tree-tfrag (drawable-tree) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-trans-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-dirt-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-ice-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-lowres-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype drawable-tree-lowres-trans-tfrag (drawable-tree-trans-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype tfrag-dists (structure) + ((data uint32 16 :offset-assert 0) + (vector vector 4 :inline :offset 0) + (k0s uint128 2 :offset 0) + (k1s uint128 2 :offset 32) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +(deftype tfrag-data (structure) + ((data uint32 56 :offset 0) + (vector vector 14 :inline :offset 0) + (fog vector :inline :offset 0) + (val vector :inline :offset 16) + (strgif qword :inline :offset 32) + (fangif qword :inline :offset 48) + (adgif qword :inline :offset 64) + (hvdf-offset vector :inline :offset 80) + (hmge-scale vector :inline :offset 96) + (invh-scale vector :inline :offset 112) + (ambient vector :inline :offset 128) + (guard vector :inline :offset 144) + (dists tfrag-dists :inline :offset 160) + (k0s uint128 2 :offset 160) + (k1s uint128 2 :offset 192) + ) + :method-count-assert 9 + :size-assert #xe0 + :flag-assert #x9000000e0 + ) + +(deftype tfrag-control (structure) + ((num-base-points uint32 :offset-assert 0) + (num-shared-base-points uint32 :offset-assert 4) + (num-level0-points uint32 :offset-assert 8) + (num-shared-level0-points uint32 :offset-assert 12) + (num-level1-points uint32 :offset-assert 16) + (num-shared-level1-points uint32 :offset-assert 20) + (ptr-vtxdata uint32 :offset-assert 24) + (ptr-base-points uint32 :offset-assert 28) + (ptr-shared-base-points uint32 :offset-assert 32) + (ptr-level0-points uint32 :offset-assert 36) + (ptr-shared-level0-points uint32 :offset-assert 40) + (ptr-level1-points uint32 :offset-assert 44) + (ptr-shared-level1-points uint32 :offset-assert 48) + (ptr-draw-points uint32 :offset-assert 52) + (ptr-interpolated-0 uint32 :offset-assert 56) + (ptr-shared-interpolated-0 uint32 :offset-assert 60) + (ptr-interpolated1 uint32 :offset-assert 64) + (ptr-shared-interpolated1 uint32 :offset-assert 68) + (ptr-strip-data uint32 :offset-assert 72) + (ptr-texture-data uint32 :offset-assert 76) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + ) + +(deftype tfrag-stats (structure) + ((from int32 :offset-assert 0) + (to int32 :offset-assert 4) + (cnt int32 :offset-assert 8) + (tris int32 :offset-assert 12) + (tfaces int32 :offset-assert 16) + (tfrags int32 :offset-assert 20) + (dtris int32 :offset-assert 24) + (base-verts int32 :offset-assert 28) + (level0-verts int32 :offset-assert 32) + (level1-verts int32 :offset-assert 36) + (dma-cnt int32 :offset-assert 40) + (dma-dta int32 :offset-assert 44) + (dma-tex int32 :offset-assert 48) + (strips int32 :offset-assert 52) + (drawpoints int32 :offset-assert 56) + (vif int32 :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +(deftype tfrag-packet (structure) + ((tag uint128 2 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +(deftype tfrag-work (structure) + ((base-tmpl dma-packet :inline :offset-assert 0) + (level-0-tmpl dma-packet :inline :offset-assert 16) + (common-tmpl dma-packet :inline :offset-assert 32) + (level-1-tmpl dma-packet :inline :offset-assert 48) + (color-tmpl dma-packet :inline :offset-assert 64) + (frag-dists vector :inline :offset-assert 80) + (max-dist vector :inline :offset-assert 96) + (min-dist vector :inline :offset-assert 112) + (color-ptr vector4w :inline :offset-assert 128) + (tr-stat-tfrag tr-stat :offset-assert 144) + (tr-stat-tfrag-near tr-stat :offset-assert 148) + (vu1-enable-tfrag int32 :offset-assert 152) + (vu1-enable-tfrag-near int32 :offset-assert 156) + (cur-vis-bits uint32 :offset-assert 160) + (end-vis-bits uint32 :offset-assert 164) + (src-ptr uint32 :offset-assert 168) + (last-call uint32 :offset-assert 172) + (dma-buffer basic :offset-assert 176) + (test-id uint32 :offset-assert 180) + (wait-from-spr uint32 :offset-assert 184) + (wait-to-spr uint32 :offset-assert 188) + (near-wait-from-spr uint32 :offset-assert 192) + (near-wait-to-spr uint32 :offset-assert 196) + ) + :method-count-assert 9 + :size-assert #xc8 + :flag-assert #x9000000c8 + ) + +(deftype tfrag-dma (structure) + ((banka tfragment 16 :inline :offset-assert 0) + (bankb tfragment 16 :inline :offset-assert 1024) + (outa uint128 128 :offset-assert 2048) + (outb uint128 128 :offset-assert 4096) + (colors rgba 2047 :offset-assert 6144) + ) + :method-count-assert 9 + :size-assert #x37fc + :flag-assert #x9000037fc + ) diff --git a/goal_src/engine/gfx/tie/tie-h.gc b/goal_src/engine/gfx/tie/tie-h.gc index a806245d1d..7adbab273c 100644 --- a/goal_src/engine/gfx/tie/tie-h.gc +++ b/goal_src/engine/gfx/tie/tie-h.gc @@ -5,3 +5,178 @@ ;; name in dgo: tie-h ;; dgos: GAME, ENGINE +(deftype tie-fragment (drawable) + ((gif-ref uint32 :offset 4) + (point-ref uint32 :offset 8) + (color-index uint16 :offset 12) + (base-colors uint8 :offset 14) + (tex-count uint16 :offset-assert 32) + (gif-count uint16 :offset-assert 34) + (vertex-count uint16 :offset-assert 36) + (color-count uint16 :offset-assert 38) + (num-tris uint16 :offset-assert 40) + (num-dverts uint16 :offset-assert 42) + (dp-ref uint32 :offset-assert 44) + (dp-qwc uint32 :offset-assert 48) + (generic-ref uint32 :offset-assert 52) + (generic-count uint32 :offset-assert 56) + (debug-lines basic :offset-assert 60) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + ) + +(deftype instance-tie (instance) + ((color-indices uint32 :offset 8) + (bucket-ptr basic :offset 12) + (max-scale uint16 :offset 38) + (flags uint16 :offset 46) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + ) + +(deftype drawable-inline-array-instance-tie (drawable-inline-array) + ((data instance-tie 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 96) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + ) + +(deftype drawable-tree-instance-tie (drawable-tree) + ((length int16 :offset 6) + (prototypes basic :offset 8) + ;; todo - maybe another data field + ) + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +(deftype prototype-tie (drawable-inline-array) + ((data instance-tie 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 96) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + ) + +(deftype tie-matrix (structure) + ((mat matrix :inline :offset-assert 0) + (morph qword :inline :offset-assert 64) + (fog qword :inline :offset-assert 80) + ) + :method-count-assert 9 + :size-assert #x60 + :flag-assert #x900000060 + ) + +(deftype instance-tie-work (structure) + ((wind-const vector :inline :offset-assert 0) + (hmge-d vector :inline :offset-assert 16) + (hvdf-offset vector :inline :offset-assert 32) + (wind-force vector :inline :offset-assert 48) + (constant vector :inline :offset-assert 64) + (far-morph vector :inline :offset-assert 80) + (dist-test vector :inline :offset-assert 96) + (min-dist vector :inline :offset-assert 112) + (guard-plane plane 4 :inline :offset-assert 128) + (upload-color-0 dma-packet :inline :offset-assert 192) + (upload-color-1 dma-packet :inline :offset-assert 208) + (upload-color-2 dma-packet :inline :offset-assert 224) + (upload-color-ret dma-packet :inline :offset-assert 240) + (upload-color-temp dma-packet :inline :offset-assert 256) + (generic-color-0 dma-packet :inline :offset-assert 272) + (generic-color-1 dma-packet :inline :offset-assert 288) + (generic-color-end dma-packet :inline :offset-assert 304) + (tie-near-perspective-matrix matrix :inline :offset-assert 320) + (wind-vectors uint32 :offset-assert 384) + (test-id uint32 :offset-assert 388) + (test-id2 uint32 :offset-assert 392) + (dma-buffer basic :offset-assert 396) + (to-spr uint32 :offset-assert 400) + (from-spr uint32 :offset-assert 404) + (wind-work uint32 :offset-assert 408) + (cur-vis-bits uint32 :offset-assert 412) + (end-vis-bits uint32 :offset-assert 416) + (first-generic-prototype uint32 :offset-assert 420) + (refl-fade-fac float :offset-assert 424) + (refl-fade-end float :offset-assert 428) + (flags uint32 :offset-assert 432) + (paused basic :offset-assert 436) + (wait-from-spr uint32 :offset-assert 440) + (wait-to-spr uint32 :offset-assert 444) + ) + :method-count-assert 9 + :size-assert #x1c0 + :flag-assert #x9000001c0 + ) + +(deftype instance-tie-dma (structure) + ((banka instance-tie 32 :inline :offset-assert 0) + (bankb instance-tie 32 :inline :offset-assert 2048) + (outa uint128 256 :offset-assert 4096) + (outb uint128 256 :offset-assert 8192) + (work instance-tie-work :dynamic :offset-assert 12288) ;; something weird here, this falls off the end of the type. + ) + :method-count-assert 9 + :size-assert #x3000 + :flag-assert #x900003000 + ) + +(deftype prototype-tie-work (structure) + ((upload-palette-0 dma-packet :inline :offset-assert 0) + (upload-palette-1 dma-packet :inline :offset-assert 16) + (upload-model-0 dma-packet :inline :offset-assert 32) + (upload-model-1 dma-packet :inline :offset-assert 48) + (upload-model-2 dma-packet :inline :offset-assert 64) + (upload-model-3 dma-packet :inline :offset-assert 80) + (upload-model-near-0 dma-packet :inline :offset-assert 96) + (upload-model-near-1 dma-packet :inline :offset-assert 112) + (upload-model-near-2 dma-packet :inline :offset-assert 128) + (upload-model-near-3 dma-packet :inline :offset-assert 144) + (upload-model-near-4 dma-packet :inline :offset-assert 160) + (generic-envmap-shader dma-packet :inline :offset-assert 176) + (generic-palette dma-packet :inline :offset-assert 192) + (generic-model-0 dma-packet :inline :offset-assert 208) + (generic-model-1 dma-packet :inline :offset-assert 224) + (generic-model-2 dma-packet :inline :offset-assert 240) + (generic-model-next dma-packet :inline :offset-assert 256) + (clamp uint64 :offset-assert 272) + (prototype-array basic :offset-assert 280) + (generic-wait-from-spr uint32 :offset-assert 284) + (generic-wait-to-spr uint32 :offset-assert 288) + (wait-from-spr uint32 :offset-assert 292) + (wait-to-spr uint32 :offset-assert 296) + (near-wait-from-spr uint32 :offset-assert 300) + (near-wait-to-spr uint32 :offset-assert 304) + ) + :method-count-assert 9 + :size-assert #x134 + :flag-assert #x900000134 + ) + +(deftype prototype-tie-dma (structure) + ((colora rgba 256 :offset-assert 0) + (colorb rgba 256 :offset-assert 1024) + (outa uint128 256 :offset-assert 2048) + (outb uint128 256 :offset-assert 6144) + (length uint32 :offset-assert 10240) + (dma-buffer basic :offset-assert 10244) + (this-frag-count uint32 :offset-assert 10248) + (next uint32 4 :offset 10256) + (geometry uint32 4 :offset-assert 10272) + (frag-count uint8 4 :offset-assert 10288) + ) + :method-count-assert 9 + :size-assert #x2834 + :flag-assert #x900002834 + ) + +;; probably a more specific type. +(define *instance-tie-work-copy* (the-as basic #f)) diff --git a/goal_src/engine/gfx/vis/bsp-h.gc b/goal_src/engine/gfx/vis/bsp-h.gc index 7a4cf87871..f42af51d8d 100644 --- a/goal_src/engine/gfx/vis/bsp-h.gc +++ b/goal_src/engine/gfx/vis/bsp-h.gc @@ -5,3 +5,159 @@ ;; name in dgo: bsp-h ;; dgos: GAME, ENGINE +(declare-type entity-camera basic) + +(deftype bsp-node (structure) + ((front int32 :offset-assert 0) + (back int32 :offset-assert 4) + (front-flags uint32 :offset-assert 8) + (back-flags uint32 :offset-assert 12) + (plane vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +(deftype bsp-header (drawable) + ((info file-info :offset 4) + (all-visible-list (pointer uint16) :offset-assert 32) + (visible-list-length int32 :offset-assert 36) + (drawable-trees drawable-tree-array :offset-assert 40) + (pat pointer :offset-assert 44) + (pat-length int32 :offset-assert 48) + (unk-data-0 pointer :offset-assert 52) + (unk-data-0-len int32 :offset-assert 56) + (unk-data-1 pointer :offset-assert 60) + (unk-data-1-len int32 :offset-assert 64) + (unk-zero-0 uint32 :offset-assert 68) + (name symbol :offset-assert 72) + (nickname symbol :offset-assert 76) + (vis-info level-vis-info 8 :offset-assert 80) + (actors drawable-inline-array-actor :offset-assert 112) + (cameras (array entity-camera) :offset-assert 116) + (nodes (inline-array bsp-node) :offset-assert 120) + (level level :offset-assert 124) + (unk-data-2 uint32 5 :offset-assert 128) + (boxes box8s-array :offset-assert 148) + (unk-data-3 uint32 :offset-assert 152) + (ambients drawable-inline-array-ambient :offset-assert 156) + (unk-data-4 uint32 :offset-assert 160) + (unk-data-5 uint32 :offset-assert 164) + (adgifs adgif-shader-array :offset-assert 168) + (unk-data-6 pointer :offset-assert 172) + (unk-data-7 pointer :offset-assert 176) + (unk-data-8 uint32 55 :offset-assert 180) + ) + :method-count-assert 20 + :size-assert #x190 + :flag-assert #x1400000190 + (:methods + (dummy-18 () none 18) + (dummy-19 () none 19) + ) + ) + +(deftype game-level (basic) + ((master-bsp basic :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +(deftype view-frustum (structure) + ((hither-top-left vector :inline :offset-assert 0) + (hither-top-right vector :inline :offset-assert 16) + (hither-bottom-left vector :inline :offset-assert 32) + (hither-bottom-right vector :inline :offset-assert 48) + (yon-top-left vector :inline :offset-assert 64) + (yon-top-right vector :inline :offset-assert 80) + (yon-bottom-left vector :inline :offset-assert 96) + (yon-bottom-right vector :inline :offset-assert 112) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) +(define-extern inspect-bsp-tree (function bsp-header bsp-node none)) + +(defmethod inspect bsp-header ((obj bsp-header)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tall-visible-list: #x~X~%" (-> obj all-visible-list)) + (format #t "~Tvisible-list-length: ~D~%" (-> obj visible-list-length)) + (format #t "~Tdrawable-trees: ~A~%" (-> obj drawable-trees)) + (format #t "~Tpat: #x~X~%" (-> obj pat)) + (format #t "~Tpat-length: ~D~%" (-> obj pat-length)) + (inspect-bsp-tree obj (the-as bsp-node (-> obj nodes))) + obj + ) + +(defun-debug inspect-bsp-tree ((arg0 bsp-header) (arg1 bsp-node)) + (cond + ((zero? arg1) + ) + (else + (format #t "_#x~X________________~%" arg1) + (inspect arg1) + (let ((s4-0 *print-column*)) + (set! *print-column* (+ *print-column* 8)) + (if (> (-> arg1 front) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 front))) + (format #t "_#x~X________________~%" arg1) + ) + (if (> (-> arg1 back) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 back))) + (format #t "_#x~X________________~%" arg1) + ) + (set! *print-column* s4-0) + ) + ) + ) + (none) + ) + +(define-extern map-bsp-tree (function (function bsp-node none) bsp-header bsp-node none)) +(defun map-bsp-tree ((arg0 (function bsp-node none)) (arg1 bsp-header) (arg2 bsp-node)) + (cond + ((zero? arg2) + ) + (else + (if (> (-> arg2 front) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 front))) + (arg0 arg2) + ) + (if (> (-> arg2 back) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 back))) + (arg0 arg2) + ) + ) + ) + (none) + ) + +(deftype cl-stat (structure) + ((fragments uint32 :offset-assert 0) + (tris uint32 :offset-assert 4) + (output uint32 :offset-assert 8) + ) + :pack-me + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +(deftype collide-stats (structure) + ((other cl-stat :inline :offset-assert 0) + (total cl-stat :inline :offset-assert 12) + (nodes uint32 :offset-assert 24) + (calls uint32 :offset-assert 28) + (total-target stopwatch :inline :offset-assert 32) + (target-cache-fill stopwatch :inline :offset-assert 64) + (target-ray-poly stopwatch :inline :offset-assert 96) + (pad uint32 :offset-assert 124) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) diff --git a/goal_src/engine/level/level-h.gc b/goal_src/engine/level/level-h.gc index 344ca9fdf5..12e151577a 100644 --- a/goal_src/engine/level/level-h.gc +++ b/goal_src/engine/level/level-h.gc @@ -121,6 +121,7 @@ :flag-assert #x900000050 ) +(declare-type bsp-header basic) ;; Per level-buffer info about the current loaded level. (deftype level (basic) ((name basic :offset-assert 4) @@ -130,7 +131,7 @@ (status basic :offset-assert 20) (other basic :offset-assert 24) (heap kheap :inline :offset-assert 32) - (bsp basic :offset-assert 48) + (bsp bsp-header :offset-assert 48) (art-group basic :offset-assert 52) (info basic :offset-assert 56) (texture-page texture-page 9 :offset-assert 60) diff --git a/goal_src/engine/sparticle/sparticle-h.gc b/goal_src/engine/sparticle/sparticle-h.gc index e1a829106f..feff9a13ef 100644 --- a/goal_src/engine/sparticle/sparticle-h.gc +++ b/goal_src/engine/sparticle/sparticle-h.gc @@ -5,3 +5,79 @@ ;; name in dgo: sparticle-h ;; dgos: GAME, ENGINE +(define *sp-frame-time* (new 'global 'vector)) + +(let ((v1-1 *sp-frame-time*)) + (set! (-> v1-1 x) 0.00000000000000000000000000000000000001175495) + (set! (-> v1-1 y) 5.0) + (set! (-> v1-1 z) 1.0) + (set! (-> v1-1 w) 1.0) + ) + +(define *sp-60-hz* #t) + +(deftype sparticle-cpuinfo (structure) + ((sprite sprite-vec-data-2d :offset-assert 0) + (adgif adgif-shader :offset-assert 4) + (radius float :offset-assert 8) + (omega float :offset-assert 12) + (vel-sxvel vector :inline :offset-assert 16) + (rot-syvel vector :inline :offset-assert 32) + (fade rgbaf :inline :offset-assert 48) + (acc vector :inline :offset-assert 64) + (rotvel3d quaternion :inline :offset-assert 80) + (vel vector3s :inline :offset 16) + (accel vector3s :inline :offset 64) + (scalevelx float :offset 28) + (scalevely float :offset 44) + (friction float :offset-assert 96) + (timer int32 :offset-assert 100) + (flags uint32 :offset-assert 104) + (user-int32 int32 :offset-assert 108) + (user-uint32 uint32 :offset 108) + (user-float float :offset 108) + (user-pntr uint32 :offset 108) + (user-sprite sprite-vec-data-2d :offset 108) + (func basic :offset-assert 112) + (next-time uint32 :offset-assert 116) + (next-launcher basic :offset-assert 120) + (cache-alpha float :offset-assert 124) + (valid basic :offset-assert 128) + (key basic :offset-assert 132) + (binding sparticle-launch-state :offset-assert 136) + (data uint32 1 :offset 12) + (dataf float 1 :offset 12) + (datac uint8 1 :offset 12) + ) + :method-count-assert 9 + :size-assert #x8c + :flag-assert #x90000008c + ) + +(deftype sparticle-launchinfo (structure) + ((launchrot vector :inline :offset-assert 0) + (conerot vector :inline :offset-assert 16) + (coneradius float :offset-assert 32) + (rotate-y float :offset-assert 36) + (data uint8 1 :offset 0) + ) + :method-count-assert 9 + :size-assert #x28 + :flag-assert #x900000028 + ) + +(deftype sparticle-system (basic) + ((blocks uint32 2 :offset-assert 4) + (length uint32 2 :offset-assert 12) + (num-alloc uint32 2 :offset-assert 20) + (is-3d basic :offset-assert 28) + (flags uint32 :offset-assert 32) + (alloc-table uint32 :offset-assert 36) + (cpuinfo-table uint32 :offset-assert 40) + (vecdata-table uint32 :offset-assert 44) + (adgifdata-table uint32 :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) diff --git a/goal_src/engine/sparticle/sparticle-launcher-h.gc b/goal_src/engine/sparticle/sparticle-launcher-h.gc index daf53e1860..834eb18272 100644 --- a/goal_src/engine/sparticle/sparticle-launcher-h.gc +++ b/goal_src/engine/sparticle/sparticle-launcher-h.gc @@ -5,3 +5,111 @@ ;; name in dgo: sparticle-launcher-h ;; dgos: GAME, ENGINE +(deftype sp-field-init-spec (structure) + ((field uint16 :offset-assert 0) + (flags uint16 :offset-assert 2) + (initial-valuef float :offset-assert 4) + (random-rangef float :offset-assert 8) + (random-multf float :offset-assert 12) + (initial-value int32 :offset 4) + (random-range int32 :offset 8) + (random-mult int32 :offset 12) + (func basic :offset 4) + (tex uint32 :offset 4) + (pntr uint32 :offset 4) + (sym basic :offset 4) + (sound basic :offset 4) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype sparticle-launcher (basic) + ((birthaccum float :offset-assert 4) + (soundaccum float :offset-assert 8) + (init-specs uint32 :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype sparticle-group-item (structure) + ((launcher uint32 :offset-assert 0) + (fade-after float :offset-assert 4) + (falloff-to float :offset-assert 8) + (flags uint16 :offset-assert 12) + (period uint16 :offset-assert 14) + (length uint16 :offset-assert 16) + (offset uint16 :offset-assert 18) + (hour-mask uint32 :offset-assert 20) + (binding uint32 :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + +(deftype sparticle-launch-state (structure) + ((group-item sparticle-group-item :offset-assert 0) + (flags uint16 :offset-assert 4) + (randomize uint16 :offset-assert 6) + (origin vector :offset-assert 8) + (sprite3d sprite-vec-data-3d :offset-assert 12) + (sprite basic :offset-assert 16) + (offset uint32 :offset-assert 20) + (accum float :offset-assert 24) + (spawn-time uint32 :offset-assert 28) + (swarm basic :offset 20) + (seed uint32 :offset 24) + (time uint32 :offset 28) + (spec basic :offset 16) + (id uint32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +(deftype sparticle-launch-group (basic) + ((length int16 :offset-assert 4) + (duration uint16 :offset-assert 6) + (linger-duration uint16 :offset-assert 8) + (flags uint16 :offset-assert 10) + (name basic :offset-assert 12) + (launcher uint32 :offset-assert 16) + (bounds sphere :inline :offset-assert 32) + ) + :method-count-assert 10 + :size-assert #x30 + :flag-assert #xa00000030 + (:methods + (dummy-9 () none 9) + ) + ) + +(deftype sparticle-launch-control (inline-array-class) + ((group basic :offset-assert 16) + (proc basic :offset-assert 20) + (local-clock int32 :offset-assert 24) + (fade float :offset-assert 28) + (matrix int32 :offset-assert 32) + (last-spawn-frame int32 :offset-assert 36) + (last-spawn-time int32 :offset-assert 40) + (center vector :inline :offset-assert 48) + (data uint8 :dynamic :offset-assert 64) + ) + :method-count-assert 14 + :size-assert #x40 + :flag-assert #xe00000040 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + ) + ) + +(set! (-> sparticle-launch-control heap-base) (the-as uint 32)) diff --git a/goalc/compiler/Compiler.cpp b/goalc/compiler/Compiler.cpp index ca33c273f0..edc4c59f10 100644 --- a/goalc/compiler/Compiler.cpp +++ b/goalc/compiler/Compiler.cpp @@ -144,8 +144,9 @@ std::unique_ptr Compiler::compile_top_level_function(const std::str } if (!fe->code().empty()) { - fe->emit_ir(); // add this line + fe->emit_ir(); } + fe->finish(); return fe; } diff --git a/test/decompiler/reference/all_forward_declarations.gc b/test/decompiler/reference/all_forward_declarations.gc index 251635c07c..f9fe40d606 100644 --- a/test/decompiler/reference/all_forward_declarations.gc +++ b/test/decompiler/reference/all_forward_declarations.gc @@ -832,3 +832,73 @@ (define-extern *camera-look-through-other* int) (define-extern *camera-other-trans* vector) (define-extern *camera-other-root* vector) + +(declare-type bsp-header basic) +(declare-type bsp-node structure) +(define-extern inspect-bsp-tree (function bsp-header bsp-node none)) +(declare-type entity-camera basic) +(define-extern map-bsp-tree (function (function bsp-node none) bsp-header bsp-node none)) + + +(deftype vif-tag (uint32) + ((imm uint16 :offset 0 :size 16) + (num uint8 :offset 16 :size 8) + (cmd vif-cmd :offset 24 :size 7) + (irq uint8 :offset 31 :size 1) + (msk uint8 :offset 28 :size 1) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +(deftype dma-tag (uint64) + ((qwc uint16 :offset 0) ;; quadword count + (pce uint8 :offset 26 :size 2) ;; priority (source mode) + (id dma-tag-id :offset 28 :size 3) ;; ID (what the tag means) + (irq uint8 :offset 31 :size 1) ;; interrupt at the end? + (addr uint32 :offset 32 :size 31) ;; address (31 bits) + (spr uint8 :offset 63 :size 1) ;; spr or not flag. + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +(deftype dma-packet (structure) + ((dma dma-tag :offset-assert 0) + (vif0 vif-tag :offset-assert 8) + (vif1 vif-tag :offset-assert 12) + (quad uint128 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype shadow-data (structure) + ((texoffset vector :inline :offset-assert 0) + (texscale vector :inline :offset-assert 16) + (clrs uint128 2 :offset-assert 32) + (dma-unpack-template dma-packet :inline :offset-assert 64) + (dma-cnt uint64 :offset-assert 80) + (vif-nop uint32 :offset-assert 88) + (vif-unpack-v4-8 uint32 :offset-assert 92) + (pdc basic :offset-assert 96) + (dist float :offset-assert 100) + (oddeven uint8 :offset-assert 104) + (waits uint32 :offset-assert 108) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +(deftype shadow-work (structure) + ((shadow-data shadow-data :inline :offset-assert 0) + (inbuf uint128 600 :offset-assert 112) + ) + :method-count-assert 9 + :size-assert #x25f0 + :flag-assert #x9000025f0 + ) diff --git a/test/decompiler/reference/engine/collide/collide-cache-h_REF.gc b/test/decompiler/reference/engine/collide/collide-cache-h_REF.gc new file mode 100644 index 0000000000..da6119293c --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-cache-h_REF.gc @@ -0,0 +1,310 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type collide-using-spheres-params +(deftype collide-using-spheres-params (structure) + ((spheres uint32 :offset-assert 0) + (num-spheres uint32 :offset-assert 4) + (collide-with uint64 :offset-assert 8) + (proc basic :offset-assert 16) + (ignore-pat uint32 :offset-assert 20) + (solid-only basic :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + +;; definition for method 3 of type collide-using-spheres-params +(defmethod + inspect + collide-using-spheres-params + ((obj collide-using-spheres-params)) + (format #t "[~8x] ~A~%" obj 'collide-using-spheres-params) + (format #t "~Tspheres: #x~X~%" (-> obj spheres)) + (format #t "~Tnum-spheres: ~D~%" (-> obj num-spheres)) + (format #t "~Tcollide-with: ~D~%" (-> obj collide-with)) + (format #t "~Tproc: ~A~%" (-> obj proc)) + (format #t "~Tignore-pat: ~D~%" (-> obj ignore-pat)) + (format #t "~Tsolid-only: ~A~%" (-> obj solid-only)) + obj + ) + +;; definition of type collide-puss-sphere +(deftype collide-puss-sphere (structure) + ((bsphere sphere :inline :offset-assert 0) + (bbox4w bounding-box4w :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type collide-puss-sphere +(defmethod inspect collide-puss-sphere ((obj collide-puss-sphere)) + (format #t "[~8x] ~A~%" obj 'collide-puss-sphere) + (format #t "~Tbsphere: #~%" (-> obj bsphere)) + (format #t "~Tbbox4w: #~%" (-> obj bbox4w)) + obj + ) + +;; definition of type collide-puss-work +(deftype collide-puss-work (structure) + ((closest-pt vector :inline :offset-assert 0) + (tri-normal vector :inline :offset-assert 16) + (tri-bbox4w bounding-box4w :inline :offset-assert 32) + (spheres-bbox4w bounding-box4w :inline :offset-assert 64) + (spheres collide-puss-sphere 64 :inline :offset-assert 96) + ) + :method-count-assert 11 + :size-assert #xc60 + :flag-assert #xb00000c60 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + ) + ) + +;; definition for method 3 of type collide-puss-work +(defmethod inspect collide-puss-work ((obj collide-puss-work)) + (format #t "[~8x] ~A~%" obj 'collide-puss-work) + (format #t "~Tclosest-pt: #~%" (-> obj closest-pt)) + (format #t "~Ttri-normal: #~%" (-> obj tri-normal)) + (format #t "~Ttri-bbox4w: #~%" (-> obj tri-bbox4w)) + (format + #t + "~Tspheres-bbox4w: #~%" + (-> obj spheres-bbox4w) + ) + (format #t "~Tspheres[64] @ #x~X~%" (-> obj spheres)) + obj + ) + +;; definition of type collide-puyp-work +(deftype collide-puyp-work (structure) + ((best-u float :offset-assert 0) + (ignore-pat uint32 :offset-assert 4) + (tri-out collide-tri-result :offset-assert 8) + (start-pos vector :inline :offset-assert 16) + (move-dist vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type collide-puyp-work +(defmethod inspect collide-puyp-work ((obj collide-puyp-work)) + (format #t "[~8x] ~A~%" obj 'collide-puyp-work) + (format #t "~Tbest-u: ~f~%" (-> obj best-u)) + (format #t "~Tignore-pat: ~D~%" (-> obj ignore-pat)) + (format #t "~Ttri-out: #~%" (-> obj tri-out)) + (format #t "~Tstart-pos: #~%" (-> obj start-pos)) + (format #t "~Tmove-dist: #~%" (-> obj move-dist)) + obj + ) + +;; definition of type collide-cache-tri +(deftype collide-cache-tri (structure) + ((vertex vector 3 :inline :offset-assert 0) + (pat uint32 :offset-assert 48) + (prim-index uint16 :offset-assert 52) + (user16 uint16 :offset-assert 54) + (user32 uint32 2 :offset-assert 56) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +;; definition for method 3 of type collide-cache-tri +(defmethod inspect collide-cache-tri ((obj collide-cache-tri)) + (format #t "[~8x] ~A~%" obj 'collide-cache-tri) + (format #t "~Tvertex[3] @ #x~X~%" (-> obj vertex)) + (format #t "~Textra-quad[16] @ #x~X~%" (&-> obj pat)) + (format #t "~Tpat: ~D~%" (-> obj pat)) + (format #t "~Tprim-index: ~D~%" (-> obj prim-index)) + (format #t "~Tuser16: ~D~%" (-> obj user16)) + (format #t "~Tuser32[2] @ #x~X~%" (-> obj user32)) + obj + ) + +;; definition of type collide-cache-prim +(deftype collide-cache-prim (structure) + ((prim-core collide-prim-core :inline :offset-assert 0) + (ccache basic :offset-assert 32) + (prim basic :offset-assert 36) + (first-tri uint16 :offset-assert 40) + (num-tris uint16 :offset-assert 42) + (unused uint8 4 :offset-assert 44) + (world-sphere vector :inline :offset 0) + (collide-as uint64 :offset 16) + (action uint32 :offset 24) + (offense int8 :offset 28) + (prim-type int8 :offset 29) + ) + :method-count-assert 11 + :size-assert #x30 + :flag-assert #xb00000030 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + ) + ) + +;; definition for method 3 of type collide-cache-prim +(defmethod inspect collide-cache-prim ((obj collide-cache-prim)) + (format #t "[~8x] ~A~%" obj 'collide-cache-prim) + (format #t "~Tprim-core: #~%" (-> obj prim-core)) + (format #t "~Textra-quad[16] @ #x~X~%" (&-> obj ccache)) + (format #t "~Tccache: ~A~%" (-> obj ccache)) + (format #t "~Tprim: ~A~%" (-> obj prim)) + (format #t "~Tfirst-tri: ~D~%" (-> obj first-tri)) + (format #t "~Tnum-tris: ~D~%" (-> obj num-tris)) + (format #t "~Tunused[4] @ #x~X~%" (-> obj unused)) + (format #t "~Tworld-sphere: ~`vector`P~%" (-> obj prim-core)) + (format #t "~Tcollide-as: ~D~%" (-> obj prim-core collide-as)) + (format #t "~Taction: ~D~%" (-> obj prim-core action)) + (format #t "~Toffense: ~D~%" (-> obj prim-core offense)) + (format #t "~Tprim-type: ~D~%" (-> obj prim-core prim-type)) + obj + ) + +;; definition of type collide-cache +(deftype collide-cache (basic) + ((num-tris int32 :offset-assert 4) + (num-prims int32 :offset-assert 8) + (ignore-mask uint32 :offset-assert 12) + (proc basic :offset-assert 16) + (collide-box bounding-box :inline :offset-assert 32) + (collide-box4w bounding-box4w :inline :offset-assert 64) + (collide-with uint64 :offset-assert 96) + (prims collide-cache-prim 100 :inline :offset-assert 112) + (tris collide-cache-tri 461 :inline :offset-assert 4912) + ) + :method-count-assert 33 + :size-assert #x8670 + :flag-assert #x2100008670 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-16 () none 16) + (dummy-17 () none 17) + (dummy-18 () none 18) + (dummy-19 () none 19) + (dummy-20 () none 20) + (dummy-21 () none 21) + (dummy-22 () none 22) + (dummy-23 () none 23) + (dummy-24 () none 24) + (dummy-25 () none 25) + (dummy-26 () none 26) + (dummy-27 () none 27) + (dummy-28 () none 28) + (dummy-29 () none 29) + (dummy-30 () none 30) + (dummy-31 () none 31) + (dummy-32 () none 32) + ) + ) + +;; definition for method 3 of type collide-cache +(defmethod inspect collide-cache ((obj collide-cache)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tnum-tris: ~D~%" (-> obj num-tris)) + (format #t "~Tnum-prims: ~D~%" (-> obj num-prims)) + (format #t "~Tignore-mask: ~D~%" (-> obj ignore-mask)) + (format #t "~Tproc: ~A~%" (-> obj proc)) + (format #t "~Tcollide-box: #~%" (-> obj collide-box)) + (format + #t + "~Tcollide-box4w: #~%" + (-> obj collide-box4w) + ) + (format #t "~Tcollide-with: ~D~%" (-> obj collide-with)) + (format #t "~Tprims[100] @ #x~X~%" (-> obj prims)) + (format #t "~Ttris[461] @ #x~X~%" (-> obj tris)) + obj + ) + +;; definition of type collide-list-item +(deftype collide-list-item (structure) + ((mesh basic :offset-assert 0) + (inst basic :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type collide-list-item +(defmethod inspect collide-list-item ((obj collide-list-item)) + (format #t "[~8x] ~A~%" obj 'collide-list-item) + (format #t "~Tmesh: ~A~%" (-> obj mesh)) + (format #t "~Tinst: ~A~%" (-> obj inst)) + obj + ) + +;; definition of type collide-list +(deftype collide-list (structure) + ((num-items int32 :offset-assert 0) + (items collide-list-item 256 :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x1010 + :flag-assert #x900001010 + ) + +;; definition for method 3 of type collide-list +(defmethod inspect collide-list ((obj collide-list)) + (format #t "[~8x] ~A~%" obj 'collide-list) + (format #t "~Tnum-items: ~D~%" (-> obj num-items)) + (format #t "~Titems[256] @ #x~X~%" (-> obj items)) + obj + ) + +;; definition of type collide-work +(deftype collide-work (structure) + ((collide-sphere-neg-r sphere :inline :offset-assert 0) + (collide-box4w bounding-box4w :inline :offset-assert 16) + (inv-mat matrix :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +;; definition for method 3 of type collide-work +(defmethod inspect collide-work ((obj collide-work)) + (format #t "[~8x] ~A~%" obj 'collide-work) + (format + #t + "~Tcollide-sphere-neg-r: #~%" + (-> obj collide-sphere-neg-r) + ) + (format + #t + "~Tcollide-box4w: #~%" + (-> obj collide-box4w) + ) + (format #t "~Tinv-mat: #~%" (-> obj inv-mat)) + obj + ) + +;; definition (perm) for symbol *collide-work*, type collide-work +(define-perm *collide-work* collide-work (new 'global 'collide-work)) + +;; definition (perm) for symbol *collide-cache*, type collide-cache +(define-perm *collide-cache* collide-cache (new 'global 'collide-cache)) + +;; definition (perm) for symbol *collide-list*, type collide-list +(define-perm *collide-list* collide-list (new 'global 'collide-list)) + + + + diff --git a/test/decompiler/reference/engine/data/art-h_REF.gc b/test/decompiler/reference/engine/data/art-h_REF.gc index 7a0d94b6cf..c8d5416600 100644 --- a/test/decompiler/reference/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/engine/data/art-h_REF.gc @@ -273,7 +273,7 @@ (deftype art-joint-anim (art-element) ((speed float :offset 20) (artist-base float :offset 24) - (artiest-step float :offset 28) + (artist-step float :offset 28) (master-art-group-name basic :offset 32) (master-art-group-index int32 :offset 36) (frames pointer :offset 44) diff --git a/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc index e2f33046a8..f8c09c4ef2 100644 --- a/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc @@ -29,7 +29,8 @@ ;; definition of type drawable-inline-array-actor (deftype drawable-inline-array-actor (drawable-inline-array) - ((paid uint8 36 :offset-assert 32) + ((data drawable-actor 1 :inline :offset-assert 32) + (pad uint8 4 :offset-assert 64) ) :method-count-assert 18 :size-assert #x44 @@ -40,7 +41,3 @@ (defmethod dummy-10 drawable-tree-actor ((obj drawable-tree-actor)) 0 ) - - - - diff --git a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc index 410805eb1d..94f3a29f7e 100644 --- a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc @@ -32,7 +32,8 @@ ;; definition of type drawable-inline-array-ambient (deftype drawable-inline-array-ambient (drawable-inline-array) - ((paid uint8 36 :offset-assert 32) + ((data drawable-ambient 1 :inline :offset-assert 32) + (pad uint8 4 :offset-assert 64) ) :method-count-assert 18 :size-assert #x44 diff --git a/test/decompiler/reference/engine/draw/drawable-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-h_REF.gc index a7af31a58b..360e11af63 100644 --- a/test/decompiler/reference/engine/draw/drawable-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-h_REF.gc @@ -10,7 +10,7 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 () none 9) + (dummy-9 (_type_) _type_ 9) (dummy-10 (_type_) int 10) (dummy-11 () none 11) (dummy-12 () none 12) diff --git a/test/decompiler/reference/engine/entity/entity-h_REF.gc b/test/decompiler/reference/engine/entity/entity-h_REF.gc index 64299621e8..71b36f4a53 100644 --- a/test/decompiler/reference/engine/entity/entity-h_REF.gc +++ b/test/decompiler/reference/engine/entity/entity-h_REF.gc @@ -243,8 +243,8 @@ :size-assert #x50 :flag-assert #x1f00000050 (:methods - (dummy-27 () none 27) - (dummy-28 () none 28) + (next-actor (_type_) entity-actor 27) + (prev-actor (_type_) entity-actor 28) (dummy-29 () none 29) (dummy-30 () none 30) ) diff --git a/test/decompiler/reference/engine/gfx/background-h_REF.gc b/test/decompiler/reference/engine/gfx/background-h_REF.gc new file mode 100644 index 0000000000..1b667716d5 --- /dev/null +++ b/test/decompiler/reference/engine/gfx/background-h_REF.gc @@ -0,0 +1,88 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type background-work +(deftype background-work (basic) + ((tfrag-tree-count int32 :offset-assert 4) + (tfrag-trees drawable-tree-tfrag 8 :offset-assert 8) + (tfrag-levels level 8 :offset-assert 40) + (trans-tfrag-tree-count int32 :offset-assert 72) + (trans-tfrag-trees drawable-tree-trans-tfrag 8 :offset-assert 76) + (trans-tfrag-levels level 8 :offset-assert 108) + (dirt-tfrag-tree-count int32 :offset-assert 140) + (dirt-tfrag-trees drawable-tree-dirt-tfrag 8 :offset-assert 144) + (dirt-tfrag-levels level 8 :offset-assert 176) + (ice-tfrag-tree-count int32 :offset-assert 208) + (ice-tfrag-trees drawable-tree-ice-tfrag 8 :offset-assert 212) + (ice-tfrag-levels level 8 :offset-assert 244) + (lowres-tfrag-tree-count int32 :offset-assert 276) + (lowres-tfrag-trees drawable-tree-lowres-tfrag 8 :offset-assert 280) + (lowres-tfrag-levels level 8 :offset-assert 312) + (lowres-trans-tfrag-tree-count int32 :offset-assert 344) + (lowres-trans-tfrag-trees drawable-tree-trans-tfrag 8 :offset-assert 348) + (lowres-trans-tfrag-levels level 8 :offset-assert 380) + (shrub-tree-count int32 :offset-assert 412) + (shrub-trees drawable-tree-instance-shrub 8 :offset-assert 416) + (shrub-levels level 8 :offset-assert 448) + (tie-tree-count int32 :offset-assert 480) + (tie-trees drawable-tree-instance-tie 8 :offset-assert 484) + (tie-levels level 8 :offset-assert 516) + (tie-generic basic 8 :offset-assert 548) + (wait-to-vu0 uint32 :offset-assert 580) + ) + :method-count-assert 9 + :size-assert #x248 + :flag-assert #x900000248 + ) + +;; definition for method 3 of type background-work +(defmethod inspect background-work ((obj background-work)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Ttfrag-tree-count: ~D~%" (-> obj tfrag-tree-count)) + (format #t "~Ttfrag-trees[8] @ #x~X~%" (-> obj tfrag-trees)) + (format #t "~Ttfrag-levels[8] @ #x~X~%" (-> obj tfrag-levels)) + (format #t "~Ttrans-tfrag-tree-count: ~D~%" (-> obj trans-tfrag-tree-count)) + (format #t "~Ttrans-tfrag-trees[8] @ #x~X~%" (-> obj trans-tfrag-trees)) + (format #t "~Ttrans-tfrag-levels[8] @ #x~X~%" (-> obj trans-tfrag-levels)) + (format #t "~Tdirt-tfrag-tree-count: ~D~%" (-> obj dirt-tfrag-tree-count)) + (format #t "~Tdirt-tfrag-trees[8] @ #x~X~%" (-> obj dirt-tfrag-trees)) + (format #t "~Tdirt-tfrag-levels[8] @ #x~X~%" (-> obj dirt-tfrag-levels)) + (format #t "~Tice-tfrag-tree-count: ~D~%" (-> obj ice-tfrag-tree-count)) + (format #t "~Tice-tfrag-trees[8] @ #x~X~%" (-> obj ice-tfrag-trees)) + (format #t "~Tice-tfrag-levels[8] @ #x~X~%" (-> obj ice-tfrag-levels)) + (format #t "~Tlowres-tfrag-tree-count: ~D~%" (-> obj lowres-tfrag-tree-count)) + (format #t "~Tlowres-tfrag-trees[8] @ #x~X~%" (-> obj lowres-tfrag-trees)) + (format #t "~Tlowres-tfrag-levels[8] @ #x~X~%" (-> obj lowres-tfrag-levels)) + (format + #t + "~Tlowres-trans-tfrag-tree-count: ~D~%" + (-> obj lowres-trans-tfrag-tree-count) + ) + (format + #t + "~Tlowres-trans-tfrag-trees[8] @ #x~X~%" + (-> obj lowres-trans-tfrag-trees) + ) + (format + #t + "~Tlowres-trans-tfrag-levels[8] @ #x~X~%" + (-> obj lowres-trans-tfrag-levels) + ) + (format #t "~Tshrub-tree-count: ~D~%" (-> obj shrub-tree-count)) + (format #t "~Tshrub-trees[8] @ #x~X~%" (-> obj shrub-trees)) + (format #t "~Tshrub-levels[8] @ #x~X~%" (-> obj shrub-levels)) + (format #t "~Ttie-tree-count: ~D~%" (-> obj tie-tree-count)) + (format #t "~Ttie-trees[8] @ #x~X~%" (-> obj tie-trees)) + (format #t "~Ttie-levels[8] @ #x~X~%" (-> obj tie-levels)) + (format #t "~Ttie-generic[8] @ #x~X~%" (-> obj tie-generic)) + (format #t "~Twait-to-vu0: ~D~%" (-> obj wait-to-vu0)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-1 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/depth-cue-h_REF.gc b/test/decompiler/reference/engine/gfx/depth-cue-h_REF.gc new file mode 100644 index 0000000000..78500a5c7b --- /dev/null +++ b/test/decompiler/reference/engine/gfx/depth-cue-h_REF.gc @@ -0,0 +1,72 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type depth-cue-data +(deftype depth-cue-data (structure) + ((data vector :inline :offset-assert 0) + (sharpness float :offset 0) + (alpha float :offset 4) + (distance float :offset 8) + (w float :offset 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type depth-cue-data +(defmethod inspect depth-cue-data ((obj depth-cue-data)) + (format #t "[~8x] ~A~%" obj 'depth-cue-data) + (format #t "~Tdata: #~%" (-> obj data)) + (format #t "~Tsharpness: ~f~%" (-> obj data x)) + (format #t "~Talpha: ~f~%" (-> obj data y)) + (format #t "~Tdistance: ~f~%" (-> obj data z)) + (format #t "~Tw: ~f~%" (-> obj data w)) + obj + ) + +;; definition of type depth-cue-work +(deftype depth-cue-work (structure) + ((texture-strip-tmpl dma-gif-packet :inline :offset-assert 0) + (temp-strip-tmpl dma-gif-packet :inline :offset-assert 32) + (stencil-tmpl dma-gif-packet :inline :offset-assert 64) + (clear-color vector4w :inline :offset-assert 96) + (set-color vector4w :inline :offset-assert 112) + (draw-color vector4w :inline :offset-assert 128) + (depth depth-cue-data :offset-assert 144) + (front depth-cue-data :offset-assert 148) + ) + :method-count-assert 9 + :size-assert #x98 + :flag-assert #x900000098 + ) + +;; definition for method 3 of type depth-cue-work +(defmethod inspect depth-cue-work ((obj depth-cue-work)) + (format #t "[~8x] ~A~%" obj 'depth-cue-work) + (format + #t + "~Ttexture-strip-tmpl: #~%" + (-> obj texture-strip-tmpl) + ) + (format + #t + "~Ttemp-strip-tmpl: #~%" + (-> obj temp-strip-tmpl) + ) + (format #t "~Tstencil-tmpl: #~%" (-> obj stencil-tmpl)) + (format #t "~Tclear-color: #~%" (-> obj clear-color)) + (format #t "~Tset-color: #~%" (-> obj set-color)) + (format #t "~Tdraw-color: #~%" (-> obj draw-color)) + (format #t "~Tdepth: #~%" (-> obj depth)) + (format #t "~Tfront: #~%" (-> obj front)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-2 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc b/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc new file mode 100644 index 0000000000..79924600c5 --- /dev/null +++ b/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc @@ -0,0 +1,473 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type billboard +(deftype billboard (drawable) + ((flat adgif-shader :inline :offset-assert 32) + ) + :method-count-assert 18 + :size-assert #x70 + :flag-assert #x1200000070 + ) + +;; definition for method 3 of type billboard +(defmethod inspect billboard ((obj billboard)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tflat: #~%" (-> obj flat)) + obj + ) + +;; definition of type shrub-view-data +(deftype shrub-view-data (structure) + ((data uint128 3 :offset-assert 0) + (texture-giftag qword :inline :offset 0) + (consts vector :inline :offset 16) + (fog-clamp vector :inline :offset 32) + (tex-start-ptr int32 :offset 16) + (gifbufsum float :offset 16) + (mtx-buf-ptr int32 :offset 20) + (exp23 float :offset 20) + (fog-0 float :offset 24) + (fog-1 float :offset 28) + (fog-min float :offset 32) + (fog-max float :offset 36) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type shrub-view-data +(defmethod inspect shrub-view-data ((obj shrub-view-data)) + (format #t "[~8x] ~A~%" obj 'shrub-view-data) + (format #t "~Tdata[3] @ #x~X~%" (-> obj data)) + (format #t "~Ttexture-giftag: #~%" (-> obj data)) + (format #t "~Tconsts: #~%" (&-> obj data 1)) + (format #t "~Tfog-clamp: #~%" (&-> obj data 2)) + (format #t "~Ttex-start-ptr: ~D~%" (-> obj consts x)) + (format #t "~Tgifbufsum: ~f~%" (-> obj consts x)) + (format #t "~Tmtx-buf-ptr: ~D~%" (-> obj consts y)) + (format #t "~Texp23: ~f~%" (-> obj consts y)) + (format #t "~Tfog-0: ~f~%" (-> obj consts z)) + (format #t "~Tfog-1: ~f~%" (-> obj consts w)) + (format #t "~Tfog-min: ~f~%" (-> obj fog-clamp x)) + (format #t "~Tfog-max: ~f~%" (-> obj fog-clamp y)) + obj + ) + +;; definition of type shrubbery +(deftype shrubbery (drawable) + ((textures (inline-array adgif-shader) :offset 4) + (header qword :offset 8) + (obj-qwc uint8 :offset 12) + (vtx-qwc uint8 :offset 13) + (col-qwc uint8 :offset 14) + (stq-qwc uint8 :offset 15) + (obj uint32 :offset 16) + (vtx uint32 :offset 20) + (col uint32 :offset 24) + (stq uint32 :offset 28) + ) + :method-count-assert 18 + :size-assert #x20 + :flag-assert #x1200000020 + ) + +;; definition for method 3 of type shrubbery +(defmethod inspect shrubbery ((obj shrubbery)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Ttextures: #x~X~%" (-> obj textures)) + (format #t "~Theader: #~%" (-> obj header)) + (format #t "~Tobj-qwc: ~D~%" (-> obj obj-qwc)) + (format #t "~Tvtx-qwc: ~D~%" (-> obj vtx-qwc)) + (format #t "~Tcol-qwc: ~D~%" (-> obj col-qwc)) + (format #t "~Tstq-qwc: ~D~%" (-> obj stq-qwc)) + (format #t "~Tobj: #x~X~%" (-> obj bsphere x)) + (format #t "~Tvtx: #x~X~%" (-> obj bsphere y)) + (format #t "~Tcol: #x~X~%" (-> obj bsphere z)) + (format #t "~Tstq: #x~X~%" (-> obj bsphere w)) + obj + ) + +;; definition of type instance-shrubbery +(deftype instance-shrubbery (instance) + ((flat-normal vector :inline :offset-assert 64) + (flat-hwidth float :offset 76) + (color uint32 :offset 8) + ) + :method-count-assert 18 + :size-assert #x50 + :flag-assert #x1200000050 + ) + +;; definition for method 3 of type instance-shrubbery +(defmethod inspect instance-shrubbery ((obj instance-shrubbery)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tbucket-index: ~D~%" (-> obj bucket-index)) + (format #t "~Torigin: #~%" (-> obj origin)) + (format #t "~Twind-index: ~D~%" (-> obj wind-index)) + (format #t "~Tflat-normal: #~%" (-> obj flat-normal)) + (format #t "~Tflat-hwidth: ~f~%" (-> obj flat-normal w)) + (format #t "~Tcolor: ~D~%" (-> obj color)) + obj + ) + +;; definition of type drawable-inline-array-instance-shrub +(deftype drawable-inline-array-instance-shrub (drawable-inline-array) + ((data instance-shrubbery 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 112) + ) + :method-count-assert 18 + :size-assert #x74 + :flag-assert #x1200000074 + ) + +;; definition of type drawable-tree-instance-shrub +(deftype drawable-tree-instance-shrub (drawable-tree) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type generic-shrub-fragment +(deftype generic-shrub-fragment (drawable) + ((textures (inline-array adgif-shader) :offset 4) + (vtx-cnt uint32 :offset 8) + (cnt-qwc uint8 :offset 12) + (vtx-qwc uint8 :offset 13) + (col-qwc uint8 :offset 14) + (stq-qwc uint8 :offset 15) + (cnt uint32 :offset 16) + (vtx uint32 :offset 20) + (col uint32 :offset 24) + (stq uint32 :offset 28) + ) + :method-count-assert 18 + :size-assert #x20 + :flag-assert #x1200000020 + ) + +;; definition for method 3 of type generic-shrub-fragment +(defmethod inspect generic-shrub-fragment ((obj generic-shrub-fragment)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Ttextures: #x~X~%" (-> obj textures)) + (format #t "~Tvtx-cnt: ~D~%" (-> obj vtx-cnt)) + (format #t "~Tcnt-qwc: ~D~%" (-> obj cnt-qwc)) + (format #t "~Tvtx-qwc: ~D~%" (-> obj vtx-qwc)) + (format #t "~Tcol-qwc: ~D~%" (-> obj col-qwc)) + (format #t "~Tstq-qwc: ~D~%" (-> obj stq-qwc)) + (format #t "~Tcnt: #x~X~%" (-> obj bsphere x)) + (format #t "~Tvtx: #x~X~%" (-> obj bsphere y)) + (format #t "~Tcol: #x~X~%" (-> obj bsphere z)) + (format #t "~Tstq: #x~X~%" (-> obj bsphere w)) + obj + ) + +;; definition of type prototype-shrubbery +(deftype prototype-shrubbery (drawable-inline-array) + ((data generic-shrub-fragment 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 64) + ) + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +;; definition of type prototype-trans-shrubbery +(deftype prototype-trans-shrubbery (prototype-shrubbery) + () + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +;; definition of type prototype-generic-shrub +(deftype prototype-generic-shrub (drawable-group) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type shrubbery-matrix +(deftype shrubbery-matrix (structure) + ((mat matrix :inline :offset-assert 0) + (color qword :inline :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + ) + +;; definition for method 3 of type shrubbery-matrix +(defmethod inspect shrubbery-matrix ((obj shrubbery-matrix)) + (format #t "[~8x] ~A~%" obj 'shrubbery-matrix) + (format #t "~Tmat: #~%" (-> obj mat)) + (format #t "~Tcolor: #~%" (-> obj color)) + obj + ) + +;; definition for function shrubbery-login-post-texture +;; INFO: Return type mismatch symbol vs none. +;; Used lq/sq +(defun shrubbery-login-post-texture ((obj shrubbery)) + (let* ((shader-count (-> obj header data 0)) + (dst + (the-as + qword + (+ + (the-as uint (-> obj header)) + (the-as uint (* (+ (-> obj header data 1) 1) 16)) + ) + ) + ) + (tex-dst + (the-as qword (+ (the-as int dst) (the-as int (* shader-count 64)))) + ) + (src (the-as qword (-> obj textures))) + ) + (dotimes (a0-1 (the-as int shader-count)) + (set! (-> tex-dst quad) (-> src quad)) + (let ((text-dst2 (the-as qword (+ (the-as int tex-dst) 16))) + (src-2 (the-as qword (&+ (the-as pointer src) 16))) + ) + (set! (-> dst data 0) (-> src-2 data 0)) + (set! (-> dst data 1) (-> src-2 data 1)) + (set! (-> dst data 2) (-> src-2 data 2)) + (set! dst (the-as qword (+ (the-as int dst) 16))) + (let ((src-3 (the-as qword (&+ (the-as pointer src-2) 16)))) + (dotimes (t0-4 3) + (set! (-> dst quad) (-> src-3 quad)) + (set! dst (the-as qword (+ (the-as int dst) 16))) + (set! src-3 (the-as qword (&+ (the-as pointer src-3) 16))) + ) + (set! (-> text-dst2 quad) (-> src-3 quad)) + (set! tex-dst (the-as qword (+ (the-as int text-dst2) 16))) + (set! src (the-as qword (&+ (the-as pointer src-3) 80))) + ) + ) + ) + ) + (none) + ) + +;; definition for symbol *shrub-state*, type int +(define *shrub-state* 0) + +;; definition of type shrub-near-packet +(deftype shrub-near-packet (structure) + ((matrix-tmpl dma-packet :inline :offset-assert 0) + (header-tmpl dma-packet :inline :offset-assert 16) + (stq-tmpl dma-packet :inline :offset-assert 32) + (color-tmpl dma-packet :inline :offset-assert 48) + (vertex-tmpl dma-packet :inline :offset-assert 64) + (mscal-tmpl dma-packet :inline :offset-assert 80) + (init-tmpl dma-packet :inline :offset-assert 96) + (init-data uint32 8 :offset-assert 112) + ) + :method-count-assert 9 + :size-assert #x90 + :flag-assert #x900000090 + ) + +;; definition for method 3 of type shrub-near-packet +(defmethod inspect shrub-near-packet ((obj shrub-near-packet)) + (format #t "[~8x] ~A~%" obj 'shrub-near-packet) + (format #t "~Tmatrix-tmpl: #~%" (-> obj matrix-tmpl)) + (format #t "~Theader-tmpl: #~%" (-> obj header-tmpl)) + (format #t "~Tstq-tmpl: #~%" (-> obj stq-tmpl)) + (format #t "~Tcolor-tmpl: #~%" (-> obj color-tmpl)) + (format #t "~Tvertex-tmpl: #~%" (-> obj vertex-tmpl)) + (format #t "~Tmscal-tmpl: #~%" (-> obj mscal-tmpl)) + (format #t "~Tinit-tmpl: #~%" (-> obj init-tmpl)) + (format #t "~Tinit-data[8] @ #x~X~%" (-> obj init-data)) + obj + ) + +;; definition of type instance-shrub-work +(deftype instance-shrub-work (structure) + ((dummy uint128 3 :offset-assert 0) + (chaina uint128 8 :offset-assert 48) + (chainb uint128 8 :offset-assert 176) + (colors rgba 1024 :offset-assert 304) + (matrix-tmpl uint128 20 :offset-assert 4400) + (count-tmpl uint128 20 :offset-assert 4720) + (mscalf-tmpl dma-packet :inline :offset-assert 5040) + (mscalf-ret-tmpl dma-packet :inline :offset-assert 5056) + (adgif-tmpl dma-gif-packet :inline :offset-assert 5072) + (billboard-tmpl dma-gif-packet :inline :offset-assert 5104) + (billboard-const vector :inline :offset-assert 5136) + (shrub-near-packets shrub-near-packet 6 :inline :offset-assert 5152) + (dma-ref dma-packet :inline :offset-assert 6016) + (dma-end dma-packet :inline :offset-assert 6032) + (wind-const vector :inline :offset-assert 6048) + (constants vector :inline :offset-assert 6064) + (color-constant vector4w :inline :offset-assert 6080) + (hmge-d vector :inline :offset-assert 6096) + (hvdf-offset vector :inline :offset-assert 6112) + (wind-force vector :inline :offset-assert 6128) + (color vector :inline :offset-assert 6144) + (bb-color vector :inline :offset-assert 6160) + (min-dist vector :inline :offset-assert 6176) + (temp-vec vector :inline :offset-assert 6192) + (guard-plane plane 4 :inline :offset-assert 6208) + (plane plane 4 :inline :offset-assert 6272) + (last uint32 4 :offset-assert 6336) + (next uint32 4 :offset-assert 6352) + (count uint16 4 :offset-assert 6368) + (mod-count uint16 4 :offset-assert 6376) + (wind-vectors uint32 :offset-assert 6384) + (instance-ptr uint32 :offset-assert 6388) + (chain-ptr uint32 :offset-assert 6392) + (chain-ptr-next uint32 :offset-assert 6396) + (stack-ptr uint32 :offset-assert 6400) + (bucket-ptr uint32 :offset-assert 6404) + (src-ptr uint32 :offset-assert 6408) + (to-spr uint32 :offset-assert 6412) + (from-spr uint32 :offset-assert 6416) + (shrub-count uint32 :offset-assert 6420) + (node uint32 6 :offset 6428) + (length uint32 6 :offset-assert 6452) + (prototypes uint32 :offset-assert 6476) + (start-bank uint8 20 :offset 6484) + (buffer-index uint32 :offset-assert 6504) + (current-spr uint32 :offset-assert 6508) + (current-mem uint32 :offset-assert 6512) + (current-shrub-near-packet uint32 :offset-assert 6516) + (dma-buffer basic :offset 6524) + (near-last uint32 :offset-assert 6528) + (near-next uint32 :offset-assert 6532) + (near-count uint32 :offset-assert 6536) + (last-shrubs uint32 :offset-assert 6540) + (chains uint32 :offset-assert 6544) + (flags uint32 :offset-assert 6548) + (paused basic :offset-assert 6552) + (node-count uint32 :offset-assert 6556) + (inst-count uint32 :offset-assert 6560) + (wait-from-spr uint32 :offset-assert 6564) + (wait-to-spr uint32 :offset-assert 6568) + ) + :method-count-assert 9 + :size-assert #x19ac + :flag-assert #x9000019ac + ) + +;; definition for method 3 of type instance-shrub-work +(defmethod inspect instance-shrub-work ((obj instance-shrub-work)) + (format #t "[~8x] ~A~%" obj 'instance-shrub-work) + (format #t "~Tdummy[3] @ #x~X~%" (-> obj dummy)) + (format #t "~Tchaina[8] @ #x~X~%" (-> obj chaina)) + (format #t "~Tchainb[8] @ #x~X~%" (-> obj chainb)) + (format #t "~Tcolors[1024] @ #x~X~%" (-> obj colors)) + (format #t "~Tmatrix-tmpl[20] @ #x~X~%" (-> obj matrix-tmpl)) + (format #t "~Tcount-tmpl[20] @ #x~X~%" (-> obj count-tmpl)) + (format #t "~Tmscalf-tmpl: #~%" (-> obj mscalf-tmpl)) + (format + #t + "~Tmscalf-ret-tmpl: #~%" + (-> obj mscalf-ret-tmpl) + ) + (format #t "~Tadgif-tmpl: #~%" (-> obj adgif-tmpl)) + (format + #t + "~Tbillboard-tmpl: #~%" + (-> obj billboard-tmpl) + ) + (format #t "~Tbillboard-const: #~%" (-> obj billboard-const)) + (format #t "~Tshrub-near-packets[6] @ #x~X~%" (-> obj shrub-near-packets)) + (format #t "~Tdma-ref: #~%" (-> obj dma-ref)) + (format #t "~Tdma-end: #~%" (-> obj dma-end)) + (format #t "~Twind-const: #~%" (-> obj wind-const)) + (format #t "~Tconstants: #~%" (-> obj constants)) + (format #t "~Tcolor-constant: #~%" (-> obj color-constant)) + (format #t "~Thmge-d: #~%" (-> obj hmge-d)) + (format #t "~Thvdf-offset: #~%" (-> obj hvdf-offset)) + (format #t "~Twind-force: #~%" (-> obj wind-force)) + (format #t "~Tcolor: #~%" (-> obj color)) + (format #t "~Tbb-color: #~%" (-> obj bb-color)) + (format #t "~Tmin-dist: #~%" (-> obj min-dist)) + (format #t "~Ttemp-vec: #~%" (-> obj temp-vec)) + (format #t "~Tguard-plane[4] @ #x~X~%" (-> obj guard-plane)) + (format #t "~Tplane[4] @ #x~X~%" (-> obj plane)) + (format #t "~Tlast[4] @ #x~X~%" (-> obj last)) + (format #t "~Tnext[4] @ #x~X~%" (-> obj next)) + (format #t "~Tcount[4] @ #x~X~%" (-> obj count)) + (format #t "~Tmod-count[4] @ #x~X~%" (-> obj mod-count)) + (format #t "~Twind-vectors: #x~X~%" (-> obj wind-vectors)) + (format #t "~Tinstance-ptr: ~D~%" (-> obj instance-ptr)) + (format #t "~Tchain-ptr: ~D~%" (-> obj chain-ptr)) + (format #t "~Tchain-ptr-next: ~D~%" (-> obj chain-ptr-next)) + (format #t "~Tstack-ptr: ~D~%" (-> obj stack-ptr)) + (format #t "~Tbucket-ptr: ~D~%" (-> obj bucket-ptr)) + (format #t "~Tsrc-ptr: ~D~%" (-> obj src-ptr)) + (format #t "~Tto-spr: ~D~%" (-> obj to-spr)) + (format #t "~Tfrom-spr: ~D~%" (-> obj from-spr)) + (format #t "~Tshrub-count: ~D~%" (-> obj shrub-count)) + (format #t "~Tstack-ptr: ~D~%" (-> obj stack-ptr)) + (format #t "~Tnode[6] @ #x~X~%" (-> obj node)) + (format #t "~Tlength[6] @ #x~X~%" (-> obj length)) + (format #t "~Tprototypes: ~D~%" (-> obj prototypes)) + (format #t "~Tbucket-ptr: ~D~%" (-> obj bucket-ptr)) + (format #t "~Tstart-bank[20] @ #x~X~%" (-> obj start-bank)) + (format #t "~Tbuffer-index: ~D~%" (-> obj buffer-index)) + (format #t "~Tcurrent-spr: ~D~%" (-> obj current-spr)) + (format #t "~Tcurrent-mem: ~D~%" (-> obj current-mem)) + (format + #t + "~Tcurrent-shrub-near-packet: ~D~%" + (-> obj current-shrub-near-packet) + ) + (format #t "~Tto-spr: ~D~%" (-> obj to-spr)) + (format #t "~Tdma-buffer: ~A~%" (-> obj dma-buffer)) + (format #t "~Tnear-last: ~D~%" (-> obj near-last)) + (format #t "~Tnear-next: ~D~%" (-> obj near-next)) + (format #t "~Tnear-count: ~D~%" (-> obj near-count)) + (format #t "~Tlast-shrubs: ~D~%" (-> obj last-shrubs)) + (format #t "~Tchains: ~D~%" (-> obj chains)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Tpaused: ~A~%" (-> obj paused)) + (format #t "~Tnode-count: ~D~%" (-> obj node-count)) + (format #t "~Tinst-count: ~D~%" (-> obj inst-count)) + (format #t "~Twait-from-spr: ~D~%" (-> obj wait-from-spr)) + (format #t "~Twait-to-spr: ~D~%" (-> obj wait-to-spr)) + obj + ) + +;; definition of type instance-shrub-dma +(deftype instance-shrub-dma (structure) + ((instancea uint128 325 :offset-assert 0) + (instanceb uint128 325 :offset-assert 5200) + (outa uint128 128 :offset-assert 10400) + (outb uint128 128 :offset-assert 12448) + ) + :method-count-assert 9 + :size-assert #x38a0 + :flag-assert #x9000038a0 + ) + +;; definition for method 3 of type instance-shrub-dma +(defmethod inspect instance-shrub-dma ((obj instance-shrub-dma)) + (format #t "[~8x] ~A~%" obj 'instance-shrub-dma) + (format #t "~Tinstancea[325] @ #x~X~%" (-> obj instancea)) + (format #t "~Tinstanceb[325] @ #x~X~%" (-> obj instanceb)) + (format #t "~Touta[128] @ #x~X~%" (-> obj outa)) + (format #t "~Toutb[128] @ #x~X~%" (-> obj outb)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-14 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/sparticle/sparticle-h_REF.gc b/test/decompiler/reference/engine/gfx/sparticle/sparticle-h_REF.gc new file mode 100644 index 0000000000..69341d33bf --- /dev/null +++ b/test/decompiler/reference/engine/gfx/sparticle/sparticle-h_REF.gc @@ -0,0 +1,160 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *sp-frame-time*, type vector +(define *sp-frame-time* (new 'global 'vector)) + +;; failed to figure out what this is: +(let ((v1-1 *sp-frame-time*)) + (set! (-> v1-1 x) 0.00000000000000000000000000000000000001175495) + (set! (-> v1-1 y) 5.0) + (set! (-> v1-1 z) 1.0) + (set! (-> v1-1 w) 1.0) + ) + +;; definition for symbol *sp-60-hz*, type symbol +(define *sp-60-hz* #t) + +;; definition of type sparticle-cpuinfo +(deftype sparticle-cpuinfo (structure) + ((sprite sprite-vec-data-2d :offset-assert 0) + (adgif adgif-shader :offset-assert 4) + (radius float :offset-assert 8) + (omega float :offset-assert 12) + (vel-sxvel vector :inline :offset-assert 16) + (rot-syvel vector :inline :offset-assert 32) + (fade rgbaf :inline :offset-assert 48) + (acc vector :inline :offset-assert 64) + (rotvel3d quaternion :inline :offset-assert 80) + (vel vector3s :inline :offset 16) + (accel vector3s :inline :offset 64) + (scalevelx float :offset 28) + (scalevely float :offset 44) + (friction float :offset-assert 96) + (timer int32 :offset-assert 100) + (flags uint32 :offset-assert 104) + (user-int32 int32 :offset-assert 108) + (user-uint32 uint32 :offset 108) + (user-float float :offset 108) + (user-pntr uint32 :offset 108) + (user-sprite sprite-vec-data-2d :offset 108) + (func basic :offset-assert 112) + (next-time uint32 :offset-assert 116) + (next-launcher basic :offset-assert 120) + (cache-alpha float :offset-assert 124) + (valid basic :offset-assert 128) + (key basic :offset-assert 132) + (binding sparticle-launch-state :offset-assert 136) + (data uint32 1 :offset 12) + (dataf float 1 :offset 12) + (datac uint8 1 :offset 12) + ) + :method-count-assert 9 + :size-assert #x8c + :flag-assert #x90000008c + ) + +;; definition for method 3 of type sparticle-cpuinfo +(defmethod inspect sparticle-cpuinfo ((obj sparticle-cpuinfo)) + (format #t "[~8x] ~A~%" obj 'sparticle-cpuinfo) + (format #t "~Tsprite: #~%" (-> obj sprite)) + (format #t "~Tadgif: #~%" (-> obj adgif)) + (format #t "~Tradius: ~f~%" (-> obj radius)) + (format #t "~Tomega: ~f~%" (-> obj omega)) + (format #t "~Tvel-sxvel: #~%" (-> obj vel-sxvel)) + (format #t "~Trot-syvel: #~%" (-> obj rot-syvel)) + (format #t "~Tfade: #~%" (-> obj fade)) + (format #t "~Tacc: #~%" (-> obj acc)) + (format #t "~Trotvel3d: #~%" (-> obj rotvel3d)) + (format #t "~Tvel: #~%" (-> obj vel-sxvel)) + (format #t "~Taccel: #~%" (-> obj acc)) + (format #t "~Tscalevelx: ~f~%" (-> obj vel-sxvel w)) + (format #t "~Tscalevely: ~f~%" (-> obj rot-syvel w)) + (format #t "~Tfriction: ~f~%" (-> obj friction)) + (format #t "~Ttimer: ~D~%" (-> obj timer)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Tuser-int32: ~D~%" (-> obj user-int32)) + (format #t "~Tuser-uint32: ~D~%" (-> obj user-uint32)) + (format #t "~Tuser-float: ~f~%" (the-as float (-> obj user-uint32))) + (format #t "~Tuser-pntr: #x~X~%" (-> obj user-uint32)) + (format + #t + "~Tuser-sprite: #~%" + (-> obj user-uint32) + ) + (format #t "~Tfunc: ~A~%" (-> obj func)) + (format #t "~Tnext-time: ~D~%" (-> obj next-time)) + (format #t "~Tnext-launcher: ~A~%" (-> obj next-launcher)) + (format #t "~Tcache-alpha: ~f~%" (-> obj cache-alpha)) + (format #t "~Tvalid: ~A~%" (-> obj valid)) + (format #t "~Tkey: ~A~%" (-> obj key)) + (format #t "~Tbinding: #~%" (-> obj binding)) + (format #t "~Tdata[1] @ #x~X~%" (&-> obj omega)) + (format #t "~Tdataf[1] @ #x~X~%" (&-> obj omega)) + (format #t "~Tdatac[1] @ #x~X~%" (&-> obj omega)) + obj + ) + +;; definition of type sparticle-launchinfo +(deftype sparticle-launchinfo (structure) + ((launchrot vector :inline :offset-assert 0) + (conerot vector :inline :offset-assert 16) + (coneradius float :offset-assert 32) + (rotate-y float :offset-assert 36) + (data uint8 1 :offset 0) + ) + :method-count-assert 9 + :size-assert #x28 + :flag-assert #x900000028 + ) + +;; definition for method 3 of type sparticle-launchinfo +(defmethod inspect sparticle-launchinfo ((obj sparticle-launchinfo)) + (format #t "[~8x] ~A~%" obj 'sparticle-launchinfo) + (format #t "~Tlaunchrot: #~%" (-> obj launchrot)) + (format #t "~Tconerot: #~%" (-> obj conerot)) + (format #t "~Tconeradius: ~f~%" (-> obj coneradius)) + (format #t "~Trotate-y: ~f~%" (-> obj rotate-y)) + (format #t "~Tdata[1] @ #x~X~%" (-> obj launchrot)) + obj + ) + +;; definition of type sparticle-system +(deftype sparticle-system (basic) + ((blocks uint32 2 :offset-assert 4) + (length uint32 2 :offset-assert 12) + (num-alloc uint32 2 :offset-assert 20) + (is-3d basic :offset-assert 28) + (flags uint32 :offset-assert 32) + (alloc-table uint32 :offset-assert 36) + (cpuinfo-table uint32 :offset-assert 40) + (vecdata-table uint32 :offset-assert 44) + (adgifdata-table uint32 :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + +;; definition for method 3 of type sparticle-system +(defmethod inspect sparticle-system ((obj sparticle-system)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tblocks[2] @ #x~X~%" (-> obj blocks)) + (format #t "~Tlength[2] @ #x~X~%" (-> obj length)) + (format #t "~Tnum-alloc[2] @ #x~X~%" (-> obj num-alloc)) + (format #t "~Tis-3d: ~A~%" (-> obj is-3d)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Talloc-table: #x~X~%" (-> obj alloc-table)) + (format #t "~Tcpuinfo-table: #x~X~%" (-> obj cpuinfo-table)) + (format #t "~Tvecdata-table: #x~X~%" (-> obj vecdata-table)) + (format #t "~Tadgifdata-table: #x~X~%" (-> obj adgifdata-table)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-4 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc b/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc new file mode 100644 index 0000000000..c97686764b --- /dev/null +++ b/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc @@ -0,0 +1,223 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type sp-field-init-spec +(deftype sp-field-init-spec (structure) + ((field uint16 :offset-assert 0) + (flags uint16 :offset-assert 2) + (initial-valuef float :offset-assert 4) + (random-rangef float :offset-assert 8) + (random-multf float :offset-assert 12) + (initial-value int32 :offset 4) + (random-range int32 :offset 8) + (random-mult int32 :offset 12) + (func basic :offset 4) + (tex uint32 :offset 4) + (pntr uint32 :offset 4) + (sym basic :offset 4) + (sound basic :offset 4) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type sp-field-init-spec +(defmethod inspect sp-field-init-spec ((obj sp-field-init-spec)) + (format #t "[~8x] ~A~%" obj 'sp-field-init-spec) + (format #t "~Tfield: ~D~%" (-> obj field)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Tinitial-valuef: ~f~%" (-> obj initial-valuef)) + (format #t "~Trandom-rangef: ~f~%" (-> obj random-rangef)) + (format #t "~Trandom-multf: ~f~%" (-> obj random-multf)) + (format #t "~Tinitial-value: ~D~%" (-> obj initial-valuef)) + (format #t "~Trandom-range: ~D~%" (-> obj random-rangef)) + (format #t "~Trandom-mult: ~D~%" (-> obj random-multf)) + (format #t "~Tfunc: ~A~%" (-> obj initial-valuef)) + (format #t "~Ttex: ~D~%" (-> obj initial-valuef)) + (format #t "~Tpntr: #x~X~%" (-> obj initial-valuef)) + (format #t "~Tsym: ~A~%" (-> obj initial-valuef)) + (format #t "~Tsound: ~A~%" (-> obj initial-valuef)) + obj + ) + +;; definition of type sparticle-launcher +(deftype sparticle-launcher (basic) + ((birthaccum float :offset-assert 4) + (soundaccum float :offset-assert 8) + (init-specs uint32 :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type sparticle-launcher +(defmethod inspect sparticle-launcher ((obj sparticle-launcher)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tbirthaccum: ~f~%" (-> obj birthaccum)) + (format #t "~Tsoundaccum: ~f~%" (-> obj soundaccum)) + (format #t "~Tinit-specs: #x~X~%" (-> obj init-specs)) + obj + ) + +;; definition of type sparticle-group-item +(deftype sparticle-group-item (structure) + ((launcher uint32 :offset-assert 0) + (fade-after float :offset-assert 4) + (falloff-to float :offset-assert 8) + (flags uint16 :offset-assert 12) + (period uint16 :offset-assert 14) + (length uint16 :offset-assert 16) + (offset uint16 :offset-assert 18) + (hour-mask uint32 :offset-assert 20) + (binding uint32 :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + +;; definition for method 3 of type sparticle-group-item +(defmethod inspect sparticle-group-item ((obj sparticle-group-item)) + (format #t "[~8x] ~A~%" obj 'sparticle-group-item) + (format #t "~Tlauncher: ~D~%" (-> obj launcher)) + (format #t "~Tfade-after: (meters ~m)~%" (-> obj fade-after)) + (format #t "~Tfalloff-to: (meters ~m)~%" (-> obj falloff-to)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Tperiod: ~D~%" (-> obj period)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Toffset: ~D~%" (-> obj offset)) + (format #t "~Thour-mask: ~D~%" (-> obj hour-mask)) + (format #t "~Tbinding: ~D~%" (-> obj binding)) + obj + ) + +;; definition of type sparticle-launch-state +(deftype sparticle-launch-state (structure) + ((group-item sparticle-group-item :offset-assert 0) + (flags uint16 :offset-assert 4) + (randomize uint16 :offset-assert 6) + (origin vector :offset-assert 8) + (sprite3d sprite-vec-data-3d :offset-assert 12) + (sprite basic :offset-assert 16) + (offset uint32 :offset-assert 20) + (accum float :offset-assert 24) + (spawn-time uint32 :offset-assert 28) + (swarm basic :offset 20) + (seed uint32 :offset 24) + (time uint32 :offset 28) + (spec basic :offset 16) + (id uint32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type sparticle-launch-state +(defmethod inspect sparticle-launch-state ((obj sparticle-launch-state)) + (format #t "[~8x] ~A~%" obj 'sparticle-launch-state) + (format + #t + "~Tgroup-item: #~%" + (-> obj group-item) + ) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Trandomize: ~D~%" (-> obj randomize)) + (format #t "~Torigin: #~%" (-> obj origin)) + (format #t "~Tsprite3d: #~%" (-> obj sprite3d)) + (format #t "~Tsprite: ~A~%" (-> obj sprite)) + (format #t "~Toffset: ~D~%" (-> obj offset)) + (format #t "~Taccum: ~f~%" (-> obj accum)) + (format #t "~Tspawn-time: ~D~%" (-> obj spawn-time)) + (format #t "~Tswarm: ~A~%" (-> obj offset)) + (format #t "~Tseed: ~D~%" (-> obj accum)) + (format #t "~Ttime: ~D~%" (-> obj spawn-time)) + (format #t "~Tspec: ~A~%" (-> obj sprite)) + (format #t "~Tid: ~D~%" (-> obj sprite3d)) + obj + ) + +;; definition of type sparticle-launch-group +(deftype sparticle-launch-group (basic) + ((length int16 :offset-assert 4) + (duration uint16 :offset-assert 6) + (linger-duration uint16 :offset-assert 8) + (flags uint16 :offset-assert 10) + (name basic :offset-assert 12) + (launcher uint32 :offset-assert 16) + (bounds sphere :inline :offset-assert 32) + ) + :method-count-assert 10 + :size-assert #x30 + :flag-assert #xa00000030 + (:methods + (dummy-9 () none 9) + ) + ) + +;; definition for method 3 of type sparticle-launch-group +(defmethod inspect sparticle-launch-group ((obj sparticle-launch-group)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tduration: ~D~%" (-> obj duration)) + (format #t "~Tlinger-duration: ~D~%" (-> obj linger-duration)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tlauncher: #x~X~%" (-> obj launcher)) + (format #t "~Tbounds: #~%" (-> obj bounds)) + obj + ) + +;; definition of type sparticle-launch-control +(deftype sparticle-launch-control (inline-array-class) + ((group basic :offset-assert 16) + (proc basic :offset-assert 20) + (local-clock int32 :offset-assert 24) + (fade float :offset-assert 28) + (matrix int32 :offset-assert 32) + (last-spawn-frame int32 :offset-assert 36) + (last-spawn-time int32 :offset-assert 40) + (center vector :inline :offset-assert 48) + (data uint8 :dynamic :offset-assert 64) + ) + :method-count-assert 14 + :size-assert #x40 + :flag-assert #xe00000040 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + ) + ) + +;; definition for method 3 of type sparticle-launch-control +(defmethod inspect sparticle-launch-control ((obj sparticle-launch-control)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tgroup: ~A~%" (-> obj group)) + (format #t "~Tproc: ~A~%" (-> obj proc)) + (format #t "~Tlocal-clock: ~D~%" (-> obj local-clock)) + (format #t "~Tfade: ~f~%" (-> obj fade)) + (format #t "~Tmatrix: ~D~%" (-> obj matrix)) + (format #t "~Tlast-spawn-frame: ~D~%" (-> obj last-spawn-frame)) + (format #t "~Tlast-spawn-time: ~D~%" (-> obj last-spawn-time)) + (format #t "~Tcenter: ~`vector`P~%" (&-> obj _data 32)) + (format #t "~Tdata[0] @ #x~X~%" (&-> obj _data 48)) + obj + ) + +;; failed to figure out what this is: +(set! (-> sparticle-launch-control heap-base) (the-as uint 32)) + +;; failed to figure out what this is: +(let ((v0-6 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/sprite/sprite-h_REF.gc b/test/decompiler/reference/engine/gfx/sprite/sprite-h_REF.gc new file mode 100644 index 0000000000..9a52a60293 --- /dev/null +++ b/test/decompiler/reference/engine/gfx/sprite/sprite-h_REF.gc @@ -0,0 +1,166 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type sprite-vec-data-2d +(deftype sprite-vec-data-2d (structure) + ((x-y-z-sx vector :inline :offset-assert 0) + (flag-rot-sy vector :inline :offset-assert 16) + (r-g-b-a vector :inline :offset-assert 32) + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (rot float :offset 24) + (flag int32 :offset 16) + (matrix int32 :offset 20) + (warp-turns int32 :offset 16) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) + (data64 uint64 6 :offset 0) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type sprite-vec-data-2d +(defmethod inspect sprite-vec-data-2d ((obj sprite-vec-data-2d)) + (format #t "[~8x] ~A~%" obj 'sprite-vec-data-2d) + (format #t "~Tx-y-z-sx: #~%" (-> obj x-y-z-sx)) + (format #t "~Tflag-rot-sy: #~%" (-> obj flag-rot-sy)) + (format #t "~Tr-g-b-a: #~%" (-> obj r-g-b-a)) + (format #t "~Tx: ~f~%" (-> obj x-y-z-sx x)) + (format #t "~Ty: ~f~%" (-> obj x-y-z-sx y)) + (format #t "~Tz: ~f~%" (-> obj x-y-z-sx z)) + (format #t "~Tsx: ~f~%" (-> obj x-y-z-sx w)) + (format #t "~Tsy: ~f~%" (-> obj flag-rot-sy w)) + (format #t "~Trot: ~f~%" (-> obj flag-rot-sy z)) + (format #t "~Tflag: ~D~%" (-> obj flag-rot-sy x)) + (format #t "~Tmatrix: ~D~%" (-> obj flag-rot-sy y)) + (format #t "~Twarp-turns: ~D~%" (-> obj flag-rot-sy x)) + (format #t "~Tr: ~f~%" (-> obj r-g-b-a x)) + (format #t "~Tg: ~f~%" (-> obj r-g-b-a y)) + (format #t "~Tb: ~f~%" (-> obj r-g-b-a z)) + (format #t "~Ta: ~f~%" (-> obj r-g-b-a w)) + (format #t "~Ttrans: #~%" (-> obj x-y-z-sx)) + (format #t "~Tcolor: #~%" (-> obj r-g-b-a)) + (format #t "~Tdata[1] @ #x~X~%" (-> obj x-y-z-sx)) + (format #t "~Tdata64[6] @ #x~X~%" (-> obj x-y-z-sx)) + obj + ) + +;; definition of type sprite-array-2d +(deftype sprite-array-2d (basic) + ((num-sprites uint32 2 :offset-assert 4) + (num-valid uint32 2 :offset-assert 12) + (vec-data uint32 :offset-assert 20) + (adgif-data uint32 :offset-assert 24) + (pad uint128 4 :offset-assert 32) + (data uint128 1 :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +;; definition for method 3 of type sprite-array-2d +(defmethod inspect sprite-array-2d ((obj sprite-array-2d)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tnum-sprites[2] @ #x~X~%" (-> obj num-sprites)) + (format #t "~Tnum-valid[2] @ #x~X~%" (-> obj num-valid)) + (format #t "~Tvec-data: #x~X~%" (-> obj vec-data)) + (format #t "~Tadgif-data: #x~X~%" (-> obj adgif-data)) + (format #t "~Tpad[4] @ #x~X~%" (-> obj pad)) + (format #t "~Tdata[1] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type sprite-vec-data-3d +(deftype sprite-vec-data-3d (structure) + ((x-y-z-sx vector :inline :offset-assert 0) + (qx-qy-qz-sy vector :inline :offset-assert 16) + (r-g-b-a vector :inline :offset-assert 32) + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (qx float :offset 16) + (qy float :offset 20) + (qz float :offset 24) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (rot vector3s :inline :offset 16) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type sprite-vec-data-3d +(defmethod inspect sprite-vec-data-3d ((obj sprite-vec-data-3d)) + (format #t "[~8x] ~A~%" obj 'sprite-vec-data-3d) + (format #t "~Tx-y-z-sx: #~%" (-> obj x-y-z-sx)) + (format #t "~Tqx-qy-qz-sy: #~%" (-> obj qx-qy-qz-sy)) + (format #t "~Tr-g-b-a: #~%" (-> obj r-g-b-a)) + (format #t "~Tx: ~f~%" (-> obj x-y-z-sx x)) + (format #t "~Ty: ~f~%" (-> obj x-y-z-sx y)) + (format #t "~Tz: ~f~%" (-> obj x-y-z-sx z)) + (format #t "~Tsx: ~f~%" (-> obj x-y-z-sx w)) + (format #t "~Tsy: ~f~%" (-> obj qx-qy-qz-sy w)) + (format #t "~Tqx: ~f~%" (-> obj qx-qy-qz-sy x)) + (format #t "~Tqy: ~f~%" (-> obj qx-qy-qz-sy y)) + (format #t "~Tqz: ~f~%" (-> obj qx-qy-qz-sy z)) + (format #t "~Tr: ~f~%" (-> obj r-g-b-a x)) + (format #t "~Tg: ~f~%" (-> obj r-g-b-a y)) + (format #t "~Tb: ~f~%" (-> obj r-g-b-a z)) + (format #t "~Ta: ~f~%" (-> obj r-g-b-a w)) + (format #t "~Ttrans: #~%" (-> obj x-y-z-sx)) + (format #t "~Trot: #~%" (-> obj qx-qy-qz-sy)) + (format #t "~Tcolor: #~%" (-> obj r-g-b-a)) + (format #t "~Tdata[1] @ #x~X~%" (-> obj x-y-z-sx)) + obj + ) + +;; definition of type sprite-array-3d +(deftype sprite-array-3d (basic) + ((num-sprites uint32 2 :offset-assert 4) + (num-valid uint32 2 :offset-assert 12) + (vec-data uint32 :offset-assert 20) + (adgif-data uint32 :offset-assert 24) + (data uint128 1 :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type sprite-array-3d +(defmethod inspect sprite-array-3d ((obj sprite-array-3d)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tnum-sprites[2] @ #x~X~%" (-> obj num-sprites)) + (format #t "~Tnum-valid[2] @ #x~X~%" (-> obj num-valid)) + (format #t "~Tvec-data: #x~X~%" (-> obj vec-data)) + (format #t "~Tadgif-data: #x~X~%" (-> obj adgif-data)) + (format #t "~Tdata[1] @ #x~X~%" (-> obj data)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-4 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/texture-h_REF.gc b/test/decompiler/reference/engine/gfx/texture-h_REF.gc index f0e2bcb5af..10e1402d37 100644 --- a/test/decompiler/reference/engine/gfx/texture-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/texture-h_REF.gc @@ -312,7 +312,7 @@ ;; definition of type adgif-shader (deftype adgif-shader (structure) - ((quad uint128 5 :offset 0) + ((quad qword 5 :inline :offset 0) (prims uint64 10 :offset 0) (tex0 uint64 :offset 0) (tex1 uint64 :offset 16) @@ -334,15 +334,15 @@ (format #t "[~8x] ~A~%" obj 'adgif-shader) (format #t "~Tquad[5] @ #x~X~%" (-> obj quad)) (format #t "~Tprims[10] @ #x~X~%" (-> obj quad)) - (format #t "~Ttex0: #x~X~%" (-> obj prims 0)) - (format #t "~Ttex1: #x~X~%" (-> obj prims 2)) - (format #t "~Tmiptbp1: #x~X~%" (-> obj prims 4)) - (format #t "~Tclamp: #x~X~%" (-> obj prims 6)) - (format #t "~Tclamp-reg: ~D~%" (-> obj prims 7)) - (format #t "~Talpha: #x~X~%" (-> obj prims 8)) - (format #t "~Tlink-test: ~D~%" (-> obj link-test)) - (format #t "~Ttexture-id: ~D~%" (-> obj texture-id)) - (format #t "~Tnext: #x~X~%" (-> obj next)) + (format #t "~Ttex0: #x~X~%" (-> obj quad 0 dword 0)) + (format #t "~Ttex1: #x~X~%" (-> obj quad 1 dword 0)) + (format #t "~Tmiptbp1: #x~X~%" (-> obj quad 2 dword 0)) + (format #t "~Tclamp: #x~X~%" (-> obj quad 3 dword 0)) + (format #t "~Tclamp-reg: ~D~%" (-> obj quad 3 dword 1)) + (format #t "~Talpha: #x~X~%" (-> obj quad 4 dword 0)) + (format #t "~Tlink-test: ~D~%" (-> obj quad 0 data 2)) + (format #t "~Ttexture-id: ~D~%" (-> obj quad 1 data 2)) + (format #t "~Tnext: #x~X~%" (-> obj quad 2 data 2)) obj ) diff --git a/test/decompiler/reference/engine/gfx/tfrag/subdivide-h_REF.gc b/test/decompiler/reference/engine/gfx/tfrag/subdivide-h_REF.gc new file mode 100644 index 0000000000..551989872e --- /dev/null +++ b/test/decompiler/reference/engine/gfx/tfrag/subdivide-h_REF.gc @@ -0,0 +1,405 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type subdivide-settings +(deftype subdivide-settings (basic) + ((dist float 5 :offset-assert 4) + (meters float 5 :offset-assert 24) + (close float 4 :offset-assert 44) + (far float 4 :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x4c + :flag-assert #x90000004c + (:methods + (new (symbol type float float) _type_ 0) + ) + ) + +;; definition for method 3 of type subdivide-settings +(defmethod inspect subdivide-settings ((obj subdivide-settings)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdist[5] @ #x~X~%" (-> obj dist)) + (format #t "~Tmeters[5] @ #x~X~%" (-> obj meters)) + (format #t "~Tclose[4] @ #x~X~%" (-> obj close)) + (format #t "~Tfar[4] @ #x~X~%" (-> obj far)) + obj + ) + +;; definition for method 0 of type subdivide-settings +(defmethod + new + subdivide-settings + ((allocation symbol) (type-to-make type) (arg0 float) (arg1 float)) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (dotimes (v1-2 3) + (set! (-> v0-0 close v1-2) arg0) + (set! (-> v0-0 far v1-2) arg1) + ) + v0-0 + ) + ) + +;; definition of type subdivide-dists +(deftype subdivide-dists (structure) + ((data uint32 32 :offset 0) + (vector vector 8 :inline :offset 0) + (k0s uint128 4 :offset 0) + (k1s uint128 4 :offset 64) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) + +;; definition for method 3 of type subdivide-dists +(defmethod inspect subdivide-dists ((obj subdivide-dists)) + (format #t "[~8x] ~A~%" obj 'subdivide-dists) + (format #t "~Tdata[32] @ #x~X~%" (-> obj data)) + (format #t "~Tvector[8] @ #x~X~%" (-> obj data)) + (format #t "~Tk0s[4] @ #x~X~%" (-> obj data)) + (format #t "~Tk1s[4] @ #x~X~%" (&-> obj data 16)) + obj + ) + +;; definition of type gs-packed-rgba +(deftype gs-packed-rgba (structure) + ((data int32 4 :offset-assert 0) + (red int32 :offset 0) + (green int32 :offset 4) + (blue int32 :offset 8) + (alpha int32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type gs-packed-rgba +(defmethod inspect gs-packed-rgba ((obj gs-packed-rgba)) + (format #t "[~8x] ~A~%" obj 'gs-packed-rgba) + (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) + (format #t "~Tred: ~D~%" (-> obj data 0)) + (format #t "~Tgreen: ~D~%" (-> obj data 1)) + (format #t "~Tblue: ~D~%" (-> obj data 2)) + (format #t "~Talpha: ~D~%" (-> obj data 3)) + obj + ) + +;; definition of type gs-packed-xyzw +(deftype gs-packed-xyzw (structure) + ((data int32 4 :offset-assert 0) + (x int32 :offset 0) + (y int32 :offset 4) + (z int32 :offset 8) + (w int32 :offset 12) + (quad uint128 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type gs-packed-xyzw +;; Used lq/sq +(defmethod inspect gs-packed-xyzw ((obj gs-packed-xyzw)) + (format #t "[~8x] ~A~%" obj 'gs-packed-xyzw) + (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) + (format #t "~Tx: ~D~%" (-> obj data 0)) + (format #t "~Ty: ~D~%" (-> obj data 1)) + (format #t "~Tz: ~D~%" (-> obj data 2)) + (format #t "~Tw: ~D~%" (-> obj data 3)) + (format #t "~Tquad: ~D~%" (-> obj quad)) + obj + ) + +;; definition of type gs-packed-stq +(deftype gs-packed-stq (structure) + ((data float 4 :offset-assert 0) + (tex-s float :offset 0) + (tex-t float :offset 4) + (tex-q float :offset 8) + (quad uint128 :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type gs-packed-stq +;; Used lq/sq +(defmethod inspect gs-packed-stq ((obj gs-packed-stq)) + (format #t "[~8x] ~A~%" obj 'gs-packed-stq) + (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) + (format #t "~Ttex-s: ~f~%" (-> obj data 0)) + (format #t "~Ttex-t: ~f~%" (-> obj data 1)) + (format #t "~Ttex-q: ~f~%" (-> obj data 2)) + (format #t "~Tquad: ~D~%" (-> obj quad)) + obj + ) + +;; definition of type gs-packed-gt +(deftype gs-packed-gt (structure) + ((stq gs-packed-stq :inline :offset-assert 0) + (rgba gs-packed-rgba :inline :offset-assert 16) + (xyzw gs-packed-xyzw :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type gs-packed-gt +(defmethod inspect gs-packed-gt ((obj gs-packed-gt)) + (format #t "[~8x] ~A~%" obj 'gs-packed-gt) + (format #t "~Tstq: #~%" (-> obj stq)) + (format #t "~Trgba: #~%" (-> obj rgba)) + (format #t "~Txyzw: #~%" (-> obj xyzw)) + obj + ) + +;; definition of type gs-packed-gt4 +(deftype gs-packed-gt4 (structure) + ((data gs-packed-gt 4 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #xc0 + :flag-assert #x9000000c0 + ) + +;; definition for method 3 of type gs-packed-gt4 +(defmethod inspect gs-packed-gt4 ((obj gs-packed-gt4)) + (format #t "[~8x] ~A~%" obj 'gs-packed-gt4) + (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type terrain-bsp +(deftype terrain-bsp (structure) + ((lev-index int32 :offset-assert 0) + (mood basic :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type terrain-bsp +(defmethod inspect terrain-bsp ((obj terrain-bsp)) + (format #t "[~8x] ~A~%" obj 'terrain-bsp) + (format #t "~Tlev-index: ~D~%" (-> obj lev-index)) + (format #t "~Tmood: ~A~%" (-> obj mood)) + obj + ) + +;; definition of type terrain-stats +(deftype terrain-stats (structure) + ((pris tr-stat :inline :offset-assert 0) + (tie-generic tr-stat :inline :offset-assert 16) + (tie tr-stat :inline :offset-assert 32) + (tie-near tr-stat :inline :offset-assert 48) + (shrub-near tr-stat :inline :offset-assert 64) + (shrub tr-stat :inline :offset-assert 80) + (tfrag-near tr-stat :inline :offset-assert 96) + (tfrag tr-stat :inline :offset-assert 112) + (billboard tr-stat :inline :offset-assert 128) + (trans-tfrag tr-stat :inline :offset-assert 144) + (trans-tfrag-near tr-stat :inline :offset-assert 160) + (trans-pris tr-stat :inline :offset-assert 176) + (trans-shrub tr-stat :inline :offset-assert 192) + (ocean-mid tr-stat :inline :offset-assert 208) + (ocean-near tr-stat :inline :offset-assert 224) + (total tr-stat :inline :offset-assert 240) + ) + :method-count-assert 9 + :size-assert #x100 + :flag-assert #x900000100 + ) + +;; definition for method 3 of type terrain-stats +(defmethod inspect terrain-stats ((obj terrain-stats)) + (format #t "[~8x] ~A~%" obj 'terrain-stats) + (format #t "~Tpris: #~%" (-> obj pris)) + (format #t "~Ttie-generic: #~%" (-> obj tie-generic)) + (format #t "~Ttie: #~%" (-> obj tie)) + (format #t "~Ttie-near: #~%" (-> obj tie-near)) + (format #t "~Tshrub-near: #~%" (-> obj shrub-near)) + (format #t "~Tshrub: #~%" (-> obj shrub)) + (format #t "~Ttfrag-near: #~%" (-> obj tfrag-near)) + (format #t "~Ttfrag: #~%" (-> obj tfrag)) + (format #t "~Tbillboard: #~%" (-> obj billboard)) + (format #t "~Ttrans-tfrag: #~%" (-> obj trans-tfrag)) + (format + #t + "~Ttrans-tfrag-near: #~%" + (-> obj trans-tfrag-near) + ) + (format #t "~Ttrans-pris: #~%" (-> obj trans-pris)) + (format #t "~Ttrans-shrub: #~%" (-> obj trans-shrub)) + (format #t "~Tocean-mid: #~%" (-> obj ocean-mid)) + (format #t "~Tocean-near: #~%" (-> obj ocean-near)) + (format #t "~Ttotal: #~%" (-> obj total)) + obj + ) + +;; definition of type dma-area +(deftype dma-area (structure) + ((draw-node-dma draw-node-dma :inline :offset 0) + (tfrag-dma tfrag-dma :inline :offset 0) + (instance-shrub-dma instance-shrub-dma :inline :offset 0) + (instance-tie-dma instance-tie-dma :inline :offset 0) + (prototype-tie-dma prototype-tie-dma :inline :offset 0) + (time-of-day-dma time-of-day-dma :inline :offset 0) + (decomp-work decomp-work :inline :offset 0) + (ocean-vertex ocean-vertex 4 :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x38a0 + :flag-assert #x9000038a0 + ) + +;; definition for method 3 of type dma-area +(defmethod inspect dma-area ((obj dma-area)) + (format #t "[~8x] ~A~%" obj 'dma-area) + (format + #t + "~Tdraw-node-dma: #~%" + (-> obj draw-node-dma) + ) + (format #t "~Ttfrag-dma: #~%" (-> obj draw-node-dma)) + (format + #t + "~Tinstance-shrub-dma: #~%" + (-> obj draw-node-dma) + ) + (format + #t + "~Tinstance-tie-dma: #~%" + (-> obj draw-node-dma) + ) + (format + #t + "~Tprototype-tie-dma: #~%" + (-> obj draw-node-dma) + ) + (format + #t + "~Ttime-of-day-dma: #~%" + (-> obj draw-node-dma) + ) + (format #t "~Tdecomp-work: #~%" (-> obj draw-node-dma)) + (format #t "~Tocean-vertex[4] @ #x~X~%" (-> obj draw-node-dma)) + obj + ) + +;; definition of type background-area +(deftype background-area (structure) + ((dma-area dma-area :inline :offset-assert 0) + (vis-list uint8 2048 :offset-assert 14496) + ) + :method-count-assert 9 + :size-assert #x40a0 + :flag-assert #x9000040a0 + ) + +;; definition for method 3 of type background-area +(defmethod inspect background-area ((obj background-area)) + (format #t "[~8x] ~A~%" obj 'background-area) + (format #t "~Tdma-area: #~%" (-> obj dma-area)) + (format #t "~Tvis-list[2048] @ #x~X~%" (-> obj vis-list)) + obj + ) + +;; definition of type foreground-area +(deftype foreground-area (structure) + ((joint-work joint-work :inline :offset-assert 0) + (generic-work generic-work :inline :offset 0) + (bone-mem bone-memory :inline :offset 0) + (shadow-work shadow-work :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x3fd0 + :flag-assert #x900003fd0 + ) + +;; definition for method 3 of type foreground-area +(defmethod inspect foreground-area ((obj foreground-area)) + (format #t "[~8x] ~A~%" obj 'foreground-area) + (format #t "~Tjoint-work: #~%" (-> obj joint-work)) + (format #t "~Tgeneric-work: #~%" (-> obj joint-work)) + (format #t "~Tbone-mem: #~%" (-> obj joint-work)) + (format #t "~Tshadow-work: #~%" (-> obj joint-work)) + obj + ) + +;; definition of type ambient-area +(deftype ambient-area (structure) + ((ambient-list ambient-list :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x2004 + :flag-assert #x900002004 + ) + +;; definition for method 3 of type ambient-area +(defmethod inspect ambient-area ((obj ambient-area)) + (format #t "[~8x] ~A~%" obj 'ambient-area) + (format #t "~Tambient-list: #~%" (-> obj ambient-list)) + obj + ) + +;; definition of type work-area +(deftype work-area (structure) + ((background background-area :inline :offset-assert 0) + (foreground foreground-area :inline :offset 0) + (ambient ambient-area :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x40a0 + :flag-assert #x9000040a0 + ) + +;; definition for method 3 of type work-area +(defmethod inspect work-area ((obj work-area)) + (format #t "[~8x] ~A~%" obj 'work-area) + (format #t "~Tbackground: #~%" (-> obj background)) + (format #t "~Tforeground: #~%" (-> obj background)) + (format #t "~Tambient: #~%" (-> obj background)) + obj + ) + +;; definition of type terrain-context +(deftype terrain-context (structure) + ((bsp terrain-bsp :inline :offset-assert 0) + (work work-area :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x40b0 + :flag-assert #x9000040b0 + ) + +;; definition for method 3 of type terrain-context +(defmethod inspect terrain-context ((obj terrain-context)) + (format #t "[~8x] ~A~%" obj 'terrain-context) + (format #t "~Tbsp: #~%" (-> obj bsp)) + (format #t "~Twork: #~%" (-> obj work)) + obj + ) + +;; definition for symbol *terrain-stats*, type terrain-stats +(define *terrain-stats* (new 'global 'terrain-stats)) + +;; definition for symbol *collide-stats*, type collide-stats +(define *collide-stats* (new 'global 'collide-stats)) + +;; failed to figure out what this is: +(let ((v0-17 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/tfrag/tfrag-h_REF.gc b/test/decompiler/reference/engine/gfx/tfrag/tfrag-h_REF.gc new file mode 100644 index 0000000000..ebdfda25da --- /dev/null +++ b/test/decompiler/reference/engine/gfx/tfrag/tfrag-h_REF.gc @@ -0,0 +1,484 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type tfragment-stats +(deftype tfragment-stats (structure) + ((num-tris uint16 4 :offset-assert 0) + (num-dverts uint16 4 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type tfragment-stats +(defmethod inspect tfragment-stats ((obj tfragment-stats)) + (format #t "[~8x] ~A~%" obj 'tfragment-stats) + (format #t "~Tnum-tris[4] @ #x~X~%" (-> obj num-tris)) + (format #t "~Tnum-dverts[4] @ #x~X~%" (-> obj num-dverts)) + obj + ) + +;; definition of type tfragment-debug-data +(deftype tfragment-debug-data (structure) + ((stats tfragment-stats :inline :offset-assert 0) + (debug-lines basic :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type tfragment-debug-data +(defmethod inspect tfragment-debug-data ((obj tfragment-debug-data)) + (format #t "[~8x] ~A~%" obj 'tfragment-debug-data) + (format #t "~Tstats: #~%" (-> obj stats)) + (format #t "~Tdebug-lines: ~A~%" (-> obj debug-lines)) + obj + ) + +;; definition of type generic-tfragment +(deftype generic-tfragment (structure) + ((dummy int32 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +;; definition for method 3 of type generic-tfragment +(defmethod inspect generic-tfragment ((obj generic-tfragment)) + (format #t "[~8x] ~A~%" obj 'generic-tfragment) + (format #t "~Tdummy: ~D~%" (-> obj dummy)) + obj + ) + +;; definition of type tfragment +(deftype tfragment (drawable) + ((color-index uint16 :offset 6) + (debug-data tfragment-debug-data :offset 8) + (color-indices uint32 :offset 12) + (colors uint32 :offset 12) + (dma-chain uint32 3 :offset-assert 32) + (dma-common uint32 :offset 32) + (dma-level-0 uint32 :offset 32) + (dma-base uint32 :offset 36) + (dma-level-1 uint32 :offset 40) + (dma-qwc uint32 4 :offset-assert 44) + (shader uint32 :offset 48) + (num-shaders uint8 :offset 52) + (num-base-colors uint8 :offset 53) + (num-level0-colors uint8 :offset 54) + (num-level1-colors uint8 :offset 55) + (color-offset uint8 :offset 56) + (color-count uint8 :offset 57) + (pad0 uint8 :offset 58) + (pad1 uint8 :offset 59) + (generic generic-tfragment :offset-assert 60) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + ) + +;; definition for method 3 of type tfragment +(defmethod inspect tfragment ((obj tfragment)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tcolor-index: ~D~%" (-> obj color-index)) + (format + #t + "~Tdebug-data: #~%" + (-> obj debug-data) + ) + (format #t "~Tcolor-indices: #x~X~%" (-> obj color-indices)) + (format #t "~Tcolors: #x~X~%" (-> obj color-indices)) + (format #t "~Tdma-chain[3] @ #x~X~%" (-> obj dma-chain)) + (format #t "~Tdma-common: #x~X~%" (-> obj dma-chain 0)) + (format #t "~Tdma-level-0: #x~X~%" (-> obj dma-chain 0)) + (format #t "~Tdma-base: #x~X~%" (-> obj dma-chain 1)) + (format #t "~Tdma-level-1: #x~X~%" (-> obj dma-chain 2)) + (format #t "~Tdma-qwc[4] @ #x~X~%" (-> obj dma-qwc)) + (format #t "~Tshader: #x~X~%" (-> obj dma-qwc 1)) + (format #t "~Tnum-shaders: ~D~%" (-> obj num-shaders)) + (format #t "~Tnum-base-colors: ~D~%" (-> obj num-base-colors)) + (format #t "~Tnum-level0-colors: ~D~%" (-> obj num-level0-colors)) + (format #t "~Tnum-level1-colors: ~D~%" (-> obj num-level1-colors)) + (format #t "~Tcolor-offset: ~D~%" (-> obj color-offset)) + (format #t "~Tcolor-count: ~D~%" (-> obj color-count)) + (format #t "~Tpad0: ~D~%" (-> obj pad0)) + (format #t "~Tpad1: ~D~%" (-> obj pad1)) + (format #t "~Tgeneric: #~%" (-> obj generic)) + obj + ) + +;; definition of type drawable-inline-array-tfrag +(deftype drawable-inline-array-tfrag (drawable-inline-array) + ((data tfragment 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 96) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + ) + +;; definition of type drawable-inline-array-trans-tfrag +(deftype drawable-inline-array-trans-tfrag (drawable-inline-array-tfrag) + ((data2 tfragment 1 :inline :offset-assert 112) + (pad2 uint32 :offset-assert 176) + ) + :method-count-assert 18 + :size-assert #xb4 + :flag-assert #x12000000b4 + ) + +;; definition of type drawable-tree-tfrag +(deftype drawable-tree-tfrag (drawable-tree) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-tree-trans-tfrag +(deftype drawable-tree-trans-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-tree-dirt-tfrag +(deftype drawable-tree-dirt-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-tree-ice-tfrag +(deftype drawable-tree-ice-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-tree-lowres-tfrag +(deftype drawable-tree-lowres-tfrag (drawable-tree-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-tree-lowres-trans-tfrag +(deftype drawable-tree-lowres-trans-tfrag (drawable-tree-trans-tfrag) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type tfrag-dists +(deftype tfrag-dists (structure) + ((data uint32 16 :offset-assert 0) + (vector vector 4 :inline :offset 0) + (k0s uint128 2 :offset 0) + (k1s uint128 2 :offset 32) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +;; definition for method 3 of type tfrag-dists +(defmethod inspect tfrag-dists ((obj tfrag-dists)) + (format #t "[~8x] ~A~%" obj 'tfrag-dists) + (format #t "~Tdata[16] @ #x~X~%" (-> obj data)) + (format #t "~Tvector[4] @ #x~X~%" (-> obj data)) + (format #t "~Tk0s[2] @ #x~X~%" (-> obj data)) + (format #t "~Tk1s[2] @ #x~X~%" (&-> obj data 8)) + obj + ) + +;; definition of type tfrag-data +(deftype tfrag-data (structure) + ((data uint32 56 :offset 0) + (vector vector 14 :inline :offset 0) + (fog vector :inline :offset 0) + (val vector :inline :offset 16) + (strgif qword :inline :offset 32) + (fangif qword :inline :offset 48) + (adgif qword :inline :offset 64) + (hvdf-offset vector :inline :offset 80) + (hmge-scale vector :inline :offset 96) + (invh-scale vector :inline :offset 112) + (ambient vector :inline :offset 128) + (guard vector :inline :offset 144) + (dists tfrag-dists :inline :offset 160) + (k0s uint128 2 :offset 160) + (k1s uint128 2 :offset 192) + ) + :method-count-assert 9 + :size-assert #xe0 + :flag-assert #x9000000e0 + ) + +;; definition for method 3 of type tfrag-data +(defmethod inspect tfrag-data ((obj tfrag-data)) + (format #t "[~8x] ~A~%" obj 'tfrag-data) + (format #t "~Tdata[56] @ #x~X~%" (-> obj data)) + (format #t "~Tvector[14] @ #x~X~%" (-> obj data)) + (format #t "~Tfog: #~%" (-> obj data)) + (format #t "~Tval: #~%" (&-> obj data 4)) + (format #t "~Tstrgif: #~%" (&-> obj data 8)) + (format #t "~Tfangif: #~%" (&-> obj data 12)) + (format #t "~Tadgif: #~%" (&-> obj data 16)) + (format #t "~Thvdf-offset: #~%" (&-> obj data 20)) + (format #t "~Thmge-scale: #~%" (&-> obj data 24)) + (format #t "~Tinvh-scale: #~%" (&-> obj data 28)) + (format #t "~Tambient: #~%" (&-> obj data 32)) + (format #t "~Tguard: #~%" (&-> obj data 36)) + (format #t "~Tdists: #~%" (&-> obj data 40)) + (format #t "~Tk0s[2] @ #x~X~%" (&-> obj data 40)) + (format #t "~Tk1s[2] @ #x~X~%" (&-> obj data 48)) + obj + ) + +;; definition of type tfrag-control +(deftype tfrag-control (structure) + ((num-base-points uint32 :offset-assert 0) + (num-shared-base-points uint32 :offset-assert 4) + (num-level0-points uint32 :offset-assert 8) + (num-shared-level0-points uint32 :offset-assert 12) + (num-level1-points uint32 :offset-assert 16) + (num-shared-level1-points uint32 :offset-assert 20) + (ptr-vtxdata uint32 :offset-assert 24) + (ptr-base-points uint32 :offset-assert 28) + (ptr-shared-base-points uint32 :offset-assert 32) + (ptr-level0-points uint32 :offset-assert 36) + (ptr-shared-level0-points uint32 :offset-assert 40) + (ptr-level1-points uint32 :offset-assert 44) + (ptr-shared-level1-points uint32 :offset-assert 48) + (ptr-draw-points uint32 :offset-assert 52) + (ptr-interpolated-0 uint32 :offset-assert 56) + (ptr-shared-interpolated-0 uint32 :offset-assert 60) + (ptr-interpolated1 uint32 :offset-assert 64) + (ptr-shared-interpolated1 uint32 :offset-assert 68) + (ptr-strip-data uint32 :offset-assert 72) + (ptr-texture-data uint32 :offset-assert 76) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + ) + +;; definition for method 3 of type tfrag-control +(defmethod inspect tfrag-control ((obj tfrag-control)) + (format #t "[~8x] ~A~%" obj 'tfrag-control) + (format #t "~Tnum-base-points: ~D~%" (-> obj num-base-points)) + (format #t "~Tnum-shared-base-points: ~D~%" (-> obj num-shared-base-points)) + (format #t "~Tnum-level0-points: ~D~%" (-> obj num-level0-points)) + (format + #t + "~Tnum-shared-level0-points: ~D~%" + (-> obj num-shared-level0-points) + ) + (format #t "~Tnum-level1-points: ~D~%" (-> obj num-level1-points)) + (format + #t + "~Tnum-shared-level1-points: ~D~%" + (-> obj num-shared-level1-points) + ) + (format #t "~Tptr-vtxdata: ~D~%" (-> obj ptr-vtxdata)) + (format #t "~Tptr-base-points: ~D~%" (-> obj ptr-base-points)) + (format #t "~Tptr-shared-base-points: ~D~%" (-> obj ptr-shared-base-points)) + (format #t "~Tptr-level0-points: ~D~%" (-> obj ptr-level0-points)) + (format + #t + "~Tptr-shared-level0-points: ~D~%" + (-> obj ptr-shared-level0-points) + ) + (format #t "~Tptr-level1-points: ~D~%" (-> obj ptr-level1-points)) + (format + #t + "~Tptr-shared-level1-points: ~D~%" + (-> obj ptr-shared-level1-points) + ) + (format #t "~Tptr-draw-points: ~D~%" (-> obj ptr-draw-points)) + (format #t "~Tptr-interpolated-0: ~D~%" (-> obj ptr-interpolated-0)) + (format + #t + "~Tptr-shared-interpolated-0: ~D~%" + (-> obj ptr-shared-interpolated-0) + ) + (format #t "~Tptr-interpolated1: ~D~%" (-> obj ptr-interpolated1)) + (format + #t + "~Tptr-shared-interpolated1: ~D~%" + (-> obj ptr-shared-interpolated1) + ) + (format #t "~Tptr-strip-data: ~D~%" (-> obj ptr-strip-data)) + (format #t "~Tptr-texture-data: ~D~%" (-> obj ptr-texture-data)) + obj + ) + +;; definition of type tfrag-stats +(deftype tfrag-stats (structure) + ((from int32 :offset-assert 0) + (to int32 :offset-assert 4) + (cnt int32 :offset-assert 8) + (tris int32 :offset-assert 12) + (tfaces int32 :offset-assert 16) + (tfrags int32 :offset-assert 20) + (dtris int32 :offset-assert 24) + (base-verts int32 :offset-assert 28) + (level0-verts int32 :offset-assert 32) + (level1-verts int32 :offset-assert 36) + (dma-cnt int32 :offset-assert 40) + (dma-dta int32 :offset-assert 44) + (dma-tex int32 :offset-assert 48) + (strips int32 :offset-assert 52) + (drawpoints int32 :offset-assert 56) + (vif int32 :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +;; definition for method 3 of type tfrag-stats +(defmethod inspect tfrag-stats ((obj tfrag-stats)) + (format #t "[~8x] ~A~%" obj 'tfrag-stats) + (format #t "~Tfrom: ~D~%" (-> obj from)) + (format #t "~Tto: ~D~%" (-> obj to)) + (format #t "~Tcnt: ~D~%" (-> obj cnt)) + (format #t "~Ttris: ~D~%" (-> obj tris)) + (format #t "~Ttfaces: ~D~%" (-> obj tfaces)) + (format #t "~Ttfrags: ~D~%" (-> obj tfrags)) + (format #t "~Tdtris: ~D~%" (-> obj dtris)) + (format #t "~Tbase-verts: ~D~%" (-> obj base-verts)) + (format #t "~Tlevel0-verts: ~D~%" (-> obj level0-verts)) + (format #t "~Tlevel1-verts: ~D~%" (-> obj level1-verts)) + (format #t "~Tdma-cnt: ~D~%" (-> obj dma-cnt)) + (format #t "~Tdma-dta: ~D~%" (-> obj dma-dta)) + (format #t "~Tdma-tex: ~D~%" (-> obj dma-tex)) + (format #t "~Tstrips: ~D~%" (-> obj strips)) + (format #t "~Tdrawpoints: ~D~%" (-> obj drawpoints)) + (format #t "~Tvif: ~D~%" (-> obj vif)) + obj + ) + +;; definition of type tfrag-packet +(deftype tfrag-packet (structure) + ((tag uint128 2 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type tfrag-packet +(defmethod inspect tfrag-packet ((obj tfrag-packet)) + (format #t "[~8x] ~A~%" obj 'tfrag-packet) + (format #t "~Ttag[2] @ #x~X~%" (-> obj tag)) + obj + ) + +;; definition of type tfrag-work +(deftype tfrag-work (structure) + ((base-tmpl dma-packet :inline :offset-assert 0) + (level-0-tmpl dma-packet :inline :offset-assert 16) + (common-tmpl dma-packet :inline :offset-assert 32) + (level-1-tmpl dma-packet :inline :offset-assert 48) + (color-tmpl dma-packet :inline :offset-assert 64) + (frag-dists vector :inline :offset-assert 80) + (max-dist vector :inline :offset-assert 96) + (min-dist vector :inline :offset-assert 112) + (color-ptr vector4w :inline :offset-assert 128) + (tr-stat-tfrag tr-stat :offset-assert 144) + (tr-stat-tfrag-near tr-stat :offset-assert 148) + (vu1-enable-tfrag int32 :offset-assert 152) + (vu1-enable-tfrag-near int32 :offset-assert 156) + (cur-vis-bits uint32 :offset-assert 160) + (end-vis-bits uint32 :offset-assert 164) + (src-ptr uint32 :offset-assert 168) + (last-call uint32 :offset-assert 172) + (dma-buffer basic :offset-assert 176) + (test-id uint32 :offset-assert 180) + (wait-from-spr uint32 :offset-assert 184) + (wait-to-spr uint32 :offset-assert 188) + (near-wait-from-spr uint32 :offset-assert 192) + (near-wait-to-spr uint32 :offset-assert 196) + ) + :method-count-assert 9 + :size-assert #xc8 + :flag-assert #x9000000c8 + ) + +;; definition for method 3 of type tfrag-work +(defmethod inspect tfrag-work ((obj tfrag-work)) + (format #t "[~8x] ~A~%" obj 'tfrag-work) + (format #t "~Tbase-tmpl: #~%" (-> obj base-tmpl)) + (format #t "~Tlevel-0-tmpl: #~%" (-> obj level-0-tmpl)) + (format #t "~Tcommon-tmpl: #~%" (-> obj common-tmpl)) + (format #t "~Tlevel-1-tmpl: #~%" (-> obj level-1-tmpl)) + (format #t "~Tcolor-tmpl: #~%" (-> obj color-tmpl)) + (format #t "~Tfrag-dists: #~%" (-> obj frag-dists)) + (format #t "~Tmax-dist: #~%" (-> obj max-dist)) + (format #t "~Tmin-dist: #~%" (-> obj min-dist)) + (format #t "~Tcolor-ptr: #~%" (-> obj color-ptr)) + (format #t "~Ttr-stat-tfrag: #~%" (-> obj tr-stat-tfrag)) + (format + #t + "~Ttr-stat-tfrag-near: #~%" + (-> obj tr-stat-tfrag-near) + ) + (format #t "~Tvu1-enable-tfrag: ~D~%" (-> obj vu1-enable-tfrag)) + (format #t "~Tvu1-enable-tfrag-near: ~D~%" (-> obj vu1-enable-tfrag-near)) + (format #t "~Tcur-vis-bits: ~D~%" (-> obj cur-vis-bits)) + (format #t "~Tend-vis-bits: ~D~%" (-> obj end-vis-bits)) + (format #t "~Tsrc-ptr: ~D~%" (-> obj src-ptr)) + (format #t "~Tlast-call: ~D~%" (-> obj last-call)) + (format #t "~Tdma-buffer: ~A~%" (-> obj dma-buffer)) + (format #t "~Ttest-id: ~D~%" (-> obj test-id)) + (format #t "~Twait-from-spr: ~D~%" (-> obj wait-from-spr)) + (format #t "~Twait-to-spr: ~D~%" (-> obj wait-to-spr)) + (format #t "~Tnear-wait-from-spr: ~D~%" (-> obj near-wait-from-spr)) + (format #t "~Tnear-wait-to-spr: ~D~%" (-> obj near-wait-to-spr)) + obj + ) + +;; definition of type tfrag-dma +(deftype tfrag-dma (structure) + ((banka tfragment 16 :inline :offset-assert 0) + (bankb tfragment 16 :inline :offset-assert 1024) + (outa uint128 128 :offset-assert 2048) + (outb uint128 128 :offset-assert 4096) + (colors rgba 2047 :offset-assert 6144) + ) + :method-count-assert 9 + :size-assert #x37fc + :flag-assert #x9000037fc + ) + +;; definition for method 3 of type tfrag-dma +(defmethod inspect tfrag-dma ((obj tfrag-dma)) + (format #t "[~8x] ~A~%" obj 'tfrag-dma) + (format #t "~Tbanka[16] @ #x~X~%" (-> obj banka)) + (format #t "~Tbankb[16] @ #x~X~%" (-> obj bankb)) + (format #t "~Touta[128] @ #x~X~%" (-> obj outa)) + (format #t "~Toutb[128] @ #x~X~%" (-> obj outb)) + (format #t "~Tcolors[2048] @ #x~X~%" (-> obj colors)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-19 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/tie/tie-h_REF.gc b/test/decompiler/reference/engine/gfx/tie/tie-h_REF.gc new file mode 100644 index 0000000000..fda3164511 --- /dev/null +++ b/test/decompiler/reference/engine/gfx/tie/tie-h_REF.gc @@ -0,0 +1,431 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type tie-fragment +(deftype tie-fragment (drawable) + ((gif-ref uint32 :offset 4) + (point-ref uint32 :offset 8) + (color-index uint16 :offset 12) + (base-colors uint8 :offset 14) + (tex-count uint16 :offset-assert 32) + (gif-count uint16 :offset-assert 34) + (vertex-count uint16 :offset-assert 36) + (color-count uint16 :offset-assert 38) + (num-tris uint16 :offset-assert 40) + (num-dverts uint16 :offset-assert 42) + (dp-ref uint32 :offset-assert 44) + (dp-qwc uint32 :offset-assert 48) + (generic-ref uint32 :offset-assert 52) + (generic-count uint32 :offset-assert 56) + (debug-lines basic :offset-assert 60) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + ) + +;; definition for method 3 of type tie-fragment +(defmethod inspect tie-fragment ((obj tie-fragment)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tgif-ref: #x~X~%" (-> obj gif-ref)) + (format #t "~Tpoint-ref: #x~X~%" (-> obj point-ref)) + (format #t "~Tcolor-index: ~D~%" (-> obj color-index)) + (format #t "~Tbase-colors: ~D~%" (-> obj base-colors)) + (format #t "~Ttex-count: ~D~%" (-> obj tex-count)) + (format #t "~Tgif-count: ~D~%" (-> obj gif-count)) + (format #t "~Tvertex-count: ~D~%" (-> obj vertex-count)) + (format #t "~Tcolor-count: ~D~%" (-> obj color-count)) + (format #t "~Tnum-tris: ~D~%" (-> obj num-tris)) + (format #t "~Tnum-dverts: ~D~%" (-> obj num-dverts)) + (format #t "~Tdp-ref: #x~X~%" (-> obj dp-ref)) + (format #t "~Tdp-qwc: ~D~%" (-> obj dp-qwc)) + (format #t "~Tgeneric-ref: #x~X~%" (-> obj generic-ref)) + (format #t "~Tgeneric-count: ~D~%" (-> obj generic-count)) + (format #t "~Tdebug-lines: ~A~%" (-> obj debug-lines)) + obj + ) + +;; definition of type instance-tie +(deftype instance-tie (instance) + ((color-indices uint32 :offset 8) + (bucket-ptr basic :offset 12) + (max-scale uint16 :offset 38) + (flags uint16 :offset 46) + ) + :method-count-assert 18 + :size-assert #x40 + :flag-assert #x1200000040 + ) + +;; definition for method 3 of type instance-tie +(defmethod inspect instance-tie ((obj instance-tie)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tbucket-index: ~D~%" (-> obj bucket-index)) + (format #t "~Torigin: #~%" (-> obj origin)) + (format #t "~Twind-index: ~D~%" (-> obj wind-index)) + (format #t "~Tcolor-indices: #x~X~%" (-> obj color-indices)) + (format #t "~Tbucket-ptr: ~A~%" (-> obj bucket-ptr)) + (format #t "~Tmax-scale: ~D~%" (-> obj max-scale)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + obj + ) + +;; definition of type drawable-inline-array-instance-tie +(deftype drawable-inline-array-instance-tie (drawable-inline-array) + ((data instance-tie 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 96) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + ) + +;; definition of type drawable-tree-instance-tie +(deftype drawable-tree-instance-tie (drawable-tree) + ((length int16 :offset 6) + (prototypes basic :offset 8) + ) + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition for method 3 of type drawable-tree-instance-tie +(defmethod inspect drawable-tree-instance-tie ((obj drawable-tree-instance-tie)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tdata[1] @ #x~X~%" (-> obj pad)) + (format #t "~Tprototypes: ~A~%" (-> obj prototypes)) + obj + ) + +;; definition of type prototype-tie +(deftype prototype-tie (drawable-inline-array) + ((data instance-tie 1 :inline :offset-assert 32) + (pad uint32 :offset-assert 96) + ) + :method-count-assert 18 + :size-assert #x64 + :flag-assert #x1200000064 + ) + +;; definition of type tie-matrix +(deftype tie-matrix (structure) + ((mat matrix :inline :offset-assert 0) + (morph qword :inline :offset-assert 64) + (fog qword :inline :offset-assert 80) + ) + :method-count-assert 9 + :size-assert #x60 + :flag-assert #x900000060 + ) + +;; definition for method 3 of type tie-matrix +(defmethod inspect tie-matrix ((obj tie-matrix)) + (format #t "[~8x] ~A~%" obj 'tie-matrix) + (format #t "~Tmat: #~%" (-> obj mat)) + (format #t "~Tmorph: #~%" (-> obj morph)) + (format #t "~Tfog: #~%" (-> obj fog)) + obj + ) + +;; definition of type instance-tie-work +(deftype instance-tie-work (structure) + ((wind-const vector :inline :offset-assert 0) + (hmge-d vector :inline :offset-assert 16) + (hvdf-offset vector :inline :offset-assert 32) + (wind-force vector :inline :offset-assert 48) + (constant vector :inline :offset-assert 64) + (far-morph vector :inline :offset-assert 80) + (dist-test vector :inline :offset-assert 96) + (min-dist vector :inline :offset-assert 112) + (guard-plane plane 4 :inline :offset-assert 128) + (upload-color-0 dma-packet :inline :offset-assert 192) + (upload-color-1 dma-packet :inline :offset-assert 208) + (upload-color-2 dma-packet :inline :offset-assert 224) + (upload-color-ret dma-packet :inline :offset-assert 240) + (upload-color-temp dma-packet :inline :offset-assert 256) + (generic-color-0 dma-packet :inline :offset-assert 272) + (generic-color-1 dma-packet :inline :offset-assert 288) + (generic-color-end dma-packet :inline :offset-assert 304) + (tie-near-perspective-matrix matrix :inline :offset-assert 320) + (wind-vectors uint32 :offset-assert 384) + (test-id uint32 :offset-assert 388) + (test-id2 uint32 :offset-assert 392) + (dma-buffer basic :offset-assert 396) + (to-spr uint32 :offset-assert 400) + (from-spr uint32 :offset-assert 404) + (wind-work uint32 :offset-assert 408) + (cur-vis-bits uint32 :offset-assert 412) + (end-vis-bits uint32 :offset-assert 416) + (first-generic-prototype uint32 :offset-assert 420) + (refl-fade-fac float :offset-assert 424) + (refl-fade-end float :offset-assert 428) + (flags uint32 :offset-assert 432) + (paused basic :offset-assert 436) + (wait-from-spr uint32 :offset-assert 440) + (wait-to-spr uint32 :offset-assert 444) + ) + :method-count-assert 9 + :size-assert #x1c0 + :flag-assert #x9000001c0 + ) + +;; definition for method 3 of type instance-tie-work +(defmethod inspect instance-tie-work ((obj instance-tie-work)) + (format #t "[~8x] ~A~%" obj 'instance-tie-work) + (format #t "~Twind-const: #~%" (-> obj wind-const)) + (format #t "~Thmge-d: #~%" (-> obj hmge-d)) + (format #t "~Thvdf-offset: #~%" (-> obj hvdf-offset)) + (format #t "~Twind-force: #~%" (-> obj wind-force)) + (format #t "~Tconstant: #~%" (-> obj constant)) + (format #t "~Tfar-morph: #~%" (-> obj far-morph)) + (format #t "~Tdist-test: #~%" (-> obj dist-test)) + (format #t "~Tmin-dist: #~%" (-> obj min-dist)) + (format #t "~Tguard-plane[4] @ #x~X~%" (-> obj guard-plane)) + (format #t "~Tupload-color-0: #~%" (-> obj upload-color-0)) + (format #t "~Tupload-color-1: #~%" (-> obj upload-color-1)) + (format #t "~Tupload-color-2: #~%" (-> obj upload-color-2)) + (format + #t + "~Tupload-color-ret: #~%" + (-> obj upload-color-ret) + ) + (format + #t + "~Tupload-color-temp: #~%" + (-> obj upload-color-temp) + ) + (format + #t + "~Tgeneric-color-0: #~%" + (-> obj generic-color-0) + ) + (format + #t + "~Tgeneric-color-1: #~%" + (-> obj generic-color-1) + ) + (format + #t + "~Tgeneric-color-end: #~%" + (-> obj generic-color-end) + ) + (format + #t + "~Ttie-near-perspective-matrix: #~%" + (-> obj tie-near-perspective-matrix) + ) + (format #t "~Twind-vectors: #x~X~%" (-> obj wind-vectors)) + (format #t "~Ttest-id: ~D~%" (-> obj test-id)) + (format #t "~Ttest-id2: ~D~%" (-> obj test-id2)) + (format #t "~Tdma-buffer: ~A~%" (-> obj dma-buffer)) + (format #t "~Tto-spr: ~D~%" (-> obj to-spr)) + (format #t "~Tfrom-spr: ~D~%" (-> obj from-spr)) + (format #t "~Twind-work: ~D~%" (-> obj wind-work)) + (format #t "~Tcur-vis-bits: ~D~%" (-> obj cur-vis-bits)) + (format #t "~Tend-vis-bits: ~D~%" (-> obj end-vis-bits)) + (format + #t + "~Tfirst-generic-prototype: #x~X~%" + (-> obj first-generic-prototype) + ) + (format #t "~Trefl-fade-fac: ~f~%" (-> obj refl-fade-fac)) + (format #t "~Trefl-fade-end: ~f~%" (-> obj refl-fade-end)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Tpaused: ~A~%" (-> obj paused)) + (format #t "~Twait-from-spr: ~D~%" (-> obj wait-from-spr)) + (format #t "~Twait-to-spr: ~D~%" (-> obj wait-to-spr)) + obj + ) + +;; definition of type instance-tie-dma +(deftype instance-tie-dma (structure) + ((banka instance-tie 32 :inline :offset-assert 0) + (bankb instance-tie 32 :inline :offset-assert 2048) + (outa uint128 256 :offset-assert 4096) + (outb uint128 256 :offset-assert 8192) + (work instance-tie-work :dynamic :offset-assert 12288) + ) + :method-count-assert 9 + :size-assert #x3000 + :flag-assert #x900003000 + ) + +;; definition for method 3 of type instance-tie-dma +(defmethod inspect instance-tie-dma ((obj instance-tie-dma)) + (format #t "[~8x] ~A~%" obj 'instance-tie-dma) + (format #t "~Tbanka[32] @ #x~X~%" (-> obj banka)) + (format #t "~Tbankb[32] @ #x~X~%" (-> obj bankb)) + (format #t "~Touta[256] @ #x~X~%" (-> obj outa)) + (format #t "~Toutb[256] @ #x~X~%" (-> obj outb)) + (format #t "~Twork: #~%" (-> obj work 0)) + obj + ) + +;; definition of type prototype-tie-work +(deftype prototype-tie-work (structure) + ((upload-palette-0 dma-packet :inline :offset-assert 0) + (upload-palette-1 dma-packet :inline :offset-assert 16) + (upload-model-0 dma-packet :inline :offset-assert 32) + (upload-model-1 dma-packet :inline :offset-assert 48) + (upload-model-2 dma-packet :inline :offset-assert 64) + (upload-model-3 dma-packet :inline :offset-assert 80) + (upload-model-near-0 dma-packet :inline :offset-assert 96) + (upload-model-near-1 dma-packet :inline :offset-assert 112) + (upload-model-near-2 dma-packet :inline :offset-assert 128) + (upload-model-near-3 dma-packet :inline :offset-assert 144) + (upload-model-near-4 dma-packet :inline :offset-assert 160) + (generic-envmap-shader dma-packet :inline :offset-assert 176) + (generic-palette dma-packet :inline :offset-assert 192) + (generic-model-0 dma-packet :inline :offset-assert 208) + (generic-model-1 dma-packet :inline :offset-assert 224) + (generic-model-2 dma-packet :inline :offset-assert 240) + (generic-model-next dma-packet :inline :offset-assert 256) + (clamp uint64 :offset-assert 272) + (prototype-array basic :offset-assert 280) + (generic-wait-from-spr uint32 :offset-assert 284) + (generic-wait-to-spr uint32 :offset-assert 288) + (wait-from-spr uint32 :offset-assert 292) + (wait-to-spr uint32 :offset-assert 296) + (near-wait-from-spr uint32 :offset-assert 300) + (near-wait-to-spr uint32 :offset-assert 304) + ) + :method-count-assert 9 + :size-assert #x134 + :flag-assert #x900000134 + ) + +;; definition for method 3 of type prototype-tie-work +(defmethod inspect prototype-tie-work ((obj prototype-tie-work)) + (format #t "[~8x] ~A~%" obj 'prototype-tie-work) + (format + #t + "~Tupload-palette-0: #~%" + (-> obj upload-palette-0) + ) + (format + #t + "~Tupload-palette-1: #~%" + (-> obj upload-palette-1) + ) + (format #t "~Tupload-model-0: #~%" (-> obj upload-model-0)) + (format #t "~Tupload-model-1: #~%" (-> obj upload-model-1)) + (format #t "~Tupload-model-2: #~%" (-> obj upload-model-2)) + (format #t "~Tupload-model-3: #~%" (-> obj upload-model-3)) + (format + #t + "~Tupload-model-near-0: #~%" + (-> obj upload-model-near-0) + ) + (format + #t + "~Tupload-model-near-1: #~%" + (-> obj upload-model-near-1) + ) + (format + #t + "~Tupload-model-near-2: #~%" + (-> obj upload-model-near-2) + ) + (format + #t + "~Tupload-model-near-3: #~%" + (-> obj upload-model-near-3) + ) + (format + #t + "~Tupload-model-near-4: #~%" + (-> obj upload-model-near-4) + ) + (format + #t + "~Tgeneric-envmap-shader: #~%" + (-> obj generic-envmap-shader) + ) + (format + #t + "~Tgeneric-palette: #~%" + (-> obj generic-palette) + ) + (format + #t + "~Tgeneric-model-0: #~%" + (-> obj generic-model-0) + ) + (format + #t + "~Tgeneric-model-1: #~%" + (-> obj generic-model-1) + ) + (format + #t + "~Tgeneric-model-2: #~%" + (-> obj generic-model-2) + ) + (format + #t + "~Tgeneric-model-next: #~%" + (-> obj generic-model-next) + ) + (format #t "~Tclamp: ~D~%" (-> obj clamp)) + (format #t "~Tprototype-array: ~A~%" (-> obj prototype-array)) + (format #t "~Tgeneric-wait-from-spr: ~D~%" (-> obj generic-wait-from-spr)) + (format #t "~Tgeneric-wait-to-spr: ~D~%" (-> obj generic-wait-to-spr)) + (format #t "~Twait-from-spr: ~D~%" (-> obj wait-from-spr)) + (format #t "~Twait-to-spr: ~D~%" (-> obj wait-to-spr)) + (format #t "~Tnear-wait-from-spr: ~D~%" (-> obj near-wait-from-spr)) + (format #t "~Tnear-wait-to-spr: ~D~%" (-> obj near-wait-to-spr)) + obj + ) + +;; definition of type prototype-tie-dma +(deftype prototype-tie-dma (structure) + ((colora rgba 256 :offset-assert 0) + (colorb rgba 256 :offset-assert 1024) + (outa uint128 256 :offset-assert 2048) + (outb uint128 256 :offset-assert 6144) + (length uint32 :offset-assert 10240) + (dma-buffer basic :offset-assert 10244) + (this-frag-count uint32 :offset-assert 10248) + (next uint32 4 :offset 10256) + (geometry uint32 4 :offset-assert 10272) + (frag-count uint8 4 :offset-assert 10288) + ) + :method-count-assert 9 + :size-assert #x2834 + :flag-assert #x900002834 + ) + +;; definition for method 3 of type prototype-tie-dma +(defmethod inspect prototype-tie-dma ((obj prototype-tie-dma)) + (format #t "[~8x] ~A~%" obj 'prototype-tie-dma) + (format #t "~Tcolora[256] @ #x~X~%" (-> obj colora)) + (format #t "~Tcolorb[256] @ #x~X~%" (-> obj colorb)) + (format #t "~Touta[256] @ #x~X~%" (-> obj outa)) + (format #t "~Toutb[256] @ #x~X~%" (-> obj outb)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tdma-buffer: ~A~%" (-> obj dma-buffer)) + (format #t "~Tthis-frag-count: ~D~%" (-> obj this-frag-count)) + (format #t "~Tnext[4] @ #x~X~%" (-> obj next)) + (format #t "~Tgeometry[4] @ #x~X~%" (-> obj geometry)) + (format #t "~Tfrag-count[4] @ #x~X~%" (-> obj frag-count)) + obj + ) + +;; definition for symbol *instance-tie-work-copy*, type basic +(define *instance-tie-work-copy* (the-as basic #f)) + +;; failed to figure out what this is: +(let ((v0-10 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/gfx/vis/bsp-h_REF.gc b/test/decompiler/reference/engine/gfx/vis/bsp-h_REF.gc new file mode 100644 index 0000000000..b68f5d576f --- /dev/null +++ b/test/decompiler/reference/engine/gfx/vis/bsp-h_REF.gc @@ -0,0 +1,247 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type bsp-node +(deftype bsp-node (structure) + ((front int32 :offset-assert 0) + (back int32 :offset-assert 4) + (front-flags uint32 :offset-assert 8) + (back-flags uint32 :offset-assert 12) + (plane vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type bsp-node +(defmethod inspect bsp-node ((obj bsp-node)) + (format #t "[~8x] ~A~%" obj 'bsp-node) + (format #t "~Tfront: ~D~%" (-> obj front)) + (format #t "~Tback: ~D~%" (-> obj back)) + (format #t "~Tfront-flags: ~D~%" (-> obj front-flags)) + (format #t "~Tback-flags: ~D~%" (-> obj back-flags)) + (format #t "~Tplane: #~%" (-> obj plane)) + obj + ) + +;; definition of type bsp-header +(deftype bsp-header (drawable) + ((info file-info :offset 4) + (all-visible-list (pointer uint16) :offset-assert 32) + (visible-list-length int32 :offset-assert 36) + (drawable-trees drawable-tree-array :offset-assert 40) + (pat pointer :offset-assert 44) + (pat-length int32 :offset-assert 48) + (unk-data-0 pointer :offset-assert 52) + (unk-data-0-len int32 :offset-assert 56) + (unk-data-1 pointer :offset-assert 60) + (unk-data-1-len int32 :offset-assert 64) + (unk-zero-0 uint32 :offset-assert 68) + (name symbol :offset-assert 72) + (nickname symbol :offset-assert 76) + (vis-info level-vis-info 8 :offset-assert 80) + (actors drawable-inline-array-actor :offset-assert 112) + (cameras (array entity-camera) :offset-assert 116) + (nodes (inline-array bsp-node) :offset-assert 120) + (level level :offset-assert 124) + (unk-data-2 uint32 5 :offset-assert 128) + (boxes box8s-array :offset-assert 148) + (unk-data-3 uint32 :offset-assert 152) + (ambients drawable-inline-array-ambient :offset-assert 156) + (unk-data-4 uint32 :offset-assert 160) + (unk-data-5 uint32 :offset-assert 164) + (adgifs adgif-shader-array :offset-assert 168) + (unk-data-6 pointer :offset-assert 172) + (unk-data-7 pointer :offset-assert 176) + (unk-data-8 uint32 55 :offset-assert 180) + ) + :method-count-assert 20 + :size-assert #x190 + :flag-assert #x1400000190 + (:methods + (dummy-18 () none 18) + (dummy-19 () none 19) + ) + ) + +;; definition of type game-level +(deftype game-level (basic) + ((master-bsp basic :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type game-level +(defmethod inspect game-level ((obj game-level)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tmaster-bsp: ~A~%" (-> obj master-bsp)) + obj + ) + +;; definition of type view-frustum +(deftype view-frustum (structure) + ((hither-top-left vector :inline :offset-assert 0) + (hither-top-right vector :inline :offset-assert 16) + (hither-bottom-left vector :inline :offset-assert 32) + (hither-bottom-right vector :inline :offset-assert 48) + (yon-top-left vector :inline :offset-assert 64) + (yon-top-right vector :inline :offset-assert 80) + (yon-bottom-left vector :inline :offset-assert 96) + (yon-bottom-right vector :inline :offset-assert 112) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) + +;; definition for method 3 of type view-frustum +(defmethod inspect view-frustum ((obj view-frustum)) + (format #t "[~8x] ~A~%" obj 'view-frustum) + (format #t "~Thither-top-left: #~%" (-> obj hither-top-left)) + (format #t "~Thither-top-right: #~%" (-> obj hither-top-right)) + (format + #t + "~Thither-bottom-left: #~%" + (-> obj hither-bottom-left) + ) + (format + #t + "~Thither-bottom-right: #~%" + (-> obj hither-bottom-right) + ) + (format #t "~Tyon-top-left: #~%" (-> obj yon-top-left)) + (format #t "~Tyon-top-right: #~%" (-> obj yon-top-right)) + (format #t "~Tyon-bottom-left: #~%" (-> obj yon-bottom-left)) + (format #t "~Tyon-bottom-right: #~%" (-> obj yon-bottom-right)) + obj + ) + +;; definition for method 3 of type bsp-header +(defmethod inspect bsp-header ((obj bsp-header)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tall-visible-list: #x~X~%" (-> obj all-visible-list)) + (format #t "~Tvisible-list-length: ~D~%" (-> obj visible-list-length)) + (format #t "~Tdrawable-trees: ~A~%" (-> obj drawable-trees)) + (format #t "~Tpat: #x~X~%" (-> obj pat)) + (format #t "~Tpat-length: ~D~%" (-> obj pat-length)) + (inspect-bsp-tree obj (the-as bsp-node (-> obj nodes))) + obj + ) + +;; definition (debug) for function inspect-bsp-tree +;; INFO: Return type mismatch bsp-header vs none. +(defun-debug inspect-bsp-tree ((arg0 bsp-header) (arg1 bsp-node)) + (cond + ((zero? arg1) + ) + (else + (format #t "_#x~X________________~%" arg1) + (let ((v0-1 (the-as object (inspect arg1))) + (s4-0 *print-column*) + ) + (set! *print-column* (+ *print-column* (the-as uint 64))) + (if (> (-> arg1 front) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 front))) + (set! v0-1 (format #t "_#x~X________________~%" arg1)) + ) + (if (> (-> arg1 back) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 back))) + (format #t "_#x~X________________~%" arg1) + ) + (set! *print-column* s4-0) + ) + ) + ) + (none) + ) + +;; definition for function map-bsp-tree +;; INFO: Return type mismatch bsp-header vs none. +(defun + map-bsp-tree + ((arg0 (function bsp-node none)) (arg1 bsp-header) (arg2 bsp-node)) + (cond + ((zero? arg2) + ) + (else + (if (> (-> arg2 front) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 front))) + (arg0 arg2) + ) + (if (> (-> arg2 back) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 back))) + (arg0 arg2) + ) + ) + ) + (none) + ) + +;; definition of type cl-stat +(deftype cl-stat (structure) + ((fragments uint32 :offset-assert 0) + (tris uint32 :offset-assert 4) + (output uint32 :offset-assert 8) + ) + :pack-me + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cl-stat +(defmethod inspect cl-stat ((obj cl-stat)) + (format #t "[~8x] ~A~%" obj 'cl-stat) + (format #t "~Tfragments: ~D~%" (-> obj fragments)) + (format #t "~Ttris: ~D~%" (-> obj tris)) + (format #t "~Toutput: ~D~%" (-> obj output)) + obj + ) + +;; definition of type collide-stats +(deftype collide-stats (structure) + ((other cl-stat :inline :offset-assert 0) + (total cl-stat :inline :offset-assert 12) + (nodes uint32 :offset-assert 24) + (calls uint32 :offset-assert 28) + (total-target stopwatch :inline :offset-assert 32) + (target-cache-fill stopwatch :inline :offset-assert 64) + (target-ray-poly stopwatch :inline :offset-assert 96) + (pad uint32 :offset-assert 124) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) + +;; definition for method 3 of type collide-stats +(defmethod inspect collide-stats ((obj collide-stats)) + (format #t "[~8x] ~A~%" obj 'collide-stats) + (format #t "~Tother: #~%" (-> obj other)) + (format #t "~Ttotal: #~%" (-> obj total)) + (format #t "~Tnodes: ~D~%" (-> obj nodes)) + (format #t "~Tcalls: ~D~%" (-> obj calls)) + (format #t "~Ttotal-target: #~%" (-> obj total-target)) + (format + #t + "~Ttarget-cache-fill: #~%" + (-> obj target-cache-fill) + ) + (format + #t + "~Ttarget-ray-poly: #~%" + (-> obj target-ray-poly) + ) + obj + ) + +;; failed to figure out what this is: +(let ((v0-6 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/level/level-h_REF.gc b/test/decompiler/reference/engine/level/level-h_REF.gc index 1d38250596..b071e0a6dd 100644 --- a/test/decompiler/reference/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/engine/level/level-h_REF.gc @@ -146,7 +146,7 @@ (status basic :offset-assert 20) (other basic :offset-assert 24) (heap kheap :inline :offset-assert 32) - (bsp basic :offset-assert 48) + (bsp bsp-header :offset-assert 48) (art-group basic :offset-assert 52) (info basic :offset-assert 56) (texture-page texture-page 9 :offset-assert 60) @@ -504,5 +504,3 @@ ) ) ) - - diff --git a/tools/MemoryDumpTool/main.cpp b/tools/MemoryDumpTool/main.cpp index 97280159ec..4bbbccb687 100644 --- a/tools/MemoryDumpTool/main.cpp +++ b/tools/MemoryDumpTool/main.cpp @@ -213,41 +213,44 @@ void inspect_basics(const Ram& ram, } for (auto& field : type->fields()) { - if (!field.is_array() && !field.is_inline() && !field.is_dynamic() && + if (!field.is_inline() && !field.is_dynamic() && (field.type() == TypeSpec("basic") || field.type() == TypeSpec("object") || field.type() == TypeSpec("uint32"))) { + int array_size = field.is_array() ? field.array_size() : 1; fmt::print(" field {}\n", field.name()); std::unordered_map type_frequency; for (auto base_addr : basics.at(name)) { - int field_addr = base_addr + field.offset(); - if (ram.word_in_memory(field_addr)) { - auto field_val = ram.word(field_addr); - if ((field_val & 0x7) == 4 && ram.word_in_memory(field_val - 4)) { - auto type_tag = ram.word(field_val - 4); - auto iter = types.find(type_tag); - if (iter != types.end()) { - if (iter->second == "symbol") { - auto sym_iter = symbols.addr_to_name.find(field_val); - if (sym_iter != symbols.addr_to_name.end()) { - type_frequency[fmt::format("(symbol {})", sym_iter->second)]++; + for (int elt_idx = 0; elt_idx < array_size; elt_idx++) { + int field_addr = base_addr + field.offset() + 4 * elt_idx; + if (ram.word_in_memory(field_addr)) { + auto field_val = ram.word(field_addr); + if ((field_val & 0x7) == 4 && ram.word_in_memory(field_val - 4)) { + auto type_tag = ram.word(field_val - 4); + auto iter = types.find(type_tag); + if (iter != types.end()) { + if (iter->second == "symbol") { + auto sym_iter = symbols.addr_to_name.find(field_val); + if (sym_iter != symbols.addr_to_name.end()) { + type_frequency[fmt::format("(symbol {})", sym_iter->second)]++; + } else { + type_frequency[iter->second]++; + } } else { type_frequency[iter->second]++; } } else { - type_frequency[iter->second]++; + type_frequency["_bad-type"]++; } + } else if (field_val == 0) { + type_frequency["0"]++; } else { - type_frequency["_bad-type"]++; + type_frequency["_not-basic-ptr"]++; } - } else if (field_val == 0) { - type_frequency["0"]++; } else { - type_frequency["_not-basic-ptr"]++; + type_frequency["_bad-field-memory"]++; } - } else { - type_frequency["_bad-field-memory"]++; } }