diff --git a/decompiler/IR2/AtomicOpForm.cpp b/decompiler/IR2/AtomicOpForm.cpp index 810b4dc250..d3051cb0ed 100644 --- a/decompiler/IR2/AtomicOpForm.cpp +++ b/decompiler/IR2/AtomicOpForm.cpp @@ -242,7 +242,6 @@ FormElement* StoreOp::get_vf_store_as_form(FormPool& pool, const Env& env) const } assert(!rd.addr_of); // we'll change this to true because .svf uses an address. auto addr = pool.alloc_single_element_form(nullptr, source, true, tokens); - return pool.alloc_element(m_value.var().reg(), addr, false); } else { // try again with no deref. @@ -261,7 +260,6 @@ FormElement* StoreOp::get_vf_store_as_form(FormPool& pool, const Env& env) const // some sketchy type stuff going on. addr = pool.alloc_single_element_form( nullptr, TypeSpec("pointer", {TypeSpec("uint128")}), addr); - return pool.alloc_element(m_value.var().reg(), addr, false); } } @@ -421,7 +419,8 @@ FormElement* StoreOp::get_as_form(FormPool& pool, const Env& env) const { return pool.alloc_element( addr, m_value.as_expr(), m_my_idx, ro.var, std::nullopt, - get_typecast_for_atom(m_value, env, coerce_to_reg_type(rd.result_type), m_my_idx)); + get_typecast_for_atom(m_value, env, coerce_to_reg_type(rd.result_type), m_my_idx), + m_size); } std::string cast_type; @@ -466,7 +465,7 @@ FormElement* StoreOp::get_as_form(FormPool& pool, const Env& env) const { pool.alloc_element(cast_source, false, std::vector()); return pool.alloc_element(deref, m_value.as_expr(), m_my_idx, ro.var, TypeSpec("pointer", {TypeSpec(cast_type)}), - std::nullopt); + std::nullopt, m_size); } } } diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index 6534863bc5..b40a708fb6 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -2017,13 +2017,15 @@ StorePlainDeref::StorePlainDeref(DerefElement* dst, int my_idx, RegisterAccess base_var, std::optional dst_cast_type, - std::optional src_cast_type) + std::optional src_cast_type, + int size) : m_dst(dst), m_expr(std::move(expr)), m_my_idx(my_idx), m_base_var(base_var), m_dst_cast_type(std::move(dst_cast_type)), - m_src_cast_type(std::move(src_cast_type)) {} + m_src_cast_type(std::move(src_cast_type)), + m_size(size) {} goos::Object StorePlainDeref::to_form_internal(const Env& env) const { std::vector lst = {pretty_print::to_symbol("set!")}; diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index e09735c3ad..a18eb09760 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -1204,7 +1204,8 @@ class StorePlainDeref : public FormElement { int my_idx, RegisterAccess base_var, std::optional dst_cast_type, - std::optional src_cast_type); + std::optional src_cast_type, + int size); goos::Object to_form_internal(const Env& env) const override; void apply(const std::function& f) override; @@ -1212,6 +1213,7 @@ class StorePlainDeref : public FormElement { void collect_vars(RegAccessSet& vars, bool recursive) const override; void get_modified_regs(RegSet& regs) const override; void push_to_stack(const Env& env, FormPool& pool, FormStack& stack) override; + int size() const { return m_size; } private: DerefElement* m_dst = nullptr; @@ -1219,6 +1221,7 @@ class StorePlainDeref : public FormElement { int m_my_idx = -1; RegisterAccess m_base_var; std::optional m_dst_cast_type, m_src_cast_type; + int m_size = -1; }; class StoreArrayAccess : public FormElement { diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 7bd95d14cb..ca80d723f5 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -1715,7 +1715,14 @@ void StorePlainDeref::push_to_stack(const Env& env, FormPool& pool, FormStack& s if (m_expr.is_var()) { // this matches the order in Compiler::compile_set auto vars = std::vector({m_expr.var(), m_base_var}); + // for 16-byte stores, the order is backward. Why???? + if (size() == 16) { + std::swap(vars.at(0), vars.at(1)); + } auto popped = pop_to_forms(vars, env, pool, stack, true); + if (size() == 16) { + std::swap(popped.at(0), popped.at(1)); + } m_dst->set_base(make_optional_cast(m_dst_cast_type, popped.at(1), pool, env)); m_dst->mark_popped(); m_dst->inline_nested(); diff --git a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp index 9630c46793..dd6b7d5100 100644 --- a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp +++ b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp @@ -464,7 +464,12 @@ void ObjectFileDB::ir2_cfg_build_pass() { total++; if (!func.suspected_asm && func.ir2.atomic_ops_succeeded && func.cfg->is_fully_resolved()) { attempted++; - build_initial_forms(func); + try { + build_initial_forms(func); + } catch (std::exception& e) { + func.warnings.general_warning("Failed to structure"); + func.ir2.top_form = nullptr; + } } if (func.ir2.top_form) { diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 597363d75b..eeed4a984e 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -7057,8 +7057,16 @@ ) (deftype art-joint-anim (art-element) - ((pad2 uint8 16)) - ;; inspect in join + ;; figured out manually from custom inspect. + ((speed float :offset 20) + (artist-base float :offset 24) + (artiest-step float :offset 28) + (master-art-group-name basic :offset 32) + (master-art-group-index int32 :offset 36) + (frames pointer :offset 44) + (data joint-anim-compressed :dynamic) + ) + ;; inspect in joint :method-count-assert 13 :size-assert #x30 :flag-assert #xd00000030 @@ -8661,12 +8669,12 @@ ;; Version - 3 ;; - Types - +(declare-type joint-control basic) (deftype joint-control-channel (structure) - ((parent basic :offset-assert 0) + ((parent joint-control :offset-assert 0) (command basic :offset-assert 4) (frame-interp float :offset-assert 8) - (frame-group basic :offset-assert 12) + (frame-group art-joint-anim :offset-assert 12) (frame-num float :offset-assert 16) (num-func basic :offset-assert 20) (param uint32 2 :offset-assert 24) @@ -10195,7 +10203,7 @@ ;; - Symbols -(define-extern *collide-mesh-cache* collide-mesh-cache) ;; unknown type +(define-extern *collide-mesh-cache* collide-mesh-cache) ;; ---------------------- @@ -10568,16 +10576,12 @@ ;; - Symbols -(define-extern *collide-hit-by-player-list* engine) ;; unknown type -(define-extern *collide-usually-hit-by-player-list* engine) ;; unknown type -(define-extern *collide-hit-by-others-list* engine) ;; unknown type -(define-extern *collide-player-list* engine) ;; unknown type - -;; - Unknowns - -;;(define-extern *collide-shape-prim-backgnd* object) ;; unknown type -;;(define-extern *collide-shape-prim-water* object) ;; unknown type - +(define-extern *collide-hit-by-player-list* engine) +(define-extern *collide-usually-hit-by-player-list* engine) +(define-extern *collide-hit-by-others-list* engine) +(define-extern *collide-player-list* engine) +(define-extern *collide-shape-prim-backgnd* collide-shape-prim-mesh) +(define-extern *collide-shape-prim-water* collide-shape-prim-mesh) ;; ---------------------- ;; File - collide-target-h @@ -10603,13 +10607,22 @@ :size-assert #x78 :flag-assert #xa00000078 (:methods - (dummy-9 () none 9) + (update! (_type_ collide-shape-moving vector vector vector) _type_ 9) ) ) -;; - Unknowns +(deftype control-info (collide-shape-moving) + ( + ;; these were determined from racer-collision-reaction. + (array-size int16 :offset 2490) + (history-array collide-history 128 :inline :offset-assert 2496) + (pad uint32 27) + ) -;;(define-extern control-info object) ;; unknown type + :size-assert #x4a2c + :method-count-assert 65 + :flag-assert #x4100004a2c + ) ;; ---------------------- @@ -10709,8 +10722,8 @@ ;; - Symbols -(define-extern *touching-prims-entry-pool* touching-prims-entry-pool) ;; unknown type -(define-extern *touching-list* touching-list) ;; unknown type +(define-extern *touching-prims-entry-pool* touching-prims-entry-pool) +(define-extern *touching-list* touching-list) ;; ---------------------- @@ -10843,11 +10856,8 @@ ;; - Symbols -(define-extern *edge-grab-info* edge-grab-info) ;; unknown type - -;; - Unknowns - -;;(define-extern *collide-edge-work* object) ;; unknown type +(define-extern *edge-grab-info* edge-grab-info) +(define-extern *collide-edge-work* collide-edge-work) ;; ---------------------- @@ -10858,19 +10868,19 @@ ;; - Symbols -(define-extern joint-control-reset! function) -(define-extern cspace-index-by-name function) -(define-extern cspace-by-name function) -(define-extern cspace-by-name-no-fail function) -(define-extern cspace-index-by-name-no-fail function) -(define-extern num-func-none function) -(define-extern num-func-+! function) -(define-extern num-func--! function) -(define-extern num-func-loop! function) -(define-extern num-func-seek! function) -(define-extern num-func-blend-in! function) -(define-extern num-func-chan function) -(define-extern num-func-identity function) +(define-extern joint-control-reset! (function joint-control joint-control-channel none)) +(define-extern cspace-index-by-name (function process-drawable string int)) +(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-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)) ;; ---------------------- @@ -10881,28 +10891,29 @@ ;; - Types -; (deftype effect-control (basic) -; ((process basic :offset-assert 4) -; (flags uint32 :offset-assert 8) -; (last-frame-group basic :offset-assert 12) -; (last-frame-num float :offset-assert 16) -; (channel-offset int32 :offset-assert 20) -; (res basic :offset-assert 24) -; (name uint32 :offset-assert 28) -; (param uint32 :offset-assert 32) -; ) -; :method-count-assert 15 -; :size-assert #x24 -; :flag-assert #xf00000024 -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; ) -; ) +(deftype effect-control (basic) + ((process process-drawable :offset-assert 4) + (flags uint32 :offset-assert 8) + (last-frame-group art-joint-anim :offset-assert 12) + (last-frame-num float :offset-assert 16) + (channel-offset int32 :offset-assert 20) + (res res-lump :offset-assert 24) + (name uint32 :offset-assert 28) + (param uint32 :offset-assert 32) + ) + :method-count-assert 15 + :size-assert #x24 + :flag-assert #xf00000024 + (:methods + (new (symbol type process-drawable) _type_) + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (set-channel-offset! (_type_ int) none 13) + (dummy-14 () none 14) + ) + ) diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index d0eb40442a..d526c2648d 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -486,5 +486,13 @@ ["L103", "rgba", true], ["L89", "(inline-array vector)", true, 6], ["L90", "(inline-array vector)", true, 3] + ], + + "process-drawable-h": [ + ["L18", "float", true] + ], + + "effect-control-h": [ + ["L6", "float", true] ] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index cb9856899d..b0a62a7ff8 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -486,5 +486,24 @@ "joint-mod-set-local-callback": [[[0, 23], "v1", "joint-mod-set-local"]], "joint-mod-set-world-callback": [[[0, 23], "v1", "joint-mod-set-world"]], "joint-mod-blend-local-callback": [[[2, 63], "gp", "joint-mod-blend-local"]], - "joint-mod-spinner-callback": [[[2, 63], "gp", "joint-mod-spinner"]] + "joint-mod-spinner-callback": [[[2, 63], "gp", "joint-mod-spinner"]], + + "(method 11 touching-prims-entry-pool)": [ + [[0, 8], "v1", "touching-prims-entry"], + [8, "v1", "pointer"], + [[9, 11], "v1", "touching-prims-entry"], + [[1, 20], "a1", "touching-prims-entry"] + ], + + "(method 0 touching-list)": [ + [[6, 9], "v0", "touching-list"] + ], + + "num-func-chan": [ + [8, "v1", "joint-control-channel"] + ], + + "cspace-by-name-no-fail": [ + [[0, 100], "v0", "cspace"] + ] } diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 6b3d71121e..57047b9913 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -1556,6 +1556,18 @@ "(method 11 touching-prims-entry-pool)": { "vars": { "a1-0": "current", "v1-0": "prev", "a2-0": "next" } }, + "(method 0 touching-list)": { + "vars": {"v0-0": ["obj", "touching-list"]} + }, + + "cspace-by-name-no-fail": { + "vars": {"v0-0": ["result", "cspace"]} + }, + + "num-func-loop!": { + "args": ["chan", "inc"], + "vars": {"f0-1":"duration", "f1-2":"after-inc", "f0-3":"wrapped"} + }, // LEVEL "lookup-level-info": { @@ -1807,5 +1819,6 @@ "vars": { "s1-0": "proc-drawable", "s3-1": ["enemy-facts", "fact-info-enemy"], "f30-0": "dist", "v1-12": ["ppointer", "(pointer process)"] } }, - "joint-mod-look-at-handler": { "args": ["csp", "xform", "mat"] } + "joint-mod-look-at-handler": { "args": ["csp", "xform", "mat"] }, + "(method 9 collide-history)": { "args": ["obj", "cshape", "xs", "transv", "transv-out"]} } diff --git a/goal_src/engine/anim/joint-h.gc b/goal_src/engine/anim/joint-h.gc index 24771dc105..088ee072bd 100644 --- a/goal_src/engine/anim/joint-h.gc +++ b/goal_src/engine/anim/joint-h.gc @@ -5,19 +5,20 @@ ;; name in dgo: joint-h ;; dgos: GAME, ENGINE +(declare-type joint-control basic) (deftype joint-control-channel (structure) - ((parent basic :offset-assert 0) - (command basic :offset-assert 4) - (frame-interp float :offset-assert 8) - (frame-group basic :offset-assert 12) - (frame-num float :offset-assert 16) - (num-func basic :offset-assert 20) - (param uint32 2 :offset-assert 24) - (group-sub-index int16 :offset-assert 32) - (group-size int16 :offset-assert 34) - (dist float :offset-assert 36) - (eval-time uint32 :offset-assert 40) - (inspector-amount float :offset-assert 44) + ((parent joint-control :offset-assert 0) + (command basic :offset-assert 4) + (frame-interp float :offset-assert 8) + (frame-group art-joint-anim :offset-assert 12) + (frame-num float :offset-assert 16) + (num-func basic :offset-assert 20) + (param uint32 2 :offset-assert 24) + (group-sub-index int16 :offset-assert 32) + (group-size int16 :offset-assert 34) + (dist float :offset-assert 36) + (eval-time uint32 :offset-assert 40) + (inspector-amount float :offset-assert 44) ) :method-count-assert 10 :size-assert #x30 @@ -101,4 +102,4 @@ (define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) (define-extern cspace<-transformq! (function cspace transformq matrix)) -(define-extern vector<-cspace! (function vector cspace vector)) \ No newline at end of file +(define-extern vector<-cspace! (function vector cspace vector)) diff --git a/goal_src/engine/collide/collide-target-h.gc b/goal_src/engine/collide/collide-target-h.gc index 2f74e11b4a..2272b01e78 100644 --- a/goal_src/engine/collide/collide-target-h.gc +++ b/goal_src/engine/collide/collide-target-h.gc @@ -5,3 +5,56 @@ ;; name in dgo: collide-target-h ;; dgos: GAME, ENGINE +;;-*-Lisp-*- +(in-package goal) + +;; We believe that target's control-info may contain an array of these. +;; Each collide-history is a record of a single collision event. +(deftype collide-history (structure) + ((intersect vector :inline :offset-assert 0) + (trans vector :inline :offset-assert 16) + (transv vector :inline :offset-assert 32) + (transv-out vector :inline :offset-assert 48) + (local-normal vector :inline :offset-assert 64) + (surface-normal vector :inline :offset-assert 80) + (time uint64 :offset-assert 96) + (status uint64 :offset-assert 104) + (pat uint32 :offset-assert 112) + (reaction-flag uint32 :offset-assert 116) + ) + :method-count-assert 10 + :size-assert #x78 + :flag-assert #xa00000078 + (:methods + (update! (_type_ collide-shape-moving vector vector vector) _type_ 9) + ) + ) + +(deftype control-info (collide-shape-moving) + ( + ;; these were determined from racer-collision-reaction. + (array-size int16 :offset 2490) + (history-array collide-history 128 :inline :offset-assert 2496) + ;; what's on the end? + (pad uint32 27) + ) + + :size-assert #x4a2c + :method-count-assert 65 + :flag-assert #x4100004a2c + ) + +(defmethod update! collide-history ((obj collide-history) (cshape collide-shape-moving) (xs vector) (transv vector) (transv-out vector)) + "Update the collide-history element." + (set! (-> obj intersect quad) (-> xs quad)) + (set! (-> obj transv quad) (-> transv quad)) + (set! (-> obj transv-out quad) (-> transv-out quad)) + (set! (-> obj trans quad) (-> cshape trans quad)) + (set! (-> obj local-normal quad) (-> cshape local-normal quad)) + (set! (-> obj surface-normal quad) (-> cshape surface-normal quad)) + (set! (-> obj time) (-> *display* base-frame-counter)) + (set! (-> obj status) (-> cshape status)) + (set! (-> obj reaction-flag) (-> cshape reaction-flag)) + (set! (-> obj pat) (-> cshape cur-pat)) + obj + ) diff --git a/goal_src/engine/data/art-h.gc b/goal_src/engine/data/art-h.gc index 5abde2ac46..9fd0538acf 100644 --- a/goal_src/engine/data/art-h.gc +++ b/goal_src/engine/data/art-h.gc @@ -154,8 +154,16 @@ ) (deftype art-joint-anim (art-element) - ((pad2 uint8 16 :offset-assert 32) + ;; figured out manually from custom inspect. + ((speed float :offset 20) + (artist-base float :offset 24) + (artiest-step float :offset 28) + (master-art-group-name basic :offset 32) + (master-art-group-index int32 :offset 36) + (frames pointer :offset 44) + (data joint-anim-compressed :dynamic) ) + ;; inspect in joint :method-count-assert 13 :size-assert #x30 :flag-assert #xd00000030 diff --git a/goal_src/engine/data/res.gc b/goal_src/engine/data/res.gc index 43581a5c3a..39d3bf08ac 100644 --- a/goal_src/engine/data/res.gc +++ b/goal_src/engine/data/res.gc @@ -482,6 +482,19 @@ default ) +(defmacro res-lump-struct (lump name type &key (tag-ptr (the-as (pointer res-tag) #f))) + `(the-as ,type ((method-of-type res-lump get-property-struct) + ,lump + ,name + 'interp + -1000000000.0 + (the-as structure #f) + ,tag-ptr + *res-static-buf* + ) + ) + ) + (defmethod get-property-value res-lump ((obj res-lump) (name symbol) (mode symbol) (time float) (default uint128) (tag-addr (pointer res-tag)) (buf-addr pointer)) "Returns a given value property's value at a specific time stamp, or default on error. name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. diff --git a/goal_src/engine/draw/process-drawable-h.gc b/goal_src/engine/draw/process-drawable-h.gc index 72ff1fdc83..e0e173084f 100644 --- a/goal_src/engine/draw/process-drawable-h.gc +++ b/goal_src/engine/draw/process-drawable-h.gc @@ -5,3 +5,146 @@ ;; name in dgo: process-drawable-h ;; dgos: GAME, ENGINE +(define-extern cspace-index-by-name (function process-drawable string int)) +(define-extern cspace-by-name (function process-drawable string cspace)) +(define-extern joint-control-reset! (function joint-control joint-control-channel none)) + +(defun cspace-by-name-no-fail ((arg0 process-drawable) (arg1 string)) + "Get a cspace by name from the given process-drawable. If it fails, print an error and return the first one" + (let ((result (cspace-by-name arg0 arg1))) + (cond + (result + result + ) + (else + (format 0 "no cspace (~A)~%" arg1) + (-> arg0 node-list data 0) + ) + ) + ) + ) + +(defun cspace-index-by-name-no-fail ((arg0 process-drawable) (arg1 string)) + "Get the index of a cspace by name from the given process drawable. If it fails, print an error and return 0." + (let ((v0-0 (cspace-index-by-name arg0 arg1))) + (cond + ((< v0-0 0) + (format 0 "no cspace[ndx] (~A)~%" arg1) + 0 + ) + (else + v0-0 + ) + ) + ) + ) + +;; 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)) + "Don't change anything." + (-> arg0 frame-num) + ) + +(defun num-func-+! ((arg0 joint-control-channel) (arg1 float)) + "Increment the frame number, taking into account the animation speed and current game rate." + (let ((f0-1 + (+ (-> arg0 frame-num) + (* arg1 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))) + ) + ) + ) + (set! (-> arg0 frame-num) f0-1) + f0-1 + ) + ) + +(defun num-func--! ((arg0 joint-control-channel) (arg1 float)) + "Decrement the frame number, taking into account the animation speed and current game rate." + (let ((f0-1 + (- (-> arg0 frame-num) + (* arg1 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))) + ) + ) + ) + (set! (-> arg0 frame-num) f0-1) + f0-1 + ) + ) + +(defun num-func-loop! ((chan joint-control-channel) (inc float)) + "Like num-func-+!, but will wrap to 0 after going past the end." + + ;; get the duration from the joint-animation-compressed. + (let* ((duration (the float (+ (-> chan frame-group data 0 length) -1))) + ;; increment (also add a full duration to it, I guess to avoid issues if inc is negative and we're near the start.) + (after-inc (+ (+ (-> chan frame-num) duration) + (* inc (* (-> chan frame-group speed) (-> *display* time-adjust-ratio))) + ) + ) + ;; wrap. + (wrapped (- after-inc (* (the float (the int (/ after-inc duration))) duration))) + ) + (set! (-> chan frame-num) wrapped) + wrapped + ) + ) + +(defun num-func-seek! ((arg0 joint-control-channel) (arg1 float) (arg2 float)) + "Seek toward arg1 by at most arg2 (taking into account speed etc)" + (let ((f0-3 (seek + (-> arg0 frame-num) + arg1 + (* arg2 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))) + ) + ) + ) + ;; set it twice, just to make sure. + (set! (-> arg0 frame-num) f0-3) + (set! (-> arg0 frame-num) f0-3) + f0-3 + ) + ) + +(defun num-func-blend-in! ((arg0 joint-control-channel) (arg1 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)) + ) + (set! (-> arg0 frame-interp) f30-0) + (set! (-> arg0 frame-interp) f30-0) + (if (= f30-0 1.0) + (joint-control-reset! (-> arg0 parent) arg0) + ) + f30-0 + ) + ) + +(defun num-func-chan ((arg0 joint-control-channel) (arg1 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 + ;; and the group-sub-index is our index in our array + ;; so we can compute the offset of the arg1-th index from this. + (let ((f0-2 (-> (the-as joint-control-channel + (+ (the-as uint arg0) + (the-as uint + ;; 48 * (difference in indices) + (* 48 (- (the int arg1) (-> arg0 group-sub-index)))) + ) + ) + frame-num + ) + ) + ) + (set! (-> arg0 frame-num) f0-2) + f0-2 + ) + ) + +(defun num-func-identity ((arg0 joint-control-channel)) + "seems to be the same thing as none." + (-> arg0 frame-num) + ) + diff --git a/goal_src/engine/game/effect-control-h.gc b/goal_src/engine/game/effect-control-h.gc index d1a91cd647..2e901302cb 100644 --- a/goal_src/engine/game/effect-control-h.gc +++ b/goal_src/engine/game/effect-control-h.gc @@ -5,3 +5,49 @@ ;; name in dgo: effect-control-h ;; dgos: GAME, ENGINE +(deftype effect-control (basic) + ((process process-drawable :offset-assert 4) + (flags uint32 :offset-assert 8) + (last-frame-group art-joint-anim :offset-assert 12) + (last-frame-num float :offset-assert 16) + (channel-offset int32 :offset-assert 20) + (res res-lump :offset-assert 24) + (name uint32 :offset-assert 28) + (param uint32 :offset-assert 32) + ) + :method-count-assert 15 + :size-assert #x24 + :flag-assert #xf00000024 + (:methods + (new (symbol type process-drawable) _type_ 0) + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (set-channel-offset! (_type_ int) none 13) + (dummy-14 () none 14) + ) + ) + +(defmethod new effect-control ((allocation symbol) (type-to-make type) (arg0 process-drawable)) + (cond + ;; for some reason, we check if we have an effect-name struct. + ((res-lump-struct (the res-lump (-> arg0 draw jgeo extra)) 'effect-name object) + (let ((v0-1 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-1 process) arg0) + (set! (-> v0-1 last-frame-group) #f) + v0-1 + ) + ) + (else + (the-as effect-control #f) + ) + ) + ) + +;; definition for method 13 of type effect-control +;; INFO: Return type mismatch int vs none. +(defmethod set-channel-offset! effect-control ((obj effect-control) (arg0 int)) + (set! (-> obj channel-offset) arg0) + (none) + ) diff --git a/test/decompiler/reference/all_forward_declarations.gc b/test/decompiler/reference/all_forward_declarations.gc index d6fc4f000d..7bcccece25 100644 --- a/test/decompiler/reference/all_forward_declarations.gc +++ b/test/decompiler/reference/all_forward_declarations.gc @@ -803,4 +803,21 @@ (define-extern add-debug-text-sphere (function symbol bucket-id vector float string rgba none)) (define-extern add-debug-matrix (function symbol bucket-id matrix none)) -(define-extern vector-flatten! (function vector vector vector vector)) \ No newline at end of file +(define-extern vector-flatten! (function vector vector vector vector)) + + +(defenum collide-list-enum + (hit-by-player) + (usually-hit-by-player) + (hit-by-others) + (player) + ) + + +(declare-type collide-cache-tri structure) +(declare-type joint-control basic) +(declare-type process-drawable basic) +(declare-type joint-control-channel structure) +(define-extern cspace-index-by-name (function process-drawable string int)) +(define-extern cspace-by-name (function process-drawable string cspace)) +(define-extern joint-control-reset! (function joint-control joint-control-channel none)) \ No newline at end of file diff --git a/test/decompiler/reference/engine/anim/joint-h_REF.gc b/test/decompiler/reference/engine/anim/joint-h_REF.gc index cc90ad3e8a..c89dd44bb7 100644 --- a/test/decompiler/reference/engine/anim/joint-h_REF.gc +++ b/test/decompiler/reference/engine/anim/joint-h_REF.gc @@ -3,18 +3,18 @@ ;; definition of type joint-control-channel (deftype joint-control-channel (structure) - ((parent basic :offset-assert 0) - (command basic :offset-assert 4) - (frame-interp float :offset-assert 8) - (frame-group basic :offset-assert 12) - (frame-num float :offset-assert 16) - (num-func basic :offset-assert 20) - (param uint32 2 :offset-assert 24) - (group-sub-index int16 :offset-assert 32) - (group-size int16 :offset-assert 34) - (dist float :offset-assert 36) - (eval-time uint32 :offset-assert 40) - (inspector-amount float :offset-assert 44) + ((parent joint-control :offset-assert 0) + (command basic :offset-assert 4) + (frame-interp float :offset-assert 8) + (frame-group art-joint-anim :offset-assert 12) + (frame-num float :offset-assert 16) + (num-func basic :offset-assert 20) + (param uint32 2 :offset-assert 24) + (group-sub-index int16 :offset-assert 32) + (group-size int16 :offset-assert 34) + (dist float :offset-assert 36) + (eval-time uint32 :offset-assert 40) + (inspector-amount float :offset-assert 44) ) :method-count-assert 10 :size-assert #x30 @@ -194,7 +194,3 @@ ;; failed to figure out what this is: (let ((v0-5 0)) ) - - - - diff --git a/test/decompiler/reference/engine/camera/cam-interface_REF.gc b/test/decompiler/reference/engine/camera/cam-interface_REF.gc index c6b2b703a1..bca7ca6d81 100644 --- a/test/decompiler/reference/engine/camera/cam-interface_REF.gc +++ b/test/decompiler/reference/engine/camera/cam-interface_REF.gc @@ -101,8 +101,9 @@ (defun camera-teleport-to-entity ((arg0 entity-actor)) (local-vars (pp process)) (let ((gp-0 (new 'stack 'transformq))) - (let ((v1-1 (-> gp-0 trans))) - (set! (-> v1-1 quad) (-> (the-as transform (-> arg0 extra)) scale quad)) + (set! + (-> gp-0 trans quad) + (-> (the-as transform (-> arg0 extra)) scale quad) ) (quaternion-copy! (the-as quaternion (-> gp-0 rot)) (-> arg0 quat)) (vector-identity! (-> gp-0 scale)) diff --git a/test/decompiler/reference/engine/camera/camera-h_REF.gc b/test/decompiler/reference/engine/camera/camera-h_REF.gc index d4551e1c12..1d3849214f 100644 --- a/test/decompiler/reference/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/camera-h_REF.gc @@ -348,12 +348,8 @@ (init-vf0-vector) (cond (arg0 - (let ((v1-0 (-> obj target))) - (set! (-> v1-0 quad) (-> arg0 quad)) - ) - (let ((v1-1 (-> obj value))) - (set! (-> v1-1 quad) (-> arg0 quad)) - ) + (set! (-> obj target quad) (-> arg0 quad)) + (set! (-> obj value quad) (-> arg0 quad)) ) (else (.svf (&-> (-> obj target) quad) vf0) @@ -848,7 +844,3 @@ ;; failed to figure out what this is: (let ((v0-11 0)) ) - - - - diff --git a/test/decompiler/reference/engine/camera/math-camera_REF.gc b/test/decompiler/reference/engine/camera/math-camera_REF.gc index b585a40aa1..28e009c748 100644 --- a/test/decompiler/reference/engine/camera/math-camera_REF.gc +++ b/test/decompiler/reference/engine/camera/math-camera_REF.gc @@ -267,9 +267,7 @@ (set! (-> sprite-row-3 w) (* (* 60.0 persp-x) (-> math-cam pfog0))) ) ) - (let ((v1-15 (-> math-cam sprite-2d-hvdf))) - (set! (-> v1-15 quad) (-> math-cam hvdf-off quad)) - ) + (set! (-> math-cam sprite-2d-hvdf quad) (-> math-cam hvdf-off quad)) (set! (-> math-cam sprite-2d-hvdf x) 2048.0) (set! (-> math-cam sprite-2d-hvdf y) 2048.0) (set! (-> math-cam sprite-2d-hvdf z) (-> math-cam hvdf-off z)) diff --git a/test/decompiler/reference/engine/collide/collide-edge-grab-h_REF.gc b/test/decompiler/reference/engine/collide/collide-edge-grab-h_REF.gc new file mode 100644 index 0000000000..1787b64f2f --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-edge-grab-h_REF.gc @@ -0,0 +1,324 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type edge-grab-info +(deftype edge-grab-info (structure) + ((world-vertex vector 6 :inline :offset-assert 0) + (local-vertex vector 6 :inline :offset-assert 96) + (actor-cshape-prim-offset int32 :offset-assert 192) + (actor-handle uint64 :offset-assert 200) + (hanging-matrix matrix :inline :offset-assert 208) + (edge-vertex vector 2 :inline :offset 0) + (center-hold vector :inline :offset 32) + (tri-vertex vector 3 :inline :offset 48) + (left-hand-hold vector :inline :offset-assert 272) + (right-hand-hold vector :inline :offset-assert 288) + (center-hold-old vector :inline :offset-assert 304) + (edge-tri-pat uint32 :offset-assert 320) + ) + :method-count-assert 11 + :size-assert #x144 + :flag-assert #xb00000144 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + ) + ) + +;; definition for method 3 of type edge-grab-info +(defmethod inspect edge-grab-info ((obj edge-grab-info)) + (format #t "[~8x] ~A~%" obj 'edge-grab-info) + (format #t "~Tworld-vertex[6] @ #x~X~%" (-> obj world-vertex)) + (format #t "~Tlocal-vertex[6] @ #x~X~%" (-> obj local-vertex)) + (format + #t + "~Tactor-cshape-prim-offset: ~D~%" + (-> obj actor-cshape-prim-offset) + ) + (format #t "~Tactor-handle: ~D~%" (-> obj actor-handle)) + (format #t "~Thanging-matrix: #~%" (-> obj hanging-matrix)) + (format #t "~Tedge-vertex[2] @ #x~X~%" (-> obj world-vertex)) + (format #t "~Tcenter-hold: ~`vector`P~%" (-> obj world-vertex 2)) + (format #t "~Ttri-vertex[3] @ #x~X~%" (-> obj world-vertex 3)) + (format #t "~Tleft-hand-hold: #~%" (-> obj left-hand-hold)) + (format #t "~Tright-hand-hold: #~%" (-> obj right-hand-hold)) + (format #t "~Tcenter-hold-old: ~`vector`P~%" (-> obj center-hold-old)) + (format #t "~Tedge-tri-pat: ~D~%" (-> obj edge-tri-pat)) + obj + ) + +;; definition of type collide-edge-tri +(deftype collide-edge-tri (structure) + ((ctri collide-cache-tri :offset-assert 0) + (normal vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type collide-edge-tri +(defmethod inspect collide-edge-tri ((obj collide-edge-tri)) + (format #t "[~8x] ~A~%" obj 'collide-edge-tri) + (format #t "~Tctri: #~%" (-> obj ctri)) + (format #t "~Tnormal: #~%" (-> obj normal)) + obj + ) + +;; definition of type collide-edge-edge +(deftype collide-edge-edge (structure) + ((ignore basic :offset-assert 0) + (etri collide-edge-tri :offset-assert 4) + (vertex-ptr vector 2 :offset-assert 8) + (outward vector :inline :offset-assert 16) + (edge-vec-norm vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type collide-edge-edge +(defmethod inspect collide-edge-edge ((obj collide-edge-edge)) + (format #t "[~8x] ~A~%" obj 'collide-edge-edge) + (format #t "~Tignore: ~A~%" (-> obj ignore)) + (format #t "~Tetri: #~%" (-> obj etri)) + (format #t "~Tvertex-ptr[2] @ #x~X~%" (-> obj vertex-ptr)) + (format #t "~Toutward: #~%" (-> obj outward)) + (format #t "~Tedge-vec-norm: #~%" (-> obj edge-vec-norm)) + obj + ) + +;; definition of type collide-edge-hold-item +(deftype collide-edge-hold-item (structure) + ((next collide-edge-hold-item :offset-assert 0) + (rating float :offset-assert 4) + (split int8 :offset-assert 8) + (edge collide-edge-edge :offset-assert 12) + (center-pt vector :inline :offset-assert 16) + (outward-pt vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type collide-edge-hold-item +(defmethod inspect collide-edge-hold-item ((obj collide-edge-hold-item)) + (format #t "[~8x] ~A~%" obj 'collide-edge-hold-item) + (format #t "~Tnext: #~%" (-> obj next)) + (format #t "~Trating: ~f~%" (-> obj rating)) + (format #t "~Tsplit: ~D~%" (-> obj split)) + (format #t "~Tedge: #~%" (-> obj edge)) + (format #t "~Tcenter-pt: #~%" (-> obj center-pt)) + (format #t "~Toutward-pt: #~%" (-> obj outward-pt)) + obj + ) + +;; definition of type collide-edge-hold-list +(deftype collide-edge-hold-list (structure) + ((num-allocs uint32 :offset-assert 0) + (num-attempts uint32 :offset-assert 4) + (head collide-edge-hold-item :offset-assert 8) + (items collide-edge-hold-item 32 :inline :offset-assert 16) + (attempts qword 32 :inline :offset-assert 1552) + ) + :method-count-assert 11 + :size-assert #x810 + :flag-assert #xb00000810 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + ) + ) + +;; definition for method 3 of type collide-edge-hold-list +(defmethod inspect collide-edge-hold-list ((obj collide-edge-hold-list)) + (format #t "[~8x] ~A~%" obj 'collide-edge-hold-list) + (format #t "~Tnum-allocs: ~D~%" (-> obj num-allocs)) + (format #t "~Tnum-attempts: ~D~%" (-> obj num-attempts)) + (format #t "~Thead: #~%" (-> obj head)) + (format #t "~Titems[32] @ #x~X~%" (-> obj items)) + (format #t "~Tattempts[32] @ #x~X~%" (-> obj attempts)) + obj + ) + +;; definition of type collide-edge-work +(deftype collide-edge-work (structure) + ((ccache basic :offset-assert 0) + (cshape basic :offset-assert 4) + (num-verts uint32 :offset-assert 8) + (num-edges uint32 :offset-assert 12) + (num-tris uint32 :offset-assert 16) + (cache-fill-box bounding-box :inline :offset-assert 32) + (within-reach-box bounding-box :inline :offset-assert 64) + (within-reach-box4w bounding-box4w :inline :offset-assert 96) + (search-pt vector :inline :offset-assert 128) + (search-dir-vec vector :inline :offset-assert 144) + (max-dist-sqrd-to-outward-pt float :offset-assert 160) + (max-dir-cosa-delta float :offset-assert 164) + (split-dists float 2 :offset-assert 168) + (outward-offset vector :inline :offset-assert 176) + (local-cache-fill-box bounding-box :inline :offset-assert 192) + (local-within-reach-box bounding-box :inline :offset-assert 224) + (local-player-spheres sphere 12 :inline :offset-assert 256) + (world-player-spheres sphere 12 :inline :offset-assert 448) + (local-player-hanging-spheres sphere 6 :inline :offset 256) + (world-player-hanging-spheres sphere 6 :inline :offset 448) + (local-player-leap-up-spheres sphere 6 :inline :offset 352) + (world-player-leap-up-spheres sphere 6 :inline :offset 544) + (verts vector 64 :inline :offset-assert 640) + (edges collide-edge-edge 96 :inline :offset-assert 1664) + (tris collide-edge-tri 48 :inline :offset-assert 6272) + (hold-list collide-edge-hold-list :inline :offset-assert 7808) + ) + :method-count-assert 20 + :size-assert #x2690 + :flag-assert #x1400002690 + (: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) + ) + ) + +;; definition for method 3 of type collide-edge-work +(defmethod inspect collide-edge-work ((obj collide-edge-work)) + (format #t "[~8x] ~A~%" obj 'collide-edge-work) + (format #t "~Tccache: ~A~%" (-> obj ccache)) + (format #t "~Tcshape: ~A~%" (-> obj cshape)) + (format #t "~Tnum-verts: ~D~%" (-> obj num-verts)) + (format #t "~Tnum-edges: ~D~%" (-> obj num-edges)) + (format #t "~Tnum-tris: ~D~%" (-> obj num-tris)) + (format + #t + "~Tcache-fill-box: #~%" + (-> obj cache-fill-box) + ) + (format + #t + "~Twithin-reach-box: #~%" + (-> obj within-reach-box) + ) + (format + #t + "~Twithin-reach-box4w: #~%" + (-> obj within-reach-box4w) + ) + (format #t "~Tsearch-pt: #~%" (-> obj search-pt)) + (format #t "~Tsearch-dir-vec: #~%" (-> obj search-dir-vec)) + (format + #t + "~Tmax-dist-sqrd-to-outward-pt: ~f~%" + (-> obj max-dist-sqrd-to-outward-pt) + ) + (format #t "~Tmax-dir-cosa-delta: ~f~%" (-> obj max-dir-cosa-delta)) + (format #t "~Tsplit-dists[2] @ #x~X~%" (-> obj split-dists)) + (format #t "~Toutward-offset: #~%" (-> obj outward-offset)) + (format + #t + "~Tlocal-cache-fill-box: #~%" + (-> obj local-cache-fill-box) + ) + (format + #t + "~Tlocal-within-reach-box: #~%" + (-> obj local-within-reach-box) + ) + (format + #t + "~Tlocal-player-spheres[12] @ #x~X~%" + (-> obj local-player-spheres) + ) + (format + #t + "~Tworld-player-spheres[12] @ #x~X~%" + (-> obj world-player-spheres) + ) + (format + #t + "~Tlocal-player-hanging-spheres[6] @ #x~X~%" + (-> obj local-player-spheres) + ) + (format + #t + "~Tworld-player-hanging-spheres[6] @ #x~X~%" + (-> obj world-player-spheres) + ) + (format + #t + "~Tlocal-player-leap-up-spheres[6] @ #x~X~%" + (-> obj local-player-spheres 6) + ) + (format + #t + "~Tworld-player-leap-up-spheres[6] @ #x~X~%" + (-> obj world-player-spheres 6) + ) + (format #t "~Tverts[64] @ #x~X~%" (-> obj verts)) + (format #t "~Tedges[96] @ #x~X~%" (-> obj edges)) + (format #t "~Ttris[48] @ #x~X~%" (-> obj tris)) + (format + #t + "~Thold-list: #~%" + (-> obj hold-list) + ) + obj + ) + +;; definition for symbol *collide-edge-work*, type collide-edge-work +(define + *collide-edge-work* + (new 'static 'collide-edge-work + :max-dist-sqrd-to-outward-pt 37748736.0 + :max-dir-cosa-delta 0.6 + :split-dists + (new 'static 'array float 2 1024.0 1433.6) + :outward-offset + (new 'static 'vector :x 708.608 :y 13312.0 :w 1.0) + :local-cache-fill-box + (new 'static 'bounding-box + :min + (new 'static 'vector :x -8192.0 :y -11059.2 :z -8192.0 :w 1.0) + :max + (new 'static 'vector :x 8192.0 :y 24576.0 :z 8192.0 :w 1.0) + ) + :local-within-reach-box + (new 'static 'bounding-box + :min + (new 'static 'vector :x -6144.0 :y 5324.8 :z -6144.0 :w 1.0) + :max + (new 'static 'vector :x 6144.0 :y 11059.2 :z 6144.0 :w 1.0) + ) + :local-player-spheres + (new 'static 'inline-array sphere 12 + (new 'static 'sphere :x 1720.32 :y -819.2 :w 1433.6) + (new 'static 'sphere :x 2293.76 :y -3276.8 :w 1884.16) + (new 'static 'sphere :x 1966.08 :y -6144.0 :w 1556.48) + (new 'static 'sphere :x 1966.08 :y -8601.6 :w 1556.48) + (new 'static 'sphere :x 1761.28 :y -11059.2 :w 1351.68) + (new 'static 'sphere :x 1679.36 :y -13312.0 :w 1269.76) + (new 'static 'sphere :x -737.28 :y 4096.0 :w 3072.0) + (new 'static 'sphere :x -737.28 :y 6553.6 :w 3072.0) + (new 'static 'sphere :x -737.28 :y 9420.8 :w 3072.0) + (new 'static 'sphere :x 1720.32 :y 3686.4 :w 2949.12) + (new 'static 'sphere :x 1720.32 :y 5734.4 :w 2949.12) + (new 'static 'sphere :x 1720.32 :y 8601.6 :w 2949.12) + ) + ) + ) + +;; definition (perm) for symbol *edge-grab-info*, type edge-grab-info +(define-perm *edge-grab-info* edge-grab-info (new 'global 'edge-grab-info)) + + + + diff --git a/test/decompiler/reference/engine/collide/collide-mesh-h_REF.gc b/test/decompiler/reference/engine/collide/collide-mesh-h_REF.gc new file mode 100644 index 0000000000..33f7a9da8f --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-mesh-h_REF.gc @@ -0,0 +1,153 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type collide-tri-result +(deftype collide-tri-result (structure) + ((vertex vector 3 :inline :offset-assert 0) + (intersect vector :inline :offset-assert 48) + (normal vector :inline :offset-assert 64) + (pat uint32 :offset-assert 80) + ) + :method-count-assert 9 + :size-assert #x54 + :flag-assert #x900000054 + ) + +;; definition for method 3 of type collide-tri-result +(defmethod inspect collide-tri-result ((obj collide-tri-result)) + (format #t "[~8x] ~A~%" obj 'collide-tri-result) + (format #t "~Tvertex[3] @ #x~X~%" (-> obj vertex)) + (format #t "~Tintersect: ~`vector`P~%" (-> obj intersect)) + (format #t "~Tnormal: ~`vector`P~%" (-> obj normal)) + (format #t "~Tpat: ~D~%" (-> obj pat)) + obj + ) + +;; definition of type collide-mesh-tri +(deftype collide-mesh-tri (structure) + ((vertex-index uint8 3 :offset-assert 0) + (unused uint8 :offset-assert 3) + (pat uint32 :offset-assert 4) + ) + :pack-me + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type collide-mesh-tri +(defmethod inspect collide-mesh-tri ((obj collide-mesh-tri)) + (format #t "[~8x] ~A~%" obj 'collide-mesh-tri) + (format #t "~Tvertex-index[3] @ #x~X~%" (-> obj vertex-index)) + (format #t "~Tunused: ~D~%" (-> obj unused)) + (format #t "~Tpat: ~D~%" (-> obj pat)) + obj + ) + +;; definition of type collide-mesh +(deftype collide-mesh (basic) + ((joint-id int32 :offset-assert 4) + (num-tris uint32 :offset-assert 8) + (num-verts uint32 :offset-assert 12) + (vertex-data uint32 :offset-assert 16) + (tris collide-mesh-tri 1 :inline :offset 32) + ) + :method-count-assert 16 + :size-assert #x28 + :flag-assert #x1000000028 + (: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) + ) + ) + +;; definition for method 3 of type collide-mesh +(defmethod inspect collide-mesh ((obj collide-mesh)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tjoint-id: ~D~%" (-> obj joint-id)) + (format #t "~Tnum-tris: ~D~%" (-> obj num-tris)) + (format #t "~Tnum-verts: ~D~%" (-> obj num-verts)) + (format #t "~Tvertex-data: #x~X~%" (-> obj vertex-data)) + (format #t "~Ttris[1] @ #x~X~%" (-> obj tris)) + obj + ) + +;; definition of type collide-mesh-cache +(deftype collide-mesh-cache (basic) + ((used-size uint32 :offset-assert 4) + (max-size uint32 :offset-assert 8) + (id uint64 :offset-assert 16) + (data uint8 40960 :offset 32) + ) + :method-count-assert 12 + :size-assert #xa020 + :flag-assert #xc0000a020 + (:methods + (dummy-9 () none 9) + (is-id? (_type_ int) symbol 10) + (next-id! (_type_) uint 11) + ) + ) + +;; definition for method 3 of type collide-mesh-cache +(defmethod inspect collide-mesh-cache ((obj collide-mesh-cache)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tused-size: ~D~%" (-> obj used-size)) + (format #t "~Tmax-size: ~D~%" (-> obj max-size)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tdata[40960] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition for method 11 of type collide-mesh-cache +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for method 10 of type collide-mesh-cache +(defmethod is-id? collide-mesh-cache ((obj collide-mesh-cache) (arg0 int)) + (= (-> obj id) arg0) + ) + +;; definition of type collide-mesh-cache-tri +(deftype collide-mesh-cache-tri (structure) + ((vertex vector 3 :inline :offset-assert 0) + (normal vector :inline :offset-assert 48) + (bbox4w bounding-box4w :inline :offset-assert 64) + (pat uint32 :offset 60) + ) + :method-count-assert 9 + :size-assert #x60 + :flag-assert #x900000060 + ) + +;; definition for method 3 of type collide-mesh-cache-tri +(defmethod inspect collide-mesh-cache-tri ((obj collide-mesh-cache-tri)) + (format #t "[~8x] ~A~%" obj 'collide-mesh-cache-tri) + (format #t "~Tvertex[3] @ #x~X~%" (-> obj vertex)) + (format #t "~Tnormal: ~`vector`P~%" (-> obj normal)) + (format #t "~Tbbox4w: #~%" (-> obj bbox4w)) + (format #t "~Tpat: ~D~%" (-> obj normal w)) + obj + ) + +;; definition (perm) for symbol *collide-mesh-cache*, type collide-mesh-cache +(define-perm *collide-mesh-cache* collide-mesh-cache + (new 'global 'collide-mesh-cache) + ) + +;; failed to figure out what this is: +(set! (-> *collide-mesh-cache* id) (the-as uint 1)) + +;; failed to figure out what this is: +(set! (-> *collide-mesh-cache* used-size) (the-as uint 0)) + +;; failed to figure out what this is: +(set! (-> *collide-mesh-cache* max-size) (the-as uint #xa000)) + + + + diff --git a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc new file mode 100644 index 0000000000..809183cc1d --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc @@ -0,0 +1,859 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type collide-sticky-rider +(deftype collide-sticky-rider (structure) + ((rider-handle handle :offset-assert 0) + (sticky-prim basic :offset-assert 8) + (prim-ry float :offset-assert 12) + (rider-local-pos vector :inline :offset-assert 16) + ) + :method-count-assert 10 + :size-assert #x20 + :flag-assert #xa00000020 + (:methods + (set-rider! (_type_ handle) symbol 9) + ) + ) + +;; definition for method 3 of type collide-sticky-rider +(defmethod inspect collide-sticky-rider ((obj collide-sticky-rider)) + (format #t "[~8x] ~A~%" obj 'collide-sticky-rider) + (format #t "~Trider-handle: ~D~%" (-> obj rider-handle)) + (format #t "~Tsticky-prim: ~A~%" (-> obj sticky-prim)) + (format #t "~Tprim-ry: ~f~%" (-> obj prim-ry)) + (format #t "~Trider-local-pos: #~%" (-> obj rider-local-pos)) + obj + ) + +;; definition for method 9 of type collide-sticky-rider +(defmethod + set-rider! + collide-sticky-rider + ((obj collide-sticky-rider) (arg0 handle)) + (set! (-> obj rider-handle) arg0) + (set! (-> obj sticky-prim) #f) + #f + ) + +;; definition of type collide-sticky-rider-group +(deftype collide-sticky-rider-group (basic) + ((num-riders int32 :offset-assert 4) + (allocated-riders int32 :offset-assert 8) + (rider collide-sticky-rider 1 :inline :offset-assert 16) + ) + :method-count-assert 11 + :size-assert #x30 + :flag-assert #xb00000030 + (:methods + (new (symbol type int) _type_ 0) + (dummy-9 () none 9) + (reset! (_type_) int 10) + ) + ) + +;; definition for method 3 of type collide-sticky-rider-group +(defmethod inspect collide-sticky-rider-group ((obj collide-sticky-rider-group)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tnum-riders: ~D~%" (-> obj num-riders)) + (format #t "~Tallocated-riders: ~D~%" (-> obj allocated-riders)) + (format #t "~Trider[1] @ #x~X~%" (-> obj rider)) + obj + ) + +;; definition for method 10 of type collide-sticky-rider-group +(defmethod reset! collide-sticky-rider-group ((obj collide-sticky-rider-group)) + (set! (-> obj num-riders) 0) + 0 + ) + +;; definition of type pull-rider-info +(deftype pull-rider-info (structure) + ((rider collide-sticky-rider :offset-assert 0) + (rider-cshape basic :offset-assert 4) + (rider-delta-ry float :offset-assert 8) + (rider-dest vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type pull-rider-info +(defmethod inspect pull-rider-info ((obj pull-rider-info)) + (format #t "[~8x] ~A~%" obj 'pull-rider-info) + (format #t "~Trider: #~%" (-> obj rider)) + (format #t "~Trider-cshape: ~A~%" (-> obj rider-cshape)) + (format #t "~Trider-delta-ry: ~f~%" (-> obj rider-delta-ry)) + (format #t "~Trider-dest: #~%" (-> obj rider-dest)) + obj + ) + +;; definition of type collide-shape-intersect +(deftype collide-shape-intersect (basic) + ((move-vec vector :inline :offset-assert 16) + (best-u float :offset-assert 32) + (best-tri collide-tri-result :inline :offset-assert 48) + (best-from-prim basic :offset-assert 132) + (best-to-prim basic :offset-assert 136) + ) + :method-count-assert 10 + :size-assert #x8c + :flag-assert #xa0000008c + (:methods + (dummy-9 () none 9) + ) + ) + +;; definition for method 3 of type collide-shape-intersect +(defmethod inspect collide-shape-intersect ((obj collide-shape-intersect)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tmove-vec: ~`vector`P~%" (-> obj move-vec)) + (format #t "~Tbest-u: ~f~%" (-> obj best-u)) + (format #t "~Tbest-tri: #~%" (-> obj best-tri)) + (format #t "~Tbest-from-prim: ~A~%" (-> obj best-from-prim)) + (format #t "~Tbest-to-prim: ~A~%" (-> obj best-to-prim)) + obj + ) + +;; definition of type collide-overlap-result +(deftype collide-overlap-result (structure) + ((best-dist float :offset-assert 0) + (best-from-prim basic :offset-assert 4) + (best-to-prim basic :offset-assert 8) + (best-from-tri collide-tri-result :inline :offset-assert 16) + ) + :method-count-assert 10 + :size-assert #x64 + :flag-assert #xa00000064 + (:methods + (reset! (_type_) none 9) + ) + ) + +;; definition for method 3 of type collide-overlap-result +(defmethod inspect collide-overlap-result ((obj collide-overlap-result)) + (format #t "[~8x] ~A~%" obj 'collide-overlap-result) + (format #t "~Tbest-dist: ~f~%" (-> obj best-dist)) + (format #t "~Tbest-from-prim: ~A~%" (-> obj best-from-prim)) + (format #t "~Tbest-to-prim: ~A~%" (-> obj best-to-prim)) + (format + #t + "~Tbest-from-tri: #~%" + (-> obj best-from-tri) + ) + obj + ) + +;; definition for method 9 of type collide-overlap-result +;; INFO: Return type mismatch symbol vs none. +(defmethod reset! collide-overlap-result ((obj collide-overlap-result)) + (set! (-> obj best-dist) 0.0) + (set! (-> obj best-from-prim) #f) + (set! (-> obj best-to-prim) #f) + (none) + ) + +;; definition of type overlaps-others-params +(deftype overlaps-others-params (structure) + ((options uint32 :offset-assert 0) + (tlist basic :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type overlaps-others-params +(defmethod inspect overlaps-others-params ((obj overlaps-others-params)) + (format #t "[~8x] ~A~%" obj 'overlaps-others-params) + (format #t "~Toptions: ~D~%" (-> obj options)) + (format #t "~Ttlist: ~A~%" (-> obj tlist)) + obj + ) + +;; definition for symbol *collide-hit-by-player-list*, type engine +(define + *collide-hit-by-player-list* + (new 'global 'engine 'collide-hit-by-player-list 768) + ) + +;; definition for symbol *collide-usually-hit-by-player-list*, type engine +(define + *collide-usually-hit-by-player-list* + (new 'global 'engine 'collide-usually-hit-by-player-list 256) + ) + +;; definition for symbol *collide-hit-by-others-list*, type engine +(define + *collide-hit-by-others-list* + (new 'global 'engine 'collide-hit-by-others-list 96) + ) + +;; definition for symbol *collide-player-list*, type engine +(define *collide-player-list* (new 'global 'engine 'collide-player-list 32)) + +;; definition of type collide-prim-core +(deftype collide-prim-core (structure) + ((world-sphere vector :inline :offset-assert 0) + (collide-as uint64 :offset-assert 16) + (action uint32 :offset-assert 24) + (offense int8 :offset-assert 28) + (prim-type int8 :offset-assert 29) + (extra uint8 2 :offset-assert 30) + (quad uint128 2 :offset 0) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type collide-prim-core +(defmethod inspect collide-prim-core ((obj collide-prim-core)) + (format #t "[~8x] ~A~%" obj 'collide-prim-core) + (format #t "~Tworld-sphere: ~`vector`P~%" (-> obj world-sphere)) + (format #t "~Tcollide-as: ~D~%" (-> obj collide-as)) + (format #t "~Taction: ~D~%" (-> obj action)) + (format #t "~Toffense: ~D~%" (-> obj offense)) + (format #t "~Tprim-type: ~D~%" (-> obj prim-type)) + (format #t "~Textra[2] @ #x~X~%" (-> obj extra)) + (format #t "~Tquad[2] @ #x~X~%" (-> obj world-sphere)) + obj + ) + +;; definition of type collide-shape-prim +(deftype collide-shape-prim (basic) + ((cshape basic :offset-assert 4) + (prim-id uint32 :offset-assert 8) + (transform-index int8 :offset-assert 12) + (prim-core collide-prim-core :inline :offset-assert 16) + (local-sphere vector :inline :offset-assert 48) + (collide-with uint64 :offset-assert 64) + (world-sphere vector :inline :offset 16) + (collide-as uint64 :offset 32) + (action uint32 :offset 40) + (offense int8 :offset 44) + (prim-type int8 :offset 45) + (radius float :offset 60) + ) + :method-count-assert 28 + :size-assert #x48 + :flag-assert #x1c00000048 + (:methods + (new (symbol type basic uint int) _type_ 0) + (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) + ) + ) + +;; definition for method 3 of type collide-shape-prim +(defmethod inspect collide-shape-prim ((obj collide-shape-prim)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tcshape: ~A~%" (-> obj cshape)) + (format #t "~Tprim-id: #x~X~%" (-> obj prim-id)) + (format #t "~Ttransform-index: ~D~%" (-> obj transform-index)) + (format #t "~Tprim-core: #~%" (-> obj prim-core)) + (format #t "~Tlocal-sphere: ~`vector`P~%" (-> obj local-sphere)) + (format #t "~Tcollide-with: ~D~%" (-> obj collide-with)) + (format #t "~Tworld-sphere: ~`vector`P~%" (-> obj prim-core)) + (format #t "~Tcollide-as: ~D~%" (-> obj prim-core collide-as)) + (format #t "~Taction: ~D~%" (-> obj prim-core action)) + (format #t "~Toffense: ~D~%" (-> obj prim-core offense)) + (format #t "~Tprim-type: ~D~%" (-> obj prim-core prim-type)) + (format #t "~Tradius: (meters ~m)~%" (-> obj local-sphere w)) + obj + ) + +;; definition of type collide-shape-prim-sphere +(deftype collide-shape-prim-sphere (collide-shape-prim) + ((pat uint32 :offset-assert 72) + ) + :method-count-assert 28 + :size-assert #x4c + :flag-assert #x1c0000004c + (:methods + (new (symbol type basic uint) _type_ 0) + ) + ) + +;; definition for method 3 of type collide-shape-prim-sphere +(defmethod inspect collide-shape-prim-sphere ((obj collide-shape-prim-sphere)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tcshape: ~A~%" (-> obj cshape)) + (format #t "~Tprim-id: #x~X~%" (-> obj prim-id)) + (format #t "~Ttransform-index: ~D~%" (-> obj transform-index)) + (format #t "~Tprim-core: #~%" (-> obj prim-core)) + (format #t "~Tlocal-sphere: ~`vector`P~%" (-> obj local-sphere)) + (format #t "~Tcollide-with: ~D~%" (-> obj collide-with)) + (format #t "~Tworld-sphere: ~`vector`P~%" (-> obj prim-core)) + (format #t "~Tcollide-as: ~D~%" (-> obj prim-core collide-as)) + (format #t "~Taction: ~D~%" (-> obj prim-core action)) + (format #t "~Toffense: ~D~%" (-> obj prim-core offense)) + (format #t "~Tprim-type: ~D~%" (-> obj prim-core prim-type)) + (format #t "~Tradius: (meters ~m)~%" (-> obj local-sphere w)) + (format #t "~Tpat: ~D~%" (-> obj pat)) + obj + ) + +;; definition of type collide-shape-prim-mesh +(deftype collide-shape-prim-mesh (collide-shape-prim) + ((mesh basic :offset-assert 72) + (mesh-id int32 :offset-assert 76) + (mesh-cache-id uint64 :offset-assert 80) + (mesh-cache-tris uint32 :offset-assert 88) + ) + :method-count-assert 29 + :size-assert #x5c + :flag-assert #x1d0000005c + (:methods + (new (symbol type basic uint uint) _type_ 0) + (dummy-28 () none 28) + ) + ) + +;; definition for method 3 of type collide-shape-prim-mesh +(defmethod inspect collide-shape-prim-mesh ((obj collide-shape-prim-mesh)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tcshape: ~A~%" (-> obj cshape)) + (format #t "~Tprim-id: #x~X~%" (-> obj prim-id)) + (format #t "~Ttransform-index: ~D~%" (-> obj transform-index)) + (format #t "~Tprim-core: #~%" (-> obj prim-core)) + (format #t "~Tlocal-sphere: ~`vector`P~%" (-> obj local-sphere)) + (format #t "~Tcollide-with: ~D~%" (-> obj collide-with)) + (format #t "~Tworld-sphere: ~`vector`P~%" (-> obj prim-core)) + (format #t "~Tcollide-as: ~D~%" (-> obj prim-core collide-as)) + (format #t "~Taction: ~D~%" (-> obj prim-core action)) + (format #t "~Toffense: ~D~%" (-> obj prim-core offense)) + (format #t "~Tprim-type: ~D~%" (-> obj prim-core prim-type)) + (format #t "~Tradius: (meters ~m)~%" (-> obj local-sphere w)) + (format #t "~Tmesh: ~A~%" (-> obj mesh)) + (format #t "~Tmesh-id: ~D~%" (-> obj mesh-id)) + (format #t "~Tmesh-cache-id: ~D~%" (-> obj mesh-cache-id)) + (format #t "~Tmesh-cache-tris: #x~X~%" (-> obj mesh-cache-tris)) + obj + ) + +;; definition of type collide-shape-prim-group +(deftype collide-shape-prim-group (collide-shape-prim) + ((num-prims int32 :offset-assert 72) + (allocated-prims int32 :offset-assert 76) + (prim uint32 1 :offset-assert 80) + ) + :method-count-assert 30 + :size-assert #x54 + :flag-assert #x1e00000054 + (:methods + (new (symbol type basic uint int) _type_ 0) + (dummy-28 () none 28) + (dummy-29 () none 29) + ) + ) + +;; definition for method 3 of type collide-shape-prim-group +(defmethod inspect collide-shape-prim-group ((obj collide-shape-prim-group)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tcshape: ~A~%" (-> obj cshape)) + (format #t "~Tprim-id: #x~X~%" (-> obj prim-id)) + (format #t "~Ttransform-index: ~D~%" (-> obj transform-index)) + (format #t "~Tprim-core: #~%" (-> obj prim-core)) + (format #t "~Tlocal-sphere: ~`vector`P~%" (-> obj local-sphere)) + (format #t "~Tcollide-with: ~D~%" (-> obj collide-with)) + (format #t "~Tworld-sphere: ~`vector`P~%" (-> obj prim-core)) + (format #t "~Tcollide-as: ~D~%" (-> obj prim-core collide-as)) + (format #t "~Taction: ~D~%" (-> obj prim-core action)) + (format #t "~Toffense: ~D~%" (-> obj prim-core offense)) + (format #t "~Tprim-type: ~D~%" (-> obj prim-core prim-type)) + (format #t "~Tradius: (meters ~m)~%" (-> obj local-sphere w)) + (format #t "~Tnum-prims: ~D~%" (-> obj num-prims)) + (format #t "~Tallocated-prims: ~D~%" (-> obj allocated-prims)) + (format #t "~Tprim[1] @ #x~X~%" (-> obj prim)) + obj + ) + +;; definition of type collide-shape +(deftype collide-shape (trsqv) + ((process basic :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 uint32 :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) + ) + :method-count-assert 56 + :size-assert #xb8 + :flag-assert #x38000000b8 + (:methods + (new (symbol type process collide-list-enum) _type_ 0) + (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-53 () none 53) + (dummy-54 () none 54) + (dummy-55 () none 55) + ) + ) + +;; definition for method 3 of type collide-shape +(defmethod inspect collide-shape ((obj collide-shape)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Ttrans: ~`vector`P~%" (-> obj trans)) + (format #t "~Trot: ~`vector`P~%" (-> obj rot)) + (format #t "~Tscale: ~`vector`P~%" (-> obj scale)) + (format #t "~Tquat: #~%" (-> obj rot)) + (format + #t + "~Tpause-adjust-distance: (meters ~m)~%" + (-> obj pause-adjust-distance) + ) + (format #t "~Tnav-radius: (meters ~m)~%" (-> obj nav-radius)) + (format #t "~Ttransv: ~`vector`P~%" (-> obj transv)) + (format #t "~Trotv: ~`vector`P~%" (-> obj rotv)) + (format #t "~Tscalev: ~`vector`P~%" (-> obj scalev)) + (format #t "~Tdir-targ: #~%" (-> obj dir-targ)) + (format #t "~Tangle-change-time: ~D~%" (-> obj angle-change-time)) + (format #t "~Told-y-angle-diff: ~f~%" (-> obj old-y-angle-diff)) + (format #t "~Tprocess: ~A~%" (-> obj process)) + (format #t "~Tmax-iteration-count: ~D~%" (-> obj max-iteration-count)) + (format #t "~Tnav-flags: ~D~%" (-> obj nav-flags)) + (format #t "~Tpad-byte[2] @ #x~X~%" (-> obj pad-byte)) + (format #t "~Tpat-ignore-mask: ~D~%" (-> obj pat-ignore-mask)) + (format #t "~Tevent-self: ~A~%" (-> obj event-self)) + (format #t "~Tevent-other: ~A~%" (-> obj event-other)) + (format #t "~Troot-prim: ~A~%" (-> obj root-prim)) + (format #t "~Triders: ~A~%" (-> obj riders)) + (format #t "~Tbackup-collide-as: ~D~%" (-> obj backup-collide-as)) + (format #t "~Tbackup-collide-with: ~D~%" (-> obj backup-collide-with)) + obj + ) + +;; definition of type collide-shape-moving +(deftype collide-shape-moving (collide-shape) + ((rider-time uint64 :offset-assert 184) + (rider-last-move vector :inline :offset-assert 192) + (trans-old vector 3 :inline :offset-assert 208) + (poly-pat uint32 :offset-assert 256) + (cur-pat uint32 :offset-assert 260) + (ground-pat uint32 :offset-assert 264) + (status uint64 :offset-assert 272) + (old-status uint64 :offset-assert 280) + (prev-status uint64 :offset-assert 288) + (reaction-flag uint32 :offset-assert 296) + (reaction basic :offset-assert 300) + (no-reaction basic :offset-assert 304) + (local-normal vector :inline :offset-assert 320) + (surface-normal vector :inline :offset-assert 336) + (poly-normal vector :inline :offset-assert 352) + (ground-poly-normal vector :inline :offset-assert 368) + (ground-touch-point vector :inline :offset-assert 384) + (shadow-pos vector :inline :offset-assert 400) + (ground-impact-vel float :offset-assert 416) + (surface-angle float :offset-assert 420) + (poly-angle float :offset-assert 424) + (touch-angle float :offset-assert 428) + (coverage float :offset-assert 432) + (dynam basic :offset-assert 436) + (surf basic :offset-assert 440) + ) + :method-count-assert 65 + :size-assert #x1bc + :flag-assert #x41000001bc + (:methods + (dummy-56 () none 56) + (dummy-57 () none 57) + (dummy-58 () none 58) + (dummy-59 () none 59) + (dummy-60 () none 60) + (dummy-61 () none 61) + (dummy-62 () none 62) + (dummy-63 () none 63) + (dummy-64 () none 64) + ) + ) + +;; definition for method 3 of type collide-shape-moving +(defmethod inspect collide-shape-moving ((obj collide-shape-moving)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Ttrans: ~`vector`P~%" (-> obj trans)) + (format #t "~Trot: ~`vector`P~%" (-> obj rot)) + (format #t "~Tscale: ~`vector`P~%" (-> obj scale)) + (format #t "~Tquat: #~%" (-> obj rot)) + (format + #t + "~Tpause-adjust-distance: (meters ~m)~%" + (-> obj pause-adjust-distance) + ) + (format #t "~Tnav-radius: (meters ~m)~%" (-> obj nav-radius)) + (format #t "~Ttransv: ~`vector`P~%" (-> obj transv)) + (format #t "~Trotv: ~`vector`P~%" (-> obj rotv)) + (format #t "~Tscalev: ~`vector`P~%" (-> obj scalev)) + (format #t "~Tdir-targ: #~%" (-> obj dir-targ)) + (format #t "~Tangle-change-time: ~D~%" (-> obj angle-change-time)) + (format #t "~Told-y-angle-diff: ~f~%" (-> obj old-y-angle-diff)) + (format #t "~Tprocess: ~A~%" (-> obj process)) + (format #t "~Tmax-iteration-count: ~D~%" (-> obj max-iteration-count)) + (format #t "~Tnav-flags: ~D~%" (-> obj nav-flags)) + (format #t "~Tpad-byte[2] @ #x~X~%" (-> obj pad-byte)) + (format #t "~Tpat-ignore-mask: ~D~%" (-> obj pat-ignore-mask)) + (format #t "~Tevent-self: ~A~%" (-> obj event-self)) + (format #t "~Tevent-other: ~A~%" (-> obj event-other)) + (format #t "~Troot-prim: ~A~%" (-> obj root-prim)) + (format #t "~Triders: ~A~%" (-> obj riders)) + (format #t "~Tbackup-collide-as: ~D~%" (-> obj backup-collide-as)) + (format #t "~Tbackup-collide-with: ~D~%" (-> obj backup-collide-with)) + (format #t "~Trider-time: ~D~%" (-> obj rider-time)) + (format #t "~Trider-last-move: ~`vector`P~%" (-> obj rider-last-move)) + (format #t "~Ttrans-old[3] @ #x~X~%" (-> obj trans-old)) + (format #t "~Tpoly-pat: #x~X~%" (-> obj poly-pat)) + (format #t "~Tcur-pat: #x~X~%" (-> obj cur-pat)) + (format #t "~Tground-pat: #x~X~%" (-> obj ground-pat)) + (format #t "~Tstatus: ~D~%" (-> obj status)) + (format #t "~Told-status: ~D~%" (-> obj old-status)) + (format #t "~Tprev-status: ~D~%" (-> obj prev-status)) + (format #t "~Treaction-flag: ~D~%" (-> obj reaction-flag)) + (format #t "~Treaction: ~A~%" (-> obj reaction)) + (format #t "~Tno-reaction: ~A~%" (-> obj no-reaction)) + (format #t "~Tlocal-normal: ~`vector`P~%" (-> obj local-normal)) + (format #t "~Tsurface-normal: ~`vector`P~%" (-> obj surface-normal)) + (format #t "~Tpoly-normal: ~`vector`P~%" (-> obj poly-normal)) + (format #t "~Tground-poly-normal: ~`vector`P~%" (-> obj ground-poly-normal)) + (format #t "~Tground-touch-point: ~`vector`P~%" (-> obj ground-touch-point)) + (format #t "~Tshadow-pos: ~`vector`P~%" (-> obj shadow-pos)) + (format #t "~Tground-impact-vel: (meters ~m)~%" (-> obj ground-impact-vel)) + (format #t "~Tsurface-angle: ~f~%" (-> obj surface-angle)) + (format #t "~Tpoly-angle: ~f~%" (-> obj poly-angle)) + (format #t "~Ttouch-angle: ~f~%" (-> obj touch-angle)) + (format #t "~Tcoverage: ~f~%" (-> obj coverage)) + (format #t "~Tdynam: ~A~%" (-> obj dynam)) + (format #t "~Tsurf: ~A~%" (-> obj surf)) + obj + ) + +;; definition for method 0 of type collide-shape-prim +(defmethod + new + collide-shape-prim + ((allocation symbol) + (type-to-make type) + (cshape basic) + (prim-id uint) + (size-bytes int) + ) + (let ((v0-0 (object-new allocation type-to-make size-bytes))) + (set! (-> v0-0 cshape) cshape) + (set! (-> v0-0 prim-id) prim-id) + (set! (-> v0-0 prim-core action) (the-as uint 0)) + (set! (-> v0-0 prim-core collide-as) (the-as uint 0)) + (set! (-> v0-0 collide-with) (the-as uint 0)) + (set! (-> v0-0 transform-index) -2) + (set! (-> v0-0 prim-core offense) 0) + (set! (-> v0-0 prim-core prim-type) -2) + v0-0 + ) + ) + +;; definition for method 0 of type collide-shape-prim-sphere +;; INFO: Return type mismatch collide-shape-prim vs collide-shape-prim-sphere. +(defmethod + new + collide-shape-prim-sphere + ((allocation symbol) (type-to-make type) (cshape basic) (prim-id uint)) + (let + ((obj + (the-as + collide-shape-prim-sphere + ((method-of-type collide-shape-prim new) + allocation + type-to-make + cshape + prim-id + 76 + ) + ) + ) + ) + (set! (-> obj pat) (the-as uint 16)) + (set! (-> obj prim-core prim-type) -1) + (the-as collide-shape-prim-sphere (the-as collide-shape-prim obj)) + ) + ) + +;; definition for method 0 of type collide-shape-prim-mesh +;; INFO: Return type mismatch collide-shape-prim vs collide-shape-prim-mesh. +(defmethod + new + collide-shape-prim-mesh + ((allocation symbol) + (type-to-make type) + (cshape basic) + (mesh-id uint) + (prim-id uint) + ) + (let + ((obj + (the-as + collide-shape-prim-mesh + ((method-of-type collide-shape-prim new) + allocation + type-to-make + cshape + prim-id + 92 + ) + ) + ) + ) + (set! (-> obj mesh) #f) + (set! (-> obj mesh-id) (the-as int mesh-id)) + (set! (-> obj mesh-cache-id) (the-as uint 0)) + (set! (-> obj prim-core prim-type) 1) + (the-as collide-shape-prim-mesh (the-as collide-shape-prim obj)) + ) + ) + +;; definition for method 0 of type collide-shape-prim-group +;; INFO: Return type mismatch collide-shape-prim vs collide-shape-prim-group. +(defmethod + new + collide-shape-prim-group + ((allocation symbol) + (type-to-make type) + (cshape basic) + (elt-count uint) + (prim-id int) + ) + (let + ((obj + (the-as + collide-shape-prim-group + ((method-of-type collide-shape-prim new) + allocation + type-to-make + cshape + (the-as uint prim-id) + (the-as int (+ (-> type-to-make size) (* (+ elt-count -1) 4))) + ) + ) + ) + ) + (set! (-> obj allocated-prims) (the-as int elt-count)) + (set! (-> obj num-prims) 0) + (set! (-> obj prim-core prim-type) 0) + (while (nonzero? elt-count) + (+! elt-count -1) + (set! (-> obj prim elt-count) (the-as uint #f)) + (nop!) + ) + (the-as collide-shape-prim-group (the-as collide-shape-prim obj)) + ) + ) + +;; definition for method 4 of type collide-shape-prim-group +(defmethod length collide-shape-prim-group ((obj collide-shape-prim-group)) + (-> obj num-prims) + ) + +;; definition for method 5 of type collide-shape-prim-group +;; INFO: Return type mismatch uint vs int. +(defmethod asize-of collide-shape-prim-group ((obj collide-shape-prim-group)) + (the-as + int + (+ (-> obj type size) (the-as uint (* (+ (-> obj allocated-prims) -1) 4))) + ) + ) + +;; definition for method 0 of type collide-shape +(defmethod + new + collide-shape + ((allocation symbol) + (type-to-make type) + (proc process) + (collide-list-kind collide-list-enum) + ) + (let + ((obj + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> obj process) proc) + (set! (-> obj max-iteration-count) (the-as uint 1)) + (set! (-> obj nav-flags) (the-as uint 1)) + (set! (-> obj event-self) #f) + (set! (-> obj event-other) #f) + (set! (-> obj riders) #f) + (set! (-> obj root-prim) #f) + (let ((v1-5 (-> proc type symbol))) + (if (= v1-5 'camera) + (set! (-> obj pat-ignore-mask) (the-as uint 2)) + (set! (-> obj pat-ignore-mask) (the-as uint 1)) + ) + ) + (set! (-> obj trans w) 1.0) + (quaternion-identity! (the-as quaternion (-> obj rot))) + (vector-identity! (-> obj scale)) + (cond + ((= collide-list-kind (collide-list-enum hit-by-player)) + (add-connection + *collide-hit-by-player-list* + proc + (the-as (function object object object object object) #f) + obj + #f + #f + ) + ) + ((= collide-list-kind (collide-list-enum usually-hit-by-player)) + (add-connection + *collide-usually-hit-by-player-list* + proc + (the-as (function object object object object object) #f) + obj + #f + #f + ) + ) + ((= collide-list-kind (collide-list-enum hit-by-others)) + (add-connection + *collide-hit-by-others-list* + proc + (the-as (function object object object object object) #f) + obj + #f + #f + ) + ) + ((= collide-list-kind (collide-list-enum player)) + (add-connection + *collide-player-list* + proc + (the-as (function object object object object object) #f) + obj + #f + #f + ) + ) + (else + (format 0 "Unsupported collide-list-enum in collide-shape constructor!~%") + ) + ) + obj + ) + ) + +;; definition for method 0 of type collide-sticky-rider-group +(defmethod + new + collide-sticky-rider-group + ((allocation symbol) (type-to-make type) (arg0 int)) + (let + ((obj + (object-new + allocation + type-to-make + (the-as int (+ (-> type-to-make size) (the-as uint (* (+ arg0 -1) 32)))) + ) + ) + ) + (set! (-> obj allocated-riders) arg0) + (set! (-> obj num-riders) 0) + obj + ) + ) + +;; definition for method 4 of type collide-sticky-rider-group +(defmethod length collide-sticky-rider-group ((obj collide-sticky-rider-group)) + (-> obj num-riders) + ) + +;; definition for method 5 of type collide-sticky-rider-group +;; INFO: Return type mismatch uint vs int. +(defmethod asize-of collide-sticky-rider-group ((obj collide-sticky-rider-group)) + (the-as + int + (+ (-> obj type size) (the-as uint (* (+ (-> obj allocated-riders) -1) 32))) + ) + ) + +;; definition for symbol *collide-shape-prim-backgnd*, type collide-shape-prim-mesh +(define + *collide-shape-prim-backgnd* + (new 'static 'collide-shape-prim-mesh + :cshape #f + :prim-core + (new 'static 'collide-prim-core + :world-sphere (new 'static 'vector :w 204800000.0) + :collide-as #x1 + :action #x1 + :offense 4 + :prim-type 2 + ) + :local-sphere (new 'static 'vector :w 204800000.0) + :mesh #f + ) + ) + +;; definition for symbol *collide-shape-prim-water*, type collide-shape-prim-mesh +(define + *collide-shape-prim-water* + (new 'static 'collide-shape-prim-mesh + :cshape #f + :prim-core + (new 'static 'collide-prim-core + :world-sphere (new 'static 'vector :w 204800000.0) + :collide-as #x20 + :action #x1 + :offense 4 + :prim-type 2 + ) + :local-sphere (new 'static 'vector :w 204800000.0) + :mesh #f + ) + ) + + + + diff --git a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc new file mode 100644 index 0000000000..f79b56d506 --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc @@ -0,0 +1,78 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type collide-history +(deftype collide-history (structure) + ((intersect vector :inline :offset-assert 0) + (trans vector :inline :offset-assert 16) + (transv vector :inline :offset-assert 32) + (transv-out vector :inline :offset-assert 48) + (local-normal vector :inline :offset-assert 64) + (surface-normal vector :inline :offset-assert 80) + (time uint64 :offset-assert 96) + (status uint64 :offset-assert 104) + (pat uint32 :offset-assert 112) + (reaction-flag uint32 :offset-assert 116) + ) + :method-count-assert 10 + :size-assert #x78 + :flag-assert #xa00000078 + (:methods + (update! (_type_ collide-shape-moving vector vector vector) _type_ 9) + ) + ) + +;; definition for method 3 of type collide-history +(defmethod inspect collide-history ((obj collide-history)) + (format #t "[~8x] ~A~%" obj 'collide-history) + (format #t "~Tintersect: ~`vector`P~%" (-> obj intersect)) + (format #t "~Ttrans: ~`vector`P~%" (-> obj trans)) + (format #t "~Ttransv: ~`vector`P~%" (-> obj transv)) + (format #t "~Ttransv-out: ~`vector`P~%" (-> obj transv-out)) + (format #t "~Tlocal-normal: ~`vector`P~%" (-> obj local-normal)) + (format #t "~Tsurface-normal: ~`vector`P~%" (-> obj surface-normal)) + (format #t "~Ttime: ~D~%" (-> obj time)) + (format #t "~Tstatus: ~D~%" (-> obj status)) + (format #t "~Tpat: ~D~%" (-> obj pat)) + (format #t "~Treaction-flag: ~D~%" (-> obj reaction-flag)) + obj + ) + +;; definition of type control-info +(deftype control-info (collide-shape-moving) + ((array-size int16 :offset 2490) + (history-array collide-history 128 :inline :offset-assert 2496) + (pad uint32 27 :offset-assert 18880) + ) + :method-count-assert 65 + :size-assert #x4a2c + :flag-assert #x4100004a2c + ) + +;; definition for method 9 of type collide-history +;; Used lq/sq +(defmethod + update! + collide-history + ((obj collide-history) + (cshape collide-shape-moving) + (xs vector) + (transv vector) + (transv-out vector) + ) + (set! (-> obj intersect quad) (-> xs quad)) + (set! (-> obj transv quad) (-> transv quad)) + (set! (-> obj transv-out quad) (-> transv-out quad)) + (set! (-> obj trans quad) (-> cshape trans quad)) + (set! (-> obj local-normal quad) (-> cshape local-normal quad)) + (set! (-> obj surface-normal quad) (-> cshape surface-normal quad)) + (set! (-> obj time) (-> *display* base-frame-counter)) + (set! (-> obj status) (-> cshape status)) + (set! (-> obj reaction-flag) (-> cshape reaction-flag)) + (set! (-> obj pat) (-> cshape cur-pat)) + obj + ) + + + + diff --git a/test/decompiler/reference/engine/collide/collide-touch-h_REF.gc b/test/decompiler/reference/engine/collide/collide-touch-h_REF.gc new file mode 100644 index 0000000000..e8bf58c710 --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-touch-h_REF.gc @@ -0,0 +1,226 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type touching-prim +(deftype touching-prim (structure) + ((cprim basic :offset-assert 0) + (has-tri? basic :offset-assert 4) + (tri collide-tri-result :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x64 + :flag-assert #x900000064 + ) + +;; definition for method 3 of type touching-prim +(defmethod inspect touching-prim ((obj touching-prim)) + (format #t "[~8x] ~A~%" obj 'touching-prim) + (format #t "~Tcprim: ~A~%" (-> obj cprim)) + (format #t "~Thas-tri?: ~A~%" (-> obj has-tri?)) + (format #t "~Ttri: #~%" (-> obj tri)) + obj + ) + +;; definition of type touching-prims-entry +(deftype touching-prims-entry (structure) + ((next touching-prims-entry :offset-assert 0) + (prev touching-prims-entry :offset-assert 4) + (allocated? basic :offset-assert 8) + (u float :offset-assert 12) + (prim1 touching-prim :inline :offset-assert 16) + (prim2 touching-prim :inline :offset-assert 128) + ) + :method-count-assert 13 + :size-assert #xe4 + :flag-assert #xd000000e4 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + ) + ) + +;; definition for method 3 of type touching-prims-entry +(defmethod inspect touching-prims-entry ((obj touching-prims-entry)) + (format #t "[~8x] ~A~%" obj 'touching-prims-entry) + (format #t "~Tnext: #~%" (-> obj next)) + (format #t "~Tprev: #~%" (-> obj prev)) + (format #t "~Tallocated?: ~A~%" (-> obj allocated?)) + (format #t "~Tu: ~f~%" (-> obj u)) + (format #t "~Tprim1: #~%" (-> obj prim1)) + (format #t "~Tprim2: #~%" (-> obj prim2)) + obj + ) + +;; definition of type touching-prims-entry-pool +(deftype touching-prims-entry-pool (structure) + ((head touching-prims-entry :offset-assert 0) + (nodes touching-prims-entry 64 :inline :offset-assert 16) + ) + :method-count-assert 13 + :size-assert #x3c10 + :flag-assert #xd00003c10 + (:methods + (new (symbol type) _type_ 0) + (dummy-9 () none 9) + (dummy-10 () none 10) + (init-list! (_type_) none 11) + (dummy-12 () none 12) + ) + ) + +;; definition for method 3 of type touching-prims-entry-pool +(defmethod inspect touching-prims-entry-pool ((obj touching-prims-entry-pool)) + (format #t "[~8x] ~A~%" obj 'touching-prims-entry-pool) + (format #t "~Thead: #~%" (-> obj head)) + (format #t "~Tnodes[64] @ #x~X~%" (-> obj nodes)) + obj + ) + +;; definition for method 11 of type touching-prims-entry-pool +;; INFO: Return type mismatch symbol vs none. +(defmethod init-list! touching-prims-entry-pool ((obj touching-prims-entry-pool)) + (let ((prev (the-as touching-prims-entry #f))) + (let ((current (the-as touching-prims-entry (-> obj nodes)))) + (set! (-> obj head) current) + (let ((a0-1 64)) + (while (nonzero? a0-1) + (+! a0-1 -1) + (set! (-> current prev) prev) + (let ((next (&+ current 240))) + (set! (-> current next) (the-as touching-prims-entry next)) + (set! (-> current allocated?) #f) + (set! prev current) + (set! current (the-as touching-prims-entry next)) + ) + ) + ) + ) + (set! (-> prev next) #f) + ) + (none) + ) + +;; definition for method 0 of type touching-prims-entry-pool +;; INFO: Return type mismatch structure vs touching-prims-entry-pool. +(defmethod + new + touching-prims-entry-pool + ((allocation symbol) (type-to-make type)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (let ((a2-0 (-> type-to-make size))) + ) + (let ((gp-0 (t9-0 allocation v1-1))) + ((method-of-type touching-prims-entry-pool init-list!) + (the-as touching-prims-entry-pool gp-0) + ) + (the-as touching-prims-entry-pool gp-0) + ) + ) + ) + +;; definition of type touching-shapes-entry +(deftype touching-shapes-entry (structure) + ((cshape1 basic :offset-assert 0) + (cshape2 basic :offset-assert 4) + (resolve-u int8 :offset-assert 8) + (head touching-prims-entry :offset-assert 12) + ) + :allow-misaligned :method-count-assert 18 + :size-assert #x10 + :flag-assert #x1200000010 + (: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) + (get-head (_type_) touching-prims-entry 16) + (unknown1 (_type_ (pointer uint32)) uint 17) + ) + ) + +;; definition for method 3 of type touching-shapes-entry +(defmethod inspect touching-shapes-entry ((obj touching-shapes-entry)) + (format #t "[~8x] ~A~%" obj 'touching-shapes-entry) + (format #t "~Tcshape1: ~A~%" (-> obj cshape1)) + (format #t "~Tcshape2: ~A~%" (-> obj cshape2)) + (format #t "~Tresolve-u: ~D~%" (-> obj resolve-u)) + (format #t "~Thead: #~%" (-> obj head)) + obj + ) + +;; definition of type touching-list +(deftype touching-list (structure) + ((num-touching-shapes int32 :offset-assert 0) + (resolve-u int8 :offset-assert 4) + (touching-shapes touching-shapes-entry 32 :inline :offset-assert 8) + ) + :method-count-assert 15 + :size-assert #x208 + :flag-assert #xf00000208 + (:methods + (new (symbol type) _type_ 0) + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + (dummy-14 () none 14) + ) + ) + +;; definition for method 3 of type touching-list +(defmethod inspect touching-list ((obj touching-list)) + (format #t "[~8x] ~A~%" obj 'touching-list) + (format #t "~Tnum-touching-shapes: ~D~%" (-> obj num-touching-shapes)) + (format #t "~Tresolve-u: ~D~%" (-> obj resolve-u)) + (format #t "~Ttouching-shapes[32] @ #x~X~%" (-> obj touching-shapes)) + obj + ) + +;; definition for method 0 of type touching-list +;; INFO: Return type mismatch structure vs touching-list. +(defmethod new touching-list ((allocation symbol) (type-to-make type)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (let ((a2-0 (-> type-to-make size))) + ) + (let ((obj (the-as touching-list (t9-0 allocation v1-1)))) + (set! (-> obj num-touching-shapes) 0) + (set! (-> obj resolve-u) 0) + obj + ) + ) + ) + +;; definition for method 16 of type touching-shapes-entry +(defmethod get-head touching-shapes-entry ((obj touching-shapes-entry)) + (-> obj head) + ) + +;; definition for method 17 of type touching-shapes-entry +(defmethod + unknown1 + touching-shapes-entry + ((obj touching-shapes-entry) (arg0 (pointer uint32))) + (-> arg0 0) + ) + +;; definition (perm) for symbol *touching-prims-entry-pool*, type touching-prims-entry-pool +(define-perm *touching-prims-entry-pool* touching-prims-entry-pool + (new 'global 'touching-prims-entry-pool) + ) + +;; definition (perm) for symbol *touching-list*, type touching-list +(define-perm *touching-list* touching-list (new 'global 'touching-list)) + + + + diff --git a/test/decompiler/reference/engine/data/art-h_REF.gc b/test/decompiler/reference/engine/data/art-h_REF.gc index d9aa063fb9..7a0d94b6cf 100644 --- a/test/decompiler/reference/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/engine/data/art-h_REF.gc @@ -271,7 +271,13 @@ ;; definition of type art-joint-anim (deftype art-joint-anim (art-element) - ((pad2 uint8 16 :offset-assert 32) + ((speed float :offset 20) + (artist-base float :offset 24) + (artiest-step float :offset 28) + (master-art-group-name basic :offset 32) + (master-art-group-index int32 :offset 36) + (frames pointer :offset 44) + (data joint-anim-compressed :dynamic :offset-assert 48) ) :method-count-assert 13 :size-assert #x30 diff --git a/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc b/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc new file mode 100644 index 0000000000..53e648b980 --- /dev/null +++ b/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc @@ -0,0 +1,164 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function cspace-by-name-no-fail +;; INFO: Return type mismatch object vs cspace. +(defun cspace-by-name-no-fail ((arg0 process-drawable) (arg1 string)) + (let ((result (cspace-by-name arg0 arg1))) + (the-as cspace (the-as cspace (cond + (result + (empty) + (the-as cspace result) + ) + (else + (format 0 "no cspace (~A)~%" arg1) + (the-as cspace (-> arg0 node-list _data)) + ) + ) + ) + ) + ) + ) + +;; definition for function cspace-index-by-name-no-fail +(defun cspace-index-by-name-no-fail ((arg0 process-drawable) (arg1 string)) + (let ((v0-0 (cspace-index-by-name arg0 arg1))) + (cond + ((< v0-0 0) + (format 0 "no cspace[ndx] (~A)~%" arg1) + 0 + ) + (else + (empty) + v0-0 + ) + ) + ) + ) + +;; definition for function num-func-none +(defun num-func-none ((arg0 joint-control-channel)) + (-> arg0 frame-num) + ) + +;; definition for function num-func-+! +(defun num-func-+! ((arg0 joint-control-channel) (arg1 float)) + (let + ((f0-1 + (+ + (-> arg0 frame-num) + (* arg1 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))) + ) + ) + ) + (set! (-> arg0 frame-num) f0-1) + f0-1 + ) + ) + +;; definition for function num-func--! +(defun num-func--! ((arg0 joint-control-channel) (arg1 float)) + (let + ((f0-1 + (- + (-> arg0 frame-num) + (* arg1 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))) + ) + ) + ) + (set! (-> arg0 frame-num) f0-1) + f0-1 + ) + ) + +;; definition for function num-func-loop! +(defun num-func-loop! ((chan joint-control-channel) (inc float)) + (let* ((duration (the float (+ (-> chan frame-group data 0 length) -1))) + (after-inc + (+ + (+ (-> chan frame-num) duration) + (* + inc + (* (-> chan frame-group speed) (-> *display* time-adjust-ratio)) + ) + ) + ) + (wrapped + (- + after-inc + (* (the float (the int (/ after-inc duration))) duration) + ) + ) + ) + (set! (-> chan frame-num) wrapped) + wrapped + ) + ) + +;; definition for function num-func-seek! +(defun num-func-seek! ((arg0 joint-control-channel) (arg1 float) (arg2 float)) + (let + ((f0-3 + (seek + (-> arg0 frame-num) + arg1 + (* arg2 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))) + ) + ) + ) + (set! (-> arg0 frame-num) f0-3) + (set! (-> arg0 frame-num) f0-3) + f0-3 + ) + ) + +;; definition for function num-func-blend-in! +(defun num-func-blend-in! ((arg0 joint-control-channel) (arg1 float)) + (let* + ((v0-0 + (seek (-> arg0 frame-interp) 1.0 (* arg1 (-> *display* time-adjust-ratio))) + ) + (f30-0 (the-as float v0-0)) + ) + (set! (-> arg0 frame-interp) f30-0) + (set! (-> arg0 frame-interp) f30-0) + (if (= f30-0 1.0) + (joint-control-reset! (-> arg0 parent) arg0) + ) + f30-0 + ) + ) + +;; definition for function num-func-chan +(defun num-func-chan ((arg0 joint-control-channel) (arg1 float)) + (let + ((f0-2 + (-> + (the-as + joint-control-channel + (+ + (the-as uint arg0) + (the-as uint (* 48 (- (the int arg1) (-> arg0 group-sub-index)))) + ) + ) + frame-num + ) + ) + ) + (set! (-> arg0 frame-num) f0-2) + f0-2 + ) + ) + +;; definition for function num-func-identity +(defun num-func-identity ((arg0 joint-control-channel)) + (-> arg0 frame-num) + ) + +;; failed to figure out what this is: +(let ((v0-0 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/game/effect-control-h_REF.gc b/test/decompiler/reference/engine/game/effect-control-h_REF.gc new file mode 100644 index 0000000000..bcf797868b --- /dev/null +++ b/test/decompiler/reference/engine/game/effect-control-h_REF.gc @@ -0,0 +1,89 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type effect-control +(deftype effect-control (basic) + ((process process-drawable :offset-assert 4) + (flags uint32 :offset-assert 8) + (last-frame-group art-joint-anim :offset-assert 12) + (last-frame-num float :offset-assert 16) + (channel-offset int32 :offset-assert 20) + (res res-lump :offset-assert 24) + (name uint32 :offset-assert 28) + (param uint32 :offset-assert 32) + ) + :method-count-assert 15 + :size-assert #x24 + :flag-assert #xf00000024 + (:methods + (new (symbol type process-drawable) _type_ 0) + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (set-channel-offset! (_type_ int) none 13) + (dummy-14 () none 14) + ) + ) + +;; definition for method 3 of type effect-control +(defmethod inspect effect-control ((obj effect-control)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tprocess: ~A~%" (-> obj process)) + (format #t "~Tflags: #x~X~%" (-> obj flags)) + (format #t "~Tlast-frame-group: ~A~%" (-> obj last-frame-group)) + (format #t "~Tlast-frame-num: ~f~%" (-> obj last-frame-num)) + (format #t "~Tchannel-offset: ~D~%" (-> obj channel-offset)) + (format #t "~Tres: ~A~%" (-> obj res)) + (format #t "~Tname: #x~X~%" (-> obj name)) + (format #t "~Tparam: #x~X~%" (-> obj param)) + obj + ) + +;; definition for method 0 of type effect-control +(defmethod + new + effect-control + ((allocation symbol) (type-to-make type) (arg0 process-drawable)) + (cond + (((method-of-type res-lump get-property-struct) + (the-as res-lump (-> arg0 draw jgeo extra)) + 'effect-name + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + (let + ((v0-1 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-1 process) arg0) + (set! (-> v0-1 last-frame-group) #f) + v0-1 + ) + ) + (else + (the-as effect-control #f) + ) + ) + ) + +;; definition for method 13 of type effect-control +;; INFO: Return type mismatch int vs none. +(defmethod set-channel-offset! effect-control ((obj effect-control) (arg0 int)) + (set! (-> obj channel-offset) arg0) + (let ((v0-0 0)) + ) + (none) + ) + +;; failed to figure out what this is: +(let ((v0-1 0)) + ) + + + + diff --git a/test/decompiler/reference/engine/math/vector_REF.gc b/test/decompiler/reference/engine/math/vector_REF.gc index e50d217478..d3ab745c94 100644 --- a/test/decompiler/reference/engine/math/vector_REF.gc +++ b/test/decompiler/reference/engine/math/vector_REF.gc @@ -1124,14 +1124,10 @@ ((out vector) (min-val vector) (max-val vector) (in float)) (cond ((>= 0.0 in) - (let ((v1-0 out)) - (set! (-> v1-0 quad) (-> min-val quad)) - ) + (set! (-> out quad) (-> min-val quad)) ) ((>= in 1.0) - (let ((v1-1 out)) - (set! (-> v1-1 quad) (-> max-val quad)) - ) + (set! (-> out quad) (-> max-val quad)) ) (else (set! (-> out x) (deg-lerp-clamp (-> min-val x) (-> max-val x) in)) diff --git a/test/decompiler/reference/engine/physics/trajectory_REF.gc b/test/decompiler/reference/engine/physics/trajectory_REF.gc index d085ba8b62..0a9c4eab69 100644 --- a/test/decompiler/reference/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/engine/physics/trajectory_REF.gc @@ -4,9 +4,7 @@ ;; definition for method 9 of type trajectory ;; Used lq/sq (defmethod TODO-RENAME-9 trajectory ((obj trajectory) (arg0 float) (arg1 vector)) - (let ((v1-0 arg1)) - (set! (-> v1-0 quad) (-> obj initial-position quad)) - ) + (set! (-> arg1 quad) (-> obj initial-position quad)) (set! (-> arg1 x) (+ (-> arg1 x) (* arg0 (-> obj initial-velocity x)))) (set! (-> arg1 y) (+ (-> arg1 y) (* arg0 (-> obj initial-velocity y)))) (set! (-> arg1 z) (+ (-> arg1 z) (* arg0 (-> obj initial-velocity z)))) @@ -20,9 +18,7 @@ TODO-RENAME-10 trajectory ((obj trajectory) (arg0 float) (arg1 vector)) - (let ((v1-0 arg1)) - (set! (-> v1-0 quad) (-> obj initial-velocity quad)) - ) + (set! (-> arg1 quad) (-> obj initial-velocity quad)) (set! (-> arg1 y) (+ (-> arg1 y) (* arg0 (-> obj gravity)))) arg1 ) @@ -40,9 +36,7 @@ (vf6 :class vf) ) (init-vf0-vector) - (let ((v1-0 (-> obj initial-position))) - (set! (-> v1-0 quad) (-> arg0 quad)) - ) + (set! (-> obj initial-position quad) (-> arg0 quad)) (set! (-> obj gravity) arg3) (set! (-> obj time) arg2) (let ((f0-3 (/ (vector-vector-xz-distance arg1 arg0) arg2))) @@ -133,13 +127,9 @@ (s4-0 (new 'stack-no-clear 'vector)) (s3-0 10) ) - (let ((v1-0 s4-0)) - (set! (-> v1-0 quad) (-> obj initial-position quad)) - ) + (set! (-> s4-0 quad) (-> obj initial-position quad)) (dotimes (s2-0 s3-0) - (let ((v1-1 s5-0)) - (set! (-> v1-1 quad) (-> s4-0 quad)) - ) + (set! (-> s5-0 quad) (-> s4-0 quad)) (let ((f0-1 (* (-> obj time) (/ (+ 1.0 (the float s2-0)) (the float s3-0))))) (TODO-RENAME-9 obj f0-1 s4-0) diff --git a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc index b047c1780e..d4a5c65882 100644 --- a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc +++ b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc @@ -219,18 +219,14 @@ set-trs! joint-mod ((obj joint-mod) (trans vector) (rot quaternion) (scale vector)) - (when trans - (let ((v1-1 (-> obj trans))) - (set! (-> v1-1 quad) (-> trans quad)) - ) + (if trans + (set! (-> obj trans quad) (-> trans quad)) ) (if rot (quaternion-copy! (-> obj quat) rot) ) - (when scale - (let ((v1-5 (-> obj scale))) - (set! (-> v1-5 quad) (-> scale quad)) - ) + (if scale + (set! (-> obj scale quad) (-> scale quad)) ) (let ((v0-1 0)) ) @@ -248,9 +244,7 @@ ((distance (vector-vector-distance (-> obj process root trans) target-trans)) ) (set! (-> obj shutting-down?) #f) - (let ((v1-6 (-> obj target))) - (set! (-> v1-6 quad) (-> target-trans quad)) - ) + (set! (-> obj target quad) (-> target-trans quad)) (if (< distance (-> obj max-dist)) (set! (-> obj blend) 1.0) (set! (-> obj blend) 0.0) @@ -368,9 +362,7 @@ (if (= (-> obj mode) (joint-mod-handler-mode reset)) (set-mode! obj (joint-mod-handler-mode look-at)) ) - (let ((v1-37 (-> obj target))) - (set! (-> v1-37 quad) (-> target-trans quad)) - ) + (set! (-> obj target quad) (-> target-trans quad)) (set! (-> obj blend) 1.0) (set! (-> obj shutting-down?) #f) ) @@ -825,13 +817,9 @@ ;; Used lq/sq (defun joint-mod-joint-set-handler ((arg0 cspace) (arg1 transformq)) (let ((s4-0 (the-as joint-mod (-> arg0 param1)))) - (let ((v1-0 (-> arg1 trans))) - (set! (-> v1-0 quad) (-> s4-0 trans quad)) - ) + (set! (-> arg1 trans quad) (-> s4-0 trans quad)) (quaternion-copy! (the-as quaternion (-> arg1 rot)) (-> s4-0 quat)) - (let ((v1-1 (-> arg1 scale))) - (set! (-> v1-1 quad) (-> s4-0 scale quad)) - ) + (set! (-> arg1 scale quad) (-> s4-0 scale quad)) ) (cspace<-parented-transformq-joint! arg0 arg1) (let ((v0-1 0)) @@ -960,9 +948,7 @@ (.sub.vf vf6 vf4 vf5 :mask #b111) (.svf (&-> a1-3 quad) vf6) ) - (let ((v1-3 (-> s4-0 last-position))) - (set! (-> v1-3 quad) (-> s1-0 quad)) - ) + (set! (-> s4-0 last-position quad) (-> s1-0 quad)) (set! f0-3 (vector-dot s2-0 s3-0)) ) (let* ((f0-4 f0-3) @@ -1050,20 +1036,14 @@ (let ((v1-0 (the-as joint-mod-set-local (-> arg0 param1)))) (cond ((-> v1-0 enable) - (when (not (-> v1-0 set-translation)) - (let ((a2-3 (-> v1-0 transform))) - (set! (-> a2-3 trans quad) (-> arg1 trans quad)) - ) + (if (not (-> v1-0 set-translation)) + (set! (-> v1-0 transform trans quad) (-> arg1 trans quad)) ) - (when (not (-> v1-0 set-rotation)) - (let ((a2-6 (-> v1-0 transform rot))) - (set! (-> a2-6 quad) (-> arg1 rot quad)) - ) + (if (not (-> v1-0 set-rotation)) + (set! (-> v1-0 transform rot quad) (-> arg1 rot quad)) ) - (when (not (-> v1-0 set-scale)) - (let ((a2-9 (-> v1-0 transform scale))) - (set! (-> a2-9 quad) (-> arg1 scale quad)) - ) + (if (not (-> v1-0 set-scale)) + (set! (-> v1-0 transform scale quad) (-> arg1 scale quad)) ) (cspace<-parented-transformq-joint! arg0 (-> v1-0 transform)) ) @@ -1097,15 +1077,9 @@ (set! (-> v0-0 set-rotation) arg3) (set! (-> v0-0 set-scale) arg4) (set! (-> v0-0 enable) #t) - (let ((v1-3 (-> v0-0 transform))) - (set! (-> v1-3 trans quad) (-> *null-vector* quad)) - ) - (let ((v1-4 (-> v0-0 transform rot))) - (set! (-> v1-4 quad) (-> *null-vector* quad)) - ) - (let ((v1-5 (-> v0-0 transform scale))) - (set! (-> v1-5 quad) (-> *identity-vector* quad)) - ) + (set! (-> v0-0 transform trans quad) (-> *null-vector* quad)) + (set! (-> v0-0 transform rot quad) (-> *null-vector* quad)) + (set! (-> v0-0 transform scale quad) (-> *identity-vector* quad)) (let ((v1-8 (-> (-> arg0 node-list) data arg1))) (set! (-> v1-8 param0) joint-mod-set-local-callback) (set! (-> v1-8 param1) v0-0) @@ -1166,15 +1140,9 @@ ) (set! (-> v0-0 node-index) arg1) (set! (-> v0-0 enable) arg2) - (let ((v1-2 (-> v0-0 transform))) - (set! (-> v1-2 trans quad) (-> *null-vector* quad)) - ) - (let ((v1-3 (-> v0-0 transform rot))) - (set! (-> v1-3 quad) (-> *null-vector* quad)) - ) - (let ((v1-4 (-> v0-0 transform scale))) - (set! (-> v1-4 quad) (-> *identity-vector* quad)) - ) + (set! (-> v0-0 transform trans quad) (-> *null-vector* quad)) + (set! (-> v0-0 transform rot quad) (-> *null-vector* quad)) + (set! (-> v0-0 transform scale quad) (-> *identity-vector* quad)) (let ((v1-7 (-> (-> arg0 node-list) data arg1))) (set! (-> v1-7 param0) joint-mod-set-world-callback) (set! (-> v1-7 param1) v0-0) @@ -1266,15 +1234,9 @@ (set! (-> v0-0 node-index) arg1) (set! (-> v0-0 enable) arg2) (set! (-> v0-0 blend) 0.0) - (let ((v1-2 (-> v0-0 transform))) - (set! (-> v1-2 trans quad) (-> *null-vector* quad)) - ) - (let ((v1-3 (-> v0-0 transform rot))) - (set! (-> v1-3 quad) (-> *null-vector* quad)) - ) - (let ((v1-4 (-> v0-0 transform scale))) - (set! (-> v1-4 quad) (-> *identity-vector* quad)) - ) + (set! (-> v0-0 transform trans quad) (-> *null-vector* quad)) + (set! (-> v0-0 transform rot quad) (-> *null-vector* quad)) + (set! (-> v0-0 transform scale quad) (-> *identity-vector* quad)) (let ((v1-7 (-> (-> arg0 node-list) data arg1))) (set! (-> v1-7 param0) joint-mod-blend-local-callback) (set! (-> v1-7 param1) v0-0) @@ -1356,9 +1318,7 @@ (object-new allocation type-to-make (the-as int (-> type-to-make size))) ) ) - (let ((v1-2 (-> v0-0 spin-axis))) - (set! (-> v1-2 quad) (-> arg2 quad)) - ) + (set! (-> v0-0 spin-axis quad) (-> arg2 quad)) (set! (-> v0-0 spin-rate) arg3) (set! (-> v0-0 enable) #t) (set! (-> v0-0 angle) 0.0) @@ -1369,7 +1329,3 @@ v0-0 ) ) - - - - diff --git a/test/decompiler/reference/engine/util/sync-info_REF.gc b/test/decompiler/reference/engine/util/sync-info_REF.gc index 0a692dd167..f356093709 100644 --- a/test/decompiler/reference/engine/util/sync-info_REF.gc +++ b/test/decompiler/reference/engine/util/sync-info_REF.gc @@ -546,12 +546,8 @@ (init-vf0-vector) (cond (arg0 - (let ((v1-0 (-> obj value))) - (set! (-> v1-0 quad) (-> arg0 quad)) - ) - (let ((v1-1 (-> obj target))) - (set! (-> v1-1 quad) (-> arg0 quad)) - ) + (set! (-> obj value quad) (-> arg0 quad)) + (set! (-> obj target quad) (-> arg0 quad)) ) (else (.svf (&-> (-> obj value) quad) vf0) diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index 3247ced5e4..2063d41b37 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -71,6 +71,9 @@ const std::unordered_set g_functions_expected_to_reject = { "(method 15 sync-info)", // needs *res-static-buf* "(method 15 sync-info-eased)", // needs *res-static-buf* "(method 15 sync-info-paused)", // needs *res-static-buf* + + // collide-mesh-h + "(method 11 collide-mesh-cache)", // asm }; const std::unordered_set g_functions_to_skip_compiling = {