diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 2f16c4b82..80596eca2 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -2891,6 +2891,7 @@ ((name basic :offset-assert 0) (mode uint32 :offset-assert 4) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 @@ -4332,7 +4333,6 @@ ;; dma-disasm ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype vif-disasm-element (structure) ((mask uint32 :offset-assert 0) (tag vif-cmd-32 :offset-assert 4) ;; guessed by decompiler @@ -4345,14 +4345,17 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -;; (define-extern *vif-disasm-table* array) ;; (array vif-disasm-element) -;; (define-extern disasm-vif-details function) ;; (function symbol (pointer uint8) vif-cmd int symbol) -;; (define-extern disasm-vif-tag function) ;; (function (pointer vif-tag) int symbol symbol int) -;; (define-extern disasm-dma-tag function) ;; (function dma-tag symbol none) -;; (define-extern *dma-disasm* object) ;; symbol -;; (define-extern disasm-dma-list function) ;; (function dma-packet symbol symbol symbol int symbol) +(define-extern *vif-disasm-table* (array vif-disasm-element)) +(define-extern disasm-vif-details "Disassemble the data stored in a vif unpack." (function symbol (pointer uint8) vif-cmd int symbol)) +(define-extern disasm-vif-tag "Disassemble vif tag, and possibly the associated data." (function (pointer vif-tag) int symbol symbol int)) +(define-extern disasm-dma-tag "Disassemble just the 64-byte dma tag" (function dma-tag symbol none)) +(define-extern *dma-disasm* symbol) +(define-extern disasm-dma-list "Print out an entire DMA list. + If mode is #t, print vif tags too. If mode is 'details, also print data unpacked by vif-tags. + If verbose is #t, print out the addresses of each tag, and total size statistics. + If expected size is negative, it is ignored. Otherwise, only disassemble this much dma data." + (function dma-packet symbol symbol symbol int symbol)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pad ;; @@ -6504,54 +6507,51 @@ ;; texture-anim-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype texture-anim-layer (structure) - ((extra vector :inline :offset-assert 240) + ((extra vector :inline :offset 240) (func (function dma-buffer uint int int texture-anim-layer float int) :offset-assert 256) ;; guessed by decompiler - (func-id symbol :offset-assert 256) ;; guessed by decompiler + (func-id symbol :offset-assert 256 :overlay-at func) ;; guessed by decompiler (init-func (function texture-anim-layer int) :offset-assert 260) ;; guessed by decompiler - (init-func-id symbol :offset-assert 260) ;; guessed by decompiler + (init-func-id symbol :offset-assert 260 :overlay-at init-func) ;; guessed by decompiler (tex texture :offset-assert 264) ;; guessed by decompiler (start-time float :offset-assert 268) (end-time float :offset-assert 272) (tex-name string :offset-assert 276) ;; guessed by decompiler - (test uint64 :offset-assert 280) ;; gs-test - (alpha uint64 :offset-assert 288) ;; gs-alpha - (clamp uint64 :offset-assert 296) ;; gs-clamp - (start-color vector :inline :offset-assert 80) - (start-scale vector2 :inline :offset-assert 96) - (start-offset vector2 :inline :offset-assert 104) - (start-st-scale vector2 :inline :offset-assert 112) - (start-st-offset vector2 :inline :offset-assert 120) - (start-qs vector :inline :offset-assert 128) - (start-rot deg :offset-assert 144) ;; degrees - (start-st-rot deg :offset-assert 148) ;; degrees - (end-color vector :inline :offset-assert 160) - (end-scale vector2 :inline :offset-assert 176) - (end-offset vector2 :inline :offset-assert 184) - (end-st-scale vector2 :inline :offset-assert 192) - (end-st-offset vector2 :inline :offset-assert 200) - (end-qs vector :inline :offset-assert 208) - (end-rot deg :offset-assert 224) ;; degrees - (end-st-rot deg :offset-assert 228) ;; degrees + (test gs-test :offset-assert 280) ;; gs-test + (alpha gs-alpha :offset-assert 288) ;; gs-alpha + (clamp gs-clamp :offset-assert 296) ;; gs-clamp + (start-color vector :inline :offset 80) + (start-scale vector2 :inline :offset 96) + (start-offset vector2 :inline :offset 104) + (start-st-scale vector2 :inline :offset 112) + (start-st-offset vector2 :inline :offset 120) + (start-qs vector :inline :offset 128) + (start-rot degrees :offset 144) ;; degrees + (start-st-rot degrees :offset 148) ;; degrees + (end-color vector :inline :offset 160) + (end-scale vector2 :inline :offset 176) + (end-offset vector2 :inline :offset 184) + (end-st-scale vector2 :inline :offset 192) + (end-st-offset vector2 :inline :offset 200) + (end-qs vector :inline :offset 208) + (end-rot degrees :offset 224) ;; degrees + (end-st-rot degrees :offset 228) ;; degrees ) :method-count-assert 11 :size-assert #x130 :flag-assert #xb00000130 (:methods - (texture-anim-layer-method-9 () none) ;; 9 ;; (initialize-texture! (_type_) _type_) - (texture-anim-layer-method-10 () none) ;; 10 ;; (clear-texture! (_type_) _type_) + (initialize-texture! (_type_) _type_) ;; 9 + (clear-texture! (_type_) _type_) ;; 10 ) ) -|# -#| (deftype texture-anim (structure) ((num-layers uint32 :offset-assert 0) (func (function dma-buffer texture-anim int) :offset-assert 4) ;; guessed by decompiler - (func-id symbol :offset-assert 4) ;; guessed by decompiler + (func-id symbol :offset-assert 4 :overlay-at func) ;; guessed by decompiler (init-func (function texture-anim int) :offset-assert 8) ;; guessed by decompiler - (init-func-id symbol :offset-assert 8) ;; guessed by decompiler + (init-func-id symbol :offset-assert 8 :overlay-at init-func) ;; guessed by decompiler (tex texture :offset-assert 12) ;; guessed by decompiler (tex-name string :offset-assert 16) ;; guessed by decompiler (extra vector :inline :offset-assert 32) @@ -6559,39 +6559,31 @@ (frame-time float :offset-assert 52) (frame-delta float :offset-assert 56) (frame-mod float :offset-assert 60) - (test uint64 :offset-assert 64) ;; gs-test - (alpha uint64 :offset-assert 72) ;; gs-alpha - (clamp uint64 :offset-assert 80) ;; gs-clamp + (test gs-test :offset-assert 64) ;; gs-test + (alpha gs-alpha :offset-assert 72) ;; gs-alpha + (clamp gs-clamp :offset-assert 80) ;; gs-clamp (data texture-anim-layer :dynamic :offset-assert 88) ;; guessed by decompiler ) :method-count-assert 11 :size-assert #x58 :flag-assert #xb00000058 (:methods - (texture-anim-method-9 () none) ;; 9 ;; (init-textures! (_type_) _type_) - (texture-anim-method-10 () none) ;; 10 ;; (clear-textures! (_type_) _type_) + (init-textures! (_type_) _type_) ;; 9 + (clear-textures! (_type_) _type_) ;; 10 ) ) -|# -#| (deftype texture-anim-array (array) - ((type type :offset-assert 0) ;; guessed by decompiler - (length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (content-type type :offset-assert 12) ;; guessed by decompiler - ) + () :method-count-assert 11 :size-assert #x10 :flag-assert #xb00000010 (:methods - (texture-anim-array-method-9 () none) ;; 9 ;; (init! (_type_) _type_) - (texture-anim-array-method-10 () none) ;; 10 ;; (clear! (_type_) _type_) + (init! (_type_) _type_) ;; 9 + (clear! (_type_) _type_) ;; 10 ) ) -|# -#| (deftype texture-anim-work (structure) ((erase-tmpl dma-gif-packet :inline :offset-assert 0) (draw-tmpl dma-gif-packet :inline :offset-assert 32) @@ -6604,16 +6596,14 @@ (corner3 vector :inline :offset-assert 208) (const vector :inline :offset-assert 224) (color vector4w :inline :offset-assert 240) - (random vector4w 8 :offset-assert 256) ;; guessed by decompiler + (random vector4w 8 :inline :offset-assert 256) ;; guessed by decompiler (random-index uint8 :offset-assert 384) ) :method-count-assert 9 :size-assert #x181 :flag-assert #x900000181 ) -|# -#| (deftype clut16x16 (structure) ((clut rgba 256 :offset-assert 0) ;; guessed by decompiler ) @@ -6621,9 +6611,7 @@ :size-assert #x400 :flag-assert #x900000400 ) -|# -#| (deftype noise8x8 (structure) ((image uint8 64 :offset-assert 0) ;; guessed by decompiler ) @@ -6631,9 +6619,7 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype noise16x16 (structure) ((image uint8 256 :offset-assert 0) ;; guessed by decompiler ) @@ -6641,9 +6627,7 @@ :size-assert #x100 :flag-assert #x900000100 ) -|# -#| (deftype noise32x32 (structure) ((image uint8 1024 :offset-assert 0) ;; guessed by decompiler ) @@ -6651,9 +6635,7 @@ :size-assert #x400 :flag-assert #x900000400 ) -|# -#| (deftype noise64x64 (structure) ((image uint8 4096 :offset-assert 0) ;; guessed by decompiler ) @@ -6661,9 +6643,7 @@ :size-assert #x1000 :flag-assert #x900001000 ) -|# -#| (deftype noise128x128 (structure) ((image uint8 16384 :offset-assert 0) ;; guessed by decompiler ) @@ -6671,9 +6651,7 @@ :size-assert #x4000 :flag-assert #x900004000 ) -|# -#| (deftype fog8x256 (structure) ((image uint8 256 :offset-assert 0) ;; guessed by decompiler ) @@ -6681,11 +6659,9 @@ :size-assert #x100 :flag-assert #x900000100 ) -|# -#| (deftype fog-texture-work (structure) - ((corner vector 4 :offset-assert 0) ;; guessed by decompiler + ((corner vector 4 :inline :offset-assert 0) ;; guessed by decompiler (const vector :inline :offset-assert 64) (min-corner vector :inline :offset-assert 80) (max-corner vector :inline :offset-assert 96) @@ -6701,9 +6677,8 @@ :size-assert #x8c :flag-assert #x90000008c ) -|# -;; (define-extern *clut-translate* object) ;; (pointer uint8) +(define-extern *clut-translate* (pointer uint8)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; lights-h ;; @@ -6721,23 +6696,21 @@ ) |# -#| (deftype light (structure) ((direction vector :inline :offset-assert 0) (color rgbaf :inline :offset-assert 16) (extra vector :inline :offset-assert 32) - (level float :offset-assert 32) - (luminance float :offset-assert 40) - (priority float :offset-assert 44) - (bytes uint8 4 :offset-assert 36) ;; guessed by decompiler - (mask uint16 :offset-assert 36) - (palette-index int8 :offset-assert 39) + (level float :offset-assert 32 :overlay-at (-> extra x)) + (luminance float :offset-assert 40 :overlay-at (-> extra z)) + (priority float :offset-assert 44 :overlay-at (-> extra w)) + (bytes uint8 4 :offset-assert 36 :overlay-at (-> extra y)) ;; guessed by decompiler + (mask uint16 :offset-assert 36 :overlay-at bytes) + (palette-index int8 :offset-assert 39 :overlay-at (-> bytes 3)) ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# ;; (deftype light-shadow-mask (uint32) ;; () @@ -6804,7 +6777,6 @@ ) |# -#| (deftype light-group (structure) ((dir0 light :inline :offset-assert 0) (dir1 light :inline :offset-assert 48) @@ -6815,7 +6787,6 @@ :size-assert #xc0 :flag-assert #x9000000c0 ) -|# ;; (define-extern *light-hash* object) ;; light-hash @@ -6844,21 +6815,19 @@ ) |# -#| (deftype mood-fog (structure) ((fog-color vector :inline :offset-assert 0) (fog-dists vector :inline :offset-assert 16) - (fog-start meters :offset-assert 16) - (fog-end meters :offset-assert 20) - (fog-max float :offset-assert 24) - (fog-min float :offset-assert 28) + (fog-start meters :offset-assert 16 :overlay-at (-> fog-dists x)) + (fog-end meters :offset-assert 20 :overlay-at (-> fog-dists y)) + (fog-max float :offset-assert 24 :overlay-at (-> fog-dists z)) + (fog-min float :offset-assert 28 :overlay-at (-> fog-dists w)) (erase-color vector :inline :offset-assert 32) ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# #| (deftype mood-fog-table (structure) @@ -6911,7 +6880,6 @@ ) |# -#| (deftype mood-clouds (structure) ((cloud-min float :offset-assert 0) (cloud-max float :offset-assert 4) @@ -6920,7 +6888,6 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# #| (deftype mood-weather (structure) @@ -7065,7 +7032,6 @@ ) |# -#| (deftype mood-context-core (structure) ((current-fog mood-fog :inline :offset-assert 0) (current-sky-color vector :inline :offset-assert 48) @@ -7077,38 +7043,31 @@ :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype mood-context-core2 (mood-context-core) - ((light-group light-group 8 :offset-assert 112) ;; guessed by decompiler + ((light-group light-group 8 :inline :offset-assert 112) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x670 :flag-assert #x900000670 ) -|# -#| (deftype mood-context-core3 (mood-context-core2) - ((times vector 8 :offset-assert 1648) ;; guessed by decompiler + ((times vector 8 :inline :offset-assert 1648) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x6f0 :flag-assert #x9000006f0 ) -|# -#| (deftype mood-context (mood-context-core3) - ((itimes vector4w 4 :offset-assert 1776) ;; guessed by decompiler + ((itimes vector4w 4 :inline :offset-assert 1776) ;; guessed by decompiler (state uint32 32 :offset-assert 1840) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x7b0 :flag-assert #x9000007b0 ) -|# #| (deftype mood-control-work (structure) @@ -7390,8 +7349,10 @@ :flag-assert #x900000050 ) -(declare-type level basic) -#| +(declare-type entity-links-array inline-array-class) +(declare-type light-hash basic) +(declare-type engine basic) +(declare-type game-text-info structure) (deftype level (basic) ((name symbol :offset-assert 4) ;; guessed by decompiler (load-name symbol :offset-assert 8) ;; guessed by decompiler @@ -7399,10 +7360,9 @@ (index int32 :offset-assert 16) (status symbol :offset-assert 20) ;; guessed by decompiler (borrow-level level 5 :offset-assert 24) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. (borrow-from-level level :offset-assert 44) ;; guessed by decompiler (heap kheap :inline :offset-assert 48) - (borrow-heap kheap 5 :offset-assert 64) ;; guessed by decompiler + (borrow-heap kheap 5 :inline :offset-assert 64) ;; guessed by decompiler (bsp bsp-header :offset-assert 144) ;; guessed by decompiler (art-group load-dir-art-group :offset-assert 148) ;; guessed by decompiler (info level-load-info :offset-assert 152) ;; guessed by decompiler @@ -7410,8 +7370,9 @@ (loaded-texture-page texture-page 16 :offset-assert 236) ;; guessed by decompiler (loaded-texture-page-count int32 :offset-assert 300) (entity entity-links-array :offset-assert 304) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. - (upload-size int32 20 :offset-assert 388) ;; guessed by decompiler + (closest-object meters :offset-assert 308) + ;; ??? + (upload-size int32 20 :offset 388) ;; guessed by decompiler (inside-boxes? basic :offset-assert 468) (display? symbol :offset-assert 472) ;; guessed by decompiler (render? symbol :offset-assert 476) ;; guessed by decompiler @@ -7440,11 +7401,12 @@ (load-buffer-last dgo-header :offset-assert 4620) ;; uint32 (load-buffer-mode load-buffer-mode :offset-assert 4624) ;; guessed by decompiler (display-start-time uint64 :offset-assert 4632) ;; time-frame - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. + (memory-mask uint32 :offset-assert 4640) + ; (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. (task-mask task-mask :offset-assert 4644) - (tfrag-gs-test uint64 :offset-assert 4648) ;; gs-test - (texture-dirty-masks texture-mask 11 :offset-assert 4656) ;; guessed by decompiler - (texture-mask texture-mask 20 :offset-assert 4832) ;; guessed by decompiler + (tfrag-gs-test gs-test :offset-assert 4648) + (texture-dirty-masks texture-mask 11 :inline :offset-assert 4656) ;; guessed by decompiler + (texture-mask texture-mask 20 :inline :offset-assert 4832) ;; guessed by decompiler (sky-mask texture-mask :inline :offset-assert 5152) (tfrag-masks texture-masks-array :offset-assert 5168) ;; guessed by decompiler (tfrag-dists pointer :offset-assert 5172) ;; guessed by decompiler @@ -7461,15 +7423,15 @@ (draw-index int32 :offset-assert 5276) (part-engine engine :offset-assert 5280) ;; guessed by decompiler (user-object basic 4 :offset-assert 5284) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. (loaded-text-info-count int32 :offset-assert 5300) (loaded-text-info game-text-info 16 :offset-assert 5304) ;; guessed by decompiler (level-type type :offset-assert 5368) ;; guessed by decompiler (load-order uint64 :offset-assert 5376) ;; int64 - (eye-slot-lowres UNKNOWN 11 :offset-assert 5384) - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. - (eye-slot-highres UNKNOWN 11 :offset-assert 5395) - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. + (eye-slot-lowres uint8 11 :offset-assert 5384) + ; (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. + (eye-slot-highres uint8 11 :offset-assert 5395) + ; (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. + (unknown-pad uint8 14) ) :method-count-assert 30 :size-assert #x152c @@ -7498,25 +7460,25 @@ (level-method-29 () none) ;; 29 ;; (vis-clear (_type_) none) ) ) -|# -#| +(declare-type entity-links structure) + (deftype level-group (basic) ((length int32 :offset-assert 4) - (entity-link entity-links :offset-assert 16) + (unk-flag1 symbol) + (unk-flag2 symbol) + + (entity-link entity-links :offset 16) (border? symbol :offset-assert 20) ;; guessed by decompiler (vis? symbol :offset-assert 24) ;; guessed by decompiler (want-level basic :offset-assert 28) (receiving-level basic :offset-assert 32) (load-commands pair :offset-assert 36) ;; guessed by decompiler (play? symbol :offset-assert 40) ;; guessed by decompiler - (target-pos vector 2 :offset-assert 48) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. - (camera-pos vector 2 :offset-assert 80) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. + (target-pos vector 2 :inline :offset-assert 48) ;; guessed by decompiler + (camera-pos vector 2 :inline :offset-assert 80) ;; guessed by decompiler (heap kheap :inline :offset-assert 112) - (sound-bank basic 6 :offset-assert 128) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. + (sound-bank sound-bank-state 6 :inline :offset-assert 128) ;; guessed by decompiler (disk-load-timing? symbol :offset-assert 176) ;; guessed by decompiler (load-level symbol :offset-assert 180) ;; guessed by decompiler (load-size uint32 :offset-assert 184) @@ -7524,19 +7486,23 @@ (load-login-time float :offset-assert 192) (draw-level-count int32 :offset-assert 196) (draw-level level 11 :offset-assert 200) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. (draw-index-map uint8 11 :offset-assert 244) ;; guessed by decompiler (status-cache-sync uint16 :offset-assert 256) (load-order uint64 :offset-assert 264) - (level level 11 :offset-assert 324) ;; guessed by decompiler - (data UNKNOWN 11 :offset-assert 324) - (level0 level :inline :offset-assert 324) - (level1 level :inline :offset-assert 5748) - (level2 level :inline :offset-assert 11172) - (level3 level :inline :offset-assert 16596) - (level4 level :inline :offset-assert 22020) - (level5 level :inline :offset-assert 27444) - (level6 level :inline :offset-assert 4) + (level level 11 :inline :offset 320) ;; guessed by decompiler + ; (data UNKNOWN 11 :offset-assert 324) + (level0 level :inline :offset-assert 320 :overlay-at (-> level 0)) + (level1 level :inline :offset-assert 5744 :overlay-at (-> level 1)) + (level2 level :inline :offset-assert 11168 :overlay-at (-> level 2)) + (level3 level :inline :offset-assert 16592 :overlay-at (-> level 3)) + (level4 level :inline :offset-assert 22016 :overlay-at (-> level 4)) + (level5 level :inline :offset-assert 27440 :overlay-at (-> level 5)) + (level6 level :inline :overlay-at (-> level 6)) + (level7 level :inline :overlay-at (-> level 7)) + (level8 level :inline :overlay-at (-> level 8)) + (level9 level :inline :overlay-at (-> level 9)) + (level-default level :inline :offset-assert 54560 :overlay-at (-> level 10)) + (pad uint32) ) :method-count-assert 31 :size-assert #xea54 @@ -7567,12 +7533,11 @@ (level-group-method-30 () none) ;; 30 ;; (level-get-most-disposable (_type_) level) ) ) -|# -;; (define-extern *level* level-group) ;; level-group -;; (define-extern *draw-index* object) ;; int -;; (define-extern *level-index* object) ;; int -;; (define-extern *city-mode* object) +(define-extern *level* level-group) +(define-extern *draw-index* int) ;; +(define-extern *level-index* int) ;; int +(define-extern *city-mode* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; capture-h ;; @@ -7984,8 +7949,9 @@ ;; time-of-day-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype palette-fade-control (structure) + "Unused interface to the time-of-day control. Was used in jak 1 as an interface between level code, + and the code in mood.gc, which set the actual fade values for time-of-day." ((trans vector :inline :offset-assert 0) (fade float :offset-assert 16) (actor-dist float :offset-assert 20) @@ -7994,24 +7960,25 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype palette-fade-controls (basic) - ((control palette-fade-control 8 :offset-assert 16) ;; guessed by decompiler + "Unused interface to the time-of-day control. Was used in jak 1 as an interface between level code, + and the code in mood.gc, which set the actual fade values for time-of-day." + ((control palette-fade-control 8 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 11 :size-assert #x110 :flag-assert #xb00000110 (:methods - (palette-fade-controls-method-9 () none) ;; 9 ;; (reset! (_type_) none) - (palette-fade-controls-method-10 () none) ;; 10 ;; (set-fade! (_type_ int float float vector) object) + (reset! (_type_) none) ;; 9 + (set-fade! (_type_ int float float vector) object) ;; 10 ) ) -|# -#| +(declare-type sparticle-launch-control inline-array-class) + (deftype time-of-day-proc (process) + "Process for running things that change with the time-of-day, like lighting, sun/stars/moon, etc." ((hours int32 :offset-assert 128) (minutes int32 :offset-assert 132) (seconds int32 :offset-assert 136) @@ -8041,10 +8008,11 @@ :size-assert #x100 :flag-assert #xe00800100 ) -|# -#| (deftype time-of-day-palette (basic) + "Pre-baked lighting values used by rendering code. The exact meaning of this data can vary, + but in all cases, the time-of-day system can do linear interpolation of two palettes to + blend between them." ((width int32 :offset-assert 4) (height int32 :offset-assert 8) (pad int32 :offset-assert 12) @@ -8054,19 +8022,23 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| +(defenum time-of-day-palette-id + :type uint32 + :bitfield #t + ) + (deftype time-of-day-context (basic) + "A mix of inputs/outputs to the time-of-day system." ((interp float 10 :offset-assert 4) ;; guessed by decompiler (current-fog mood-fog :inline :offset-assert 48) (current-sky-color vector :inline :offset-assert 96) (current-env-color vector :inline :offset-assert 112) (current-prt-color vector :inline :offset-assert 128) (current-shadow-color vector :inline :offset-assert 144) - (light-group light-group 8 :offset-assert 160) ;; guessed by decompiler + (light-group light-group 8 :inline :offset-assert 160) ;; guessed by decompiler (current-clouds mood-clouds :inline :offset-assert 1696) - (times vector 8 :offset-assert 1712) ;; guessed by decompiler + (times vector 8 :inline :offset-assert 1712) ;; guessed by decompiler (title-light-group light-group :inline :offset-assert 1840) (rim-light-group light-group :inline :offset-assert 2032) (rim-light-group2 light-group :inline :offset-assert 2224) @@ -8092,10 +8064,9 @@ :size-assert #xa88 :flag-assert #x900000a88 ) -|# -#| (deftype time-of-day-dma (structure) + "Memory layout for the time-of-day interpolation functions." ((outa uint32 256 :offset-assert 0) ;; guessed by decompiler (outb uint32 256 :offset-assert 1024) ;; guessed by decompiler (banka uint32 256 :offset-assert 2048) ;; guessed by decompiler @@ -8105,10 +8076,9 @@ :size-assert #x1000 :flag-assert #x900001000 ) -|# -;; (define-extern *palette-fade-controls* object) ;; palette-fade-controls -;; (define-extern *time-of-day-context* time-of-day-context) ;; time-of-day-context +(define-extern *palette-fade-controls* palette-fade-controls) +(define-extern *time-of-day-context* time-of-day-context) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; profile ;; diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index bd1394f6e..ee881658d 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -38,5 +38,6 @@ "profile": [ ["L3", "(inline-array profile-spec)", 14], ["L2", "(pointer uint64)", 584] - ] + ], + "texture-anim-h": [["L1", "(pointer uint8)", 256]] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index af3babe62..b9d69d14c 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -212,5 +212,24 @@ [[3, 34], "a0", "dma-bucket"], [[34, 38], "a0", "dma-packet"] // [34, "a0", "(inline-array dma-bucket)"] + ], + "disasm-dma-list": [ + [43, "v1", "dma-packet"], + [266, "v1", "(pointer uint64)"], + [272, "v1", "(pointer uint64)"], + [133, "v1", "(pointer uint64)"], + [152, "v1", "(pointer uint64)"], + [167, "v1", "(pointer uint64)"], + [176, "v1", "(pointer uint64)"], + [198, "v1", "(pointer uint64)"], + [207, "v1", "(pointer uint64)"], + [238, "v1", "(pointer uint64)"], + [247, "v1", "(pointer uint64)"], + [282, "v1", "(pointer uint64)"], + [291, "v1", "(pointer uint64)"], + [324, "v1", "(pointer uint64)"], + [334, "v1", "(pointer uint64)"], + [141, "v1", "int"], + [25, "v1", "dma-tag"] ] } diff --git a/decompiler/config/jak3/ntsc_v1/var_names.jsonc b/decompiler/config/jak3/ntsc_v1/var_names.jsonc index d18d61afb..7339fcdd8 100644 --- a/decompiler/config/jak3/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak3/ntsc_v1/var_names.jsonc @@ -488,5 +488,36 @@ }, "dma-bucket-insert-tag": { "args": ["buckets", "bucket", "start-tag", "end-tag-to-patch"] + }, + "disasm-vif-details": { + "args": [ + "fmt-dest", + "vif-data", + "unpack-cmd", + "unpack-count" + ] + }, + "disasm-vif-tag": { + "args": [ + "tag", + "count", + "format-dest", + "details?" + ] + }, + "disasm-dma-tag": { + "args": [ + "tag", + "format-dest" + ] + }, + "disasm-dma-list": { + "args": [ + "data", + "mode", + "verbose", + "stream", + "expected-size" + ] } } diff --git a/goal_src/jak3/engine/dma/dma-disasm.gc b/goal_src/jak3/engine/dma/dma-disasm.gc index f22e7113e..5cc035259 100644 --- a/goal_src/jak3/engine/dma/dma-disasm.gc +++ b/goal_src/jak3/engine/dma/dma-disasm.gc @@ -7,3 +7,719 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +(deftype vif-disasm-element (structure) + ((mask uint32) + (tag vif-cmd-32) + (val uint32) + (print uint32) + (string1 string) + (string2 string) + ) + ) + + +(define *vif-disasm-table* + (new 'static 'boxed-array :type vif-disasm-element + (new 'static 'vif-disasm-element :mask #x7f :string1 "nop") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stcycl) :print #x2 :string1 "stcycl") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 offset) + :print #x1 + :string1 "offset" + :string2 "offset" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 base) :print #x1 :string1 "base" :string2 "base") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 itop) :print #x1 :string1 "itop" :string2 "addr") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 stmod) + :print #x1 + :string1 "stmod" + :string2 "mode" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 mskpath3) + :print #x1 + :string1 "mskpath3" + :string2 "mask" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mark) :print #x1 :string1 "mark" :string2 "mark") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flushe) :string1 "flushe") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flush) :string1 "flush") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flusha) :string1 "flusha") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 mscal) + :print #x1 + :string1 "mscal" + :string2 "addr" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscnt) :string1 "mscnt") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 mscalf) + :print #x1 + :string1 "mscalf" + :string2 "addr" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 stmask) + :print #x3 + :string1 "stmask" + :string2 "mask" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 strow) + :print #x4 + :string1 "strow" + :string2 "row" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 stcol) + :print #x4 + :string1 "stcol" + :string2 "col" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mpg) :print #x5 :string1 "mpg") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 direct) :print #x6 :string1 "direct") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 directhl) :print #x6 :string1 "directhl") + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-s-32) + :val #x10 + :print #x7 + :string1 "unpack-s-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-s-16) + :val #x8 + :print #x7 + :string1 "unpack-s-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-s-8) + :val #x4 + :print #x7 + :string1 "unpack-s-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v2-32) + :val #x8 + :print #x7 + :string1 "unpack-v2-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v2-16) + :val #x4 + :print #x7 + :string1 "unpack-v2-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v2-8) + :val #x2 + :print #x7 + :string1 "unpack-v2-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v3-32) + :val #xc + :print #x7 + :string1 "unpack-v3-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v3-16) + :val #x6 + :print #x7 + :string1 "unpack-v3-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v3-8) + :val #x3 + :print #x7 + :string1 "unpack-v3-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-32) + :val #x10 + :print #x7 + :string1 "unpack-v4-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-16) + :val #x8 + :print #x7 + :string1 "unpack-v4-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-8) + :val #x4 + :print #x7 + :string1 "unpack-v4-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-5) + :val #x2 + :print #x7 + :string1 "unpack-v4-5" + ) + (new 'static 'vif-disasm-element :print #x8) + ) + ) + +(defun disasm-vif-details ((fmt-dest symbol) (vif-data (pointer uint8)) (unpack-cmd vif-cmd) (unpack-count int)) + "Disassemble the data stored in a vif unpack." + (let ((s4-0 unpack-count)) + (cond + ((= unpack-cmd (vif-cmd unpack-v4-8)) + (let ((s3-0 (&-> vif-data 4))) + (dotimes (s2-0 s4-0) + (format + fmt-dest + " #x~X: #x~2X #x~2X #x~2X #x~2X~%" + (+ (+ (* s2-0 4) 4) (the-as int vif-data)) + (-> s3-0 (* s2-0 4)) + (-> s3-0 (+ (* s2-0 4) 1)) + (-> s3-0 (+ (* s2-0 4) 2)) + (-> s3-0 (+ (* s2-0 4) 3)) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-s-8)) + (let ((s3-1 (&-> vif-data 4))) + (dotimes (s2-1 s4-0) + (format fmt-dest " #x~X: #x~2x~%" (+ (+ s2-1 4) (the-as int vif-data)) unpack-count) + (-> s3-1 (* 3 s2-1)) + (-> s3-1 (+ (* 3 s2-1) 1)) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v4-32)) + (let ((s3-2 (&-> vif-data 4))) + (dotimes (s2-2 s4-0) + (format + fmt-dest + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* s2-2 16) 4) (the-as int vif-data)) + (-> (the-as (pointer uint32) (&+ s3-2 (* (* s2-2 4) 4)))) + (-> (the-as (pointer uint32) (&+ s3-2 (* (+ (* s2-2 4) 1) 4)))) + (-> (the-as (pointer uint32) (&+ s3-2 (* (+ (* s2-2 4) 2) 4)))) + (-> (the-as (pointer uint32) (&+ s3-2 (* (+ (* s2-2 4) 3) 4)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v4-16)) + (let ((s3-3 (&-> vif-data 4))) + (dotimes (s2-3 s4-0) + (format + fmt-dest + " #x~X: #x~4x #x~4x #x~4x #x~4x~%" + (+ (+ (* s2-3 8) 4) (the-as int vif-data)) + (-> (the-as (pointer uint16) (&+ s3-3 (* (* s2-3 4) 2)))) + (-> (the-as (pointer uint16) (&+ s3-3 (* (+ (* s2-3 4) 1) 2)))) + (-> (the-as (pointer uint16) (&+ s3-3 (* (+ (* s2-3 4) 2) 2)))) + (-> (the-as (pointer uint16) (&+ s3-3 (* (+ (* s2-3 4) 3) 2)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v3-32)) + (let ((s3-4 (&-> vif-data 4))) + (dotimes (s2-4 s4-0) + (format + fmt-dest + " #x~X: #x~8x #x~8x #x~8x~%" + (+ (+ (* 12 s2-4) 4) (the-as int vif-data)) + (-> (the-as (pointer uint32) (&+ s3-4 (* 12 s2-4)))) + (-> (the-as (pointer uint32) (&+ s3-4 (* (+ (* 3 s2-4) 1) 4)))) + (-> (the-as (pointer uint32) (&+ s3-4 (* (+ (* 3 s2-4) 2) 4)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v3-16)) + (let ((s3-5 (&-> vif-data 4))) + (dotimes (s2-5 s4-0) + (format + fmt-dest + " #x~X: #x~4x #x~4x #x~4x~%" + (+ (+ (* 6 s2-5) 4) (the-as int vif-data)) + (-> (the-as (pointer uint16) (&+ s3-5 (* 6 s2-5)))) + (-> (the-as (pointer uint16) (&+ s3-5 (* (+ (* 3 s2-5) 1) 2)))) + (-> (the-as (pointer uint16) (&+ s3-5 (* (+ (* 3 s2-5) 2) 2)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v2-16)) + (let ((s3-6 (&-> vif-data 4))) + (dotimes (s2-6 s4-0) + (format + fmt-dest + " #x~X: #x~4x #x~4x~%" + (+ (+ (* s2-6 4) 4) (the-as int vif-data)) + (-> (the-as (pointer uint16) (&+ s3-6 (* 6 s2-6)))) + (-> (the-as (pointer uint16) (&+ s3-6 (* (+ (* 3 s2-6) 1) 2)))) + ) + ) + ) + ) + (else + (format + fmt-dest + " #x~X: Data format #b~b not yet supported, add it for yourself!~%" + (&-> vif-data 4) + unpack-cmd + ) + ) + ) + ) + #f + ) + +(defun disasm-vif-tag ((tag (pointer vif-tag)) (count int) (format-dest symbol) (details? symbol)) + "Disassemble vif tag, and possibly the associated data." + (local-vars (sv-16 vif-cmd) (sv-32 (pointer vif-tag)) (sv-48 int) (sv-64 uint)) + (let ((gp-0 0)) + (while (< gp-0 (* count 4)) + (let ((s0-0 4)) + (let ((s1-0 (-> tag 0))) + (format format-dest " #x~X:" tag) + (dotimes (v1-0 (-> *vif-disasm-table* length)) + (set! sv-16 (-> s1-0 cmd)) + (when (= (logand sv-16 (-> *vif-disasm-table* v1-0 mask)) (-> *vif-disasm-table* v1-0 tag)) + (let ((a0-12 (-> *vif-disasm-table* v1-0 print))) + (cond + ((zero? a0-12) + (format format-dest " (~s :irq ~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq)) + ) + ((= a0-12 1) + (format + format-dest + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + (-> s1-0 imm) + ) + ) + ((= a0-12 2) + (let ((t1-1 (-> s1-0 imm))) + (format + format-dest + " (~s :irq ~D :wl ~D :cl ~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (shr (shl t1-1 48) 56) + (shr (shl t1-1 56) 56) + ) + ) + ) + ((= a0-12 3) + (set! s0-0 8) + (format + format-dest + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + (-> tag 1) + ) + ) + ((= a0-12 4) + (set! s0-0 20) + (format + format-dest + " (~s :irq ~D :~s " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + ) + (format format-dest "#x~X #x~X #x~X #x~X)~%" (-> tag 1) (-> tag 2) (-> tag 3) (-> tag 4)) + ) + ((= a0-12 5) + (format + format-dest + " (~s :irq ~D :instructions #x~D :addr #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (-> s1-0 imm) + ) + ) + ((= a0-12 6) + (if (-> s1-0 imm) + (set! s0-0 #x100000) + (set! s0-0 (the-as int (* (-> s1-0 imm) 16))) + ) + (format + format-dest + " (~s :irq ~D :qwc #x~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 imm) + ) + (set! sv-32 (&-> tag 1)) + (set! sv-48 0) + (while (< sv-48 (the-as int (-> s1-0 imm))) + (format + format-dest + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* sv-48 16) 4) (the-as int tag)) + (-> sv-32 (* sv-48 4)) + (-> sv-32 (+ (* sv-48 4) 1)) + (-> sv-32 (+ (* sv-48 4) 2)) + (-> sv-32 (+ (* sv-48 4) 3)) + ) + (set! sv-48 (+ sv-48 1)) + ) + #f + ) + ((= a0-12 7) + (set! s0-0 (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* v1-0 val) (-> s1-0 num)) 3)) 4))) + (set! sv-64 (-> s1-0 imm)) + (format + format-dest + " (~s :irq ~D :num ~D :addr #x~X " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (shr (shl sv-64 54) 54) + ) + (format + format-dest + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> s1-0 msk) + (shr (shl sv-64 48) 63) + (shr (shl sv-64 49) 63) + (the-as uint s0-0) + ) + (if details? + (disasm-vif-details + format-dest + (the-as (pointer uint8) tag) + (logand sv-16 (vif-cmd cmd-mask)) + (the-as int (-> s1-0 num)) + ) + ) + ) + ((= a0-12 8) + (format format-dest " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) + ) + ) + ) + (set! v1-0 (-> *vif-disasm-table* length)) + ) + ) + ) + (+! gp-0 s0-0) + (&+! tag s0-0) + ) + ) + (- gp-0 (* count 4)) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defun disasm-dma-tag ((tag dma-tag) (format-dest symbol)) + "Disassemble just the 64-byte dma tag" + (format format-dest "(dma-tag ") + (let ((t9-1 format) + (a0-2 format-dest) + (a1-2 "~s") + (v1-1 (-> tag id)) + ) + (t9-1 a0-2 a1-2 (cond + ((= v1-1 (dma-tag-id refe)) + "refe" + ) + ((= v1-1 (dma-tag-id refs)) + "refs" + ) + ((= v1-1 (dma-tag-id ret)) + "ret" + ) + ((= v1-1 (dma-tag-id cnt)) + "cnt" + ) + ((= v1-1 (dma-tag-id next)) + "next" + ) + ((= v1-1 (dma-tag-id call)) + "call" + ) + ((= v1-1 (dma-tag-id ref)) + "ref" + ) + ((= v1-1 (dma-tag-id end)) + "end" + ) + (else + "*unknown*" + ) + ) + ) + ) + (if (> (-> tag addr) 0) + (format format-dest " :addr #x~8x" (-> tag addr)) + ) + (if (> (-> tag qwc) 0) + (format format-dest " :qwc ~d" (-> tag qwc)) + ) + (if (> (-> tag spr) 0) + (format format-dest " :spr ~d" (-> tag spr)) + ) + (if (> (-> tag irq) 0) + (format format-dest " :irq ~d" (-> tag irq)) + ) + (if (> (-> tag pce) 0) + (format format-dest " :pce ~d" (-> tag pce)) + ) + (format format-dest ")~%") + (none) + ) + +(define *dma-disasm* #t) + +;; WARN: Check prologue - tricky store of a0 +(defun disasm-dma-list ((data dma-packet) (mode symbol) (verbose symbol) (stream symbol) (expected-size int)) + "Print out an entire DMA list. + If mode is #t, print vif tags too. If mode is 'details, also print data unpacked by vif-tags. + If verbose is #t, print out the addresses of each tag, and total size statistics. + If expected size is negative, it is ignored. Otherwise, only disassemble this much dma data." + (local-vars + (sv-16 object) + (sv-32 object) + (sv-48 int) + (sv-64 object) + (sv-80 object) + (sv-96 int) + (sv-112 dma-tag) + ) + (set! sv-32 data) + (let ((s2-0 mode) + (s3-0 verbose) + (gp-0 stream) + (s1-0 expected-size) + ) + (if s3-0 + (format gp-0 "~%--- ~X -----------------------------~%" sv-32) + ) + (let ((s0-0 #f)) + (let ((s4-0 0) + (s5-0 0) + ) + (set! sv-16 0) + (set! sv-48 0) + (set! sv-64 0) + (set! sv-80 1) + (set! sv-96 -1) + (set! sv-112 (new 'static 'dma-tag)) + (while (not s0-0) + (let ((t9-1 valid?) + (a0-2 sv-32) + (a1-2 #f) + (a2-2 "dma-list tag pointer") + ) + (cond + ((not (t9-1 a0-2 (the-as type a1-2) a2-2 #t gp-0)) + (format gp-0 "ERROR: dma-list tag pointer invalid~%") + (set! s0-0 'error) + ) + (else + (set! sv-112 (-> (the-as dma-packet sv-32) dma)) + (when (not (or (zero? s5-0) (let ((t9-3 valid?) + (a0-4 sv-16) + (a1-4 #f) + ) + (set! a2-2 "dma-list data pointer") + (t9-3 a0-4 (the-as type a1-4) a2-2 #t gp-0) + ) + ) + ) + (format gp-0 "ERROR: dma-list data pointer invalid~%") + (set! s0-0 'error) + ) + (when (logtest? (the-as dma-tag #x3ff0000) sv-112) + (format gp-0 "ERROR: dma tag has data in reserved bits ~X~%" (the-as none a2-2)) + (set! s0-0 'error) + ) + ) + ) + ) + (when (or s3-0 (= s0-0 'error)) + (format gp-0 "#x~8x: " sv-32) + (cond + ((zero? sv-96) + (format gp-0 " ") + ) + ((= sv-96 1) + (format gp-0 " ") + ) + ) + (disasm-dma-tag sv-112 gp-0) + ) + (cond + (s0-0 + ) + ((or (= (-> sv-112 id) (dma-tag-id ref)) (= (-> sv-112 id) (dma-tag-id refs)) (zero? (-> sv-112 id))) + (set! sv-16 (-> sv-112 addr)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (when s2-0 + (let ((v0-10 + (disasm-vif-tag (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) 2 gp-0 (= s2-0 'details)) + ) + ) + (disasm-vif-tag + (the-as (pointer vif-tag) (+ (the-as int sv-16) v0-10)) + (the-as int (- (* sv-48 4) (the-as uint (/ v0-10 4)))) + gp-0 + (= s2-0 'details) + ) + ) + ) + (set! sv-32 (&-> (the-as (pointer uint64) sv-32) 2)) + (if (= (-> sv-112 id) (dma-tag-id refe)) + (set! s0-0 #t) + ) + ) + ((= (-> sv-112 id) (dma-tag-id cnt)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (set! sv-32 (+ (the-as uint sv-32) (* (+ sv-48 1) 16))) + (the-as int sv-32) + ) + ((= (-> sv-112 id) (dma-tag-id next)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (when (= sv-32 (-> sv-112 addr)) + (format gp-0 "ERROR: next tag creates infinite loop.~%") + (set! s0-0 'error) + ) + (set! sv-32 (-> sv-112 addr)) + (the-as uint sv-32) + ) + ((= (-> sv-112 id) (dma-tag-id call)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (set! sv-32 (-> sv-112 addr)) + (set! sv-96 (+ sv-96 1)) + (cond + ((zero? sv-96) + (set! sv-64 (&+ (the-as (pointer uint64) sv-16) sv-48)) + (the-as (pointer uint64) sv-64) + ) + (else + (set! sv-80 (&+ (the-as (pointer uint64) sv-16) sv-48)) + (the-as (pointer uint64) sv-80) + ) + ) + ) + ((= (-> sv-112 id) (dma-tag-id ret)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (let ((v1-123 sv-96)) + (cond + ((zero? v1-123) + (set! sv-32 sv-64) + sv-32 + ) + ((= v1-123 1) + (set! sv-32 sv-80) + sv-32 + ) + (else + (set! s0-0 #t) + ) + ) + ) + (set! sv-96 (+ sv-96 -1)) + sv-96 + ) + ((= (-> sv-112 id) (dma-tag-id end)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (set! s0-0 #t) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + ) + (else + (format gp-0 "ERROR: Unknown DMA TAG command.~%") + (set! s0-0 'error) + ) + ) + (+! s4-0 sv-48) + (+! s5-0 1) + (if (and (>= s1-0 0) (>= s5-0 s1-0)) + (set! s0-0 #t) + ) + ) + (when (or s3-0 (= s0-0 'error)) + (format gp-0 "NOTICE: Total tags: ~d~%" s5-0) + (format gp-0 "NOTICE: Total QWC: ~d~%" s4-0) + (format gp-0 "--------------------------------~%~%") + ) + ) + (!= s0-0 'error) + ) + ) + ) diff --git a/goal_src/jak3/engine/gfx/foreground/lights-h.gc b/goal_src/jak3/engine/gfx/foreground/lights-h.gc index cf19f199e..f7acfbeba 100644 --- a/goal_src/jak3/engine/gfx/foreground/lights-h.gc +++ b/goal_src/jak3/engine/gfx/foreground/lights-h.gc @@ -5,5 +5,26 @@ ;; name in dgo: lights-h ;; dgos: GAME +;; temporary: remove these +(deftype light (structure) + ((direction vector :inline) + (color rgbaf :inline) + (extra vector :inline) + (level float :overlay-at (-> extra x)) + (luminance float :overlay-at (-> extra z)) + (priority float :overlay-at (-> extra w)) + (bytes uint8 4 :overlay-at (-> extra y)) + (mask uint16 :overlay-at bytes) + (palette-index int8 :overlay-at (-> bytes 3)) + ) + ) +(deftype light-group (structure) + ((dir0 light :inline) + (dir1 light :inline) + (dir2 light :inline) + (ambi light :inline) + ) + ) + ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/gfx/mood/mood-h.gc b/goal_src/jak3/engine/gfx/mood/mood-h.gc index db2c4068d..be54a8d7b 100644 --- a/goal_src/jak3/engine/gfx/mood/mood-h.gc +++ b/goal_src/jak3/engine/gfx/mood/mood-h.gc @@ -5,5 +5,52 @@ ;; name in dgo: mood-h ;; dgos: GAME +;; temporary: remove these once mood-h is decompiled fully: + +(deftype mood-fog (structure) + ((fog-color vector :inline) + (fog-dists vector :inline) + (fog-start meters :overlay-at (-> fog-dists x)) + (fog-end meters :overlay-at (-> fog-dists y)) + (fog-max float :overlay-at (-> fog-dists z)) + (fog-min float :overlay-at (-> fog-dists w)) + (erase-color vector :inline) + ) + ) +(deftype mood-range (structure) + ((data float 4 :offset-assert 0) + (min-cloud float :offset 0) + (max-cloud float :offset 4) + (min-fog float :offset 8) + (max-fog float :offset 12) + (quad uint128 :offset 0) + ) + ) +(deftype mood-context-core (structure) + ((current-fog mood-fog :inline) + (current-sky-color vector :inline) + (current-env-color vector :inline) + (current-prt-color vector :inline) + (current-shadow-color vector :inline) + ) + ) +(deftype mood-context-core2 (mood-context-core) + ((light-group light-group 8 :inline) + ) + ) +(deftype mood-context-core3 (mood-context-core2) + ((times vector 8 :inline) + ) + ) +(deftype mood-context (mood-context-core3) + ((itimes vector4w 4 :inline) + (state uint32 32) + ) + ) +(deftype mood-clouds (structure) + ((cloud-min float :offset-assert 0) + (cloud-max float :offset-assert 4) + ) + ) ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc b/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc index f18568f6a..6d2f85586 100644 --- a/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc +++ b/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc @@ -5,5 +5,124 @@ ;; name in dgo: time-of-day-h ;; dgos: GAME +(defenum time-of-day-palette-id + :type uint32 + :bitfield #t + ) + +(declare-type sparticle-launch-control inline-array-class) + ;; DECOMP BEGINS +(deftype palette-fade-control (structure) + "Unused interface to the time-of-day control. Was used in jak 1 as an interface between level code, +and the code in mood.gc, which set the actual fade values for time-of-day." + ((trans vector :inline) + (fade float) + (actor-dist float) + ) + ) + + +(deftype palette-fade-controls (basic) + "Unused interface to the time-of-day control. Was used in jak 1 as an interface between level code, +and the code in mood.gc, which set the actual fade values for time-of-day." + ((control palette-fade-control 8 :inline) + ) + (:methods + (reset! (_type_) none) + (set-fade! (_type_ int float float vector) object) + ) + ) + + +(define-perm *palette-fade-controls* palette-fade-controls (new 'global 'palette-fade-controls)) + +(deftype time-of-day-proc (process) + "Process for running things that change with the time-of-day, like lighting, sun/stars/moon, etc." + ((hours int32) + (minutes int32) + (seconds int32) + (old-frame uint64) + (current-frame uint64) + (frames uint64) + (time-of-day float) + (old-frame-save uint64) + (current-frame-save uint64) + (frames-save uint64) + (time-of-day-save float) + (time-ratio float) + (dest-time-ratio float) + (dest-time-delta float) + (sun-count int32) + (sun sparticle-launch-control) + (green-sun-count int32) + (green-sun sparticle-launch-control) + (moon-count int32) + (moon sparticle-launch-control) + (day-star-count int32) + (day-star basic) + (day-star-enable basic) + (start-timer int32) + ) + ) + + +(deftype time-of-day-palette (basic) + "Pre-baked lighting values used by rendering code. The exact meaning of this data can vary, +but in all cases, the time-of-day system can do linear interpolation of two palettes to +blend between them." + ((width int32) + (height int32) + (pad int32) + (data int32 1) + ) + ) + + +(deftype time-of-day-context (basic) + "A mix of inputs/outputs to the time-of-day system." + ((interp float 10) + (current-fog mood-fog :inline) + (current-sky-color vector :inline) + (current-env-color vector :inline) + (current-prt-color vector :inline) + (current-shadow-color vector :inline) + (light-group light-group 8 :inline) + (current-clouds mood-clouds :inline) + (times vector 8 :inline) + (title-light-group light-group :inline) + (rim-light-group light-group :inline) + (rim-light-group2 light-group :inline) + (rim-light-group3 light-group :inline) + (filter vector :inline) + (filter-color vector :inline) + (time float) + (target-interp float) + (erase-color rgba) + (sky symbol) + (special-mood basic) + (use-camera-other basic) + (title-updated symbol) + (mode time-of-day-palette-id) + (overide-enable symbol) + (overide-palette time-of-day-palette-id) + (max-rain float) + (fog-mult float) + (exterior-level basic) + (ocean-alpha float) + ) + ) + + +(deftype time-of-day-dma (structure) + "Memory layout for the time-of-day interpolation functions." + ((outa uint32 256) + (outb uint32 256) + (banka uint32 256) + (bankb uint32 256) + ) + ) + + +(define *time-of-day-context* (new 'static 'time-of-day-context)) diff --git a/goal_src/jak3/engine/gfx/texture/texture-anim-h.gc b/goal_src/jak3/engine/gfx/texture/texture-anim-h.gc index 70483d1b4..559835f32 100644 --- a/goal_src/jak3/engine/gfx/texture/texture-anim-h.gc +++ b/goal_src/jak3/engine/gfx/texture/texture-anim-h.gc @@ -7,3 +7,409 @@ ;; DECOMP BEGINS +(deftype texture-anim-layer (structure) + ((extra vector :inline :offset 240) + (func (function dma-buffer uint int int texture-anim-layer float int)) + (func-id symbol :overlay-at func) + (init-func (function texture-anim-layer int)) + (init-func-id symbol :overlay-at init-func) + (tex texture) + (start-time float) + (end-time float) + (tex-name string) + (test gs-test) + (alpha gs-alpha) + (clamp gs-clamp) + (start-color vector :inline :offset 80) + (start-scale vector2 :inline :offset 96) + (start-offset vector2 :inline :offset 104) + (start-st-scale vector2 :inline :offset 112) + (start-st-offset vector2 :inline :offset 120) + (start-qs vector :inline :offset 128) + (start-rot degrees :offset 144) + (start-st-rot degrees :offset 148) + (end-color vector :inline :offset 160) + (end-scale vector2 :inline :offset 176) + (end-offset vector2 :inline :offset 184) + (end-st-scale vector2 :inline :offset 192) + (end-st-offset vector2 :inline :offset 200) + (end-qs vector :inline :offset 208) + (end-rot degrees :offset 224) + (end-st-rot degrees :offset 228) + ) + (:methods + (initialize-texture! (_type_) _type_) + (clear-texture! (_type_) _type_) + ) + ) + + +(deftype texture-anim (structure) + ((num-layers uint32) + (func (function dma-buffer texture-anim int)) + (func-id symbol :overlay-at func) + (init-func (function texture-anim int)) + (init-func-id symbol :overlay-at init-func) + (tex texture) + (tex-name string) + (extra vector :inline) + (color rgba) + (frame-time float) + (frame-delta float) + (frame-mod float) + (test gs-test) + (alpha gs-alpha) + (clamp gs-clamp) + (data texture-anim-layer :dynamic) + ) + (:methods + (init-textures! (_type_) _type_) + (clear-textures! (_type_) _type_) + ) + ) + + +(deftype texture-anim-array (array) + () + (:methods + (init! (_type_) _type_) + (clear! (_type_) _type_) + ) + ) + + +(deftype texture-anim-work (structure) + ((erase-tmpl dma-gif-packet :inline) + (draw-tmpl dma-gif-packet :inline) + (draw2-tmpl dma-gif-packet :inline) + (fill-tmpl dma-gif-packet :inline) + (adgif-tmpl dma-gif-packet :inline) + (corner0 vector :inline) + (corner1 vector :inline) + (corner2 vector :inline) + (corner3 vector :inline) + (const vector :inline) + (color vector4w :inline) + (random vector4w 8 :inline) + (random-index uint8) + ) + ) + + +(deftype clut16x16 (structure) + ((clut rgba 256) + ) + ) + + +(deftype noise8x8 (structure) + ((image uint8 64) + ) + ) + + +(deftype noise16x16 (structure) + ((image uint8 256) + ) + ) + + +(deftype noise32x32 (structure) + ((image uint8 1024) + ) + ) + + +(deftype noise64x64 (structure) + ((image uint8 4096) + ) + ) + + +(deftype noise128x128 (structure) + ((image uint8 16384) + ) + ) + + +(deftype fog8x256 (structure) + ((image uint8 256) + ) + ) + + +(deftype fog-texture-work (structure) + ((corner vector 4 :inline) + (const vector :inline) + (min-corner vector :inline) + (max-corner vector :inline) + (fog-near float) + (fog-far float) + (fog-delta float) + (alpha-near float) + (alpha-far float) + (alpha-delta float) + (color uint32) + ) + ) + + +(define *clut-translate* (new 'static 'array uint8 256 + #x0 + #x1 + #x2 + #x3 + #x4 + #x5 + #x6 + #x7 + #x10 + #x11 + #x12 + #x13 + #x14 + #x15 + #x16 + #x17 + #x8 + #x9 + #xa + #xb + #xc + #xd + #xe + #xf + #x18 + #x19 + #x1a + #x1b + #x1c + #x1d + #x1e + #x1f + #x20 + #x21 + #x22 + #x23 + #x24 + #x25 + #x26 + #x27 + #x30 + #x31 + #x32 + #x33 + #x34 + #x35 + #x36 + #x37 + #x28 + #x29 + #x2a + #x2b + #x2c + #x2d + #x2e + #x2f + #x38 + #x39 + #x3a + #x3b + #x3c + #x3d + #x3e + #x3f + #x40 + #x41 + #x42 + #x43 + #x44 + #x45 + #x46 + #x47 + #x50 + #x51 + #x52 + #x53 + #x54 + #x55 + #x56 + #x57 + #x48 + #x49 + #x4a + #x4b + #x4c + #x4d + #x4e + #x4f + #x58 + #x59 + #x5a + #x5b + #x5c + #x5d + #x5e + #x5f + #x60 + #x61 + #x62 + #x63 + #x64 + #x65 + #x66 + #x67 + #x70 + #x71 + #x72 + #x73 + #x74 + #x75 + #x76 + #x77 + #x68 + #x69 + #x6a + #x6b + #x6c + #x6d + #x6e + #x6f + #x78 + #x79 + #x7a + #x7b + #x7c + #x7d + #x7e + #x7f + #x80 + #x81 + #x82 + #x83 + #x84 + #x85 + #x86 + #x87 + #x90 + #x91 + #x92 + #x93 + #x94 + #x95 + #x96 + #x97 + #x88 + #x89 + #x8a + #x8b + #x8c + #x8d + #x8e + #x8f + #x98 + #x99 + #x9a + #x9b + #x9c + #x9d + #x9e + #x9f + #xa0 + #xa1 + #xa2 + #xa3 + #xa4 + #xa5 + #xa6 + #xa7 + #xb0 + #xb1 + #xb2 + #xb3 + #xb4 + #xb5 + #xb6 + #xb7 + #xa8 + #xa9 + #xaa + #xab + #xac + #xad + #xae + #xaf + #xb8 + #xb9 + #xba + #xbb + #xbc + #xbd + #xbe + #xbf + #xc0 + #xc1 + #xc2 + #xc3 + #xc4 + #xc5 + #xc6 + #xc7 + #xd0 + #xd1 + #xd2 + #xd3 + #xd4 + #xd5 + #xd6 + #xd7 + #xc8 + #xc9 + #xca + #xcb + #xcc + #xcd + #xce + #xcf + #xd8 + #xd9 + #xda + #xdb + #xdc + #xdd + #xde + #xdf + #xe0 + #xe1 + #xe2 + #xe3 + #xe4 + #xe5 + #xe6 + #xe7 + #xf0 + #xf1 + #xf2 + #xf3 + #xf4 + #xf5 + #xf6 + #xf7 + #xe8 + #xe9 + #xea + #xeb + #xec + #xed + #xee + #xef + #xf8 + #xf9 + #xfa + #xfb + #xfc + #xfd + #xfe + #xff + ) + ) diff --git a/goal_src/jak3/engine/level/level-h.gc b/goal_src/jak3/engine/level/level-h.gc index df5293728..56cfe2fa1 100644 --- a/goal_src/jak3/engine/level/level-h.gc +++ b/goal_src/jak3/engine/level/level-h.gc @@ -5,6 +5,18 @@ ;; name in dgo: level-h ;; dgos: GAME +(declare-type bsp-header basic) +(declare-type drawable basic) +(declare-type entity-links-array inline-array-class) +(declare-type light-hash basic) +(declare-type engine basic) +(declare-type game-text-info structure) +(declare-type entity-links structure) +(declare-type level-group basic) +(define-extern *level* level-group) +(define-extern *draw-index* int) +(define-extern *level-index* int) + ;; +++vis-info-flag (defenum vis-info-flag :type uint32 @@ -115,3 +127,383 @@ ;; DECOMP BEGINS +(deftype level-vis-info (basic) + ((level level) + (from-level symbol) + (from-bsp bsp-header) + (flags vis-info-flag) + (length uint32) + (allocated-length uint32) + (dictionary-length uint32) + (dictionary uint32) + (string-block uint32) + (ramdisk uint32) + (vis-bits uint32) + (current-vis-string uint32) + (vis-string uint32 :dynamic) + ) + ) + + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this level-vis-info)) + (the-as int (+ (-> level-vis-info size) (-> this dictionary-length))) + ) + +(deftype level-borrow-info (basic) + ((alias basic) + (borrow-size uint16 5) + (borrow-info object 5) + ) + ) + + +(deftype level-load-info (basic) + ((name-list symbol 6) + (name symbol :overlay-at (-> name-list 0)) + (visname symbol :overlay-at (-> name-list 1)) + (nickname symbol :overlay-at (-> name-list 2)) + (dbname symbol :overlay-at (-> name-list 3)) + (taskname symbol :overlay-at (-> name-list 4)) + (index int16) + (task-level uint8) + (part-engine-max uint8) + (master-level basic) + (level-flags uint32) + (packages pair) + (run-packages pair) + (memory-mode load-buffer-mode) + (music-bank symbol) + (sound-reverb float) + (extra-sound-bank pair) + (mood-func symbol) + (special-mood basic) + (ocean symbol) + (ocean-height float) + (ocean-alpha float) + (status-cache uint16) + (status-cache-sync uint16) + (priority int32) + (draw-priority float) + (base-task-mask task-mask) + (buffer-size uint32) + (city-map-bits uint64) + (bigmap-id bigmap-id) + (continues pair) + (callback-list basic) + (borrow basic) + (bottom-height meters) + (fog-height float) + (max-rain float) + (fog-mult float) + (mood-range mood-range :inline) + ) + (:methods + (level-load-info-method-9 (_type_) none) + (level-load-info-method-10 (_type_) none) + ) + ) + + +(deftype login-state (basic) + ((state int32) + (pos uint32) + (elts uint32) + (elt drawable 16) + ) + ) + + +(deftype level (basic) + ((name symbol) + (load-name symbol) + (nickname symbol) + (index int32) + (status symbol) + (borrow-level level 5) + (borrow-from-level level) + (heap kheap :inline) + (borrow-heap kheap 5 :inline) + (bsp bsp-header) + (art-group load-dir-art-group) + (info level-load-info) + (texture-page texture-page 20) + (loaded-texture-page texture-page 16) + (loaded-texture-page-count int32) + (entity entity-links-array) + (closest-object meters) + (upload-size int32 20 :offset 388) + (inside-boxes? basic) + (display? symbol) + (render? symbol) + (meta-inside? symbol) + (force-inside? symbol) + (load-id uint32) + (mood-context mood-context :inline) + (mood-func (function mood-context float int none)) + (mood-init (function mood-context none)) + (vis-bits pointer) + (all-visible? symbol) + (force-all-visible? symbol) + (linking symbol) + (vis-info level-vis-info 8) + (vis-self-index int32) + (vis-adj-index int32) + (vis-buffer uint8 2048) + (mem-usage-block memory-usage-block) + (mem-usage int32) + (code-memory-start pointer) + (code-memory-end pointer) + (load-start-time uint64) + (load-stop-time uint64) + (load-buffer uint32 2) + (load-buffer-size uint32) + (load-buffer-last dgo-header) + (load-buffer-mode load-buffer-mode) + (display-start-time uint64) + (memory-mask uint32) + (task-mask task-mask) + (tfrag-gs-test gs-test) + (texture-dirty-masks texture-mask 11 :inline) + (texture-mask texture-mask 20 :inline) + (sky-mask texture-mask :inline) + (tfrag-masks texture-masks-array) + (tfrag-dists pointer) + (shrub-masks texture-masks-array) + (shrub-dists pointer) + (alpha-masks texture-masks-array) + (alpha-dists pointer) + (water-masks texture-masks-array) + (water-dists pointer) + (tfrag-last-calls int32 6) + (texture-anim-array texture-anim-array 11) + (light-hash light-hash) + (draw-priority float) + (draw-index int32) + (part-engine engine) + (user-object basic 4) + (loaded-text-info-count int32) + (loaded-text-info game-text-info 16) + (level-type type) + (load-order uint64) + (eye-slot-lowres uint8 11) + (eye-slot-highres uint8 11) + (unknown-pad uint8 14) + ) + (:methods + (level-method-9 () none) + (level-method-10 () none) + (level-method-11 () none) + (level-method-12 () none) + (level-method-13 () none) + (level-method-14 () none) + (level-method-15 () none) + (level-method-16 () none) + (level-method-17 () none) + (level-method-18 () none) + (level-method-19 () none) + (level-method-20 () none) + (level-method-21 () none) + (level-method-22 () none) + (level-method-23 () none) + (level-method-24 () none) + (level-method-25 () none) + (level-method-26 () none) + (level-method-27 () none) + (level-method-28 () none) + (level-method-29 () none) + ) + ) + + +(deftype level-group (basic) + ((length int32) + (unk-flag1 symbol) + (unk-flag2 symbol) + (entity-link entity-links :offset 16) + (border? symbol) + (vis? symbol) + (want-level basic) + (receiving-level basic) + (load-commands pair) + (play? symbol) + (target-pos vector 2 :inline) + (camera-pos vector 2 :inline) + (heap kheap :inline) + (sound-bank sound-bank-state 6 :inline) + (disk-load-timing? symbol) + (load-level symbol) + (load-size uint32) + (load-time float) + (load-login-time float) + (draw-level-count int32) + (draw-level level 11) + (draw-index-map uint8 11) + (status-cache-sync uint16) + (load-order uint64) + (level level 11 :inline :offset 320) + (level0 level :inline :overlay-at (-> level 0)) + (level1 level :inline :offset 5744) + (level2 level :inline :offset 11168) + (level3 level :inline :offset 16592) + (level4 level :inline :offset 22016) + (level5 level :inline :offset 27440) + (level6 level :inline :offset 32864) + (level7 level :inline :offset 38288) + (level8 level :inline :offset 43712) + (level9 level :inline :offset 49136) + (level-default level :inline :offset 54560) + (pad uint32) + ) + (:methods + (level-group-method-9 () none) + (level-group-method-10 () none) + (level-group-method-11 () none) + (level-group-method-12 () none) + (level-group-method-13 () none) + (level-group-method-14 () none) + (level-group-method-15 () none) + (level-group-method-16 () none) + (level-group-method-17 () none) + (level-group-method-18 () none) + (level-group-method-19 () none) + (level-group-method-20 () none) + (level-group-method-21 () none) + (level-group-method-22 () none) + (level-group-method-23 () none) + (level-group-method-24 () none) + (level-group-method-25 () none) + (level-group-method-26 () none) + (level-group-method-27 () none) + (level-group-method-28 () none) + (level-group-method-29 () none) + (level-group-method-30 () none) + ) + ) + + +(when (zero? *level*) + (set! *level* + (new 'static 'level-group + :length 10 + :unk-flag1 #f + :unk-flag2 #f + :entity-link #f + :border? #f + :vis? #f + :want-level #f + :load-commands '() + :play? #f + :sound-bank (new 'static 'inline-array sound-bank-state 6 + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + ) + :disk-load-timing? #f + :status-cache-sync #x1 + :level (new 'static 'inline-array level 11 + (new 'static 'level :name #f :status 'inactive :inside-boxes? #f :force-inside? #f :linking #f :level-type #f) + (new 'static 'level + :name #f + :index 1 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 2 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 3 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 4 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 5 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 6 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 7 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 8 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 9 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name 'default + :index 10 + :status 'reserved + :bsp #f + :inside-boxes? #f + :display? #f + :force-inside? #f + :linking #f + :level-type #f + ) + ) + ) + ) + (set! *draw-index* 0) + (set! *level-index* 0) + 0 + ) + +(define *city-mode* #f) diff --git a/goal_src/jak3/engine/sound/gsound-h.gc b/goal_src/jak3/engine/sound/gsound-h.gc index 258286ab3..080685c1c 100644 --- a/goal_src/jak3/engine/sound/gsound-h.gc +++ b/goal_src/jak3/engine/sound/gsound-h.gc @@ -299,6 +299,7 @@ ((name basic) (mode uint32) ) + :pack-me ) diff --git a/test/decompiler/reference/jak3/engine/dma/dma-disasm_REF.gc b/test/decompiler/reference/jak3/engine/dma/dma-disasm_REF.gc new file mode 100644 index 000000000..fbb943a41 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/dma/dma-disasm_REF.gc @@ -0,0 +1,748 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition of type vif-disasm-element +(deftype vif-disasm-element (structure) + ((mask uint32) + (tag vif-cmd-32) + (val uint32) + (print uint32) + (string1 string) + (string2 string) + ) + ) + +;; definition for method 3 of type vif-disasm-element +(defmethod inspect ((this vif-disasm-element)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'vif-disasm-element) + (format #t "~1Tmask: ~D~%" (-> this mask)) + (format #t "~1Ttag: ~D~%" (-> this tag)) + (format #t "~1Tval: ~D~%" (-> this val)) + (format #t "~1Tprint: ~D~%" (-> this print)) + (format #t "~1Tstring1: ~A~%" (-> this string1)) + (format #t "~1Tstring2: ~A~%" (-> this string2)) + (label cfg-4) + this + ) + +;; definition for symbol *vif-disasm-table*, type (array vif-disasm-element) +(define *vif-disasm-table* + (new 'static 'boxed-array :type vif-disasm-element + (new 'static 'vif-disasm-element :mask #x7f :string1 "nop") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stcycl) :print #x2 :string1 "stcycl") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 offset) + :print #x1 + :string1 "offset" + :string2 "offset" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 base) :print #x1 :string1 "base" :string2 "base") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 itop) :print #x1 :string1 "itop" :string2 "addr") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 stmod) + :print #x1 + :string1 "stmod" + :string2 "mode" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 mskpath3) + :print #x1 + :string1 "mskpath3" + :string2 "mask" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mark) :print #x1 :string1 "mark" :string2 "mark") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flushe) :string1 "flushe") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flush) :string1 "flush") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flusha) :string1 "flusha") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 mscal) + :print #x1 + :string1 "mscal" + :string2 "addr" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscnt) :string1 "mscnt") + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 mscalf) + :print #x1 + :string1 "mscalf" + :string2 "addr" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 stmask) + :print #x3 + :string1 "stmask" + :string2 "mask" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 strow) + :print #x4 + :string1 "strow" + :string2 "row" + ) + (new 'static 'vif-disasm-element + :mask #x7f + :tag (vif-cmd-32 stcol) + :print #x4 + :string1 "stcol" + :string2 "col" + ) + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mpg) :print #x5 :string1 "mpg") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 direct) :print #x6 :string1 "direct") + (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 directhl) :print #x6 :string1 "directhl") + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-s-32) + :val #x10 + :print #x7 + :string1 "unpack-s-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-s-16) + :val #x8 + :print #x7 + :string1 "unpack-s-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-s-8) + :val #x4 + :print #x7 + :string1 "unpack-s-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v2-32) + :val #x8 + :print #x7 + :string1 "unpack-v2-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v2-16) + :val #x4 + :print #x7 + :string1 "unpack-v2-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v2-8) + :val #x2 + :print #x7 + :string1 "unpack-v2-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v3-32) + :val #xc + :print #x7 + :string1 "unpack-v3-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v3-16) + :val #x6 + :print #x7 + :string1 "unpack-v3-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v3-8) + :val #x3 + :print #x7 + :string1 "unpack-v3-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-32) + :val #x10 + :print #x7 + :string1 "unpack-v4-32" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-16) + :val #x8 + :print #x7 + :string1 "unpack-v4-16" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-8) + :val #x4 + :print #x7 + :string1 "unpack-v4-8" + ) + (new 'static 'vif-disasm-element + :mask #x6f + :tag (vif-cmd-32 unpack-v4-5) + :val #x2 + :print #x7 + :string1 "unpack-v4-5" + ) + (new 'static 'vif-disasm-element :print #x8) + ) + ) + +;; definition for function disasm-vif-details +(defun disasm-vif-details ((fmt-dest symbol) (vif-data (pointer uint8)) (unpack-cmd vif-cmd) (unpack-count int)) + "Disassemble the data stored in a vif unpack." + (let ((s4-0 unpack-count)) + (cond + ((= unpack-cmd (vif-cmd unpack-v4-8)) + (let ((s3-0 (&-> vif-data 4))) + (dotimes (s2-0 s4-0) + (format + fmt-dest + " #x~X: #x~2X #x~2X #x~2X #x~2X~%" + (+ (+ (* s2-0 4) 4) (the-as int vif-data)) + (-> s3-0 (* s2-0 4)) + (-> s3-0 (+ (* s2-0 4) 1)) + (-> s3-0 (+ (* s2-0 4) 2)) + (-> s3-0 (+ (* s2-0 4) 3)) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-s-8)) + (let ((s3-1 (&-> vif-data 4))) + (dotimes (s2-1 s4-0) + (format fmt-dest " #x~X: #x~2x~%" (+ (+ s2-1 4) (the-as int vif-data)) unpack-count) + (-> s3-1 (* 3 s2-1)) + (-> s3-1 (+ (* 3 s2-1) 1)) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v4-32)) + (let ((s3-2 (&-> vif-data 4))) + (dotimes (s2-2 s4-0) + (format + fmt-dest + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* s2-2 16) 4) (the-as int vif-data)) + (-> (the-as (pointer uint32) (&+ s3-2 (* (* s2-2 4) 4)))) + (-> (the-as (pointer uint32) (&+ s3-2 (* (+ (* s2-2 4) 1) 4)))) + (-> (the-as (pointer uint32) (&+ s3-2 (* (+ (* s2-2 4) 2) 4)))) + (-> (the-as (pointer uint32) (&+ s3-2 (* (+ (* s2-2 4) 3) 4)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v4-16)) + (let ((s3-3 (&-> vif-data 4))) + (dotimes (s2-3 s4-0) + (format + fmt-dest + " #x~X: #x~4x #x~4x #x~4x #x~4x~%" + (+ (+ (* s2-3 8) 4) (the-as int vif-data)) + (-> (the-as (pointer uint16) (&+ s3-3 (* (* s2-3 4) 2)))) + (-> (the-as (pointer uint16) (&+ s3-3 (* (+ (* s2-3 4) 1) 2)))) + (-> (the-as (pointer uint16) (&+ s3-3 (* (+ (* s2-3 4) 2) 2)))) + (-> (the-as (pointer uint16) (&+ s3-3 (* (+ (* s2-3 4) 3) 2)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v3-32)) + (let ((s3-4 (&-> vif-data 4))) + (dotimes (s2-4 s4-0) + (format + fmt-dest + " #x~X: #x~8x #x~8x #x~8x~%" + (+ (+ (* 12 s2-4) 4) (the-as int vif-data)) + (-> (the-as (pointer uint32) (&+ s3-4 (* 12 s2-4)))) + (-> (the-as (pointer uint32) (&+ s3-4 (* (+ (* 3 s2-4) 1) 4)))) + (-> (the-as (pointer uint32) (&+ s3-4 (* (+ (* 3 s2-4) 2) 4)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v3-16)) + (let ((s3-5 (&-> vif-data 4))) + (dotimes (s2-5 s4-0) + (format + fmt-dest + " #x~X: #x~4x #x~4x #x~4x~%" + (+ (+ (* 6 s2-5) 4) (the-as int vif-data)) + (-> (the-as (pointer uint16) (&+ s3-5 (* 6 s2-5)))) + (-> (the-as (pointer uint16) (&+ s3-5 (* (+ (* 3 s2-5) 1) 2)))) + (-> (the-as (pointer uint16) (&+ s3-5 (* (+ (* 3 s2-5) 2) 2)))) + ) + ) + ) + ) + ((= unpack-cmd (vif-cmd unpack-v2-16)) + (let ((s3-6 (&-> vif-data 4))) + (dotimes (s2-6 s4-0) + (format + fmt-dest + " #x~X: #x~4x #x~4x~%" + (+ (+ (* s2-6 4) 4) (the-as int vif-data)) + (-> (the-as (pointer uint16) (&+ s3-6 (* 6 s2-6)))) + (-> (the-as (pointer uint16) (&+ s3-6 (* (+ (* 3 s2-6) 1) 2)))) + ) + ) + ) + ) + (else + (format + fmt-dest + " #x~X: Data format #b~b not yet supported, add it for yourself!~%" + (&-> vif-data 4) + unpack-cmd + ) + ) + ) + ) + #f + ) + +;; definition for function disasm-vif-tag +;; INFO: Used lq/sq +(defun disasm-vif-tag ((tag (pointer vif-tag)) (count int) (format-dest symbol) (details? symbol)) + "Disassemble vif tag, and possibly the associated data." + (local-vars (sv-16 vif-cmd) (sv-32 (pointer vif-tag)) (sv-48 int) (sv-64 uint)) + (let ((gp-0 0)) + (while (< gp-0 (* count 4)) + (let ((s0-0 4)) + (let ((s1-0 (-> tag 0))) + (format format-dest " #x~X:" tag) + (dotimes (v1-0 (-> *vif-disasm-table* length)) + (set! sv-16 (-> s1-0 cmd)) + (when (= (logand sv-16 (-> *vif-disasm-table* v1-0 mask)) (-> *vif-disasm-table* v1-0 tag)) + (let ((a0-12 (-> *vif-disasm-table* v1-0 print))) + (cond + ((zero? a0-12) + (format format-dest " (~s :irq ~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq)) + ) + ((= a0-12 1) + (format + format-dest + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + (-> s1-0 imm) + ) + ) + ((= a0-12 2) + (let ((t1-1 (-> s1-0 imm))) + (format + format-dest + " (~s :irq ~D :wl ~D :cl ~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (shr (shl t1-1 48) 56) + (shr (shl t1-1 56) 56) + ) + ) + ) + ((= a0-12 3) + (set! s0-0 8) + (format + format-dest + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + (-> tag 1) + ) + ) + ((= a0-12 4) + (set! s0-0 20) + (format + format-dest + " (~s :irq ~D :~s " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + ) + (format format-dest "#x~X #x~X #x~X #x~X)~%" (-> tag 1) (-> tag 2) (-> tag 3) (-> tag 4)) + ) + ((= a0-12 5) + (format + format-dest + " (~s :irq ~D :instructions #x~D :addr #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (-> s1-0 imm) + ) + ) + ((= a0-12 6) + (if (-> s1-0 imm) + (set! s0-0 #x100000) + (set! s0-0 (the-as int (* (-> s1-0 imm) 16))) + ) + (format + format-dest + " (~s :irq ~D :qwc #x~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 imm) + ) + (set! sv-32 (&-> tag 1)) + (set! sv-48 0) + (while (< sv-48 (the-as int (-> s1-0 imm))) + (format + format-dest + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* sv-48 16) 4) (the-as int tag)) + (-> sv-32 (* sv-48 4)) + (-> sv-32 (+ (* sv-48 4) 1)) + (-> sv-32 (+ (* sv-48 4) 2)) + (-> sv-32 (+ (* sv-48 4) 3)) + ) + (set! sv-48 (+ sv-48 1)) + ) + #f + ) + ((= a0-12 7) + (set! s0-0 (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* v1-0 val) (-> s1-0 num)) 3)) 4))) + (set! sv-64 (-> s1-0 imm)) + (format + format-dest + " (~s :irq ~D :num ~D :addr #x~X " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (shr (shl sv-64 54) 54) + ) + (format + format-dest + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> s1-0 msk) + (shr (shl sv-64 48) 63) + (shr (shl sv-64 49) 63) + (the-as uint s0-0) + ) + (if details? + (disasm-vif-details + format-dest + (the-as (pointer uint8) tag) + (logand sv-16 (vif-cmd cmd-mask)) + (the-as int (-> s1-0 num)) + ) + ) + ) + ((= a0-12 8) + (format format-dest " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) + ) + ) + ) + (set! v1-0 (-> *vif-disasm-table* length)) + ) + ) + ) + (+! gp-0 s0-0) + (&+! tag s0-0) + ) + ) + (- gp-0 (* count 4)) + ) + ) + +;; definition for function disasm-dma-tag +;; WARN: Return type mismatch object vs none. +(defun disasm-dma-tag ((tag dma-tag) (format-dest symbol)) + "Disassemble just the 64-byte dma tag" + (format format-dest "(dma-tag ") + (let ((t9-1 format) + (a0-2 format-dest) + (a1-2 "~s") + (v1-1 (-> tag id)) + ) + (t9-1 a0-2 a1-2 (cond + ((= v1-1 (dma-tag-id refe)) + "refe" + ) + ((= v1-1 (dma-tag-id refs)) + "refs" + ) + ((= v1-1 (dma-tag-id ret)) + "ret" + ) + ((= v1-1 (dma-tag-id cnt)) + "cnt" + ) + ((= v1-1 (dma-tag-id next)) + "next" + ) + ((= v1-1 (dma-tag-id call)) + "call" + ) + ((= v1-1 (dma-tag-id ref)) + "ref" + ) + ((= v1-1 (dma-tag-id end)) + "end" + ) + (else + "*unknown*" + ) + ) + ) + ) + (if (> (-> tag addr) 0) + (format format-dest " :addr #x~8x" (-> tag addr)) + ) + (if (> (-> tag qwc) 0) + (format format-dest " :qwc ~d" (-> tag qwc)) + ) + (if (> (-> tag spr) 0) + (format format-dest " :spr ~d" (-> tag spr)) + ) + (if (> (-> tag irq) 0) + (format format-dest " :irq ~d" (-> tag irq)) + ) + (if (> (-> tag pce) 0) + (format format-dest " :pce ~d" (-> tag pce)) + ) + (format format-dest ")~%") + (none) + ) + +;; definition for symbol *dma-disasm*, type symbol +(define *dma-disasm* #t) + +;; definition for function disasm-dma-list +;; WARN: Check prologue - tricky store of a0 +;; INFO: Used lq/sq +(defun disasm-dma-list ((data dma-packet) (mode symbol) (verbose symbol) (stream symbol) (expected-size int)) + "Print out an entire DMA list. + If mode is #t, print vif tags too. If mode is 'details, also print data unpacked by vif-tags. + If verbose is #t, print out the addresses of each tag, and total size statistics. + If expected size is negative, it is ignored. Otherwise, only disassemble this much dma data." + (local-vars + (sv-16 object) + (sv-32 object) + (sv-48 int) + (sv-64 object) + (sv-80 object) + (sv-96 int) + (sv-112 dma-tag) + ) + (set! sv-32 data) + (let ((s2-0 mode) + (s3-0 verbose) + (gp-0 stream) + (s1-0 expected-size) + ) + (if s3-0 + (format gp-0 "~%--- ~X -----------------------------~%" sv-32) + ) + (let ((s0-0 #f)) + (let ((s4-0 0) + (s5-0 0) + ) + (set! sv-16 0) + (set! sv-48 0) + (set! sv-64 0) + (set! sv-80 1) + (set! sv-96 -1) + (set! sv-112 (new 'static 'dma-tag)) + (while (not s0-0) + (let ((t9-1 valid?) + (a0-2 sv-32) + (a1-2 #f) + (a2-2 "dma-list tag pointer") + ) + (cond + ((not (t9-1 a0-2 (the-as type a1-2) a2-2 #t gp-0)) + (format gp-0 "ERROR: dma-list tag pointer invalid~%") + (set! s0-0 'error) + ) + (else + (set! sv-112 (-> (the-as dma-packet sv-32) dma)) + (when (not (or (zero? s5-0) (let ((t9-3 valid?) + (a0-4 sv-16) + (a1-4 #f) + ) + (set! a2-2 "dma-list data pointer") + (t9-3 a0-4 (the-as type a1-4) a2-2 #t gp-0) + ) + ) + ) + (format gp-0 "ERROR: dma-list data pointer invalid~%") + (set! s0-0 'error) + ) + (when (logtest? (the-as dma-tag #x3ff0000) sv-112) + (format gp-0 "ERROR: dma tag has data in reserved bits ~X~%" (the-as none a2-2)) + (set! s0-0 'error) + ) + ) + ) + ) + (when (or s3-0 (= s0-0 'error)) + (format gp-0 "#x~8x: " sv-32) + (cond + ((zero? sv-96) + (format gp-0 " ") + ) + ((= sv-96 1) + (format gp-0 " ") + ) + ) + (disasm-dma-tag sv-112 gp-0) + ) + (cond + (s0-0 + ) + ((or (= (-> sv-112 id) (dma-tag-id ref)) (= (-> sv-112 id) (dma-tag-id refs)) (zero? (-> sv-112 id))) + (set! sv-16 (-> sv-112 addr)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (when s2-0 + (let ((v0-10 + (disasm-vif-tag (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) 2 gp-0 (= s2-0 'details)) + ) + ) + (disasm-vif-tag + (the-as (pointer vif-tag) (+ (the-as int sv-16) v0-10)) + (the-as int (- (* sv-48 4) (the-as uint (/ v0-10 4)))) + gp-0 + (= s2-0 'details) + ) + ) + ) + (set! sv-32 (&-> (the-as (pointer uint64) sv-32) 2)) + (if (= (-> sv-112 id) (dma-tag-id refe)) + (set! s0-0 #t) + ) + ) + ((= (-> sv-112 id) (dma-tag-id cnt)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (set! sv-32 (+ (the-as uint sv-32) (* (+ sv-48 1) 16))) + (the-as int sv-32) + ) + ((= (-> sv-112 id) (dma-tag-id next)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (when (= sv-32 (-> sv-112 addr)) + (format gp-0 "ERROR: next tag creates infinite loop.~%") + (set! s0-0 'error) + ) + (set! sv-32 (-> sv-112 addr)) + (the-as uint sv-32) + ) + ((= (-> sv-112 id) (dma-tag-id call)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (set! sv-32 (-> sv-112 addr)) + (set! sv-96 (+ sv-96 1)) + (cond + ((zero? sv-96) + (set! sv-64 (&+ (the-as (pointer uint64) sv-16) sv-48)) + (the-as (pointer uint64) sv-64) + ) + (else + (set! sv-80 (&+ (the-as (pointer uint64) sv-16) sv-48)) + (the-as (pointer uint64) sv-80) + ) + ) + ) + ((= (-> sv-112 id) (dma-tag-id ret)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (let ((v1-123 sv-96)) + (cond + ((zero? v1-123) + (set! sv-32 sv-64) + sv-32 + ) + ((= v1-123 1) + (set! sv-32 sv-80) + sv-32 + ) + (else + (set! s0-0 #t) + ) + ) + ) + (set! sv-96 (+ sv-96 -1)) + sv-96 + ) + ((= (-> sv-112 id) (dma-tag-id end)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (set! s0-0 #t) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* sv-48 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + ) + (else + (format gp-0 "ERROR: Unknown DMA TAG command.~%") + (set! s0-0 'error) + ) + ) + (+! s4-0 sv-48) + (+! s5-0 1) + (if (and (>= s1-0 0) (>= s5-0 s1-0)) + (set! s0-0 #t) + ) + ) + (when (or s3-0 (= s0-0 'error)) + (format gp-0 "NOTICE: Total tags: ~d~%" s5-0) + (format gp-0 "NOTICE: Total QWC: ~d~%" s4-0) + (format gp-0 "--------------------------------~%~%") + ) + ) + (!= s0-0 'error) + ) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/mood/time-of-day-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/mood/time-of-day-h_REF.gc new file mode 100644 index 000000000..e87de7880 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/mood/time-of-day-h_REF.gc @@ -0,0 +1,257 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type palette-fade-control +(deftype palette-fade-control (structure) + "Unused interface to the time-of-day control. Was used in jak 1 as an interface between level code, +and the code in mood.gc, which set the actual fade values for time-of-day." + ((trans vector :inline) + (fade float) + (actor-dist float) + ) + ) + +;; definition for method 3 of type palette-fade-control +(defmethod inspect ((this palette-fade-control)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'palette-fade-control) + (format #t "~1Ttrans: #~%" (-> this trans)) + (format #t "~1Tfade: ~f~%" (-> this fade)) + (format #t "~1Tactor-dist: ~f~%" (-> this actor-dist)) + (label cfg-4) + this + ) + +;; definition of type palette-fade-controls +(deftype palette-fade-controls (basic) + "Unused interface to the time-of-day control. Was used in jak 1 as an interface between level code, +and the code in mood.gc, which set the actual fade values for time-of-day." + ((control palette-fade-control 8 :inline) + ) + (:methods + (reset! (_type_) none) + (set-fade! (_type_ int float float vector) object) + ) + ) + +;; definition for method 3 of type palette-fade-controls +(defmethod inspect ((this palette-fade-controls)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tcontrol[8] @ #x~X~%" (-> this control)) + (label cfg-4) + this + ) + +;; definition (perm) for symbol *palette-fade-controls*, type palette-fade-controls +(define-perm *palette-fade-controls* palette-fade-controls (new 'global 'palette-fade-controls)) + +;; definition of type time-of-day-proc +(deftype time-of-day-proc (process) + "Process for running things that change with the time-of-day, like lighting, sun/stars/moon, etc." + ((hours int32) + (minutes int32) + (seconds int32) + (old-frame uint64) + (current-frame uint64) + (frames uint64) + (time-of-day float) + (old-frame-save uint64) + (current-frame-save uint64) + (frames-save uint64) + (time-of-day-save float) + (time-ratio float) + (dest-time-ratio float) + (dest-time-delta float) + (sun-count int32) + (sun sparticle-launch-control) + (green-sun-count int32) + (green-sun sparticle-launch-control) + (moon-count int32) + (moon sparticle-launch-control) + (day-star-count int32) + (day-star basic) + (day-star-enable basic) + (start-timer int32) + ) + ) + +;; definition for method 3 of type time-of-day-proc +(defmethod inspect ((this time-of-day-proc)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Thours: ~D~%" (-> this hours)) + (format #t "~2Tminutes: ~D~%" (-> this minutes)) + (format #t "~2Tseconds: ~D~%" (-> this seconds)) + (format #t "~2Told-frame: ~D~%" (-> this old-frame)) + (format #t "~2Tcurrent-frame: ~D~%" (-> this current-frame)) + (format #t "~2Tframes: ~D~%" (-> this frames)) + (format #t "~2Ttime-of-day: ~f~%" (-> this time-of-day)) + (format #t "~2Told-frame-save: ~D~%" (-> this old-frame-save)) + (format #t "~2Tcurrent-frame-save: ~D~%" (-> this current-frame-save)) + (format #t "~2Tframes-save: ~D~%" (-> this frames-save)) + (format #t "~2Ttime-of-day-save: ~f~%" (-> this time-of-day-save)) + (format #t "~2Ttime-ratio: ~f~%" (-> this time-ratio)) + (format #t "~2Tdest-time-ratio: ~f~%" (-> this dest-time-ratio)) + (format #t "~2Tdest-time-delta: ~f~%" (-> this dest-time-delta)) + (format #t "~2Tsun-count: ~D~%" (-> this sun-count)) + (format #t "~2Tsun: ~A~%" (-> this sun)) + (format #t "~2Tgreen-sun-count: ~D~%" (-> this green-sun-count)) + (format #t "~2Tgreen-sun: ~A~%" (-> this green-sun)) + (format #t "~2Tmoon-count: ~D~%" (-> this moon-count)) + (format #t "~2Tmoon: ~A~%" (-> this moon)) + (format #t "~2Tday-star-count: ~D~%" (-> this day-star-count)) + (format #t "~2Tday-star: ~A~%" (-> this day-star)) + (format #t "~2Tday-star-enable: ~A~%" (-> this day-star-enable)) + (format #t "~2Tstart-timer: ~D~%" (-> this start-timer)) + (label cfg-4) + this + ) + +;; definition of type time-of-day-palette +(deftype time-of-day-palette (basic) + "Pre-baked lighting values used by rendering code. The exact meaning of this data can vary, +but in all cases, the time-of-day system can do linear interpolation of two palettes to +blend between them." + ((width int32) + (height int32) + (pad int32) + (data int32 1) + ) + ) + +;; definition for method 3 of type time-of-day-palette +(defmethod inspect ((this time-of-day-palette)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Twidth: ~D~%" (-> this width)) + (format #t "~1Theight: ~D~%" (-> this height)) + (format #t "~1Tpad: ~D~%" (-> this pad)) + (format #t "~1Tdata[1] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; definition of type time-of-day-context +(deftype time-of-day-context (basic) + "A mix of inputs/outputs to the time-of-day system." + ((interp float 10) + (current-fog mood-fog :inline) + (current-sky-color vector :inline) + (current-env-color vector :inline) + (current-prt-color vector :inline) + (current-shadow-color vector :inline) + (light-group light-group 8 :inline) + (current-clouds mood-clouds :inline) + (times vector 8 :inline) + (title-light-group light-group :inline) + (rim-light-group light-group :inline) + (rim-light-group2 light-group :inline) + (rim-light-group3 light-group :inline) + (filter vector :inline) + (filter-color vector :inline) + (time float) + (target-interp float) + (erase-color rgba) + (sky symbol) + (special-mood basic) + (use-camera-other basic) + (title-updated symbol) + (mode time-of-day-palette-id) + (overide-enable symbol) + (overide-palette time-of-day-palette-id) + (max-rain float) + (fog-mult float) + (exterior-level basic) + (ocean-alpha float) + ) + ) + +;; definition for method 3 of type time-of-day-context +(defmethod inspect ((this time-of-day-context)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tinterp[10] @ #x~X~%" (-> this interp)) + (format #t "~1Tcurrent-fog: #~%" (-> this current-fog)) + (format #t "~1Tcurrent-sky-color: #~%" (-> this current-sky-color)) + (format #t "~1Tcurrent-env-color: #~%" (-> this current-env-color)) + (format #t "~1Tcurrent-prt-color: #~%" (-> this current-prt-color)) + (format #t "~1Tcurrent-shadow-color: #~%" (-> this current-shadow-color)) + (format #t "~1Tlight-group[8] @ #x~X~%" (-> this light-group)) + (format #t "~1Tcurrent-clouds: #~%" (-> this current-clouds)) + (format #t "~1Ttimes[8] @ #x~X~%" (-> this times)) + (format #t "~1Ttitle-light-group: #~%" (-> this title-light-group)) + (format #t "~1Trim-light-group: #~%" (-> this rim-light-group)) + (format #t "~1Trim-light-group2: #~%" (-> this rim-light-group2)) + (format #t "~1Trim-light-group3: #~%" (-> this rim-light-group3)) + (format #t "~1Tfilter: #~%" (-> this filter)) + (format #t "~1Tfilter-color: #~%" (-> this filter-color)) + (format #t "~1Ttime: ~f~%" (-> this time)) + (format #t "~1Ttarget-interp: ~f~%" (-> this target-interp)) + (format #t "~1Terase-color: ~D~%" (-> this erase-color)) + (format #t "~1Tsky: ~A~%" (-> this sky)) + (format #t "~1Tspecial-mood: ~A~%" (-> this special-mood)) + (format #t "~1Tuse-camera-other: ~A~%" (-> this use-camera-other)) + (format #t "~1Ttitle-updated: ~A~%" (-> this title-updated)) + (format #t "~1Tmode: ~D~%" (-> this mode)) + (format #t "~1Toveride-enable: ~A~%" (-> this overide-enable)) + (format #t "~1Toveride-palette: ~D~%" (-> this overide-palette)) + (format #t "~1Tmax-rain: ~f~%" (-> this max-rain)) + (format #t "~1Tfog-mult: ~f~%" (-> this fog-mult)) + (format #t "~1Texterior-level: ~A~%" (-> this exterior-level)) + (format #t "~1Tocean-alpha: ~f~%" (-> this ocean-alpha)) + (label cfg-4) + this + ) + +;; definition of type time-of-day-dma +(deftype time-of-day-dma (structure) + "Memory layout for the time-of-day interpolation functions." + ((outa uint32 256) + (outb uint32 256) + (banka uint32 256) + (bankb uint32 256) + ) + ) + +;; definition for method 3 of type time-of-day-dma +(defmethod inspect ((this time-of-day-dma)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'time-of-day-dma) + (format #t "~1Touta[256] @ #x~X~%" (-> this outa)) + (format #t "~1Toutb[256] @ #x~X~%" (-> this outb)) + (format #t "~1Tbanka[256] @ #x~X~%" (-> this banka)) + (format #t "~1Tbankb[256] @ #x~X~%" (-> this bankb)) + (label cfg-4) + this + ) + +;; definition for symbol *time-of-day-context*, type time-of-day-context +(define *time-of-day-context* (new 'static 'time-of-day-context)) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/texture/texture-anim-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/texture/texture-anim-h_REF.gc new file mode 100644 index 000000000..a8d8de66f --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/texture/texture-anim-h_REF.gc @@ -0,0 +1,628 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type texture-anim-layer +(deftype texture-anim-layer (structure) + ((extra vector :inline :offset 240) + (func (function dma-buffer uint int int texture-anim-layer float int)) + (func-id symbol :overlay-at func) + (init-func (function texture-anim-layer int)) + (init-func-id symbol :overlay-at init-func) + (tex texture) + (start-time float) + (end-time float) + (tex-name string) + (test gs-test) + (alpha gs-alpha) + (clamp gs-clamp) + (start-color vector :inline :offset 80) + (start-scale vector2 :inline :offset 96) + (start-offset vector2 :inline :offset 104) + (start-st-scale vector2 :inline :offset 112) + (start-st-offset vector2 :inline :offset 120) + (start-qs vector :inline :offset 128) + (start-rot degrees :offset 144) + (start-st-rot degrees :offset 148) + (end-color vector :inline :offset 160) + (end-scale vector2 :inline :offset 176) + (end-offset vector2 :inline :offset 184) + (end-st-scale vector2 :inline :offset 192) + (end-st-offset vector2 :inline :offset 200) + (end-qs vector :inline :offset 208) + (end-rot degrees :offset 224) + (end-st-rot degrees :offset 228) + ) + (:methods + (initialize-texture! (_type_) _type_) + (clear-texture! (_type_) _type_) + ) + ) + +;; definition for method 3 of type texture-anim-layer +(defmethod inspect ((this texture-anim-layer)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'texture-anim-layer) + (format #t "~1Textra: #~%" (-> this extra)) + (format #t "~1Tfunc: ~A~%" (-> this func)) + (format #t "~1Tfunc-id: ~A~%" (-> this func)) + (format #t "~1Tinit-func: ~A~%" (-> this init-func)) + (format #t "~1Tinit-func-id: ~A~%" (-> this init-func)) + (format #t "~1Ttex: ~A~%" (-> this tex)) + (format #t "~1Tstart-time: ~f~%" (-> this start-time)) + (format #t "~1Tend-time: ~f~%" (-> this end-time)) + (format #t "~1Ttex-name: ~A~%" (-> this tex-name)) + (format #t "~1Ttest: #x~X~%" (-> this test)) + (format #t "~1Talpha: #x~X~%" (-> this alpha)) + (format #t "~1Tclamp: #x~X~%" (-> this clamp)) + (format #t "~1Tstart-color: ~`vector`P~%" (-> this start-color)) + (format #t "~1Tstart-scale: ~`vector2`P~%" (-> this start-scale)) + (format #t "~1Tstart-offset: ~`vector2`P~%" (-> this start-offset)) + (format #t "~1Tstart-st-scale: ~`vector2`P~%" (-> this start-st-scale)) + (format #t "~1Tstart-st-offset: ~`vector2`P~%" (-> this start-st-offset)) + (format #t "~1Tstart-qs: ~`vector`P~%" (-> this start-qs)) + (format #t "~1Tstart-rot: (deg ~r)~%" (-> this start-rot)) + (format #t "~1Tstart-st-rot: (deg ~r)~%" (-> this start-st-rot)) + (format #t "~1Tend-color: ~`vector`P~%" (-> this end-color)) + (format #t "~1Tend-scale: ~`vector2`P~%" (-> this end-scale)) + (format #t "~1Tend-offset: ~`vector2`P~%" (-> this end-offset)) + (format #t "~1Tend-st-scale: ~`vector2`P~%" (-> this end-st-scale)) + (format #t "~1Tend-st-offset: ~`vector2`P~%" (-> this end-st-offset)) + (format #t "~1Tend-qs: ~`vector`P~%" (-> this end-qs)) + (format #t "~1Tend-rot: (deg ~r)~%" (-> this end-rot)) + (format #t "~1Tend-st-rot: (deg ~r)~%" (-> this end-st-rot)) + (label cfg-4) + this + ) + +;; definition of type texture-anim +(deftype texture-anim (structure) + ((num-layers uint32) + (func (function dma-buffer texture-anim int)) + (func-id symbol :overlay-at func) + (init-func (function texture-anim int)) + (init-func-id symbol :overlay-at init-func) + (tex texture) + (tex-name string) + (extra vector :inline) + (color rgba) + (frame-time float) + (frame-delta float) + (frame-mod float) + (test gs-test) + (alpha gs-alpha) + (clamp gs-clamp) + (data texture-anim-layer :dynamic) + ) + (:methods + (init-textures! (_type_) _type_) + (clear-textures! (_type_) _type_) + ) + ) + +;; definition for method 3 of type texture-anim +(defmethod inspect ((this texture-anim)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'texture-anim) + (format #t "~1Tnum-layers: ~D~%" (-> this num-layers)) + (format #t "~1Tfunc: ~A~%" (-> this func)) + (format #t "~1Tfunc-id: ~A~%" (-> this func)) + (format #t "~1Tinit-func: ~A~%" (-> this init-func)) + (format #t "~1Tinit-func-id: ~A~%" (-> this init-func)) + (format #t "~1Ttex: ~A~%" (-> this tex)) + (format #t "~1Ttex-name: ~A~%" (-> this tex-name)) + (format #t "~1Textra: #~%" (-> this extra)) + (format #t "~1Tcolor: #x~X~%" (-> this color)) + (format #t "~1Tframe-time: ~f~%" (-> this frame-time)) + (format #t "~1Tframe-delta: ~f~%" (-> this frame-delta)) + (format #t "~1Tframe-mod: ~f~%" (-> this frame-mod)) + (format #t "~1Ttest: #x~X~%" (-> this test)) + (format #t "~1Talpha: #x~X~%" (-> this alpha)) + (format #t "~1Tclamp: #x~X~%" (-> this clamp)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; definition of type texture-anim-array +(deftype texture-anim-array (array) + () + (:methods + (init! (_type_) _type_) + (clear! (_type_) _type_) + ) + ) + +;; definition for method 3 of type texture-anim-array +(defmethod inspect ((this texture-anim-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Ttype: ~A~%" (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tcontent-type: ~A~%" (-> this content-type)) + (label cfg-4) + this + ) + +;; definition of type texture-anim-work +(deftype texture-anim-work (structure) + ((erase-tmpl dma-gif-packet :inline) + (draw-tmpl dma-gif-packet :inline) + (draw2-tmpl dma-gif-packet :inline) + (fill-tmpl dma-gif-packet :inline) + (adgif-tmpl dma-gif-packet :inline) + (corner0 vector :inline) + (corner1 vector :inline) + (corner2 vector :inline) + (corner3 vector :inline) + (const vector :inline) + (color vector4w :inline) + (random vector4w 8 :inline) + (random-index uint8) + ) + ) + +;; definition for method 3 of type texture-anim-work +(defmethod inspect ((this texture-anim-work)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'texture-anim-work) + (format #t "~1Terase-tmpl: #~%" (-> this erase-tmpl)) + (format #t "~1Tdraw-tmpl: #~%" (-> this draw-tmpl)) + (format #t "~1Tdraw2-tmpl: #~%" (-> this draw2-tmpl)) + (format #t "~1Tfill-tmpl: #~%" (-> this fill-tmpl)) + (format #t "~1Tadgif-tmpl: #~%" (-> this adgif-tmpl)) + (format #t "~1Tcorner0: #~%" (-> this corner0)) + (format #t "~1Tcorner1: #~%" (-> this corner1)) + (format #t "~1Tcorner2: #~%" (-> this corner2)) + (format #t "~1Tcorner3: #~%" (-> this corner3)) + (format #t "~1Tconst: #~%" (-> this const)) + (format #t "~1Tcolor: #~%" (-> this color)) + (format #t "~1Trandom[8] @ #x~X~%" (-> this random)) + (format #t "~1Trandom-index: ~D~%" (-> this random-index)) + (label cfg-4) + this + ) + +;; definition of type clut16x16 +(deftype clut16x16 (structure) + ((clut rgba 256) + ) + ) + +;; definition for method 3 of type clut16x16 +(defmethod inspect ((this clut16x16)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'clut16x16) + (format #t "~1Tclut[256] @ #x~X~%" (-> this clut)) + (label cfg-4) + this + ) + +;; definition of type noise8x8 +(deftype noise8x8 (structure) + ((image uint8 64) + ) + ) + +;; definition for method 3 of type noise8x8 +(defmethod inspect ((this noise8x8)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'noise8x8) + (format #t "~1Timage[64] @ #x~X~%" (-> this image)) + (label cfg-4) + this + ) + +;; definition of type noise16x16 +(deftype noise16x16 (structure) + ((image uint8 256) + ) + ) + +;; definition for method 3 of type noise16x16 +(defmethod inspect ((this noise16x16)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'noise16x16) + (format #t "~1Timage[256] @ #x~X~%" (-> this image)) + (label cfg-4) + this + ) + +;; definition of type noise32x32 +(deftype noise32x32 (structure) + ((image uint8 1024) + ) + ) + +;; definition for method 3 of type noise32x32 +(defmethod inspect ((this noise32x32)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'noise32x32) + (format #t "~1Timage[1024] @ #x~X~%" (-> this image)) + (label cfg-4) + this + ) + +;; definition of type noise64x64 +(deftype noise64x64 (structure) + ((image uint8 4096) + ) + ) + +;; definition for method 3 of type noise64x64 +(defmethod inspect ((this noise64x64)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'noise64x64) + (format #t "~1Timage[4096] @ #x~X~%" (-> this image)) + (label cfg-4) + this + ) + +;; definition of type noise128x128 +(deftype noise128x128 (structure) + ((image uint8 16384) + ) + ) + +;; definition for method 3 of type noise128x128 +(defmethod inspect ((this noise128x128)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'noise128x128) + (format #t "~1Timage[16384] @ #x~X~%" (-> this image)) + (label cfg-4) + this + ) + +;; definition of type fog8x256 +(deftype fog8x256 (structure) + ((image uint8 256) + ) + ) + +;; definition for method 3 of type fog8x256 +(defmethod inspect ((this fog8x256)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'fog8x256) + (format #t "~1Timage[256] @ #x~X~%" (-> this image)) + (label cfg-4) + this + ) + +;; definition of type fog-texture-work +(deftype fog-texture-work (structure) + ((corner vector 4 :inline) + (const vector :inline) + (min-corner vector :inline) + (max-corner vector :inline) + (fog-near float) + (fog-far float) + (fog-delta float) + (alpha-near float) + (alpha-far float) + (alpha-delta float) + (color uint32) + ) + ) + +;; definition for method 3 of type fog-texture-work +(defmethod inspect ((this fog-texture-work)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'fog-texture-work) + (format #t "~1Tcorner[4] @ #x~X~%" (-> this corner)) + (format #t "~1Tconst: #~%" (-> this const)) + (format #t "~1Tmin-corner: #~%" (-> this min-corner)) + (format #t "~1Tmax-corner: #~%" (-> this max-corner)) + (format #t "~1Tfog-near: ~f~%" (-> this fog-near)) + (format #t "~1Tfog-far: ~f~%" (-> this fog-far)) + (format #t "~1Tfog-delta: ~f~%" (-> this fog-delta)) + (format #t "~1Talpha-near: ~f~%" (-> this alpha-near)) + (format #t "~1Talpha-far: ~f~%" (-> this alpha-far)) + (format #t "~1Talpha-delta: ~f~%" (-> this alpha-delta)) + (format #t "~1Tcolor: ~D~%" (-> this color)) + (label cfg-4) + this + ) + +;; definition for symbol *clut-translate*, type (pointer uint8) +(define *clut-translate* (new 'static 'array uint8 256 + #x0 + #x1 + #x2 + #x3 + #x4 + #x5 + #x6 + #x7 + #x10 + #x11 + #x12 + #x13 + #x14 + #x15 + #x16 + #x17 + #x8 + #x9 + #xa + #xb + #xc + #xd + #xe + #xf + #x18 + #x19 + #x1a + #x1b + #x1c + #x1d + #x1e + #x1f + #x20 + #x21 + #x22 + #x23 + #x24 + #x25 + #x26 + #x27 + #x30 + #x31 + #x32 + #x33 + #x34 + #x35 + #x36 + #x37 + #x28 + #x29 + #x2a + #x2b + #x2c + #x2d + #x2e + #x2f + #x38 + #x39 + #x3a + #x3b + #x3c + #x3d + #x3e + #x3f + #x40 + #x41 + #x42 + #x43 + #x44 + #x45 + #x46 + #x47 + #x50 + #x51 + #x52 + #x53 + #x54 + #x55 + #x56 + #x57 + #x48 + #x49 + #x4a + #x4b + #x4c + #x4d + #x4e + #x4f + #x58 + #x59 + #x5a + #x5b + #x5c + #x5d + #x5e + #x5f + #x60 + #x61 + #x62 + #x63 + #x64 + #x65 + #x66 + #x67 + #x70 + #x71 + #x72 + #x73 + #x74 + #x75 + #x76 + #x77 + #x68 + #x69 + #x6a + #x6b + #x6c + #x6d + #x6e + #x6f + #x78 + #x79 + #x7a + #x7b + #x7c + #x7d + #x7e + #x7f + #x80 + #x81 + #x82 + #x83 + #x84 + #x85 + #x86 + #x87 + #x90 + #x91 + #x92 + #x93 + #x94 + #x95 + #x96 + #x97 + #x88 + #x89 + #x8a + #x8b + #x8c + #x8d + #x8e + #x8f + #x98 + #x99 + #x9a + #x9b + #x9c + #x9d + #x9e + #x9f + #xa0 + #xa1 + #xa2 + #xa3 + #xa4 + #xa5 + #xa6 + #xa7 + #xb0 + #xb1 + #xb2 + #xb3 + #xb4 + #xb5 + #xb6 + #xb7 + #xa8 + #xa9 + #xaa + #xab + #xac + #xad + #xae + #xaf + #xb8 + #xb9 + #xba + #xbb + #xbc + #xbd + #xbe + #xbf + #xc0 + #xc1 + #xc2 + #xc3 + #xc4 + #xc5 + #xc6 + #xc7 + #xd0 + #xd1 + #xd2 + #xd3 + #xd4 + #xd5 + #xd6 + #xd7 + #xc8 + #xc9 + #xca + #xcb + #xcc + #xcd + #xce + #xcf + #xd8 + #xd9 + #xda + #xdb + #xdc + #xdd + #xde + #xdf + #xe0 + #xe1 + #xe2 + #xe3 + #xe4 + #xe5 + #xe6 + #xe7 + #xf0 + #xf1 + #xf2 + #xf3 + #xf4 + #xf5 + #xf6 + #xf7 + #xe8 + #xe9 + #xea + #xeb + #xec + #xed + #xee + #xef + #xf8 + #xf9 + #xfa + #xfb + #xfc + #xfd + #xfe + #xff + ) + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/level/level-h_REF.gc b/test/decompiler/reference/jak3/engine/level/level-h_REF.gc new file mode 100644 index 000000000..4564809f0 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/level/level-h_REF.gc @@ -0,0 +1,871 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type level-vis-info +(deftype level-vis-info (basic) + ((level level) + (from-level symbol) + (from-bsp bsp-header) + (flags vis-info-flag) + (length uint32) + (allocated-length uint32) + (dictionary-length uint32) + (dictionary uint32) + (string-block uint32) + (ramdisk uint32) + (vis-bits uint32) + (current-vis-string uint32) + (vis-string uint32 :dynamic) + ) + ) + +;; definition for method 3 of type level-vis-info +(defmethod inspect ((this level-vis-info)) + (when (not this) + (set! this this) + (goto cfg-68) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlevel: ~A~%" (-> this level)) + (format #t "~1Tfrom-level: ~A~%" (-> this from-level)) + (format #t "~1Tfrom-bsp: ~A~%" (-> this from-bsp)) + (format #t "~1Tflags: #x~X : (vis-info-flag " (-> this flags)) + (let ((s5-0 (-> this flags))) + (if (= (logand (vis-info-flag dummy22) s5-0) (vis-info-flag dummy22)) + (format #t "dummy22 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy14)) (vis-info-flag dummy14)) + (format #t "dummy14 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy9)) (vis-info-flag dummy9)) + (format #t "dummy9 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy10)) (vis-info-flag dummy10)) + (format #t "dummy10 ") + ) + (if (= (logand (vis-info-flag dummy23) s5-0) (vis-info-flag dummy23)) + (format #t "dummy23 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy15)) (vis-info-flag dummy15)) + (format #t "dummy15 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy5)) (vis-info-flag dummy5)) + (format #t "dummy5 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy7)) (vis-info-flag dummy7)) + (format #t "dummy7 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy1)) (vis-info-flag dummy1)) + (format #t "dummy1 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy11)) (vis-info-flag dummy11)) + (format #t "dummy11 ") + ) + (if (= (logand (vis-info-flag dummy28) s5-0) (vis-info-flag dummy28)) + (format #t "dummy28 ") + ) + (if (= (logand (vis-info-flag dummy24) s5-0) (vis-info-flag dummy24)) + (format #t "dummy24 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy3)) (vis-info-flag dummy3)) + (format #t "dummy3 ") + ) + (if (= (logand (vis-info-flag dummy16) s5-0) (vis-info-flag dummy16)) + (format #t "dummy16 ") + ) + (if (= (logand (vis-info-flag dummy17) s5-0) (vis-info-flag dummy17)) + (format #t "dummy17 ") + ) + (if (= (logand (vis-info-flag dummy20) s5-0) (vis-info-flag dummy20)) + (format #t "dummy20 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy12)) (vis-info-flag dummy12)) + (format #t "dummy12 ") + ) + (if (= (logand (vis-info-flag loading) s5-0) (vis-info-flag loading)) + (format #t "loading ") + ) + (if (= (logand (vis-info-flag dummy25) s5-0) (vis-info-flag dummy25)) + (format #t "dummy25 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy6)) (vis-info-flag dummy6)) + (format #t "dummy6 ") + ) + (if (= (logand (vis-info-flag vis-valid) s5-0) (shl #x8000 16)) + (format #t "vis-valid ") + ) + (if (= (logand (vis-info-flag in-iop) s5-0) (vis-info-flag in-iop)) + (format #t "in-iop ") + ) + (if (= (logand (vis-info-flag dummy18) s5-0) (vis-info-flag dummy18)) + (format #t "dummy18 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy8)) (vis-info-flag dummy8)) + (format #t "dummy8 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy2)) (vis-info-flag dummy2)) + (format #t "dummy2 ") + ) + (if (= (logand (vis-info-flag dummy21) s5-0) (vis-info-flag dummy21)) + (format #t "dummy21 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy13)) (vis-info-flag dummy13)) + (format #t "dummy13 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy4)) (vis-info-flag dummy4)) + (format #t "dummy4 ") + ) + (if (= (logand (vis-info-flag dummy26) s5-0) (vis-info-flag dummy26)) + (format #t "dummy26 ") + ) + (if (= (logand (vis-info-flag dummy27) s5-0) (vis-info-flag dummy27)) + (format #t "dummy27 ") + ) + (if (= (logand (vis-info-flag dummy19) s5-0) (vis-info-flag dummy19)) + (format #t "dummy19 ") + ) + (if (= (logand s5-0 (vis-info-flag dummy0)) (vis-info-flag dummy0)) + (format #t "dummy0 ") + ) + ) + (format #t ")~%") + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdictionary-length: ~D~%" (-> this dictionary-length)) + (format #t "~1Tdictionary: #x~X~%" (-> this dictionary)) + (format #t "~1Tstring-block: #x~X~%" (-> this string-block)) + (format #t "~1Tramdisk: ~D~%" (-> this ramdisk)) + (format #t "~1Tvis-bits: #x~X~%" (-> this vis-bits)) + (format #t "~1Tcurrent-vis-string: ~D~%" (-> this current-vis-string)) + (format #t "~1Tvis-string[0] @ #x~X~%" (-> this vis-string)) + (label cfg-68) + this + ) + +;; definition for method 5 of type level-vis-info +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this level-vis-info)) + (the-as int (+ (-> level-vis-info size) (-> this dictionary-length))) + ) + +;; definition of type level-borrow-info +(deftype level-borrow-info (basic) + ((alias basic) + (borrow-size uint16 5) + (borrow-info object 5) + ) + ) + +;; definition for method 3 of type level-borrow-info +(defmethod inspect ((this level-borrow-info)) + (when (not this) + (set! this this) + (goto cfg-10) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Talias: ~A~%" (-> this alias)) + (format #t "~1Tborrow-size[5] @ #x~X~%" (-> this borrow-size)) + (dotimes (s5-0 5) + (format #t "~T [~D]~1Tborrow-size: ~`integer`P~%" s5-0 (-> this borrow-size s5-0)) + ) + (format #t "~1Tborrow-info[5] @ #x~X~%" (-> this borrow-info)) + (dotimes (s5-1 5) + (format #t "~T [~D]~1Tborrow-info: ~`object`P~%" s5-1 (-> this borrow-info s5-1)) + ) + (label cfg-10) + this + ) + +;; definition of type level-load-info +(deftype level-load-info (basic) + ((name-list symbol 6) + (name symbol :overlay-at (-> name-list 0)) + (visname symbol :overlay-at (-> name-list 1)) + (nickname symbol :overlay-at (-> name-list 2)) + (dbname symbol :overlay-at (-> name-list 3)) + (taskname symbol :overlay-at (-> name-list 4)) + (index int16) + (task-level uint8) + (part-engine-max uint8) + (master-level basic) + (level-flags uint32) + (packages pair) + (run-packages pair) + (memory-mode load-buffer-mode) + (music-bank symbol) + (sound-reverb float) + (extra-sound-bank pair) + (mood-func symbol) + (special-mood basic) + (ocean symbol) + (ocean-height float) + (ocean-alpha float) + (status-cache uint16) + (status-cache-sync uint16) + (priority int32) + (draw-priority float) + (base-task-mask task-mask) + (buffer-size uint32) + (city-map-bits uint64) + (bigmap-id bigmap-id) + (continues pair) + (callback-list basic) + (borrow basic) + (bottom-height meters) + (fog-height float) + (max-rain float) + (fog-mult float) + (mood-range mood-range :inline) + ) + (:methods + (level-load-info-method-9 (_type_) none) + (level-load-info-method-10 (_type_) none) + ) + ) + +;; definition for method 3 of type level-load-info +(defmethod inspect ((this level-load-info)) + (when (not this) + (set! this this) + (goto cfg-42) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tname-list[6] @ #x~X~%" (-> this name-list)) + (format #t "~1Tname: ~A~%" (-> this name)) + (format #t "~1Tvisname: ~A~%" (-> this visname)) + (format #t "~1Tnickname: ~A~%" (-> this nickname)) + (format #t "~1Tdbname: ~A~%" (-> this dbname)) + (format #t "~1Ttaskname: ~A~%" (-> this taskname)) + (format #t "~1Tindex: ~D~%" (-> this index)) + (format #t "~1Ttask-level: ~D~%" (-> this task-level)) + (format #t "~1Tpart-engine-max: ~D~%" (-> this part-engine-max)) + (format #t "~1Tmaster-level: ~A~%" (-> this master-level)) + (format #t "~1Tlevel-flags: ~D~%" (-> this level-flags)) + (format #t "~1Tpackages: ~A~%" (-> this packages)) + (format #t "~1Trun-packages: ~A~%" (-> this run-packages)) + (format #t "~1Tmemory-mode: ~D~%" (-> this memory-mode)) + (format #t "~1Tmusic-bank: ~A~%" (-> this music-bank)) + (format #t "~1Tsound-reverb: ~f~%" (-> this sound-reverb)) + (format #t "~1Textra-sound-bank: ~A~%" (-> this extra-sound-bank)) + (format #t "~1Tmood-func: ~A~%" (-> this mood-func)) + (format #t "~1Tspecial-mood: ~A~%" (-> this special-mood)) + (format #t "~1Tocean: ~A~%" (-> this ocean)) + (format #t "~1Tocean-height: ~f~%" (-> this ocean-height)) + (format #t "~1Tocean-alpha: ~f~%" (-> this ocean-alpha)) + (format #t "~1Tstatus-cache: ~D~%" (-> this status-cache)) + (format #t "~1Tstatus-cache-sync: ~D~%" (-> this status-cache-sync)) + (format #t "~1Tpriority: ~D~%" (-> this priority)) + (format #t "~1Tdraw-priority: ~f~%" (-> this draw-priority)) + (format #t "~1Tbase-task-mask: #x~X : (task-mask " (-> this base-task-mask)) + (let ((s5-0 (-> this base-task-mask))) + (if (= (logand s5-0 (task-mask task0)) (task-mask task0)) + (format #t "task0 ") + ) + (if (= (logand s5-0 (task-mask task2)) (task-mask task2)) + (format #t "task2 ") + ) + (if (= (logand s5-0 (task-mask task4)) (task-mask task4)) + (format #t "task4 ") + ) + (if (= (logand s5-0 (task-mask task6)) (task-mask task6)) + (format #t "task6 ") + ) + (if (= (logand s5-0 (task-mask ctywide)) (task-mask ctywide)) + (format #t "ctywide ") + ) + (if (= (logand s5-0 (task-mask never)) (task-mask never)) + (format #t "never ") + ) + (if (= (logand (task-mask movie1) s5-0) (task-mask movie1)) + (format #t "movie1 ") + ) + (if (= (logand s5-0 (task-mask vehicle)) (task-mask vehicle)) + (format #t "vehicle ") + ) + (if (= (logand s5-0 (task-mask dummy1)) (task-mask dummy1)) + (format #t "dummy1 ") + ) + (if (= (logand s5-0 (task-mask primary0)) (task-mask primary0)) + (format #t "primary0 ") + ) + (if (= (logand s5-0 (task-mask task1)) (task-mask task1)) + (format #t "task1 ") + ) + (if (= (logand s5-0 (task-mask task3)) (task-mask task3)) + (format #t "task3 ") + ) + (if (= (logand s5-0 (task-mask task5)) (task-mask task5)) + (format #t "task5 ") + ) + (if (= (logand s5-0 (task-mask task7)) (task-mask task7)) + (format #t "task7 ") + ) + (if (= (logand (task-mask movie2) s5-0) (task-mask movie2)) + (format #t "movie2 ") + ) + (if (= (logand s5-0 (task-mask done)) (task-mask done)) + (format #t "done ") + ) + (if (= (logand s5-0 (task-mask special)) (task-mask special)) + (format #t "special ") + ) + (if (= (logand (task-mask movie0) s5-0) (task-mask movie0)) + (format #t "movie0 ") + ) + (if (= (logand s5-0 (task-mask dummy0)) (task-mask dummy0)) + (format #t "dummy0 ") + ) + ) + (format #t ")~%") + (format #t "~1Tbuffer-size: ~D~%" (-> this buffer-size)) + (format #t "~1Tcity-map-bits: ~D~%" (-> this city-map-bits)) + (format #t "~1Tbigmap-id: ~D~%" (-> this bigmap-id)) + (format #t "~1Tcontinues: ~A~%" (-> this continues)) + (format #t "~1Tcallback-list: ~A~%" (-> this callback-list)) + (format #t "~1Tborrow: ~A~%" (-> this borrow)) + (format #t "~1Tbottom-height: (meters ~m)~%" (-> this bottom-height)) + (format #t "~1Tfog-height: ~f~%" (-> this fog-height)) + (format #t "~1Tmax-rain: ~f~%" (-> this max-rain)) + (format #t "~1Tfog-mult: ~f~%" (-> this fog-mult)) + (format #t "~1Tmood-range: #~%" (-> this mood-range)) + (label cfg-42) + this + ) + +;; definition of type login-state +(deftype login-state (basic) + ((state int32) + (pos uint32) + (elts uint32) + (elt drawable 16) + ) + ) + +;; definition for method 3 of type login-state +(defmethod inspect ((this login-state)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tstate: ~D~%" (-> this state)) + (format #t "~1Tpos: ~D~%" (-> this pos)) + (format #t "~1Telts: ~D~%" (-> this elts)) + (format #t "~1Telt[16] @ #x~X~%" (-> this elt)) + (label cfg-4) + this + ) + +;; definition of type level +(deftype level (basic) + ((name symbol) + (load-name symbol) + (nickname symbol) + (index int32) + (status symbol) + (borrow-level level 5) + (borrow-from-level level) + (heap kheap :inline) + (borrow-heap kheap 5 :inline) + (bsp bsp-header) + (art-group load-dir-art-group) + (info level-load-info) + (texture-page texture-page 20) + (loaded-texture-page texture-page 16) + (loaded-texture-page-count int32) + (entity entity-links-array) + (closest-object meters) + (upload-size int32 20 :offset 388) + (inside-boxes? basic) + (display? symbol) + (render? symbol) + (meta-inside? symbol) + (force-inside? symbol) + (load-id uint32) + (mood-context mood-context :inline) + (mood-func (function mood-context float int none)) + (mood-init (function mood-context none)) + (vis-bits pointer) + (all-visible? symbol) + (force-all-visible? symbol) + (linking symbol) + (vis-info level-vis-info 8) + (vis-self-index int32) + (vis-adj-index int32) + (vis-buffer uint8 2048) + (mem-usage-block memory-usage-block) + (mem-usage int32) + (code-memory-start pointer) + (code-memory-end pointer) + (load-start-time uint64) + (load-stop-time uint64) + (load-buffer uint32 2) + (load-buffer-size uint32) + (load-buffer-last dgo-header) + (load-buffer-mode load-buffer-mode) + (display-start-time uint64) + (memory-mask uint32) + (task-mask task-mask) + (tfrag-gs-test gs-test) + (texture-dirty-masks texture-mask 11 :inline) + (texture-mask texture-mask 20 :inline) + (sky-mask texture-mask :inline) + (tfrag-masks texture-masks-array) + (tfrag-dists pointer) + (shrub-masks texture-masks-array) + (shrub-dists pointer) + (alpha-masks texture-masks-array) + (alpha-dists pointer) + (water-masks texture-masks-array) + (water-dists pointer) + (tfrag-last-calls int32 6) + (texture-anim-array texture-anim-array 11) + (light-hash light-hash) + (draw-priority float) + (draw-index int32) + (part-engine engine) + (user-object basic 4) + (loaded-text-info-count int32) + (loaded-text-info game-text-info 16) + (level-type type) + (load-order uint64) + (eye-slot-lowres uint8 11) + (eye-slot-highres uint8 11) + (unknown-pad uint8 14) + ) + (:methods + (level-method-9 () none) + (level-method-10 () none) + (level-method-11 () none) + (level-method-12 () none) + (level-method-13 () none) + (level-method-14 () none) + (level-method-15 () none) + (level-method-16 () none) + (level-method-17 () none) + (level-method-18 () none) + (level-method-19 () none) + (level-method-20 () none) + (level-method-21 () none) + (level-method-22 () none) + (level-method-23 () none) + (level-method-24 () none) + (level-method-25 () none) + (level-method-26 () none) + (level-method-27 () none) + (level-method-28 () none) + (level-method-29 () none) + ) + ) + +;; definition for method 3 of type level +(defmethod inspect ((this level)) + (when (not this) + (set! this this) + (goto cfg-54) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tname: ~A~%" (-> this name)) + (format #t "~1Tload-name: ~A~%" (-> this load-name)) + (format #t "~1Tnickname: ~A~%" (-> this nickname)) + (format #t "~1Tindex: ~D~%" (-> this index)) + (format #t "~1Tstatus: ~A~%" (-> this status)) + (format #t "~1Tborrow-level[5] @ #x~X~%" (-> this borrow-level)) + (dotimes (s5-0 5) + (format #t "~T [~D]~1Tborrow-level: ~A~%" s5-0 (-> this borrow-level s5-0)) + ) + (format #t "~1Tborrow-from-level: ~A~%" (-> this borrow-from-level)) + (format #t "~1Theap: #~%" (-> this heap)) + (format #t "~1Tborrow-heap[5] @ #x~X~%" (-> this borrow-heap)) + (format #t "~1Tbsp: ~A~%" (-> this bsp)) + (format #t "~1Tart-group: ~A~%" (-> this art-group)) + (format #t "~1Tinfo: ~A~%" (-> this info)) + (format #t "~1Ttexture-page[20] @ #x~X~%" (-> this texture-page)) + (format #t "~1Tloaded-texture-page[16] @ #x~X~%" (-> this loaded-texture-page)) + (format #t "~1Tloaded-texture-page-count: ~D~%" (-> this loaded-texture-page-count)) + (format #t "~1Tentity: ~A~%" (-> this entity)) + (format #t "~1Tclosest-object: (meters ~m)~%" (&-> this closest-object)) + (format #t "~1Tupload-size[20] @ #x~X~%" (-> this upload-size)) + (format #t "~1Tinside-boxes?: ~A~%" (-> this inside-boxes?)) + (format #t "~1Tdisplay?: ~A~%" (-> this display?)) + (format #t "~1Trender?: ~A~%" (-> this render?)) + (format #t "~1Tmeta-inside?: ~A~%" (-> this meta-inside?)) + (format #t "~1Tforce-inside?: ~A~%" (-> this force-inside?)) + (format #t "~1Tload-id: ~D~%" (-> this load-id)) + (format #t "~1Tmood-context: #~%" (-> this mood-context)) + (format #t "~1Tmood-func: ~A~%" (-> this mood-func)) + (format #t "~1Tmood-init: ~A~%" (-> this mood-init)) + (format #t "~1Tvis-bits: #x~X~%" (-> this vis-bits)) + (format #t "~1Tall-visible?: ~A~%" (-> this all-visible?)) + (format #t "~1Tforce-all-visible?: ~A~%" (-> this force-all-visible?)) + (format #t "~1Tlinking: ~A~%" (-> this linking)) + (format #t "~1Tvis-info[8] @ #x~X~%" (-> this vis-info)) + (format #t "~1Tvis-self-index: ~D~%" (-> this vis-self-index)) + (format #t "~1Tvis-adj-index: ~D~%" (-> this vis-adj-index)) + (format #t "~1Tvis-buffer[2048] @ #x~X~%" (-> this vis-buffer)) + (format #t "~1Tmem-usage-block: ~A~%" (-> this mem-usage-block)) + (format #t "~1Tmem-usage: ~D~%" (-> this mem-usage)) + (format #t "~1Tcode-memory-start: #x~X~%" (-> this code-memory-start)) + (format #t "~1Tcode-memory-end: #x~X~%" (-> this code-memory-end)) + (format #t "~1Tload-start-time: ~D~%" (-> this load-start-time)) + (format #t "~1Tload-stop-time: ~D~%" (-> this load-stop-time)) + (format #t "~1Tload-buffer[2] @ #x~X~%" (-> this load-buffer)) + (format #t "~1Tload-buffer-size: ~D~%" (-> this load-buffer-size)) + (format #t "~1Tload-buffer-last: #~%" (-> this load-buffer-last)) + (format #t "~1Tload-buffer-mode: ~D~%" (-> this load-buffer-mode)) + (format #t "~1Tdisplay-start-time: ~D~%" (-> this display-start-time)) + (format #t "~1Tmemory-mask: #b~B~%" (-> this memory-mask)) + (format #t "~1Ttask-mask: #x~X : (task-mask " (-> this task-mask)) + (let ((s5-1 (-> this task-mask))) + (if (= (logand s5-1 (task-mask task0)) (task-mask task0)) + (format #t "task0 ") + ) + (if (= (logand s5-1 (task-mask task2)) (task-mask task2)) + (format #t "task2 ") + ) + (if (= (logand s5-1 (task-mask task4)) (task-mask task4)) + (format #t "task4 ") + ) + (if (= (logand s5-1 (task-mask task6)) (task-mask task6)) + (format #t "task6 ") + ) + (if (= (logand s5-1 (task-mask ctywide)) (task-mask ctywide)) + (format #t "ctywide ") + ) + (if (= (logand s5-1 (task-mask never)) (task-mask never)) + (format #t "never ") + ) + (if (= (logand (task-mask movie1) s5-1) (task-mask movie1)) + (format #t "movie1 ") + ) + (if (= (logand s5-1 (task-mask vehicle)) (task-mask vehicle)) + (format #t "vehicle ") + ) + (if (= (logand s5-1 (task-mask dummy1)) (task-mask dummy1)) + (format #t "dummy1 ") + ) + (if (= (logand s5-1 (task-mask primary0)) (task-mask primary0)) + (format #t "primary0 ") + ) + (if (= (logand s5-1 (task-mask task1)) (task-mask task1)) + (format #t "task1 ") + ) + (if (= (logand s5-1 (task-mask task3)) (task-mask task3)) + (format #t "task3 ") + ) + (if (= (logand s5-1 (task-mask task5)) (task-mask task5)) + (format #t "task5 ") + ) + (if (= (logand s5-1 (task-mask task7)) (task-mask task7)) + (format #t "task7 ") + ) + (if (= (logand (task-mask movie2) s5-1) (task-mask movie2)) + (format #t "movie2 ") + ) + (if (= (logand s5-1 (task-mask done)) (task-mask done)) + (format #t "done ") + ) + (if (= (logand s5-1 (task-mask special)) (task-mask special)) + (format #t "special ") + ) + (if (= (logand (task-mask movie0) s5-1) (task-mask movie0)) + (format #t "movie0 ") + ) + (if (= (logand s5-1 (task-mask dummy0)) (task-mask dummy0)) + (format #t "dummy0 ") + ) + ) + (format #t ")~%") + (format #t "~1Ttfrag-gs-test: ~D~%" (-> this tfrag-gs-test)) + (format #t "~1Ttexture-dirty-masks[11] @ #x~X~%" (-> this texture-dirty-masks)) + (format #t "~1Ttexture-mask[20] @ #x~X~%" (-> this texture-mask)) + (format #t "~1Tsky-mask: #~%" (-> this sky-mask)) + (format #t "~1Ttfrag-masks: ~A~%" (-> this tfrag-masks)) + (format #t "~1Ttfrag-dists: #x~X~%" (-> this tfrag-dists)) + (format #t "~1Tshrub-masks: ~A~%" (-> this shrub-masks)) + (format #t "~1Tshrub-dists: #x~X~%" (-> this shrub-dists)) + (format #t "~1Talpha-masks: ~A~%" (-> this alpha-masks)) + (format #t "~1Talpha-dists: #x~X~%" (-> this alpha-dists)) + (format #t "~1Twater-masks: ~A~%" (-> this water-masks)) + (format #t "~1Twater-dists: #x~X~%" (-> this water-dists)) + (format #t "~1Ttfrag-last-calls[6] @ #x~X~%" (-> this tfrag-last-calls)) + (format #t "~1Ttexture-anim-array[11] @ #x~X~%" (-> this texture-anim-array)) + (format #t "~1Tlight-hash: ~A~%" (-> this light-hash)) + (format #t "~1Tdraw-priority: ~f~%" (-> this draw-priority)) + (format #t "~1Tdraw-index: ~D~%" (-> this draw-index)) + (format #t "~1Tpart-engine: ~A~%" (-> this part-engine)) + (format #t "~1Tuser-object[4] @ #x~X~%" (-> this user-object)) + (dotimes (s5-2 4) + (format #t "~T [~D]~1Tuser-object: ~A~%" s5-2 (-> this user-object s5-2)) + ) + (format #t "~1Tloaded-text-info-count: ~D~%" (-> this loaded-text-info-count)) + (format #t "~1Tloaded-text-info[16] @ #x~X~%" (-> this loaded-text-info)) + (format #t "~1Tlevel-type: ~A~%" (-> this level-type)) + (format #t "~1Tload-order: ~D~%" (-> this load-order)) + (format #t "~1Teye-slot-lowres[11] @ #x~X~%" (-> this eye-slot-lowres)) + (dotimes (s5-3 11) + (format #t "~T [~D]~1Teye-slot-lowres: ~D~%" s5-3 (-> this eye-slot-lowres s5-3)) + ) + (format #t "~1Teye-slot-highres[11] @ #x~X~%" (-> this eye-slot-highres)) + (dotimes (s5-4 11) + (format #t "~T [~D]~1Teye-slot-highres: ~D~%" s5-4 (-> this eye-slot-highres s5-4)) + ) + (label cfg-54) + this + ) + +;; definition of type level-group +(deftype level-group (basic) + ((length int32) + (unk-flag1 symbol) + (unk-flag2 symbol) + (entity-link entity-links :offset 16) + (border? symbol) + (vis? symbol) + (want-level basic) + (receiving-level basic) + (load-commands pair) + (play? symbol) + (target-pos vector 2 :inline) + (camera-pos vector 2 :inline) + (heap kheap :inline) + (sound-bank sound-bank-state 6 :inline) + (disk-load-timing? symbol) + (load-level symbol) + (load-size uint32) + (load-time float) + (load-login-time float) + (draw-level-count int32) + (draw-level level 11) + (draw-index-map uint8 11) + (status-cache-sync uint16) + (load-order uint64) + (level level 11 :inline :offset 320) + (level0 level :inline :overlay-at (-> level 0)) + (level1 level :inline :offset 5744) + (level2 level :inline :offset 11168) + (level3 level :inline :offset 16592) + (level4 level :inline :offset 22016) + (level5 level :inline :offset 27440) + (level6 level :inline :offset 32864) + (level7 level :inline :offset 38288) + (level8 level :inline :offset 43712) + (level9 level :inline :offset 49136) + (level-default level :inline :offset 54560) + (pad uint32) + ) + (:methods + (level-group-method-9 () none) + (level-group-method-10 () none) + (level-group-method-11 () none) + (level-group-method-12 () none) + (level-group-method-13 () none) + (level-group-method-14 () none) + (level-group-method-15 () none) + (level-group-method-16 () none) + (level-group-method-17 () none) + (level-group-method-18 () none) + (level-group-method-19 () none) + (level-group-method-20 () none) + (level-group-method-21 () none) + (level-group-method-22 () none) + (level-group-method-23 () none) + (level-group-method-24 () none) + (level-group-method-25 () none) + (level-group-method-26 () none) + (level-group-method-27 () none) + (level-group-method-28 () none) + (level-group-method-29 () none) + (level-group-method-30 () none) + ) + ) + +;; definition for method 3 of type level-group +(defmethod inspect ((this level-group)) + (when (not this) + (set! this this) + (goto cfg-16) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tentity-link: ~`entity-links`P~%" (-> this entity-link)) + (format #t "~1Tborder?: ~A~%" (-> this border?)) + (format #t "~1Tvis?: ~A~%" (-> this vis?)) + (format #t "~1Twant-level: ~A~%" (-> this want-level)) + (format #t "~1Treceiving-level: ~A~%" (-> this receiving-level)) + (format #t "~1Tload-commands: ~A~%" (-> this load-commands)) + (format #t "~1Tplay?: ~A~%" (-> this play?)) + (format #t "~1Ttarget-pos[2] @ #x~X~%" (-> this target-pos)) + (dotimes (s5-0 2) + (format #t "~T [~D]~1Ttarget-pos: ~`vector`P~%" s5-0 (-> this target-pos s5-0)) + ) + (format #t "~1Tcamera-pos[2] @ #x~X~%" (-> this camera-pos)) + (dotimes (s5-1 2) + (format #t "~T [~D]~1Tcamera-pos: ~`vector`P~%" s5-1 (-> this camera-pos s5-1)) + ) + (format #t "~1Theap: #~%" (-> this heap)) + (format #t "~1Tsound-bank[6] @ #x~X~%" (-> this sound-bank)) + (dotimes (s5-2 6) + (format #t "~T [~D]~1Tsound-bank: ~`sound-bank-state`P~%" s5-2 (-> this sound-bank s5-2)) + ) + (format #t "~1Tdisk-load-timing?: ~A~%" (-> this disk-load-timing?)) + (format #t "~1Tload-level: ~A~%" (-> this load-level)) + (format #t "~1Tload-size: ~D~%" (-> this load-size)) + (format #t "~1Tload-time: ~f~%" (-> this load-time)) + (format #t "~1Tload-login-time: ~f~%" (-> this load-login-time)) + (format #t "~1Tdraw-level-count: ~D~%" (-> this draw-level-count)) + (format #t "~1Tdraw-level[11] @ #x~X~%" (-> this draw-level)) + (dotimes (s5-3 (-> this draw-level-count)) + (format #t "~T [~D]~1Tdraw-level: ~`object`P~%" s5-3 (-> this draw-level s5-3)) + ) + (format #t "~1Tdraw-index-map[11] @ #x~X~%" (-> this draw-index-map)) + (format #t "~1Tstatus-cache-sync: ~D~%" (-> this status-cache-sync)) + (format #t "~1Tload-order: ~D~%" (-> this load-order)) + (format #t "~1Tlevel[11] @ #x~X~%" (-> this level)) + (format #t "~1Tdata[11] @ #x~X~%" (-> this level)) + (format #t "~1Tlevel0: ~`level`P~%" (-> this level)) + (format #t "~1Tlevel1: ~`level`P~%" (-> this level1)) + (format #t "~1Tlevel2: ~`level`P~%" (-> this level2)) + (format #t "~1Tlevel3: ~`level`P~%" (-> this level3)) + (format #t "~1Tlevel4: ~`level`P~%" (-> this level4)) + (format #t "~1Tlevel5: ~`level`P~%" (-> this level5)) + (format #t "~1Tlevel6: ~`level`P~%" (-> this level6)) + (format #t "~1Tlevel7: ~`level`P~%" (-> this level7)) + (format #t "~1Tlevel8: ~`level`P~%" (-> this level8)) + (format #t "~1Tlevel9: ~`level`P~%" (-> this level9)) + (format #t "~1Tlevel-default: ~`level`P~%" (-> this level-default)) + (label cfg-16) + this + ) + +;; failed to figure out what this is: +(when (zero? *level*) + (set! *level* + (new 'static 'level-group + :length 10 + :unk-flag1 #f + :unk-flag2 #f + :entity-link #f + :border? #f + :vis? #f + :want-level #f + :load-commands '() + :play? #f + :sound-bank (new 'static 'inline-array sound-bank-state 6 + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + (new 'static 'sound-bank-state :name #f) + ) + :disk-load-timing? #f + :status-cache-sync #x1 + :level (new 'static 'inline-array level 11 + (new 'static 'level :name #f :status 'inactive :inside-boxes? #f :force-inside? #f :linking #f :level-type #f) + (new 'static 'level + :name #f + :index 1 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 2 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 3 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 4 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 5 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 6 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 7 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 8 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name #f + :index 9 + :status 'inactive + :inside-boxes? #f + :force-inside? #f + :linking #f + :level-type #f + ) + (new 'static 'level + :name 'default + :index 10 + :status 'reserved + :bsp #f + :inside-boxes? #f + :display? #f + :force-inside? #f + :linking #f + :level-type #f + ) + ) + ) + ) + (set! *draw-index* 0) + (set! *level-index* 0) + 0 + ) + +;; definition for symbol *city-mode*, type symbol +(define *city-mode* #f) + + + + diff --git a/test/decompiler/reference/jak3/sound/gsound-h_REF.gc b/test/decompiler/reference/jak3/sound/gsound-h_REF.gc index 455fa26c7..5a6d4e370 100644 --- a/test/decompiler/reference/jak3/sound/gsound-h_REF.gc +++ b/test/decompiler/reference/jak3/sound/gsound-h_REF.gc @@ -804,6 +804,7 @@ ((name basic) (mode uint32) ) + :pack-me ) ;; definition for method 3 of type sound-bank-state