diff --git a/.vs/launch.vs.json b/.vs/launch.vs.json index 0650cbff3b..f7af0801bd 100644 --- a/.vs/launch.vs.json +++ b/.vs/launch.vs.json @@ -82,6 +82,13 @@ "projectTarget" : "memory_dump_tool.exe (bin\\memory_dump_tool.exe)", "name" : "Run - EE Memory Analyze", "args" : [ "${workspaceRoot}/eeMemory.bin", "${workspaceRoot}"] + }, + { + "type" : "default", + "project" : "CMakeLists.txt", + "projectTarget" : "dgo_unpacker.exe (bin\\dgo_unpacker.exe)", + "name" : "Run - DGO Unpacker (test)", + "args" : [ "C:\\GameData\\Jak1\\Backup\\DGO-PAL\\GAME", "C:\\GameData\\Jak1\\Backup\\DISC-PAL\\CGO\\GAME.CGO"] } ] } diff --git a/common/util/DgoReader.cpp b/common/util/DgoReader.cpp index fe81cd88b6..2e1def774f 100644 --- a/common/util/DgoReader.cpp +++ b/common/util/DgoReader.cpp @@ -58,4 +58,4 @@ std::string DgoReader::description_as_json() const { } return j.dump(4); -} \ No newline at end of file +} diff --git a/decompiler/analysis/stack_spill.cpp b/decompiler/analysis/stack_spill.cpp index 4db7b20257..f366e09171 100644 --- a/decompiler/analysis/stack_spill.cpp +++ b/decompiler/analysis/stack_spill.cpp @@ -78,6 +78,7 @@ struct StackInstrInfo { constexpr StackInstrInfo stack_instrs[] = {{InstructionKind::SQ, false, 16, false}, {InstructionKind::LQ, true, 16, false}, {InstructionKind::SW, false, 4, false}, + {InstructionKind::SH, false, 2, false}, {InstructionKind::SB, false, 1, false}, {InstructionKind::LBU, true, 1, false}, //{InstructionKind::LWU, true, 4, false} @@ -111,4 +112,4 @@ StackSpillMap build_spill_map(const std::vector& instructions, Rang map.finalize(); return map; } -} // namespace decompiler \ No newline at end of file +} // namespace decompiler diff --git a/decompiler/analysis/type_analysis.cpp b/decompiler/analysis/type_analysis.cpp index 990bf3f38c..a3491aae35 100644 --- a/decompiler/analysis/type_analysis.cpp +++ b/decompiler/analysis/type_analysis.cpp @@ -15,7 +15,8 @@ TypeState construct_initial_typestate(const TypeSpec& f_ts, const Env& env) { } // todo, more specific process types for behaviors. - result.get(Register(Reg::GPR, Reg::S6)) = TP_Type::make_from_ts(TypeSpec("process")); + result.get(Register(Reg::GPR, Reg::S6)) = + TP_Type::make_from_ts(TypeSpec(f_ts.try_get_tag("behavior").value_or("process"))); // initialize stack slots as uninitialized for (auto slot_info : env.stack_spills().map()) { diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index ada72f4021..fcdbb606cb 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -622,6 +622,13 @@ :bitfield #t :type uint32 (display-marks 0) + (bit1 1) + (bit2 2) + (bit3 3) + (bit4 4) + (bit5 5) + (bit6 6) + (bit7 7) (bit8 8) (bit13 13) ) @@ -977,7 +984,7 @@ (new (symbol type basic) _type_ 0) (activate (_type_ process-tree basic pointer) process-tree 9) (deactivate (_type_) none 10) - (dummy-method-11 () none 11) + (dummy-method-11 (_type_ object) none 11) (run-logic? (_type_) symbol 12) (dummy-method () none 13) ) @@ -1001,12 +1008,12 @@ (allow-to-run process-mask :offset-assert 12) (next-pid int32 :offset-assert 16) (fast-stack-top pointer :offset-assert 20) - (current-process basic :offset-assert 24) + (current-process process :offset-assert 24) (relocating-process basic :offset-assert 28) (relocating-min int32 :offset-assert 32) (relocating-max int32 :offset-assert 36) (relocating-offset int32 :offset-assert 40) - (low-memory-message basic :offset-assert 44) + (low-memory-message symbol :offset-assert 44) ) :method-count-assert 9 :size-assert #x30 @@ -1155,14 +1162,14 @@ (trans (function object) :offset-assert 20) (post function :offset-assert 24) (enter (function object object object object object object object) :offset-assert 28) - (event (function basic int basic event-message-block object) :offset-assert 32) + (event (function process int symbol event-message-block object) :offset-assert 32) ) (:methods (new (symbol type basic function (function object) (function object object object object object object object) (function object) - (function basic int basic event-message-block object)) _type_ 0) + (function process int symbol event-message-block object)) _type_ 0) ) :method-count-assert 9 :size-assert #x24 @@ -1170,10 +1177,10 @@ ) (deftype event-message-block (structure) - ((to basic :offset-assert 0) - (from basic :offset-assert 4) + ((to process :offset-assert 0) + (from process :offset-assert 4) (num-params int32 :offset-assert 8) - (message basic :offset-assert 12) + (message symbol :offset-assert 12) (param uint64 7 :offset-assert 16) ) :method-count-assert 9 @@ -1208,7 +1215,7 @@ (state state :offset-assert #x38) (trans-hook function :offset-assert #x3c) (post-hook function :offset-assert #x40) - (event-hook (function basic int basic event-message-block object) :offset-assert #x44) + (event-hook (function process int symbol event-message-block object) :offset-assert #x44) (allocated-length int32 :offset-assert #x48) (next-state state :offset-assert #x4c) (heap-base pointer :offset-assert #x50) @@ -1222,7 +1229,7 @@ (new (symbol type basic int) _type_ 0) (activate (_type_ process-tree basic pointer) process-tree 9) (deactivate (process) none 10) - (dummy-method-11 () none 11) + (dummy-method-11 (_type_ object) none 11) (run-logic? (process) symbol 12) (dummy-method () none 13) ) @@ -4394,28 +4401,31 @@ ;; - Types +(declare-type art-group basic) ;; custom fields (deftype load-dir (basic) ((unknown basic :offset-assert 4) - (string-array (array string) :offset-assert 8) - (data-array (array basic) :score -50 :offset-assert 12) + (string-array (array string) :offset-assert 8) ;; these are the names + (data-array (array basic) :score -50 :offset-assert 12) ;; this is the file data. ) :flag-assert #xb00000010 (:methods (new (symbol type int basic) _type_ 0) - (dummy-9 () none 9) - (dummy-10 () none 10) + ;; these methods dont exist + (dummy-9 (_type_ string symbol kheap int) art-group 9) + (dummy-10 (_type_ art-group) art-group 10) ) ) ;; custom fields -(declare-type art-group basic) (deftype load-dir-art-group (load-dir) ((art-group-array (array art-group) :offset 12) ) :flag-assert #xb00000010 (:methods (new (symbol type int basic) _type_ 0) + (dummy-9 (_type_ string symbol kheap int) art-group 9) + (dummy-10 (_type_ art-group) art-group 10) ) ) @@ -4428,13 +4438,13 @@ (heap kheap :inline :offset-assert 32) (pending-load-file string :offset-assert 48) (pending-load-file-part int32 :offset-assert 52) - (pending-load-file-owner uint64 :offset-assert 56) + (pending-load-file-owner handle :offset-assert 56) (pending-load-file-priority float :offset-assert 64) (load-file string :offset-assert 68) (load-file-part int32 :offset-assert 72) - (load-file-owner uint64 :offset-assert 80) + (load-file-owner handle :offset-assert 80) (load-file-priority float :offset-assert 88) - (buf uint32 :offset-assert 92) + (buf pointer :offset-assert 92) (len int32 :offset-assert 96) (art-group art-group :offset-assert 100) ) @@ -4443,23 +4453,25 @@ :flag-assert #x1000000068 (:methods (new (symbol type int) _type_ 0) - (dummy-9 (_type_ symbol int symbol float) none 9) - (dummy-10 () none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) + (want-file (_type_ string int handle float) int 9) + (update (_type_) int 10) + (inactive? (_type_) symbol 11) + (file-status (_type_ string int) symbol 12) + (link-file (_type_ art-group) art-group 13) + (unlink-file (_type_ art-group) int 14) + (unlock! (_type_) symbol 15) ) ) (deftype spool-anim (basic) ((name string :offset 16) ;; why? - (index int32 :offset-assert 20) + (buf1 external-art-buffer :offset 16) ;; custom + (buf2 external-art-buffer :offset-assert 20) ;; custom (also what?) + (index int32 :offset 20) (parts int32 :offset-assert 24) (priority float :offset-assert 28) - (owner uint64 :offset-assert 32) - (command-list basic :offset-assert 40) + (owner handle :offset-assert 32) + (command-list pair :offset-assert 40) ) :pack-me :method-count-assert 9 @@ -4467,14 +4479,13 @@ :flag-assert #x90000002c ) -; todo inline basics (deftype external-art-control (basic) ((buffer external-art-buffer 2 :offset-assert 4) - (rec spool-anim 3 :inline) - (spool-lock uint64 :offset-assert 160) - (reserve-buffer basic :offset-assert 168) + (rec spool-anim 3 :inline :offset-assert 16) + (spool-lock handle :offset-assert 160) + (reserve-buffer external-art-buffer :offset-assert 168) (reserve-buffer-count int32 :offset-assert 172) - (active-stream basic :offset-assert 176) + (active-stream string :offset-assert 176) (preload-stream spool-anim :inline :offset-assert 184) (last-preload-stream spool-anim :inline :offset-assert 232) (end-pad uint32) @@ -4484,14 +4495,14 @@ :flag-assert #x1100000118 (:methods (new (symbol type) _type_ 0) - (dummy-9 (_type_ symbol) none 9) - (dummy-10 (_type_) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) + (update (_type_ symbol) int 9) + (clear-rec (_type_) int 10) + (spool-push (_type_ string int process float) int 11) + (file-status (_type_ string int) symbol 12) + (reserve-alloc (_type_) kheap 13) + (reserve-free (_type_ kheap) int 14) + (none-reserved? (_type_) symbol 15) + (try-preload-stream (_type_ string int process float) int 16) ) ) @@ -6857,13 +6868,13 @@ ;; - Symbols -(define-extern *ocean-work* ocean-work) ;; unknown type -(define-extern *ocean-facing* int) ;; unknown type -(define-extern *ocean-off* symbol) ;; unknown type -(define-extern *ocean-mid-off* symbol) ;; unknown type -(define-extern *ocean-near-off* symbol) ;; unknown type -(define-extern *ocean-heights* symbol) ;; unknown type -(define-extern *ocean-verts* symbol) ;; unknown type +(define-extern *ocean-work* ocean-work) +(define-extern *ocean-facing* int) +(define-extern *ocean-off* symbol) +(define-extern *ocean-mid-off* symbol) +(define-extern *ocean-near-off* symbol) +(define-extern *ocean-heights* symbol) +(define-extern *ocean-verts* symbol) ;; ---------------------- @@ -6874,25 +6885,25 @@ ;; - Symbols -(define-extern *ocean-left-table* (pointer float)) ;; unknown type -(define-extern *ocean-right-table* (pointer float)) ;; unknown type -(define-extern *ocean-up-table* (pointer float)) ;; unknown type -(define-extern *ocean-down-table* (pointer float)) ;; unknown type -(define-extern *ocean-down-left-table* (pointer float)) ;; unknown type -(define-extern *ocean-down-right-table* (pointer float)) ;; unknown type -(define-extern *ocean-up-right-table* (pointer float)) ;; unknown type -(define-extern *ocean-up-left-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-left-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-right-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-up-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-down-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-down-left-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-down-right-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-up-right-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-up-left-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-corner-table* (pointer float)) ;; unknown type -(define-extern *ocean-trans-strip-array* (pointer float)) ;; unknown type -(define-extern *ocean-trans-st-table* (pointer float)) ;; unknown type +(define-extern *ocean-left-table* (pointer float)) +(define-extern *ocean-right-table* (pointer float)) +(define-extern *ocean-up-table* (pointer float)) +(define-extern *ocean-down-table* (pointer float)) +(define-extern *ocean-down-left-table* (pointer float)) +(define-extern *ocean-down-right-table* (pointer float)) +(define-extern *ocean-up-right-table* (pointer float)) +(define-extern *ocean-up-left-table* (pointer float)) +(define-extern *ocean-trans-left-table* (pointer float)) +(define-extern *ocean-trans-right-table* (pointer float)) +(define-extern *ocean-trans-up-table* (pointer float)) +(define-extern *ocean-trans-down-table* (pointer float)) +(define-extern *ocean-trans-down-left-table* (pointer float)) +(define-extern *ocean-trans-down-right-table* (pointer float)) +(define-extern *ocean-trans-up-right-table* (pointer float)) +(define-extern *ocean-trans-up-left-table* (pointer float)) +(define-extern *ocean-trans-corner-table* (pointer float)) +(define-extern *ocean-trans-strip-array* (pointer float)) +(define-extern *ocean-trans-st-table* (pointer float)) ;; ---------------------- @@ -6903,25 +6914,25 @@ ;; - Symbols -(define-extern *ocean-spheres-village1* ocean-spheres) ;; unknown type -(define-extern *ocean-colors-village1* ocean-colors) ;; unknown type -(define-extern *ocean-near-indices-village1* ocean-near-indices) ;; unknown type -(define-extern *ocean-trans-indices-village1* ocean-trans-indices) ;; unknown type -(define-extern *ocean-mid-indices-village1* ocean-mid-indices) ;; unknown type -(define-extern *ocean-mid-masks-village1* ocean-mid-masks) ;; unknown type -(define-extern *ocean-spheres-village2* ocean-spheres) ;; unknown type -(define-extern *ocean-colors-village2* ocean-colors) ;; unknown type -(define-extern *ocean-near-indices-village2* ocean-near-indices) ;; unknown type -(define-extern *ocean-trans-indices-village2* ocean-trans-indices) ;; unknown type -(define-extern *ocean-mid-indices-village2* ocean-mid-indices) ;; unknown type -(define-extern *ocean-mid-masks-village2* ocean-mid-masks) ;; unknown type -(define-extern *ocean-near-indices-sunken* ocean-near-indices) ;; unknown type -(define-extern *ocean-trans-indices-sunken* ocean-trans-indices) ;; unknown type -(define-extern *ocean-mid-indices-sunken* ocean-mid-indices) ;; unknown type -(define-extern *ocean-mid-masks-sunken* ocean-mid-masks) ;; unknown type -(define-extern *ocean-map-village1* ocean-map) ;; unknown type -(define-extern *ocean-map-village2* ocean-map) ;; unknown type -(define-extern *ocean-map-sunken* ocean-map) ;; unknown type +(define-extern *ocean-spheres-village1* ocean-spheres) +(define-extern *ocean-colors-village1* ocean-colors) +(define-extern *ocean-near-indices-village1* ocean-near-indices) +(define-extern *ocean-trans-indices-village1* ocean-trans-indices) +(define-extern *ocean-mid-indices-village1* ocean-mid-indices) +(define-extern *ocean-mid-masks-village1* ocean-mid-masks) +(define-extern *ocean-spheres-village2* ocean-spheres) +(define-extern *ocean-colors-village2* ocean-colors) +(define-extern *ocean-near-indices-village2* ocean-near-indices) +(define-extern *ocean-trans-indices-village2* ocean-trans-indices) +(define-extern *ocean-mid-indices-village2* ocean-mid-indices) +(define-extern *ocean-mid-masks-village2* ocean-mid-masks) +(define-extern *ocean-near-indices-sunken* ocean-near-indices) +(define-extern *ocean-trans-indices-sunken* ocean-trans-indices) +(define-extern *ocean-mid-indices-sunken* ocean-mid-indices) +(define-extern *ocean-mid-masks-sunken* ocean-mid-masks) +(define-extern *ocean-map-village1* ocean-map) +(define-extern *ocean-map-village2* ocean-map) +(define-extern *ocean-map-sunken* ocean-map) ;; ---------------------- @@ -6943,8 +6954,6 @@ ;; - Types -;;;;;;;;;; -;;;;;;;;;; (deftype sky-color-hour (structure) ((snapshot1 int32 :offset-assert 0) (snapshot2 int32 :offset-assert 4) @@ -6978,12 +6987,12 @@ (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) + (c-sun-start rgba :offset 32) + (c-sun-end rgba :offset 48) + (c-halo-start rgba :offset 36) + (c-halo-end rgba :offset 52) + (c-aurora-start rgba :offset 40) + (c-aurora-end rgba :offset 56) ) :method-count-assert 9 :size-assert #x40 @@ -7015,10 +7024,8 @@ ) (deftype sky-upload-data (basic) - ( - ;(data UNKNOWN 27 :offset-assert 16) - (circle sky-circle-data :inline :offset-assert 16) - (sun sky-sun-data 2 :inline :offset-assert 288) + ((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) ) @@ -7049,7 +7056,7 @@ (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) + (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) @@ -7085,10 +7092,10 @@ ;; - Symbols -(define-extern *sky-parms* sky-parms) ;; unknown type -(define-extern *sky-upload-data* sky-upload-data) ;; unknown type -(define-extern *sky-drawn* symbol) ;; unknown type -(define-extern *cloud-drawn* symbol) ;; unknown type +(define-extern *sky-parms* sky-parms) +(define-extern *sky-upload-data* sky-upload-data) +(define-extern *sky-drawn* symbol) +(define-extern *cloud-drawn* symbol) ;; ---------------------- @@ -7295,9 +7302,9 @@ ;; - Symbols -(define-extern *palette-fade-controls* palette-fade-controls) ;; unknown type -(define-extern *time-of-day-mode* int) ;; unknown type -(define-extern *time-of-day-context* time-of-day-context) ;; unknown type +(define-extern *palette-fade-controls* palette-fade-controls) +(define-extern *time-of-day-mode* int) +(define-extern *time-of-day-context* time-of-day-context) ;; ---------------------- @@ -7472,8 +7479,8 @@ :size-assert #x20 :flag-assert #xf00000020 (:methods - (dummy-13 (_type_) int 13) - (dummy-14 (_type_) int 14) + (link-art! (_type_) art-group 13) + (unlink-art! (_type_) int 14) ) ) @@ -7596,7 +7603,7 @@ ;; - Functions -(define-extern new-dynamic-structure (function symbol type int structure)) ;; unknown type +(define-extern new-dynamic-structure (function symbol type int structure)) ;; ---------------------- @@ -8464,7 +8471,7 @@ ;; - Symbols -(define-extern *generic-debug* generic-debug) ;; unknown type +(define-extern *generic-debug* generic-debug) ;; ---------------------- @@ -8637,10 +8644,10 @@ ;; - Symbols -(define-extern *shadow-queue* shadow-queue) ;; unknown type -(define-extern *shadow* symbol) ;; unknown type -(define-extern *shadow-object* symbol) ;; unknown type -(define-extern *shadow-debug* symbol) ;; unknown type +(define-extern *shadow-queue* shadow-queue) +(define-extern *shadow* symbol) +(define-extern *shadow-object* symbol) +(define-extern *shadow-debug* symbol) ;; ---------------------- @@ -8743,7 +8750,7 @@ ) (deftype level-buffer-state (structure) - ((name basic :offset-assert 0) + ((name symbol :offset-assert 0) (display? symbol :offset-assert 4) (force-vis? symbol :offset-assert 8) (force-inside? symbol :offset-assert 12) @@ -8772,29 +8779,29 @@ (want-display-level (_type_ symbol symbol) int 12) (want-vis (_type_ symbol) int 13) (want-force-vis (_type_ symbol symbol) int 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) + (dummy-15 (_type_ pair) none 15) + (dummy-16 (_type_ float) int 16) + (dummy-17 (_type_ pair) int 17) + (dummy-18 (_type_) int 18) + (dummy-19 (_type_) int 19) (dummy-20 () none 20) ) ) (deftype continue-point (basic) ((name string :offset-assert 4) - (level basic :offset-assert 8) + (level symbol :offset-assert 8) (flags uint32 :offset-assert 12) (trans vector :inline :offset-assert 16) (quat quaternion :inline :offset-assert 32) (camera-trans vector :inline :offset-assert 48) - (camera-rot float 9 :offset-assert 64) - (load-commands pair :offset-assert 100) - (vis-nick basic :offset-assert 104) - (lev0 basic :offset-assert 108) - (disp0 basic :offset-assert 112) - (lev1 basic :offset-assert 116) - (disp1 basic :offset-assert 120) + (camera-rot float 9 :offset-assert 64) + (load-commands pair :offset-assert 100) + (vis-nick symbol :offset-assert 104) + (lev0 symbol :offset-assert 108) + (disp0 symbol :offset-assert 112) + (lev1 symbol :offset-assert 116) + (disp1 symbol :offset-assert 120) ) :method-count-assert 10 :size-assert #x7c @@ -8861,7 +8868,7 @@ (initialize! (_type_ symbol game-save string) _type_ 9) (adjust (_type_ symbol float handle) float 10) (task-complete? (_type_ game-task) symbol 11) - (lookup-entity-perm-by-aid (_type_ uint) entity-perm 12) + (lookup-entity-perm-by-aid (_type_ actor-id) entity-perm 12) (get-entity-task-perm (_type_ game-task) entity-perm 13) (copy-perms-from-level! (_type_ level) none 14) (copy-perms-to-level! (_type_ level) none 15) @@ -8883,7 +8890,7 @@ ;; - Symbols -(define-extern *GAME-bank* game-bank) ;; unknown type +(define-extern *GAME-bank* game-bank) (define-extern *game-info* game-info) @@ -9269,7 +9276,7 @@ ;; - Symbols -(define-extern *merc-globals* symbol) ;; unknown type +(define-extern *merc-globals* symbol) ;; ---------------------- @@ -9282,7 +9289,7 @@ ;;;; engine (define-extern *background-draw-engine* engine) -(define-extern *matrix-engine* (array handle)) ;; unknown type +(define-extern *matrix-engine* (array handle)) (define-extern *camera-engine* engine) (define-extern *debug-engine* engine) @@ -9467,48 +9474,48 @@ ;; - Symbols -(define-extern *walk-mods* surface) ;; unknown type -(define-extern *walk-no-turn-mods* surface) ;; unknown type -(define-extern *turn-around-mods* surface) ;; unknown type -(define-extern *duck-mods* surface) ;; unknown type -(define-extern *duck-attack-mods* surface) ;; unknown type -(define-extern *jump-mods* surface) ;; unknown type -(define-extern *double-jump-mods* surface) ;; unknown type -(define-extern *smack-jump-mods* surface) ;; unknown type -(define-extern *high-jump-mods* surface) ;; unknown type -(define-extern *launch-jump-mods* surface) ;; unknown type -(define-extern *forward-high-jump-mods* surface) ;; unknown type -(define-extern *flip-jump-mods* surface) ;; unknown type -(define-extern *forward-jump-mods* surface) ;; unknown type -(define-extern *forward-pole-jump-mods* surface) ;; unknown type -(define-extern *attack-mods* surface) ;; unknown type -(define-extern *jump-attack-mods* surface) ;; unknown type -(define-extern *uppercut-jump-mods* surface) ;; unknown type -(define-extern *run-attack-mods* surface) ;; unknown type -(define-extern *wheel-mods* surface) ;; unknown type -(define-extern *wheel-flip-mods* surface) ;; unknown type -(define-extern *flop-mods* surface) ;; unknown type -(define-extern *flop-land-mods* surface) ;; unknown type -(define-extern *wade-mods* surface) ;; unknown type -(define-extern *swim-mods* surface) ;; unknown type -(define-extern *dive-mods* surface) ;; unknown type -(define-extern *dive-bottom-mods* surface) ;; unknown type -(define-extern *pole-mods* surface) ;; unknown type -(define-extern *grab-mods* surface) ;; unknown type -(define-extern *edge-grab-mods* surface) ;; unknown type -(define-extern *empty-mods* surface) ;; unknown type -(define-extern *neutral-mods* surface) ;; unknown type -(define-extern *stone-surface* surface) ;; unknown type -(define-extern *edge-surface* surface) ;; unknown type -(define-extern *wade-surface* surface) ;; unknown type -(define-extern *slope-surface* surface) ;; unknown type -(define-extern *quicksand-surface* surface) ;; unknown type -(define-extern *tar-surface* surface) ;; unknown type -(define-extern *grass-surface* surface) ;; unknown type -(define-extern *ice-surface* surface) ;; unknown type -(define-extern *tread-surface* surface) ;; unknown type -(define-extern *standard-ground-surface* surface) ;; unknown type -(define-extern *swim-surface* surface) ;; unknown type +(define-extern *walk-mods* surface) +(define-extern *walk-no-turn-mods* surface) +(define-extern *turn-around-mods* surface) +(define-extern *duck-mods* surface) +(define-extern *duck-attack-mods* surface) +(define-extern *jump-mods* surface) +(define-extern *double-jump-mods* surface) +(define-extern *smack-jump-mods* surface) +(define-extern *high-jump-mods* surface) +(define-extern *launch-jump-mods* surface) +(define-extern *forward-high-jump-mods* surface) +(define-extern *flip-jump-mods* surface) +(define-extern *forward-jump-mods* surface) +(define-extern *forward-pole-jump-mods* surface) +(define-extern *attack-mods* surface) +(define-extern *jump-attack-mods* surface) +(define-extern *uppercut-jump-mods* surface) +(define-extern *run-attack-mods* surface) +(define-extern *wheel-mods* surface) +(define-extern *wheel-flip-mods* surface) +(define-extern *flop-mods* surface) +(define-extern *flop-land-mods* surface) +(define-extern *wade-mods* surface) +(define-extern *swim-mods* surface) +(define-extern *dive-mods* surface) +(define-extern *dive-bottom-mods* surface) +(define-extern *pole-mods* surface) +(define-extern *grab-mods* surface) +(define-extern *edge-grab-mods* surface) +(define-extern *empty-mods* surface) +(define-extern *neutral-mods* surface) +(define-extern *stone-surface* surface) +(define-extern *edge-surface* surface) +(define-extern *wade-surface* surface) +(define-extern *slope-surface* surface) +(define-extern *quicksand-surface* surface) +(define-extern *tar-surface* surface) +(define-extern *grass-surface* surface) +(define-extern *ice-surface* surface) +(define-extern *tread-surface* surface) +(define-extern *standard-ground-surface* surface) +(define-extern *swim-surface* surface) ;; ---------------------- @@ -9554,7 +9561,7 @@ ;; - Symbols -(define-extern *pat-mode-info* (inline-array pat-mode-info)) ;; unknown type +(define-extern *pat-mode-info* (inline-array pat-mode-info)) ;; ---------------------- @@ -9658,7 +9665,7 @@ (declare-type process-drawable process) (define-extern process-drawable-art-error (state string process-drawable)) -(define-extern *FACT-bank* fact-bank) ;; unknown type +(define-extern *FACT-bank* fact-bank) ;; ---------------------- @@ -9669,7 +9676,6 @@ ;; - Types -(declare-type process-drawable process) (deftype align-control (basic) ((flags uint32 :offset-assert 4) (process process-drawable :offset-assert 8) @@ -9703,25 +9709,29 @@ ;; - Types -(declare-type collide-shape basic) -(declare-type water-control basic) +(declare-type nav-control basic) +(declare-type path-control basic) +(declare-type vol-control basic) +(declare-type actor-link-info basic) (declare-type sparticle-launch-control basic) +(declare-type water-control basic) +(declare-type collide-shape basic) (deftype process-drawable (process) ((root trsqv :offset-assert 112) (node-list cspace-array :offset-assert 116) (draw draw-control :offset-assert 120) (skel joint-control :offset-assert 124) - (nav basic :offset-assert 128) + (nav nav-control :offset-assert 128) (align align-control :offset-assert 132) - (path basic :offset-assert 136) - (vol basic :offset-assert 140) + (path path-control :offset-assert 136) + (vol vol-control :offset-assert 140) (fact fact-info :offset-assert 144) - (link basic :offset-assert 148) + (link actor-link-info :offset-assert 148) (part sparticle-launch-control :offset-assert 152) (water water-control :offset-assert 156) (sound ambient-sound :offset-assert 160) (state-flags uint32 :offset-assert 164) - (state-time uint64 :offset-assert 168) + (state-time seconds :offset-assert 168) ) :heap-base #x40 :method-count-assert 20 @@ -9846,9 +9856,9 @@ ((new-trans-hook function :offset-assert 176) (cur-trans-hook function :offset-assert 180) (cur-event-hook function :offset-assert 184) - (new-joint-anim basic :offset-assert 188) + (new-joint-anim art-joint-anim :offset-assert 188) (new-joint-anim-blend uint64 :offset-assert 192) - (anim-mode basic :offset-assert 200) + (anim-mode symbol :offset-assert 200) (cur-grab-handle uint64 :offset-assert 208) (cur-target-handle uint64 :offset-assert 216) (old-grab-pos vector :inline :offset-assert 224) @@ -10811,7 +10821,7 @@ (pat-ignore-mask pat-surface :offset-assert 148) (event-self basic :offset-assert 152) (event-other basic :offset-assert 156) - (root-prim basic :offset-assert 160) + (root-prim collide-shape-prim :offset-assert 160) (riders basic :offset-assert 164) (backup-collide-as uint64 :offset-assert 168) (backup-collide-with uint64 :offset-assert 176) @@ -11203,14 +11213,14 @@ (define-extern cspace-by-name (function process-drawable string cspace)) (define-extern cspace-by-name-no-fail (function process-drawable string cspace)) (define-extern cspace-index-by-name-no-fail (function process-drawable string int)) -(define-extern num-func-none (function joint-control-channel float)) -(define-extern num-func-+! (function joint-control-channel float float)) -(define-extern num-func--! (function joint-control-channel float float)) -(define-extern num-func-loop! (function joint-control-channel float float)) +(define-extern num-func-none (function joint-control-channel float float float)) +(define-extern num-func-+! (function joint-control-channel float float float)) +(define-extern num-func--! (function joint-control-channel float float float)) +(define-extern num-func-loop! (function joint-control-channel float float float)) (define-extern num-func-seek! (function joint-control-channel float float float)) -(define-extern num-func-blend-in! (function joint-control-channel float float)) -(define-extern num-func-chan (function joint-control-channel float float)) -(define-extern num-func-identity (function joint-control-channel float)) +(define-extern num-func-blend-in! (function joint-control-channel float float float)) +(define-extern num-func-chan (function joint-control-channel float float float)) +(define-extern num-func-identity (function joint-control-channel float float float)) ;; ---------------------- @@ -11432,7 +11442,7 @@ (deftype sidekick (process-drawable) ((control control-info :offset 112) (anim-seed uint64 :offset 192) - (shadow-in-movie? basic :offset-assert 200) + (shadow-in-movie? symbol :offset-assert 200) ) :heap-base #x60 :method-count-assert 20 @@ -12781,8 +12791,8 @@ (user-uint8 uint8 8 :offset 0) (status entity-perm-status :offset-assert 8) (dummy uint8 1 :offset-assert 10) - (task uint8 :offset-assert 11) - (aid uint32 :offset-assert 12) + (task game-task :offset-assert 11) + (aid actor-id :offset-assert 12) (quad uint128 :offset 0) ) :pack-me @@ -12804,8 +12814,8 @@ (trans vector :inline :offset-assert 32) (perm entity-perm :inline :offset-assert 48) (status uint16 :offset 56) ;; overlays - (aid uint32 :offset 60) - (task uint8 :offset 59) + (aid actor-id :offset 60) + (task game-task :offset 59) ) :method-count-assert 10 :size-assert #x40 @@ -13354,7 +13364,7 @@ :size-assert #x10 :flag-assert #x1a00000010 (:methods - (new (symbol type process) _type_) + (new (symbol type process) _type_ 0) (get-matching-actor-type-mask (_type_ type) int 9) (actor-count-before (_type_) int 10) (link (_type_) entity-actor 11) @@ -13365,12 +13375,12 @@ (apply-function-forward (_type_ (function entity-actor object object) object) int 16) (apply-function-reverse (_type_ (function entity-actor object object) object) int 17) (apply-all (_type_ (function entity-actor object object) object) int 18) - (send-to-all (_type_ object) none 19) - (send-to-all-after (_type_ object) object 20) - (send-to-all-before (_type_ object) object 21) - (send-to-next-and-prev (_type_ object) none 22) - (send-to-next (_type_ object) none 23) - (send-to-prev (_type_ object) none 24) + (send-to-all (_type_ symbol) none 19) + (send-to-all-after (_type_ symbol) object 20) + (send-to-all-before (_type_ symbol) object 21) + (send-to-next-and-prev (_type_ symbol) none 22) + (send-to-next (_type_ symbol) none 23) + (send-to-prev (_type_ symbol) none 24) (actor-count (_type_) int 25) ) ) @@ -14477,7 +14487,7 @@ (define-extern str-load (function string int pointer int symbol)) (define-extern str-load-status (function (pointer int32) symbol)) (define-extern str-load-cancel (function none)) -(define-extern str-play-async (function string pointer none)) +(define-extern str-play-async (function string sound-id none)) (define-extern str-play-stop (function string none)) (define-extern str-play-queue (function string none)) (define-extern str-ambient-play (function string none)) @@ -14564,19 +14574,19 @@ ;; - Types (deftype sound-iop-info (basic) - ((frame uint32 :offset 16) + ((frame uint32 :offset 16) (strpos int32 :offset-assert 20) - (str-id uint32 :offset-assert 24) - (str-id-sign int32 :offset 24) + (str-id sound-id :offset-assert 24) + (str-id-sign int32 :offset 24) (freemem uint32 :offset-assert 28) - (chinfo uint8 48 :offset-assert 32) + (chinfo uint8 48 :offset-assert 32) (freemem2 uint32 :offset-assert 80) (nocd uint32 :offset-assert 84) (dirtycd uint32 :offset-assert 88) - (diskspeed uint32 2 :offset-assert 92) + (diskspeed uint32 2 :offset-assert 92) (lastspeed uint32 :offset-assert 100) (dupseg int32 :offset-assert 104) - (times uint32 41 :offset-assert 108) + (times uint32 41 :offset-assert 108) (times-seq uint32 :offset-assert 272) ) :method-count-assert 9 @@ -14623,8 +14633,8 @@ (define-extern sound-command->string (function sound-command string)) (define-extern sound-name= (function sound-name sound-name symbol)) (define-extern str-is-playing? (function symbol)) -(define-extern current-str-id (function int)) -(define-extern current-str-pos (function int int)) +(define-extern current-str-id (function sound-id)) +(define-extern current-str-pos (function sound-id int)) (define-extern is-cd-in? (function symbol)) (define-extern check-irx-version (function int)) (define-extern sound-bank-load (function sound-name sound-id)) @@ -16067,7 +16077,7 @@ (define-extern sp-launch-particles-var function) (define-extern sp-get-particle function) (define-extern particle-adgif function) -(define-extern lookup-part-group-by-name function) +(define-extern lookup-part-group-by-name (function string basic)) (define-extern lookup-part-group-pointer-by-name function) (define-extern unlink-part-group-by-heap (function kheap int)) (define-extern particle-setup-adgif function) @@ -16169,13 +16179,14 @@ (define-extern ja-channel-push! (function int int int)) (define-extern ja-channel-set! (function int int)) (define-extern kill-current-level-hint (function pair pair symbol none)) -(define-extern level-hint-surpress! function) +(define-extern level-hint-surpress! (function none)) (define-extern ja-aframe-num (function int float)) -(define-extern ja-abort-spooled-anim function) -(define-extern art-group-load-check function) -(define-extern drawable-load function) -(define-extern art-load function) -(define-extern ja-play-spooled-anim function) +(define-extern ja-abort-spooled-anim (function spool-anim art-joint-anim int int :behavior process-drawable)) +(define-extern art-group-load-check (function string kheap int art-group)) +(define-extern drawable-load (function drawable kheap drawable)) +(define-extern art-load (function string kheap art)) +(define-extern ja-play-spooled-anim (function spool-anim art-joint-anim art-joint-anim (function process-drawable symbol) int :behavior process-drawable)) +(define-extern link (function pointer pointer int kheap int pointer)) ;; - Symbols @@ -16185,8 +16196,8 @@ ;; - Unknowns (define-extern *art-control* external-art-control) -;;(define-extern *preload-spool-anims* object) ;; unknown type -;;(define-extern *stack-top* object) ;; unknown type +(define-extern *preload-spool-anims* symbol) +(define-extern *stack-top* pointer) ;; ---------------------- @@ -16256,17 +16267,17 @@ :size-assert #x10 :flag-assert #xc00000010 (:methods - (dummy-9 () none 9) + (dummy-9 (_type_ vector int float process-drawable) none 9) (dummy-10 () none 10) (dummy-11 () none 11) ) ) (deftype process-taskable (process-drawable) - ((tasks basic :offset-assert 176) + ((tasks task-control :offset-assert 176) (query gui-query :inline :offset-assert 180) (old-target-pos transformq :inline :offset-assert 208) - (cell-for-task uint8 :offset-assert 256) + (cell-for-task game-task :offset-assert 256) (cell-x uint64 :offset-assert 264) (cam-joint-index int32 :offset-assert 272) (skippable basic :offset-assert 276) @@ -16293,41 +16304,40 @@ :method-count-assert 53 :size-assert #x17c :flag-assert #x350110017c - ;; inherited inspect of process-drawable (:methods - (dummy-20 () none 20) - (dummy-21 () none 21) - (dummy-22 () none 22) - (dummy-23 () none 23) - (dummy-24 () none 24) - (dummy-25 () none 25) - (dummy-26 () none 26) - (dummy-27 () none 27) - (dummy-28 () none 28) - (dummy-29 () none 29) - (dummy-30 () none 30) - (dummy-31 () none 31) - (dummy-32 () none 32) - (dummy-33 () none 33) - (dummy-34 () none 34) - (dummy-35 () none 35) - (dummy-36 () none 36) - (dummy-37 () none 37) - (dummy-38 () none 38) - (dummy-39 () none 39) - (dummy-40 () none 40) - (dummy-41 () none 41) - (dummy-42 () none 42) - (dummy-43 () none 43) - (dummy-44 () none 44) - (dummy-45 () none 45) - (dummy-46 () none 46) - (dummy-47 () none 47) - (dummy-48 () none 48) - (dummy-49 () none 49) - (dummy-50 () none 50) - (dummy-51 () none 51) - (dummy-52 () none 52) + (dummy-20 (_type_) none 20) + (dummy-21 (_type_) none 21) + (dummy-22 (_type_) none 22) + (dummy-23 (_type_) none 23) + (dummy-24 (_type_) none 24) + (dummy-25 (_type_) none 25) + (dummy-26 (_type_) none 26) + (dummy-27 (_type_) none 27) + (dummy-28 (_type_) none 28) + (dummy-29 (_type_) none 29) + (dummy-30 (_type_) none 30) + (dummy-31 (_type_) none 31) + (dummy-32 (_type_ symbol) spool-anim 32) + (dummy-33 (_type_) none 33) + (dummy-34 (_type_) none 34) + (dummy-35 (_type_) none 35) + (dummy-36 (_type_) none 36) + (dummy-37 (_type_) none 37) + (dummy-38 (_type_) none 38) + (dummy-39 (_type_) none 39) + (dummy-40 (_type_ object skeleton-group int int vector int) none 40) + (dummy-41 (_type_) none 41) + (dummy-42 (_type_) none 42) + (dummy-43 (_type_) none 43) + (dummy-44 (_type_) none 44) + (dummy-45 (_type_) none 45) + (dummy-46 (_type_) none 46) + (dummy-47 (_type_) none 47) + (dummy-48 (_type_) none 48) + (dummy-49 (_type_) none 49) + (dummy-50 (_type_) none 50) + (dummy-51 (_type_) none 51) + (dummy-52 (_type_) none 52) ) ) @@ -16992,10 +17002,10 @@ ;; - Functions (define-extern sky-set-sun-radii (function sky-parms int float float float symbol)) -(define-extern sky-set-sun-colors (function sky-parms int uint uint uint uint symbol)) -(define-extern sky-set-sun-colors-sun (function sky-parms int uint uint symbol)) -(define-extern sky-set-sun-colors-halo (function sky-parms int uint uint symbol)) -(define-extern sky-set-sun-colors-aurora (function sky-parms int uint uint symbol)) +(define-extern sky-set-sun-colors (function sky-parms int rgba rgba rgba rgba symbol)) +(define-extern sky-set-sun-colors-sun (function sky-parms int rgba rgba symbol)) +(define-extern sky-set-sun-colors-halo (function sky-parms int rgba rgba symbol)) +(define-extern sky-set-sun-colors-aurora (function sky-parms int rgba rgba symbol)) (define-extern sky-set-orbit (function sky-parms int float float float float float float symbol)) @@ -17170,14 +17180,14 @@ (define-extern load-state-want-levels (function symbol symbol int)) (define-extern load-state-want-display-level (function symbol symbol int)) (define-extern load-state-want-force-vis (function symbol symbol int)) -(define-extern command-get-param function) -(define-extern entity-birth-no-kill function) +(define-extern command-get-param (function object symbol symbol)) +(define-extern entity-birth-no-kill (function entity none)) (define-extern part-tracker-init function) -(define-extern command-list-get-process function) -(define-extern command-get-quoted-param function) -(define-extern command-get-int function) -(define-extern ambient-hint-spawn function) -(define-extern command-get-float function) +(define-extern command-list-get-process (function object process)) +(define-extern command-get-quoted-param (function object symbol symbol)) +(define-extern command-get-int (function object int int)) +(define-extern ambient-hint-spawn (function symbol symbol process-tree none)) +(define-extern command-get-float (function object float float)) (define-extern process-by-ename function) (define-extern point-in-polygon function) (define-extern try-corner function) @@ -18411,7 +18421,7 @@ ;; - Functions -(define-extern process-entity-status! (function process int symbol symbol)) +(define-extern process-entity-status! (function process entity-perm-status symbol int)) (define-extern process-grab? (function process symbol)) (define-extern process-release? (function process symbol)) (define-extern ja-post (function int)) @@ -18641,7 +18651,7 @@ (define-extern line-in-view-frustum? function) (define-extern process-drawable-random-point! function) -(define-extern process-drawable-from-entity! function) +(define-extern process-drawable-from-entity! (function process-drawable object none)) (define-extern cam-launcher-long-joystick function) (define-extern hide-hud-quick function) (define-extern command-get-process function) @@ -31658,63 +31668,24 @@ ;; - Types -; (deftype farmer (process-taskable) -; () -; :method-count-assert 53 -; :size-assert #x17c -; :flag-assert #x350110017c -; ;; not enough basic ops -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; (dummy-20 () none 20) -; (dummy-21 () none 21) -; (dummy-22 () none 22) -; (dummy-23 () none 23) -; (dummy-24 () none 24) -; (dummy-25 () none 25) -; (dummy-26 () none 26) -; (dummy-27 () none 27) -; (dummy-28 () none 28) -; (dummy-29 () none 29) -; (dummy-30 () none 30) -; (dummy-31 () none 31) -; (dummy-32 () none 32) -; (dummy-33 () none 33) -; (dummy-34 () none 34) -; (dummy-35 () none 35) -; (dummy-36 () none 36) -; (dummy-37 () none 37) -; (dummy-38 () none 38) -; (dummy-39 () none 39) -; (dummy-40 () none 40) -; (dummy-41 () none 41) -; (dummy-42 () none 42) -; (dummy-43 () none 43) -; (dummy-44 () none 44) -; (dummy-45 () none 45) -; (dummy-46 () none 46) -; (dummy-47 () none 47) -; (dummy-48 () none 48) -; (dummy-49 () none 49) -; (dummy-50 () none 50) -; (dummy-51 () none 51) -; (dummy-52 () none 52) -; ) -; ) +(deftype farmer (process-taskable) + () + :heap-base #x110 + :method-count-assert 53 + :size-assert #x17c + :flag-assert #x350110017c + (:methods + (dummy-method-11 (_type_ object) none 11) + (dummy-31 (_type_) none 31) + (dummy-32 (_type_ symbol) spool-anim 32) + (dummy-41 (_type_) none 41) + (dummy-43 (_type_) none 43) + ) + ) ;; - Unknowns -;;(define-extern *farmer-sg* object) ;; unknown type +(define-extern *farmer-sg* skeleton-group) ;; unknown type ;; ---------------------- @@ -31933,104 +31904,92 @@ ;; - Types -; (deftype yakow-bank (basic) -; ((walk-cycle-frame-count float :offset-assert 4) -; (run-cycle-frame-count float :offset-assert 8) -; (walk-speed meters :offset-assert 12) -; (run-speed meters :offset-assert 16) -; (walk-anim-speed float :offset-assert 20) -; (run-anim-speed float :offset-assert 24) -; (walk-away-dist meters :offset-assert 28) -; (run-away-dist meters :offset-assert 32) -; (walk-rotate-speed float :offset-assert 36) -; (run-rotate-speed float :offset-assert 40) -; (walk-turn-time uint64 :offset-assert 48) -; (run-turn-time uint64 :offset-assert 56) -; (max-walk-speed float :offset-assert 64) -; (min-run-speed float :offset-assert 68) -; (walk-run-blend-rate float :offset-assert 72) -; (walk-turn-blend-rate float :offset-assert 76) -; (max-run-speed float :offset-assert 80) -; (acceleration meters :offset-assert 84) -; (default-patrol-time uint64 :offset-assert 88) -; (default-idle-distance meters :offset-assert 96) -; (safe-distance meters :offset-assert 100) -; (min-run-anim-speed float :offset-assert 104) -; (max-run-anim-speed float :offset-assert 108) -; (min-walk-anim-speed float :offset-assert 112) -; (speed-boost-impulse meters :offset-assert 116) -; ) -; :method-count-assert 9 -; :size-assert #x78 -; :flag-assert #x900000078 -; ) +(deftype yakow-bank (basic) + ((walk-cycle-frame-count float :offset-assert 4) + (run-cycle-frame-count float :offset-assert 8) + (walk-speed meters :offset-assert 12) + (run-speed meters :offset-assert 16) + (walk-anim-speed float :offset-assert 20) + (run-anim-speed float :offset-assert 24) + (walk-away-dist meters :offset-assert 28) + (run-away-dist meters :offset-assert 32) + (walk-rotate-speed float :offset-assert 36) + (run-rotate-speed float :offset-assert 40) + (walk-turn-time uint64 :offset-assert 48) + (run-turn-time uint64 :offset-assert 56) + (max-walk-speed float :offset-assert 64) + (min-run-speed float :offset-assert 68) + (walk-run-blend-rate float :offset-assert 72) + (walk-turn-blend-rate float :offset-assert 76) + (max-run-speed float :offset-assert 80) + (acceleration meters :offset-assert 84) + (default-patrol-time uint64 :offset-assert 88) + (default-idle-distance meters :offset-assert 96) + (safe-distance meters :offset-assert 100) + (min-run-anim-speed float :offset-assert 104) + (max-run-anim-speed float :offset-assert 108) + (min-walk-anim-speed float :offset-assert 112) + (speed-boost-impulse meters :offset-assert 116) + ) + :method-count-assert 9 + :size-assert #x78 + :flag-assert #x900000078 + ) -; (deftype yakow (process-drawable) -; ((player-attack-id int32 :offset-assert 176) -; (walk-run-blend float :offset-assert 180) -; (walk-turn-blend float :offset-assert 184) -; (run-mode basic :offset-assert 188) -; (travel-speed meters :offset-assert 192) -; (final-speed meters :offset-assert 196) -; (rotate-speed float :offset-assert 200) -; (turn-time uint64 :offset-assert 208) -; (vulnerable basic :offset-assert 216) -; (grazing basic :offset-assert 220) -; (push-velocity vector :inline :offset-assert 224) -; (home-base vector :inline :offset-assert 240) -; (dest-base vector :inline :offset-assert 256) -; (dest-rot degrees :offset-assert 272) -; (enable-turn-around basic :offset-assert 276) -; (rotating basic :offset-assert 280) -; (in-pen basic :offset-assert 284) -; ) -; :method-count-assert 20 -; :size-assert #x120 -; :flag-assert #x1400b00120 -; ;; inherited inspect of process-drawable -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; ) -; ) +(deftype yakow (process-drawable) + ((player-attack-id int32 :offset-assert 176) + (walk-run-blend float :offset-assert 180) + (walk-turn-blend float :offset-assert 184) + (run-mode basic :offset-assert 188) + (travel-speed meters :offset-assert 192) + (final-speed meters :offset-assert 196) + (rotate-speed float :offset-assert 200) + (turn-time uint64 :offset-assert 208) + (vulnerable basic :offset-assert 216) + (grazing basic :offset-assert 220) + (push-velocity vector :inline :offset-assert 224) + (home-base vector :inline :offset-assert 240) + (dest-base vector :inline :offset-assert 256) + (dest-rot degrees :offset-assert 272) + (enable-turn-around basic :offset-assert 276) + (rotating basic :offset-assert 280) + (in-pen basic :offset-assert 284) + ) + :method-count-assert 20 + :size-assert #x120 + :heap-base #xb0 + :flag-assert #x1400b00120 + ;; inherited inspect of process-drawable + ) ;; - Functions -(define-extern yakow-task-complete? function) +(define-extern yakow-task-complete? (function symbol none :behavior yakow)) (define-extern yakow-facing-player? function) -(define-extern yakow-post function) +(define-extern yakow-post (function none :behavior yakow)) (define-extern yakow-facing-point? function) (define-extern yakow-facing-direction? function) (define-extern yakow-generate-travel-vector function) -(define-extern yakow-common-post function) -(define-extern yakow-cam function) -(define-extern yakow-default-event-handler function) +(define-extern yakow-common-post (function none :behavior yakow)) +(define-extern yakow-cam (function none)) +(define-extern yakow-default-event-handler (function process-drawable int symbol event-message-block object :behavior yakow)) (define-extern yakow-simple-post function) (define-extern yakow-run-post function) (define-extern yakow-blend-walk-run function) ;; - Unknowns -;;(define-extern *YAKOW-bank* object) ;; unknown type -;;(define-extern *yakow-sg* object) ;; unknown type -;;(define-extern yakow-graze object) ;; unknown type -;;(define-extern yakow-idle object) ;; unknown type -;;(define-extern yakow-run-away object) ;; unknown type -;;(define-extern yakow-graze-kicked object) ;; unknown type -;;(define-extern yakow-walk-to object) ;; unknown type -;;(define-extern yakow-notice object) ;; unknown type -;;(define-extern yakow-kicked object) ;; unknown type -;;(define-extern *village1cam-sg* object) ;; unknown type -;;(define-extern yakow-die object) ;; unknown type +(define-extern *YAKOW-bank* yakow-bank) ;; unknown type +(define-extern *yakow-sg* skeleton-group) ;; unknown type +(define-extern yakow-graze (state none)) ;; unknown type +(define-extern yakow-idle (state none)) ;; unknown type +(define-extern yakow-run-away state) ;; unknown type +(define-extern yakow-graze-kicked state) ;; unknown type +(define-extern yakow-walk-to state) ;; unknown type +(define-extern yakow-notice state) ;; unknown type +(define-extern yakow-kicked (state none)) ;; unknown type +(define-extern *village1cam-sg* skeleton-group) ;; unknown type +(define-extern yakow-die state) ;; unknown type ;; ---------------------- @@ -45436,16 +45395,16 @@ ;; - Types (deftype logo (process-drawable) - ((~Tcamera uint64 :offset-assert 176) - (~Tcamera-anim uint64 :offset-assert 184) - (~Tvolumes uint64 :offset-assert 192) - (~Tblack uint64 :offset-assert 200) - (~Ttarget uint64 :offset-assert 208) - (~Tsidekick uint64 :offset-assert 216) - (~Tmain-joint basic :offset-assert 224) - (~Tanim basic :offset-assert 228) - (~Tnext-anim basic :offset-assert 232) - (~Tdone? basic :offset-assert 236) + ((camera uint64 :offset-assert 176) + (camera-anim uint64 :offset-assert 184) + (volumes uint64 :offset-assert 192) + (black uint64 :offset-assert 200) + (target uint64 :offset-assert 208) + (sidekick uint64 :offset-assert 216) + (main-joint basic :offset-assert 224) + (anim basic :offset-assert 228) + (next-anim basic :offset-assert 232) + (done? basic :offset-assert 236) ) :heap-base #x80 :method-count-assert 24 @@ -45461,7 +45420,7 @@ ) (deftype logo-slave (process-drawable) - ((~Tmain-joint basic :offset-assert 176) + ((main-joint basic :offset-assert 176) ) :heap-base #x50 :method-count-assert 21 diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index f6af6c7fe7..bdc8bb7a2c 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -241,9 +241,6 @@ "sp-process-block-2d", "sp-get-particle", - // loader BUG - "(method 10 external-art-buffer)", - // game-info BUG "(method 11 fact-info-target)", @@ -469,7 +466,9 @@ "debug-menu-send-msg", "debug-menu-find-from-template", "build-continue-menu", - "(method 8 process-tree)" + "(method 8 process-tree)", + "(method 16 load-state)", + "(method 15 load-state)" ], // If format is used with the wrong number of arguments, @@ -495,7 +494,8 @@ " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%": 2, " textures ~192H~5DK ~280Htextures~456H~5DK~%": 2, " entity ~192H~5DK~%": 2, - " misc ~192H~5DK ~280Hsprite~456H~5DK~%": 2 + " misc ~192H~5DK ~280Hsprite~456H~5DK~%": 2, + "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~": 3 }, "blocks_ending_in_asm_branch": { diff --git a/decompiler/config/jak1_ntsc_black_label/inputs.jsonc b/decompiler/config/jak1_ntsc_black_label/inputs.jsonc index 40138334a2..43d16a7230 100644 --- a/decompiler/config/jak1_ntsc_black_label/inputs.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/inputs.jsonc @@ -259,15 +259,10 @@ ], // uncomment the next line to extract audio to wave files. - //"audio_dir_file_name": "VAG/VAGDIR.AYB", - "audio_dir_file_name" : "", + //"audio_dir_file_name": "jak1/VAG", + "audio_dir_file_name": "", "streamed_audio_file_names": [ - "VAG/VAGWAD.ENG", - "VAG/VAGWAD.FRE", - "VAG/VAGWAD.GER", - "VAG/VAGWAD.ITA", - "VAG/VAGWAD.JAP", - "VAG/VAGWAD.SPA" + "VAGWAD.ENG" ] } diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index d8c69f6f60..86751a127d 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -609,7 +609,11 @@ ["L255", "float", true] ], - "load-boundary": [["L327", "(inline-array lbvtx)", true, 3]], + "load-boundary": [ + ["L327", "(inline-array lbvtx)", true, 3], + ["L336", "float", true], + ["L337", "float", true] + ], "shrub-work": [["L3", "instance-shrub-work", true]], @@ -1197,6 +1201,35 @@ ["L78", "rgba", true], ["L79", "rgba", true] ], + + "loader": [ + ["L279", "float", true], + ["L283", "float", true], + ["L285", "float", true], + ["L286", "float", true], + ["L280", "float", true], + ["L281", "float", true], + ["L278", "float", true] + ], + + "yakow": [ + ["L150", "float", true], + ["L162", "float", true], + ["L160", "float", true], + ["L155", "float", true], + ["L163", "float", true], + ["L159", "float", true], + ["L154", "float", true], + ["L153", "float", true], + ["L169", "float", true], + ["L161", "float", true], + ["L152", "float", true], + ["L149", "float", true] + ], + + "farmer": [ + ["L50", "float", true] + ], // please do not add things after this entry! git is dumb. "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 603f0d8293..5be358041a 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -543,5 +543,23 @@ "(method 10 align-control)": [[16, "vector"]], + "(method 15 load-state)": [ + [16, "event-message-block"], + [96, "event-message-block"] + ], + + "(method 43 farmer)": [ + [16, "vector"] + ], + + "yakow-post": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [96, "vector"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 072577c196..b89c08c8fa 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -1082,6 +1082,71 @@ [196, "s4", "pointer"], [[203, 210], "s4", "game-save-tag"] ], + + "drawable-load": [ + [17, "s5", "drawable"], + [18, "s5", "drawable"], + [20, "s5", "drawable"], + [25, "s5", "drawable"], + [27, "s5", "drawable"] + ], + "art-load": [ + [9, "s5", "art"], + [13, "s5", "art"], + [15, "s5", "art"] + ], + "art-group-load-check": [ + [22, "s3", "art-group"], + [31, "s3", "art-group"], + [43, "s3", "art-group"], + [50, "s3", "art-group"], + [52, "s3", "art-group"] + ], + "(method 13 art-group)": [[16, "s3", "art-joint-anim"]], + "(method 14 art-group)": [[16, "s3", "art-joint-anim"]], + + "(method 9 external-art-control)": [ + [171, "s4", "external-art-buffer"], + [172, "s4", "external-art-buffer"], + [173, "s4", "external-art-buffer"], + [177, "s4", "external-art-buffer"], + [183, "s4", "external-art-buffer"], + [190, "s4", "external-art-buffer"], + + [233, "s4", "spool-anim"], + [240, "s4", "spool-anim"], + [243, "s4", "spool-anim"], + [248, "s4", "spool-anim"], + [249, "s4", "spool-anim"], + [253, "s4", "spool-anim"], + [257, "s4", "spool-anim"] + ], + + "(method 10 external-art-control)": [ + [18, "v1", "spool-anim"] + ], + + "(method 16 external-art-control)": [ + [37, "a0", "process"], + [17, "s5", "process-drawable"] + ], + + "ja-play-spooled-anim": [ + [154, "a0", "process"], + [286, "s2", "art-joint-anim"], + [294, "s2", "art-joint-anim"], + [295, "s2", "art-joint-anim"], + [306, "s2", "art-joint-anim"], + [320, "s2", "art-joint-anim"], + [324, "s2", "art-joint-anim"] + ], + + "(method 11 external-art-control)": [ + [127, "a0", "process"], + [151, "a0", "process"], + [168, "a0", "process"], + [18, "s5", "process-drawable"] + ], "debug-menu-item-var-update-display-str": [ [[44, 49], "v1", "int"], @@ -1179,6 +1244,28 @@ "blackout": [[[20, 24], "v1", "dma-packet"]], "(method 10 external-art-control)": [[18, "v1", "pointer"]], + + "(method 15 load-state)": [ + [31, "t9", "(function int)"], + [291, "s5", "entity-actor"], + [370, "s3", "process-drawable"] + ], + + "yakow-default-event-handler": [ + [27, "a0", "collide-shape"], + [32, "a0", "collide-shape"] + ], + + "(method 11 yakow)": [ + [184, "v1", "vector"], + [186, "v1", "vector"], + [189, "v1", "vector"] + ], + + "yakow-post": [ + [114, "a0", "collide-shape-moving"], + [130, "a0", "collide-shape-moving"] + ], "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 2eb7e03098..d6dfbe6966 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -2392,6 +2392,24 @@ } }, + "(method 13 art-group)": { + "vars":{ + "s3-0":"art-elt", + "s4-0":"janim", + "v1-9":"janim-group", + "s2-0":"success" + } + }, + + "(method 14 art-group)": { + "vars":{ + "s3-0":"art-elt", + "s4-0":"janim", + "v1-9":"janim-group", + "s3-1":"success" + } + }, + "(method 16 process-drawable)" : { "vars": { "s3-0":"body-T-world", @@ -2411,5 +2429,15 @@ "f0-6":"abs-vel-limit", "f0-10":"dpos" } - } + }, + + "ja-play-spooled-anim" : { + "vars": { + "sv-16":"spool-part", + "sv-28":"old-skel-status", + "sv-64":"spool-sound" + } + }, + + "aaaaaaaaaaaaaaaaaaaaaaa" : {} } diff --git a/decompiler/data/streamed_audio.cpp b/decompiler/data/streamed_audio.cpp index 8636b6e3de..21375891c1 100644 --- a/decompiler/data/streamed_audio.cpp +++ b/decompiler/data/streamed_audio.cpp @@ -181,9 +181,10 @@ AudioFileInfo process_audio_file(const std::vector& data, } void process_streamed_audio(const std::string& dir, const std::vector& audio_files) { - lg::info("Streaming audio: {}\n", dir); + auto dir_file_name = file_util::combine_path(dir, "VAGDIR.AYB"); + lg::info("Streaming audio: {}\n", dir_file_name); file_util::create_dir_if_needed(file_util::get_file_path({"assets", "streaming_audio"})); - auto dir_data = read_audio_dir(file_util::get_file_path({"iso_data", dir})); + auto dir_data = read_audio_dir(file_util::get_file_path({"iso_data", dir_file_name})); double audio_len = 0.f; std::vector langs; @@ -198,7 +199,7 @@ void process_streamed_audio(const std::string& dir, const std::vector obj length)) + (let ((v1-2 (-> obj data s3-0))) + (+! s5-0 (-> v1-2 used)) + (+! s4-0 (-> v1-2 total)) + (format #t "~3D: ~20S ~7D ~8D ~8D~%" s3-0 (-> v1-2 name) (-> v1-2 count) (-> v1-2 used) (-> v1-2 total)) + ) + ) + (format #t "total: ~8D ~8D~%" s5-0 s4-0) + ) + (format #t "-------------------------------------------------------------~%") + obj + ) + +(defmethod mem-usage object ((obj object) (arg0 memory-usage-block) (arg1 int)) + (if obj + (format #t "WARNING: mem-usage called on object, probably not what was wanted for ~A~%" obj) + ) + obj + ) + +(defmethod calculate-total memory-usage-block ((obj memory-usage-block)) + (let ((v0-0 0)) + (dotimes (v1-0 (-> obj length)) + (+! v0-0 (-> obj data v1-0 total)) + ) + v0-0 + ) + ) + +(defmethod reset! memory-usage-block ((obj memory-usage-block)) + (set! (-> obj length) 0) + (dotimes (v1-0 109) + (set! (-> obj data v1-0 used) 0) + (set! (-> obj data v1-0 total) 0) + (set! (-> obj data v1-0 count) 0) + ) + obj + ) + +(defun mem-size ((arg0 basic) (arg1 symbol) (arg2 int)) + (let ((gp-0 (new 'stack 'memory-usage-block))) + (mem-usage arg0 gp-0 arg2) + (if arg1 + (inspect gp-0) + ) + (calculate-total gp-0) + ) + ) + + +) + + diff --git a/goal_src/engine/draw/process-drawable-h.gc b/goal_src/engine/draw/process-drawable-h.gc index e0e173084f..b712fb26a3 100644 --- a/goal_src/engine/draw/process-drawable-h.gc +++ b/goal_src/engine/draw/process-drawable-h.gc @@ -42,12 +42,12 @@ ;; The following functions can be applied to a joint-control-channel to change the frame number. ;; They return the resulting frame number as well. -(defun num-func-none ((arg0 joint-control-channel)) +(defun num-func-none ((arg0 joint-control-channel) (arg2 float) (arg2 float)) "Don't change anything." (-> arg0 frame-num) ) -(defun num-func-+! ((arg0 joint-control-channel) (arg1 float)) +(defun num-func-+! ((arg0 joint-control-channel) (arg1 float) (arg2 float)) "Increment the frame number, taking into account the animation speed and current game rate." (let ((f0-1 (+ (-> arg0 frame-num) @@ -60,7 +60,7 @@ ) ) -(defun num-func--! ((arg0 joint-control-channel) (arg1 float)) +(defun num-func--! ((arg0 joint-control-channel) (arg1 float) (arg2 float)) "Decrement the frame number, taking into account the animation speed and current game rate." (let ((f0-1 (- (-> arg0 frame-num) @@ -73,7 +73,7 @@ ) ) -(defun num-func-loop! ((chan joint-control-channel) (inc float)) +(defun num-func-loop! ((chan joint-control-channel) (inc float) (arg2 float)) "Like num-func-+!, but will wrap to 0 after going past the end." ;; get the duration from the joint-animation-compressed. @@ -107,7 +107,7 @@ ) ) -(defun num-func-blend-in! ((arg0 joint-control-channel) (arg1 float)) +(defun num-func-blend-in! ((arg0 joint-control-channel) (arg1 float) (arg2 float)) "Seek frame-interp toward 1. Once its there, do a joint-control-reset." (let* ((v0-0 (seek (-> arg0 frame-interp) 1.0 (* arg1 (-> *display* time-adjust-ratio)))) (f30-0 (the-as float v0-0)) @@ -121,7 +121,7 @@ ) ) -(defun num-func-chan ((arg0 joint-control-channel) (arg1 float)) +(defun num-func-chan ((arg0 joint-control-channel) (arg1 float) (arg2 float)) "Copies the frame number from the channel arg1." ;; this is a super hack. ;; we know that we're in an inline-array of joint-control-channels @@ -143,7 +143,7 @@ ) ) -(defun num-func-identity ((arg0 joint-control-channel)) +(defun num-func-identity ((arg0 joint-control-channel) (arg1 float) (arg2 float)) "seems to be the same thing as none." (-> arg0 frame-num) ) diff --git a/goal_src/engine/entity/actor-link-h.gc b/goal_src/engine/entity/actor-link-h.gc index 3f236442d2..de4d5f3888 100644 --- a/goal_src/engine/entity/actor-link-h.gc +++ b/goal_src/engine/entity/actor-link-h.gc @@ -89,25 +89,25 @@ :size-assert #x10 :flag-assert #x1a00000010 (:methods - (new (symbol type process) _type_ 0) - (get-matching-actor-type-mask (_type_ type) int 9) - (actor-count-before (_type_) int 10) - (link (_type_) entity-actor 11) - (get-next (_type_) entity-actor 12) - (get-prev (_type_) entity-actor 13) - (get-next-process (_type_) process 14) - (get-prev-process (_type_) process 15) - (apply-function-forward (_type_ (function entity-actor object object) object) int 16) - (apply-function-reverse (_type_ (function entity-actor object object) object) int 17) - (apply-all (_type_ (function entity-actor object object) object) int 18) - (send-to-all (_type_ object) none 19) - (send-to-all-after (_type_ object) object 20) - (send-to-all-before (_type_ object) object 21) - (send-to-next-and-prev (_type_ object) none 22) - (send-to-next (_type_ object) none 23) - (send-to-prev (_type_ object) none 24) - (actor-count (_type_) int 25) - ) + (new (symbol type process) _type_ 0) + (get-matching-actor-type-mask (_type_ type) int 9) + (actor-count-before (_type_) int 10) + (link (_type_) entity-actor 11) + (get-next (_type_) entity-actor 12) + (get-prev (_type_) entity-actor 13) + (get-next-process (_type_) process 14) + (get-prev-process (_type_) process 15) + (apply-function-forward (_type_ (function entity-actor object object) object) int 16) + (apply-function-reverse (_type_ (function entity-actor object object) object) int 17) + (apply-all (_type_ (function entity-actor object object) object) int 18) + (send-to-all (_type_ symbol) none 19) + (send-to-all-after (_type_ symbol) object 20) + (send-to-all-before (_type_ symbol) object 21) + (send-to-next-and-prev (_type_ symbol) none 22) + (send-to-next (_type_ symbol) none 23) + (send-to-prev (_type_ symbol) none 24) + (actor-count (_type_) int 25) + ) ) ;;;;;;;;;;;;;;;; @@ -244,76 +244,51 @@ 0 ) -;; method 20 -(defmethod send-to-all-after actor-link-info ((obj actor-link-info) (message object)) - (with-pp - (let ((iter (-> obj next)) - (result (the object #f))) - (while iter - (let ((proc (-> (the entity-links (-> iter extra)) process))) - (when proc - (let ((msg-block (new 'stack-no-clear 'event-message-block))) - (set! (-> msg-block from) pp) - (set! (-> msg-block num-params) 0) - (set! (-> msg-block message) (the basic message)) +(defmethod send-to-all-after actor-link-info ((obj actor-link-info) (message symbol)) + "Send an event to all processes after this link with no parameters." - (let ((send-result (send-event-function (the process proc) msg-block))) - (set! result (and result send-result)) - ) - ) - ) - (set! iter (entity-actor-lookup iter 'next-actor 0)) + (let ((iter (-> obj next)) + (result (the object #f))) + (while iter + (let ((proc (-> (the entity-links (-> iter extra)) process))) + (when proc + (set! result (and result (send-event proc message))) ) + (set! iter (entity-actor-lookup iter 'next-actor 0)) ) - result ) + result ) ) -(defmethod send-to-all-before actor-link-info ((obj actor-link-info) (message object)) - (with-pp - (let ((iter (-> obj prev)) - (result (the object #f))) - (while iter - (let ((proc (-> (the entity-links (-> iter extra)) process))) - (when proc - (let ((msg-block (new 'stack-no-clear 'event-message-block))) - (set! (-> msg-block from) pp) - (set! (-> msg-block num-params) 0) - (set! (-> msg-block message) (the basic message)) +(defmethod send-to-all-before actor-link-info ((obj actor-link-info) (message symbol)) + "Send an event to all processes before this link with no parameters." - (let ((send-result (send-event-function (the process proc) msg-block))) - (set! result (and result send-result)) - ) - ) - ) - (set! iter (entity-actor-lookup iter 'prev-actor 0)) + (let ((iter (-> obj prev)) + (result (the object #f))) + (while iter + (let ((proc (-> (the entity-links (-> iter extra)) process))) + (when proc + (set! result (and result (send-event proc message))) ) + (set! iter (entity-actor-lookup iter 'prev-actor 0)) ) - result ) + result ) ) -(defmethod send-to-next actor-link-info ((obj actor-link-info) (arg0 object)) +(defmethod send-to-next actor-link-info ((obj actor-link-info) (message symbol)) "Send event arg0 to the next actor's process" - (with-pp - (let ((a0-1 (-> obj next))) - ;; do we have a next? - (when a0-1 - ;; get the actual process - (let ((a0-2 (-> (the-as entity-links (-> a0-1 extra)) process))) - ;; do we have a process? - (when a0-2 - ;; create a block on the stack - (let ((v1-4 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-4 from) pp) - (set! (-> v1-4 num-params) 0) - (set! (-> v1-4 message) (the-as basic arg0)) - ;; and send it! - (send-event-function (the process a0-2) v1-4) - ) - ) + + (let ((a0-1 (-> obj next))) + ;; do we have a next? + (when a0-1 + ;; get the actual process + (let ((a0-2 (-> (the-as entity-links (-> a0-1 extra)) process))) + ;; do we have a process? + (when a0-2 + (send-event a0-2 message) ) ) ) @@ -321,20 +296,14 @@ (none) ) -(defmethod send-to-prev actor-link-info ((obj actor-link-info) (arg0 object)) +(defmethod send-to-prev actor-link-info ((obj actor-link-info) (message symbol)) "Send event arg1 to the next actor's process." - (with-pp - (let ((a0-1 (-> obj prev))) - (when a0-1 - (let ((a0-2 (-> (the-as entity-links (-> a0-1 extra)) process))) - (when a0-2 - (let ((v1-4 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-4 from) pp) - (set! (-> v1-4 num-params) 0) - (set! (-> v1-4 message) (the-as basic arg0)) - (send-event-function (the process a0-2) v1-4) - ) - ) + + (let ((a0-1 (-> obj prev))) + (when a0-1 + (let ((a0-2 (-> (the-as entity-links (-> a0-1 extra)) process))) + (when a0-2 + (send-event a0-2 message) ) ) ) @@ -342,16 +311,17 @@ (none) ) -(defmethod send-to-next-and-prev actor-link-info ((obj actor-link-info) (arg0 object)) - "Send event arg0 to both next and prev." - (send-to-next obj arg0) - (send-to-prev obj arg0) +(defmethod send-to-next-and-prev actor-link-info ((obj actor-link-info) (msg symbol)) + "Send an event to both next and prev with no params." + + (send-to-next obj msg) + (send-to-prev obj msg) (none) ) -(defmethod send-to-all actor-link-info ((obj actor-link-info) (arg0 object)) - (send-to-all-after obj arg0) - (send-to-all-before obj arg0) +(defmethod send-to-all actor-link-info ((obj actor-link-info) (msg symbol)) + (send-to-all-after obj msg) + (send-to-all-before obj msg) (none) ) @@ -432,13 +402,9 @@ ) (defun actor-link-subtask-complete-hook ((arg0 entity-actor) (arg1 (pointer symbol))) - "Sets arg1 if the thing is complete. Returns the opposite value." + "Sets arg1 if the thing is complete. Does not continue the apply if the complete perm is set." (cond - ((nonzero? (logand - (-> (the-as entity-links (-> arg0 extra)) perm status) - (entity-perm-status complete) - ) - ) + ((logtest? (-> (the-as entity-links (-> arg0 extra)) perm status) (entity-perm-status complete)) (set! (-> arg1 0) #t) #f ) @@ -450,13 +416,9 @@ ) (defun actor-link-dead-hook ((arg0 entity-actor) (arg1 (pointer symbol))) - "Sets arg1 is the thing is dead. Returns the opposite value." + "Sets arg1 is the thing is dead. Does not continue the apply if the dead perm is set." (cond - ((nonzero? (logand - (-> (the-as entity-links (-> arg0 extra)) perm status) - (entity-perm-status dead) - ) - ) + ((logtest? (-> (the-as entity-links (-> arg0 extra)) perm status) (entity-perm-status dead)) (set! (-> arg1 0) #t) #f ) diff --git a/goal_src/engine/entity/entity-h.gc b/goal_src/engine/entity/entity-h.gc index 17d6d84a3f..a6c4e2cfe8 100644 --- a/goal_src/engine/entity/entity-h.gc +++ b/goal_src/engine/entity/entity-h.gc @@ -5,13 +5,8 @@ ;; name in dgo: entity-h ;; dgos: GAME, ENGINE -;; definition for symbol *generate-actor-vis*, type symbol (define *generate-actor-vis* #f) - -;; definition for symbol *generate-actor-vis-start*, type symbol (define *generate-actor-vis-start* #f) - -;; definition for symbol *generate-actor-vis-output*, type symbol (define *generate-actor-vis-output* #f) (defenum entity-perm-status @@ -31,43 +26,42 @@ ;; definition of type entity-perm (deftype entity-perm (structure) - ((user-object object 2 :offset-assert 0) - (user-uint64 uint64 :offset 0) - (user-float float 2 :offset 0) - (user-int32 int32 2 :offset 0) - (user-uint32 uint32 2 :offset 0) - (user-int16 int16 4 :offset 0) - (user-uint16 uint16 4 :offset 0) - (user-int8 int8 8 :offset 0) - (user-uint8 uint8 8 :offset 0) - (status entity-perm-status :offset-assert 8) - (dummy uint8 1 :offset-assert 10) - (task uint8 :offset-assert 11) - (aid uint32 :offset-assert 12) - (quad uint128 :offset 0) + ((user-object object 2 :offset-assert 0) + (user-uint64 uint64 :offset 0) + (user-float float 2 :offset 0) + (user-int32 int32 2 :offset 0) + (user-uint32 uint32 2 :offset 0) + (user-int16 int16 4 :offset 0) + (user-uint16 uint16 4 :offset 0) + (user-int8 int8 8 :offset 0) + (user-uint8 uint8 8 :offset 0) + (status entity-perm-status :offset-assert 8) + (dummy uint8 1 :offset-assert 10) + (task game-task :offset-assert 11) + (aid actor-id :offset-assert 12) + (quad uint128 :offset 0) ) :pack-me :method-count-assert 10 :size-assert #x10 :flag-assert #xa00000010 (:methods - (update-perm! (_type_ symbol entity-perm-status) _type_ 9) - ) + (update-perm! (_type_ symbol entity-perm-status) _type_ 9) + ) ) -;; definition of type entity-links (deftype entity-links (structure) - ((prev-link entity-links :offset-assert 0) - (next-link entity-links :offset-assert 4) - (entity entity :offset-assert 8) - (process process :offset-assert 12) - (level level :offset-assert 16) - (vis-id int32 :offset-assert 20) - (trans vector :inline :offset-assert 32) - (perm entity-perm :inline :offset-assert 48) - (status uint16 :offset 56) - (aid uint32 :offset 60) - (task uint8 :offset 59) + ((prev-link entity-links :offset-assert 0) + (next-link entity-links :offset-assert 4) + (entity entity :offset-assert 8) + (process process :offset-assert 12) + (level level :offset-assert 16) + (vis-id int32 :offset-assert 20) + (trans vector :inline :offset-assert 32) + (perm entity-perm :inline :offset-assert 48) + (status uint16 :offset 56) + (aid actor-id :offset 60) + (task game-task :offset 59) ) :method-count-assert 10 :size-assert #x40 @@ -77,17 +71,15 @@ ) ) -;; definition of type entity-perm-array (deftype entity-perm-array (inline-array-class) - ((data entity-perm :inline :dynamic :offset-assert 16)) + ((data entity-perm :inline :dynamic :offset-assert 16) + ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) - (set! (-> entity-perm-array heap-base) (the-as uint 16)) -;; definition of type entity-links-array (deftype entity-links-array (inline-array-class) ((data entity-links :inline :dynamic :offset-assert 16) ) @@ -95,13 +87,11 @@ :size-assert #x10 :flag-assert #x900000010 ) - (set! (-> entity-links-array heap-base) (the-as uint 64)) -;; definition of type entity (deftype entity (res-lump) - ((trans vector :inline :offset-assert 32) - (aid uint32 :offset-assert 48) + ((trans vector :inline :offset-assert 32) + (aid uint32 :offset-assert 48) ) :method-count-assert 27 :size-assert #x34 @@ -115,45 +105,40 @@ ) ) -;; definition of type entity-camera (deftype entity-camera (entity) - ((connect connectable :inline :offset-assert 64) + ((connect connectable :inline :offset-assert 64) ) :method-count-assert 27 :size-assert #x50 :flag-assert #x1b00000050 ) -;; definition of type entity-ambient-data (deftype entity-ambient-data (structure) - ((user-object object 3 :offset-assert 0) - (function basic :offset-assert 12) - (quad uint128 :offset 0) - (user-uint64 uint64 1 :offset 0) - (user-float float 3 :offset 0) - (user-int32 int32 3 :offset 0) - (user-uint32 uint32 3 :offset 0) - (user-int16 int16 6 :offset 0) - (user-uint16 uint16 6 :offset 0) - (user-int8 int8 12 :offset 0) - (user-uint8 uint8 12 :offset 0) + ((user-object object 3 :offset-assert 0) + (function basic :offset-assert 12) + (quad uint128 :offset 0) + (user-uint64 uint64 1 :offset 0) + (user-float float 3 :offset 0) + (user-int32 int32 3 :offset 0) + (user-uint32 uint32 3 :offset 0) + (user-int16 int16 6 :offset 0) + (user-uint16 uint16 6 :offset 0) + (user-int8 int8 12 :offset 0) + (user-uint8 uint8 12 :offset 0) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -;; definition of type entity-ambient-data-array (deftype entity-ambient-data-array (inline-array-class) () :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) - (set! (-> entity-ambient-data-array heap-base) (the-as uint 16)) -;; definition of type entity-ambient (deftype entity-ambient (entity) () :method-count-assert 29 @@ -165,33 +150,30 @@ ) ) -;; definition of type entity-actor -(declare-type nav-mesh basic) (deftype entity-actor (entity) - ((nav-mesh nav-mesh :offset-assert 52) - (etype type :offset-assert 56) - (task uint8 :offset-assert 60) - (vis-id uint16 :offset-assert 62) - (quat quaternion :inline :offset-assert 64) + ((nav-mesh nav-mesh :offset-assert 52) + (etype type :offset-assert 56) + (task uint8 :offset-assert 60) + (vis-id uint16 :offset-assert 62) + (quat quaternion :inline :offset-assert 64) ) :method-count-assert 31 :size-assert #x50 :flag-assert #x1f00000050 (:methods - (next-actor (_type_) entity-actor 27) - (prev-actor (_type_) entity-actor 28) - (dummy-29 () none 29) - (dummy-30 () none 30) - ) + (next-actor (_type_) entity-actor 27) + (prev-actor (_type_) entity-actor 28) + (dummy-29 () none 29) + (dummy-30 () none 30) + ) ) -;; definition of type entity-info (deftype entity-info (basic) - ((ptype type :offset-assert 4) - (package basic :offset-assert 8) - (art-group pair :offset-assert 12) - (pool basic :offset-assert 16) - (heap-size int32 :offset-assert 20) + ((ptype type :offset-assert 4) + (package basic :offset-assert 8) + (art-group pair :offset-assert 12) + (pool basic :offset-assert 16) + (heap-size int32 :offset-assert 20) ) :method-count-assert 9 :size-assert #x18 @@ -205,23 +187,21 @@ (set! entity-nav-login (the-as (function entity-actor none) nothing)) ) -;; definition of type actor-bank (deftype actor-bank (basic) - ((pause-dist float :offset-assert 4) - (birth-dist float :offset-assert 8) - (birth-max int32 :offset-assert 12) + ((pause-dist float :offset-assert 4) + (birth-dist float :offset-assert 8) + (birth-max int32 :offset-assert 12) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -;; definition for symbol *ACTOR-bank*, type actor-bank (define *ACTOR-bank* (new 'static 'actor-bank - :pause-dist 204800.0 - :birth-dist 901120.0 - :birth-max 10 + :pause-dist (meters 50) ;; actor activity range? + :birth-dist (meters 220) ;; draw distance or something? + :birth-max 10 ;; maximum actor births per frame? (it is known they dont all happen at once) ) ) diff --git a/goal_src/engine/game/game-h.gc b/goal_src/engine/game/game-h.gc index a59d48eb93..f53b765932 100644 --- a/goal_src/engine/game/game-h.gc +++ b/goal_src/engine/game/game-h.gc @@ -6,25 +6,29 @@ ;; dgos: GAME, ENGINE -(declare-type collide-shape basic) -(declare-type water-control basic) +(declare-type nav-control basic) +(declare-type path-control basic) +(declare-type vol-control basic) +(declare-type actor-link-info basic) (declare-type sparticle-launch-control basic) +(declare-type water-control basic) +(declare-type collide-shape basic) (deftype process-drawable (process) ((root trsqv :offset-assert 112) (node-list cspace-array :offset-assert 116) (draw draw-control :offset-assert 120) (skel joint-control :offset-assert 124) - (nav basic :offset-assert 128) + (nav nav-control :offset-assert 128) (align align-control :offset-assert 132) - (path basic :offset-assert 136) - (vol basic :offset-assert 140) + (path path-control :offset-assert 136) + (vol vol-control :offset-assert 140) (fact fact-info :offset-assert 144) - (link basic :offset-assert 148) + (link actor-link-info :offset-assert 148) (part sparticle-launch-control :offset-assert 152) (water water-control :offset-assert 156) (sound ambient-sound :offset-assert 160) (state-flags uint32 :offset-assert 164) - (state-time uint64 :offset-assert 168) + (state-time seconds :offset-assert 168) ) :heap-base #x40 :method-count-assert 20 @@ -144,4 +148,4 @@ ) -(declare-type target basic) \ No newline at end of file +(declare-type target process-drawable) \ No newline at end of file diff --git a/goal_src/engine/game/game-info-h.gc b/goal_src/engine/game/game-info-h.gc index 8ac3204405..9d29a57721 100644 --- a/goal_src/engine/game/game-info-h.gc +++ b/goal_src/engine/game/game-info-h.gc @@ -158,7 +158,7 @@ ;; the possible state for a level. (deftype level-buffer-state (structure) - ((name basic :offset-assert 0) ;; level name + ((name symbol :offset-assert 0) ;; level name (display? symbol :offset-assert 4) ;; should it be drawn? (force-vis? symbol :offset-assert 8) ;; ? should it have its vis loaded? (force-inside? symbol :offset-assert 12) ;; ? @@ -187,11 +187,11 @@ (want-display-level (_type_ symbol symbol) int 12) (want-vis (_type_ symbol) int 13) (want-force-vis (_type_ symbol symbol) int 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) + (dummy-15 (_type_ pair) none 15) + (dummy-16 (_type_ float) int 16) + (dummy-17 (_type_ pair) int 17) + (dummy-18 (_type_) int 18) + (dummy-19 (_type_) int 19) (dummy-20 () none 20) ) ) @@ -206,19 +206,19 @@ ;; a game checkpoint (deftype continue-point (basic) - ((name string :offset-assert 4) - (level basic :offset-assert 8) - (flags uint32 :offset-assert 12) - (trans vector :inline :offset-assert 16) - (quat quaternion :inline :offset-assert 32) - (camera-trans vector :inline :offset-assert 48) - (camera-rot float 9 :offset-assert 64) - (load-commands pair :offset-assert 100) - (vis-nick basic :offset-assert 104) - (lev0 basic :offset-assert 108) - (disp0 basic :offset-assert 112) - (lev1 basic :offset-assert 116) - (disp1 basic :offset-assert 120) + ((name string :offset-assert 4) + (level symbol :offset-assert 8) + (flags uint32 :offset-assert 12) + (trans vector :inline :offset-assert 16) + (quat quaternion :inline :offset-assert 32) + (camera-trans vector :inline :offset-assert 48) + (camera-rot float 9 :offset-assert 64) + (load-commands pair :offset-assert 100) + (vis-nick symbol :offset-assert 104) + (lev0 symbol :offset-assert 108) + (disp0 symbol :offset-assert 112) + (lev1 symbol :offset-assert 116) + (disp1 symbol :offset-assert 120) ) :method-count-assert 10 :size-assert #x7c @@ -287,7 +287,7 @@ (initialize! (_type_ symbol game-save string) _type_ 9) (adjust (_type_ symbol float handle) float 10) (task-complete? (_type_ game-task) symbol 11) - (lookup-entity-perm-by-aid (_type_ uint) entity-perm 12) + (lookup-entity-perm-by-aid (_type_ actor-id) entity-perm 12) (get-entity-task-perm (_type_ game-task) entity-perm 13) (copy-perms-from-level! (_type_ level) none 14) (copy-perms-to-level! (_type_ level) none 15) diff --git a/goal_src/engine/game/game-info.gc b/goal_src/engine/game/game-info.gc index 061a975684..e171917912 100644 --- a/goal_src/engine/game/game-info.gc +++ b/goal_src/engine/game/game-info.gc @@ -551,10 +551,10 @@ ;; todo method 11 -(defmethod lookup-entity-perm-by-aid game-info ((obj game-info) (arg0 uint)) +(defmethod lookup-entity-perm-by-aid game-info ((obj game-info) (aid actor-id)) (let ((v1-0 (-> obj perm-list))) (countdown (a0-1 (-> v1-0 length)) - (if (= arg0 (-> v1-0 data a0-1 aid)) + (if (= aid (-> v1-0 data a0-1 aid)) (return (-> v1-0 data a0-1)) ) ) @@ -708,363 +708,125 @@ ) (defun-debug game-task->string ((arg0 game-task)) - (let ((v1-0 arg0)) - (cond - ((= v1-0 (game-task max)) - "max" - ) - ((= v1-0 (game-task assistant-village3)) - "assistant-village3" - ) - ((= v1-0 (game-task leaving-misty)) - "leaving-misty" - ) - ((= v1-0 (game-task plunger-lurker-hit)) - "plunger-lurker-hit" - ) - ((= v1-0 (game-task finalboss-movies)) - "finalboss-movies" - ) - ((= v1-0 (game-task village4-button)) - "village4-button" - ) - ((= v1-0 (game-task ogre-secret)) - "ogre-secret" - ) - ((= v1-0 (game-task intro)) - "intro" - ) - ((= v1-0 (game-task lavatube-start)) - "lavatube-start" - ) - ((= v1-0 (game-task lavatube-balls)) - "lavatube-balls" - ) - ((= v1-0 (game-task red-eggtop)) - "red-eggtop" - ) - ((= v1-0 (game-task village3-button)) - "village3-button" - ) - ((= v1-0 (game-task swamp-arm)) - "swamp-arm" - ) - ((= v1-0 (game-task village2-levitator)) - "village2-levitator" - ) - ((= v1-0 (game-task firecanyon-assistant)) - "firecanyon-assistant" - ) - ((= v1-0 (game-task village3-oracle-money2)) - "village3-oracle-money2" - ) - ((= v1-0 (game-task village3-oracle-money1)) - "village3-oracle-money1" - ) - ((= v1-0 (game-task village3-miner-money4)) - "village3-miner-money4" - ) - ((= v1-0 (game-task village3-miner-money3)) - "village3-miner-money3" - ) - ((= v1-0 (game-task village3-miner-money2)) - "village3-miner-money2" - ) - ((= v1-0 (game-task village3-miner-money1)) - "village3-miner-money1" - ) - ((= v1-0 (game-task training-buzzer)) - "training-buzzer" - ) - ((= v1-0 (game-task training-climb)) - "training-climb" - ) - ((= v1-0 (game-task training-door)) - "training-door" - ) - ((= v1-0 (game-task training-gimmie)) - "training-gimmie" - ) - ((= v1-0 (game-task citadel-buzzer)) - "citadel-buzzer" - ) - ((= v1-0 (game-task lavatube-buzzer)) - "lavatube-buzzer" - ) - ((= v1-0 (game-task lavatube-end)) - "lavatube-end" - ) - ((= v1-0 (game-task ogre-buzzer)) - "ogre-buzzer" - ) - ((= v1-0 (game-task ogre-end)) - "ogre-end" - ) - ((= v1-0 (game-task ogre-boss)) - "ogre-boss" - ) - ((= v1-0 (game-task cave-buzzer)) - "cave-buzzer" - ) - ((= v1-0 (game-task cave-platforms)) - "cave-platforms" - ) - ((= v1-0 (game-task cave-spider-tunnel)) - "cave-spider-tunnel" - ) - ((= v1-0 (game-task cave-swing-poles)) - "cave-swing-poles" - ) - ((= v1-0 (game-task cave-robot-climb)) - "cave-robot-climb" - ) - ((= v1-0 (game-task cave-dark-climb)) - "cave-dark-climb" - ) - ((= v1-0 (game-task cave-dark-crystals)) - "cave-dark-crystals" - ) - ((= v1-0 (game-task cave-gnawers)) - "cave-gnawers" - ) - ((= v1-0 (game-task village3-buzzer)) - "village3-buzzer" - ) - ((= v1-0 (game-task village2-buzzer)) - "village2-buzzer" - ) - ((= v1-0 (game-task village1-buzzer)) - "village1-buzzer" - ) - ((= v1-0 (game-task village3-extra1)) - "village3-extra1" - ) - ((= v1-0 (game-task citadel-sage-yellow)) - "citadel-sage-yellow" - ) - ((= v1-0 (game-task citadel-sage-red)) - "citadel-sage-red" - ) - ((= v1-0 (game-task citadel-sage-blue)) - "citadel-sage-blue" - ) - ((= v1-0 (game-task citadel-sage-green)) - "citadel-sage-green" - ) - ((= v1-0 (game-task firecanyon-end)) - "firecanyon-end" - ) - ((= v1-0 (game-task firecanyon-buzzer)) - "firecanyon-buzzer" - ) - ((= v1-0 (game-task snow-cage)) - "snow-cage" - ) - ((= v1-0 (game-task snow-bumpers)) - "snow-bumpers" - ) - ((= v1-0 (game-task snow-buzzer)) - "snow-buzzer" - ) - ((= v1-0 (game-task snow-bunnies)) - "snow-bunnies" - ) - ((= v1-0 (game-task snow-ball)) - "snow-ball" - ) - ((= v1-0 (game-task snow-fort)) - "snow-fort" - ) - ((= v1-0 (game-task snow-ram)) - "snow-ram" - ) - ((= v1-0 (game-task snow-eggtop)) - "snow-eggtop" - ) - ((= v1-0 (game-task rolling-ring-chase-2)) - "rolling-ring-chase-2" - ) - ((= v1-0 (game-task rolling-ring-chase-1)) - "rolling-ring-chase-1" - ) - ((= v1-0 (game-task rolling-buzzer)) - "rolling-buzzer" - ) - ((= v1-0 (game-task rolling-lake)) - "rolling-lake" - ) - ((= v1-0 (game-task rolling-plants)) - "rolling-plants" - ) - ((= v1-0 (game-task rolling-moles)) - "rolling-moles" - ) - ((= v1-0 (game-task rolling-robbers)) - "rolling-robbers" - ) - ((= v1-0 (game-task rolling-race)) - "rolling-race" - ) - ((= v1-0 (game-task sunken-spinning-room)) - "sunken-spinning-room" - ) - ((= v1-0 (game-task sunken-top-of-helix)) - "sunken-top-of-helix" - ) - ((= v1-0 (game-task sunken-buzzer)) - "sunken-buzzer" - ) - ((= v1-0 (game-task sunken-sharks)) - "sunken-sharks" - ) - ((= v1-0 (game-task sunken-room)) - "sunken-room" - ) - ((= v1-0 (game-task sunken-slide)) - "sunken-slide" - ) - ((= v1-0 (game-task sunken-pipe)) - "sunken-pipe" - ) - ((= v1-0 (game-task sunken-platforms)) - "sunken-platforms" - ) - ((= v1-0 (game-task swamp-buzzer)) - "swamp-buzzer" - ) - ((= v1-0 (game-task swamp-tether-4)) - "swamp-tether-4" - ) - ((= v1-0 (game-task swamp-tether-3)) - "swamp-tether-3" - ) - ((= v1-0 (game-task swamp-tether-2)) - "swamp-tether-2" - ) - ((= v1-0 (game-task swamp-tether-1)) - "swamp-tether-1" - ) - ((= v1-0 (game-task swamp-battle)) - "swamp-battle" - ) - ((= v1-0 (game-task swamp-flutflut)) - "swamp-flutflut" - ) - ((= v1-0 (game-task swamp-billy)) - "swamp-billy" - ) - ((= v1-0 (game-task village2-oracle-money2)) - "village2-oracle-money2" - ) - ((= v1-0 (game-task village2-oracle-money1)) - "village2-oracle-money1" - ) - ((= v1-0 (game-task village2-warrior-money)) - "village2-warrior-money" - ) - ((= v1-0 (game-task village2-geologist-money)) - "village2-geologist-money" - ) - ((= v1-0 (game-task village2-gambler-money)) - "village2-gambler-money" - ) - ((= v1-0 (game-task misty-eco-challenge)) - "misty-eco-challenge" - ) - ((= v1-0 (game-task misty-bike-jump)) - "misty-bike-jump" - ) - ((= v1-0 (game-task misty-buzzer)) - "misty-buzzer" - ) - ((= v1-0 (game-task misty-bike)) - "misty-bike" - ) - ((= v1-0 (game-task misty-cannon)) - "misty-cannon" - ) - ((= v1-0 (game-task misty-warehouse)) - "misty-warehouse" - ) - ((= v1-0 (game-task misty-boat)) - "misty-boat" - ) - ((= v1-0 (game-task misty-muse)) - "misty-muse" - ) - ((= v1-0 (game-task beach-sentinel)) - "beach-sentinel" - ) - ((= v1-0 (game-task beach-gimmie)) - "beach-gimmie" - ) - ((= v1-0 (game-task beach-buzzer)) - "beach-buzzer" - ) - ((= v1-0 (game-task beach-cannon)) - "beach-cannon" - ) - ((= v1-0 (game-task beach-seagull)) - "beach-seagull" - ) - ((= v1-0 (game-task beach-flutflut)) - "beach-flutflut" - ) - ((= v1-0 (game-task beach-pelican)) - "beach-pelican" - ) - ((= v1-0 (game-task beach-ecorocks)) - "beach-ecorocks" - ) - ((= v1-0 (game-task village1-oracle-money2)) - "village1-oracle-money2" - ) - ((= v1-0 (game-task village1-oracle-money1)) - "village1-oracle-money1" - ) - ((= v1-0 (game-task village1-uncle-money)) - "village1-uncle-money" - ) - ((= v1-0 (game-task village1-mayor-money)) - "village1-mayor-money" - ) - ((= v1-0 (game-task village1-yakow)) - "village1-yakow" - ) - ((= v1-0 (game-task jungle-temple-door)) - "jungle-temple-door" - ) - ((= v1-0 (game-task jungle-canyon-end)) - "jungle-canyon-end" - ) - ((= v1-0 (game-task jungle-buzzer)) - "jungle-buzzer" - ) - ((= v1-0 (game-task jungle-plant)) - "jungle-plant" - ) - ((= v1-0 (game-task jungle-fishgame)) - "jungle-fishgame" - ) - ((= v1-0 (game-task jungle-tower)) - "jungle-tower" - ) - ((= v1-0 (game-task jungle-lurkerm)) - "jungle-lurkerm" - ) - ((= v1-0 (game-task jungle-eggtop)) - "jungle-eggtop" - ) - ((= v1-0 (game-task complete)) - "complete" - ) - ((= v1-0 (game-task none)) - "none" - ) - (else - "*unknown*" - ) - ) + (case arg0 + (((game-task max)) "max") + (((game-task assistant-village3)) "assistant-village3") + (((game-task leaving-misty)) "leaving-misty") + (((game-task plunger-lurker-hit)) "plunger-lurker-hit") + (((game-task finalboss-movies)) "finalboss-movies") + (((game-task village4-button)) "village4-button") + (((game-task ogre-secret)) "ogre-secret") + (((game-task intro)) "intro") + (((game-task lavatube-start)) "lavatube-start") + (((game-task lavatube-balls)) "lavatube-balls") + (((game-task red-eggtop)) "red-eggtop") + (((game-task village3-button)) "village3-button") + (((game-task swamp-arm)) "swamp-arm") + (((game-task village2-levitator)) "village2-levitator") + (((game-task firecanyon-assistant)) "firecanyon-assistant") + (((game-task village3-oracle-money2)) "village3-oracle-money2") + (((game-task village3-oracle-money1)) "village3-oracle-money1") + (((game-task village3-miner-money4)) "village3-miner-money4") + (((game-task village3-miner-money3)) "village3-miner-money3") + (((game-task village3-miner-money2)) "village3-miner-money2") + (((game-task village3-miner-money1)) "village3-miner-money1") + (((game-task training-buzzer)) "training-buzzer") + (((game-task training-climb)) "training-climb") + (((game-task training-door)) "training-door") + (((game-task training-gimmie)) "training-gimmie") + (((game-task citadel-buzzer)) "citadel-buzzer") + (((game-task lavatube-buzzer)) "lavatube-buzzer") + (((game-task lavatube-end)) "lavatube-end") + (((game-task ogre-buzzer)) "ogre-buzzer") + (((game-task ogre-end)) "ogre-end") + (((game-task ogre-boss)) "ogre-boss") + (((game-task cave-buzzer)) "cave-buzzer") + (((game-task cave-platforms)) "cave-platforms") + (((game-task cave-spider-tunnel)) "cave-spider-tunnel") + (((game-task cave-swing-poles)) "cave-swing-poles") + (((game-task cave-robot-climb)) "cave-robot-climb") + (((game-task cave-dark-climb)) "cave-dark-climb") + (((game-task cave-dark-crystals)) "cave-dark-crystals") + (((game-task cave-gnawers)) "cave-gnawers") + (((game-task village3-buzzer)) "village3-buzzer") + (((game-task village2-buzzer)) "village2-buzzer") + (((game-task village1-buzzer)) "village1-buzzer") + (((game-task village3-extra1)) "village3-extra1") + (((game-task citadel-sage-yellow)) "citadel-sage-yellow") + (((game-task citadel-sage-red)) "citadel-sage-red") + (((game-task citadel-sage-blue)) "citadel-sage-blue") + (((game-task citadel-sage-green)) "citadel-sage-green") + (((game-task firecanyon-end)) "firecanyon-end") + (((game-task firecanyon-buzzer)) "firecanyon-buzzer") + (((game-task snow-cage)) "snow-cage") + (((game-task snow-bumpers)) "snow-bumpers") + (((game-task snow-buzzer)) "snow-buzzer") + (((game-task snow-bunnies)) "snow-bunnies") + (((game-task snow-ball)) "snow-ball") + (((game-task snow-fort)) "snow-fort") + (((game-task snow-ram)) "snow-ram") + (((game-task snow-eggtop)) "snow-eggtop") + (((game-task rolling-ring-chase-2)) "rolling-ring-chase-2") + (((game-task rolling-ring-chase-1)) "rolling-ring-chase-1") + (((game-task rolling-buzzer)) "rolling-buzzer") + (((game-task rolling-lake)) "rolling-lake") + (((game-task rolling-plants)) "rolling-plants") + (((game-task rolling-moles)) "rolling-moles") + (((game-task rolling-robbers)) "rolling-robbers") + (((game-task rolling-race)) "rolling-race") + (((game-task sunken-spinning-room)) "sunken-spinning-room") + (((game-task sunken-top-of-helix)) "sunken-top-of-helix") + (((game-task sunken-buzzer)) "sunken-buzzer") + (((game-task sunken-sharks)) "sunken-sharks") + (((game-task sunken-room)) "sunken-room") + (((game-task sunken-slide)) "sunken-slide") + (((game-task sunken-pipe)) "sunken-pipe") + (((game-task sunken-platforms)) "sunken-platforms") + (((game-task swamp-buzzer)) "swamp-buzzer") + (((game-task swamp-tether-4)) "swamp-tether-4") + (((game-task swamp-tether-3)) "swamp-tether-3") + (((game-task swamp-tether-2)) "swamp-tether-2") + (((game-task swamp-tether-1)) "swamp-tether-1") + (((game-task swamp-battle)) "swamp-battle") + (((game-task swamp-flutflut)) "swamp-flutflut") + (((game-task swamp-billy)) "swamp-billy") + (((game-task village2-oracle-money2)) "village2-oracle-money2") + (((game-task village2-oracle-money1)) "village2-oracle-money1") + (((game-task village2-warrior-money)) "village2-warrior-money") + (((game-task village2-geologist-money)) "village2-geologist-money") + (((game-task village2-gambler-money)) "village2-gambler-money") + (((game-task misty-eco-challenge)) "misty-eco-challenge") + (((game-task misty-bike-jump)) "misty-bike-jump") + (((game-task misty-buzzer)) "misty-buzzer") + (((game-task misty-bike)) "misty-bike") + (((game-task misty-cannon)) "misty-cannon") + (((game-task misty-warehouse)) "misty-warehouse") + (((game-task misty-boat)) "misty-boat") + (((game-task misty-muse)) "misty-muse") + (((game-task beach-sentinel)) "beach-sentinel") + (((game-task beach-gimmie)) "beach-gimmie") + (((game-task beach-buzzer)) "beach-buzzer") + (((game-task beach-cannon)) "beach-cannon") + (((game-task beach-seagull)) "beach-seagull") + (((game-task beach-flutflut)) "beach-flutflut") + (((game-task beach-pelican)) "beach-pelican") + (((game-task beach-ecorocks)) "beach-ecorocks") + (((game-task village1-oracle-money2)) "village1-oracle-money2") + (((game-task village1-oracle-money1)) "village1-oracle-money1") + (((game-task village1-uncle-money)) "village1-uncle-money") + (((game-task village1-mayor-money)) "village1-mayor-money") + (((game-task village1-yakow)) "village1-yakow") + (((game-task jungle-temple-door)) "jungle-temple-door") + (((game-task jungle-canyon-end)) "jungle-canyon-end") + (((game-task jungle-buzzer)) "jungle-buzzer") + (((game-task jungle-plant)) "jungle-plant") + (((game-task jungle-fishgame)) "jungle-fishgame") + (((game-task jungle-tower)) "jungle-tower") + (((game-task jungle-lurkerm)) "jungle-lurkerm") + (((game-task jungle-eggtop)) "jungle-eggtop") + (((game-task complete)) "complete") + (((game-task none)) "none") + (else "*unknown*") ) ) @@ -1103,7 +865,7 @@ (let ((v1-15 (new 'global 'entity-perm-array 116))) (set! (-> gp-0 task-perm-list) v1-15) (dotimes (a0-24 (-> v1-15 length)) - (set! (-> v1-15 data a0-24 task) (the-as uint a0-24)) + (set! (-> v1-15 data a0-24 task) (the-as game-task a0-24)) ) (set! (-> v1-15 data 1 status) diff --git a/goal_src/engine/game/generic-obs-h.gc b/goal_src/engine/game/generic-obs-h.gc index f22323a187..7fb0185a53 100644 --- a/goal_src/engine/game/generic-obs-h.gc +++ b/goal_src/engine/game/generic-obs-h.gc @@ -10,9 +10,9 @@ ((new-trans-hook function :offset-assert 176) (cur-trans-hook function :offset-assert 180) (cur-event-hook function :offset-assert 184) - (new-joint-anim basic :offset-assert 188) + (new-joint-anim art-joint-anim :offset-assert 188) (new-joint-anim-blend uint64 :offset-assert 192) - (anim-mode basic :offset-assert 200) + (anim-mode symbol :offset-assert 200) (cur-grab-handle uint64 :offset-assert 208) (cur-target-handle uint64 :offset-assert 216) (old-grab-pos vector :inline :offset-assert 224) diff --git a/goal_src/engine/game/settings.gc b/goal_src/engine/game/settings.gc index 62cba6ac3c..23bef0fc05 100644 --- a/goal_src/engine/game/settings.gc +++ b/goal_src/engine/game/settings.gc @@ -5,7 +5,7 @@ ;; name in dgo: settings ;; dgos: GAME, ENGINE -;; definition for method 9 of type setting-data + (defmethod handle-pending-updates setting-data ((obj setting-data) (arg0 engine)) "this goes through the list of pending setting changes in the engine/connection list and updates the setting-data" @@ -29,28 +29,13 @@ (('process-mask) (case (-> conn param1) (('set) - (set! - (-> obj process-mask) - (logior - (-> obj process-mask) - (the-as uint (the-as int (-> conn param3))) - ) - ) + (logior! (-> obj process-mask) (the-as process-mask (-> conn param3))) ) (('clear) - (set! - (-> obj process-mask) - (logand - (-> obj process-mask) - (the-as uint (the-as uint (lognot (the-as uint (-> conn param3))))) - ) - ) + (logclear! (-> obj process-mask) (the-as process-mask (-> conn param3))) ) (('abs) - (set! - (-> obj process-mask) - (the-as process-mask (the-as int (-> conn param3))) - ) + (set! (-> obj process-mask) (the-as process-mask (-> conn param3))) ) ) ) @@ -211,16 +196,10 @@ (('common-page) (case (-> conn param1) (('set) - (set! (-> obj common-page) - (logior (-> obj common-page) (the-as int (-> conn param3))) - ) + (logior! (-> obj common-page) (the-as int (-> conn param3))) ) (('clear) - (set! (-> obj common-page) - (logand (-> obj common-page) - (the-as int (the-as uint (lognot (the-as uint (-> conn param3))))) - ) - ) + (logclear! (-> obj common-page) (the-as int (-> conn param3))) ) ) ) @@ -232,35 +211,13 @@ obj ) -;; definition for method 9 of type setting-control -;; INFO: Return type mismatch int vs none. -(defmethod - push-setting! - setting-control - ((obj setting-control) - (arg0 process) - (arg1 (function object object object object object)) - (arg2 object) - (arg3 object) - (arg4 object) - ) +(defmethod push-setting! setting-control ((obj setting-control) (arg0 process) (arg1 (function object object object object object)) (arg2 object) (arg3 object) (arg4 object)) (add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4) 0 (none) ) -;; definition for method 10 of type setting-control -;; INFO: Return type mismatch int vs none. -(defmethod - set-setting! - setting-control - ((obj setting-control) - (arg0 process) - (arg1 symbol) - (arg2 symbol) - (arg3 float) - (arg4 int) - ) +(defmethod set-setting! setting-control ((obj setting-control) (arg0 process) (arg1 symbol) (arg2 symbol) (arg3 float) (arg4 int)) (clear-pending-settings-from-process obj arg0 arg1) (add-connection (-> obj engine) @@ -274,12 +231,7 @@ (none) ) -;; definition for method 11 of type setting-control -;; INFO: Return type mismatch int vs none. -(defmethod - clear-pending-settings-from-process - setting-control - ((obj setting-control) (arg0 process) (arg1 symbol)) +(defmethod clear-pending-settings-from-process setting-control ((obj setting-control) (arg0 process) (arg1 symbol)) (when arg0 (let ((s5-0 (-> obj engine)) (s4-0 (-> arg0 connection-list next1)) @@ -303,7 +255,7 @@ (none) ) -;; definition for method 12 of type setting-control + (defmethod copy-settings-from-target! setting-control ((obj setting-control)) (let ((gp-0 (-> obj current))) (let ((s5-0 (-> obj target))) @@ -338,54 +290,26 @@ ) ) -;; definition for method 13 of type setting-control + (defmethod update-per-frame-settings! setting-control ((obj setting-control)) (copy-settings-from-target! obj) (let ((gp-0 (-> obj current))) (let ((s5-1 (-> obj target))) (when *sound-player-enable* (when (!= (-> gp-0 sfx-volume) (-> s5-1 sfx-volume)) - (set! - (-> gp-0 sfx-volume) - (seek - (-> gp-0 sfx-volume) - (-> s5-1 sfx-volume) - (* 100.0 (-> *display* seconds-per-frame)) - ) - ) + (seek! (-> gp-0 sfx-volume) (-> s5-1 sfx-volume) (* 100.0 (-> *display* seconds-per-frame))) (sound-set-volume (the-as uint 1) (-> gp-0 sfx-volume)) ) (when (!= (-> gp-0 music-volume) (-> s5-1 music-volume)) - (set! - (-> gp-0 music-volume) - (seek - (-> gp-0 music-volume) - (-> s5-1 music-volume) - (* 100.0 (-> *display* seconds-per-frame)) - ) - ) + (seek! (-> gp-0 music-volume) (-> s5-1 music-volume) (* 100.0 (-> *display* seconds-per-frame))) (sound-set-volume (the-as uint 2) (-> gp-0 music-volume)) ) (when (!= (-> gp-0 dialog-volume) (-> s5-1 dialog-volume)) - (set! - (-> gp-0 dialog-volume) - (seek - (-> gp-0 dialog-volume) - (-> s5-1 dialog-volume) - (* 100.0 (-> *display* seconds-per-frame)) - ) - ) + (seek! (-> gp-0 dialog-volume) (-> s5-1 dialog-volume) (* 100.0 (-> *display* seconds-per-frame))) (sound-set-volume (the-as uint 4) (-> gp-0 dialog-volume)) ) (when (!= (-> gp-0 ambient-volume) (-> s5-1 ambient-volume)) - (set! - (-> gp-0 ambient-volume) - (seek - (-> gp-0 ambient-volume) - (-> s5-1 ambient-volume) - (* 100.0 (-> *display* seconds-per-frame)) - ) - ) + (seek! (-> gp-0 ambient-volume) (-> s5-1 ambient-volume) (* 100.0 (-> *display* seconds-per-frame))) (sound-set-volume (the-as uint 16) (-> gp-0 ambient-volume)) ) ) @@ -393,16 +317,13 @@ (set! (-> gp-0 language) (-> s5-1 language)) (set-language (-> gp-0 language)) ) - (when - (and - (!= (-> s5-1 music) (-> gp-0 music)) - (and - (< 0.0 (-> *setting-control* current music-volume)) - (zero? (rpc-busy? 1)) - *sound-bank-1* - *sound-bank-2* - ) - ) + (when (and (!= (-> s5-1 music) (-> gp-0 music)) + (and (< 0.0 (-> *setting-control* current music-volume)) + (zero? (rpc-busy? 1)) + *sound-bank-1* + *sound-bank-2* + ) + ) (cond ((-> s5-1 music) (format 0 "Load music ~A~%" (-> s5-1 music)) @@ -415,13 +336,7 @@ ) (set! (-> gp-0 music) (-> s5-1 music)) ) - (set! - (-> s5-1 sound-flava) - (the-as - uint - (flava-lookup (-> gp-0 music) (the-as int (-> s5-1 sound-flava))) - ) - ) + (set! (-> s5-1 sound-flava) (the-as uint (flava-lookup (-> gp-0 music) (the-as int (-> s5-1 sound-flava))))) (set! (-> gp-0 sound-flava) (-> s5-1 sound-flava)) (if *sound-player-enable* (sound-set-flava (-> gp-0 sound-flava)) @@ -449,14 +364,7 @@ (set! (-> gp-0 bg-r) (-> s5-1 bg-r)) (set! (-> gp-0 bg-g) (-> s5-1 bg-g)) (set! (-> gp-0 bg-b) (-> s5-1 bg-b)) - (set! - (-> gp-0 bg-a) - (seek - (-> gp-0 bg-a) - (-> s5-1 bg-a) - (* (-> s5-1 bg-a-speed) (-> *display* seconds-per-frame)) - ) - ) + (seek! (-> gp-0 bg-a) (-> s5-1 bg-a) (* (-> s5-1 bg-a-speed) (-> *display* seconds-per-frame))) ) (let ((v1-60 (-> *display* frames (-> *display* on-screen) display)) (f0-39 (-> gp-0 bg-a)) @@ -488,7 +396,7 @@ ) ) -;; failed to figure out what this is: + (when (zero? *setting-control*) (set! *setting-control* (new 'global 'setting-control 32)) (let ((gp-0 (-> *setting-control* default)) @@ -498,38 +406,14 @@ (set! (-> gp-0 ocean-off) #f) (set! (-> gp-0 allow-look-around) #t) (set! (-> gp-0 border-mode) #f) - (set! - (-> gp-0 sfx-volume) - (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2))))) - ) - (set! - (-> gp-0 music-volume) - (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2))))) - ) - (set! - (-> gp-0 dialog-volume) - (the float (* 5 (the int (+ 0.5 (* 20.0 f0-2))))) - ) - (set! - (-> gp-0 ambient-volume) - (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2))))) - ) - (set! - (-> gp-0 sfx-volume-movie) - (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2))))) - ) - (set! - (-> gp-0 music-volume-movie) - (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2))))) - ) - (set! - (-> gp-0 ambient-volume-movie) - (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2))))) - ) - (set! - (-> gp-0 dialog-volume-hint) - (the float (* 5 (the int (+ 0.5 (* 16.0 f0-2))))) - ) + (set! (-> gp-0 sfx-volume) (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2)))))) + (set! (-> gp-0 music-volume) (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2)))))) + (set! (-> gp-0 dialog-volume) (the float (* 5 (the int (+ 0.5 (* 20.0 f0-2)))))) + (set! (-> gp-0 ambient-volume) (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2)))))) + (set! (-> gp-0 sfx-volume-movie) (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2)))))) + (set! (-> gp-0 music-volume-movie) (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2)))))) + (set! (-> gp-0 ambient-volume-movie) (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2)))))) + (set! (-> gp-0 dialog-volume-hint) (the float (* 5 (the int (+ 0.5 (* 16.0 f0-2)))))) ) (set! (-> gp-0 language) (the-as int (scf-get-language))) (set! (-> gp-0 process-mask) (process-mask execute sleep)) diff --git a/goal_src/engine/game/task/task-control-h.gc b/goal_src/engine/game/task/task-control-h.gc index c1385e47e5..0400111719 100644 --- a/goal_src/engine/game/task/task-control-h.gc +++ b/goal_src/engine/game/task/task-control-h.gc @@ -85,7 +85,6 @@ ) ) -;; definition of type ambient-control (deftype ambient-control (structure) ((last-ambient-time uint64 :offset-assert 0) (last-ambient basic :offset-assert 8) @@ -95,18 +94,17 @@ :size-assert #x10 :flag-assert #xc00000010 (:methods - (dummy-9 () none 9) + (dummy-9 (_type_ vector int float process-drawable) none 9) (dummy-10 () none 10) (dummy-11 () none 11) ) ) -;; definition of type process-taskable (deftype process-taskable (process-drawable) - ((tasks basic :offset-assert 176) + ((tasks task-control :offset-assert 176) (query gui-query :inline :offset-assert 180) (old-target-pos transformq :inline :offset-assert 208) - (cell-for-task uint8 :offset-assert 256) + (cell-for-task game-task :offset-assert 256) (cell-x uint64 :offset-assert 264) (cam-joint-index int32 :offset-assert 272) (skippable basic :offset-assert 276) @@ -134,39 +132,39 @@ :size-assert #x17c :flag-assert #x350110017c (:methods - (dummy-20 () none 20) - (dummy-21 () none 21) - (dummy-22 () none 22) - (dummy-23 () none 23) - (dummy-24 () none 24) - (dummy-25 () none 25) - (dummy-26 () none 26) - (dummy-27 () none 27) - (dummy-28 () none 28) - (dummy-29 () none 29) - (dummy-30 () none 30) - (dummy-31 () none 31) - (dummy-32 () none 32) - (dummy-33 () none 33) - (dummy-34 () none 34) - (dummy-35 () none 35) - (dummy-36 () none 36) - (dummy-37 () none 37) - (dummy-38 () none 38) - (dummy-39 () none 39) - (dummy-40 () none 40) - (dummy-41 () none 41) - (dummy-42 () none 42) - (dummy-43 () none 43) - (dummy-44 () none 44) - (dummy-45 () none 45) - (dummy-46 () none 46) - (dummy-47 () none 47) - (dummy-48 () none 48) - (dummy-49 () none 49) - (dummy-50 () none 50) - (dummy-51 () none 51) - (dummy-52 () none 52) + (dummy-20 (_type_) none 20) + (dummy-21 (_type_) none 21) + (dummy-22 (_type_) none 22) + (dummy-23 (_type_) none 23) + (dummy-24 (_type_) none 24) + (dummy-25 (_type_) none 25) + (dummy-26 (_type_) none 26) + (dummy-27 (_type_) none 27) + (dummy-28 (_type_) none 28) + (dummy-29 (_type_) none 29) + (dummy-30 (_type_) none 30) + (dummy-31 (_type_) none 31) + (dummy-32 (_type_ symbol) spool-anim 32) + (dummy-33 (_type_) none 33) + (dummy-34 (_type_) none 34) + (dummy-35 (_type_) none 35) + (dummy-36 (_type_) none 36) + (dummy-37 (_type_) none 37) + (dummy-38 (_type_) none 38) + (dummy-39 (_type_) none 39) + (dummy-40 (_type_ object skeleton-group int int vector int) none 40) + (dummy-41 (_type_) none 41) + (dummy-42 (_type_) none 42) + (dummy-43 (_type_) none 43) + (dummy-44 (_type_) none 44) + (dummy-45 (_type_) none 45) + (dummy-46 (_type_) none 46) + (dummy-47 (_type_) none 47) + (dummy-48 (_type_) none 48) + (dummy-49 (_type_) none 49) + (dummy-50 (_type_) none 50) + (dummy-51 (_type_) none 51) + (dummy-52 (_type_) none 52) ) ) diff --git a/goal_src/engine/game/task/task-control.gc b/goal_src/engine/game/task/task-control.gc index ff395b722a..078b793596 100644 --- a/goal_src/engine/game/task/task-control.gc +++ b/goal_src/engine/game/task/task-control.gc @@ -1,39 +1,22 @@ ;;-*-Lisp-*- (in-package goal) -;; definition (debug) for function task-status->string +;; name: task-control.gc +;; name in dgo: task-control +;; dgos: GAME, ENGINE + (defun-debug task-status->string ((arg0 task-status)) - (let ((v1-0 arg0)) - (cond - ((= v1-0 7) - "need-resolution" - ) - ((= v1-0 6) - "need-reward-speech" - ) - ((= v1-0 5) - "need-reminder" - ) - ((= v1-0 4) - "need-reminder-a" - ) - ((= v1-0 3) - "need-introduction" - ) - ((= v1-0 2) - "need-hint" - ) - ((= v1-0 1) - "unknown" - ) - ((zero? v1-0) - "invalid" - ) - (else - "*unknown*" - ) + (case arg0 + (((task-status need-resolution)) "need-resolution") + (((task-status need-reward-speech)) "need-reward-speech") + (((task-status need-reminder)) "need-reminder") + (((task-status need-reminder-a)) "need-reminder-a") + (((task-status need-introduction)) "need-introduction") + (((task-status need-hint)) "need-hint") + (((task-status unknown)) "unknown") + (((task-status invalid)) "invalid") + (else "*unknown*") ) - ) ) (defmethod get-game-task task-cstage ((obj task-cstage)) @@ -48,41 +31,43 @@ (defmethod closed? task-cstage ((obj task-cstage)) "Is the closed flag set?" - (nonzero? (logand (-> obj flags) (task-flags closed))) + (declare (inline)) + + (logtest? (-> obj flags) (task-flags closed)) ) (defmethod closed-by-default? task-cstage ((obj task-cstage)) "Is the closed-by-default flag set?" - (nonzero? (logand (-> obj flags) (task-flags closed-by-default))) + (declare (inline)) + + (logtest? (-> obj flags) (task-flags closed-by-default)) ) (defmethod task-available? task-cstage ((obj task-cstage) (arg0 task-control)) "Is this task available to be the current task?" - (let ((a0-1 obj)) - (cond - ((nonzero? (logand (-> a0-1 flags) (task-flags closed))) - ;; closed flag is set, we're already closed. - #f - ) - ((>= (the-as int (-> (get-entity-task-perm *game-info* (-> obj game-task)) user-uint8 0)) - (the-as int (-> obj status)) - ) - ;; the permanent entity for this task has stored that we have progresssed past - ;; our status. Remember that we are closed, and return #f. - (set! (-> obj flags) (logior (-> obj flags) (task-flags closed))) - #f - ) - ((task-complete? *game-info* (-> obj game-task)) - ;; the game-info thinks that we have completed this task already. - ;; remember we are closed and return #f - (set! (-> obj flags) (logior (-> obj flags) (task-flags closed))) - #f - ) - (else - ;; we aren't closed. Check the condition. - ((-> obj condition) arg0) - ) - ) + (cond + ((closed? obj) + ;; we're already closed. + #f + ) + ((>= (the-as int (-> (get-entity-task-perm *game-info* (-> obj game-task)) user-uint8 0)) + (the-as int (-> obj status)) + ) + ;; the permanent entity for this task has stored that we have progresssed past + ;; our status. Remember that we are closed, and return #f. + (logior! (-> obj flags) (task-flags closed)) + #f + ) + ((task-complete? *game-info* (-> obj game-task)) + ;; the game-info thinks that we have completed this task already. + ;; remember we are closed and return #f + (logior! (-> obj flags) (task-flags closed)) + #f + ) + (else + ;; we aren't closed. Check the condition. + ((-> obj condition) arg0) + ) ) ) @@ -94,16 +79,14 @@ ) ;; flag as closed - (set! (-> obj flags) (logior (-> obj flags) (task-flags closed))) + (logior! (-> obj flags) (task-flags closed)) ;; do we have an entity to update? - (when (nonzero? (logand (-> obj flags) (task-flags has-entity))) + (when (logtest? (-> obj flags) (task-flags has-entity)) ;; look up the permanent storage for the entity associated with our task (let ((v1-9 (get-entity-task-perm *game-info* (-> obj game-task)))) ;; we set a bit to indicate that we are storing a non-default status - (set! (-> v1-9 status) - (logior (-> v1-9 status) (entity-perm-status user-set-from-cstage)) - ) + (logior! (-> v1-9 status) (entity-perm-status user-set-from-cstage)) ;; and store the actual status (only increment) (if (< (-> v1-9 user-uint8 0) (the-as uint (-> obj status))) (set! (-> v1-9 user-int8 0) (the-as int (-> obj status))) @@ -115,7 +98,7 @@ (defmethod open-task! task-cstage ((obj task-cstage)) "Clear the closed flag." - (set! (-> obj flags) (logand (lognot (task-flags closed)) (-> obj flags))) + (logclear! (-> obj flags) (task-flags closed)) 0 ) @@ -143,7 +126,6 @@ ;; look up the current cstage's task (the-as int (-> obj stage (-> obj current-stage) game-task)) ) - ) ) @@ -183,7 +165,6 @@ (none) ) -;; definition for method 12 of type task-control (defmethod close-status! task-control ((obj task-control) (arg0 task-status)) "Close the cstage that: - is associated with the task for the current cstage @@ -234,8 +215,9 @@ 0 ) -(defmethod reset! task-control ((obj task-control) (arg0 symbol) (arg1 symbol)) - "Reset a task control. arg1 to warn on null, arg1 'game for a game reset" +(defmethod reset! task-control ((obj task-control) (reset-mode symbol) (arg1 symbol)) + "Reset a task control. arg1 to warn on null, reset-mode 'game for a game reset" + (when (= obj *null-task-control*) (if arg1 (format 0 "ERROR: reset! received self of *null-task-control*~%~%") @@ -244,24 +226,15 @@ ) (dotimes (s4-0 (-> obj stage length)) ;; do we open the task? - (if (or (= arg0 'game) ;; if we're resetting the whole game, yes - (let ((a0-4 (-> obj stage s4-0))) - (not (nonzero? (logand - (-> a0-4 flags) - (task-flags closed-by-default) ;; todo this flag? - ) - ) - ) - ) + (if (or (= reset-mode 'game) ;; open every task on game reset + (not (closed-by-default? (-> obj stage s4-0))) ;; todo this flag? ) (open-task! (-> obj stage s4-0)) ) ;; call close-task! to send closed stuff to entities - (let ((a0-10 (-> obj stage s4-0))) - (if (nonzero? (logand (-> a0-10 flags) (task-flags closed))) - (close-task! (-> obj stage s4-0)) - ) + (if (closed? (-> obj stage s4-0)) + (close-task! (-> obj stage s4-0)) ) ) (the-as int #f) @@ -270,6 +243,7 @@ (defmethod closed? task-control ((obj task-control) (arg0 game-task) (arg1 task-status)) "Is the given task/status cstage closed?" + (when (= obj *null-task-control*) (format 0 "ERROR: closed? received self of *null-task-control*~%~%") (return #f) @@ -279,10 +253,7 @@ (when (and (= arg0 (-> obj stage v1-3 game-task)) (= arg1 (-> obj stage v1-3 status)) ) - (let ((a0-3 (-> obj stage v1-3))) - ;; is the closed set? - (return (nonzero? (logand (-> a0-3 flags) (task-flags closed)))) - ) + (return (closed? (-> obj stage v1-3))) ) ) (format 0 "ERROR: closed? received non-existent task-cstage(~S ~S)--returning #t.~%" @@ -325,9 +296,7 @@ ) (let ((v1-4 (get-entity-task-perm *game-info* (-> obj stage 0 game-task)))) ;; remember that we have a change. - (set! (-> v1-4 status) - (logior (-> v1-4 status) (entity-perm-status user-set-from-cstage)) - ) + (logior! (-> v1-4 status) (entity-perm-status user-set-from-cstage)) (set! (-> v1-4 user-int8 (+ arg1 1)) arg0) ) 0 @@ -338,7 +307,8 @@ ;; Task Control Definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; definition for symbol *assistant-tasks*, type task-control + +;; tasks for assistant (note: keira) (define *assistant-tasks* (new 'static 'task-control :current-stage -1 @@ -348,48 +318,25 @@ (new 'static 'task-cstage :game-task (game-task jungle-eggtop) :status (task-status need-hint) - :flags - (task-flags has-entity closed-by-default) + :flags (task-flags has-entity closed-by-default) :condition (lambda ((arg0 task-control)) #t) ) (new 'static 'task-cstage :game-task (game-task jungle-eggtop) :status (task-status need-introduction) - :flags - (task-flags has-entity closed-by-default) + :flags (task-flags has-entity closed-by-default) :condition (lambda ((arg0 task-control)) #t) ) (new 'static 'task-cstage :game-task (game-task misty-bike) :status (task-status need-hint) - :flags - (task-flags has-entity closed-by-default) + :flags (task-flags has-entity closed-by-default) :condition - (lambda - ((arg0 task-control)) - (with-pp - (or - (closed? arg0 (game-task jungle-eggtop) (task-status need-reminder)) - (and - (closed? - arg0 - (game-task jungle-eggtop) - (task-status need-introduction) - ) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) pp) - (set! (-> a1-2 num-params) 2) - (set! (-> a1-2 message) 'query) - (set! (-> a1-2 param 0) (the-as uint 'pickup)) - (set! (-> a1-2 param 1) (the-as uint 6)) - (>= - (the int (send-event-function *target* a1-2)) - (+ (get-reminder arg0 1) 3) - ) - ) - ) - ) - ) + (lambda ((arg0 task-control)) + (or (closed? arg0 (game-task jungle-eggtop) (task-status need-reminder)) + (and (closed? arg0 (game-task jungle-eggtop) (task-status need-introduction)) + (>= (the int (send-event *target* 'query 'pickup 6)) (+ (get-reminder arg0 1) 3))) + ) ) ) (new 'static 'task-cstage @@ -398,31 +345,11 @@ :flags (task-flags has-entity closed-by-default) :condition - (lambda - ((arg0 task-control)) - (with-pp - (or - (closed? arg0 (game-task jungle-eggtop) (task-status need-reminder)) - (and - (closed? - arg0 - (game-task jungle-eggtop) - (task-status need-introduction) - ) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) pp) - (set! (-> a1-2 num-params) 2) - (set! (-> a1-2 message) 'query) - (set! (-> a1-2 param 0) (the-as uint 'pickup)) - (set! (-> a1-2 param 1) (the-as uint 6)) - (>= - (the int (send-event-function *target* a1-2)) - (+ (get-reminder arg0 1) 3) - ) - ) - ) - ) - ) + (lambda ((arg0 task-control)) + (or (closed? arg0 (game-task jungle-eggtop) (task-status need-reminder)) + (and (closed? arg0 (game-task jungle-eggtop) (task-status need-introduction)) + (>= (the int (send-event *target* 'query 'pickup 6)) (+ (get-reminder arg0 1) 3))) + ) ) ) (new 'static 'task-cstage @@ -452,12 +379,8 @@ :status (task-status unknown) :flags (task-flags has-entity) :condition - (lambda - ((arg0 task-control)) - (task-closed? - (game-task village4-button) - (task-status need-reward-speech) - ) + (lambda ((arg0 task-control)) + (task-closed? (game-task village4-button) (task-status need-reward-speech)) ) ) (new 'static 'task-cstage @@ -481,9 +404,8 @@ ) ) -;; definition for symbol *assistant-village2-tasks*, type task-control -(define - *assistant-village2-tasks* +;; tasks for assistant, village2 variant +(define *assistant-village2-tasks* (new 'static 'task-control :current-stage -1 :stage @@ -522,18 +444,7 @@ :status (task-status need-reward-speech) :flags (task-flags has-entity) :condition - (lambda - ((arg0 task-control)) - (with-pp (let ((a1-0 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-0 from) pp) - (set! (-> a1-0 num-params) 2) - (set! (-> a1-0 message) 'query) - (set! (-> a1-0 param 0) (the-as uint 'pickup)) - (set! (-> a1-0 param 1) (the-as uint 6)) - (>= (the int (send-event-function *target* a1-0)) 45) - ) - ) - ) + (lambda ((arg0 task-control)) (>= (the int (send-event *target* 'query 'pickup 2)) 45)) ) (new 'static 'task-cstage :game-task (game-task sunken-room) @@ -3392,39 +3303,23 @@ (new 'static 'task-cstage :game-task (game-task village2-warrior-money) :status (task-status need-hint) - :flags - (task-flags has-entity closed-by-default) + :flags (task-flags has-entity closed-by-default) :condition - (lambda - ((arg0 task-control)) - (and - (not (task-closed? (game-task ogre-boss) (task-status need-reminder))) - (not - (task-closed? - (game-task village2-levitator) - (task-status need-reward-speech) - ) - ) - ) + (lambda ((arg0 task-control)) + (and (not (task-closed? (game-task ogre-boss) (task-status need-reminder))) + (not (task-closed? (game-task village2-levitator) (task-status need-reward-speech))) + ) ) ) (new 'static 'task-cstage :game-task (game-task village2-warrior-money) :status (task-status need-introduction) - :flags - (task-flags has-entity closed-by-default) + :flags (task-flags has-entity closed-by-default) :condition - (lambda - ((arg0 task-control)) - (and - (not (task-closed? (game-task ogre-boss) (task-status need-reminder))) - (not - (task-closed? - (game-task village2-levitator) - (task-status need-reward-speech) - ) - ) - ) + (lambda ((arg0 task-control)) + (and (not (task-closed? (game-task ogre-boss) (task-status need-reminder))) + (not (task-closed? (game-task village2-levitator) (task-status need-reward-speech))) + ) ) ) (new 'static 'task-cstage @@ -3432,31 +3327,8 @@ :status (task-status need-reward-speech) :flags (task-flags has-entity) :condition - (lambda - ((arg0 task-control)) - (with-pp - (the-as - symbol - (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-0 from) pp) - (set! (-> a1-0 num-params) 2) - (set! (-> a1-0 message) 'query) - (set! (-> a1-0 param 0) (the-as uint 'pickup)) - (set! (-> a1-0 param 1) (the-as uint 5)) - (>= - ((the-as - (function process event-message-block float) - send-event-function - ) - *target* - a1-0 - ) - (-> *GAME-bank* money-task-inc) - ) - ) - ) - ) - ) + (lambda ((arg0 task-control)) + (>= (the-as float (send-event *target* 'query 'pickup 5)) (-> *GAME-bank* money-task-inc)) ) ) (new 'static 'task-cstage @@ -5234,17 +5106,8 @@ :status (task-status need-reward-speech) :flags (task-flags has-entity) :condition - (lambda - ((arg0 task-control)) - (with-pp (let ((a1-0 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-0 from) pp) - (set! (-> a1-0 num-params) 2) - (set! (-> a1-0 message) 'query) - (set! (-> a1-0 param 0) (the-as uint 'pickup)) - (set! (-> a1-0 param 1) (the-as uint 6)) - (>= (the int (send-event-function *target* a1-0)) 72) - ) - ) + (lambda ((arg0 task-control)) + (>= (the int (send-event *target* 'query 'pickup 6)) 72) ) ) (new 'static 'task-cstage @@ -5413,12 +5276,8 @@ :status (task-status unknown) :flags (task-flags has-entity) :condition - (lambda - ((arg0 task-control)) - (task-closed? - (game-task village4-button) - (task-status need-reward-speech) - ) + (lambda ((arg0 task-control)) + (task-closed? (game-task village4-button) (task-status need-reward-speech)) ) ) (new 'static 'task-cstage @@ -5533,17 +5392,14 @@ 0 ) -;; definition for function task-closed? (defun task-closed? ((arg0 game-task) (arg1 task-status)) (closed? (get-task-control arg0) arg0 arg1) ) -;; definition for function task-exists? (defun task-exists? ((arg0 game-task) (arg1 task-status)) (exists? (get-task-control arg0) arg0 arg1) ) -;; definition for function task-known? (defun task-known? ((arg0 game-task)) "Is there a cstage with a non-unknown status?" (let ((v1-0 (get-task-status arg0))) @@ -5562,7 +5418,6 @@ ) ) -;; definition for function sages-kidnapped? (defun sages-kidnapped? () (task-closed? (game-task village4-button) (task-status need-reward-speech)) ) @@ -5593,7 +5448,6 @@ ) ) -;; failed to figure out what this is: (task-control-reset 'game) diff --git a/goal_src/engine/gfx/depth-cue-h.gc b/goal_src/engine/gfx/depth-cue-h.gc index 36c64fb063..925c8e5c89 100644 --- a/goal_src/engine/gfx/depth-cue-h.gc +++ b/goal_src/engine/gfx/depth-cue-h.gc @@ -5,7 +5,7 @@ ;; name in dgo: depth-cue-h ;; dgos: GAME, ENGINE -;; depth-cue-h + (deftype depth-cue-data (structure) ((data vector :inline :offset-assert 0) (sharpness float :offset 0) @@ -18,7 +18,6 @@ :flag-assert #x900000010 ) -;; depth-cue-h (deftype depth-cue-work (structure) ((texture-strip-tmpl dma-gif-packet :inline :offset-assert 0) (temp-strip-tmpl dma-gif-packet :inline :offset-assert 32) diff --git a/goal_src/engine/gfx/sky/sky-h.gc b/goal_src/engine/gfx/sky/sky-h.gc index 9c79180203..1d47b8503a 100644 --- a/goal_src/engine/gfx/sky/sky-h.gc +++ b/goal_src/engine/gfx/sky/sky-h.gc @@ -39,12 +39,12 @@ (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) + (c-sun-start rgba :offset 32) + (c-sun-end rgba :offset 48) + (c-halo-start rgba :offset 36) + (c-halo-end rgba :offset 52) + (c-aurora-start rgba :offset 40) + (c-aurora-end rgba :offset 56) ) :method-count-assert 9 :size-assert #x40 @@ -76,9 +76,7 @@ ) (deftype sky-upload-data (basic) - ( - ;;(data UNKNOWN 27 :offset-assert 16) - (circle sky-circle-data :inline :offset-assert 16) + ((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) @@ -106,12 +104,12 @@ ) (defmethod new sky-parms ((allocation symbol) (type-to-make type)) - (local-vars (v0-0 sky-parms)) - (set! 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 + "allocate a new sky-parms" + + (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 + ) ) (define *sky-parms* (new 'global 'sky-parms)) diff --git a/goal_src/engine/gfx/sky/sky-utils.gc b/goal_src/engine/gfx/sky/sky-utils.gc index f00774db7f..cb4bc9c6ea 100644 --- a/goal_src/engine/gfx/sky/sky-utils.gc +++ b/goal_src/engine/gfx/sky/sky-utils.gc @@ -5,10 +5,7 @@ ;; name in dgo: sky-utils ;; dgos: GAME, ENGINE -;; definition for function sky-set-sun-radii -(defun - sky-set-sun-radii - ((arg0 sky-parms) (arg1 int) (arg2 float) (arg3 float) (arg4 float)) +(defun sky-set-sun-radii ((arg0 sky-parms) (arg1 int) (arg2 float) (arg3 float) (arg4 float)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 r-sun) arg2) (set! (-> arg0 upload-data sun v1-0 r-halo) arg3) @@ -17,10 +14,7 @@ #f ) -;; definition for function sky-set-sun-colors -(defun - sky-set-sun-colors - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint) (arg4 uint) (arg5 uint)) +(defun sky-set-sun-colors ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba) (arg4 rgba) (arg5 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-sun-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-sun-end) arg3) @@ -32,10 +26,7 @@ #f ) -;; definition for function sky-set-sun-colors-sun -(defun - sky-set-sun-colors-sun - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint)) +(defun sky-set-sun-colors-sun ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-sun-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-sun-end) arg3) @@ -43,10 +34,7 @@ #f ) -;; definition for function sky-set-sun-colors-halo -(defun - sky-set-sun-colors-halo - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint)) +(defun sky-set-sun-colors-halo ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-halo-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-halo-end) arg3) @@ -54,10 +42,7 @@ #f ) -;; definition for function sky-set-sun-colors-aurora -(defun - sky-set-sun-colors-aurora - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint)) +(defun sky-set-sun-colors-aurora ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-aurora-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-aurora-end) arg3) @@ -65,18 +50,7 @@ #f ) -;; definition for function sky-set-orbit -(defun - sky-set-orbit - ((arg0 sky-parms) - (arg1 int) - (arg2 float) - (arg3 float) - (arg4 float) - (arg5 float) - (arg6 float) - (arg7 float) - ) +(defun sky-set-orbit ((arg0 sky-parms) (arg1 int) (arg2 float) (arg3 float) (arg4 float) (arg5 float) (arg6 float) (arg7 float)) (set! (-> arg0 orbit arg1 high-noon) arg2) (set! (-> arg0 orbit arg1 tilt) (* 0.017453292 arg3)) (set! (-> arg0 orbit arg1 rise) (* 0.017453292 arg4)) diff --git a/goal_src/engine/level/level.gc b/goal_src/engine/level/level.gc index 4868cd9e7d..f40e870633 100644 --- a/goal_src/engine/level/level.gc +++ b/goal_src/engine/level/level.gc @@ -382,7 +382,7 @@ ) ) (('loading-bt) - ;; finished loading the background! + ;; finished loading the last object! (level-status-set! obj 'loading-done) (level-status-set! obj 'loaded) ) @@ -406,7 +406,7 @@ ;; something has finished loading! (cond ((not last-obj) - ;; not the last object, so it's some non-background file. start linking + ;; not the last object. start linking (cond ((dgo-load-link (the-as dgo-header a0-15) (-> obj heap) *print-login* #f) ;; linking finished (that was fast) @@ -421,7 +421,7 @@ ) ) (else - ;; the background is always the last object, so we're loading the background now + ;; we're loading the last object now, which has different rules (set! (-> obj heap top) (-> obj heap top-base)) (level-status-set! obj 'loading-bt) ) @@ -434,7 +434,7 @@ (level-update-after-load obj *login-state*) ) (('loading-bt) - ;; link the bt object + ;; link the last object (let ((a0-26 (align64 (-> obj heap current)))) (cond ((dgo-load-link (the-as dgo-header a0-26) (-> obj heap) *print-login* #t) @@ -452,7 +452,7 @@ ) (defmethod load-begin level ((obj level)) - "Start loading the level. Uses 2 megabyte heaps for loading each non-bt object." + "Start loading the level. Uses 2 megabyte heaps for loading each object." (set! loading-level (-> obj heap)) (set! (-> *level* loading-level) obj) @@ -575,7 +575,7 @@ (let ((s2-2 (-> loaded-level art-group art-group-array v1-39))) (dummy-9 s2-2) (if (dummy-12 s2-2) - (dummy-13 s2-2) + (link-art! s2-2) ) ) (1+! (-> level-login-state elts)) @@ -788,7 +788,7 @@ (dotimes (s5-0 (-> obj art-group art-group-array length)) (let ((s4-0 (-> obj art-group art-group-array s5-0))) (if (dummy-12 s4-0) - (dummy-14 s4-0) + (unlink-art! s4-0) ) ) ) @@ -1200,12 +1200,12 @@ 0 ) -(defun play ((use-vis symbol) (arg1 symbol)) +(defun play ((use-vis symbol) (init-game symbol)) "The entry point to the actual game! This allocates the level heaps, loads some data, sets some default parameters and sets the startup level." ;; temp - (format #t "(play ~A ~A) has been called!~%" use-vis arg1) - (format 0 "(play ~A ~A) has been called!~%" use-vis arg1) + (format #t "(play :use-vis ~A :init-game ~A) has been called!~%" use-vis init-game) + (format 0 "(play :use-vis ~A :init-game ~A) has been called!~%" use-vis init-game) ;;(kernel-shutdown) (let ((startup-level (case *kernel-boot-message* @@ -1260,8 +1260,8 @@ (load-dbg "Load complete. Level: ~A. Now starting display!~%" (-> *level* level0)) (on #t) (load-dbg "Display started: ~A~%" *dproc*) - (when arg1 - ;; (dummy-9 *game-info* 'game #f (the-as string #f)) TODO + (when init-game + (initialize! *game-info* 'game (the-as game-save #f) (the-as string #f)) ) 0 ) @@ -1307,87 +1307,55 @@ ) ) (when (and gp-0 (!= gp-0 *sound-bank-1*) (!= gp-0 *sound-bank-2*)) - (if (not *sound-bank-1*) - (return (begin - (format 0 "Load soundbank ~A~%" gp-0) - (sound-bank-load (string->sound-name (symbol->string gp-0))) - (set! *sound-bank-1* gp-0) - 0 - ) - ) + (when (not *sound-bank-1*) + (format 0 "Load soundbank ~A~%" gp-0) + (sound-bank-load (string->sound-name (symbol->string gp-0))) + (set! *sound-bank-1* gp-0) + (return 0) ) - (if (not *sound-bank-2*) - (return (begin - (format 0 "Load soundbank ~A~%" gp-0) - (sound-bank-load (string->sound-name (symbol->string gp-0))) - (set! *sound-bank-2* gp-0) - 0 - ) - ) + (when (not *sound-bank-2*) + (format 0 "Load soundbank ~A~%" gp-0) + (sound-bank-load (string->sound-name (symbol->string gp-0))) + (set! *sound-bank-2* gp-0) + (return 0) ) - (if (!= *sound-bank-1* s5-0) - (return (begin - (format 0 "Unload soundbank ~A~%" *sound-bank-1*) - (sound-bank-unload - (string->sound-name (symbol->string *sound-bank-1*)) - ) - (set! *sound-bank-1* #f) - 0 - ) - ) + (when (!= *sound-bank-1* s5-0) + (format 0 "Unload soundbank ~A~%" *sound-bank-1*) + (sound-bank-unload (string->sound-name (symbol->string *sound-bank-1*))) + (set! *sound-bank-1* #f) + (return 0) ) - (if (!= *sound-bank-2* s5-0) - (return (begin - (format 0 "Unload soundbank ~A~%" *sound-bank-2*) - (sound-bank-unload - (string->sound-name (symbol->string *sound-bank-2*)) - ) - (set! *sound-bank-2* #f) - 0 - ) - ) + (when (!= *sound-bank-2* s5-0) + (format 0 "Unload soundbank ~A~%" *sound-bank-2*) + (sound-bank-unload (string->sound-name (symbol->string *sound-bank-2*))) + (set! *sound-bank-2* #f) + (return 0) ) ) (when (and s5-0 (!= s5-0 *sound-bank-1*) (!= s5-0 *sound-bank-2*)) - (if (not *sound-bank-1*) - (return (begin - (format 0 "Load soundbank ~A~%" s5-0) - (sound-bank-load (string->sound-name (symbol->string s5-0))) - (set! *sound-bank-1* s5-0) - 0 - ) - ) + (when (not *sound-bank-1*) + (format 0 "Load soundbank ~A~%" s5-0) + (sound-bank-load (string->sound-name (symbol->string s5-0))) + (set! *sound-bank-1* s5-0) + (return 0) ) - (if (not *sound-bank-2*) - (return (begin - (format 0 "Load soundbank ~A~%" s5-0) - (sound-bank-load (string->sound-name (symbol->string s5-0))) - (set! *sound-bank-2* s5-0) - 0 - ) - ) + (when (not *sound-bank-2*) + (format 0 "Load soundbank ~A~%" s5-0) + (sound-bank-load (string->sound-name (symbol->string s5-0))) + (set! *sound-bank-2* s5-0) + (return 0) ) - (if (!= *sound-bank-1* gp-0) - (return (begin - (format 0 "Unload soundbank ~A~%" *sound-bank-1*) - (sound-bank-unload - (string->sound-name (symbol->string *sound-bank-1*)) - ) - (set! *sound-bank-1* #f) - 0 - ) - ) + (when (!= *sound-bank-1* gp-0) + (format 0 "Unload soundbank ~A~%" *sound-bank-1*) + (sound-bank-unload (string->sound-name (symbol->string *sound-bank-1*))) + (set! *sound-bank-1* #f) + (return 0) ) - (if (!= *sound-bank-2* gp-0) - (return (begin - (format 0 "Unload soundbank ~A~%" *sound-bank-2*) - (sound-bank-unload - (string->sound-name (symbol->string *sound-bank-2*)) - ) - (set! *sound-bank-2* #f) - 0 - ) - ) + (when (!= *sound-bank-2* gp-0) + (format 0 "Unload soundbank ~A~%" *sound-bank-2*) + (sound-bank-unload (string->sound-name (symbol->string *sound-bank-2*))) + (set! *sound-bank-2* #f) + (return 0) ) ) ) diff --git a/goal_src/engine/load/load-dgo.gc b/goal_src/engine/load/load-dgo.gc index 359218f635..5f6e73e1fd 100644 --- a/goal_src/engine/load/load-dgo.gc +++ b/goal_src/engine/load/load-dgo.gc @@ -183,16 +183,15 @@ struct DgoHeader { ;; STR PLAY ;;;;;;;;;;;;;;;;;;;;;;;;; -;; unknown. I think related to playing cutscene stuff? +;; play streamed audio for a STR -(defun str-play-async ((name string) (addr pointer)) +(defun str-play-async ((name string) (id sound-id)) "Queue a play cmd to do... something? Locks the queue, doesn't check other locks" (set! *que-str-lock* #t) (let ((cmd (the-as load-chunk-msg (add-element *play-str-rpc*)))) (charp<-string (-> cmd basename) name) - ;; might be an id? - (set! (-> cmd address) addr) + (set! (-> cmd address) (the-as pointer id)) ;; probably using a different enum here (set! (-> cmd result) (load-msg-result done)) ) diff --git a/goal_src/engine/load/loader-h.gc b/goal_src/engine/load/loader-h.gc index 9e68d1a849..7029ac3be0 100644 --- a/goal_src/engine/load/loader-h.gc +++ b/goal_src/engine/load/loader-h.gc @@ -8,6 +8,13 @@ ;; This is not well-understood yet, but it is definitely related to streaming animation loading, ;; and possibly art-group stuff. + +(defconstant SPOOL_PRIORITY_LOWEST 100000000.0) +(defconstant SPOOL_PRIORITY_RECALC -99.0) +(defconstant SPOOL_PRIORITY_HIGHEST -20.0) +(defconstant SPOOL_PRIORITY_HIGH -10.0) + + ;; This type didn't have an inspect method, so these field names are made up. (declare-type art-group basic) (deftype load-dir (basic) @@ -18,19 +25,20 @@ :flag-assert #xb00000010 (:methods (new (symbol type int basic) _type_ 0) - (dummy-9 () none 9) - (dummy-10 () none 10) + (dummy-9 (_type_ string symbol kheap int) art-group 9) + (dummy-10 (_type_ art-group) art-group 10) ) ) ;; specialization of load-dir where the data-array holds art-groups. -(declare-type art-group basic) (deftype load-dir-art-group (load-dir) ((art-group-array (array art-group) :offset 12) ) :flag-assert #xb00000010 (:methods (new (symbol type int basic) _type_ 0) + (dummy-9 (_type_ string symbol kheap int) art-group 9) + (dummy-10 (_type_ art-group) art-group 10) ) ) @@ -76,13 +84,13 @@ (heap kheap :inline :offset-assert 32) (pending-load-file string :offset-assert 48) (pending-load-file-part int32 :offset-assert 52) - (pending-load-file-owner uint64 :offset-assert 56) + (pending-load-file-owner handle :offset-assert 56) (pending-load-file-priority float :offset-assert 64) (load-file string :offset-assert 68) (load-file-part int32 :offset-assert 72) - (load-file-owner uint64 :offset-assert 80) + (load-file-owner handle :offset-assert 80) (load-file-priority float :offset-assert 88) - (buf uint32 :offset-assert 92) + (buf pointer :offset-assert 92) (len int32 :offset-assert 96) (art-group art-group :offset-assert 100) ) @@ -91,13 +99,13 @@ :flag-assert #x1000000068 (:methods (new (symbol type int) _type_ 0) - (dummy-9 (_type_ symbol int symbol float) none 9) - (dummy-10 () none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) + (want-file (_type_ string int handle float) int 9) + (update (_type_) int 10) + (inactive? (_type_) symbol 11) + (file-status (_type_ string int) symbol 12) + (link-file (_type_ art-group) art-group 13) + (unlink-file (_type_ art-group) int 14) + (unlock! (_type_) symbol 15) ) ) @@ -107,12 +115,12 @@ (set! (-> obj index) idx) (set! (-> obj load-file) #f) (set! (-> obj load-file-part) -1) - (set! (-> obj load-file-owner) (the-as uint #f)) - (set! (-> obj load-file-priority) 100000000.0) + (set! (-> obj load-file-owner) (the-as handle #f)) + (set! (-> obj load-file-priority) SPOOL_PRIORITY_LOWEST) (set! (-> obj pending-load-file) #f) (set! (-> obj pending-load-file-part) -1) - (set! (-> obj pending-load-file-owner) (the-as uint #f)) - (set! (-> obj pending-load-file-priority) 100000000.0) + (set! (-> obj pending-load-file-owner) (the-as handle #f)) + (set! (-> obj pending-load-file-priority) SPOOL_PRIORITY_LOWEST) (set! (-> obj art-group) #f) (set! (-> obj status) 'initialize) (set! (-> obj locked?) #f) @@ -123,11 +131,13 @@ (deftype spool-anim (basic) ((name string :offset 16) ;; why? - (index int32 :offset-assert 20) + (buf1 external-art-buffer :offset 16) ;; custom + (buf2 external-art-buffer :offset-assert 20) ;; custom (also what?) + (index int32 :offset 20) (parts int32 :offset-assert 24) (priority float :offset-assert 28) - (owner uint64 :offset-assert 32) - (command-list basic :offset-assert 40) + (owner handle :offset-assert 32) + (command-list pair :offset-assert 40) ) :pack-me :method-count-assert 9 @@ -137,11 +147,11 @@ (deftype external-art-control (basic) ((buffer external-art-buffer 2 :offset-assert 4) - (rec spool-anim 3 :inline) - (spool-lock uint64 :offset-assert 160) - (reserve-buffer basic :offset-assert 168) + (rec spool-anim 3 :inline :offset-assert 16) + (spool-lock handle :offset-assert 160) + (reserve-buffer external-art-buffer :offset-assert 168) (reserve-buffer-count int32 :offset-assert 172) - (active-stream basic :offset-assert 176) + (active-stream string :offset-assert 176) (preload-stream spool-anim :inline :offset-assert 184) (last-preload-stream spool-anim :inline :offset-assert 232) (end-pad uint32) @@ -151,17 +161,18 @@ :flag-assert #x1100000118 (:methods (new (symbol type) _type_ 0) - (dummy-9 (_type_ symbol) none 9) - (dummy-10 (_type_) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) + (update (_type_ symbol) int 9) + (clear-rec (_type_) int 10) + (spool-push (_type_ string int process float) int 11) + (file-status (_type_ string int) symbol 12) + (reserve-alloc (_type_) kheap 13) + (reserve-free (_type_ kheap) int 14) + (none-reserved? (_type_) symbol 15) + (try-preload-stream (_type_ string int process float) int 16) ) ) + (defmethod new external-art-control ((allocation symbol) (type-to-make type)) (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))))) ;; allocate buffers. @@ -176,19 +187,25 @@ ;; set up recs (dotimes (rec-idx 3) (set! (-> obj rec rec-idx name) #f) - (set! (-> obj rec rec-idx priority) 100000000.0) - (set! (-> obj rec rec-idx owner) (the-as uint #f)) + (set! (-> obj rec rec-idx priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj rec rec-idx owner) (the-as handle #f)) ) ;; set up defaults. - (set! (-> obj spool-lock) (the-as uint #f)) + (set! (-> obj spool-lock) (the-as handle #f)) (set! (-> obj reserve-buffer) #f) (set! (-> obj active-stream) #f) (set! (-> obj preload-stream name) #f) - (set! (-> obj preload-stream priority) 100000000.0) - (set! (-> obj preload-stream owner) (the-as uint #f)) + (set! (-> obj preload-stream priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj preload-stream owner) (the-as handle #f)) (set! (-> obj last-preload-stream name) #f) - (set! (-> obj last-preload-stream priority) 100000000.0) - (set! (-> obj last-preload-stream owner) (the-as uint #f)) + (set! (-> obj last-preload-stream priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj last-preload-stream owner) (the-as handle #f)) obj ) ) + + +(define-extern *art-control* external-art-control) +(defun-extern art-group-load-check string kheap int art-group) + + diff --git a/goal_src/engine/load/loader.gc b/goal_src/engine/load/loader.gc index e142a6f024..7c5f223ebf 100644 --- a/goal_src/engine/load/loader.gc +++ b/goal_src/engine/load/loader.gc @@ -5,3 +5,1055 @@ ;; name in dgo: loader ;; dgos: GAME, ENGINE + +(defmethod inspect load-dir ((obj load-dir)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlevel: ~A~%" (-> obj unknown)) + (format #t "~Tallocated-length: ~D~%" (-> obj string-array allocated-length)) + (format #t "~Tlength: ~D~%" (-> obj string-array length)) + (dotimes (i (-> obj string-array length)) + (format #t "~T [~D] ~S ~A (~D bytes)~%" + i (-> obj string-array i) (-> obj data-array i) (mem-size (-> obj data-array i) #f 0)) + ) + obj + ) + +(defmethod mem-usage load-dir ((obj load-dir) (arg0 memory-usage-block) (arg1 int)) + "Get the memory usage data of a load-dir" + + (set! (-> arg0 length) (max 82 (-> arg0 length))) + (set! (-> arg0 data 81 name) "array") + (set! (-> arg0 data 81 count) (+ (-> arg0 data 81 count) 1)) + (let ((v1-6 (asize-of obj))) + (set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-6)) + (set! + (-> arg0 data 81 total) + (+ (-> arg0 data 81 total) (logand -16 (+ v1-6 15))) + ) + ) + (set! (-> arg0 length) (max 82 (-> arg0 length))) + (set! (-> arg0 data 81 name) "array") + (set! (-> arg0 data 81 count) (-> arg0 data 81 count)) + (let ((v1-15 (asize-of (-> obj string-array)))) + (set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-15)) + (set! + (-> arg0 data 81 total) + (+ (-> arg0 data 81 total) (logand -16 (+ v1-15 15))) + ) + ) + (set! (-> arg0 length) (max 82 (-> arg0 length))) + (set! (-> arg0 data 81 name) "array") + (set! (-> arg0 data 81 count) (-> arg0 data 81 count)) + (let ((v1-24 (asize-of (-> obj data-array)))) + (set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-24)) + (set! + (-> arg0 data 81 total) + (+ (-> arg0 data 81 total) (logand -16 (+ v1-24 15))) + ) + ) + (dotimes (s3-0 (-> obj data-array length)) + (mem-usage (-> obj data-array s3-0) arg0 arg1) + ) + (the-as load-dir #f) + ) + +(defmethod dummy-9 load-dir-art-group ((obj load-dir-art-group) (arg0 string) (arg1 symbol) (arg2 kheap) (arg3 int)) + "This is not understood." + + (let ((s5-0 (-> obj string-array))) + (dotimes (s3-0 (-> s5-0 length)) + (when (string= arg0 (-> s5-0 s3-0)) + (when arg1 + (let ((v1-4 (art-group-load-check arg0 arg2 arg3))) + (if v1-4 + (set! (-> obj art-group-array s3-0) v1-4) + ) + ) + ) + (return (-> obj art-group-array s3-0)) + ) + ) + (let ((v0-2 (art-group-load-check arg0 arg2 arg3))) + (when v0-2 + (set! (-> s5-0 (-> s5-0 length)) arg0) + (set! (-> obj art-group-array (-> s5-0 length)) v0-2) + (1+! (-> s5-0 length)) + (1+! (-> obj art-group-array length)) + ) + v0-2 + ) + ) + ) + +(defmethod dummy-10 load-dir-art-group ((obj load-dir-art-group) (arg0 art-group)) + "This is not understood." + + (let ((s4-0 (-> obj string-array))) + (dotimes (s3-0 (-> s4-0 length)) + (when (string= (-> arg0 name) (-> s4-0 s3-0)) + (set! (-> obj art-group-array s3-0) arg0) + (return (-> obj art-group-array s3-0)) + ) + ) + (set! (-> s4-0 (-> s4-0 length)) (-> arg0 name)) + (set! (-> obj art-group-array (-> s4-0 length)) arg0) + (set! (-> s4-0 length) (+ (-> s4-0 length) 1)) + ) + (set! (-> obj art-group-array length) (+ (-> obj art-group-array length) 1)) + arg0 + ) + +(defun drawable-load ((arg0 drawable) (arg1 kheap)) + "Load a drawable file. Unused." + + (cond + ((type-type? (-> arg0 type) string) + #|(with-sp (protect sp + (if (< sp *stack-top*) + (set! sp (&+ *kernel-sp* -1024)) + )|# + (let ((s5-1 (the-as drawable (loado (the-as string arg0) arg1)))) + (if (and s5-1 (type-type? (-> s5-1 type) drawable)) + (login s5-1) + ) + ) + ;;)) + ) + ((type-type? (-> arg0 type) drawable) + (login arg0) + ) + ) + ) + +(defun art-load ((arg0 string) (arg1 kheap)) + "Load an art file. Unused." + + #|(with-sp (protect sp + (if (< sp *stack-top*) + (set! sp (&+ *kernel-sp* -1024)) + )|# + (let ((s5-0 (the-as art (loado arg0 arg1)))) + (if (type-type? (-> s5-0 type) art) + (dummy-9 s5-0) + (the-as art #f) + ) + ) + ;;)) + ) + +(defun art-group-load-check ((arg0 string) (arg1 kheap) (arg2 int)) + "Load and check an art-group file. this only runs if we're using debug memory." + + (when *debug-segment* + #|(with-sp (protect sp + (if (< sp *stack-top*) + (set! sp (&+ *kernel-sp* -1024)) + )|# + (let ((s3-1 (the-as art-group (loado (make-file-name (file-kind art-group) arg0 arg2 #f) arg1)))) + (cond + ((not s3-1) + (format 0 "ERROR: art-group ~A is not a valid file.~%" arg0) + (the-as art-group #f) + ) + ((not (type-type? (-> s3-1 type) art-group)) + (format 0 "ERROR: art-group ~A is not a art-group.~%" arg0) + (the-as art-group #f) + ) + ((not (file-info-correct-version? (-> s3-1 info) (file-kind art-group) arg2)) + ;;(format 0 "ERROR: art-group ~A is not the correct version.~%" arg0) + (the-as art-group #f) + ) + (else + (dummy-9 s3-1) + ) + ) + ) + ;;)) + ) + ) + +(defmethod want-file external-art-buffer ((obj external-art-buffer) (arg0 string) (arg1 int) (arg2 handle) (arg3 float)) + "Request a new file to be loaded into this buffer." + + (set! (-> obj pending-load-file) arg0) + (set! (-> obj pending-load-file-part) arg1) + (set! (-> obj pending-load-file-owner) arg2) + (set! (-> obj pending-load-file-priority) arg3) + 0 + ) + +(defmethod unlock! external-art-buffer ((obj external-art-buffer)) + "Unlock this buffer." + + (declare (inline)) + (set! (-> obj locked?) #f) + #f + ) + +(defmethod inactive? external-art-buffer ((obj external-art-buffer)) + "Is this buffer inactive?" + + (declare (inline)) + (!= (-> obj status) 'active) + ) + +(defmethod file-status external-art-buffer ((obj external-art-buffer) (name string) (part int)) + "Get the status of a file in the buffer. #f = file is not present." + + (when (and (name= (-> obj pending-load-file) name) + (= (-> obj pending-load-file-part) part) + ) + ;; the file is at least wanting to load + (if (and (name= (-> obj load-file) name) (= (-> obj load-file-part) part)) + (-> obj status) ;; file is loaded + 'pending ;; file is not loaded yet? + ) + ) + ) + +(defmethod link-art! art-group ((obj art-group)) + "Links the elements of this art-group." + + ;; this check seems superfluous + (when obj + (countdown (s5-0 (-> obj length)) + (let* ((art-elt (-> obj data s5-0)) + (janim (if (and (nonzero? art-elt) (type-type? (-> art-elt type) art-joint-anim)) + (the-as art-joint-anim art-elt) + )) + (success #f) + ) + (when janim + ;; a countdown with a label right at the start + (let ((s3-1 3)) + (while (begin + (label cfg-22) + (nonzero? s3-1) + ) + (+! s3-1 -1) + (let ((janim-group (art-group-get-by-name (-> *level* level s3-1) (-> janim master-art-group-name)))) + (when janim-group + (cond + ((and (< (-> janim master-art-group-index) (-> janim-group length)) + (not (-> janim-group data (-> janim master-art-group-index))) + ) + (set! (-> janim-group data (-> janim master-art-group-index)) janim) + (set! success #t) + ) + (else + (countdown (a0-14 (-> janim-group length)) + (when (not (-> janim-group data a0-14)) + (set! (-> janim-group data a0-14) janim) + (set! success #t) + (goto cfg-22) + ) + ) + ) + ) + ) + ) + ) + ) + (if (not success) + (format 0 "ERROR: ~A could not find a master slot to link for ~A.~%" (-> obj name) janim) + ) + ) + ) + ) + ) + obj + ) + +(defmethod unlink-art! art-group ((obj art-group)) + "Unlinks the elements of this art-group." + + (when obj + (countdown (s5-0 (-> obj length)) + (let* ((art-elt (-> obj data s5-0)) + (janim (if (and (nonzero? art-elt) (type-type? (-> art-elt type) art-joint-anim)) + (the-as art-joint-anim art-elt) + )) + (success #f) + ) + (when janim + (let ((s2-0 3)) + (while (begin + (label cfg-16) + (nonzero? s2-0) + ) + (+! s2-0 -1) + (let ((janim-group (art-group-get-by-name (-> *level* level s2-0) (-> janim master-art-group-name)))) + (when janim-group + (countdown (a0-5 (-> janim-group length)) + (when (= janim (-> janim-group data a0-5)) + (set! (-> janim-group data a0-5) #f) + (set! success #t) + (goto cfg-16) + ) + ) + ) + ) + ) + ) + (if (not success) + (format 0 "ERROR: ~A could not find a master slot to unlink for ~A.~%" (-> obj name) janim) + ) + ) + ) + ) + ) + 0 + ) + +(defmethod link-file external-art-buffer ((obj external-art-buffer) (ag art-group)) + "Link the art-group and set it to this buffer's art group." + + (when ag + (link-art! ag) + (set! (-> obj art-group) ag) + ) + ag + ) + +(defmethod unlink-file external-art-buffer ((obj external-art-buffer) (ag art-group)) + "Unlink the art-group and remove this buffer's art group." + + (when ag + (unlink-art! ag) + (set! (-> obj art-group) #f) + ) + 0 + ) + +(defmethod update external-art-buffer ((obj external-art-buffer)) + "Update this buffer." + + (when (or (not (name= (-> obj pending-load-file) (-> obj load-file))) + (!= (-> obj pending-load-file-part) (-> obj load-file-part)) + ) + ;; we're loading a different file, or a different part of a file + (unless (handle->process (-> obj pending-load-file-owner)) + ;; nobody owns the loading file so we can discard it + (set! (-> obj pending-load-file) #f) + (set! (-> obj pending-load-file-part) -1) + (set! (-> obj pending-load-file-owner) (the-as handle #f)) + (set! (-> obj pending-load-file-priority) SPOOL_PRIORITY_LOWEST) + ) + (when (= (-> obj status) 'initialize) + ;; we need to initialize the heap + (let ((v1-11 (-> obj heap))) + (set! (-> v1-11 base) (the-as pointer (+ #x84000 (* #x3dc00 (-> obj index))))) + (set! (-> v1-11 current) (-> v1-11 base)) + (set! (-> v1-11 top-base) (&+ (-> v1-11 base) #x3dc00)) + (set! (-> v1-11 top) (-> v1-11 top-base)) + ) + (set! (-> obj status) 'inactive) + ;; heap is now allocated, but there is no data to use + ) + (cond + ((-> obj load-file) + ;; the buffer is working on a file + (if (= (-> obj status) 'loading) + ;; something else is already loading, cancel that because we want something else + (str-load-cancel) + ) + ;; now nothing is loaded! + (set! (-> obj load-file) #f) + (set! (-> obj load-file-part) -1) + (set! (-> obj load-file-owner) (the-as handle #f)) + (set! (-> obj load-file-priority) SPOOL_PRIORITY_LOWEST) + ) + (else + ;; we have officially chosen to load this file + (set! (-> obj load-file) (-> obj pending-load-file)) + (set! (-> obj load-file-part) (-> obj pending-load-file-part)) + (set! (-> obj load-file-owner) (-> obj pending-load-file-owner)) + (set! (-> obj load-file-priority) (-> obj pending-load-file-priority)) + ) + ) + ) + (label cfg-18) + (cond + ((-> obj load-file) + ;; something is being worked on + (case (-> obj status) + (('active 'reserved) + ;; file is loaded and usable (or reserved) + ) + (('error) + ;; oops an error happened. make this buffer unusable now. + (set! (-> obj status) 'inactive) + (set! (-> obj load-file) #f) + (set! (-> obj load-file-part) -1) + (set! (-> obj load-file-owner) (the-as handle #f)) + (set! (-> obj load-file-priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj pending-load-file) #f) + (set! (-> obj pending-load-file-part) -1) + (set! (-> obj pending-load-file-owner) (the-as handle #f)) + (set! (-> obj pending-load-file-priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj art-group) #f) + ) + (('inactive) + ;; no usable data here, fill the buffer + ;; TODO macro + (let ((v1-28 (-> obj heap))) + (set! (-> v1-28 current) (-> v1-28 base)) + ) + (cond + ((string= (-> obj load-file) "reserved") ;; we want to reserve something + (cond + ((-> *art-control* reserve-buffer) + (format 0 "ERROR: trying double reserve ~A when ~A is reserved~%" obj (-> *art-control* reserve-buffer)) + ) + (else + (set! (-> obj status) 'reserved) + (set! (-> *art-control* reserve-buffer) obj) ;; this buffer is reserved + ) + ) + ) + ((and (!= (-> *level* loading-level) (-> *level* level-default)) + (< (meters 20) (-> obj load-file-priority)) + ) + ;; unused cond + ) + ((str-load (-> obj load-file) (-> obj load-file-part) (align64 (-> obj heap current)) #x3fc00) + (set! (-> obj status) 'loading) + ) + ) + ) + (('loading) + ;; loading... + (case (str-load-status (&-> obj len)) + (('error) + ;; something went wrong. oh well. + (set! (-> obj status) 'error) + ) + (('busy) + ;; loading. we have nothing to do. + ) + (else + ;; done!! + ;; not sure it is a good idea to assume that this is a success... + (set! (-> obj buf) (align64 (-> obj heap current))) + (set! (-> obj status) 'loaded) + (goto cfg-18) ;; go back and check status again! + ) + ) + ) + (('loaded) + ;; file is loaded. link it and see if we're good + (let ((a0-37 (-> obj buf))) + (set! (-> obj art-group) (the-as art-group (link (the-as pointer a0-37) (-> obj load-file data) (-> obj len) (-> obj heap) 0))) + ) + (let ((s4-0 (-> obj art-group)) + (s3-0 (-> obj load-file)) + ) + (cond + ((not s4-0) + (format 0 "ERROR: art-group ~A part ~D is not a valid file.~%" s3-0 (-> obj load-file-part)) + (set! (-> obj status) 'error) + ) + ((not (type-type? (-> s4-0 type) art-group)) + (format 0 "ERROR: art-group ~A part ~D is not a art-group.~%" s3-0 (-> obj load-file-part)) + (set! (-> obj status) 'error) + ) + ((not (file-info-correct-version? (-> s4-0 info) (file-kind art-group) 0)) + ;;(format 0 "ERROR: art-group ~A part ~D is the wrong version.~%" s3-0 (-> obj load-file-part)) + (set! (-> obj status) 'error) + ) + (else + (dummy-9 s4-0) + (set! (-> obj status) 'locked) ;; make file ready to be used + ) + ) + ) + ) + (('locked) + ;; this buffer is locked and needs to be unlocked before it can be used. + (when (and (not (-> obj locked?)) (handle->process (-> obj load-file-owner))) + ;; we want to be used, unlock this buffer and lock the other just in case. + (link-file obj (-> obj art-group)) + (set! (-> obj other locked?) #t) + (set! (-> obj status) 'active) + (goto cfg-18) + ) + ) + ) + ) + (else + ;; we want to get rid of the file! + (case (-> obj status) + (('initialize) + ;; this was done earlier + ) + (('reserved) + ;; this buffer is reserved + (cond + ((= (-> *art-control* reserve-buffer) obj) ;; yep it's this one! + (set! (-> *art-control* reserve-buffer) #f) + (set! (-> obj status) 'inactive) + ) + (else + (format 0 "ERROR: trying tro free ~A when ~A is reserved~%" obj (-> *art-control* reserve-buffer)) + ) + ) + ) + (('active) + ;; buffer is in use. not anymore! + (unlink-file obj (-> obj art-group)) + (let ((v1-70 (-> obj heap))) + (set! (-> v1-70 current) (-> v1-70 base)) + ) + (set! (-> obj art-group) #f) + (set! (-> obj status) 'inactive) + (when (-> obj other locked?) + (unlock! (-> obj other)) + (update (-> obj other)) + ) + ) + (else + ;; some other scenario, just get rid of the whole thing. + (let ((v1-79 (-> obj heap))) + (set! (-> v1-79 current) (-> v1-79 base)) + ) + (set! (-> obj art-group) #f) + (set! (-> obj status) 'inactive) + ) + ) + ) + ) + 0 + ) + + +;; start loading a spooled anim if we think one is about to be used, e.g. when approaching a fuel cell or npc +;; (some processes may want to wait for the stream to be preloaded, which won't happen with this disabled) +(define *preload-spool-anims* #t) + +(defmethod file-status external-art-control ((obj external-art-control) (name string) (part int)) + "Get the status of a file in this art control. #f = file not found" + + (dotimes (i 2) + (swhen (file-status (-> obj buffer i) name part) + (return bc) + ) + ) + #f + ) + +(defmethod update external-art-control ((obj external-art-control) (debug-print symbol)) + "Update this external-art-control. This validates the spool buffers, sorts the spools, and does some other things. + If debug-print, also prints some text to the display console" + + (if (nonzero? (-> obj reserve-buffer-count)) + (spool-push obj "reserved" 0 *dproc* (if (-> obj reserve-buffer) + -110.0 + -0.5) + ) + ) + (dotimes (v1-5 2) + (set! (-> obj buffer v1-5 frame-lock) #f) ;; I don't know what this is + ) + (dotimes (v1-8 3) + (set! (-> obj rec v1-8 buf2) #f) + ) + (dotimes (s4-0 2) + (let ((s3-0 (-> obj rec s4-0))) + (when (-> s3-0 name) + (dotimes (s2-0 2) + (when (and (file-status (-> obj buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) + (not (-> obj buffer s2-0 frame-lock)) + ) + (set! (-> obj buffer s2-0 frame-lock) #t) + (set! (-> s3-0 buf2) (-> obj buffer s2-0)) + (set! (-> obj buffer s2-0 pending-load-file-owner) (-> s3-0 owner)) + (set! (-> obj buffer s2-0 load-file-owner) (-> s3-0 owner)) + (set! (-> obj buffer s2-0 pending-load-file-priority) (-> s3-0 priority)) + (set! (-> obj buffer s2-0 load-file-priority) (-> s3-0 priority)) + (goto cfg-24) ;; buffer found, move on. + ) + ) + ) + ) + (label cfg-24) + ) + + (dotimes (s4-1 2) + (let ((s3-1 (-> obj rec s4-1))) + (when (and (-> s3-1 name) (not (-> s3-1 buf2))) + (if (and (not *preload-spool-anims*) (>= (-> s3-1 priority) 0.0)) + ;; not in use, move on + (goto cfg-46) + ) + (dotimes (s2-1 2) + (when (not (-> obj buffer s2-1 frame-lock)) + (set! (-> obj buffer s2-1 frame-lock) #t) + (want-file (-> obj buffer s2-1) (-> s3-1 name) (-> s3-1 parts) (-> s3-1 owner) (-> s3-1 priority)) + (set! (-> s3-1 index) (the-as int (-> obj buffer s2-1))) + (goto cfg-46) + ) + ) + ) + ) + (label cfg-46) + ) + + (when (not (-> obj reserve-buffer)) + (let ((s4-2 (-> obj rec 0 buf1))) + (if (and s4-2 + (-> s4-2 locked?) + (not (string= (-> s4-2 pending-load-file) "reserved")) + (not (string= (-> s4-2 other pending-load-file) "reserved")) + ) + (want-file (-> s4-2 other) (the-as string #f) -1 (the-as handle #f) SPOOL_PRIORITY_LOWEST) + ) + ) + ) + + (dotimes (s4-3 2) + (update (-> obj buffer s4-3)) + ) + + ;; sort spool anims. + (let ((s4-4 (the-as spool-anim #f))) + (countdown (s3-2 3) + (if (and (-> obj rec s3-2 name) + (not (name= (-> obj rec s3-2 name) (-> obj active-stream))) + ) + (set! s4-4 (-> obj rec 0)) + ) + ) + (if (and (-> obj preload-stream name) + (or (not s4-4) (< (-> obj preload-stream priority) (-> s4-4 priority))) + ) + (set! s4-4 (-> obj preload-stream)) + ) + (cond + (s4-4 + (mem-copy! (&-> (-> obj last-preload-stream) type) (&-> s4-4 type) (size-of spool-anim)) + (str-play-queue (-> s4-4 name)) + ) + (else + (set! (-> obj last-preload-stream name) #f) + (set! (-> obj last-preload-stream owner) (the-as handle #f)) + ) + ) + ) + + (when (and debug-print *display-art-control*) + (dotimes (s5-1 3) + (format *stdcon* "rec ~d ~S ~D ~f ~A~%" s5-1 (-> obj rec s5-1 name) (-> obj rec s5-1 parts) (-> obj rec s5-1 priority) (handle->name (-> obj rec s5-1 owner))) + ) + (dotimes (s5-2 2) + (format *stdcon* "buf ~d ~C ~S ~D ~A ~A~%" s5-2 (if (-> obj buffer s5-2 locked?) #\l #\\s) (-> obj buffer s5-2 pending-load-file) (-> obj buffer s5-2 pending-load-file-part) (-> obj buffer s5-2 status) (handle->name (-> obj buffer s5-2 pending-load-file-owner))) + ) + (format *stdcon* " a: ~S~%" (-> obj active-stream)) + (format *stdcon* " p: ~S ~A~%" (-> obj preload-stream name) (handle->name (-> obj preload-stream owner))) + (format *stdcon* " q: ~S ~A~%" (-> obj last-preload-stream name) (handle->name (-> obj last-preload-stream owner))) + ) + 0 + ) + +(defmethod none-reserved? external-art-control ((obj external-art-control)) + "are there any reserved buffers?" + (declare (inline)) + (zero? (-> obj reserve-buffer-count)) + ) + +(defmethod reserve-alloc external-art-control ((obj external-art-control)) + "Reserve a buffer!" + + (set! (-> obj reserve-buffer-count) 1) + (if (-> obj reserve-buffer) + (-> obj reserve-buffer heap) + ) + ) + +(defmethod reserve-free external-art-control ((obj external-art-control) (arg0 kheap)) + "Free the reserved buffer!" + + (cond + ((none-reserved? obj) + (format 0 "ERROR: illegal attempt to free a buffer #x~X which had not been reserved (none reserved).~%" arg0) + ) + ((not (-> obj reserve-buffer)) + (set! (-> obj reserve-buffer-count) 0) + ) + ((= (-> obj reserve-buffer heap) arg0) + (want-file (-> obj reserve-buffer) (the-as string #f) -1 (the-as handle #f) SPOOL_PRIORITY_LOWEST) + (update (-> obj reserve-buffer)) + (set! (-> obj reserve-buffer-count) 0) + ) + (else + (format 0 "ERROR: illegal attempt to free a buffer #x~X which had not been reserved (buffer unknown).~%" arg0) + ) + ) + 0 + ) + +(defmethod clear-rec external-art-control ((obj external-art-control)) + "Clears the recent spool anims from the art control." + + (cond + ((!= *master-mode* 'game) + (dotimes (s5-0 3) + (when (name= (-> obj rec s5-0 name) "reserved") + (case s5-0 + ((0) + (mem-copy! (&-> obj rec 0 type) (&-> obj rec 1 type) (size-of spool-anim)) + (mem-copy! (&-> obj rec 1 type) (&-> obj rec 2 type) (size-of spool-anim)) + ) + ((1) + (mem-copy! (&-> obj rec 1 type) (&-> obj rec 2 type) (size-of spool-anim)) + ) + ) + (set! (-> obj rec 2 type) spool-anim) + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ) + ) + (else + (dotimes (v1-19 3) + (set! (-> obj rec v1-19 type) spool-anim) + (set! (-> obj rec v1-19 name) #f) + (set! (-> obj rec v1-19 priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj rec v1-19 owner) (the-as handle #f)) + ) + (set! (-> obj preload-stream type) spool-anim) + (set! (-> obj preload-stream name) #f) + (set! (-> obj preload-stream priority) SPOOL_PRIORITY_LOWEST) + (set! (-> obj preload-stream owner) (the-as handle #f)) + ) + ) + 0 + ) + +(defmacro spool-calc-priority (priority proc) + "Check the priority of a spool anim and recalculate it if needed. It will be the same as distance between target and the requesting process. + priority = var that stores priority + proc = a process to recalc from" + `(when (and (= ,priority SPOOL_PRIORITY_RECALC) ,proc) + (let ((target-trans (target-pos 0))) + (set! ,priority (vector-vector-distance target-trans (-> (the-as process-drawable ,proc) root trans))) + ) + ) + ) + +(defmethod try-preload-stream external-art-control ((obj external-art-control) (arg0 string) (arg1 int) (arg2 process) (arg3 float)) + "Set a new stream to be preloaded, if appropriate." + + (spool-calc-priority arg3 arg2) + + (unless (and (-> obj preload-stream name) + (>= arg3 (-> obj preload-stream priority)) + ) + (set! (-> obj preload-stream name) arg0) + (set! (-> obj preload-stream parts) arg1) + (set! (-> obj preload-stream priority) arg3) + (set! (-> obj preload-stream owner) (process->handle arg2)) + ) + 0 + ) + +(defmethod spool-push external-art-control ((obj external-art-control) (name string) (part int) (proc process) (priority float)) + "Push a spool-anim to the spool array. There are only space for three, and only the three highest priority spool anims will be kept. (lowest priority = top)" + + (spool-calc-priority priority proc) + + ;; if this spool-anim already exists, pop it from the rec list + (cond + ((and (= part (-> obj rec 0 parts)) (name= name (-> obj rec 0 name))) + (if (>= priority (-> obj rec 0 priority)) + (return (the-as int #f)) + ) + ;; first spool. copy 1st <- 2nd and 2nd <- 3rd, 3rd will be wiped + (mem-copy! (&-> obj rec 0 type) (&-> obj rec 1 type) (size-of spool-anim)) + (mem-copy! (&-> obj rec 1 type) (&-> obj rec 2 type) (size-of spool-anim)) + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ((and (= part (-> obj rec 1 parts)) (name= name (-> obj rec 1 name))) + (if (>= priority (-> obj rec 1 priority)) + (return (the-as int #f)) + ) + ;; second spool. copy 2nd <- 3rd, 3rd will be wiped + (mem-copy! (&-> obj rec 1 type) (&-> obj rec 2 type) (size-of spool-anim)) + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ((and (= part (-> obj rec 2 parts)) (name= name (-> obj rec 2 name))) + (if (>= priority (-> obj rec 2 priority)) + (return (the-as int #f)) + ) + ;; third spool. 3rd will be wiped + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ) + + ;; if it's top 3 priority, push this spool-anim to the rec list + (cond + ((< priority (-> obj rec 0 priority)) + ;; 1st place! + (mem-copy! (&-> obj rec 2 type) (&-> obj rec 1 type) (size-of spool-anim)) + (mem-copy! (&-> obj rec 1 type) (&-> obj rec 0 type) (size-of spool-anim)) + (set! (-> obj rec 0 name) name) + (set! (-> obj rec 0 parts) part) + (set! (-> obj rec 0 priority) priority) + (set! (-> obj rec 0 owner) (process->handle proc)) + ) + ((< priority (-> obj rec 1 priority)) + ;; 2nd place. + (mem-copy! (&-> obj rec 2 type) (&-> obj rec 1 type) (size-of spool-anim)) + (set! (-> obj rec 1 name) name) + (set! (-> obj rec 1 parts) part) + (set! (-> obj rec 1 priority) priority) + (set! (-> obj rec 1 owner) (process->handle proc)) + ) + ((< priority (-> obj rec 2 priority)) + ;; 3rd place... + (set! (-> obj rec 2 name) name) + (set! (-> obj rec 2 parts) part) + (set! (-> obj rec 2 priority) priority) + (set! (-> obj rec 2 owner) (process->handle proc)) + ) + ) + 0 + ) + +(defun-extern level-hint-surpress! none) ;; ? +(defun-extern ja-channel-push! int int int) ;; TODO temp +(defun-extern ja-channel-set! int int) ;; TODO temp +(defun-extern joint-control-channel-group-eval! joint-control-channel art-joint-anim (function joint-control-channel float float float) int) ;; TODO temp +(defun-extern joint-control-channel-group! joint-control-channel art-joint-anim (function joint-control-channel float float float) int) ;; TODO temp +(defun-extern ja-aframe-num int float) ;; TODO temp + +(define-extern ja-abort-spooled-anim (function spool-anim art-joint-anim int int :behavior process-drawable)) +(defbehavior ja-play-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 art-joint-anim) (arg3 (function process-drawable symbol))) + "Set up and start playing a spooled animation. details not understood yet." + + (let ((spool-part 0) + (sv-24 -17.0) + (old-skel-status (-> self skel status)) + (sv-32 -2) + (sv-40 0) + (sv-48 0) + (sv-56 0) + (spool-sound (new-sound-id)) + ) + (dummy-17 *load-state* (-> arg0 command-list)) + (set-setting! *setting-control* self 'spooling (the-as symbol (process->ppointer self)) 0.0 0) + (logior! (-> self skel status) #x7) + (kill-current-level-hint '() '() 'die) + (level-hint-surpress!) + (copy-settings-from-target! *setting-control*) + ;; the spool lock is active (or we're not in game mode for some reason?) + (when (or (handle->process (-> *art-control* spool-lock)) + (!= *master-mode* 'game) + ) + (cond + (arg1 + (when (!= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + arg1 + ) + (ja-channel-push! 1 15) + ;; TODO macro + (let ((s2-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! s2-0 arg1 num-func-identity) + (set! (-> s2-0 frame-num) 0.0) + ) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (while (or (handle->process (-> *art-control* spool-lock)) + (!= *master-mode* 'game) + ) + (format #t "WARNING: ---------------------> loader stall on lock~%") + (if (arg3 self) + (goto anim-abort) + ) + (spool-push *art-control* (-> arg0 name) spool-part self -9.0) + (suspend) + (when arg1 + ;; TODO macro + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) 1.0) + (joint-control-channel-group-eval! a0-17 (the-as art-joint-anim #f) num-func-loop!) + ) + ) + ) + ) + (set! (-> *art-control* spool-lock) (process->handle self)) + (set! sv-48 (the-as int (-> *display* base-frame-counter))) + (while (< spool-part (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (update *art-control* #f) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (cond + (arg1 + (when (!= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + arg1 + ) + (ja-channel-set! 1) + (let ((s2-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! s2-2 arg1 num-func-identity) + (set! (-> s2-2 frame-num) 0.0) + ) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (if (arg3 self) + (goto anim-abort) + ) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part) + (suspend) + (when arg1 + (let ((a0-37 (-> self skel root-channel 0))) + (set! (-> a0-37 param 0) 1.0) + (joint-control-channel-group-eval! a0-37 (the-as art-joint-anim #f) num-func-loop!) + ) + ) + ) + ) + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (let ((s2-4 (the-as art-joint-anim (dummy-10 (-> self draw art-group) (-> arg0 name) art-joint-anim)))) + (cond + (s2-4 + (ja-channel-set! 1) + (let ((a0-42 (-> self skel root-channel 0))) + (set! (-> a0-42 frame-group) s2-4) + (set! (-> a0-42 param 0) (the float (+ (-> s2-4 data 0 length) -1))) + (set! (-> a0-42 param 1) 1.0) + (set! (-> a0-42 frame-num) 0.0) + (joint-control-channel-group! a0-42 s2-4 num-func-seek!) + ) + (when (zero? spool-part) + (str-play-async (-> arg0 name) spool-sound) + (set! (-> *art-control* active-stream) (-> arg0 name)) + ) + (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) + (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))) + (sv-72 (current-str-pos spool-sound)) + ) + (set! sv-40 (the-as int (-> *display* base-frame-counter))) + ;; uhh... + (until (begin + (spool-push *art-control* (-> arg0 name) spool-part self -20.0) + (cond + ((< (1+ spool-part) (-> arg0 parts)) + (spool-push *art-control* (-> arg0 name) (1+ spool-part) self -10.0) + ) + (else + (logclear! (-> self skel status) #x4) + ) + ) + (dummy-16 *load-state* (ja-aframe-num 0)) + (cond + ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) + (+! sv-56 (the-as int (- (-> *display* base-frame-counter) (-> *display* old-base-frame-counter)))) + (set! sv-40 (the-as int (-> *display* base-frame-counter))) + ) + (else + 0 + ) + ) + (set! sv-32 sv-72) + (set! sv-48 (the-as int (-> *display* base-frame-counter))) + (suspend) + (let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0)) + (a0-69 (-> self skel root-channel 0)) + ) + (set! (-> a0-69 param 0) (the float (+ (-> a0-69 frame-group data 0 length) -1))) + (set! (-> a0-69 param 1) 1.0) + (set! (-> a0-69 frame-num) f0-14) + (joint-control-channel-group! a0-69 (the-as art-joint-anim #f) num-func-seek!) + ) + (let ((v0-39 (current-str-pos spool-sound))) + (set! sv-72 v0-39) + (>= (the float v0-39) f28-0) + ) + ) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (logior! (-> self skel status) #x20) + ) + (if (or (arg3 self) + (and (<= sv-72 0) + (>= (the-as int (- (-> *display* base-frame-counter) sv-40)) (seconds 4)) + ) + (and (< (seconds 1) sv-56) (<= sv-72 0)) + ) + (goto anim-abort) + ) + ) + (set! sv-24 f28-0) + ) + (logclear! (-> self skel status) #x20) + ) + (else + (format 0 "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part) + (goto anim-abort) + ) + ) + ) + (1+! spool-part) + ) + (1-! spool-part) + (label anim-abort) + (ja-abort-spooled-anim arg0 arg2 spool-part) + ) + 0 + ) + +(defbehavior ja-abort-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 int)) + "Abort a spooled animation." + + (dummy-18 *load-state*) + (str-play-stop (-> arg0 name)) + (set! (-> *art-control* active-stream) #f) + (logclear! (-> self skel status) #x6) ;; #x4 and #x2 + (if (not (logtest? (-> self skel status) 1)) + (logclear! (-> self skel status) #x1) + ) + (clear-pending-settings-from-process *setting-control* self 'spooling) + (cond + ((and arg1 (>= arg2 0)) + (ja-channel-push! 1 30) + (set! (-> self skel root-channel 0 frame-group) arg1) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (spool-push *art-control* (-> arg0 name) arg2 self -20.0) + (suspend) + ;; TODO macro + (let ((a0-12 (-> self skel root-channel 0))) + (set! (-> a0-12 param 0) (the float (+ (-> a0-12 frame-group data 0 length) -1))) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! a0-12 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (set! (-> *art-control* spool-lock) (the-as handle #f)) + 0 + ) + +(if (zero? *art-control*) + (set! *art-control* (new 'global 'external-art-control)) + ) + diff --git a/goal_src/engine/math/math.gc b/goal_src/engine/math/math.gc index 8a62fd311b..39d8c58b73 100644 --- a/goal_src/engine/math/math.gc +++ b/goal_src/engine/math/math.gc @@ -139,6 +139,15 @@ ) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; utility macros +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defmacro seek! (place target rate) + "Macro to use seek in-place. place is the target, and where the result is stored." + `(set! ,place (seek ,place ,target ,rate)) + ) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; integer utility ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/engine/math/vector.gc b/goal_src/engine/math/vector.gc index a222ac787b..3d21932e0d 100644 --- a/goal_src/engine/math/vector.gc +++ b/goal_src/engine/math/vector.gc @@ -505,17 +505,17 @@ (defun vector-seconds ((arg0 vector) (arg1 vector)) "Convert from actual seconds to the seconds unit." - (set! (-> arg0 data 0) (seconds (-> arg1 data 0))) - (set! (-> arg0 data 1) (seconds (-> arg1 data 1))) - (set! (-> arg0 data 2) (seconds (-> arg1 data 2))) + (set! (-> arg0 data 0) (fsec (-> arg1 data 0))) + (set! (-> arg0 data 1) (fsec (-> arg1 data 1))) + (set! (-> arg0 data 2) (fsec (-> arg1 data 2))) arg0 ) (defun vector-seconds! ((arg0 vector)) "Convert from actual seconds to seconds, in place" - (set! (-> arg0 data 0) (seconds (-> arg0 data 0))) - (set! (-> arg0 data 1) (seconds (-> arg0 data 1))) - (set! (-> arg0 data 2) (seconds (-> arg0 data 2))) + (set! (-> arg0 data 0) (fsec (-> arg0 data 0))) + (set! (-> arg0 data 1) (fsec (-> arg0 data 1))) + (set! (-> arg0 data 2) (fsec (-> arg0 data 2))) arg0 ) diff --git a/goal_src/engine/nav/navigate-h.gc b/goal_src/engine/nav/navigate-h.gc index 48d1a2df07..ca543f6375 100644 --- a/goal_src/engine/nav/navigate-h.gc +++ b/goal_src/engine/nav/navigate-h.gc @@ -9,6 +9,13 @@ :bitfield #t :type uint32 (display-marks 0) + (bit1 1) + (bit2 2) + (bit3 3) + (bit4 4) + (bit5 5) + (bit6 6) + (bit7 7) (bit8 8) (bit13 13) ) diff --git a/goal_src/engine/sound/gsound-h.gc b/goal_src/engine/sound/gsound-h.gc index 662275512c..1ba7b63641 100644 --- a/goal_src/engine/sound/gsound-h.gc +++ b/goal_src/engine/sound/gsound-h.gc @@ -374,7 +374,7 @@ :flag-assert #x90000004c ) -(define *current-sound-id* (the sound-id 65536)) +(define *current-sound-id* (the sound-id #x10000)) (deftype ambient-sound (basic) ((spec sound-spec :offset-assert 4) diff --git a/goal_src/engine/sound/gsound.gc b/goal_src/engine/sound/gsound.gc index 8be34f29be..d3c269c4b9 100644 --- a/goal_src/engine/sound/gsound.gc +++ b/goal_src/engine/sound/gsound.gc @@ -19,20 +19,20 @@ ) (deftype sound-iop-info (basic) - ((frame uint32 :offset 16) - (strpos int32 :offset-assert 20) - (str-id uint32 :offset-assert 24) - (str-id-sign int32 :offset 24) - (freemem uint32 :offset-assert 28) - (chinfo uint8 48 :offset-assert 32) - (freemem2 uint32 :offset-assert 80) - (nocd uint32 :offset-assert 84) - (dirtycd uint32 :offset-assert 88) - (diskspeed uint32 2 :offset-assert 92) - (lastspeed uint32 :offset-assert 100) - (dupseg int32 :offset-assert 104) - (times uint32 41 :offset-assert 108) - (times-seq uint32 :offset-assert 272) + ((frame uint32 :offset 16) + (strpos int32 :offset-assert 20) + (str-id sound-id :offset-assert 24) + (str-id-sign int32 :offset 24) + (freemem uint32 :offset-assert 28) + (chinfo uint8 48 :offset-assert 32) + (freemem2 uint32 :offset-assert 80) + (nocd uint32 :offset-assert 84) + (dirtycd uint32 :offset-assert 88) + (diskspeed uint32 2 :offset-assert 92) + (lastspeed uint32 :offset-assert 100) + (dupseg int32 :offset-assert 104) + (times uint32 41 :offset-assert 108) + (times-seq uint32 :offset-assert 272) ) :method-count-assert 9 :size-assert #x114 @@ -50,10 +50,10 @@ (defun current-str-id () "Return id of the current stream" - (-> *sound-iop-info* str-id-sign) + (the-as sound-id (-> *sound-iop-info* str-id-sign)) ) -(defun current-str-pos ((str int)) +(defun current-str-pos ((str sound-id)) "Return position of the current stream. Return -1 if specified stream is not current" (let ((ret -1)) @@ -886,7 +886,7 @@ 3 : to-maincave 4 : to-snow 5 : sage-green -6 : voicebox +6 : assistant 7 : birdlady 8 : mayor 9 : sculptor diff --git a/goal_src/engine/target/logic-target.gc b/goal_src/engine/target/logic-target.gc index f8ce580814..349829350f 100644 --- a/goal_src/engine/target/logic-target.gc +++ b/goal_src/engine/target/logic-target.gc @@ -10,6 +10,8 @@ (defun init-target ((cont continue-point)) "NOTHING11!!!!" + (looping-code) + (the object 0) ) diff --git a/goal_src/engine/target/target-h.gc b/goal_src/engine/target/target-h.gc index 2ad577faac..9ebc5d3b74 100644 --- a/goal_src/engine/target/target-h.gc +++ b/goal_src/engine/target/target-h.gc @@ -47,7 +47,7 @@ (deftype sidekick (process-drawable) ((control control-info :offset 112) (anim-seed uint64 :offset 192) - (shadow-in-movie? basic :offset-assert 200) + (shadow-in-movie? symbol :offset-assert 200) ) :heap-base #x60 :method-count-assert 20 diff --git a/goal_src/engine/ui/progress/progress-static.gc b/goal_src/engine/ui/progress/progress-static.gc index e46c803651..87e8752041 100644 --- a/goal_src/engine/ui/progress/progress-static.gc +++ b/goal_src/engine/ui/progress/progress-static.gc @@ -1360,13 +1360,14 @@ ) ) +;; goes down by 24 or 23 every time (define *task-egg-starting-x* (new 'static 'boxed-array :type int32 :length 9 :allocated-length 9 - #xda - #xc2 - #xab - #x93 - #x7c + 218 + 194 + 171 + 147 + 124 100 77 53 diff --git a/goal_src/engine/util/types-h.gc b/goal_src/engine/util/types-h.gc index e63366bfc0..1e1554bf9b 100644 --- a/goal_src/engine/util/types-h.gc +++ b/goal_src/engine/util/types-h.gc @@ -33,7 +33,8 @@ (defmacro meters (x) "Convert number to meters. If the input is a constant float or integer, the result will be a - compile time constant float. Otherwise, it will not be constant." + compile time constant float. Otherwise, it will not be constant. + Returns float." ;; we don't have enough constant propagation for the compiler to figure this out. (cond @@ -55,6 +56,7 @@ ;; quickly by converting to an int, masking, and back to float (defglobalconstant DEGREES_PER_ROT 65536.0) +;; this was deg in GOAL (defmacro degrees (x) "Convert number to degrees unit. Will keep a constant float/int constant." @@ -76,15 +78,27 @@ ;; an unsigned 32-bit integer can store about 150 days (defglobalconstant TICKS_PER_SECOND 300) ;; 5 t/frame @ 60fps, 6 t/frame @ 50fps +;; this was usec in GOAL (defmacro seconds (x) - "Convert number to seconds unit." + "Convert number to seconds unit. + Returns uint." (cond - ((float? x) - (* 1.0 TICKS_PER_SECOND x) - ) - ((integer? x) + ((or (integer? x) (float? x)) (* TICKS_PER_SECOND x) ) + (#t + `(the uint (* TICKS_PER_SECOND ,x)) + ) + ) + ) + +(defmacro fsec (x) + "Convert number to seconds unit. + Returns float." + (cond + ((or (integer? x) (float? x)) + (* 1.0 TICKS_PER_SECOND x) + ) (#t `(* 1.0 TICKS_PER_SECOND ,x) ) diff --git a/goal_src/goal-lib.gc b/goal_src/goal-lib.gc index 4f69000dcf..94483713c5 100644 --- a/goal_src/goal-lib.gc +++ b/goal_src/goal-lib.gc @@ -301,7 +301,8 @@ ) (defmacro dotimes (var &rest body) - "Loop like for (int i = 0; i < end; i++)" + "Loop like for (int i = 0; i < end; i++) + var is a list made up of a variable to bind the amount to (second item), and the remaining forms are evaluated after the loop is finished." `(let (( ,(first var) 0)) (while (< ,(first var) ,(second var)) ,@body @@ -488,14 +489,30 @@ `(set! ,place (logxor ,place ,amount)) ) -(defmacro lognor! (place amount) - `(set! ,place (lognor ,place ,amount)) - ) - (defmacro logand! (place amount) `(set! ,place (logand ,place ,amount)) ) +(defmacro logclear (a b) + "Returns the result of setting the bits in b to zero in a" + `(logand (lognot ,b) ,a) + ) + +(defmacro logclear! (a b) + "Sets the bits in b to zero in a, in place" + `(set! ,a (logand (lognot ,b) ,a)) + ) + +(defmacro logtest? (a b) + "does a have any of the bits in b?" + `(nonzero? (logand ,a ,b)) + ) + +(defmacro logtesta? (a b) + "does a have ALL of the bits in b?" + `(= (logand ,a ,b) ,b) + ) + (defmacro deref (t addr &rest fields) `(-> (the-as (pointer ,t) ,addr) ,@fields) ) diff --git a/goal_src/kernel-defs.gc b/goal_src/kernel-defs.gc index 5ad5df8681..75b040f58c 100644 --- a/goal_src/kernel-defs.gc +++ b/goal_src/kernel-defs.gc @@ -243,7 +243,7 @@ (new (symbol type basic) _type_ 0) (activate (_type_ process-tree basic pointer) process-tree 9) (deactivate (_type_) none 10) - (dummy-method-11 () none 11) + (dummy-method-11 (_type_ object) none 11) (run-logic? (_type_) symbol 12) (dummy-method () none 13) ) diff --git a/goal_src/kernel/gkernel-h.gc b/goal_src/kernel/gkernel-h.gc index 9c2fa5f505..151bdf80a7 100644 --- a/goal_src/kernel/gkernel-h.gc +++ b/goal_src/kernel/gkernel-h.gc @@ -118,12 +118,12 @@ (allow-to-run process-mask :offset-assert 12) (next-pid int32 :offset-assert 16) (fast-stack-top pointer :offset-assert 20) - (current-process basic :offset-assert 24) + (current-process process :offset-assert 24) (relocating-process basic :offset-assert 28) (relocating-min int32 :offset-assert 32) (relocating-max int32 :offset-assert 36) (relocating-offset int32 :offset-assert 40) - (low-memory-message basic :offset-assert 44) + (low-memory-message symbol :offset-assert 44) ) :size-assert #x30 @@ -212,7 +212,7 @@ (new (symbol type basic) _type_ 0) (activate (_type_ process-tree basic pointer) process-tree 9) (deactivate (_type_) none 10) - (dummy-method-11 () none 11) + (dummy-method-11 (_type_ object) none 11) (run-logic? (_type_) symbol 12) (dummy-method () none 13) ) @@ -236,7 +236,7 @@ (state state :offset-assert #x38) (trans-hook function :offset-assert #x3c) (post-hook function :offset-assert #x40) - (event-hook (function basic int basic event-message-block object) :offset-assert #x44) + (event-hook (function process int symbol event-message-block object) :offset-assert #x44) (allocated-length int32 :offset-assert #x48) (next-state state :offset-assert #x4c) (heap-base pointer :offset-assert #x50) @@ -251,7 +251,7 @@ (new (symbol type basic int) _type_ 0) (activate (_type_ process-tree basic pointer) process-tree 9) (deactivate (process) none 10) - (dummy-method-11 () none 11) + (dummy-method-11 (_type_ object) none 11) (run-logic? (process) symbol 12) (dummy-method () none 13) ) @@ -447,14 +447,14 @@ (trans (function object) :offset-assert 20) (post function :offset-assert 24) (enter (function object object object object object object object) :offset-assert 28) - (event (function basic int basic event-message-block object) :offset-assert 32) + (event (function process int symbol event-message-block object) :offset-assert 32) ) (:methods (new (symbol type basic function (function object) (function object object object object object object object) (function object) - (function basic int basic event-message-block object)) _type_ 0) + (function process int symbol event-message-block object)) _type_ 0) ) :method-count-assert 9 :size-assert #x24 @@ -464,10 +464,10 @@ ;; Not sure what this is, but it's probably used in the event system. (deftype event-message-block (structure) - ((to basic :offset-assert 0) - (from basic :offset-assert 4) + ((to process :offset-assert 0) + (from process :offset-assert 4) (num-params int32 :offset-assert 8) - (message basic :offset-assert 12) + (message symbol :offset-assert 12) (param uint64 7 :offset-assert 16) ) @@ -571,3 +571,21 @@ `(define ,name (lambda :name ,name :behavior ,process-type ,bindings ,@body)) ) ) + +(defmacro handle->name (handle) + "get the name of a process using a handle. #f is the result if the handle was invalid." + + (with-gensyms (proc) + `(let ((proc (handle->process ,handle))) + (if proc + (-> proc name) + ) + ) + ) + ) + + +(defmacro with-sp (&rest body) + `(rlet ((sp :reg rsp :reset-here #t :type pointer)) + ,@body) + ) diff --git a/goal_src/kernel/gstate.gc b/goal_src/kernel/gstate.gc index 23cb1b23e5..915d48f04d 100644 --- a/goal_src/kernel/gstate.gc +++ b/goal_src/kernel/gstate.gc @@ -144,16 +144,16 @@ There are several ways to "go" (trans (function object)) (enter (function object object object object object object object)) (exit (function object)) - (event (function basic int basic event-message-block object))) + (event (function process int symbol event-message-block object))) "Allocate a new state. It seems like this isn't really used much and most states are statically allocated and as a result don't have the constructor called." (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> obj name) name) - (set! (-> obj next) '#f) + (set! (-> obj next) #f) (set! (-> obj exit) exit) (set! (-> obj code) code) (set! (-> obj trans) trans) - (set! (-> obj post) '#f) + (set! (-> obj post) #f) (set! (-> obj enter) enter) (set! (-> obj event) event) obj @@ -318,6 +318,8 @@ There are several ways to "go" ) (defun send-event-function ((proc process) (msg event-message-block)) + "Function to send an event to a process. Please use the send-event macros when possible" + (with-pp (when (and proc (!= (-> proc type) process-tree) (-> proc event-hook)) (let ((pp-backup pp)) @@ -332,6 +334,8 @@ There are several ways to "go" ) (defmacro send-event (proc msg &rest params) + "Send an event to a process. This should be used over send-event-function" + `(with-pp (let ((event-data (new 'stack-no-clear 'event-message-block))) (set! (-> event-data from) pp) diff --git a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc index 8533f1126c..41ed8c75f4 100644 --- a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc @@ -389,17 +389,17 @@ ;; definition of type collide-shape (deftype collide-shape (trsqv) - ((process process :offset-assert 140) - (max-iteration-count uint8 :offset-assert 144) - (nav-flags uint8 :offset-assert 145) - (pad-byte uint8 2 :offset-assert 146) - (pat-ignore-mask pat-surface :offset-assert 148) - (event-self basic :offset-assert 152) - (event-other basic :offset-assert 156) - (root-prim basic :offset-assert 160) - (riders basic :offset-assert 164) - (backup-collide-as uint64 :offset-assert 168) - (backup-collide-with uint64 :offset-assert 176) + ((process process :offset-assert 140) + (max-iteration-count uint8 :offset-assert 144) + (nav-flags uint8 :offset-assert 145) + (pad-byte uint8 2 :offset-assert 146) + (pat-ignore-mask pat-surface :offset-assert 148) + (event-self basic :offset-assert 152) + (event-other basic :offset-assert 156) + (root-prim collide-shape-prim :offset-assert 160) + (riders basic :offset-assert 164) + (backup-collide-as uint64 :offset-assert 168) + (backup-collide-with uint64 :offset-assert 176) ) :method-count-assert 56 :size-assert #xb8 diff --git a/test/decompiler/reference/engine/data/art-h_REF.gc b/test/decompiler/reference/engine/data/art-h_REF.gc index 87141b9679..a44a525ac3 100644 --- a/test/decompiler/reference/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/engine/data/art-h_REF.gc @@ -296,8 +296,8 @@ :size-assert #x20 :flag-assert #xf00000020 (:methods - (dummy-13 (_type_) int 13) - (dummy-14 (_type_) int 14) + (link-art! (_type_) art-group 13) + (unlink-art! (_type_) int 14) ) ) diff --git a/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc b/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc index 0fb4456247..bc72f1cf57 100644 --- a/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc +++ b/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc @@ -36,12 +36,12 @@ ) ;; definition for function num-func-none -(defun num-func-none ((arg0 joint-control-channel)) +(defun num-func-none ((arg0 joint-control-channel) (arg1 float) (arg2 float)) (-> arg0 frame-num) ) ;; definition for function num-func-+! -(defun num-func-+! ((arg0 joint-control-channel) (arg1 float)) +(defun num-func-+! ((arg0 joint-control-channel) (arg1 float) (arg2 float)) (let ((f0-1 (+ @@ -56,7 +56,7 @@ ) ;; definition for function num-func--! -(defun num-func--! ((arg0 joint-control-channel) (arg1 float)) +(defun num-func--! ((arg0 joint-control-channel) (arg1 float) (arg2 float)) (let ((f0-1 (- @@ -71,7 +71,7 @@ ) ;; definition for function num-func-loop! -(defun num-func-loop! ((chan joint-control-channel) (inc float)) +(defun num-func-loop! ((chan joint-control-channel) (inc float) (arg2 float)) (let* ((duration (the float (+ (-> chan frame-group data 0 length) -1))) (after-inc (+ @@ -112,7 +112,9 @@ ) ;; definition for function num-func-blend-in! -(defun num-func-blend-in! ((arg0 joint-control-channel) (arg1 float)) +(defun + num-func-blend-in! + ((arg0 joint-control-channel) (arg1 float) (arg2 float)) (let ((f30-0 (seek (-> arg0 frame-interp) 1.0 (* arg1 (-> *display* time-adjust-ratio))) @@ -128,7 +130,7 @@ ) ;; definition for function num-func-chan -(defun num-func-chan ((arg0 joint-control-channel) (arg1 float)) +(defun num-func-chan ((arg0 joint-control-channel) (arg1 float) (arg2 float)) (let ((f0-2 (-> @@ -149,7 +151,7 @@ ) ;; definition for function num-func-identity -(defun num-func-identity ((arg0 joint-control-channel)) +(defun num-func-identity ((arg0 joint-control-channel) (arg1 float) (arg2 float)) (-> arg0 frame-num) ) diff --git a/test/decompiler/reference/engine/entity/actor-link-h_REF.gc b/test/decompiler/reference/engine/entity/actor-link-h_REF.gc index 72eed8ea89..f4dd4a2b94 100644 --- a/test/decompiler/reference/engine/entity/actor-link-h_REF.gc +++ b/test/decompiler/reference/engine/entity/actor-link-h_REF.gc @@ -79,12 +79,12 @@ (apply-function-forward (_type_ (function entity-actor object object) object) int 16) (apply-function-reverse (_type_ (function entity-actor object object) object) int 17) (apply-all (_type_ (function entity-actor object object) object) int 18) - (send-to-all (_type_ object) none 19) - (send-to-all-after (_type_ object) object 20) - (send-to-all-before (_type_ object) object 21) - (send-to-next-and-prev (_type_ object) none 22) - (send-to-next (_type_ object) none 23) - (send-to-prev (_type_ object) none 24) + (send-to-all (_type_ symbol) none 19) + (send-to-all-after (_type_ symbol) object 20) + (send-to-all-before (_type_ symbol) object 21) + (send-to-next-and-prev (_type_ symbol) none 22) + (send-to-next (_type_ symbol) none 23) + (send-to-prev (_type_ symbol) none 24) (actor-count (_type_) int 25) ) ) @@ -236,7 +236,7 @@ (defmethod send-to-all-after actor-link-info - ((obj actor-link-info) (message object)) + ((obj actor-link-info) (message symbol)) (with-pp (let ((iter (-> obj next)) (result (the-as object #f)) @@ -247,7 +247,7 @@ (let ((msg-block (new 'stack-no-clear 'event-message-block))) (set! (-> msg-block from) pp) (set! (-> msg-block num-params) 0) - (set! (-> msg-block message) (the-as basic message)) + (set! (-> msg-block message) message) (let ((v1-3 (send-event-function proc msg-block))) (b! v1-3 cfg-4 :likely-delay (set! result v1-3)) ) @@ -266,7 +266,7 @@ (defmethod send-to-all-before actor-link-info - ((obj actor-link-info) (arg0 object)) + ((obj actor-link-info) (arg0 symbol)) (with-pp (let ((s4-0 (-> obj prev)) (s5-0 (the-as object #f)) @@ -277,7 +277,7 @@ (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) pp) (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) (the-as basic arg0)) + (set! (-> a1-1 message) arg0) (let ((v1-3 (send-event-function a0-1 a1-1))) (b! v1-3 cfg-4 :likely-delay (set! s5-0 v1-3)) ) @@ -294,7 +294,7 @@ ;; definition for method 23 of type actor-link-info ;; INFO: Return type mismatch int vs none. -(defmethod send-to-next actor-link-info ((obj actor-link-info) (arg0 object)) +(defmethod send-to-next actor-link-info ((obj actor-link-info) (arg0 symbol)) (with-pp (let ((a0-1 (-> obj next))) (when a0-1 @@ -303,7 +303,7 @@ (let ((v1-4 (new 'stack-no-clear 'event-message-block))) (set! (-> v1-4 from) pp) (set! (-> v1-4 num-params) 0) - (set! (-> v1-4 message) (the-as basic arg0)) + (set! (-> v1-4 message) arg0) (send-event-function a0-2 v1-4) ) ) @@ -317,7 +317,7 @@ ;; definition for method 24 of type actor-link-info ;; INFO: Return type mismatch int vs none. -(defmethod send-to-prev actor-link-info ((obj actor-link-info) (arg0 object)) +(defmethod send-to-prev actor-link-info ((obj actor-link-info) (arg0 symbol)) (with-pp (let ((a0-1 (-> obj prev))) (when a0-1 @@ -326,7 +326,7 @@ (let ((v1-4 (new 'stack-no-clear 'event-message-block))) (set! (-> v1-4 from) pp) (set! (-> v1-4 num-params) 0) - (set! (-> v1-4 message) (the-as basic arg0)) + (set! (-> v1-4 message) arg0) (send-event-function a0-2 v1-4) ) ) @@ -342,7 +342,7 @@ (defmethod send-to-next-and-prev actor-link-info - ((obj actor-link-info) (arg0 object)) + ((obj actor-link-info) (arg0 symbol)) (send-to-next obj arg0) (send-to-prev obj arg0) (none) @@ -350,7 +350,7 @@ ;; definition for method 19 of type actor-link-info ;; INFO: Return type mismatch object vs none. -(defmethod send-to-all actor-link-info ((obj actor-link-info) (arg0 object)) +(defmethod send-to-all actor-link-info ((obj actor-link-info) (arg0 symbol)) (send-to-all-after obj arg0) (send-to-all-before obj arg0) (none) @@ -490,7 +490,3 @@ incomplete-count ) ) - - - - diff --git a/test/decompiler/reference/engine/entity/entity-h_REF.gc b/test/decompiler/reference/engine/entity/entity-h_REF.gc index 0b3c31483c..12e7e38cef 100644 --- a/test/decompiler/reference/engine/entity/entity-h_REF.gc +++ b/test/decompiler/reference/engine/entity/entity-h_REF.gc @@ -23,8 +23,8 @@ (user-uint8 uint8 8 :offset 0) (status entity-perm-status :offset-assert 8) (dummy uint8 1 :offset-assert 10) - (task uint8 :offset-assert 11) - (aid uint32 :offset-assert 12) + (task game-task :offset-assert 11) + (aid actor-id :offset-assert 12) (quad uint128 :offset 0) ) :pack-me @@ -68,8 +68,8 @@ (trans vector :inline :offset-assert 32) (perm entity-perm :inline :offset-assert 48) (status uint16 :offset 56) - (aid uint32 :offset 60) - (task uint8 :offset 59) + (aid actor-id :offset 60) + (task game-task :offset 59) ) :method-count-assert 10 :size-assert #x40 diff --git a/test/decompiler/reference/engine/game/game-h_REF.gc b/test/decompiler/reference/engine/game/game-h_REF.gc index f781e48454..04155d0695 100644 --- a/test/decompiler/reference/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/engine/game/game-h_REF.gc @@ -7,17 +7,17 @@ (node-list cspace-array :offset-assert 116) (draw draw-control :offset-assert 120) (skel joint-control :offset-assert 124) - (nav basic :offset-assert 128) + (nav nav-control :offset-assert 128) (align align-control :offset-assert 132) - (path basic :offset-assert 136) - (vol basic :offset-assert 140) + (path path-control :offset-assert 136) + (vol vol-control :offset-assert 140) (fact fact-info :offset-assert 144) - (link basic :offset-assert 148) + (link actor-link-info :offset-assert 148) (part sparticle-launch-control :offset-assert 152) (water water-control :offset-assert 156) (sound ambient-sound :offset-assert 160) (state-flags uint32 :offset-assert 164) - (state-time uint64 :offset-assert 168) + (state-time seconds :offset-assert 168) ) :heap-base #x40 :method-count-assert 20 diff --git a/test/decompiler/reference/engine/game/game-info-h_REF.gc b/test/decompiler/reference/engine/game/game-info-h_REF.gc index 1323799562..44acc24d35 100644 --- a/test/decompiler/reference/engine/game/game-info-h_REF.gc +++ b/test/decompiler/reference/engine/game/game-info-h_REF.gc @@ -49,7 +49,7 @@ ;; definition of type level-buffer-state (deftype level-buffer-state (structure) - ((name basic :offset-assert 0) + ((name symbol :offset-assert 0) (display? symbol :offset-assert 4) (force-vis? symbol :offset-assert 8) (force-inside? symbol :offset-assert 12) @@ -89,11 +89,11 @@ (want-display-level (_type_ symbol symbol) int 12) (want-vis (_type_ symbol) int 13) (want-force-vis (_type_ symbol symbol) int 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) + (dummy-15 (_type_ pair) none 15) + (dummy-16 (_type_ float) int 16) + (dummy-17 (_type_ pair) int 17) + (dummy-18 (_type_) int 18) + (dummy-19 (_type_) int 19) (dummy-20 () none 20) ) ) @@ -119,18 +119,18 @@ ;; definition of type continue-point (deftype continue-point (basic) ((name string :offset-assert 4) - (level basic :offset-assert 8) + (level symbol :offset-assert 8) (flags uint32 :offset-assert 12) (trans vector :inline :offset-assert 16) (quat quaternion :inline :offset-assert 32) (camera-trans vector :inline :offset-assert 48) (camera-rot float 9 :offset-assert 64) (load-commands pair :offset-assert 100) - (vis-nick basic :offset-assert 104) - (lev0 basic :offset-assert 108) - (disp0 basic :offset-assert 112) - (lev1 basic :offset-assert 116) - (disp1 basic :offset-assert 120) + (vis-nick symbol :offset-assert 104) + (lev0 symbol :offset-assert 108) + (disp0 symbol :offset-assert 112) + (lev1 symbol :offset-assert 116) + (disp1 symbol :offset-assert 120) ) :method-count-assert 10 :size-assert #x7c @@ -213,7 +213,7 @@ (initialize! (_type_ symbol game-save string) _type_ 9) (adjust (_type_ symbol float handle) float 10) (task-complete? (_type_ game-task) symbol 11) - (lookup-entity-perm-by-aid (_type_ uint) entity-perm 12) + (lookup-entity-perm-by-aid (_type_ actor-id) entity-perm 12) (get-entity-task-perm (_type_ game-task) entity-perm 13) (copy-perms-from-level! (_type_ level) none 14) (copy-perms-to-level! (_type_ level) none 15) diff --git a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc index 759737c39c..556a95506d 100644 --- a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc @@ -3,21 +3,21 @@ ;; definition of type manipy (deftype manipy (process-drawable) - ((new-trans-hook function :offset-assert 176) - (cur-trans-hook function :offset-assert 180) - (cur-event-hook function :offset-assert 184) - (new-joint-anim basic :offset-assert 188) - (new-joint-anim-blend uint64 :offset-assert 192) - (anim-mode basic :offset-assert 200) - (cur-grab-handle uint64 :offset-assert 208) - (cur-target-handle uint64 :offset-assert 216) - (old-grab-pos vector :inline :offset-assert 224) - (joint joint 4 :offset-assert 240) - (new-post-hook function :offset-assert 256) - (cur-post-hook function :offset-assert 260) - (clone-copy-trans basic :offset-assert 264) - (shadow-backup basic :offset-assert 268) - (draw? symbol :offset-assert 272) + ((new-trans-hook function :offset-assert 176) + (cur-trans-hook function :offset-assert 180) + (cur-event-hook function :offset-assert 184) + (new-joint-anim art-joint-anim :offset-assert 188) + (new-joint-anim-blend uint64 :offset-assert 192) + (anim-mode symbol :offset-assert 200) + (cur-grab-handle uint64 :offset-assert 208) + (cur-target-handle uint64 :offset-assert 216) + (old-grab-pos vector :inline :offset-assert 224) + (joint joint 4 :offset-assert 240) + (new-post-hook function :offset-assert 256) + (cur-post-hook function :offset-assert 260) + (clone-copy-trans basic :offset-assert 264) + (shadow-backup basic :offset-assert 268) + (draw? symbol :offset-assert 272) ) :heap-base #xb0 :method-count-assert 20 diff --git a/test/decompiler/reference/engine/game/task/task-control-h_REF.gc b/test/decompiler/reference/engine/game/task/task-control-h_REF.gc index 7b25122601..dbee95ae51 100644 --- a/test/decompiler/reference/engine/game/task/task-control-h_REF.gc +++ b/test/decompiler/reference/engine/game/task/task-control-h_REF.gc @@ -72,7 +72,7 @@ :size-assert #x10 :flag-assert #xc00000010 (:methods - (dummy-9 () none 9) + (dummy-9 (_type_ vector int float process-drawable) none 9) (dummy-10 () none 10) (dummy-11 () none 11) ) @@ -89,10 +89,10 @@ ;; definition of type process-taskable (deftype process-taskable (process-drawable) - ((tasks basic :offset-assert 176) + ((tasks task-control :offset-assert 176) (query gui-query :inline :offset-assert 180) (old-target-pos transformq :inline :offset-assert 208) - (cell-for-task uint8 :offset-assert 256) + (cell-for-task game-task :offset-assert 256) (cell-x uint64 :offset-assert 264) (cam-joint-index int32 :offset-assert 272) (skippable basic :offset-assert 276) @@ -120,39 +120,39 @@ :size-assert #x17c :flag-assert #x350110017c (:methods - (dummy-20 () none 20) - (dummy-21 () none 21) - (dummy-22 () none 22) - (dummy-23 () none 23) - (dummy-24 () none 24) - (dummy-25 () none 25) - (dummy-26 () none 26) - (dummy-27 () none 27) - (dummy-28 () none 28) - (dummy-29 () none 29) - (dummy-30 () none 30) - (dummy-31 () none 31) - (dummy-32 () none 32) - (dummy-33 () none 33) - (dummy-34 () none 34) - (dummy-35 () none 35) - (dummy-36 () none 36) - (dummy-37 () none 37) - (dummy-38 () none 38) - (dummy-39 () none 39) - (dummy-40 () none 40) - (dummy-41 () none 41) - (dummy-42 () none 42) - (dummy-43 () none 43) - (dummy-44 () none 44) - (dummy-45 () none 45) - (dummy-46 () none 46) - (dummy-47 () none 47) - (dummy-48 () none 48) - (dummy-49 () none 49) - (dummy-50 () none 50) - (dummy-51 () none 51) - (dummy-52 () none 52) + (dummy-20 (_type_) none 20) + (dummy-21 (_type_) none 21) + (dummy-22 (_type_) none 22) + (dummy-23 (_type_) none 23) + (dummy-24 (_type_) none 24) + (dummy-25 (_type_) none 25) + (dummy-26 (_type_) none 26) + (dummy-27 (_type_) none 27) + (dummy-28 (_type_) none 28) + (dummy-29 (_type_) none 29) + (dummy-30 (_type_) none 30) + (dummy-31 (_type_) none 31) + (dummy-32 (_type_ symbol) spool-anim 32) + (dummy-33 (_type_) none 33) + (dummy-34 (_type_) none 34) + (dummy-35 (_type_) none 35) + (dummy-36 (_type_) none 36) + (dummy-37 (_type_) none 37) + (dummy-38 (_type_) none 38) + (dummy-39 (_type_) none 39) + (dummy-40 (_type_ object skeleton-group int int vector int) none 40) + (dummy-41 (_type_) none 41) + (dummy-42 (_type_) none 42) + (dummy-43 (_type_) none 43) + (dummy-44 (_type_) none 44) + (dummy-45 (_type_) none 45) + (dummy-46 (_type_) none 46) + (dummy-47 (_type_) none 47) + (dummy-48 (_type_) none 48) + (dummy-49 (_type_) none 49) + (dummy-50 (_type_) none 50) + (dummy-51 (_type_) none 51) + (dummy-52 (_type_) none 52) ) ) diff --git a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc index a9ef2b4b7e..acb609eb4f 100644 --- a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc @@ -62,12 +62,12 @@ (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) + (c-sun-start rgba :offset 32) + (c-sun-end rgba :offset 48) + (c-halo-start rgba :offset 36) + (c-halo-end rgba :offset 52) + (c-aurora-start rgba :offset 40) + (c-aurora-end rgba :offset 56) ) :method-count-assert 9 :size-assert #x40 diff --git a/test/decompiler/reference/engine/gfx/sky/sky-utils_REF.gc b/test/decompiler/reference/engine/gfx/sky/sky-utils_REF.gc index 88f9c9162a..af006ffd44 100644 --- a/test/decompiler/reference/engine/gfx/sky/sky-utils_REF.gc +++ b/test/decompiler/reference/engine/gfx/sky/sky-utils_REF.gc @@ -16,7 +16,7 @@ ;; definition for function sky-set-sun-colors (defun sky-set-sun-colors - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint) (arg4 uint) (arg5 uint)) + ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba) (arg4 rgba) (arg5 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-sun-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-sun-end) arg3) @@ -31,7 +31,7 @@ ;; definition for function sky-set-sun-colors-sun (defun sky-set-sun-colors-sun - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint)) + ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-sun-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-sun-end) arg3) @@ -42,7 +42,7 @@ ;; definition for function sky-set-sun-colors-halo (defun sky-set-sun-colors-halo - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint)) + ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-halo-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-halo-end) arg3) @@ -53,7 +53,7 @@ ;; definition for function sky-set-sun-colors-aurora (defun sky-set-sun-colors-aurora - ((arg0 sky-parms) (arg1 int) (arg2 uint) (arg3 uint)) + ((arg0 sky-parms) (arg1 int) (arg2 rgba) (arg3 rgba)) (let ((v1-0 (logand arg1 1))) (set! (-> arg0 upload-data sun v1-0 c-aurora-start) arg2) (set! (-> arg0 upload-data sun v1-0 c-aurora-end) arg3) @@ -81,7 +81,3 @@ (set! (-> arg0 orbit arg1 max-halo) arg7) #f ) - - - - diff --git a/test/decompiler/reference/engine/load/load-dgo_REF.gc b/test/decompiler/reference/engine/load/load-dgo_REF.gc index 06e068321a..8617935fef 100644 --- a/test/decompiler/reference/engine/load/load-dgo_REF.gc +++ b/test/decompiler/reference/engine/load/load-dgo_REF.gc @@ -142,11 +142,11 @@ ;; definition for function str-play-async ;; INFO: Return type mismatch int vs none. -(defun str-play-async ((name string) (addr pointer)) +(defun str-play-async ((name string) (addr sound-id)) (set! *que-str-lock* #t) (let ((cmd (the-as load-chunk-msg (add-element *play-str-rpc*)))) (charp<-string (-> cmd basename) name) - (set! (-> cmd address) addr) + (set! (-> cmd address) (the-as pointer addr)) (set! (-> cmd result) (load-msg-result done)) ) 0 diff --git a/test/decompiler/reference/engine/load/loader-h_REF.gc b/test/decompiler/reference/engine/load/loader-h_REF.gc index 77103d1290..ef119193ed 100644 --- a/test/decompiler/reference/engine/load/loader-h_REF.gc +++ b/test/decompiler/reference/engine/load/loader-h_REF.gc @@ -12,8 +12,8 @@ :flag-assert #xb00000010 (:methods (new (symbol type int basic) _type_ 0) - (dummy-9 () none 9) - (dummy-10 () none 10) + (dummy-9 (_type_ string symbol kheap int) art-group 9) + (dummy-10 (_type_ art-group) art-group 10) ) ) @@ -83,13 +83,13 @@ (heap kheap :inline :offset-assert 32) (pending-load-file string :offset-assert 48) (pending-load-file-part int32 :offset-assert 52) - (pending-load-file-owner uint64 :offset-assert 56) + (pending-load-file-owner handle :offset-assert 56) (pending-load-file-priority float :offset-assert 64) (load-file string :offset-assert 68) (load-file-part int32 :offset-assert 72) - (load-file-owner uint64 :offset-assert 80) + (load-file-owner handle :offset-assert 80) (load-file-priority float :offset-assert 88) - (buf uint32 :offset-assert 92) + (buf pointer :offset-assert 92) (len int32 :offset-assert 96) (art-group art-group :offset-assert 100) ) @@ -98,13 +98,13 @@ :flag-assert #x1000000068 (:methods (new (symbol type int) _type_ 0) - (dummy-9 (_type_ symbol int symbol float) none 9) - (dummy-10 () none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) + (want-file (_type_ string int handle float) int 9) + (update (_type_) int 10) + (inactive? (_type_) symbol 11) + (file-status (_type_ string int) symbol 12) + (link-file (_type_ art-group) art-group 13) + (unlink-file (_type_ art-group) int 14) + (unlock! (_type_) symbol 15) ) ) @@ -148,11 +148,11 @@ (set! (-> obj index) idx) (set! (-> obj load-file) #f) (set! (-> obj load-file-part) -1) - (set! (-> obj load-file-owner) (the-as uint #f)) + (set! (-> obj load-file-owner) (the-as handle #f)) (set! (-> obj load-file-priority) 100000000.0) (set! (-> obj pending-load-file) #f) (set! (-> obj pending-load-file-part) -1) - (set! (-> obj pending-load-file-owner) (the-as uint #f)) + (set! (-> obj pending-load-file-owner) (the-as handle #f)) (set! (-> obj pending-load-file-priority) 100000000.0) (set! (-> obj art-group) #f) (set! (-> obj status) 'initialize) @@ -164,12 +164,14 @@ ;; definition of type spool-anim (deftype spool-anim (basic) - ((name string :offset 16) - (index int32 :offset-assert 20) - (parts int32 :offset-assert 24) - (priority float :offset-assert 28) - (owner uint64 :offset-assert 32) - (command-list basic :offset-assert 40) + ((name string :offset 16) + (buf1 external-art-buffer :offset 16) + (buf2 external-art-buffer :offset-assert 20) + (index int32 :offset 20) + (parts int32 :offset-assert 24) + (priority float :offset-assert 28) + (owner handle :offset-assert 32) + (command-list pair :offset-assert 40) ) :pack-me :method-count-assert 9 @@ -181,7 +183,7 @@ (defmethod inspect spool-anim ((obj spool-anim)) (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~Tname: ~A~%" (-> obj name)) - (format #t "~Tindex: ~D~%" (-> obj index)) + (format #t "~Tindex: ~D~%" (-> obj buf2)) (format #t "~Tparts: ~D~%" (-> obj parts)) (format #t "~Tpriority: ~f~%" (-> obj priority)) (format #t "~Towner: ~D~%" (-> obj owner)) @@ -193,10 +195,10 @@ (deftype external-art-control (basic) ((buffer external-art-buffer 2 :offset-assert 4) (rec spool-anim 3 :inline :offset-assert 16) - (spool-lock uint64 :offset-assert 160) - (reserve-buffer basic :offset-assert 168) + (spool-lock handle :offset-assert 160) + (reserve-buffer external-art-buffer :offset-assert 168) (reserve-buffer-count int32 :offset-assert 172) - (active-stream basic :offset-assert 176) + (active-stream string :offset-assert 176) (preload-stream spool-anim :inline :offset-assert 184) (last-preload-stream spool-anim :inline :offset-assert 232) (end-pad uint32 :offset-assert 276) @@ -206,14 +208,14 @@ :flag-assert #x1100000118 (:methods (new (symbol type) _type_ 0) - (dummy-9 (_type_ symbol) none 9) - (dummy-10 (_type_) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) + (update (_type_ symbol) int 9) + (clear-rec (_type_) int 10) + (spool-push (_type_ string int process float) int 11) + (file-status (_type_ string int) symbol 12) + (reserve-alloc (_type_) kheap 13) + (reserve-free (_type_ kheap) int 14) + (none-reserved? (_type_) symbol 15) + (try-preload-stream (_type_ string int process float) int 16) ) ) @@ -257,17 +259,17 @@ (dotimes (rec-idx 3) (set! (-> obj rec rec-idx name) #f) (set! (-> obj rec rec-idx priority) 100000000.0) - (set! (-> obj rec rec-idx owner) (the-as uint #f)) + (set! (-> obj rec rec-idx owner) (the-as handle #f)) ) - (set! (-> obj spool-lock) (the-as uint #f)) + (set! (-> obj spool-lock) (the-as handle #f)) (set! (-> obj reserve-buffer) #f) (set! (-> obj active-stream) #f) (set! (-> obj preload-stream name) #f) (set! (-> obj preload-stream priority) 100000000.0) - (set! (-> obj preload-stream owner) (the-as uint #f)) + (set! (-> obj preload-stream owner) (the-as handle #f)) (set! (-> obj last-preload-stream name) #f) (set! (-> obj last-preload-stream priority) 100000000.0) - (set! (-> obj last-preload-stream owner) (the-as uint #f)) + (set! (-> obj last-preload-stream owner) (the-as handle #f)) obj ) ) diff --git a/test/decompiler/reference/engine/load/loader_REF.gc b/test/decompiler/reference/engine/load/loader_REF.gc new file mode 100644 index 0000000000..9d1219ee95 --- /dev/null +++ b/test/decompiler/reference/engine/load/loader_REF.gc @@ -0,0 +1,1457 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 3 of type load-dir +;; Used lq/sq +(defmethod inspect load-dir ((obj load-dir)) + (local-vars (sv-16 basic)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlevel: ~A~%" (-> obj unknown)) + (format #t "~Tallocated-length: ~D~%" (-> obj string-array allocated-length)) + (format #t "~Tlength: ~D~%" (-> obj string-array length)) + (dotimes (s5-0 (-> obj string-array length)) + (let ((s4-0 format) + (s3-0 #t) + (s2-0 "~T [~D] ~S ~A (~D bytes)~%") + (s1-0 s5-0) + (s0-0 (-> obj string-array s5-0)) + ) + (set! sv-16 (-> obj data-array s5-0)) + (let ((t1-0 (mem-size (-> obj data-array s5-0) #f 0))) + (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) + ) + ) + ) + obj + ) + +;; definition for method 8 of type load-dir +;; INFO: Return type mismatch symbol vs load-dir. +(defmethod + mem-usage + load-dir + ((obj load-dir) (arg0 memory-usage-block) (arg1 int)) + (set! (-> arg0 length) (max 82 (-> arg0 length))) + (set! (-> arg0 data 81 name) "array") + (+! (-> arg0 data 81 count) 1) + (let ((v1-6 (asize-of obj))) + (+! (-> arg0 data 81 used) v1-6) + (+! (-> arg0 data 81 total) (logand -16 (+ v1-6 15))) + ) + (set! (-> arg0 length) (max 82 (-> arg0 length))) + (set! (-> arg0 data 81 name) "array") + (set! (-> arg0 data 81 count) (-> arg0 data 81 count)) + (let ((v1-15 (asize-of (-> obj string-array)))) + (+! (-> arg0 data 81 used) v1-15) + (+! (-> arg0 data 81 total) (logand -16 (+ v1-15 15))) + ) + (set! (-> arg0 length) (max 82 (-> arg0 length))) + (set! (-> arg0 data 81 name) "array") + (set! (-> arg0 data 81 count) (-> arg0 data 81 count)) + (let ((v1-24 (asize-of (-> obj data-array)))) + (+! (-> arg0 data 81 used) v1-24) + (+! (-> arg0 data 81 total) (logand -16 (+ v1-24 15))) + ) + (dotimes (s3-0 (-> obj data-array length)) + (mem-usage (-> obj data-array s3-0) arg0 arg1) + ) + (the-as load-dir #f) + ) + +;; definition for method 9 of type load-dir-art-group +(defmethod + dummy-9 + load-dir-art-group + ((obj load-dir-art-group) (arg0 string) (arg1 symbol) (arg2 kheap) (arg3 int)) + (let ((s5-0 (-> obj string-array))) + (dotimes (s3-0 (-> s5-0 length)) + (when (string= arg0 (-> s5-0 s3-0)) + (when arg1 + (let ((v1-4 (art-group-load-check arg0 arg2 arg3))) + (if v1-4 + (set! (-> obj art-group-array s3-0) v1-4) + ) + ) + ) + (return (-> obj art-group-array s3-0)) + ) + ) + (let ((v0-2 (art-group-load-check arg0 arg2 arg3))) + (when v0-2 + (set! (-> s5-0 (-> s5-0 length)) arg0) + (set! (-> obj art-group-array (-> s5-0 length)) v0-2) + (+! (-> s5-0 length) 1) + (+! (-> obj art-group-array length) 1) + ) + v0-2 + ) + ) + ) + +;; definition for method 10 of type load-dir-art-group +(defmethod + dummy-10 + load-dir-art-group + ((obj load-dir-art-group) (arg0 art-group)) + (let ((s4-0 (-> obj string-array))) + (dotimes (s3-0 (-> s4-0 length)) + (when (string= (-> arg0 name) (-> s4-0 s3-0)) + (set! (-> obj art-group-array s3-0) arg0) + (set! arg0 (-> obj art-group-array s3-0)) + (goto cfg-7) + ) + ) + (set! (-> s4-0 (-> s4-0 length)) (-> arg0 name)) + (set! (-> obj art-group-array (-> s4-0 length)) arg0) + (+! (-> s4-0 length) 1) + ) + (+! (-> obj art-group-array length) 1) + (label cfg-7) + arg0 + ) + +;; definition for function drawable-load +(defun drawable-load ((arg0 drawable) (arg1 kheap)) + (local-vars (sp-0 none)) + (cond + ((type-type? (-> arg0 type) string) + sp-0 + (if (< (the-as uint sp-0) (the-as uint *stack-top*)) + (&+ *kernel-sp* -1024) + ) + (let ((s5-1 (the-as drawable (loado (the-as string arg0) arg1)))) + (if (and s5-1 (type-type? (-> s5-1 type) drawable)) + (login s5-1) + ) + ) + ) + ((type-type? (-> arg0 type) drawable) + (login arg0) + ) + ) + ) + +;; definition for function art-load +(defun art-load ((arg0 string) (arg1 kheap)) + (local-vars (sp-0 none)) + sp-0 + (if (< (the-as uint sp-0) (the-as uint *stack-top*)) + (&+ *kernel-sp* -1024) + ) + (let ((s5-0 (loado arg0 arg1))) + (the-as art (if (type-type? (-> (the-as art s5-0) type) art) + (dummy-9 (the-as art s5-0)) + (the-as art #f) + ) + ) + ) + ) + +;; definition for function art-group-load-check +(defun art-group-load-check ((arg0 string) (arg1 kheap) (arg2 int)) + (local-vars (sp-0 none)) + (when *debug-segment* + sp-0 + (if (< (the-as uint sp-0) (the-as uint *stack-top*)) + (&+ *kernel-sp* -1024) + ) + (let + ((s3-1 + (the-as + art-group + (loado (make-file-name (file-kind art-group) arg0 arg2 #f) arg1) + ) + ) + ) + (the-as art-group (cond + ((not s3-1) + (format + 0 + "ERROR: art-group ~A is not a valid file.~%" + arg0 + ) + (the-as art-group #f) + ) + ((not (type-type? (-> s3-1 type) art-group)) + (format + 0 + "ERROR: art-group ~A is not a art-group.~%" + arg0 + ) + (the-as art-group #f) + ) + ((not + (file-info-correct-version? + (-> s3-1 info) + (file-kind art-group) + arg2 + ) + ) + (the-as art-group #f) + ) + (else + (dummy-9 s3-1) + ) + ) + ) + ) + ) + ) + +;; definition for method 9 of type external-art-buffer +(defmethod + want-file + external-art-buffer + ((obj external-art-buffer) + (arg0 string) + (arg1 int) + (arg2 handle) + (arg3 float) + ) + (set! (-> obj pending-load-file) arg0) + (set! (-> obj pending-load-file-part) arg1) + (set! (-> obj pending-load-file-owner) arg2) + (set! (-> obj pending-load-file-priority) arg3) + 0 + ) + +;; definition for method 15 of type external-art-buffer +(defmethod unlock! external-art-buffer ((obj external-art-buffer)) + (set! (-> obj locked?) #f) + #f + ) + +;; definition for method 11 of type external-art-buffer +(defmethod inactive? external-art-buffer ((obj external-art-buffer)) + (!= (-> obj status) 'active) + ) + +;; definition for method 12 of type external-art-buffer +(defmethod + file-status + external-art-buffer + ((obj external-art-buffer) (arg0 string) (arg1 int)) + (when + (and + (name= (-> obj pending-load-file) arg0) + (= (-> obj pending-load-file-part) arg1) + ) + (if (and (name= (-> obj load-file) arg0) (= (-> obj load-file-part) arg1)) + (-> obj status) + 'pending + ) + ) + ) + +;; definition for method 13 of type art-group +(defmethod link-art! art-group ((obj art-group)) + (when obj + (countdown (s5-0 (-> obj length)) + (let* ((art-elt (-> obj data s5-0)) + (janim + (if + (and + (nonzero? art-elt) + (type-type? (-> art-elt type) art-joint-anim) + ) + (the-as art-joint-anim art-elt) + ) + ) + (success #f) + ) + (when janim + (let ((s3-1 3)) + (while (begin + (label cfg-22) + (nonzero? s3-1) + ) + (+! s3-1 -1) + (let + ((janim-group + (art-group-get-by-name + (-> *level* level s3-1) + (-> janim master-art-group-name) + ) + ) + ) + (when janim-group + (cond + ((and + (< (-> janim master-art-group-index) (-> janim-group length)) + (not (-> janim-group data (-> janim master-art-group-index))) + ) + (set! (-> janim-group data (-> janim master-art-group-index)) janim) + (set! success #t) + ) + (else + (countdown (a0-14 (-> janim-group length)) + (when (not (-> janim-group data a0-14)) + (set! (-> janim-group data a0-14) janim) + (set! success #t) + (goto cfg-22) + ) + ) + ) + ) + ) + ) + ) + ) + (if (not success) + (format + 0 + "ERROR: ~A could not find a master slot to link for ~A.~%" + (-> obj name) + janim + ) + ) + ) + ) + ) + ) + obj + ) + +;; definition for method 14 of type art-group +(defmethod unlink-art! art-group ((obj art-group)) + (when obj + (countdown (s5-0 (-> obj length)) + (let* ((art-elt (-> obj data s5-0)) + (janim + (if + (and + (nonzero? art-elt) + (type-type? (-> art-elt type) art-joint-anim) + ) + (the-as art-joint-anim art-elt) + ) + ) + (success #f) + ) + (when janim + (let ((s2-0 3)) + (while (begin + (label cfg-16) + (nonzero? s2-0) + ) + (+! s2-0 -1) + (let + ((janim-group + (art-group-get-by-name + (-> *level* level s2-0) + (-> janim master-art-group-name) + ) + ) + ) + (when janim-group + (countdown (a0-5 (-> janim-group length)) + (when (= janim (-> janim-group data a0-5)) + (set! (-> janim-group data a0-5) #f) + (set! success #t) + (goto cfg-16) + ) + ) + ) + ) + ) + ) + (if (not success) + (format + 0 + "ERROR: ~A could not find a master slot to unlink for ~A.~%" + (-> obj name) + janim + ) + ) + ) + ) + ) + ) + 0 + ) + +;; definition for method 13 of type external-art-buffer +(defmethod + link-file + external-art-buffer + ((obj external-art-buffer) (arg0 art-group)) + (when arg0 + (link-art! arg0) + (set! (-> obj art-group) arg0) + ) + arg0 + ) + +;; definition for method 14 of type external-art-buffer +(defmethod + unlink-file + external-art-buffer + ((obj external-art-buffer) (arg0 art-group)) + (when arg0 + (unlink-art! arg0) + (set! (-> obj art-group) #f) + ) + 0 + ) + +;; definition for method 10 of type external-art-buffer +;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. +(defmethod update external-art-buffer ((obj external-art-buffer)) + (local-vars (v1-54 handle)) + (when + (or + (not (name= (-> obj pending-load-file) (-> obj load-file))) + (!= (-> obj pending-load-file-part) (-> obj load-file-part)) + ) + (when (not (handle->process (-> obj pending-load-file-owner))) + (set! (-> obj pending-load-file) #f) + (set! (-> obj pending-load-file-part) -1) + (set! (-> obj pending-load-file-owner) (the-as handle #f)) + (set! (-> obj pending-load-file-priority) 100000000.0) + ) + (when (= (-> obj status) 'initialize) + (let ((v1-11 (-> obj heap))) + (set! + (-> v1-11 base) + (the-as pointer (+ #x84000 (* #x3dc00 (-> obj index)))) + ) + (set! (-> v1-11 current) (-> v1-11 base)) + (set! (-> v1-11 top-base) (&+ (-> v1-11 base) #x3dc00)) + (set! (-> v1-11 top) (-> v1-11 top-base)) + ) + (set! (-> obj status) 'inactive) + ) + (cond + ((-> obj load-file) + (if (= (-> obj status) 'loading) + (str-load-cancel) + ) + (set! (-> obj load-file) #f) + (set! (-> obj load-file-part) -1) + (set! (-> obj load-file-owner) (the-as handle #f)) + (set! (-> obj load-file-priority) 100000000.0) + ) + (else + (set! (-> obj load-file) (-> obj pending-load-file)) + (set! (-> obj load-file-part) (-> obj pending-load-file-part)) + (set! (-> obj load-file-owner) (-> obj pending-load-file-owner)) + (set! (-> obj load-file-priority) (-> obj pending-load-file-priority)) + ) + ) + ) + (label cfg-18) + (cond + ((-> obj load-file) + (case (-> obj status) + (('active 'reserved) + ) + (('error) + (set! (-> obj status) 'inactive) + (set! (-> obj load-file) #f) + (set! (-> obj load-file-part) -1) + (set! (-> obj load-file-owner) (the-as handle #f)) + (set! (-> obj load-file-priority) 100000000.0) + (set! (-> obj pending-load-file) #f) + (set! (-> obj pending-load-file-part) -1) + (set! (-> obj pending-load-file-owner) (the-as handle #f)) + (set! (-> obj pending-load-file-priority) 100000000.0) + (set! (-> obj art-group) #f) + ) + (('inactive) + (let ((v1-28 (-> obj heap))) + (set! (-> v1-28 current) (-> v1-28 base)) + ) + (cond + ((string= (-> obj load-file) "reserved") + (cond + ((-> *art-control* reserve-buffer) + (format + 0 + "ERROR: trying double reserve ~A when ~A is reserved~%" + obj + (-> *art-control* reserve-buffer) + ) + ) + (else + (set! (-> obj status) 'reserved) + (set! (-> *art-control* reserve-buffer) obj) + ) + ) + ) + ((and + (!= (-> *level* loading-level) (-> *level* level-default)) + (< 81920.0 (-> obj load-file-priority)) + ) + ) + ((str-load + (-> obj load-file) + (-> obj load-file-part) + (logand -64 (&+ (-> obj heap current) 63)) + #x3fc00 + ) + (set! (-> obj status) 'loading) + ) + ) + ) + (('loading) + (case (str-load-status (&-> obj len)) + (('error) + (set! (-> obj status) 'error) + ) + (('busy) + ) + (else + (set! (-> obj buf) (logand -64 (&+ (-> obj heap current) 63))) + (set! (-> obj status) 'loaded) + (goto cfg-18) + ) + ) + ) + (('loaded) + (let ((a0-37 (-> obj buf))) + (set! + (-> obj art-group) + (the-as + art-group + (link a0-37 (-> obj load-file data) (-> obj len) (-> obj heap) 0) + ) + ) + ) + (let ((s4-0 (-> obj art-group)) + (s3-0 (-> obj load-file)) + ) + (cond + ((not s4-0) + (format + 0 + "ERROR: art-group ~A part ~D is not a valid file.~%" + s3-0 + (-> obj load-file-part) + ) + (set! (-> obj status) 'error) + ) + ((not (type-type? (-> s4-0 type) art-group)) + (format + 0 + "ERROR: art-group ~A part ~D is not a art-group.~%" + s3-0 + (-> obj load-file-part) + ) + (set! (-> obj status) 'error) + ) + ((not + (file-info-correct-version? (-> s4-0 info) (file-kind art-group) 0) + ) + (set! (-> obj status) 'error) + ) + (else + (dummy-9 s4-0) + (set! (-> obj status) 'locked) + ) + ) + ) + ) + (('locked) + (when (and (not (-> obj locked?)) (begin + (set! v1-54 (-> obj load-file-owner)) + (nonzero? (l32-false-check v1-54)) + ) + (let ((a0-46 (-> v1-54 process 0))) + (if (= (-> v1-54 pid) (-> a0-46 pid)) + a0-46 + ) + ) + ) + (link-file obj (-> obj art-group)) + (set! (-> obj other locked?) #t) + (set! (-> obj status) 'active) + (goto cfg-18) + ) + ) + ) + ) + (else + (case (-> obj status) + (('initialize) + ) + (('reserved) + (cond + ((= (-> *art-control* reserve-buffer) obj) + (set! (-> *art-control* reserve-buffer) #f) + (set! (-> obj status) 'inactive) + ) + (else + (format + 0 + "ERROR: trying tro free ~A when ~A is reserved~%" + obj + (-> *art-control* reserve-buffer) + ) + ) + ) + ) + (('active) + (unlink-file obj (-> obj art-group)) + (let ((v1-70 (-> obj heap))) + (set! (-> v1-70 current) (-> v1-70 base)) + ) + (set! (-> obj art-group) #f) + (set! (-> obj status) 'inactive) + (when (-> obj other locked?) + (unlock! (-> obj other)) + (update (-> obj other)) + ) + ) + (else + (let ((v1-79 (-> obj heap))) + (set! (-> v1-79 current) (-> v1-79 base)) + ) + (set! (-> obj art-group) #f) + (set! (-> obj status) 'inactive) + ) + ) + ) + ) + 0 + ) + +;; definition for symbol *preload-spool-anims*, type symbol +(define *preload-spool-anims* #t) + +;; definition for method 12 of type external-art-control +(defmethod + file-status + external-art-control + ((obj external-art-control) (arg0 string) (arg1 int)) + (dotimes (s3-0 2) + (let ((v1-3 (file-status (-> obj buffer s3-0) arg0 arg1))) + (if v1-3 + (return v1-3) + ) + ) + ) + #f + ) + +;; definition for method 9 of type external-art-control +(defmethod update external-art-control ((obj external-art-control) (arg0 symbol)) + (if (nonzero? (-> obj reserve-buffer-count)) + (spool-push obj "reserved" 0 *dproc* (if (-> obj reserve-buffer) + -110.0 + -0.5 + ) + ) + ) + (dotimes (v1-5 2) + (set! (-> obj buffer v1-5 frame-lock) #f) + ) + (dotimes (v1-8 3) + (set! (-> obj rec v1-8 buf2) #f) + ) + (dotimes (s4-0 2) + (let ((s3-0 (-> obj rec s4-0))) + (when (-> s3-0 name) + (dotimes (s2-0 2) + (when + (and + (file-status (-> obj buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) + (not (-> obj buffer s2-0 frame-lock)) + ) + (set! (-> obj buffer s2-0 frame-lock) #t) + (set! (-> s3-0 buf2) (-> obj buffer s2-0)) + (set! (-> obj buffer s2-0 pending-load-file-owner) (-> s3-0 owner)) + (set! (-> obj buffer s2-0 load-file-owner) (-> s3-0 owner)) + (set! (-> obj buffer s2-0 pending-load-file-priority) (-> s3-0 priority)) + (set! (-> obj buffer s2-0 load-file-priority) (-> s3-0 priority)) + (goto cfg-24) + ) + ) + ) + ) + (label cfg-24) + ) + (dotimes (s4-1 2) + (let ((s3-1 (-> obj rec s4-1))) + (when (and (-> s3-1 name) (not (-> s3-1 buf2))) + (if (and (not *preload-spool-anims*) (>= (-> s3-1 priority) 0.0)) + (goto cfg-46) + ) + (dotimes (s2-1 2) + (when (not (-> obj buffer s2-1 frame-lock)) + (set! (-> obj buffer s2-1 frame-lock) #t) + (want-file + (-> obj buffer s2-1) + (-> s3-1 name) + (-> s3-1 parts) + (-> s3-1 owner) + (-> s3-1 priority) + ) + (set! (-> s3-1 buf2) (-> obj buffer s2-1)) + (goto cfg-46) + ) + ) + ) + ) + (label cfg-46) + ) + (when (not (-> obj reserve-buffer)) + (let ((s4-2 (-> obj rec 0 buf2))) + (if + (and + s4-2 + (-> s4-2 locked?) + (not (string= (-> s4-2 pending-load-file) "reserved")) + (not (string= (-> s4-2 other pending-load-file) "reserved")) + ) + (want-file + (-> s4-2 other) + (the-as string #f) + -1 + (the-as handle #f) + 100000000.0 + ) + ) + ) + ) + (dotimes (s4-3 2) + (update (-> obj buffer s4-3)) + ) + (let ((s4-4 (the-as spool-anim #f))) + (countdown (s3-2 3) + (if + (and + (-> obj rec s3-2 name) + (not (name= (-> obj rec s3-2 name) (-> obj active-stream))) + ) + (set! s4-4 (the-as spool-anim (-> obj rec))) + ) + ) + (if + (and + (-> obj preload-stream name) + (or (not s4-4) (< (-> obj preload-stream priority) (-> s4-4 priority))) + ) + (set! s4-4 (-> obj preload-stream)) + ) + (cond + (s4-4 + (mem-copy! (&-> (-> obj last-preload-stream) type) (&-> s4-4 type) 44) + (str-play-queue (-> s4-4 name)) + ) + (else + (set! (-> obj last-preload-stream name) #f) + (set! (-> obj last-preload-stream owner) (the-as handle #f)) + ) + ) + ) + (when (and arg0 *display-art-control*) + (dotimes (s5-1 3) + (let ((t9-10 format) + (a0-29 *stdcon*) + (a1-9 "rec ~d ~S ~D ~f ~A~%") + (a2-5 s5-1) + (a3-3 (-> obj rec s5-1 name)) + (t0-3 (-> obj rec s5-1 parts)) + (t1-0 (-> obj rec s5-1 priority)) + (v1-123 (handle->process (-> obj rec s5-1 owner))) + ) + (t9-10 a0-29 a1-9 a2-5 a3-3 t0-3 t1-0 (if v1-123 + (-> v1-123 name) + ) + ) + ) + ) + (dotimes (s5-2 2) + (let ((t9-11 format) + (a0-30 *stdcon*) + (a1-10 "buf ~d ~C ~S ~D ~A ~A~%") + (a2-6 s5-2) + (a3-4 (if (-> obj buffer s5-2 locked?) + 108 + 32 + ) + ) + (t0-4 (-> obj buffer s5-2 pending-load-file)) + (t1-1 (-> obj buffer s5-2 pending-load-file-part)) + (t2-5 (-> obj buffer s5-2 status)) + (v1-144 + (handle->process (-> obj buffer s5-2 pending-load-file-owner)) + ) + ) + (t9-11 a0-30 a1-10 a2-6 a3-4 t0-4 t1-1 t2-5 (if v1-144 + (-> v1-144 name) + ) + ) + ) + ) + (format *stdcon* " a: ~S~%" (-> obj active-stream)) + (let ((t9-13 format) + (a0-32 *stdcon*) + (a1-12 " p: ~S ~A~%") + (a2-8 (-> obj preload-stream name)) + (v1-149 (handle->process (-> obj preload-stream owner))) + ) + (t9-13 a0-32 a1-12 a2-8 (if v1-149 + (-> v1-149 name) + ) + ) + ) + (let ((t9-14 format) + (a0-33 *stdcon*) + (a1-13 " q: ~S ~A~%") + (a2-9 (-> obj last-preload-stream name)) + (v1-152 (handle->process (-> obj last-preload-stream owner))) + ) + (t9-14 a0-33 a1-13 a2-9 (if v1-152 + (-> v1-152 name) + ) + ) + ) + ) + 0 + ) + +;; definition for method 15 of type external-art-control +(defmethod none-reserved? external-art-control ((obj external-art-control)) + (zero? (-> obj reserve-buffer-count)) + ) + +;; definition for method 13 of type external-art-control +(defmethod reserve-alloc external-art-control ((obj external-art-control)) + (set! (-> obj reserve-buffer-count) 1) + (if (-> obj reserve-buffer) + (-> obj reserve-buffer heap) + ) + ) + +;; definition for method 14 of type external-art-control +(defmethod + reserve-free + external-art-control + ((obj external-art-control) (arg0 kheap)) + (cond + ((zero? (-> obj reserve-buffer-count)) + (format + 0 + "ERROR: illegal attempt to free a buffer #x~X which had not been reserved (none reserved).~%" + arg0 + ) + ) + ((not (-> obj reserve-buffer)) + (set! (-> obj reserve-buffer-count) 0) + 0 + ) + ((= (-> obj reserve-buffer heap) arg0) + (want-file + (-> obj reserve-buffer) + (the-as string #f) + -1 + (the-as handle #f) + 100000000.0 + ) + (update (-> obj reserve-buffer)) + (set! (-> obj reserve-buffer-count) 0) + 0 + ) + (else + (format + 0 + "ERROR: illegal attempt to free a buffer #x~X which had not been reserved (buffer unknown).~%" + arg0 + ) + ) + ) + 0 + ) + +;; definition for method 10 of type external-art-control +(defmethod clear-rec external-art-control ((obj external-art-control)) + (cond + ((!= *master-mode* 'game) + (dotimes (s5-0 3) + (when (name= (-> obj rec s5-0 name) "reserved") + (let ((v1-5 s5-0)) + (cond + ((zero? v1-5) + (mem-copy! + (&+ (the-as pointer (-> obj rec)) -4) + (&-> (-> obj rec 1) type) + 44 + ) + (mem-copy! (&-> (-> obj rec 1) type) (&-> (-> obj rec 2) type) 44) + ) + ((= v1-5 1) + (mem-copy! (&-> (-> obj rec 1) type) (&-> (-> obj rec 2) type) 44) + ) + ) + ) + (set! (-> obj rec 2 type) spool-anim) + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 priority) 100000000.0) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ) + ) + (else + (dotimes (v1-19 3) + (set! (-> obj rec v1-19 type) spool-anim) + (set! (-> obj rec v1-19 name) #f) + (set! (-> obj rec v1-19 priority) 100000000.0) + (set! (-> obj rec v1-19 owner) (the-as handle #f)) + ) + (set! (-> obj preload-stream type) spool-anim) + (set! (-> obj preload-stream name) #f) + (set! (-> obj preload-stream priority) 100000000.0) + (set! (-> obj preload-stream owner) (the-as handle #f)) + ) + ) + 0 + ) + +;; definition for method 16 of type external-art-control +(defmethod + try-preload-stream + external-art-control + ((obj external-art-control) + (arg0 string) + (arg1 int) + (arg2 process) + (arg3 float) + ) + (when (and (= arg3 -99.0) arg2) + (let ((a0-2 (target-pos 0))) + (set! + arg3 + (vector-vector-distance + a0-2 + (-> (the-as process-drawable arg2) root trans) + ) + ) + ) + ) + (when + (not + (and + (-> obj preload-stream name) + (>= arg3 (-> obj preload-stream priority)) + ) + ) + (set! (-> obj preload-stream name) arg0) + (set! (-> obj preload-stream parts) arg1) + (set! (-> obj preload-stream priority) arg3) + (let ((v1-8 (if arg2 + (-> arg2 ppointer) + ) + ) + ) + (set! + (-> obj preload-stream owner) + (new 'static 'handle + :process v1-8 + :pid (-> (the-as process (-> v1-8 0)) pid) + ) + ) + ) + ) + 0 + ) + +;; definition for method 11 of type external-art-control +(defmethod + spool-push + external-art-control + ((obj external-art-control) + (arg0 string) + (arg1 int) + (arg2 process) + (arg3 float) + ) + (when (and (= arg3 -99.0) arg2) + (let ((a0-2 (target-pos 0))) + (set! + arg3 + (vector-vector-distance + a0-2 + (-> (the-as process-drawable arg2) root trans) + ) + ) + ) + ) + (cond + ((and (= arg1 (-> obj rec 0 parts)) (name= arg0 (-> obj rec 0 name))) + (if (>= arg3 (-> obj rec 0 priority)) + (return (the-as int #f)) + ) + (mem-copy! (&-> (-> obj rec) 0 type) (&-> (-> obj rec 1) type) 44) + (mem-copy! (&-> (-> obj rec 1) type) (&-> (-> obj rec 2) type) 44) + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ((and (= arg1 (-> obj rec 1 parts)) (name= arg0 (-> obj rec 1 name))) + (if (>= arg3 (-> obj rec 1 priority)) + (return (the-as int #f)) + ) + (mem-copy! (&-> (-> obj rec 1) type) (&-> (-> obj rec 2) type) 44) + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ((and (= arg1 (-> obj rec 2 parts)) (name= arg0 (-> obj rec 2 name))) + (if (>= arg3 (-> obj rec 2 priority)) + (return (the-as int #f)) + ) + (set! (-> obj rec 2 name) #f) + (set! (-> obj rec 2 owner) (the-as handle #f)) + ) + ) + (cond + ((< arg3 (-> obj rec 0 priority)) + (mem-copy! (&-> (-> obj rec 2) type) (&-> (-> obj rec 1) type) 44) + (mem-copy! (&-> (-> obj rec 1) type) (&-> (-> obj rec) 0 type) 44) + (set! (-> obj rec 0 name) arg0) + (set! (-> obj rec 0 parts) arg1) + (set! (-> obj rec 0 priority) arg3) + (let ((v1-34 (if arg2 + (-> arg2 ppointer) + ) + ) + ) + (set! + (-> obj rec 0 owner) + (new 'static 'handle + :process v1-34 + :pid (-> (the-as process (-> v1-34 0)) pid) + ) + ) + ) + ) + ((< arg3 (-> obj rec 1 priority)) + (mem-copy! (&-> (-> obj rec 2) type) (&-> (-> obj rec 1) type) 44) + (set! (-> obj rec 1 name) arg0) + (set! (-> obj rec 1 parts) arg1) + (set! (-> obj rec 1 priority) arg3) + (let* ((a0-18 arg2) + (v1-40 (if a0-18 + (-> a0-18 ppointer) + ) + ) + ) + (set! + (-> obj rec 1 owner) + (new 'static 'handle + :process v1-40 + :pid (-> (the-as process (-> v1-40 0)) pid) + ) + ) + ) + ) + ((< arg3 (-> obj rec 2 priority)) + (set! (-> obj rec 2 name) arg0) + (set! (-> obj rec 2 parts) arg1) + (set! (-> obj rec 2 priority) arg3) + (let* ((a0-22 arg2) + (v1-44 (if a0-22 + (-> a0-22 ppointer) + ) + ) + ) + (set! + (-> obj rec 2 owner) + (new 'static 'handle + :process v1-44 + :pid (-> (the-as process (-> v1-44 0)) pid) + ) + ) + ) + ) + ) + 0 + ) + +;; definition for function ja-play-spooled-anim +;; WARN: Stack slot offset 24 signed mismatch +;; WARN: Stack slot offset 24 signed mismatch +;; WARN: Stack slot offset 24 signed mismatch +;; WARN: Stack slot offset 24 signed mismatch +;; WARN: Stack slot offset 24 signed mismatch +(defbehavior + ja-play-spooled-anim process-drawable + ((arg0 spool-anim) + (arg1 art-joint-anim) + (arg2 art-joint-anim) + (arg3 (function process-drawable symbol)) + ) + (local-vars + (spool-part int) + (sv-24 float) + (old-skel-status uint) + (sv-32 int) + (sv-40 int) + (sv-48 int) + (sv-56 int) + (spool-sound sound-id) + (sv-72 int) + ) + (set! spool-part 0) + (set! sv-24 -17.0) + (set! old-skel-status (-> self skel status)) + (set! sv-32 -2) + (set! sv-40 0) + (set! sv-48 0) + (set! sv-56 0) + (set! spool-sound (new-sound-id)) + (dummy-17 *load-state* (-> arg0 command-list)) + (let* ((a0-2 *setting-control*) + (t9-2 (method-of-object a0-2 set-setting!)) + (a1-2 self) + (a2-1 'spooling) + (v1-6 self) + ) + (t9-2 a0-2 a1-2 a2-1 (the-as symbol (if v1-6 + (-> v1-6 ppointer) + ) + ) + 0.0 0 + ) + ) + (set! (-> self skel status) (logior (-> self skel status) 7)) + (kill-current-level-hint '() '() 'die) + (level-hint-surpress!) + (copy-settings-from-target! *setting-control*) + (when + (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game)) + (cond + (arg1 + (when (!= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + arg1 + ) + (ja-channel-push! 1 15) + (let ((s2-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! s2-0 arg1 num-func-identity) + (set! (-> s2-0 frame-num) 0.0) + ) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (while + (or + (handle->process (-> *art-control* spool-lock)) + (!= *master-mode* 'game) + ) + (format #t "WARNING: ---------------------> loader stall on lock~%") + (if (arg3 self) + (goto cfg-88) + ) + (let* ((a0-16 *art-control*) + (t9-11 (method-of-object a0-16 spool-push)) + (a1-8 (-> arg0 name)) + (a2-4 spool-part) + (t0-1 -9.0) + ) + (t9-11 a0-16 a1-8 a2-4 self t0-1) + ) + (suspend) + (when arg1 + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) 1.0) + (joint-control-channel-group-eval! + a0-17 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + ) + (let ((v1-46 (if self + (-> self ppointer) + ) + ) + ) + (set! + (-> *art-control* spool-lock) + (new 'static 'handle + :process v1-46 + :pid (-> (the-as process (-> v1-46 0)) pid) + ) + ) + ) + (set! sv-48 (the-as int (-> *display* base-frame-counter))) + (while (< spool-part (-> arg0 parts)) + (let* ((a0-27 *art-control*) + (t9-13 (method-of-object a0-27 spool-push)) + (a1-11 (-> arg0 name)) + (a2-6 spool-part) + (t0-2 -20.0) + ) + (t9-13 a0-27 a1-11 a2-6 self t0-2) + ) + (update *art-control* #f) + (let* ((a0-29 *art-control*) + (t9-15 (method-of-object a0-29 spool-push)) + (a1-13 (-> arg0 name)) + (a2-7 spool-part) + (t0-3 -20.0) + ) + (t9-15 a0-29 a1-13 a2-7 self t0-3) + ) + (when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (cond + (arg1 + (when (!= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + arg1 + ) + (ja-channel-set! 1) + (let ((s2-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! s2-2 arg1 num-func-identity) + (set! (-> s2-2 frame-num) 0.0) + ) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active) + (if (arg3 self) + (goto cfg-88) + ) + (let* ((a0-35 *art-control*) + (t9-21 (method-of-object a0-35 spool-push)) + (a1-16 (-> arg0 name)) + (a2-10 spool-part) + (t0-4 -20.0) + ) + (t9-21 a0-35 a1-16 a2-10 self t0-4) + ) + (format + #t + "WARNING: ---------------------> loader stall on art ~S ~D~%" + (-> arg0 name) + spool-part + ) + (suspend) + (when arg1 + (let ((a0-37 (-> self skel root-channel 0))) + (set! (-> a0-37 param 0) 1.0) + (joint-control-channel-group-eval! + a0-37 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + ) + (let* ((a0-39 *art-control*) + (t9-25 (method-of-object a0-39 spool-push)) + (a1-20 (-> arg0 name)) + (a2-14 spool-part) + (t0-5 -20.0) + ) + (t9-25 a0-39 a1-20 a2-14 self t0-5) + ) + (let + ((s2-4 + (the-as + art-joint-anim + (dummy-10 (-> self draw art-group) (-> arg0 name) art-joint-anim) + ) + ) + ) + (cond + (s2-4 + (ja-channel-set! 1) + (let ((a0-42 (-> self skel root-channel 0))) + (set! (-> a0-42 frame-group) s2-4) + (set! (-> a0-42 param 0) (the float (+ (-> s2-4 data 0 length) -1))) + (set! (-> a0-42 param 1) 1.0) + (set! (-> a0-42 frame-num) 0.0) + (joint-control-channel-group! a0-42 s2-4 num-func-seek!) + ) + (when (zero? spool-part) + (str-play-async (-> arg0 name) spool-sound) + (set! (-> *art-control* active-stream) (-> arg0 name)) + ) + (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) + (f28-0 + (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0)) + ) + ) + (set! sv-72 (current-str-pos spool-sound)) + (set! sv-40 (the-as int (-> *display* base-frame-counter))) + (until (begin + (let* ((a0-55 *art-control*) + (t9-32 (method-of-object a0-55 spool-push)) + (a1-24 (-> arg0 name)) + (a2-17 spool-part) + (t0-6 -20.0) + ) + (t9-32 a0-55 a1-24 a2-17 self t0-6) + ) + (cond + ((< (+ spool-part 1) (-> arg0 parts)) + (let* ((a0-57 *art-control*) + (t9-33 (method-of-object a0-57 spool-push)) + (a1-25 (-> arg0 name)) + (a2-18 (+ spool-part 1)) + (t0-7 -10.0) + ) + (t9-33 a0-57 a1-25 a2-18 self t0-7) + ) + ) + (else + (set! + (-> self skel status) + (logand -5 (the-as int (-> self skel status))) + ) + ) + ) + (dummy-16 *load-state* (ja-aframe-num 0)) + (cond + ((and (< sv-32 sv-72) (= (current-str-id) spool-sound)) + (set! + sv-56 + (+ + sv-56 + (the-as + int + (- + (-> *display* base-frame-counter) + (-> *display* old-base-frame-counter) + ) + ) + ) + ) + (set! sv-40 (the-as int (-> *display* base-frame-counter))) + ) + (else + 0 + ) + ) + (set! sv-32 sv-72) + (set! sv-48 (the-as int (-> *display* base-frame-counter))) + (suspend) + (let + ((f0-14 + (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0) + ) + (a0-69 (-> self skel root-channel 0)) + ) + (set! + (-> a0-69 param 0) + (the float (+ (-> a0-69 frame-group data 0 length) -1)) + ) + (set! (-> a0-69 param 1) 1.0) + (set! (-> a0-69 frame-num) f0-14) + (joint-control-channel-group! + a0-69 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((v0-39 (current-str-pos spool-sound))) + (set! sv-72 v0-39) + (>= (the float v0-39) f28-0) + ) + ) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (set! (-> self skel status) (logior (-> self skel status) 32)) + ) + (if + (or + (arg3 self) + (and + (<= sv-72 0) + (>= (the-as int (- (-> *display* base-frame-counter) sv-40)) 1200) + ) + (and (< 300 sv-56) (<= sv-72 0)) + ) + (goto cfg-88) + ) + ) + (set! sv-24 f28-0) + ) + (set! + (-> self skel status) + (logand -33 (the-as int (-> self skel status))) + ) + ) + (else + (format + 0 + "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~" + self + (-> arg0 name) + spool-part + ) + (goto cfg-88) + ) + ) + ) + (set! spool-part (+ spool-part 1)) + ) + (set! spool-part (+ spool-part -1)) + (label cfg-88) + (ja-abort-spooled-anim arg0 arg2 spool-part) + 0 + ) + +;; definition for function ja-abort-spooled-anim +(defbehavior + ja-abort-spooled-anim process-drawable + ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 int)) + (dummy-18 *load-state*) + (str-play-stop (-> arg0 name)) + (set! (-> *art-control* active-stream) #f) + (set! (-> self skel status) (logand -7 (the-as int (-> self skel status)))) + (if (zero? (logand (-> self skel status) 1)) + (set! (-> self skel status) (logand -2 (the-as int (-> self skel status)))) + ) + (clear-pending-settings-from-process *setting-control* self 'spooling) + (cond + ((and arg1 (>= arg2 0)) + (ja-channel-push! 1 30) + (set! (-> self skel root-channel 0 frame-group) arg1) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (let* ((a0-11 *art-control*) + (t9-4 (method-of-object a0-11 spool-push)) + (a1-3 (-> arg0 name)) + (a2-2 arg2) + (t0-0 -20.0) + ) + (t9-4 a0-11 a1-3 a2-2 self t0-0) + ) + (suspend) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 param 0) + (the float (+ (-> a0-12 frame-group data 0 length) -1)) + ) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! + a0-12 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + (set! (-> *art-control* spool-lock) (the-as handle #f)) + 0 + ) + +;; failed to figure out what this is: +(if (zero? *art-control*) + (set! *art-control* (new 'global 'external-art-control)) + ) diff --git a/test/decompiler/reference/engine/sound/gsound_REF.gc b/test/decompiler/reference/engine/sound/gsound_REF.gc index b740b9e99a..276015164c 100644 --- a/test/decompiler/reference/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound_REF.gc @@ -20,20 +20,20 @@ ;; definition of type sound-iop-info (deftype sound-iop-info (basic) - ((frame uint32 :offset 16) - (strpos int32 :offset-assert 20) - (str-id uint32 :offset-assert 24) - (str-id-sign int32 :offset 24) - (freemem uint32 :offset-assert 28) - (chinfo uint8 48 :offset-assert 32) - (freemem2 uint32 :offset-assert 80) - (nocd uint32 :offset-assert 84) - (dirtycd uint32 :offset-assert 88) - (diskspeed uint32 2 :offset-assert 92) - (lastspeed uint32 :offset-assert 100) - (dupseg int32 :offset-assert 104) - (times uint32 41 :offset-assert 108) - (times-seq uint32 :offset-assert 272) + ((frame uint32 :offset 16) + (strpos int32 :offset-assert 20) + (str-id sound-id :offset-assert 24) + (str-id-sign int32 :offset 24) + (freemem uint32 :offset-assert 28) + (chinfo uint8 48 :offset-assert 32) + (freemem2 uint32 :offset-assert 80) + (nocd uint32 :offset-assert 84) + (dirtycd uint32 :offset-assert 88) + (diskspeed uint32 2 :offset-assert 92) + (lastspeed uint32 :offset-assert 100) + (dupseg int32 :offset-assert 104) + (times uint32 41 :offset-assert 108) + (times-seq uint32 :offset-assert 272) ) :method-count-assert 9 :size-assert #x114 @@ -69,12 +69,13 @@ ) ;; definition for function current-str-id +;; INFO: Return type mismatch int vs sound-id. (defun current-str-id () - (-> *sound-iop-info* str-id-sign) + (the-as sound-id (-> *sound-iop-info* str-id-sign)) ) ;; definition for function current-str-pos -(defun current-str-pos ((arg0 int)) +(defun current-str-pos ((arg0 sound-id)) (let ((v0-0 -1)) (if (= arg0 (-> *sound-iop-info* str-id)) (set! v0-0 (-> *sound-iop-info* strpos)) diff --git a/test/decompiler/reference/engine/target/target-h_REF.gc b/test/decompiler/reference/engine/target/target-h_REF.gc index 5903a04d3f..a6adf61f1b 100644 --- a/test/decompiler/reference/engine/target/target-h_REF.gc +++ b/test/decompiler/reference/engine/target/target-h_REF.gc @@ -80,7 +80,7 @@ (deftype sidekick (process-drawable) ((control control-info :offset 112) (anim-seed uint64 :offset 192) - (shadow-in-movie? basic :offset-assert 200) + (shadow-in-movie? symbol :offset-assert 200) ) :heap-base #x60 :method-count-assert 20 diff --git a/test/decompiler/reference/kernel/gkernel-h_REF.gc b/test/decompiler/reference/kernel/gkernel-h_REF.gc index 469dc48f19..57535c360b 100644 --- a/test/decompiler/reference/kernel/gkernel-h_REF.gc +++ b/test/decompiler/reference/kernel/gkernel-h_REF.gc @@ -8,12 +8,12 @@ (allow-to-run process-mask :offset-assert 12) (next-pid int32 :offset-assert 16) (fast-stack-top pointer :offset-assert 20) - (current-process basic :offset-assert 24) + (current-process process :offset-assert 24) (relocating-process basic :offset-assert 28) (relocating-min int32 :offset-assert 32) (relocating-max int32 :offset-assert 36) (relocating-offset int32 :offset-assert 40) - (low-memory-message basic :offset-assert 44) + (low-memory-message symbol :offset-assert 44) ) :method-count-assert 9 :size-assert #x30 @@ -304,13 +304,13 @@ (trans (function object) :offset-assert 20) (post function :offset-assert 24) (enter (function object object object object object object object) :offset-assert 28) - (event (function basic int basic event-message-block object) :offset-assert 32) + (event (function process int symbol event-message-block object) :offset-assert 32) ) :method-count-assert 9 :size-assert #x24 :flag-assert #x900000024 (:methods - (new (symbol type basic function (function object) (function object object object object object object object) (function object) (function basic int basic event-message-block object)) _type_ 0) + (new (symbol type basic function (function object) (function object object object object object object object) (function object) (function process int symbol event-message-block object)) _type_ 0) ) ) @@ -330,11 +330,11 @@ ;; definition of type event-message-block (deftype event-message-block (structure) - ((to basic :offset-assert 0) - (from basic :offset-assert 4) - (num-params int32 :offset-assert 8) - (message basic :offset-assert 12) - (param uint64 7 :offset-assert 16) + ((to process :offset-assert 0) + (from process :offset-assert 4) + (num-params int32 :offset-assert 8) + (message symbol :offset-assert 12) + (param uint64 7 :offset-assert 16) ) :method-count-assert 9 :size-assert #x48 diff --git a/test/decompiler/reference/kernel/gstate_REF.gc b/test/decompiler/reference/kernel/gstate_REF.gc index 0215c62611..2f193edaf3 100644 --- a/test/decompiler/reference/kernel/gstate_REF.gc +++ b/test/decompiler/reference/kernel/gstate_REF.gc @@ -12,7 +12,7 @@ (trans (function object)) (enter (function object object object object object object object)) (exit (function object)) - (event (function basic int basic event-message-block object)) + (event (function process int symbol event-message-block object)) ) (let ((obj diff --git a/test/goalc/source_templates/with_game/test-fancy-static-fields.gc b/test/goalc/source_templates/with_game/test-fancy-static-fields.gc index 10e92b07e5..7e7bb7e845 100644 --- a/test/goalc/source_templates/with_game/test-fancy-static-fields.gc +++ b/test/goalc/source_templates/with_game/test-fancy-static-fields.gc @@ -21,11 +21,11 @@ :name "name" :bf (new 'static 'basic-field-test-bitfield :f1 1 :f3 1) :kc (new 'static 'kernel-context :next-pid 12) - :kci (new 'static 'kernel-context :current-process 'asdf :relocating-min 33)))) + :kci (new 'static 'kernel-context :low-memory-message 'asdf :relocating-min 33)))) (format #t "~A ~D ~f ~A ~D" (-> obj name) (-> obj kc next-pid) (-> obj pos) (-> obj list) (-> obj bf)) (format #t " ~D ~D ~A ~A~%" (-> obj kci relocating-min) (logand 15 (the int (-> obj kci))) (-> obj kci type) - (-> obj kci current-process)) + (-> obj kci low-memory-message)) ) \ No newline at end of file diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index 882d3d931d..ebdc133878 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -151,7 +151,10 @@ const std::unordered_set g_functions_to_skip_compiling = { "get-task-status", // aligner - return-from-thread, currently not supported - "(method 9 align-control)"}; + "(method 9 align-control)", + + // loader - decompiler bug with detecting handle macros + "(method 10 external-art-buffer)"}; // default location for the data. It can be changed with a command line argument. std::string g_iso_data_path = "";