diff --git a/common/goos/PrettyPrinter.cpp b/common/goos/PrettyPrinter.cpp index 71ac8b01b..090626921 100644 --- a/common/goos/PrettyPrinter.cpp +++ b/common/goos/PrettyPrinter.cpp @@ -17,15 +17,21 @@ namespace pretty_print { namespace { // the integer representation is used here instead, wouldn't want really long numbers const std::unordered_set banned_floats = {}; + +// print these floats (shown as ints here) as a named constant instead +const std::unordered_map const_floats = {{0x40490fda, "PI"}, + {0xc0490fda, "MINUS_PI"}}; } // namespace /*! - * Print a float in a nice representation if possibly, or an exact 32-bit integer constant to + * Print a float in a nice representation if possible, or an exact 32-bit integer constant to * be reinterpreted. */ goos::Object float_representation(float value) { u32 int_value; memcpy(&int_value, &value, 4); - if (banned_floats.find(int_value) == banned_floats.end()) { + if (const_floats.find(int_value) != const_floats.end()) { + return pretty_print::to_symbol(const_floats.at(int_value)); + } else if (banned_floats.find(int_value) == banned_floats.end()) { return goos::Object::make_float(value); } else { return pretty_print::build_list("the-as", "float", fmt::format("#x{:x}", int_value)); diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index 25dafabba..a891376c1 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -962,7 +962,7 @@ int TypeSystem::get_size_in_type(const Field& field) const { if (field.is_inline()) { if (!allow_inline(field_type)) { fmt::print( - "[Type System] Attempted to use {} inline, this probably isn't what you wanted.\n", + "[Type System] Attempted to use `{}` inline, this probably isn't what you wanted.\n", field_type->get_name()); throw std::runtime_error("bad get size in type"); } @@ -982,7 +982,8 @@ int TypeSystem::get_size_in_type(const Field& field) const { if (field.is_inline()) { if (!allow_inline(field_type)) { fmt::print( - "[Type System] Attempted to use {} inline, this probably isn't what you wanted.\n", + "[Type System] Attempted to use `{}` inline, this probably isn't what you wanted. Type " + "may not be defined fully.\n", field_type->get_name()); throw std::runtime_error("bad get size in type"); } diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 9a85d51c4..6e7762cbf 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -6375,12 +6375,12 @@ (current-prt-color vector :inline :offset-assert 112) (current-shadow vector :inline :offset-assert 128) (current-shadow-color vector :inline :offset-assert 144) - ;; (light-group UNKNOWN 8 :offset-assert 160) - (times vector 8 :inline :offset 1696) - (sky-times float 8 :offset-assert 1824) - ;; (itimes UNKNOWN 4 :offset-assert 1856) - ;; (state UNKNOWN 16 :offset-assert 1920) - (num-stars float :offset 1936) + (light-group light-group 8 :inline :offset-assert 160) + (times vector 8 :inline :offset-assert 1696) + (sky-times float 8 :offset-assert 1824) + (itimes vector4w 4 :inline :offset-assert 1856) + (state uint8 16 :offset-assert 1920) + (num-stars float :offset-assert 1936) ) (:methods (new (symbol type) _type_ 0) @@ -6456,46 +6456,46 @@ :flag-assert #x900000014 ) -; ;; time-of-day-h -; (deftype time-of-day-context (basic) -; ((active-count uint32 :offset-assert 4) -; (interp float :offset-assert 8) -; (current-interp float :offset-assert 12) -; (moods UNKNOWN 2 :offset-assert 16) -; (current-fog mood-fog :inline :offset-assert 32) -; (current-sun mood-sun :inline :offset-assert 80) -; (current-prt-color vector :inline :offset-assert 112) -; (current-shadow vector :inline :offset-assert 128) -; (current-shadow-color vector :inline :offset-assert 144) -; (light-group UNKNOWN 9 :offset-assert 160) -; (title-light-group light-group :inline :offset-assert 1888) -; (time float :offset-assert 2080) -; (target-interp float :offset-assert 2084) -; (erase-color uint32 :offset-assert 2088) -; (num-stars float :offset-assert 2092) -; (light-masks-0 UNKNOWN 2 :offset-assert 2096) -; (light-masks-1 UNKNOWN 2 :offset-assert 2098) -; (light-interp UNKNOWN 2 :offset-assert 2100) -; (sky basic :offset-assert 2108) -; (sun-fade float :offset-assert 2112) -; (title-updated basic :offset-assert 2116) -; ) -; :method-count-assert 9 -; :size-assert #x848 -; :flag-assert #x900000848 -; ) +;; time-of-day-h +(deftype time-of-day-context (basic) + ((active-count uint32 :offset-assert 4) + (interp float :offset-assert 8) + (current-interp float :offset-assert 12) + (moods uint64 2 :offset-assert 16) + (current-fog mood-fog :inline :offset-assert 32) + (current-sun mood-sun :inline :offset-assert 80) + (current-prt-color vector :inline :offset-assert 112) + (current-shadow vector :inline :offset-assert 128) + (current-shadow-color vector :inline :offset-assert 144) + (light-group light-group 9 :inline :offset-assert 160) + (title-light-group light-group :inline :offset-assert 1888) + (time float :offset-assert 2080) + (target-interp float :offset-assert 2084) + (erase-color uint32 :offset-assert 2088) + (num-stars float :offset-assert 2092) + (light-masks-0 uint8 2 :offset-assert 2096) + (light-masks-1 uint8 2 :offset-assert 2098) + (light-interp uint32 2 :offset-assert 2100) + (sky basic :offset-assert 2108) + (sun-fade float :offset-assert 2112) + (title-updated symbol :offset-assert 2116) + ) + :method-count-assert 9 + :size-assert #x848 + :flag-assert #x900000848 + ) -; ;; time-of-day-h -; (deftype time-of-day-dma (structure) -; ((outa UNKNOWN 256 :offset-assert 0) -; (outb UNKNOWN 256 :offset-assert 1024) -; (banka UNKNOWN 256 :offset-assert 2048) -; (bankb UNKNOWN 256 :offset-assert 3072) -; ) -; :method-count-assert 9 -; :size-assert #x1000 -; :flag-assert #x900001000 -; ) +;; time-of-day-h +(deftype time-of-day-dma (structure) + ((outa uint32 256 :offset-assert 0) + (outb uint32 256 :offset-assert 1024) + (banka uint32 256 :offset-assert 2048) + (bankb uint32 256 :offset-assert 3072) + ) + :method-count-assert 9 + :size-assert #x1000 + :flag-assert #x900001000 + ) ;; art-h (deftype joint-anim (basic) @@ -6508,17 +6508,32 @@ :flag-assert #x90000000c ) -; ;; art-h -; (deftype joint-anim-drawable (joint-anim) -; ((name basic :offset-assert 4) -; (number int16 :offset-assert 8) -; (length int16 :offset-assert 10) -; (data UNKNOWN :dynamic :offset-assert 12) -; ) -; :method-count-assert 9 -; :size-assert #xc -; :flag-assert #x90000000c -; ) +; art-h +(deftype joint-anim-matrix (joint-anim) + ((matrix matrix :offset-assert 12)) ;; guess + ;; inspect in joint + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(deftype joint-anim-transformq (joint-anim) + ((transformq transformq :offset-assert 12)) ;; guess + ;; inspect in joint + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ;; too many basic blocks + ) + +;; art-h +(deftype joint-anim-drawable (joint-anim) + ((data uint32 :inline :dynamic :offset-assert 12) ;; guess + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) ;; art-h (deftype joint-anim-compressed (joint-anim) @@ -6528,66 +6543,69 @@ :flag-assert #x90000000c ) -; ;; art-h -; (deftype joint-anim-frame (structure) -; ((matrices UNKNOWN 2 :offset-assert 0) -; (data UNKNOWN :dynamic :offset-assert 128) -; ) -; :method-count-assert 9 -; :size-assert #x80 -; :flag-assert #x900000080 -; ) +;; art-h +(deftype joint-anim-frame (structure) + ((matrices matrix 2 :inline :offset-assert 0) + (data uint32 :dynamic :offset-assert 128) ;; guess + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + (:methods + (new (symbol type int) _type_ 0) + ) + ) -; ;; art-h -; (deftype joint-anim-compressed-hdr (structure) -; ((control-bits UNKNOWN 14 :offset-assert 0) -; (num-joints uint32 :offset-assert 56) -; (matrix-bits uint32 :offset-assert 60) -; ) -; :method-count-assert 9 -; :size-assert #x40 -; :flag-assert #x900000040 -; ) +;; art-h +(deftype joint-anim-compressed-hdr (structure) + ((control-bits uint32 14 :offset-assert 0) + (num-joints uint32 :offset-assert 56) + (matrix-bits uint32 :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) -; ;; art-h -; (deftype joint-anim-compressed-fixed (structure) -; ((hdr joint-anim-compressed-hdr :inline :offset-assert 0) -; (offset-64 uint32 :offset-assert 64) -; (offset-32 uint32 :offset-assert 68) -; (offset-16 uint32 :offset-assert 72) -; (reserved uint32 :offset-assert 76) -; (data UNKNOWN 133 :offset-assert 80) -; ) -; :method-count-assert 9 -; :size-assert #x8a0 -; :flag-assert #x9000008a0 -; ) +;; art-h +(deftype joint-anim-compressed-fixed (structure) + ((hdr joint-anim-compressed-hdr :inline :offset-assert 0) + (offset-64 uint32 :offset-assert 64) + (offset-32 uint32 :offset-assert 68) + (offset-16 uint32 :offset-assert 72) + (reserved uint32 :offset-assert 76) + (data vector 133 :inline :offset-assert 80) ;; guess + ) + :method-count-assert 9 + :size-assert #x8a0 + :flag-assert #x9000008a0 + ) -; ;; art-h -; (deftype joint-anim-compressed-frame (structure) -; ((offset-64 uint32 :offset-assert 0) -; (offset-32 uint32 :offset-assert 4) -; (offset-16 uint32 :offset-assert 8) -; (reserved uint32 :offset-assert 12) -; (data UNKNOWN 133 :offset-assert 16) -; ) -; :method-count-assert 9 -; :size-assert #x860 -; :flag-assert #x900000860 -; ) +;; art-h +(deftype joint-anim-compressed-frame (structure) + ((offset-64 uint32 :offset-assert 0) + (offset-32 uint32 :offset-assert 4) + (offset-16 uint32 :offset-assert 8) + (reserved uint32 :offset-assert 12) + (data vector 133 :inline :offset-assert 16) ;; guess + ) + :method-count-assert 9 + :size-assert #x860 + :flag-assert #x900000860 + ) -; ;; art-h -; (deftype joint-anim-compressed-control (structure) -; ((num-frames uint32 :offset-assert 0) -; (fixed-qwc uint32 :offset-assert 4) -; (frame-qwc uint32 :offset-assert 8) -; (fixed joint-anim-compressed-fixed :offset-assert 12) -; (data UNKNOWN 1 :offset-assert 16) -; ) -; :method-count-assert 9 -; :size-assert #x14 -; :flag-assert #x900000014 -; ) +;; art-h +(deftype joint-anim-compressed-control (structure) + ((num-frames uint32 :offset-assert 0) + (fixed-qwc uint32 :offset-assert 4) + (frame-qwc uint32 :offset-assert 8) + (fixed joint-anim-compressed-fixed :offset-assert 12) + (data uint32 1 :offset-assert 16) ;; guess + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) ;; art-h (deftype art (basic) @@ -6620,102 +6638,150 @@ ) ) -; ;; art-h -; (deftype skeleton-group (basic) -; ((art-group-name basic :offset-assert 4) -; (jgeo int32 :offset-assert 8) -; (janim int32 :offset-assert 12) -; (bounds vector :inline :offset-assert 16) -; (radius meters :offset-assert 28) -; (mgeo UNKNOWN 4 :offset-assert 32) -; (max-lod int32 :offset-assert 40) -; (lod-dist UNKNOWN 4 :offset-assert 44) -; (longest-edge meters :offset-assert 60) -; (texture-level int8 :offset-assert 64) -; (version int8 :offset-assert 65) -; (shadow int8 :offset-assert 66) -; (sort int8 :offset-assert 67) -; ) -; :method-count-assert 9 -; :size-assert #x48 -; :flag-assert #x900000048 -; ) +(deftype art-mesh-anim (art-element) + () + :method-count-assert 13 + :size-assert #x20 + :flag-assert #xd00000020 + ) + +(deftype art-joint-anim (art-element) + ((pad2 uint8 16)) + ;; inspect in join + :method-count-assert 13 + :size-assert #x30 + :flag-assert #xd00000030 + ) + +(deftype art-group (art) + ((pad2 uint8 12)) + ;; inspect in join + :method-count-assert 15 + :size-assert #x20 + :flag-assert #xf00000020 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + ) + ) + +(deftype art-mesh-geo (art-element) + () + :method-count-assert 13 + :size-assert #x20 + :flag-assert #xd00000020 + ) + +(deftype art-joint-geo (art-element) + () + :method-count-assert 13 + :size-assert #x20 + :flag-assert #xd00000020 + ) + +;; art-h +(deftype skeleton-group (basic) + ((art-group-name basic :offset-assert 4) + (jgeo int32 :offset-assert 8) + (janim int32 :offset-assert 12) + (bounds vector :inline :offset-assert 16) + (radius float :offset 28) ;; meters + (mgeo uint16 4 :offset-assert 32) + (max-lod int32 :offset-assert 40) + (lod-dist float 4 :offset-assert 44) + (longest-edge float :offset-assert 60) ;; meters + (texture-level int8 :offset-assert 64) + (version int8 :offset-assert 65) + (shadow int8 :offset-assert 66) + (sort int8 :offset-assert 67) + (_pad uint8 4) ;; what was here? + ) + :method-count-assert 9 + :size-assert #x48 + :flag-assert #x900000048 + ) ;; art-h (deftype lod-group (structure) ((geo basic :offset-assert 0) (dist float :offset-assert 4) ;; meters ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -; ;; art-h -; (deftype lod-set (structure) -; ((lod UNKNOWN 4 :offset-assert 0) -; (max-lod int8 :offset-assert 32) -; ) -; :method-count-assert 10 -; :size-assert #x21 -; :flag-assert #xa00000021 -; (:methods -; (dummy-9 () none 9) -; ) -; ) +;; art-h +(deftype lod-set (structure) + ((lod lod-group 4 :inline :offset-assert 0) + (max-lod int8 :offset-assert 32) + ) + :pack-me + :method-count-assert 10 + :size-assert #x21 + :flag-assert #xa00000021 + (:methods + (dummy-9 () none 9) + ) + ) -; ;; art-h -; (deftype draw-control (basic) -; ((status uint8 :offset-assert 4) -; (matrix-type uint8 :offset-assert 5) -; (data-format uint8 :offset-assert 6) -; (global-effect uint8 :offset-assert 7) -; (art-group basic :offset-assert 8) -; (jgeo basic :offset-assert 12) -; (mgeo basic :offset-assert 16) -; (dma-add-func basic :offset-assert 20) -; (skeleton basic :offset-assert 24) -; (lod-set lod-set :inline :offset-assert 28) -; (lod UNKNOWN 4 :offset-assert 28) -; (max-lod int8 :offset-assert 60) -; (force-lod int8 :offset-assert 61) -; (cur-lod int8 :offset-assert 62) -; (desired-lod int8 :offset-assert 63) -; (ripple basic :offset-assert 64) -; (longest-edge meters :offset-assert 68) -; (longest-edge? uint32 :offset-assert 68) -; (light-index uint8 :offset-assert 72) -; (dummy UNKNOWN 2 :offset-assert 73) -; (death-draw-overlap uint8 :offset-assert 75) -; (death-timer uint8 :offset-assert 76) -; (death-timer-org uint8 :offset-assert 77) -; (death-vertex-skip uint16 :offset-assert 78) -; (death-effect uint32 :offset-assert 80) -; (sink-group basic :offset-assert 84) -; (process basic :offset-assert 88) -; (shadow basic :offset-assert 92) -; (shadow-ctrl basic :offset-assert 96) -; (origin vector :inline :offset-assert 112) -; (bounds vector :inline :offset-assert 128) -; (radius meters :offset-assert 140) -; (color-mult rgbaf :inline :offset-assert 144) -; (color-emissive rgbaf :inline :offset-assert 160) -; (secondary-interp float :offset-assert 176) -; (current-secondary-interp float :offset-assert 180) -; (shadow-mask uint8 :offset-assert 184) -; (level-index uint8 :offset-assert 185) -; (origin-joint-index uint8 :offset-assert 186) -; (shadow-joint-index uint8 :offset-assert 187) -; ) -; :method-count-assert 12 -; :size-assert #xbc -; :flag-assert #xc000000bc -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; ) -; ) +;; art-h +(deftype draw-control (basic) + ((status uint8 :offset-assert 4) + (matrix-type uint8 :offset-assert 5) + (data-format uint8 :offset-assert 6) + (global-effect uint8 :offset-assert 7) + (art-group art-group :offset-assert 8) + (jgeo art-joint-geo :offset-assert 12) + (mgeo art-mesh-geo :offset-assert 16) + (dma-add-func function :offset-assert 20) + (skeleton skeleton-group :offset-assert 24) + (lod-set lod-set :inline :offset-assert 28) + (lod lod-group 4 :inline :offset 28) + (max-lod int8 :offset 60) + (force-lod int8 :offset-assert 61) + (cur-lod int8 :offset-assert 62) + (desired-lod int8 :offset-assert 63) + (ripple basic :offset-assert 64) + (longest-edge float :offset-assert 68) ;; meters + (longest-edge? uint32 :offset 68) + (light-index uint8 :offset-assert 72) + (dummy uint8 2 :offset-assert 73) + (death-draw-overlap uint8 :offset-assert 75) + (death-timer uint8 :offset-assert 76) + (death-timer-org uint8 :offset-assert 77) + (death-vertex-skip uint16 :offset-assert 78) + (death-effect uint32 :offset-assert 80) + (sink-group basic :offset-assert 84) ;; dma-foreground-sink-group? + (process basic :offset-assert 88) + (shadow basic :offset-assert 92) + (shadow-ctrl basic :offset-assert 96) + (origin vector :inline :offset-assert 112) + (bounds vector :inline :offset-assert 128) + (radius float :offset 140) ;; meters + (color-mult rgbaf :inline :offset-assert 144) + (color-emissive rgbaf :inline :offset-assert 160) + (secondary-interp float :offset-assert 176) + (current-secondary-interp float :offset-assert 180) + (shadow-mask uint8 :offset-assert 184) + (level-index uint8 :offset-assert 185) + (origin-joint-index uint8 :offset-assert 186) + (shadow-joint-index uint8 :offset-assert 187) + ) + :method-count-assert 12 + :size-assert #xbc + :flag-assert #xc000000bc + (:methods + (dummy-9 (_type_) pointer 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + ) + ) ;; generic-vu1-h (deftype pris-mtx (structure) @@ -13152,23 +13218,6 @@ ; :flag-assert #x900000508 ; ) -;; joint -; (deftype joint-anim-matrix (joint-anim) -; () -; :method-count-assert 9 -; :size-assert #x10 -; :flag-assert #x900000010 -; ) - -; ;; joint -; (deftype joint-anim-transformq (joint-anim) -; () -; :method-count-assert 9 -; :size-assert #x10 -; :flag-assert #x900000010 -; ;; too many basic blocks -; ) - ; ;; joint ; (deftype art-joint-anim (art-element) ; () @@ -33615,15 +33664,15 @@ ;;(define-extern *ocean-wave-frames* object) ;; unknown type ;;(define-extern sky-color-hour object) ;; unknown type ;;(define-extern sky-circle-data object) ;; unknown type -;;(define-extern *sky-drawn* object) ;; unknown type +(define-extern *sky-drawn* symbol) ;; unknown type ;;(define-extern sky-vertex object) ;; unknown type ;;(define-extern sky-sun-data object) ;; unknown type ;;(define-extern sky-color-day object) ;; unknown type -;;(define-extern *cloud-drawn* object) ;; unknown type +(define-extern *cloud-drawn* symbol) ;; unknown type ;;(define-extern sky-tng-data object) ;; unknown type ;;(define-extern sky-orbit object) ;; unknown type ;;(define-extern sky-upload-data object) ;; unknown type -;;(define-extern *sky-parms* object) ;; unknown type +(define-extern *sky-parms* sky-parms) ;; unknown type ;;(define-extern sky-moon-data object) ;; unknown type (define-extern *sky-upload-data* sky-upload-data) ;; unknown type ;;(define-extern sky-work object) ;; unknown type @@ -33635,10 +33684,9 @@ ;;(define-extern mood-sun-table object) ;; unknown type ;;(define-extern mood-lights object) ;; unknown type ;;(define-extern mood-sun object) ;; unknown type -(define-extern time-of-day-context type) -;;(define-extern *time-of-day-context* object) ;; unknown type +(define-extern *time-of-day-context* time-of-day-context) ;; unknown type ;;(define-extern palette-fade-control object) ;; unknown type -;;(define-extern *time-of-day-mode* object) ;; unknown type +(define-extern *time-of-day-mode* int) ;; unknown type ;;(define-extern time-of-day-dma object) ;; unknown type ;;(define-extern palette-fade-controls object) ;; unknown type (define-extern *palette-fade-controls* palette-fade-controls) ;; unknown type @@ -33664,7 +33712,7 @@ ;;(define-extern joint-anim-frame object) ;; unknown type ;;(define-extern joint-anim-transformq object) ;; unknown type ;;(define-extern lod-set object) ;; unknown type -;;(define-extern new-dynamic-structure object) ;; unknown type +(define-extern new-dynamic-structure (function kheap type int structure)) ;; unknown type ;;(define-extern generic-pris-mtx-save object) ;; unknown type ;;(define-extern generic-constants object) ;; unknown type ;;(define-extern pris-mtx object) ;; unknown type diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index 0e0e39a79..8cbbc53de 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -303,6 +303,8 @@ ], "mood-h": [["L3", "float", true]], + + "time-of-day-h": [["L2", "time-of-day-context", true]], "merc-h": [ ["L4", "float", true], diff --git a/goal_src/engine/gfx/mood-h.gc b/goal_src/engine/gfx/mood-h.gc index 40c858ece..8ec5c9298 100644 --- a/goal_src/engine/gfx/mood-h.gc +++ b/goal_src/engine/gfx/mood-h.gc @@ -76,12 +76,12 @@ (current-prt-color vector :inline :offset-assert 112) (current-shadow vector :inline :offset-assert 128) (current-shadow-color vector :inline :offset-assert 144) - ;; (light-group UNKNOWN 8 :offset-assert 160) - (times vector 8 :inline :offset 1696) - (sky-times float 8 :offset-assert 1824) - ;; (itimes UNKNOWN 4 :offset-assert 1856) - ;; (state UNKNOWN 16 :offset-assert 1920) - (num-stars float :offset 1936) + (light-group light-group 8 :inline :offset-assert 160) + (times vector 8 :inline :offset-assert 1696) + (sky-times float 8 :offset-assert 1824) + (itimes vector4w 4 :inline :offset-assert 1856) + (state uint8 16 :offset-assert 1920) + (num-stars float :offset-assert 1936) ) (:methods (new (symbol type) _type_ 0) diff --git a/goal_src/engine/gfx/sky/sky-h.gc b/goal_src/engine/gfx/sky/sky-h.gc index aa2ab1f9a..c492bb6a6 100644 --- a/goal_src/engine/gfx/sky/sky-h.gc +++ b/goal_src/engine/gfx/sky/sky-h.gc @@ -118,24 +118,13 @@ (define *sky-upload-data* (new 'global 'sky-upload-data)) ;; generate some sky data. -(let ((gp-0 0)) - (while (< gp-0 17) - (let* ((f30-0 (+ (the-as float #xc0490fda) - (* (the-as float #x3ec90fda) (the float (logand gp-0 15))) - ) - ) - (f0-2 (* (the-as float #x400ccccd) (sin-rad f30-0))) - ) - - (set! (-> *sky-upload-data* circle data gp-0 data 0) - (* (the-as float #x400ccccd) (sin-rad f30-0)) - ) - (set! (-> *sky-upload-data* circle data gp-0 data 1) (cos-rad f30-0)) - (set! (-> *sky-upload-data* circle data gp-0 data 2) 0.000000) - (set! (-> *sky-upload-data* circle data gp-0 data 3) 0.000000) - (+! gp-0 1) - ) - ) +(dotimes (gp-0 17) + (let ((f30-0 (+ MINUS_PI (* 0.39269906 (the float (logand gp-0 15)))))) + (set! (-> *sky-upload-data* circle data gp-0 x) (* 2.2 (sin-rad f30-0))) + (set! (-> *sky-upload-data* circle data gp-0 y) (cos-rad f30-0)) + ) + (set! (-> *sky-upload-data* circle data gp-0 z) 0.0) + (set! (-> *sky-upload-data* circle data gp-0 w) 0.0) ) (deftype sky-tng-data (basic) diff --git a/goal_src/engine/gfx/time-of-day-h.gc b/goal_src/engine/gfx/time-of-day-h.gc index d516f0ad0..5a9165886 100644 --- a/goal_src/engine/gfx/time-of-day-h.gc +++ b/goal_src/engine/gfx/time-of-day-h.gc @@ -5,3 +5,112 @@ ;; name in dgo: time-of-day-h ;; dgos: GAME, ENGINE + +(deftype palette-fade-control (structure) + ((trans vector :inline :offset-assert 0) + (fade float :offset-assert 16) + (actor-dist float :offset-assert 20) + ) + :method-count-assert 9 + :size-assert #x18 + :flag-assert #x900000018 + ) + +(deftype palette-fade-controls (basic) + ((control palette-fade-control 8 :inline :offset-assert 16) + ) + :method-count-assert 11 + :size-assert #x110 + :flag-assert #xb00000110 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + ) + ) + +(define-extern *palette-fade-controls* palette-fade-controls) +(if (or (not *palette-fade-controls*) (zero? *palette-fade-controls*)) + (set! + *palette-fade-controls* + (the-as palette-fade-controls (new 'global 'palette-fade-controls)) + ) + ) + +(deftype time-of-day-proc (process) + ((year int32 :offset-assert 112) + (month int32 :offset-assert 116) + (week int32 :offset-assert 120) + (day int32 :offset-assert 124) + (hour int32 :offset-assert 128) + (minute int32 :offset-assert 132) + (second int32 :offset-assert 136) + (frame int32 :offset-assert 140) + (time-of-day float :offset-assert 144) + (time-ratio float :offset-assert 148) + (star-count int32 :offset-assert 152) + (stars basic :offset-assert 156) + (sun-count int32 :offset-assert 160) + (sun basic :offset-assert 164) + (green-sun-count int32 :offset-assert 168) + (green-sun basic :offset-assert 172) + (moon-count int32 :offset-assert 176) + (moon basic :offset-assert 180) + ) + :method-count-assert 14 + :size-assert #xb8 + :flag-assert #xe000000b8 + ) + +(deftype time-of-day-palette (basic) + ((width int32 :offset-assert 4) + (height int32 :offset-assert 8) + (pad int32 :offset-assert 12) + (data int32 1 :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +(deftype time-of-day-context (basic) + ((active-count uint32 :offset-assert 4) + (interp float :offset-assert 8) + (current-interp float :offset-assert 12) + (moods uint64 2 :offset-assert 16) + (current-fog mood-fog :inline :offset-assert 32) + (current-sun mood-sun :inline :offset-assert 80) + (current-prt-color vector :inline :offset-assert 112) + (current-shadow vector :inline :offset-assert 128) + (current-shadow-color vector :inline :offset-assert 144) + (light-group light-group 9 :inline :offset-assert 160) + (title-light-group light-group :inline :offset-assert 1888) + (time float :offset-assert 2080) + (target-interp float :offset-assert 2084) + (erase-color uint32 :offset-assert 2088) + (num-stars float :offset-assert 2092) + (light-masks-0 uint8 2 :offset-assert 2096) + (light-masks-1 uint8 2 :offset-assert 2098) + (light-interp uint32 2 :offset-assert 2100) + (sky basic :offset-assert 2108) + (sun-fade float :offset-assert 2112) + (title-updated symbol :offset-assert 2116) + ) + :method-count-assert 9 + :size-assert #x848 + :flag-assert #x900000848 + ) + +(deftype time-of-day-dma (structure) + ((outa uint32 256 :offset-assert 0) + (outb uint32 256 :offset-assert 1024) + (banka uint32 256 :offset-assert 2048) + (bankb uint32 256 :offset-assert 3072) + ) + :method-count-assert 9 + :size-assert #x1000 + :flag-assert #x900001000 + ) + +(define *time-of-day-mode* 8) ;; flags? enum? +(define *time-of-day-context* (new 'static 'time-of-day-context)) + diff --git a/test/decompiler/reference/all_forward_declarations.gc b/test/decompiler/reference/all_forward_declarations.gc index e45547c39..6d183b3a1 100644 --- a/test/decompiler/reference/all_forward_declarations.gc +++ b/test/decompiler/reference/all_forward_declarations.gc @@ -138,6 +138,12 @@ (define-extern quaternion-from-two-vectors-max-angle! (function quaternion vector vector float quaternion)) (define-extern vector-xz-length (function vector float)) +;; trigonometry +(defconstant PI (the-as float #x40490fda)) +(defconstant MINUS_PI (the-as float #xc0490fda)) +(define-extern sin-rad (function float float)) +(define-extern cos-rad (function float float)) + (defmacro .sync.l () `(none)) diff --git a/test/decompiler/reference/lights-h_REF.gc b/test/decompiler/reference/lights-h_REF.gc new file mode 100644 index 000000000..29941af9a --- /dev/null +++ b/test/decompiler/reference/lights-h_REF.gc @@ -0,0 +1,213 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type vu-lights +(deftype vu-lights (structure) + ((direction uint128 3 :offset-assert 0) + (color uint128 3 :offset-assert 48) + (ambient vector :inline :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +;; definition for method 3 of type vu-lights +(defmethod inspect vu-lights ((obj vu-lights)) + (format #t "[~8x] ~A~%" obj 'vu-lights) + (format #t "~Tdirection[3] @ #x~X~%" (-> obj direction)) + (format #t "~Tcolor[3] @ #x~X~%" (-> obj color)) + (format #t "~Tambient: ~`vector`P~%" (-> obj ambient)) + obj + ) + +;; definition of type light +(deftype light (structure) + ((direction vector :inline :offset-assert 0) + (color rgbaf :inline :offset-assert 16) + (levels vector :inline :offset-assert 32) + (level float :offset 32) + (sort-level float :offset 36) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type light +(defmethod inspect light ((obj light)) + (format #t "[~8x] ~A~%" obj 'light) + (format #t "~Tdirection: #~%" (-> obj direction)) + (format #t "~Tcolor: #~%" (-> obj color)) + (format #t "~Tlevels: #~%" (-> obj levels)) + (format #t "~Tlevel: ~f~%" (-> obj levels x)) + (format #t "~Tsort-level: ~f~%" (-> obj levels y)) + obj + ) + +;; definition of type light-ellipse +(deftype light-ellipse (structure) + ((matrix matrix :inline :offset-assert 0) + (color rgbaf :inline :offset-assert 64) + (name basic :offset 12) + (decay-start float :offset 28) + (ambient-point-ratio float :offset 44) + (level float :offset 60) + (func-symbol basic :offset 76) + (func basic :offset 76) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + ) + +;; definition for method 3 of type light-ellipse +(defmethod inspect light-ellipse ((obj light-ellipse)) + (format #t "[~8x] ~A~%" obj 'light-ellipse) + (format #t "~Tmatrix: #~%" (-> obj matrix)) + (format #t "~Tcolor: #~%" (-> obj color)) + (format #t "~Tname: ~A~%" (-> obj matrix data 3)) + (format #t "~Tdecay-start: ~f~%" (-> obj matrix data 7)) + (format #t "~Tambient-point-ratio: ~f~%" (-> obj matrix data 11)) + (format #t "~Tlevel: ~f~%" (-> obj matrix data 15)) + (format #t "~Tfunc-symbol: ~A~%" (-> obj color w)) + (format #t "~Tfunc: ~A~%" (-> obj color w)) + obj + ) + +;; definition of type light-array +(deftype light-array (array) + () + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type light-array +(defmethod inspect light-array ((obj light-array)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Ttype: ~A~%" (-> obj type)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tcontent-type: ~A~%" (-> obj content-type)) + obj + ) + +;; definition of type light-volume +(deftype light-volume (basic) + ((light-array basic :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type light-volume +(defmethod inspect light-volume ((obj light-volume)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlight-array: ~A~%" (-> obj light-array)) + obj + ) + +;; definition of type light-volume-sphere +(deftype light-volume-sphere (light-volume) + ((bsphere sphere :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type light-volume-sphere +(defmethod inspect light-volume-sphere ((obj light-volume-sphere)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlight-array: ~A~%" (-> obj light-array)) + (format #t "~Tbsphere: #~%" (-> obj bsphere)) + obj + ) + +;; definition of type light-volume-planes +(deftype light-volume-planes (light-volume) + ((planes vertical-planes :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type light-volume-planes +(defmethod inspect light-volume-planes ((obj light-volume-planes)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlight-array: ~A~%" (-> obj light-array)) + (format #t "~Tplanes: #~%" (-> obj planes)) + obj + ) + +;; definition of type light-volume-array +(deftype light-volume-array (array) + () + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type light-volume-array +(defmethod inspect light-volume-array ((obj light-volume-array)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Ttype: ~A~%" (-> obj type)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tcontent-type: ~A~%" (-> obj content-type)) + obj + ) + +;; definition for method 2 of type light +(defmethod print light ((obj light)) + (format + #t + "# obj levels x) + (-> obj direction x) + (-> obj direction y) + (-> obj direction z) + ) + (format + #t + "~F ~F ~F @ #x~X>" + (-> obj color x) + (-> obj color y) + (-> obj color z) + obj + ) + obj + ) + +;; definition of type light-group +(deftype light-group (structure) + ((dir0 light :inline :offset-assert 0) + (dir1 light :inline :offset-assert 48) + (dir2 light :inline :offset-assert 96) + (ambi light :inline :offset-assert 144) + ) + :method-count-assert 9 + :size-assert #xc0 + :flag-assert #x9000000c0 + ) + +;; definition for method 3 of type light-group +(defmethod inspect light-group ((obj light-group)) + (format #t "[~8x] ~A~%" obj 'light-group) + (format #t "~Tdir0: ~`light`P~%" (-> obj dir0)) + (format #t "~Tdir1: ~`light`P~%" (-> obj dir1)) + (format #t "~Tdir2: ~`light`P~%" (-> obj dir2)) + (format #t "~Tambi: ~`light`P~%" (-> obj ambi)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-9 0)) + ) + + + + diff --git a/test/decompiler/reference/mood-h_REF.gc b/test/decompiler/reference/mood-h_REF.gc new file mode 100644 index 000000000..e9ee8cdd0 --- /dev/null +++ b/test/decompiler/reference/mood-h_REF.gc @@ -0,0 +1,266 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type mood-fog +(deftype mood-fog (structure) + ((fog-color vector :inline :offset-assert 0) + (fog-dists vector :inline :offset-assert 16) + (fog-start float :offset 16) + (fog-end float :offset 20) + (fog-max float :offset 24) + (fog-min float :offset 28) + (erase-color vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type mood-fog +(defmethod inspect mood-fog ((obj mood-fog)) + (format #t "[~8x] ~A~%" obj 'mood-fog) + (format #t "~Tfog-color: #~%" (-> obj fog-color)) + (format #t "~Tfog-dists: #~%" (-> obj fog-dists)) + (format #t "~Tfog-start: (meters ~m)~%" (-> obj fog-dists x)) + (format #t "~Tfog-end: (meters ~m)~%" (-> obj fog-dists y)) + (format #t "~Tfog-max: ~f~%" (-> obj fog-dists z)) + (format #t "~Tfog-min: ~f~%" (-> obj fog-dists w)) + (format #t "~Terase-color: #~%" (-> obj erase-color)) + obj + ) + +;; definition of type mood-fog-table +(deftype mood-fog-table (structure) + ((data mood-fog 8 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x180 + :flag-assert #x900000180 + ) + +;; definition for method 3 of type mood-fog-table +(defmethod inspect mood-fog-table ((obj mood-fog-table)) + (format #t "[~8x] ~A~%" obj 'mood-fog-table) + (format #t "~Tdata[8] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type mood-lights +(deftype mood-lights (structure) + ((direction vector :inline :offset-assert 0) + (lgt-color vector :inline :offset-assert 16) + (prt-color vector :inline :offset-assert 32) + (amb-color vector :inline :offset-assert 48) + (shadow vector :inline :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + ) + +;; definition for method 3 of type mood-lights +(defmethod inspect mood-lights ((obj mood-lights)) + (format #t "[~8x] ~A~%" obj 'mood-lights) + (format #t "~Tdirection: #~%" (-> obj direction)) + (format #t "~Tlgt-color: #~%" (-> obj lgt-color)) + (format #t "~Tprt-color: #~%" (-> obj prt-color)) + (format #t "~Tamb-color: #~%" (-> obj amb-color)) + (format #t "~Tshadow: #~%" (-> obj shadow)) + obj + ) + +;; definition of type mood-lights-table +(deftype mood-lights-table (structure) + ((data mood-lights 8 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x280 + :flag-assert #x900000280 + ) + +;; definition for method 3 of type mood-lights-table +(defmethod inspect mood-lights-table ((obj mood-lights-table)) + (format #t "[~8x] ~A~%" obj 'mood-lights-table) + (format #t "~Tdata[8] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type mood-sun +(deftype mood-sun (structure) + ((sun-color vector :inline :offset-assert 0) + (env-color vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type mood-sun +(defmethod inspect mood-sun ((obj mood-sun)) + (format #t "[~8x] ~A~%" obj 'mood-sun) + (format #t "~Tsun-color: #~%" (-> obj sun-color)) + (format #t "~Tenv-color: #~%" (-> obj env-color)) + obj + ) + +;; definition of type mood-sun-table +(deftype mood-sun-table (structure) + ((data mood-sun 8 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x100 + :flag-assert #x900000100 + ) + +;; definition for method 3 of type mood-sun-table +(defmethod inspect mood-sun-table ((obj mood-sun-table)) + (format #t "[~8x] ~A~%" obj 'mood-sun-table) + (format #t "~Tdata[8] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type mood-context +(deftype mood-context (basic) + ((mood-fog-table mood-fog-table :offset-assert 4) + (mood-lights-table mood-lights-table :offset-assert 8) + (mood-sun-table mood-sun-table :offset-assert 12) + (fog-interp sky-color-day :offset-assert 16) + (palette-interp sky-color-day :offset-assert 20) + (sky-texture-interp sky-color-day :offset-assert 24) + (current-fog mood-fog :inline :offset-assert 32) + (current-sun mood-sun :inline :offset-assert 80) + (current-prt-color vector :inline :offset-assert 112) + (current-shadow vector :inline :offset-assert 128) + (current-shadow-color vector :inline :offset-assert 144) + (light-group light-group 8 :inline :offset-assert 160) + (times vector 8 :inline :offset-assert 1696) + (sky-times float 8 :offset-assert 1824) + (itimes vector4w 4 :inline :offset-assert 1856) + (state uint8 16 :offset-assert 1920) + (num-stars float :offset-assert 1936) + ) + :method-count-assert 9 + :size-assert #x794 + :flag-assert #x900000794 + (:methods + (new (symbol type) _type_ 0) + ) + ) + +;; definition for method 3 of type mood-context +(defmethod inspect mood-context ((obj mood-context)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format + #t + "~Tmood-fog-table: #~%" + (-> obj mood-fog-table) + ) + (format + #t + "~Tmood-lights-table: #~%" + (-> obj mood-lights-table) + ) + (format + #t + "~Tmood-sun-table: #~%" + (-> obj mood-sun-table) + ) + (format #t "~Tfog-interp: #~%" (-> obj fog-interp)) + (format + #t + "~Tpalette-interp: #~%" + (-> obj palette-interp) + ) + (format + #t + "~Tsky-texture-interp: #~%" + (-> obj sky-texture-interp) + ) + (format #t "~Tcurrent-fog: #~%" (-> obj current-fog)) + (format #t "~Tcurrent-sun: #~%" (-> obj current-sun)) + (format + #t + "~Tcurrent-prt-color: #~%" + (-> obj current-prt-color) + ) + (format #t "~Tcurrent-shadow: #~%" (-> obj current-shadow)) + (format + #t + "~Tcurrent-shadow-color: #~%" + (-> obj current-shadow-color) + ) + (format #t "~Tlight-group[8] @ #x~X~%" (-> obj light-group)) + (format #t "~Ttimes[8] @ #x~X~%" (-> obj times)) + (format #t "~Tsky-times[8] @ #x~X~%" (-> obj sky-times)) + (format #t "~Titimes[4] @ #x~X~%" (-> obj itimes)) + (format #t "~Tstate[16] @ #x~X~%" (-> obj state)) + (format #t "~Tnum-stars: ~f~%" (-> obj num-stars)) + obj + ) + +;; definition for method 0 of type mood-context +(defmethod new mood-context ((allocation symbol) (type-to-make type)) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (let ((v1-2 (-> v0-0 times))) + (set! (-> v1-2 0 x) 1.0) + (set! (-> v1-2 0 y) 1.0) + (set! (-> v1-2 0 z) 1.0) + (set! (-> v1-2 0 w) 0.0) + ) + (let ((v1-3 (-> v0-0 times 1))) + (set! (-> v1-3 x) 1.0) + (set! (-> v1-3 y) 1.0) + (set! (-> v1-3 z) 1.0) + (set! (-> v1-3 w) 0.0) + ) + (let ((v1-4 (-> v0-0 times 2))) + (set! (-> v1-4 x) 1.0) + (set! (-> v1-4 y) 1.0) + (set! (-> v1-4 z) 1.0) + (set! (-> v1-4 w) 0.0) + ) + (let ((v1-5 (-> v0-0 times 3))) + (set! (-> v1-5 x) 1.0) + (set! (-> v1-5 y) 1.0) + (set! (-> v1-5 z) 1.0) + (set! (-> v1-5 w) 0.0) + ) + (let ((v1-6 (-> v0-0 times 4))) + (set! (-> v1-6 x) 1.0) + (set! (-> v1-6 y) 1.0) + (set! (-> v1-6 z) 1.0) + (set! (-> v1-6 w) 0.0) + ) + (let ((v1-7 (-> v0-0 times 5))) + (set! (-> v1-7 x) 1.0) + (set! (-> v1-7 y) 1.0) + (set! (-> v1-7 z) 1.0) + (set! (-> v1-7 w) 0.0) + ) + (let ((v1-8 (-> v0-0 times 6))) + (set! (-> v1-8 x) 1.0) + (set! (-> v1-8 y) 1.0) + (set! (-> v1-8 z) 1.0) + (set! (-> v1-8 w) 0.0) + ) + (let ((v1-9 (-> v0-0 times 7))) + (set! (-> v1-9 x) 1.0) + (set! (-> v1-9 y) 1.0) + (set! (-> v1-9 z) 1.0) + (set! (-> v1-9 w) 0.0) + ) + v0-0 + ) + ) + +;; failed to figure out what this is: +(let ((v0-7 0)) + ) + + + + diff --git a/test/decompiler/reference/sky-h_REF.gc b/test/decompiler/reference/sky-h_REF.gc new file mode 100644 index 000000000..4b6809c23 --- /dev/null +++ b/test/decompiler/reference/sky-h_REF.gc @@ -0,0 +1,326 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type sky-color-hour +(deftype sky-color-hour (structure) + ((snapshot1 int32 :offset-assert 0) + (snapshot2 int32 :offset-assert 4) + (morph-start float :offset-assert 8) + (morph-end float :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type sky-color-hour +(defmethod inspect sky-color-hour ((obj sky-color-hour)) + (format #t "[~8x] ~A~%" obj 'sky-color-hour) + (format #t "~Tsnapshot1: ~D~%" (-> obj snapshot1)) + (format #t "~Tsnapshot2: ~D~%" (-> obj snapshot2)) + (format #t "~Tmorph-start: ~f~%" (-> obj morph-start)) + (format #t "~Tmorph-end: ~f~%" (-> obj morph-end)) + obj + ) + +;; definition of type sky-color-day +(deftype sky-color-day (structure) + ((hour sky-color-hour 24 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x180 + :flag-assert #x900000180 + ) + +;; definition for method 3 of type sky-color-day +(defmethod inspect sky-color-day ((obj sky-color-day)) + (format #t "[~8x] ~A~%" obj 'sky-color-day) + (format #t "~Thour[24] @ #x~X~%" (-> obj hour)) + obj + ) + +;; definition of type sky-circle-data +(deftype sky-circle-data (structure) + ((data vector 17 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x110 + :flag-assert #x900000110 + ) + +;; definition for method 3 of type sky-circle-data +(defmethod inspect sky-circle-data ((obj sky-circle-data)) + (format #t "[~8x] ~A~%" obj 'sky-circle-data) + (format #t "~Tdata[17] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type sky-sun-data +(deftype sky-sun-data (structure) + ((data uint128 4 :offset-assert 0) + (pos vector :inline :offset 0) + (r-sun float :offset 16) + (r-halo float :offset 20) + (r-aurora float :offset 24) + (c-sun-start uint32 :offset 32) + (c-sun-end uint32 :offset 48) + (c-halo-start uint32 :offset 36) + (c-halo-end uint32 :offset 52) + (c-aurora-start uint32 :offset 40) + (c-aurora-end uint32 :offset 56) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +;; definition for method 3 of type sky-sun-data +(defmethod inspect sky-sun-data ((obj sky-sun-data)) + (format #t "[~8x] ~A~%" obj 'sky-sun-data) + (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) + (format #t "~Tpos: #~%" (-> obj data)) + (format #t "~Tr-sun: ~f~%" (-> obj r-sun)) + (format #t "~Tr-halo: ~f~%" (-> obj r-halo)) + (format #t "~Tr-aurora: ~f~%" (-> obj r-aurora)) + (format #t "~Tc-sun-start: ~D~%" (-> obj c-sun-start)) + (format #t "~Tc-sun-end: ~D~%" (-> obj c-sun-end)) + (format #t "~Tc-halo-start: ~D~%" (-> obj c-halo-start)) + (format #t "~Tc-halo-end: ~D~%" (-> obj c-halo-end)) + (format #t "~Tc-aurora-start: ~D~%" (-> obj c-aurora-start)) + (format #t "~Tc-aurora-end: ~D~%" (-> obj c-aurora-end)) + obj + ) + +;; definition of type sky-moon-data +(deftype sky-moon-data (structure) + ((data uint128 2 :offset-assert 0) + (pos vector :inline :offset 0) + (scale vector :inline :offset 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type sky-moon-data +(defmethod inspect sky-moon-data ((obj sky-moon-data)) + (format #t "[~8x] ~A~%" obj 'sky-moon-data) + (format #t "~Tdata[2] @ #x~X~%" (-> obj data)) + (format #t "~Tpos: #~%" (-> obj data)) + (format #t "~Tscale: #~%" (&-> obj data 1)) + obj + ) + +;; definition of type sky-orbit +(deftype sky-orbit (structure) + ((high-noon float :offset-assert 0) + (tilt float :offset-assert 4) + (rise float :offset-assert 8) + (dist float :offset-assert 12) + (min-halo float :offset-assert 16) + (max-halo float :offset-assert 20) + ) + :allow-misaligned :method-count-assert 9 + :size-assert #x18 + :flag-assert #x900000018 + ) + +;; definition for method 3 of type sky-orbit +(defmethod inspect sky-orbit ((obj sky-orbit)) + (format #t "[~8x] ~A~%" obj 'sky-orbit) + (format #t "~Thigh-noon: ~f~%" (-> obj high-noon)) + (format #t "~Ttilt: ~f~%" (-> obj tilt)) + (format #t "~Trise: ~f~%" (-> obj rise)) + (format #t "~Tdist: ~f~%" (-> obj dist)) + (format #t "~Tmin-halo: ~f~%" (-> obj min-halo)) + (format #t "~Tmax-halo: ~f~%" (-> obj max-halo)) + obj + ) + +;; definition of type sky-upload-data +(deftype sky-upload-data (basic) + ((circle sky-circle-data :inline :offset-assert 16) + (sun sky-sun-data 2 :inline :offset-assert 288) + (moon sky-moon-data :inline :offset-assert 416) + (data uint128 27 :offset 16) + ) + :method-count-assert 9 + :size-assert #x1c0 + :flag-assert #x9000001c0 + ) + +;; definition for method 3 of type sky-upload-data +(defmethod inspect sky-upload-data ((obj sky-upload-data)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdata[27] @ #x~X~%" (-> obj circle)) + (format #t "~Tcircle: #~%" (-> obj circle)) + (format #t "~Tsun[2] @ #x~X~%" (-> obj sun)) + (format #t "~Tmoon: #~%" (-> obj moon)) + obj + ) + +;; definition of type sky-parms +(deftype sky-parms (basic) + ((orbit sky-orbit 3 :inline :offset-assert 4) + (upload-data sky-upload-data :inline :offset-assert 112) + (sun-lights light-group :inline :offset-assert 560) + (moon-lights light-group :inline :offset-assert 752) + (default-lights light-group :inline :offset-assert 944) + (default-vu-lights vu-lights :inline :offset-assert 1136) + ) + :method-count-assert 9 + :size-assert #x4e0 + :flag-assert #x9000004e0 + (:methods + (new (symbol type) _type_ 0) + ) + ) + +;; definition for method 3 of type sky-parms +(defmethod inspect sky-parms ((obj sky-parms)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Torbit[3] @ #x~X~%" (-> obj orbit)) + (format #t "~Tupload-data: #~%" (-> obj upload-data)) + (format #t "~Tsun-lights: #~%" (-> obj sun-lights)) + (format #t "~Tmoon-lights: #~%" (-> obj moon-lights)) + (format + #t + "~Tdefault-lights: #~%" + (-> obj default-lights) + ) + (format + #t + "~Tdefault-vu-lights: #~%" + (-> obj default-vu-lights) + ) + obj + ) + +;; definition for method 0 of type sky-parms +(defmethod new sky-parms ((allocation symbol) (type-to-make type)) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 upload-data type) sky-upload-data) + v0-0 + ) + ) + +;; definition for symbol *sky-parms*, type sky-parms +(define *sky-parms* (new 'global 'sky-parms)) + +;; definition for symbol *sky-upload-data*, type sky-upload-data +(define + *sky-upload-data* + (the-as sky-upload-data (new 'global 'sky-upload-data)) + ) + +;; failed to figure out what this is: +(dotimes (gp-0 17) + (let ((f30-0 (+ MINUS_PI (* 0.39269906 (the float (logand gp-0 15)))))) + (set! (-> *sky-upload-data* circle data gp-0 x) (* 2.2 (sin-rad f30-0))) + (set! (-> *sky-upload-data* circle data gp-0 y) (cos-rad f30-0)) + ) + (set! (-> *sky-upload-data* circle data gp-0 z) 0.0) + (set! (-> *sky-upload-data* circle data gp-0 w) 0.0) + ) + +;; failed to figure out what this is: +(empty-form) + +;; failed to figure out what this is: +(empty-form) + +;; definition of type sky-tng-data +(deftype sky-tng-data (basic) + ((giftag-base qword :inline :offset-assert 16) + (giftag-roof qword :inline :offset-assert 32) + (giftag-ocean qword :inline :offset-assert 48) + (fog vector :inline :offset-assert 64) + (sky uint32 8 :offset-assert 80) + (time float :offset-assert 112) + (off-s-0 uint16 :offset-assert 116) + (off-t-0 uint16 :offset-assert 118) + (off-s-1 uint16 :offset-assert 120) + (off-t-1 uint16 :offset-assert 122) + ) + :method-count-assert 9 + :size-assert #x7c + :flag-assert #x90000007c + ) + +;; definition for method 3 of type sky-tng-data +(defmethod inspect sky-tng-data ((obj sky-tng-data)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tgiftag-base: #~%" (-> obj giftag-base)) + (format #t "~Tgiftag-roof: #~%" (-> obj giftag-roof)) + (format #t "~Tgiftag-ocean: #~%" (-> obj giftag-ocean)) + (format #t "~Tfog: #~%" (-> obj fog)) + (format #t "~Tsky[8] @ #x~X~%" (-> obj sky)) + (format #t "~Ttime: ~f~%" (-> obj time)) + (format #t "~Toff-s-0: ~D~%" (-> obj off-s-0)) + (format #t "~Toff-t-0: ~D~%" (-> obj off-t-0)) + (format #t "~Toff-s-1: ~D~%" (-> obj off-s-1)) + (format #t "~Toff-t-1: ~D~%" (-> obj off-t-1)) + obj + ) + +;; definition of type sky-work +(deftype sky-work (structure) + ((adgif-tmpl dma-gif-packet :inline :offset-assert 0) + (draw-tmpl dma-gif-packet :inline :offset-assert 32) + (blend-tmpl dma-gif-packet :inline :offset-assert 64) + (sky-data uint128 5 :offset-assert 96) + (cloud-data uint128 5 :offset-assert 176) + ) + :method-count-assert 9 + :size-assert #x100 + :flag-assert #x900000100 + ) + +;; definition for method 3 of type sky-work +(defmethod inspect sky-work ((obj sky-work)) + (format #t "[~8x] ~A~%" obj 'sky-work) + (format #t "~Tadgif-tmpl: #~%" (-> obj adgif-tmpl)) + (format #t "~Tdraw-tmpl: #~%" (-> obj draw-tmpl)) + (format #t "~Tblend-tmpl: #~%" (-> obj blend-tmpl)) + (format #t "~Tsky-data[5] @ #x~X~%" (-> obj sky-data)) + (format #t "~Tcloud-data[5] @ #x~X~%" (-> obj cloud-data)) + obj + ) + +;; definition of type sky-vertex +(deftype sky-vertex (structure) + ((pos vector :inline :offset-assert 0) + (stq vector :inline :offset-assert 16) + (col vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type sky-vertex +(defmethod inspect sky-vertex ((obj sky-vertex)) + (format #t "[~8x] ~A~%" obj 'sky-vertex) + (format #t "~Tpos: #~%" (-> obj pos)) + (format #t "~Tstq: #~%" (-> obj stq)) + (format #t "~Tcol: #~%" (-> obj col)) + obj + ) + +;; definition for symbol *sky-drawn*, type symbol +(define *sky-drawn* #f) + +;; definition for symbol *cloud-drawn*, type symbol +(define *cloud-drawn* #f) + +;; failed to figure out what this is: +(let ((v0-15 0)) + ) + + + + diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index 1a210aa41..3a2728959 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -22,6 +22,10 @@ const std::unordered_set g_object_files_to_decompile = { /* gap */ "mspace-h", "drawable-h", "drawable-group-h", /* gap */ + "lights-h", + /* gap */ + "sky-h", "mood-h", /* "time-of-day-h", */ + /* gap */ "bounding-box", /* gap */ "sync-info-h", "sync-info"}; @@ -40,6 +44,10 @@ const std::vector g_object_files_to_check_against_reference = { "display", /* gap */ "mspace-h", "drawable-h", "drawable-group-h", + /* gap */ + "lights-h", + /* gap */ + "sky-h", "mood-h", /* "time-of-day-h", */ /* gap */ "bounding-box", /* gap */ "sync-info-h", "sync-info"};