diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index f609083446..7f5b423b15 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -783,7 +783,7 @@ void TypeSystem::add_builtin_types() { add_field_to_type(basic_type, "type", make_typespec("type")); // the default new basic doesn't support dynamic sizing. anything dynamic will override this // and then call (method object new) to do the dynamically-sized allocation. - add_method(basic_type, "new", make_function_typespec({"symbol", "type"}, "basic")); + add_method(basic_type, "new", make_function_typespec({"symbol", "type"}, "_type_")); // SYMBOL builtin_structure_inherit(symbol_type); diff --git a/decompiler/IR2/AtomicOpForm.cpp b/decompiler/IR2/AtomicOpForm.cpp index 6ba74506f9..53c8d62128 100644 --- a/decompiler/IR2/AtomicOpForm.cpp +++ b/decompiler/IR2/AtomicOpForm.cpp @@ -457,12 +457,8 @@ Form* LoadVarOp::get_load_src(FormPool& pool, const Env& env) const { auto method_id = (ro.offset - 16) / 4; auto method_info = env.dts->ts.lookup_method(type_name, method_id); - std::vector tokens; - tokens.push_back(DerefToken::make_field_name("methods-by-name")); - tokens.push_back(DerefToken::make_field_name(method_info.name)); - auto source = pool.alloc_single_element_form( - nullptr, SimpleAtom::make_var(ro.var).as_expr(), m_my_idx); - return pool.alloc_single_element_form(nullptr, source, false, tokens); + return pool.alloc_single_element_form( + nullptr, ro.var, input_type.get_type_objects_typespec(), method_info); } // todo structure method diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index b44ab20dc4..8a6dc29c23 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -1497,6 +1497,8 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) { return "!="; case FixedOperatorKind::METHOD_OF_OBJECT: return "method-of-object"; + case FixedOperatorKind::METHOD_OF_TYPE: + return "method-of-type"; case FixedOperatorKind::NULLP: return "null?"; case FixedOperatorKind::PAIRP: @@ -2346,6 +2348,31 @@ void StackSpillValueElement::apply_form(const std::function&) {} void StackSpillValueElement::collect_vars(RegAccessSet&, bool) const {} void StackSpillValueElement::get_modified_regs(RegSet&) const {} +//////////////////////////////// +// MethodOfTypeElement +/////////////////////////////// + +MethodOfTypeElement::MethodOfTypeElement(RegisterAccess type_reg, + const TypeSpec& type_at_decompile, + const MethodInfo& method_info) + : m_type_reg(type_reg), m_type_at_decompile(type_at_decompile), m_method_info(method_info) {} + +goos::Object MethodOfTypeElement::to_form_internal(const Env& env) const { + return pretty_print::build_list("method-of-type", m_type_reg.to_form(env), m_method_info.name); +} + +void MethodOfTypeElement::apply(const std::function& f) { + f(this); +} + +void MethodOfTypeElement::apply_form(const std::function&) {} + +void MethodOfTypeElement::collect_vars(RegAccessSet& vars, bool) const { + vars.insert(m_type_reg); +} + +void MethodOfTypeElement::get_modified_regs(RegSet&) const {} + //////////////////////////////// // Utilities //////////////////////////////// diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 41be814b35..e1d653f929 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -997,6 +997,10 @@ class DerefToken { void apply_form(const std::function& f); void get_modified_regs(RegSet& regs) const; + bool is_field_name(const std::string& name) const { + return m_kind == Kind::FIELD_NAME && m_name == name; + } + Kind kind() const { return m_kind; } const std::string& field_name() const { assert(m_kind == Kind::FIELD_NAME); @@ -1038,6 +1042,7 @@ class DerefElement : public FormElement { const Form* base() const { return m_base; } Form* base() { return m_base; } const std::vector& tokens() const { return m_tokens; } + std::vector& tokens() { return m_tokens; } void set_base(Form* new_base); void set_addr_of(bool is_addr_of) { m_is_addr_of = is_addr_of; } @@ -1146,6 +1151,7 @@ class ConstantTokenElement : public FormElement { FormStack& stack, std::vector* result, bool allow_side_effects) override; + const std::string& value() const { return m_value; } private: std::string m_value; @@ -1365,6 +1371,28 @@ class StackSpillValueElement : public FormElement { bool m_is_signed = false; }; +class MethodOfTypeElement : public FormElement { + public: + MethodOfTypeElement(RegisterAccess type_reg, + const TypeSpec& type_at_decompile, + const MethodInfo& method_info); + goos::Object to_form_internal(const Env& env) const override; + void apply(const std::function& f) override; + void apply_form(const std::function& f) override; + void collect_vars(RegAccessSet& vars, bool recursive) const override; + void update_from_stack(const Env& env, + FormPool& pool, + FormStack& stack, + std::vector* result, + bool allow_side_effects) override; + void get_modified_regs(RegSet& regs) const override; + + private: + RegisterAccess m_type_reg; + TypeSpec m_type_at_decompile; + MethodInfo m_method_info; +}; + /*! * A Form is a wrapper around one or more FormElements. * This is done for two reasons: diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 71e0dc02c5..be35bfadd6 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -1677,8 +1677,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto actual_arg_type = env.get_types_before_op(var.idx()).get(var.reg()).typespec(); auto desired_arg_type = function_type.get_arg(arg_id + 1); if (!env.dts->ts.tc(desired_arg_type, actual_arg_type)) { - arg_forms.push_back( - pool.alloc_single_element_form(nullptr, desired_arg_type, val)); + arg_forms.push_back(cast_form(val, desired_arg_type, pool, env)); } else { arg_forms.push_back(val); } @@ -1694,8 +1693,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto actual_arg_type = env.get_types_before_op(var.idx()).get(var.reg()).typespec(); auto desired_arg_type = function_type.get_arg(arg_id); if (!env.dts->ts.tc(desired_arg_type, actual_arg_type)) { - arg_forms.push_back( - pool.alloc_single_element_form(nullptr, desired_arg_type, val)); + arg_forms.push_back(cast_form(val, desired_arg_type, pool, env)); } else { arg_forms.push_back(val); } @@ -1791,13 +1789,13 @@ void FunctionCallElement::update_from_stack(const Env& env, { // detect method calls: - // ex: ((-> pair methods-by-name new) (quote global) pair gp-0 a3-0) + // ex: ((method-of-type pair new) (quote global) pair gp-0 a3-0) constexpr int type_for_method = 0; constexpr int method_name = 1; - auto deref_matcher = Matcher::deref( - Matcher::any_symbol(type_for_method), false, - {DerefTokenMatcher::string("methods-by-name"), DerefTokenMatcher::any_string(method_name)}); + auto deref_matcher = Matcher::op( + GenericOpMatcher::fixed(FixedOperatorKind::METHOD_OF_TYPE), + {Matcher::any_symbol(type_for_method), Matcher::any_constant_token(method_name)}); auto matcher = Matcher::op_with_rest(GenericOpMatcher::func(deref_matcher), {}); auto temp_form = pool.alloc_single_form(nullptr, new_form); @@ -1893,13 +1891,13 @@ void FunctionCallElement::update_from_stack(const Env& env, { // detect method calls: - // ex: ((-> XXX methods-by-name new) (quote global) pair gp-0 a3-0) + // ex: ((method-of-type x new) (quote global) pair gp-0 a3-0) constexpr int method_name = 0; constexpr int type_source = 1; - auto deref_matcher = Matcher::deref( - Matcher::any(type_source), false, - {DerefTokenMatcher::string("methods-by-name"), DerefTokenMatcher::any_string(method_name)}); + auto deref_matcher = + Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::METHOD_OF_TYPE), + {Matcher::any(type_source), Matcher::any_constant_token(method_name)}); auto matcher = Matcher::op_with_rest(GenericOpMatcher::func(deref_matcher), {}); auto temp_form = pool.alloc_single_form(nullptr, new_form); @@ -1942,52 +1940,7 @@ void DerefElement::update_from_stack(const Env& env, // merge nested ->'s inline_nested(); - if (m_tokens.size() >= 3) { - auto& method_name = m_tokens.at(m_tokens.size() - 1); - auto& mbn = m_tokens.at(m_tokens.size() - 2); - auto& type = m_tokens.at(m_tokens.size() - 3); - if (method_name.kind() == DerefToken::Kind::FIELD_NAME && - mbn.kind() == DerefToken::Kind::FIELD_NAME && mbn.field_name() == "methods-by-name" && - type.kind() == DerefToken::Kind::FIELD_NAME && type.field_name() == "type") { - std::string name = method_name.field_name(); - m_tokens.pop_back(); - m_tokens.pop_back(); - m_tokens.pop_back(); - - if (m_tokens.empty()) { - auto method_op = pool.alloc_element( - GenericOperator::make_fixed(FixedOperatorKind::METHOD_OF_OBJECT), m_base, - pool.alloc_single_element_form(nullptr, name)); - result->push_back(method_op); - } else { - auto method_op = pool.alloc_element( - GenericOperator::make_fixed(FixedOperatorKind::METHOD_OF_OBJECT), - pool.alloc_single_form(nullptr, this), - pool.alloc_single_element_form(nullptr, name)); - result->push_back(method_op); - } - return; - } - } - - // rewrite access to the method table to use method-of-object - // (-> type methods-by-name ) - // (method-of-object ) - auto get_method_matcher = Matcher::deref( - Matcher::any(0), false, - {DerefTokenMatcher::string("type"), DerefTokenMatcher::string("methods-by-name"), - DerefTokenMatcher::any_string(1)}); - Form hack_form; - hack_form.elts() = {this}; - auto mr = match(get_method_matcher, &hack_form); - if (mr.matched) { - auto method_op = pool.alloc_element( - GenericOperator::make_fixed(FixedOperatorKind::METHOD_OF_OBJECT), mr.maps.forms.at(0), - pool.alloc_single_element_form(nullptr, mr.maps.strings.at(1))); - result->push_back(method_op); - } else { - result->push_back(this); - } + result->push_back(this); } void DerefElement::inline_nested() { @@ -3187,6 +3140,41 @@ void VectorFloatLoadStoreElement::push_to_stack(const Env&, FormPool&, FormStack stack.push_form_element(this, true); } +void MethodOfTypeElement::update_from_stack(const Env& env, + FormPool& pool, + FormStack& stack, + std::vector* result, + bool allow_side_effects) { + mark_popped(); + auto type = pop_to_forms({m_type_reg}, env, pool, stack, allow_side_effects).at(0); + + auto type_as_deref = type->try_as_element(); + if (type_as_deref) { + if (type_as_deref->tokens().size() > 1 && + type_as_deref->tokens().back().is_field_name("type")) { + type_as_deref->tokens().pop_back(); + result->push_back(pool.alloc_element( + GenericOperator::make_fixed(FixedOperatorKind::METHOD_OF_OBJECT), + std::vector{type, pool.alloc_single_element_form( + nullptr, m_method_info.name)})); + return; + } else if (type_as_deref->tokens().size() == 1 && + type_as_deref->tokens().back().is_field_name("type")) { + result->push_back(pool.alloc_element( + GenericOperator::make_fixed(FixedOperatorKind::METHOD_OF_OBJECT), + std::vector{ + type_as_deref->base(), + pool.alloc_single_element_form(nullptr, m_method_info.name)})); + return; + } + } + + result->push_back(pool.alloc_element( + GenericOperator::make_fixed(FixedOperatorKind::METHOD_OF_TYPE), + std::vector{type, pool.alloc_single_element_form( + nullptr, m_method_info.name)})); +} + void SimpleAtomElement::update_from_stack(const Env&, FormPool&, FormStack&, diff --git a/decompiler/IR2/GenericElementMatcher.cpp b/decompiler/IR2/GenericElementMatcher.cpp index 2f1d8ded46..1e11e03261 100644 --- a/decompiler/IR2/GenericElementMatcher.cpp +++ b/decompiler/IR2/GenericElementMatcher.cpp @@ -130,6 +130,13 @@ Matcher Matcher::while_loop(const Matcher& condition, const Matcher& body) { return m; } +Matcher Matcher::any_constant_token(int match_id) { + Matcher m; + m.m_kind = Kind::ANY_CONSTANT_TOKEN; + m.m_string_out_id = match_id; + return m; +} + bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out) const { switch (m_kind) { case Kind::ANY: @@ -251,6 +258,18 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out) const { return false; } break; + case Kind::ANY_CONSTANT_TOKEN: { + auto as_ct = input->try_as_element(); + if (as_ct) { + if (m_string_out_id != -1) { + maps_out->strings[m_string_out_id] = as_ct->value(); + } + return true; + } else { + return false; + } + } break; + case Kind::CAST: { auto as_cast = dynamic_cast(input->try_as_single_element()); if (as_cast) { diff --git a/decompiler/IR2/GenericElementMatcher.h b/decompiler/IR2/GenericElementMatcher.h index 0c7152b33e..2eec692497 100644 --- a/decompiler/IR2/GenericElementMatcher.h +++ b/decompiler/IR2/GenericElementMatcher.h @@ -46,6 +46,7 @@ class Matcher { const Matcher& true_case, const Matcher& false_case); static Matcher while_loop(const Matcher& condition, const Matcher& body); + static Matcher any_constant_token(int match_id = -1); enum class Kind { ANY_REG, // matching any register @@ -64,6 +65,7 @@ class Matcher { SYMBOL, IF_WITH_ELSE, WHILE_LOOP, + ANY_CONSTANT_TOKEN, INVALID }; diff --git a/decompiler/IR2/IR2_common.h b/decompiler/IR2/IR2_common.h index 0c83ca795c..bb008a1c21 100644 --- a/decompiler/IR2/IR2_common.h +++ b/decompiler/IR2/IR2_common.h @@ -138,6 +138,7 @@ enum class FixedOperatorKind { NEQ, CONS, METHOD_OF_OBJECT, + METHOD_OF_TYPE, NULLP, PAIRP, NONE, diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 856657a68c..06e3779b09 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -5218,7 +5218,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -5238,7 +5238,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -5272,7 +5272,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -5299,7 +5299,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -5342,7 +5342,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -5376,7 +5376,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) (dummy-18 () none 18) ) @@ -5470,7 +5470,6 @@ ;; generic-h ;;;;;;;;;;;;;;;; -;; todo (deftype gsf-vertex (structure) ((data uint32 8 :offset-assert 0) (byte uint8 32 :offset 0) @@ -5729,6 +5728,8 @@ :flag-assert #x900000100 ) +(define-extern *gsf-buffer* gsf-buffer) + ;;;;;;;;;;;;; ;; lights-h ;;;;;;;;;;;;; @@ -6042,7 +6043,7 @@ (corner-count int32 :offset-assert 2080) (temp-vecs vector 4 :inline :offset-assert 2096) (mid-mask-ptrs pointer 36 :offset-assert 2160) - (mid-camera-masks ocean-mid-masks 36 :inline :offset-assert 2304) + (mid-camera-masks uint64 36 :offset-assert 2304) (trans-mask-ptrs pointer 64 :offset-assert 2592) (trans-camera-masks ocean-trans-mask 16 :inline :offset-assert 2848) (trans-temp-masks ocean-trans-mask 16 :inline :offset-assert 2976) @@ -6259,6 +6260,8 @@ :flag-assert #x900000110 ) +(define-extern *ocean-wave-frames* (pointer uint32)) + ;;;;;;;;;; ;; sky-h ;;;;;;;;;; @@ -8363,7 +8366,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -10924,7 +10927,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -10973,7 +10976,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -10995,7 +10998,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -11024,7 +11027,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -33730,7 +33733,6 @@ (define-extern *ocean-mid-masks-sunken* ocean-mid-masks) ;; unknown type (define-extern *ocean-map-village1* ocean-map) ;; unknown type (define-extern *ocean-spheres-village1* ocean-spheres) ;; unknown type -;;(define-extern *ocean-wave-frames* object) ;; unknown type ;;(define-extern sky-color-hour object) ;; unknown type ;;(define-extern sky-circle-data object) ;; unknown type (define-extern *sky-drawn* symbol) ;; unknown type diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index c8010a7802..25ff55f0f8 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -270,28 +270,29 @@ ], "ocean-tables": [ - ["L26", "ocean-spheres", true], - ["L18", "ocean-spheres", true], - - ["L25", "ocean-colors", true], - ["L17", "ocean-colors", true], - - ["L23", "ocean-near-indices", true], - ["L15", "ocean-near-indices", true], - ["L9", "ocean-near-indices", true], - ["L22", "ocean-trans-indices", true], - ["L14", "ocean-trans-indices", true], - ["L8", "ocean-trans-indices", true], - ["L21", "ocean-mid-indices", true], - ["L13", "ocean-mid-indices", true], - ["L7", "ocean-mid-indices", true], - ["L19", "ocean-mid-masks", true], - ["L11", "ocean-mid-masks", true], - ["L5", "ocean-mid-masks", true], - - ["L4", "ocean-map", true], - ["L3", "ocean-map", true], - ["L2", "ocean-map", true] + // see comment in ocean-tables.gc + // ["L26", "ocean-spheres", true], + // ["L18", "ocean-spheres", true], + + // ["L25", "ocean-colors", true], + // ["L17", "ocean-colors", true], + + // ["L23", "ocean-near-indices", true], + // ["L15", "ocean-near-indices", true], + // ["L9", "ocean-near-indices", true], + // ["L22", "ocean-trans-indices", true], + // ["L14", "ocean-trans-indices", true], + // ["L8", "ocean-trans-indices", true], + // ["L21", "ocean-mid-indices", true], + // ["L13", "ocean-mid-indices", true], + // ["L7", "ocean-mid-indices", true], + // ["L19", "ocean-mid-masks", true], + // ["L11", "ocean-mid-masks", true], + // ["L5", "ocean-mid-masks", true], + + // ["L4", "ocean-map", true], + // ["L3", "ocean-map", true], + // ["L2", "ocean-map", true] ], "ocean-frames": [["L1", "(pointer uint32)", true, 16384]], diff --git a/docs/markdown/progress-notes/changelog.md b/docs/markdown/progress-notes/changelog.md index 1c4da3b1de..ef6b3d915a 100644 --- a/docs/markdown/progress-notes/changelog.md +++ b/docs/markdown/progress-notes/changelog.md @@ -142,4 +142,5 @@ - Adding a duplicate entry to an enum now generates a compiler error. - Added `.psubw` assembly form - Changed `.ftoi` to `VCVTTPS2DQ` to make the rounding behavior match the PS2 (truncate). -- Forward declaring a type with `declare-type` also forward declares the global holding the runtime type object. \ No newline at end of file +- Forward declaring a type with `declare-type` also forward declares the global holding the runtime type object. +- The `new` method of basic now has a method return type of `_type_`. Previously it was `basic`, meaning you always needed to declare `new` with the right type. \ No newline at end of file diff --git a/goal_src/engine/draw/draw-node-h.gc b/goal_src/engine/draw/draw-node-h.gc index f3ed123b3c..f587eee1b6 100644 --- a/goal_src/engine/draw/draw-node-h.gc +++ b/goal_src/engine/draw/draw-node-h.gc @@ -15,17 +15,6 @@ :size-assert #x20 :flag-assert #x1200000020 ;; field distance is a float printed as hex? - (:methods - (dummy-9 () none 9) - (dummy-10 (_type_) int 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - ) ) ;; the types of these fields are a guess for now. diff --git a/goal_src/engine/draw/drawable-actor-h.gc b/goal_src/engine/draw/drawable-actor-h.gc index 9935e22244..bcac80f625 100644 --- a/goal_src/engine/draw/drawable-actor-h.gc +++ b/goal_src/engine/draw/drawable-actor-h.gc @@ -11,17 +11,6 @@ :method-count-assert 18 :size-assert #x20 :flag-assert #x1200000020 - (:methods - (dummy-9 () none 9) - (dummy-10 (_type_) int 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - ) ) diff --git a/goal_src/engine/draw/drawable-ambient-h.gc b/goal_src/engine/draw/drawable-ambient-h.gc index 41a484bc0b..a9fdea1ea3 100644 --- a/goal_src/engine/draw/drawable-ambient-h.gc +++ b/goal_src/engine/draw/drawable-ambient-h.gc @@ -5,42 +5,58 @@ ;; name in dgo: drawable-ambient-h ;; dgos: GAME, ENGINE +;;-*-Lisp-*- +(in-package goal) + +;; definition of type drawable-ambient (deftype drawable-ambient (drawable) - ((ambient basic :offset 8) + ((ambient basic :offset 8) ) :method-count-assert 19 :size-assert #x20 :flag-assert #x1300000020 (:methods - (dummy-9 () none 9) - (dummy-10 (_type_) int 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) (dummy-18 () none 18) ) ) +;; definition for method 3 of type drawable-ambient +(defmethod inspect drawable-ambient ((obj drawable-ambient)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tambient: ~A~%" (-> obj ambient)) + obj + ) + +;; definition of type drawable-tree-ambient (deftype drawable-tree-ambient (drawable-tree) () - :flag-assert #x1200000024 + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 ) +;; definition of type drawable-inline-array-ambient (deftype drawable-inline-array-ambient (drawable-inline-array) - ((paid uint8 36)) - :flag-assert #x1200000044 + ((paid uint8 36 :offset-assert 32) + ) + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 ) -(defmethod dummy-10 drawable-tree-ambient ((obj _type_)) +;; definition for method 10 of type drawable-tree-ambient +(defmethod dummy-10 drawable-tree-ambient ((obj drawable-tree-ambient)) 0 ) -;; TODO dummy-16 +;; definition for method 16 of type drawable-tree-ambient +(defmethod dummy-16 drawable-tree-ambient ((obj drawable-tree-ambient) (arg0 object) (arg1 object)) + arg1 + ) +;; definition of type level-hint (deftype level-hint (process) ((text-id-to-display uint32 :offset-assert 112) (sound-to-play basic :offset-assert 116) @@ -52,38 +68,39 @@ (last-time uint64 :offset-assert 152) (voicebox uint64 :offset-assert 160) ) - :heap-base #x40 :method-count-assert 16 :size-assert #xa8 - :flag-assert #x10004000a8 - ;; inherited inspect of process + :flag-assert #x10000000a8 (:methods (dummy-14 () none 14) (dummy-15 () none 15) ) ) +;; definition for method 3 of type level-hint (defmethod inspect level-hint ((obj level-hint)) - (local-vars (t9-0 (function process process))) - (set! t9-0 (method-of-type process inspect)) - (t9-0 obj) - (format '#t "~T~Ttext-id-to-display: ~D~%" (-> obj text-id-to-display)) - (format '#t "~T~Tsound-to-play: ~A~%" (-> obj sound-to-play)) - (format '#t "~T~Ttrans: #~%" (-> obj trans)) - (format '#t "~T~Tsound-id: ~D~%" (-> obj sound-id)) - (format '#t "~T~Tmode: ~A~%" (-> obj mode)) - (format '#t "~T~Ttotal-time: ~D~%" (-> obj total-time)) - (format '#t "~T~Ttotal-off-time: ~D~%" (-> obj total-off-time)) - (format '#t "~T~Tlast-time: ~D~%" (-> obj last-time)) - (format '#t "~T~Tvoicebox: ~D~%" (-> obj voicebox)) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~T~Ttext-id-to-display: ~D~%" (-> obj text-id-to-display)) + (format #t "~T~Tsound-to-play: ~A~%" (-> obj sound-to-play)) + (format #t "~T~Ttrans: #~%" (-> obj trans)) + (format #t "~T~Tsound-id: ~D~%" (-> obj sound-id)) + (format #t "~T~Tmode: ~A~%" (-> obj mode)) + (format #t "~T~Ttotal-time: ~D~%" (-> obj total-time)) + (format #t "~T~Ttotal-off-time: ~D~%" (-> obj total-off-time)) + (format #t "~T~Tlast-time: ~D~%" (-> obj last-time)) + (format #t "~T~Tvoicebox: ~D~%" (-> obj voicebox)) obj ) +;; definition of type ambient-list (deftype ambient-list (structure) - ((num-items int32 :offset-assert 0) + ((num-items int32 :offset-assert 0) (items uint32 2048 :offset-assert 4) ) :method-count-assert 9 :size-assert #x2004 :flag-assert #x900002004 ) + diff --git a/goal_src/engine/draw/drawable-h.gc b/goal_src/engine/draw/drawable-h.gc index bae4bdfde0..bdccf549d1 100644 --- a/goal_src/engine/draw/drawable-h.gc +++ b/goal_src/engine/draw/drawable-h.gc @@ -22,7 +22,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) ;; takes at least 3 args, return type is same as the 3rd arg. + (dummy-16 (_type_ object object) object 16) ;; takes at least 3 args, return type is same as the 3rd arg. (dummy-17 () none 17) ) ) @@ -41,7 +41,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) diff --git a/goal_src/engine/draw/drawable-inline-array-h.gc b/goal_src/engine/draw/drawable-inline-array-h.gc index b9d9a68b84..447c99e708 100644 --- a/goal_src/engine/draw/drawable-inline-array-h.gc +++ b/goal_src/engine/draw/drawable-inline-array-h.gc @@ -11,15 +11,4 @@ :method-count-assert 18 :size-assert #x20 :flag-assert #x1200000020 - (:methods - (dummy-9 () none 9) - (dummy-10 (_type_) int 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - ) ) diff --git a/goal_src/engine/gfx/generic/generic-h.gc b/goal_src/engine/gfx/generic/generic-h.gc index b85ac27195..55d03686a0 100644 --- a/goal_src/engine/gfx/generic/generic-h.gc +++ b/goal_src/engine/gfx/generic/generic-h.gc @@ -255,4 +255,4 @@ :flag-assert #x900000100 ) -(define *gsf-buffer* (kmalloc global #x2400 (kmalloc-flags align-64) "malloc")) +(define *gsf-buffer* (the gsf-buffer (kmalloc global #x2400 (kmalloc-flags align-64) "malloc"))) diff --git a/goal_src/engine/gfx/ocean/ocean-h.gc b/goal_src/engine/gfx/ocean/ocean-h.gc index 03dfd4fbc8..4a5c06cd99 100644 --- a/goal_src/engine/gfx/ocean/ocean-h.gc +++ b/goal_src/engine/gfx/ocean/ocean-h.gc @@ -198,7 +198,7 @@ (corner-count int32 :offset-assert 2080) (temp-vecs vector 4 :inline :offset-assert 2096) (mid-mask-ptrs pointer 36 :offset-assert 2160) - (mid-camera-masks ocean-mid-masks 36 :inline :offset-assert 2304) + (mid-camera-masks uint64 36 :offset-assert 2304) (trans-mask-ptrs pointer 64 :offset-assert 2592) (trans-camera-masks ocean-trans-mask 16 :inline :offset-assert 2848) (trans-temp-masks ocean-trans-mask 16 :inline :offset-assert 2976) diff --git a/goal_src/engine/gfx/ocean/ocean-tables.gc b/goal_src/engine/gfx/ocean/ocean-tables.gc index 150d8a2ddd..3978019ed1 100644 --- a/goal_src/engine/gfx/ocean/ocean-tables.gc +++ b/goal_src/engine/gfx/ocean/ocean-tables.gc @@ -5,6 +5,13 @@ ;; name in dgo: ocean-tables ;; dgos: GAME, ENGINE +;; note: the following types aren't decompiled correctly +;; - ocean-mid-masks +;; - ocean-near-indices +;; these types have a pointer to an array of unknown length. +;; when we do get to the ocean renderer, we should probably write a special tool +;; for this file in both the compiler/decompiler. + (define *ocean-spheres-village1* (new 'static 'ocean-spheres :spheres (new 'static 'inline-array sphere 36 (new 'static 'sphere :x -7864320.0 :z -7864320.0 :w 2224365.5) diff --git a/test/decompiler/reference/all_forward_declarations.gc b/test/decompiler/reference/all_forward_declarations.gc index fb94bfe8b9..e3b39b0750 100644 --- a/test/decompiler/reference/all_forward_declarations.gc +++ b/test/decompiler/reference/all_forward_declarations.gc @@ -425,4 +425,7 @@ ;; texture (declare-type texture-page basic) -(declare-type level basic) \ No newline at end of file +(declare-type level basic) + +;; main-h +(define-extern *dproc* process) \ No newline at end of file diff --git a/test/decompiler/reference/connect_REF.gc b/test/decompiler/reference/connect_REF.gc index d99e6066d3..2dfe12bab5 100644 --- a/test/decompiler/reference/connect_REF.gc +++ b/test/decompiler/reference/connect_REF.gc @@ -388,7 +388,7 @@ (defmethod inspect-all-connections engine ((obj engine)) (apply-to-connections obj - (the-as (function connectable none) (-> connection methods-by-name inspect)) + (the-as (function connectable none) (method-of-type connection inspect)) ) obj ) diff --git a/test/decompiler/reference/display_REF.gc b/test/decompiler/reference/display_REF.gc index 9237fa35d3..d71c781fbe 100644 --- a/test/decompiler/reference/display_REF.gc +++ b/test/decompiler/reference/display_REF.gc @@ -754,7 +754,7 @@ 0 512 224 - (the-as rgba 0) + (new 'static 'rgba) ) ) ) diff --git a/test/decompiler/reference/draw-node-h_REF.gc b/test/decompiler/reference/draw-node-h_REF.gc new file mode 100644 index 0000000000..5c84ace690 --- /dev/null +++ b/test/decompiler/reference/draw-node-h_REF.gc @@ -0,0 +1,54 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type draw-node +(deftype draw-node (drawable) + ((child-count uint8 :offset 6) + (flags uint8 :offset 7) + (child uint32 :offset 8) + (distance float :offset 12) + ) + :method-count-assert 18 + :size-assert #x20 + :flag-assert #x1200000020 + ) + +;; definition for method 3 of type draw-node +(defmethod inspect draw-node ((obj draw-node)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tchild-count: ~D~%" (-> obj child-count)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Tchild: #x~X~%" (-> obj child)) + (format #t "~Tdistance: #x~X~%" (-> obj distance)) + obj + ) + +;; type drawable-inline-array-node is defined here, but it is unknown to the decompiler + +;; definition of type draw-node-dma +(deftype draw-node-dma (structure) + ((banka draw-node 32 :inline :offset-assert 0) + (bankb draw-node 32 :inline :offset-assert 1024) + ) + :method-count-assert 9 + :size-assert #x800 + :flag-assert #x900000800 + ) + +;; definition for method 3 of type draw-node-dma +(defmethod inspect draw-node-dma ((obj draw-node-dma)) + (format #t "[~8x] ~A~%" obj 'draw-node-dma) + (format #t "~Tbanka[32] @ #x~X~%" (-> obj banka)) + (format #t "~Tbankb[32] @ #x~X~%" (-> obj bankb)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-3 0)) + ) + + + + diff --git a/test/decompiler/reference/drawable-actor-h_REF.gc b/test/decompiler/reference/drawable-actor-h_REF.gc new file mode 100644 index 0000000000..e2f33046a8 --- /dev/null +++ b/test/decompiler/reference/drawable-actor-h_REF.gc @@ -0,0 +1,46 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type drawable-actor +(deftype drawable-actor (drawable) + ((actor basic :offset 8) + ) + :method-count-assert 18 + :size-assert #x20 + :flag-assert #x1200000020 + ) + +;; definition for method 3 of type drawable-actor +(defmethod inspect drawable-actor ((obj drawable-actor)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tactor: ~A~%" (-> obj actor)) + obj + ) + +;; definition of type drawable-tree-actor +(deftype drawable-tree-actor (drawable-tree) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-inline-array-actor +(deftype drawable-inline-array-actor (drawable-inline-array) + ((paid uint8 36 :offset-assert 32) + ) + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +;; definition for method 10 of type drawable-tree-actor +(defmethod dummy-10 drawable-tree-actor ((obj drawable-tree-actor)) + 0 + ) + + + + diff --git a/test/decompiler/reference/drawable-ambient-h_REF.gc b/test/decompiler/reference/drawable-ambient-h_REF.gc new file mode 100644 index 0000000000..a35e25406b --- /dev/null +++ b/test/decompiler/reference/drawable-ambient-h_REF.gc @@ -0,0 +1,113 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type drawable-ambient +(deftype drawable-ambient (drawable) + ((ambient basic :offset 8) + ) + :method-count-assert 19 + :size-assert #x20 + :flag-assert #x1300000020 + (:methods + (dummy-18 () none 18) + ) + ) + +;; definition for method 3 of type drawable-ambient +(defmethod inspect drawable-ambient ((obj drawable-ambient)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tambient: ~A~%" (-> obj ambient)) + obj + ) + +;; definition of type drawable-tree-ambient +(deftype drawable-tree-ambient (drawable-tree) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-inline-array-ambient +(deftype drawable-inline-array-ambient (drawable-inline-array) + ((paid uint8 36 :offset-assert 32) + ) + :method-count-assert 18 + :size-assert #x44 + :flag-assert #x1200000044 + ) + +;; definition for method 10 of type drawable-tree-ambient +(defmethod dummy-10 drawable-tree-ambient ((obj drawable-tree-ambient)) + 0 + ) + +;; definition for method 16 of type drawable-tree-ambient +(defmethod + dummy-16 + drawable-tree-ambient + ((obj drawable-tree-ambient) (arg0 object) (arg1 object)) + arg1 + ) + +;; definition of type level-hint +(deftype level-hint (process) + ((text-id-to-display uint32 :offset-assert 112) + (sound-to-play basic :offset-assert 116) + (trans vector :offset-assert 120) + (sound-id uint32 :offset-assert 124) + (mode basic :offset-assert 128) + (total-time uint64 :offset-assert 136) + (total-off-time uint64 :offset-assert 144) + (last-time uint64 :offset-assert 152) + (voicebox uint64 :offset-assert 160) + ) + :method-count-assert 16 + :size-assert #xa8 + :flag-assert #x10000000a8 + (:methods + (dummy-14 () none 14) + (dummy-15 () none 15) + ) + ) + +;; definition for method 3 of type level-hint +(defmethod inspect level-hint ((obj level-hint)) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~T~Ttext-id-to-display: ~D~%" (-> obj text-id-to-display)) + (format #t "~T~Tsound-to-play: ~A~%" (-> obj sound-to-play)) + (format #t "~T~Ttrans: #~%" (-> obj trans)) + (format #t "~T~Tsound-id: ~D~%" (-> obj sound-id)) + (format #t "~T~Tmode: ~A~%" (-> obj mode)) + (format #t "~T~Ttotal-time: ~D~%" (-> obj total-time)) + (format #t "~T~Ttotal-off-time: ~D~%" (-> obj total-off-time)) + (format #t "~T~Tlast-time: ~D~%" (-> obj last-time)) + (format #t "~T~Tvoicebox: ~D~%" (-> obj voicebox)) + obj + ) + +;; definition of type ambient-list +(deftype ambient-list (structure) + ((num-items int32 :offset-assert 0) + (items uint32 2048 :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x2004 + :flag-assert #x900002004 + ) + +;; definition for method 3 of type ambient-list +(defmethod inspect ambient-list ((obj ambient-list)) + (format #t "[~8x] ~A~%" obj 'ambient-list) + (format #t "~Tnum-items: ~D~%" (-> obj num-items)) + (format #t "~Titems[2048] @ #x~X~%" (-> obj items)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-5 0)) + ) diff --git a/test/decompiler/reference/drawable-h_REF.gc b/test/decompiler/reference/drawable-h_REF.gc index 1f212c89c5..a7af31a58b 100644 --- a/test/decompiler/reference/drawable-h_REF.gc +++ b/test/decompiler/reference/drawable-h_REF.gc @@ -17,7 +17,7 @@ (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) - (dummy-16 () none 16) + (dummy-16 (_type_ object object) object 16) (dummy-17 () none 17) ) ) @@ -51,7 +51,3 @@ ;; failed to figure out what this is: (let ((v0-2 0)) ) - - - - diff --git a/test/decompiler/reference/drawable-inline-array-h_REF.gc b/test/decompiler/reference/drawable-inline-array-h_REF.gc new file mode 100644 index 0000000000..1ff2310b95 --- /dev/null +++ b/test/decompiler/reference/drawable-inline-array-h_REF.gc @@ -0,0 +1,26 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type drawable-inline-array +(deftype drawable-inline-array (drawable) + ((length int16 :offset 6) + ) + :method-count-assert 18 + :size-assert #x20 + :flag-assert #x1200000020 + ) + +;; definition for method 3 of type drawable-inline-array +(defmethod inspect drawable-inline-array ((obj drawable-inline-array)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere)) + (format #t "~Tlength: ~D~%" (-> obj length)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-1 0)) + ) + + diff --git a/test/decompiler/reference/drawable-tree-h_REF.gc b/test/decompiler/reference/drawable-tree-h_REF.gc new file mode 100644 index 0000000000..bdbf60b133 --- /dev/null +++ b/test/decompiler/reference/drawable-tree-h_REF.gc @@ -0,0 +1,23 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type drawable-tree +(deftype drawable-tree (drawable-group) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; definition of type drawable-tree-array +(deftype drawable-tree-array (drawable-group) + () + :method-count-assert 18 + :size-assert #x24 + :flag-assert #x1200000024 + ) + +;; failed to figure out what this is: +(let ((v0-2 0)) + ) + diff --git a/test/decompiler/reference/game-task-h_REF.gc b/test/decompiler/reference/game-task-h_REF.gc new file mode 100644 index 0000000000..d92736d4cf --- /dev/null +++ b/test/decompiler/reference/game-task-h_REF.gc @@ -0,0 +1,6 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(let ((v0-0 0)) + ) diff --git a/test/decompiler/reference/generic-h_REF.gc b/test/decompiler/reference/generic-h_REF.gc new file mode 100644 index 0000000000..742bd48c6a --- /dev/null +++ b/test/decompiler/reference/generic-h_REF.gc @@ -0,0 +1,497 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type gsf-vertex +(deftype gsf-vertex (structure) + ((data uint32 8 :offset-assert 0) + (byte uint8 32 :offset 0) + (quad uint128 2 :offset 0) + (vt qword :inline :offset 0) + (pos vector3s :inline :offset 0) + (tex vector2uh :inline :offset 12) + (nrm vector3s :inline :offset 16) + (nc qword :inline :offset 16) + (clr vector4ub :inline :offset 28) + (dtex vector2uh :inline :offset 16) + (dclr vector4ub :inline :offset 20) + ) + :pack-me + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type gsf-vertex +(defmethod inspect gsf-vertex ((obj gsf-vertex)) + (format #t "[~8x] ~A~%" obj 'gsf-vertex) + (format #t "~Tdata[8] @ #x~X~%" (-> obj data)) + (format #t "~Tbyte[32] @ #x~X~%" (-> obj data)) + (format #t "~Tquad[2] @ #x~X~%" (-> obj data)) + (format #t "~Tvt: #~%" (-> obj data)) + (format #t "~Tpos: #~%" (-> obj data)) + (format #t "~Ttex: #~%" (&-> obj data 3)) + (format #t "~Tnrm: #~%" (&-> obj data 4)) + (format #t "~Tnc: #~%" (&-> obj data 4)) + (format #t "~Tclr: #~%" (&-> obj data 7)) + (format #t "~Tdtex: #~%" (&-> obj data 4)) + (format #t "~Tdclr: #~%" (&-> obj data 5)) + obj + ) + +;; definition of type gsf-vertex-array +(deftype gsf-vertex-array (structure) + ((vtx gsf-vertex :dynamic :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x0 + :flag-assert #x900000000 + ) + +;; definition for method 3 of type gsf-vertex-array +(defmethod inspect gsf-vertex-array ((obj gsf-vertex-array)) + (format #t "[~8x] ~A~%" obj 'gsf-vertex-array) + (format #t "~Tvtx[0] @ #x~X~%" (-> obj vtx)) + obj + ) + +;; definition of type gsf-fx-vertex +(deftype gsf-fx-vertex (structure) + ((clr vector4ub :inline :offset-assert 0) + (tex vector2uh :inline :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type gsf-fx-vertex +(defmethod inspect gsf-fx-vertex ((obj gsf-fx-vertex)) + (format #t "[~8x] ~A~%" obj 'gsf-fx-vertex) + (format #t "~Tclr: #~%" (-> obj clr)) + (format #t "~Ttex: #~%" (-> obj tex)) + obj + ) + +;; definition of type gsf-fx-vertex-array +(deftype gsf-fx-vertex-array (structure) + ((data gsf-fx-vertex :dynamic :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x0 + :flag-assert #x900000000 + ) + +;; definition for method 3 of type gsf-fx-vertex-array +(defmethod inspect gsf-fx-vertex-array ((obj gsf-fx-vertex-array)) + (format #t "[~8x] ~A~%" obj 'gsf-fx-vertex-array) + (format #t "~Tdata[0] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type gsf-header +(deftype gsf-header (structure) + ((num-strips uint8 :offset-assert 0) + (expanded uint8 :offset-assert 1) + (num-dps uint16 :offset-assert 2) + (num-vtxs uint16 :offset-assert 4) + (strip-table uint8 10 :offset-assert 6) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type gsf-header +(defmethod inspect gsf-header ((obj gsf-header)) + (format #t "[~8x] ~A~%" obj 'gsf-header) + (format #t "~Tnum-strips: ~D~%" (-> obj num-strips)) + (format #t "~Texpanded: ~D~%" (-> obj expanded)) + (format #t "~Tnum-dps: ~D~%" (-> obj num-dps)) + (format #t "~Tnum-vtxs: ~D~%" (-> obj num-vtxs)) + (format #t "~Tstrip-table[10] @ #x~X~%" (-> obj strip-table)) + obj + ) + +;; definition of type gsf-ik +(deftype gsf-ik (structure) + ((index uint8 :offset-assert 0) + (no-kick uint8 :offset-assert 1) + ) + :method-count-assert 9 + :size-assert #x2 + :flag-assert #x900000002 + ) + +;; definition for method 3 of type gsf-ik +(defmethod inspect gsf-ik ((obj gsf-ik)) + (format #t "[~8x] ~A~%" obj 'gsf-ik) + (format #t "~Tindex: ~D~%" (-> obj index)) + (format #t "~Tno-kick: ~D~%" (-> obj no-kick)) + obj + ) + +;; definition of type gsf-info +(deftype gsf-info (structure) + ((ptr-iks uint32 :offset-assert 0) + (ptr-verts uint32 :offset-assert 4) + (ptr-fx uint32 :offset-assert 8) + (dummy2 uint32 :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type gsf-info +(defmethod inspect gsf-info ((obj gsf-info)) + (format #t "[~8x] ~A~%" obj 'gsf-info) + (format #t "~Tptr-iks: #x~X~%" (-> obj ptr-iks)) + (format #t "~Tptr-verts: #x~X~%" (-> obj ptr-verts)) + (format #t "~Tptr-fx: #x~X~%" (-> obj ptr-fx)) + (format #t "~Tdummy2: ~D~%" (-> obj dummy2)) + obj + ) + +;; definition of type gsf-buffer +(deftype gsf-buffer (structure) + ((data uint8 8192 :offset-assert 0) + (info gsf-info :inline :offset 0) + (header gsf-header :inline :offset 16) + (work-area uint8 :dynamic :offset 32) + ) + :method-count-assert 9 + :size-assert #x2000 + :flag-assert #x900002000 + ) + +;; definition for method 3 of type gsf-buffer +(defmethod inspect gsf-buffer ((obj gsf-buffer)) + (format #t "[~8x] ~A~%" obj 'gsf-buffer) + (format #t "~Tdata[8192] @ #x~X~%" (-> obj data)) + (format #t "~Tinfo: #~%" (-> obj data)) + (format #t "~Theader: #~%" (&-> obj data 16)) + (format #t "~Twork-area[0] @ #x~X~%" (&-> obj data 32)) + obj + ) + +;; definition of type generic-frag +(deftype generic-frag (structure) + ((start-pos uint16 :offset-assert 0) + (end-pos uint16 :offset-assert 2) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +;; definition for method 3 of type generic-frag +(defmethod inspect generic-frag ((obj generic-frag)) + (format #t "[~8x] ~A~%" obj 'generic-frag) + (format #t "~Tstart-pos: ~D~%" (-> obj start-pos)) + (format #t "~Tend-pos: ~D~%" (-> obj end-pos)) + obj + ) + +;; definition of type generic-strip +(deftype generic-strip (structure) + ((pos uint16 :offset-assert 0) + (len uint16 :offset-assert 2) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +;; definition for method 3 of type generic-strip +(defmethod inspect generic-strip ((obj generic-strip)) + (format #t "[~8x] ~A~%" obj 'generic-strip) + (format #t "~Tpos: ~D~%" (-> obj pos)) + (format #t "~Tlen: ~D~%" (-> obj len)) + obj + ) + +;; definition of type generic-envmap-saves +(deftype generic-envmap-saves (structure) + ((index-mask vector4w :inline :offset-assert 0) + (verts uint128 12 :offset-assert 16) + (kicks uint128 4 :offset-assert 208) + ) + :method-count-assert 9 + :size-assert #x110 + :flag-assert #x900000110 + ) + +;; definition for method 3 of type generic-envmap-saves +(defmethod inspect generic-envmap-saves ((obj generic-envmap-saves)) + (format #t "[~8x] ~A~%" obj 'generic-envmap-saves) + (format #t "~Tindex-mask: #~%" (-> obj index-mask)) + (format #t "~Tverts[12] @ #x~X~%" (-> obj verts)) + (format #t "~Tkicks[4] @ #x~X~%" (-> obj kicks)) + obj + ) + +;; definition of type generic-interp-job +(deftype generic-interp-job (structure) + ((job-type uint16 :offset-assert 0) + (num uint16 :offset-assert 2) + (first uint16 :offset-assert 4) + (pad uint16 :offset-assert 6) + (ptr-data uint32 :offset-assert 8) + (morph-z uint16 :offset-assert 12) + (morph-w uint16 :offset-assert 14) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type generic-interp-job +(defmethod inspect generic-interp-job ((obj generic-interp-job)) + (format #t "[~8x] ~A~%" obj 'generic-interp-job) + (format #t "~Tjob-type: ~D~%" (-> obj job-type)) + (format #t "~Tnum: ~D~%" (-> obj num)) + (format #t "~Tfirst: ~D~%" (-> obj first)) + (format #t "~Tpad: ~D~%" (-> obj pad)) + (format #t "~Tptr-data: #x~X~%" (-> obj ptr-data)) + (format #t "~Tmorph-z: ~D~%" (-> obj morph-z)) + (format #t "~Tmorph-w: ~D~%" (-> obj morph-w)) + obj + ) + +;; definition of type generic-saves +(deftype generic-saves (structure) + ((ptr-dma uint32 :offset-assert 0) + (ptr-vtxs uint32 :offset-assert 4) + (ptr-clrs uint32 :offset-assert 8) + (ptr-texs uint32 :offset-assert 12) + (ptr-env-clrs uint32 :offset-assert 16) + (ptr-env-texs uint32 :offset-assert 20) + (cur-outbuf uint32 :offset-assert 24) + (ptr-fx-buf uint32 :offset-assert 28) + (xor-outbufs uint32 :offset-assert 32) + (num-dps uint32 :offset-assert 36) + (qwc uint32 :offset-assert 40) + (gsf-buf gsf-buffer :offset-assert 44) + (ptr-shaders uint32 :offset-assert 48) + (ptr-env-shader uint32 :offset-assert 52) + (is-envmap uint32 :offset-assert 56) + (basep uint32 :offset-assert 60) + (ptr-interp-job generic-interp-job :offset-assert 64) + (gifbuf-adr uint32 :offset-assert 68) + (inbuf-adr uint32 :offset-assert 72) + (fade-val uint32 :offset-assert 76) + (time-of-day-color uint32 :offset-assert 80) + (to-vu0-waits uint32 :offset-assert 84) + (to-spr-waits uint32 :offset-assert 88) + (from-spr-waits uint32 :offset-assert 92) + (envmap generic-envmap-saves :inline :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x170 + :flag-assert #x900000170 + ) + +;; definition for method 3 of type generic-saves +(defmethod inspect generic-saves ((obj generic-saves)) + (format #t "[~8x] ~A~%" obj 'generic-saves) + (format #t "~Tptr-dma: #x~X~%" (-> obj ptr-dma)) + (format #t "~Tptr-vtxs: #x~X~%" (-> obj ptr-vtxs)) + (format #t "~Tptr-clrs: #x~X~%" (-> obj ptr-clrs)) + (format #t "~Tptr-texs: #x~X~%" (-> obj ptr-texs)) + (format #t "~Tptr-env-clrs: #x~X~%" (-> obj ptr-env-clrs)) + (format #t "~Tptr-env-texs: #x~X~%" (-> obj ptr-env-texs)) + (format #t "~Tcur-outbuf: #x~X~%" (-> obj cur-outbuf)) + (format #t "~Tptr-fx-buf: ~D~%" (-> obj ptr-fx-buf)) + (format #t "~Txor-outbufs: ~D~%" (-> obj xor-outbufs)) + (format #t "~Tnum-dps: ~D~%" (-> obj num-dps)) + (format #t "~Tqwc: ~D~%" (-> obj qwc)) + (format #t "~Tgsf-buf: #~%" (-> obj gsf-buf)) + (format #t "~Tptr-shaders: #x~X~%" (-> obj ptr-shaders)) + (format #t "~Tptr-env-shader: ~D~%" (-> obj ptr-env-shader)) + (format #t "~Tis-envmap: ~D~%" (-> obj is-envmap)) + (format #t "~Tbasep: #x~X~%" (-> obj basep)) + (format + #t + "~Tptr-interp-job: #~%" + (-> obj ptr-interp-job) + ) + (format #t "~Tgifbuf-adr: ~D~%" (-> obj gifbuf-adr)) + (format #t "~Tinbuf-adr: ~D~%" (-> obj inbuf-adr)) + (format #t "~Tfade-val: ~D~%" (-> obj fade-val)) + (format #t "~Ttime-of-day-color: ~D~%" (-> obj time-of-day-color)) + (format #t "~Tto-vu0-waits: ~D~%" (-> obj to-vu0-waits)) + (format #t "~Tto-spr-waits: ~D~%" (-> obj to-spr-waits)) + (format #t "~Tfrom-spr-waits: ~D~%" (-> obj from-spr-waits)) + (format #t "~Tenvmap: #~%" (-> obj envmap)) + obj + ) + +;; definition of type generic-gif-tag +(deftype generic-gif-tag (structure) + ((data uint32 4 :offset-assert 0) + (qword qword :inline :offset 0) + (fan-prim uint32 :offset 0) + (str-prim uint32 :offset 4) + (regs uint32 :offset 8) + (num-strips uint32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type generic-gif-tag +(defmethod inspect generic-gif-tag ((obj generic-gif-tag)) + (format #t "[~8x] ~A~%" obj 'generic-gif-tag) + (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) + (format #t "~Tqword: #~%" (-> obj data)) + (format #t "~Tfan-prim: ~D~%" (-> obj data 0)) + (format #t "~Tstr-prim: ~D~%" (-> obj data 1)) + (format #t "~Tregs: ~D~%" (-> obj data 2)) + (format #t "~Tnum-strips: ~D~%" (-> obj data 3)) + obj + ) + +;; definition of type ad-cmd +(deftype ad-cmd (structure) + ((word uint32 4 :offset-assert 0) + (quad uint128 :offset 0) + (data uint64 :offset 0) + (cmds uint64 :offset 8) + (cmd uint8 :offset 8) + (x uint32 :offset 0) + (y uint32 :offset 4) + (z uint32 :offset 8) + (w uint32 :offset 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type ad-cmd +;; Used lq/sq +(defmethod inspect ad-cmd ((obj ad-cmd)) + (format #t "[~8x] ~A~%" obj 'ad-cmd) + (format #t "~Tword[4] @ #x~X~%" (-> obj word)) + (format #t "~Tquad: ~D~%" (-> obj quad)) + (format #t "~Tdata: ~D~%" (-> obj data)) + (format #t "~Tcmds: ~D~%" (-> obj cmds)) + (format #t "~Tcmd: ~D~%" (-> obj cmd)) + (format #t "~Tx: ~D~%" (-> obj word 0)) + (format #t "~Ty: ~D~%" (-> obj word 1)) + (format #t "~Tz: ~D~%" (-> obj word 2)) + (format #t "~Tw: ~D~%" (-> obj word 3)) + obj + ) + +;; definition of type generic-envmap-consts +(deftype generic-envmap-consts (structure) + ((consts vector :inline :offset-assert 0) + (strgif generic-gif-tag :inline :offset-assert 16) + (colors vector4w :inline :offset-assert 32) + (shader adgif-shader :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) + +;; definition for method 3 of type generic-envmap-consts +(defmethod inspect generic-envmap-consts ((obj generic-envmap-consts)) + (format #t "[~8x] ~A~%" obj 'generic-envmap-consts) + (format #t "~Tconsts: #~%" (-> obj consts)) + (format #t "~Tstrgif: #~%" (-> obj strgif)) + (format #t "~Tcolors: #~%" (-> obj colors)) + (format #t "~Tshader: #~%" (-> obj shader)) + obj + ) + +;; definition of type generic-consts +(deftype generic-consts (structure) + ((dma-header dma-packet :inline :offset-assert 0) + (vif-header uint32 4 :offset-assert 16) + (dma-ref-vtxs dma-packet :inline :offset-assert 32) + (dma-cnt-call dma-packet :inline :offset-assert 48) + (matrix matrix :inline :offset-assert 64) + (base-strgif generic-gif-tag :inline :offset-assert 128) + (alpha-opaque ad-cmd :inline :offset-assert 144) + (alpha-translucent ad-cmd :inline :offset-assert 160) + (ztest-normal ad-cmd :inline :offset-assert 176) + (ztest-opaque ad-cmd :inline :offset-assert 192) + (adcmd-offsets uint8 16 :offset-assert 208) + (adcmds ad-cmd 4 :offset 144) + (stcycle-tag uint32 :offset-assert 224) + (unpack-vtx-tag uint32 :offset-assert 228) + (unpack-clr-tag uint32 :offset-assert 232) + (unpack-tex-tag uint32 :offset-assert 236) + (mscal-tag uint32 :offset-assert 240) + (flush-tag uint32 :offset-assert 244) + (reset-cycle-tag uint32 :offset-assert 248) + (dummy0 uint32 :offset-assert 252) + (dma-tag-cnt uint64 :offset-assert 256) + (envmap generic-envmap-consts :inline :offset-assert 272) + (light-consts vector :inline :offset-assert 400) + (texture-offset uint16 8 :offset-assert 416) + ) + :method-count-assert 9 + :size-assert #x1b0 + :flag-assert #x9000001b0 + ) + +;; definition for method 3 of type generic-consts +(defmethod inspect generic-consts ((obj generic-consts)) + (format #t "[~8x] ~A~%" obj 'generic-consts) + (format #t "~Tdma-header: #~%" (-> obj dma-header)) + (format #t "~Tvif-header[4] @ #x~X~%" (-> obj vif-header)) + (format #t "~Tdma-ref-vtxs: #~%" (-> obj dma-ref-vtxs)) + (format #t "~Tdma-cnt-call: #~%" (-> obj dma-cnt-call)) + (format #t "~Tmatrix: #~%" (-> obj matrix)) + (format #t "~Tbase-strgif: #~%" (-> obj base-strgif)) + (format #t "~Talpha-opaque: #~%" (-> obj alpha-opaque)) + (format + #t + "~Talpha-translucent: #~%" + (-> obj alpha-translucent) + ) + (format #t "~Tztest-normal: #~%" (-> obj ztest-normal)) + (format #t "~Tztest-opaque: #~%" (-> obj ztest-opaque)) + (format #t "~Tadcmd-offsets[16] @ #x~X~%" (-> obj adcmd-offsets)) + (format #t "~Tadcmds[4] @ #x~X~%" (-> obj alpha-opaque)) + (format #t "~Tstcycle-tag: ~D~%" (-> obj stcycle-tag)) + (format #t "~Tunpack-vtx-tag: ~D~%" (-> obj unpack-vtx-tag)) + (format #t "~Tunpack-clr-tag: ~D~%" (-> obj unpack-clr-tag)) + (format #t "~Tunpack-tex-tag: ~D~%" (-> obj unpack-tex-tag)) + (format #t "~Tmscal-tag: ~D~%" (-> obj mscal-tag)) + (format #t "~Tflush-tag: ~D~%" (-> obj flush-tag)) + (format #t "~Treset-cycle-tag: ~D~%" (-> obj reset-cycle-tag)) + (format #t "~Tdummy0: ~D~%" (-> obj dummy0)) + (format #t "~Tdma-tag-cnt: ~D~%" (-> obj dma-tag-cnt)) + (format #t "~Tenvmap: #~%" (-> obj envmap)) + (format #t "~Tlight-consts: #~%" (-> obj light-consts)) + (format #t "~Ttexture-offset[8] @ #x~X~%" (-> obj texture-offset)) + obj + ) + +;; definition of type generic-storage +(deftype generic-storage (structure) + ((data uint128 16 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x100 + :flag-assert #x900000100 + ) + +;; definition for method 3 of type generic-storage +(defmethod inspect generic-storage ((obj generic-storage)) + (format #t "[~8x] ~A~%" obj 'generic-storage) + (format #t "~Tdata[16] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition for symbol *gsf-buffer*, type gsf-buffer +(define + *gsf-buffer* + (the-as gsf-buffer (kmalloc global 9216 (kmalloc-flags align-64) "malloc")) + ) + diff --git a/test/decompiler/reference/hint-control-h_REF.gc b/test/decompiler/reference/hint-control-h_REF.gc new file mode 100644 index 0000000000..ab66a46f4a --- /dev/null +++ b/test/decompiler/reference/hint-control-h_REF.gc @@ -0,0 +1,79 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type level-hint-control +(deftype level-hint-control (structure) + ((delay-before-playing uint64 :offset-assert 0) + (id uint32 :offset-assert 8) + (num-attempts-before-playing int8 :offset-assert 12) + (num-success-before-killing int8 :offset-assert 13) + (num-attempts int8 :offset-assert 14) + (num-success int8 :offset-assert 15) + (start-time uint64 :offset-assert 16) + (last-time-called uint64 :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type level-hint-control +(defmethod inspect level-hint-control ((obj level-hint-control)) + (format #t "[~8x] ~A~%" obj 'level-hint-control) + (format #t "~Tdelay-before-playing: ~D~%" (-> obj delay-before-playing)) + (format #t "~Tid: ~D~%" (-> obj id)) + (format + #t + "~Tnum-attempts-before-playing: ~D~%" + (-> obj num-attempts-before-playing) + ) + (format + #t + "~Tnum-success-before-killing: ~D~%" + (-> obj num-success-before-killing) + ) + (format #t "~Tnum-attempts: ~D~%" (-> obj num-attempts)) + (format #t "~Tnum-success: ~D~%" (-> obj num-success)) + (format #t "~Tstart-time: ~D~%" (-> obj start-time)) + (format #t "~Tlast-time-called: ~D~%" (-> obj last-time-called)) + obj + ) + +;; definition of type task-hint-control +(deftype task-hint-control (structure) + ((task uint8 :offset-assert 0) + (delay uint64 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type task-hint-control +(defmethod inspect task-hint-control ((obj task-hint-control)) + (format #t "[~8x] ~A~%" obj 'task-hint-control) + (format #t "~Ttask: ~D~%" (-> obj task)) + (format #t "~Tdelay: ~D~%" (-> obj delay)) + obj + ) + +;; definition of type task-hint-control-group +(deftype task-hint-control-group (structure) + ((tasks basic :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +;; definition for method 3 of type task-hint-control-group +(defmethod inspect task-hint-control-group ((obj task-hint-control-group)) + (format #t "[~8x] ~A~%" obj 'task-hint-control-group) + (format #t "~Ttasks: ~A~%" (-> obj tasks)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-3 0)) + ) + diff --git a/test/decompiler/reference/main-h_REF.gc b/test/decompiler/reference/main-h_REF.gc new file mode 100644 index 0000000000..f413d8dd9d --- /dev/null +++ b/test/decompiler/reference/main-h_REF.gc @@ -0,0 +1,336 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *stats-poly*, type symbol +(define *stats-poly* #f) + +;; definition for symbol *stats-memory*, type symbol +(define *stats-memory* #f) + +;; definition for symbol *stats-memory-short*, type symbol +(define *stats-memory-short* #f) + +;; definition for symbol *stats-collide*, type symbol +(define *stats-collide* #f) + +;; definition for symbol *stats-bsp*, type symbol +(define *stats-bsp* #f) + +;; definition for symbol *stats-buffer*, type symbol +(define *stats-buffer* #f) + +;; definition for symbol *stats-target*, type symbol +(define *stats-target* #f) + +;; definition for symbol *stats-dma-test*, type symbol +(define *stats-dma-test* #f) + +;; definition for symbol *artist-all-visible*, type symbol +(define *artist-all-visible* #f) + +;; definition for symbol *artist-flip-visible*, type symbol +(define *artist-flip-visible* #f) + +;; definition for symbol *artist-fix-visible*, type symbol +(define *artist-fix-visible* #f) + +;; definition for symbol *artist-fix-frustum*, type symbol +(define *artist-fix-frustum* #f) + +;; definition for symbol *artist-error-spheres*, type symbol +(define *artist-error-spheres* #f) + +;; definition for symbol *artist-use-menu-subdiv*, type symbol +(define *artist-use-menu-subdiv* #f) + +;; definition for symbol *display-profile*, type symbol +(define *display-profile* #t) + +;; definition for symbol *display-sidekick-stats*, type symbol +(define *display-sidekick-stats* #f) + +;; definition for symbol *display-quad-stats*, type symbol +(define *display-quad-stats* #f) + +;; definition for symbol *display-tri-stats*, type symbol +(define *display-tri-stats* #f) + +;; definition for symbol *display-perf-stats*, type symbol +(define *display-perf-stats* #f) + +;; definition for symbol *display-ground-stats*, type symbol +(define *display-ground-stats* #f) + +;; definition for symbol *display-collision-marks*, type symbol +(define *display-collision-marks* #f) + +;; definition for symbol *display-collide-cache*, type symbol +(define *display-collide-cache* #f) + +;; definition for symbol *display-render-collision*, type symbol +(define *display-render-collision* #f) + +;; definition for symbol *display-hipri-collision-marks*, type symbol +(define *display-hipri-collision-marks* #f) + +;; definition for symbol *display-edge-collision-marks*, type symbol +(define *display-edge-collision-marks* #f) + +;; definition for symbol *display-geo-marks*, type symbol +(define *display-geo-marks* #f) + +;; definition for symbol *display-target-marks*, type symbol +(define *display-target-marks* #f) + +;; definition for symbol *display-collide-history*, type int +(define *display-collide-history* 0) + +;; definition for symbol *display-xyz-axes*, type symbol +(define *display-xyz-axes* #f) + +;; definition for symbol *display-cam-collide-history*, type symbol +(define *display-cam-collide-history* #f) + +;; definition for symbol *record-cam-collide-history*, type symbol +(define *record-cam-collide-history* #f) + +;; definition for symbol *display-cam-master-marks*, type symbol +(define *display-cam-master-marks* #f) + +;; definition for symbol *display-cam-other*, type symbol +(define *display-cam-other* #f) + +;; definition for symbol *display-camera-marks*, type symbol +(define *display-camera-marks* #f) + +;; definition for symbol *camera-no-mip-correction*, type symbol +(define *camera-no-mip-correction* #f) + +;; definition for symbol *display-cam-los-info*, type symbol +(define *display-cam-los-info* #f) + +;; definition for symbol *display-cam-los-debug*, type symbol +(define *display-cam-los-debug* #f) + +;; definition for symbol *display-cam-los-marks*, type symbol +(define *display-cam-los-marks* #f) + +;; definition for symbol *display-cam-coll-marks*, type symbol +(define *display-cam-coll-marks* #f) + +;; definition for symbol *display-camera-info*, type symbol +(define *display-camera-info* #f) + +;; definition for symbol *display-camera-old-stats*, type symbol +(define *display-camera-old-stats* #f) + +;; definition for symbol *display-camera-last-attacker*, type symbol +(define *display-camera-last-attacker* #f) + +;; definition for symbol *display-file-info*, type symbol +(define *display-file-info* #f) + +;; definition for symbol *display-actor-marks*, type symbol +(define *display-actor-marks* #f) + +;; definition for symbol *display-ambient-hint-marks*, type symbol +(define *display-ambient-hint-marks* #f) + +;; definition for symbol *display-ambient-sound-marks*, type symbol +(define *display-ambient-sound-marks* #f) + +;; definition for symbol *display-ambient-poi-marks*, type symbol +(define *display-ambient-poi-marks* #f) + +;; definition for symbol *display-ambient-light-marks*, type symbol +(define *display-ambient-light-marks* #f) + +;; definition for symbol *display-ambient-dark-marks*, type symbol +(define *display-ambient-dark-marks* #f) + +;; definition for symbol *display-ambient-weather-off-marks*, type symbol +(define *display-ambient-weather-off-marks* #f) + +;; definition for symbol *display-ambient-ocean-off-marks*, type symbol +(define *display-ambient-ocean-off-marks* #f) + +;; definition for symbol *display-ambient-ocean-near-off-marks*, type symbol +(define *display-ambient-ocean-near-off-marks* #f) + +;; definition for symbol *display-ambient-music-marks*, type symbol +(define *display-ambient-music-marks* #f) + +;; definition for symbol *display-sprite-info*, type symbol +(define *display-sprite-info* #f) + +;; definition for symbol *display-entity-errors*, type symbol +(define *display-entity-errors* #t) + +;; definition for symbol *display-lights*, type symbol +(define *display-lights* #f) + +;; definition for symbol *display-instance-info*, type symbol +(define *display-instance-info* #f) + +;; definition for symbol *display-deci-count*, type symbol +(define *display-deci-count* #f) + +;; definition for symbol *sync-dma*, type symbol +(define *sync-dma* #f) + +;; definition for symbol *display-strip-lines*, type int +(define *display-strip-lines* 0) + +;; definition for symbol *display-nav-marks*, type symbol +(define *display-nav-marks* #f) + +;; definition for symbol *display-path-marks*, type symbol +(define *display-path-marks* #f) + +;; definition for symbol *display-vol-marks*, type symbol +(define *display-vol-marks* #f) + +;; definition for symbol *display-water-marks*, type symbol +(define *display-water-marks* #f) + +;; definition for symbol *display-actor-anim*, type symbol +(define *display-actor-anim* #f) + +;; definition for symbol *display-process-anim*, type symbol +(define *display-process-anim* #f) + +;; definition for symbol *display-actor-vis*, type symbol +(define *display-actor-vis* #f) + +;; definition for symbol *display-actor-graph*, type symbol +(define *display-actor-graph* #f) + +;; definition for symbol *display-level-border*, type symbol +(define *display-level-border* #f) + +;; definition for symbol *display-load-boundaries*, type symbol +(define *display-load-boundaries* #f) + +;; definition for symbol *display-memcard-info*, type symbol +(define *display-memcard-info* #f) + +;; definition for symbol *display-split-boxes*, type symbol +(define *display-split-boxes* #f) + +;; definition for symbol *display-split-box-info*, type symbol +(define *display-split-box-info* #f) + +;; definition for symbol *display-texture-download*, type symbol +(define *display-texture-download* #f) + +;; definition for symbol *display-art-control*, type symbol +(define *display-art-control* #f) + +;; definition for symbol *display-level-spheres*, type symbol +(define *display-level-spheres* #f) + +;; definition for symbol *time-of-day-effects*, type symbol +(define *time-of-day-effects* #t) + +;; definition for symbol *time-of-day-fast*, type symbol +(define *time-of-day-fast* #t) + +;; definition for symbol *display-iop-info*, type symbol +(define *display-iop-info* #f) + +;; definition for symbol *ambient-sound-class*, type symbol +(define *ambient-sound-class* #t) + +;; definition for symbol *slow-frame-rate*, type symbol +(define *slow-frame-rate* #f) + +;; definition for symbol *weather-off*, type symbol +(define *weather-off* #f) + +;; definition for symbol *debug-pause*, type symbol +(define *debug-pause* #f) + +;; definition for symbol *subdivide-draw-mode*, type int +(define *subdivide-draw-mode* 0) + +;; definition for symbol *ocean-subdivide-draw-mode*, type int +(define *ocean-subdivide-draw-mode* 0) + +;; failed to figure out what this is: +(when (or (not *dproc*) (zero? *dproc*)) + (set! *dproc* #f) + ) + +;; definition for symbol *run*, type symbol +(define *run* #f) + +;; definition for symbol *teleport*, type symbol +(define *teleport* #f) + +;; definition for symbol *teleport-count*, type int +(define *teleport-count* 0) + +;; definition for symbol *draw-hook*, type (function none) +(define *draw-hook* nothing) + +;; definition for symbol *debug-hook*, type (function none) +(define *debug-hook* nothing) + +;; definition for symbol *menu-hook*, type (function none) +(define *menu-hook* nothing) + +;; definition for symbol *progress-hook*, type (function none) +(define *progress-hook* nothing) + +;; definition for symbol *dma-timeout-hook*, type (function none) +(define *dma-timeout-hook* nothing) + +;; definition of type frame-stats +(deftype frame-stats (structure) + ((field-time uint64 2 :offset-assert 0) + (field int32 :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type frame-stats +(defmethod inspect frame-stats ((obj frame-stats)) + (format #t "[~8x] ~A~%" obj 'frame-stats) + (format #t "~Tfield-time[2] @ #x~X~%" (-> obj field-time)) + (format #t "~Tfield: ~D~%" (-> obj field)) + obj + ) + +;; definition for symbol *frame-stats*, type frame-stats +(define *frame-stats* (new 'static 'frame-stats)) + +;; definition of type screen-filter +(deftype screen-filter (basic) + ((draw? basic :offset-assert 4) + (color rgba :offset-assert 8) + ) + :method-count-assert 10 + :size-assert #xc + :flag-assert #xa0000000c + (:methods + (dummy-9 (_type_) none 9) + ) + ) + +;; definition for method 3 of type screen-filter +(defmethod inspect screen-filter ((obj screen-filter)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdraw?: ~A~%" (-> obj draw?)) + (format #t "~Tcolor: ~D~%" (-> obj color)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-2 0)) + ) + + + + diff --git a/test/decompiler/reference/math_REF.gc b/test/decompiler/reference/math_REF.gc index f0aa1d08bc..9e82580cd1 100644 --- a/test/decompiler/reference/math_REF.gc +++ b/test/decompiler/reference/math_REF.gc @@ -215,10 +215,7 @@ ) ;; definition for symbol *random-generator*, type random-generator -(define - *random-generator* - (the-as random-generator (new 'global 'random-generator)) - ) +(define *random-generator* (new 'global 'random-generator)) ;; failed to figure out what this is: (set! (-> *random-generator* seed) (the-as uint #x666edd1e)) diff --git a/test/decompiler/reference/memory-usage-h_REF.gc b/test/decompiler/reference/memory-usage-h_REF.gc index 609d177dd8..1583a09f18 100644 --- a/test/decompiler/reference/memory-usage-h_REF.gc +++ b/test/decompiler/reference/memory-usage-h_REF.gc @@ -51,13 +51,10 @@ ) ;; definition for symbol *mem-usage*, type memory-usage-block -(define *mem-usage* (the-as memory-usage-block (new 'debug 'memory-usage-block))) +(define *mem-usage* (new 'debug 'memory-usage-block)) ;; definition for symbol *dma-mem-usage*, type memory-usage-block -(define - *dma-mem-usage* - (the-as memory-usage-block (new 'debug 'memory-usage-block)) - ) +(define *dma-mem-usage* (new 'debug 'memory-usage-block)) ;; definition for symbol *temp-mem-usage*, type symbol (define *temp-mem-usage* #f) diff --git a/test/decompiler/reference/ocean-h_REF.gc b/test/decompiler/reference/ocean-h_REF.gc new file mode 100644 index 0000000000..a414eed338 --- /dev/null +++ b/test/decompiler/reference/ocean-h_REF.gc @@ -0,0 +1,823 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type ocean-corner +(deftype ocean-corner (structure) + ((bsphere sphere :inline :offset-assert 0) + (start-corner vector :inline :offset-assert 16) + (y-scales vector :inline :offset-assert 32) + (alphas vector :inline :offset-assert 48) + (colors uint32 4 :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + ) + +;; definition for method 3 of type ocean-corner +(defmethod inspect ocean-corner ((obj ocean-corner)) + (format #t "[~8x] ~A~%" obj 'ocean-corner) + (format #t "~Tbsphere: #~%" (-> obj bsphere)) + (format #t "~Tstart-corner: #~%" (-> obj start-corner)) + (format #t "~Ty-scales: #~%" (-> obj y-scales)) + (format #t "~Talphas: #~%" (-> obj alphas)) + (format #t "~Tcolors[4] @ #x~X~%" (-> obj colors)) + obj + ) + +;; definition of type ocean-wave-info +(deftype ocean-wave-info (structure) + ((frequency float :offset-assert 0) + (amplitude float :offset-assert 4) + (wave-speed float :offset-assert 8) + (angle float :offset-assert 12) + (kx float :offset-assert 16) + (ky float :offset-assert 20) + (w float :offset-assert 24) + (flags int32 :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type ocean-wave-info +(defmethod inspect ocean-wave-info ((obj ocean-wave-info)) + (format #t "[~8x] ~A~%" obj 'ocean-wave-info) + (format #t "~Tfrequency: ~f~%" (-> obj frequency)) + (format #t "~Tamplitude: ~f~%" (-> obj amplitude)) + (format #t "~Twave-speed: ~f~%" (-> obj wave-speed)) + (format #t "~Tangle: ~f~%" (-> obj angle)) + (format #t "~Tkx: ~f~%" (-> obj kx)) + (format #t "~Tky: ~f~%" (-> obj ky)) + (format #t "~Tw: ~f~%" (-> obj w)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + obj + ) + +;; definition of type ocean-vertex +(deftype ocean-vertex (structure) + ((pos vector :inline :offset-assert 0) + (stq vector :inline :offset-assert 16) + (col vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type ocean-vertex +(defmethod inspect ocean-vertex ((obj ocean-vertex)) + (format #t "[~8x] ~A~%" obj 'ocean-vertex) + (format #t "~Tpos: #~%" (-> obj pos)) + (format #t "~Tstq: #~%" (-> obj stq)) + (format #t "~Tcol: #~%" (-> obj col)) + obj + ) + +;; definition of type ocean-spheres +(deftype ocean-spheres (structure) + ((spheres sphere 36 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x240 + :flag-assert #x900000240 + ) + +;; definition for method 3 of type ocean-spheres +(defmethod inspect ocean-spheres ((obj ocean-spheres)) + (format #t "[~8x] ~A~%" obj 'ocean-spheres) + (format #t "~Tspheres[36] @ #x~X~%" (-> obj spheres)) + obj + ) + +;; definition of type ocean-colors +(deftype ocean-colors (structure) + ((colors rgba 2548 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x27d0 + :flag-assert #x9000027d0 + ) + +;; definition for method 3 of type ocean-colors +(defmethod inspect ocean-colors ((obj ocean-colors)) + (format #t "[~8x] ~A~%" obj 'ocean-colors) + (format #t "~Tcolors[2548] @ #x~X~%" (-> obj colors)) + obj + ) + +;; definition of type ocean-mid-mask +(deftype ocean-mid-mask (structure) + ((mask uint8 8 :offset-assert 0) + (dword uint64 :offset 0) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type ocean-mid-mask +(defmethod inspect ocean-mid-mask ((obj ocean-mid-mask)) + (format #t "[~8x] ~A~%" obj 'ocean-mid-mask) + (format #t "~Tmask[8] @ #x~X~%" (-> obj mask)) + (format #t "~Tdword: #x~X~%" (-> obj dword)) + obj + ) + +;; definition of type ocean-mid-indices +(deftype ocean-mid-indices (basic) + ((data uint16 36 :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x4c + :flag-assert #x90000004c + ) + +;; definition for method 3 of type ocean-mid-indices +(defmethod inspect ocean-mid-indices ((obj ocean-mid-indices)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdata[36] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type ocean-mid-masks +(deftype ocean-mid-masks (basic) + ((data uint32 :offset-assert 4) + ) + :pack-me + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type ocean-mid-masks +(defmethod inspect ocean-mid-masks ((obj ocean-mid-masks)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdata: #x~X~%" (-> obj data)) + obj + ) + +;; definition of type ocean-trans-mask +(deftype ocean-trans-mask (structure) + ((mask uint16 4 :offset-assert 0) + (word uint64 :offset 0) + ) + :pack-me + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type ocean-trans-mask +(defmethod inspect ocean-trans-mask ((obj ocean-trans-mask)) + (format #t "[~8x] ~A~%" obj 'ocean-trans-mask) + (format #t "~Tmask[4] @ #x~X~%" (-> obj mask)) + (format #t "~Tword: #x~X~%" (-> obj word)) + obj + ) + +;; definition of type ocean-trans-index +(deftype ocean-trans-index (structure) + ((parent int16 :offset-assert 0) + (child int16 :offset-assert 2) + ) + :pack-me + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +;; definition for method 3 of type ocean-trans-index +(defmethod inspect ocean-trans-index ((obj ocean-trans-index)) + (format #t "[~8x] ~A~%" obj 'ocean-trans-index) + (format #t "~Tparent: ~D~%" (-> obj parent)) + (format #t "~Tchild: ~D~%" (-> obj child)) + obj + ) + +;; definition of type ocean-trans-indices +(deftype ocean-trans-indices (basic) + ((data uint32 2304 :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x2404 + :flag-assert #x900002404 + ) + +;; definition for method 3 of type ocean-trans-indices +(defmethod inspect ocean-trans-indices ((obj ocean-trans-indices)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdata[2304] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type ocean-near-index +(deftype ocean-near-index (structure) + ((data uint16 16 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type ocean-near-index +(defmethod inspect ocean-near-index ((obj ocean-near-index)) + (format #t "[~8x] ~A~%" obj 'ocean-near-index) + (format #t "~Tdata[16] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type ocean-near-indices +(deftype ocean-near-indices (basic) + ((data uint32 :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type ocean-near-indices +(defmethod inspect ocean-near-indices ((obj ocean-near-indices)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdata: #x~X~%" (-> obj data)) + obj + ) + +;; definition of type ocean-near-colors +(deftype ocean-near-colors (structure) + ((color0 vector :inline :offset-assert 0) + (color1 vector :inline :offset-assert 16) + (color2 vector :inline :offset-assert 32) + (color3 vector :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +;; definition for method 3 of type ocean-near-colors +(defmethod inspect ocean-near-colors ((obj ocean-near-colors)) + (format #t "[~8x] ~A~%" obj 'ocean-near-colors) + (format #t "~Tcolor0: #~%" (-> obj color0)) + (format #t "~Tcolor1: #~%" (-> obj color1)) + (format #t "~Tcolor2: #~%" (-> obj color2)) + (format #t "~Tcolor3: #~%" (-> obj color3)) + obj + ) + +;; definition of type ocean-map +(deftype ocean-map (basic) + ((start-corner vector :inline :offset-assert 16) + (far-color vector :inline :offset-assert 32) + (ocean-spheres ocean-spheres :offset-assert 48) + (ocean-colors ocean-colors :offset-assert 52) + (ocean-mid-indices basic :offset-assert 56) + (ocean-trans-indices basic :offset-assert 60) + (ocean-near-indices basic :offset-assert 64) + (ocean-mid-masks basic :offset-assert 68) + ) + :method-count-assert 9 + :size-assert #x48 + :flag-assert #x900000048 + ) + +;; definition for method 3 of type ocean-map +(defmethod inspect ocean-map ((obj ocean-map)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tstart-corner: #~%" (-> obj start-corner)) + (format #t "~Tfar-color: #~%" (-> obj far-color)) + (format + #t + "~Tocean-spheres: #~%" + (-> obj ocean-spheres) + ) + (format #t "~Tocean-colors: #~%" (-> obj ocean-colors)) + (format #t "~Tocean-mid-indices: ~A~%" (-> obj ocean-mid-indices)) + (format #t "~Tocean-trans-indices: ~A~%" (-> obj ocean-trans-indices)) + (format #t "~Tocean-near-indices: ~A~%" (-> obj ocean-near-indices)) + (format #t "~Tocean-mid-masks: ~A~%" (-> obj ocean-mid-masks)) + obj + ) + +;; definition of type ocean-trans-strip +(deftype ocean-trans-strip (structure) + ((verts uint128 10 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #xa0 + :flag-assert #x9000000a0 + ) + +;; definition for method 3 of type ocean-trans-strip +(defmethod inspect ocean-trans-strip ((obj ocean-trans-strip)) + (format #t "[~8x] ~A~%" obj 'ocean-trans-strip) + (format #t "~Tverts[10] @ #x~X~%" (-> obj verts)) + obj + ) + +;; definition of type ocean-trans-strip-array +(deftype ocean-trans-strip-array (structure) + ((data ocean-trans-strip 4 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x280 + :flag-assert #x900000280 + ) + +;; definition for method 3 of type ocean-trans-strip-array +(defmethod inspect ocean-trans-strip-array ((obj ocean-trans-strip-array)) + (format #t "[~8x] ~A~%" obj 'ocean-trans-strip-array) + (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type ocean-wave-data +(deftype ocean-wave-data (structure) + ((data uint8 1024 :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x400 + :flag-assert #x900000400 + ) + +;; definition for method 3 of type ocean-wave-data +(defmethod inspect ocean-wave-data ((obj ocean-wave-data)) + (format #t "[~8x] ~A~%" obj 'ocean-wave-data) + (format #t "~Tdata[1024] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition of type ocean-wave-frames +(deftype ocean-wave-frames (structure) + ((frame ocean-wave-data 64 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x10000 + :flag-assert #x900000000 + ) + +;; definition for method 3 of type ocean-wave-frames +(defmethod inspect ocean-wave-frames ((obj ocean-wave-frames)) + (format #t "[~8x] ~A~%" obj 'ocean-wave-frames) + (format #t "~Tframe[64] @ #x~X~%" (-> obj frame)) + obj + ) + +;; definition of type ocean-work +(deftype ocean-work (basic) + ((deltas vector :inline :offset-assert 16) + (map-min vector :inline :offset-assert 32) + (map-max vector :inline :offset-assert 48) + (interp vector :inline :offset-assert 64) + (corner-array ocean-corner 25 :inline :offset-assert 80) + (corner-count int32 :offset-assert 2080) + (temp-vecs vector 4 :inline :offset-assert 2096) + (mid-mask-ptrs pointer 36 :offset-assert 2160) + (mid-camera-masks uint64 36 :offset-assert 2304) + (trans-mask-ptrs pointer 64 :offset-assert 2592) + (trans-camera-masks ocean-trans-mask 16 :inline :offset-assert 2848) + (trans-temp-masks ocean-trans-mask 16 :inline :offset-assert 2976) + (near-mask-indices uint16 16 :offset-assert 3104) + (mid-minx uint8 :offset-assert 3136) + (mid-maxx uint8 :offset-assert 3137) + (mid-minz uint8 :offset-assert 3138) + (mid-maxz uint8 :offset-assert 3139) + (near-minx uint8 :offset-assert 3140) + (near-maxx uint8 :offset-assert 3141) + (near-minz uint8 :offset-assert 3142) + (near-maxz uint8 :offset-assert 3143) + (temp-minx uint8 :offset-assert 3144) + (temp-maxx uint8 :offset-assert 3145) + (temp-minz uint8 :offset-assert 3146) + (temp-maxz uint8 :offset-assert 3147) + ) + :method-count-assert 9 + :size-assert #xc4c + :flag-assert #x900000c4c + ) + +;; definition for method 3 of type ocean-work +(defmethod inspect ocean-work ((obj ocean-work)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdeltas: #~%" (-> obj deltas)) + (format #t "~Tmap-min: #~%" (-> obj map-min)) + (format #t "~Tmap-max: #~%" (-> obj map-max)) + (format #t "~Tinterp: #~%" (-> obj interp)) + (format #t "~Tcorner-array[25] @ #x~X~%" (-> obj corner-array)) + (format #t "~Tcorner-count: ~D~%" (-> obj corner-count)) + (format #t "~Ttemp-vecs[4] @ #x~X~%" (-> obj temp-vecs)) + (format #t "~Tmid-mask-ptrs[36] @ #x~X~%" (-> obj mid-mask-ptrs)) + (format #t "~Tmid-camera-masks[36] @ #x~X~%" (-> obj mid-camera-masks)) + (format #t "~Ttrans-mask-ptrs[64] @ #x~X~%" (-> obj trans-mask-ptrs)) + (format #t "~Ttrans-camera-masks[16] @ #x~X~%" (-> obj trans-camera-masks)) + (format #t "~Ttrans-temp-masks[16] @ #x~X~%" (-> obj trans-temp-masks)) + (format #t "~Tnear-mask-indices[16] @ #x~X~%" (-> obj near-mask-indices)) + (format #t "~Tmid-minx: ~D~%" (-> obj mid-minx)) + (format #t "~Tmid-maxx: ~D~%" (-> obj mid-maxx)) + (format #t "~Tmid-minz: ~D~%" (-> obj mid-minz)) + (format #t "~Tmid-maxz: ~D~%" (-> obj mid-maxz)) + (format #t "~Tnear-minx: ~D~%" (-> obj near-minx)) + (format #t "~Tnear-maxx: ~D~%" (-> obj near-maxx)) + (format #t "~Tnear-minz: ~D~%" (-> obj near-minz)) + (format #t "~Tnear-maxz: ~D~%" (-> obj near-maxz)) + (format #t "~Ttemp-minx: ~D~%" (-> obj temp-minx)) + (format #t "~Ttemp-maxx: ~D~%" (-> obj temp-maxx)) + (format #t "~Ttemp-minz: ~D~%" (-> obj temp-minz)) + (format #t "~Ttemp-maxz: ~D~%" (-> obj temp-maxz)) + obj + ) + +;; definition for symbol *ocean-work*, type ocean-work +(define *ocean-work* (new 'static 'ocean-work)) + +;; definition for symbol *ocean-facing*, type int +(define *ocean-facing* 0) + +;; definition for symbol *ocean-off*, type symbol +(define *ocean-off* #f) + +;; definition for symbol *ocean-mid-off*, type symbol +(define *ocean-mid-off* #f) + +;; definition for symbol *ocean-near-off*, type symbol +(define *ocean-near-off* #f) + +;; definition for symbol *ocean-heights*, type symbol +(define *ocean-heights* #f) + +;; definition for symbol *ocean-verts*, type symbol +(define *ocean-verts* #f) + +;; definition of type ocean-vu0-work +(deftype ocean-vu0-work (structure) + ((scales vector :inline :offset-assert 0) + (mask-hi vector4w :inline :offset-assert 16) + (mask-lo vector4w :inline :offset-assert 32) + (lights vu-lights :inline :offset-assert 48) + (wait-to-vu0 uint32 :offset-assert 160) + ) + :method-count-assert 9 + :size-assert #xa4 + :flag-assert #x9000000a4 + ) + +;; definition for method 3 of type ocean-vu0-work +(defmethod inspect ocean-vu0-work ((obj ocean-vu0-work)) + (format #t "[~8x] ~A~%" obj 'ocean-vu0-work) + (format #t "~Tscales: #~%" (-> obj scales)) + (format #t "~Tmask-hi: #~%" (-> obj mask-hi)) + (format #t "~Tmask-lo: #~%" (-> obj mask-lo)) + (format #t "~Tlights: #~%" (-> obj lights)) + (format #t "~Twait-to-vu0: ~D~%" (-> obj wait-to-vu0)) + obj + ) + +;; definition of type ocean-texture-constants +(deftype ocean-texture-constants (structure) + ((giftag qword :inline :offset-assert 0) + (buffers vector4w :inline :offset-assert 16) + (dests vector4w :inline :offset-assert 32) + (start vector :inline :offset-assert 48) + (offsets vector :inline :offset-assert 64) + (constants vector :inline :offset-assert 80) + (cam-nrm vector :inline :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +;; definition for method 3 of type ocean-texture-constants +(defmethod inspect ocean-texture-constants ((obj ocean-texture-constants)) + (format #t "[~8x] ~A~%" obj 'ocean-texture-constants) + (format #t "~Tgiftag: #~%" (-> obj giftag)) + (format #t "~Tbuffers: #~%" (-> obj buffers)) + (format #t "~Tdests: #~%" (-> obj dests)) + (format #t "~Tstart: #~%" (-> obj start)) + (format #t "~Toffsets: #~%" (-> obj offsets)) + (format #t "~Tconstants: #~%" (-> obj constants)) + (format #t "~Tcam-nrm: #~%" (-> obj cam-nrm)) + obj + ) + +;; definition of type ocean-texture-work +(deftype ocean-texture-work (structure) + ((sprite-tmpl dma-gif-packet :inline :offset-assert 0) + (sprite-tmpl2 dma-gif-packet :inline :offset-assert 32) + (adgif-tmpl dma-gif-packet :inline :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x60 + :flag-assert #x900000060 + ) + +;; definition for method 3 of type ocean-texture-work +(defmethod inspect ocean-texture-work ((obj ocean-texture-work)) + (format #t "[~8x] ~A~%" obj 'ocean-texture-work) + (format #t "~Tsprite-tmpl: #~%" (-> obj sprite-tmpl)) + (format #t "~Tsprite-tmpl2: #~%" (-> obj sprite-tmpl2)) + (format #t "~Tadgif-tmpl: #~%" (-> obj adgif-tmpl)) + obj + ) + +;; definition of type ocean-mid-vertex +(deftype ocean-mid-vertex (structure) + ((stq vector :inline :offset-assert 0) + (col vector :inline :offset-assert 16) + (pos vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type ocean-mid-vertex +(defmethod inspect ocean-mid-vertex ((obj ocean-mid-vertex)) + (format #t "[~8x] ~A~%" obj 'ocean-mid-vertex) + (format #t "~Tstq: #~%" (-> obj stq)) + (format #t "~Tcol: #~%" (-> obj col)) + (format #t "~Tpos: #~%" (-> obj pos)) + obj + ) + +;; definition of type ocean-mid-constants +(deftype ocean-mid-constants (structure) + ((hmge-scale vector :inline :offset-assert 0) + (inv-hmge-scale vector :inline :offset-assert 16) + (hvdf-offset vector :inline :offset-assert 32) + (fog vector :inline :offset-assert 48) + (constants vector :inline :offset-assert 64) + (constants2 vector :inline :offset-assert 80) + (drw-fan qword :inline :offset-assert 96) + (env-fan qword :inline :offset-assert 112) + (drw-adgif qword :inline :offset-assert 128) + (drw-texture adgif-shader :inline :offset-assert 144) + (drw-strip-0 qword :inline :offset-assert 224) + (drw-strip-1 qword :inline :offset-assert 240) + (env-adgif qword :inline :offset-assert 256) + (env-texture adgif-shader :inline :offset-assert 272) + (env-strip qword :inline :offset-assert 352) + (env-color vector :inline :offset-assert 368) + (index-table uint128 8 :offset-assert 384) + (pos0 vector :inline :offset-assert 512) + (pos1 vector :inline :offset-assert 528) + (pos2 vector :inline :offset-assert 544) + (pos3 vector :inline :offset-assert 560) + ) + :method-count-assert 9 + :size-assert #x240 + :flag-assert #x900000240 + ) + +;; definition for method 3 of type ocean-mid-constants +(defmethod inspect ocean-mid-constants ((obj ocean-mid-constants)) + (format #t "[~8x] ~A~%" obj 'ocean-mid-constants) + (format #t "~Thmge-scale: #~%" (-> obj hmge-scale)) + (format #t "~Tinv-hmge-scale: #~%" (-> obj inv-hmge-scale)) + (format #t "~Thvdf-offset: #~%" (-> obj hvdf-offset)) + (format #t "~Tfog: #~%" (-> obj fog)) + (format #t "~Tconstants: #~%" (-> obj constants)) + (format #t "~Tconstants2: #~%" (-> obj constants2)) + (format #t "~Tdrw-fan: #~%" (-> obj drw-fan)) + (format #t "~Tenv-fan: #~%" (-> obj env-fan)) + (format #t "~Tdrw-adgif: #~%" (-> obj drw-adgif)) + (format #t "~Tdrw-texture: #~%" (-> obj drw-texture)) + (format #t "~Tdrw-strip-0: #~%" (-> obj drw-strip-0)) + (format #t "~Tdrw-strip-1: #~%" (-> obj drw-strip-1)) + (format #t "~Tenv-adgif: #~%" (-> obj env-adgif)) + (format #t "~Tenv-texture: #~%" (-> obj env-texture)) + (format #t "~Tenv-strip: #~%" (-> obj env-strip)) + (format #t "~Tenv-color: #~%" (-> obj env-color)) + (format #t "~Tindex-table[8] @ #x~X~%" (-> obj index-table)) + (format #t "~Tpos0: #~%" (-> obj pos0)) + (format #t "~Tpos1: #~%" (-> obj pos1)) + (format #t "~Tpos2: #~%" (-> obj pos2)) + (format #t "~Tpos3: #~%" (-> obj pos3)) + obj + ) + +;; definition of type ocean-mid-upload +(deftype ocean-mid-upload (structure) + ((rot matrix :inline :offset-assert 0) + (matrix matrix :inline :offset-assert 64) + (colors uint128 108 :offset-assert 128) + (masks uint128 2 :offset-assert 1856) + ) + :method-count-assert 9 + :size-assert #x760 + :flag-assert #x900000760 + ) + +;; definition for method 3 of type ocean-mid-upload +(defmethod inspect ocean-mid-upload ((obj ocean-mid-upload)) + (format #t "[~8x] ~A~%" obj 'ocean-mid-upload) + (format #t "~Trot: #~%" (-> obj rot)) + (format #t "~Tmatrix: #~%" (-> obj matrix)) + (format #t "~Tcolors[108] @ #x~X~%" (-> obj colors)) + (format #t "~Tmasks[2] @ #x~X~%" (-> obj masks)) + obj + ) + +;; definition of type ocean-mid-upload2 +(deftype ocean-mid-upload2 (structure) + ((rot matrix :inline :offset-assert 0) + (matrix matrix :inline :offset-assert 64) + (count vector4w :inline :offset-assert 128) + (tex0 vector :inline :offset-assert 144) + (tex1 vector :inline :offset-assert 160) + (tex2 vector :inline :offset-assert 176) + (tex3 vector :inline :offset-assert 192) + (clr0 vector :inline :offset-assert 208) + (clr1 vector :inline :offset-assert 224) + (clr2 vector :inline :offset-assert 240) + (clr3 vector :inline :offset-assert 256) + (verts uint128 18 :offset-assert 272) + ) + :method-count-assert 9 + :size-assert #x230 + :flag-assert #x900000230 + ) + +;; definition for method 3 of type ocean-mid-upload2 +(defmethod inspect ocean-mid-upload2 ((obj ocean-mid-upload2)) + (format #t "[~8x] ~A~%" obj 'ocean-mid-upload2) + (format #t "~Trot: #~%" (-> obj rot)) + (format #t "~Tmatrix: #~%" (-> obj matrix)) + (format #t "~Tcount: #~%" (-> obj count)) + (format #t "~Ttex0: #~%" (-> obj tex0)) + (format #t "~Ttex1: #~%" (-> obj tex1)) + (format #t "~Ttex2: #~%" (-> obj tex2)) + (format #t "~Ttex3: #~%" (-> obj tex3)) + (format #t "~Tclr0: #~%" (-> obj clr0)) + (format #t "~Tclr1: #~%" (-> obj clr1)) + (format #t "~Tclr2: #~%" (-> obj clr2)) + (format #t "~Tclr3: #~%" (-> obj clr3)) + (format #t "~Tverts[18] @ #x~X~%" (-> obj verts)) + obj + ) + +;; definition of type ocean-mid-work +(deftype ocean-mid-work (structure) + ((env0 vector :inline :offset-assert 0) + (env1 vector :inline :offset-assert 16) + (env2 vector :inline :offset-assert 32) + (hmg0 vector :inline :offset-assert 48) + (hmg1 vector :inline :offset-assert 64) + (hmg2 vector :inline :offset-assert 80) + (indices uint128 16 :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x160 + :flag-assert #x900000160 + ) + +;; definition for method 3 of type ocean-mid-work +(defmethod inspect ocean-mid-work ((obj ocean-mid-work)) + (format #t "[~8x] ~A~%" obj 'ocean-mid-work) + (format #t "~Tenv0: #~%" (-> obj env0)) + (format #t "~Tenv1: #~%" (-> obj env1)) + (format #t "~Tenv2: #~%" (-> obj env2)) + (format #t "~Thmg0: #~%" (-> obj hmg0)) + (format #t "~Thmg1: #~%" (-> obj hmg1)) + (format #t "~Thmg2: #~%" (-> obj hmg2)) + (format #t "~Tindices[16] @ #x~X~%" (-> obj indices)) + obj + ) + +;; definition of type ocean-near-constants +(deftype ocean-near-constants (structure) + ((hmge-scale vector :inline :offset-assert 0) + (inv-hmge-scale vector :inline :offset-assert 16) + (hvdf-offset vector :inline :offset-assert 32) + (fog vector :inline :offset-assert 48) + (constants vector :inline :offset-assert 64) + (constants2 vector :inline :offset-assert 80) + (constants3 vector :inline :offset-assert 96) + (constants4 vector :inline :offset-assert 112) + (drw-fan qword :inline :offset-assert 128) + (drw2-fan qword :inline :offset-assert 144) + (env-fan qword :inline :offset-assert 160) + (drw-adgif qword :inline :offset-assert 176) + (drw-texture adgif-shader :inline :offset-assert 192) + (drw-strip qword :inline :offset-assert 272) + (env-adgif qword :inline :offset-assert 288) + (env-texture adgif-shader :inline :offset-assert 304) + (env-strip qword :inline :offset-assert 384) + (env-color vector :inline :offset-assert 400) + (drw2-adgif qword :inline :offset-assert 416) + (drw2-tex0 qword :inline :offset-assert 432) + (drw2-frame qword :inline :offset-assert 448) + (drw2-strip qword :inline :offset-assert 464) + (drw3-adgif qword :inline :offset-assert 480) + (drw3-frame qword :inline :offset-assert 496) + (index-table uint128 4 :offset-assert 512) + ) + :method-count-assert 9 + :size-assert #x240 + :flag-assert #x900000240 + ) + +;; definition for method 3 of type ocean-near-constants +(defmethod inspect ocean-near-constants ((obj ocean-near-constants)) + (format #t "[~8x] ~A~%" obj 'ocean-near-constants) + (format #t "~Thmge-scale: #~%" (-> obj hmge-scale)) + (format #t "~Tinv-hmge-scale: #~%" (-> obj inv-hmge-scale)) + (format #t "~Thvdf-offset: #~%" (-> obj hvdf-offset)) + (format #t "~Tfog: #~%" (-> obj fog)) + (format #t "~Tconstants: #~%" (-> obj constants)) + (format #t "~Tconstants2: #~%" (-> obj constants2)) + (format #t "~Tconstants3: #~%" (-> obj constants3)) + (format #t "~Tconstants4: #~%" (-> obj constants4)) + (format #t "~Tdrw-fan: #~%" (-> obj drw-fan)) + (format #t "~Tdrw2-fan: #~%" (-> obj drw2-fan)) + (format #t "~Tenv-fan: #~%" (-> obj env-fan)) + (format #t "~Tdrw-adgif: #~%" (-> obj drw-adgif)) + (format #t "~Tdrw-texture: #~%" (-> obj drw-texture)) + (format #t "~Tdrw-strip: #~%" (-> obj drw-strip)) + (format #t "~Tenv-adgif: #~%" (-> obj env-adgif)) + (format #t "~Tenv-texture: #~%" (-> obj env-texture)) + (format #t "~Tenv-strip: #~%" (-> obj env-strip)) + (format #t "~Tenv-color: #~%" (-> obj env-color)) + (format #t "~Tdrw2-adgif: #~%" (-> obj drw2-adgif)) + (format #t "~Tdrw2-tex0: #~%" (-> obj drw2-tex0)) + (format #t "~Tdrw2-frame: #~%" (-> obj drw2-frame)) + (format #t "~Tdrw2-strip: #~%" (-> obj drw2-strip)) + (format #t "~Tdrw3-adgif: #~%" (-> obj drw3-adgif)) + (format #t "~Tdrw3-frame: #~%" (-> obj drw3-frame)) + (format #t "~Tindex-table[4] @ #x~X~%" (-> obj index-table)) + obj + ) + +;; definition of type ocean-near-upload +(deftype ocean-near-upload (structure) + ((rot matrix :inline :offset-assert 0) + (matrix matrix :inline :offset-assert 64) + (masks uint128 2 :offset-assert 128) + (start-height vector4w :inline :offset-assert 160) + (start-st vector :inline :offset-assert 176) + (near-colors ocean-near-colors :inline :offset-assert 192) + ) + :method-count-assert 9 + :size-assert #x100 + :flag-assert #x900000100 + ) + +;; definition for method 3 of type ocean-near-upload +(defmethod inspect ocean-near-upload ((obj ocean-near-upload)) + (format #t "[~8x] ~A~%" obj 'ocean-near-upload) + (format #t "~Trot: #~%" (-> obj rot)) + (format #t "~Tmatrix: #~%" (-> obj matrix)) + (format #t "~Tmasks[2] @ #x~X~%" (-> obj masks)) + (format #t "~Tstart-height: #~%" (-> obj start-height)) + (format #t "~Tstart-st: #~%" (-> obj start-st)) + (format + #t + "~Tnear-colors: #~%" + (-> obj near-colors) + ) + obj + ) + +;; definition of type ocean-near-vertex +(deftype ocean-near-vertex (structure) + ((stq vector :inline :offset-assert 0) + (clr vector :inline :offset-assert 16) + (pos vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type ocean-near-vertex +(defmethod inspect ocean-near-vertex ((obj ocean-near-vertex)) + (format #t "[~8x] ~A~%" obj 'ocean-near-vertex) + (format #t "~Tstq: #~%" (-> obj stq)) + (format #t "~Tclr: #~%" (-> obj clr)) + (format #t "~Tpos: #~%" (-> obj pos)) + obj + ) + +;; definition of type ocean-near-work +(deftype ocean-near-work (structure) + ((verts-ptr vector :inline :offset-assert 0) + (indices uint128 16 :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x110 + :flag-assert #x900000110 + ) + +;; definition for method 3 of type ocean-near-work +(defmethod inspect ocean-near-work ((obj ocean-near-work)) + (format #t "[~8x] ~A~%" obj 'ocean-near-work) + (format #t "~Tverts-ptr: #~%" (-> obj verts-ptr)) + (format #t "~Tindices[16] @ #x~X~%" (-> obj indices)) + obj + ) + +;; failed to figure out what this is: +(let ((v0-32 0)) + ) + diff --git a/test/decompiler/reference/ocean-trans-tables_REF.gc b/test/decompiler/reference/ocean-trans-tables_REF.gc new file mode 100644 index 0000000000..f6173e19bc --- /dev/null +++ b/test/decompiler/reference/ocean-trans-tables_REF.gc @@ -0,0 +1,1151 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *ocean-left-table*, type (pointer float) +(define + *ocean-left-table* + (new 'static 'array float 28 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-right-table*, type (pointer float) +(define + *ocean-right-table* + (new 'static 'array float 28 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-up-table*, type (pointer float) +(define + *ocean-up-table* + (new 'static 'array float 28 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-down-table*, type (pointer float) +(define + *ocean-down-table* + (new 'static 'array float 28 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-down-left-table*, type (pointer float) +(define + *ocean-down-left-table* + (new 'static 'array float 40 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-down-right-table*, type (pointer float) +(define + *ocean-down-right-table* + (new 'static 'array float 40 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-up-right-table*, type (pointer float) +(define + *ocean-up-right-table* + (new 'static 'array float 40 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 1.0 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-up-left-table*, type (pointer float) +(define + *ocean-up-left-table* + (new 'static 'array float 40 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-trans-left-table*, type (pointer float) +(define + *ocean-trans-left-table* + (new 'static 'array float 44 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-trans-right-table*, type (pointer float) +(define + *ocean-trans-right-table* + (new 'static 'array float 44 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-trans-up-table*, type (pointer float) +(define + *ocean-trans-up-table* + (new 'static 'array float 44 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-trans-down-table*, type (pointer float) +(define + *ocean-trans-down-table* + (new 'static 'array float 44 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-trans-down-left-table*, type (pointer float) +(define + *ocean-trans-down-left-table* + (new 'static 'array float 72 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-trans-down-right-table*, type (pointer float) +(define + *ocean-trans-down-right-table* + (new 'static 'array float 72 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-trans-up-right-table*, type (pointer float) +(define + *ocean-trans-up-right-table* + (new 'static 'array float 72 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 1.0 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-trans-up-left-table*, type (pointer float) +(define + *ocean-trans-up-left-table* + (new 'static 'array float 72 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) + ) + +;; definition for symbol *ocean-trans-corner-table*, type (pointer float) +(define + *ocean-trans-corner-table* + (new 'static 'array float 100 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5625 + 0.1875 + 0.1875 + 0.0625 + 0.375 + 0.375 + 0.125 + 0.125 + 0.1875 + 0.5625 + 0.0625 + 0.1875 + 0.0 + 0.75 + 0.0 + 0.25 + 0.5 + 0.0 + 0.5 + 0.0 + 0.375 + 0.125 + 0.375 + 0.125 + 0.25 + 0.25 + 0.25 + 0.25 + 0.125 + 0.375 + 0.125 + 0.375 + 0.0 + 0.5 + 0.0 + 0.5 + 0.25 + 0.0 + 0.75 + 0.0 + 0.1875 + 0.0625 + 0.5625 + 0.1875 + 0.125 + 0.125 + 0.375 + 0.375 + 0.0625 + 0.1875 + 0.1875 + 0.5625 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-trans-strip-array*, type (pointer float) +(define + *ocean-trans-strip-array* + (new 'static 'array float 160 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5625 + 0.1875 + 0.1875 + 0.0625 + 0.5 + 0.5 + 0.0 + 0.0 + 0.375 + 0.375 + 0.125 + 0.125 + 0.25 + 0.75 + 0.0 + 0.0 + 0.1875 + 0.5625 + 0.0625 + 0.1875 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5625 + 0.1875 + 0.1875 + 0.0625 + 0.375 + 0.125 + 0.375 + 0.125 + 0.375 + 0.375 + 0.125 + 0.125 + 0.25 + 0.25 + 0.25 + 0.25 + 0.1875 + 0.5625 + 0.0625 + 0.1875 + 0.125 + 0.375 + 0.125 + 0.375 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.375 + 0.125 + 0.375 + 0.125 + 0.1875 + 0.0625 + 0.5625 + 0.1875 + 0.25 + 0.25 + 0.25 + 0.25 + 0.125 + 0.125 + 0.375 + 0.375 + 0.125 + 0.375 + 0.125 + 0.375 + 0.0625 + 0.1875 + 0.1875 + 0.5625 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.1875 + 0.0625 + 0.5625 + 0.1875 + 0.0 + 0.0 + 0.75 + 0.25 + 0.125 + 0.125 + 0.375 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0625 + 0.1875 + 0.1875 + 0.5625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) + +;; definition for symbol *ocean-trans-st-table*, type (pointer float) +(define + *ocean-trans-st-table* + (new 'static 'array float 16 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 1.0 + 0.0 + 1.0 + 1.0 + 1.0 + 0.0 + ) + ) + + + + diff --git a/test/decompiler/reference/sky-h_REF.gc b/test/decompiler/reference/sky-h_REF.gc index 4b6809c239..fc8f1e3d76 100644 --- a/test/decompiler/reference/sky-h_REF.gc +++ b/test/decompiler/reference/sky-h_REF.gc @@ -212,10 +212,7 @@ (define *sky-parms* (new 'global 'sky-parms)) ;; definition for symbol *sky-upload-data*, type sky-upload-data -(define - *sky-upload-data* - (the-as sky-upload-data (new 'global 'sky-upload-data)) - ) +(define *sky-upload-data* (new 'global 'sky-upload-data)) ;; failed to figure out what this is: (dotimes (gp-0 17) diff --git a/test/decompiler/reference/texture-h_REF.gc b/test/decompiler/reference/texture-h_REF.gc index 456125851d..63d9fd7164 100644 --- a/test/decompiler/reference/texture-h_REF.gc +++ b/test/decompiler/reference/texture-h_REF.gc @@ -302,10 +302,7 @@ ) ;; definition for symbol *texture-relocate-later*, type texture-relocate-later -(define - *texture-relocate-later* - (the-as texture-relocate-later (new 'global 'texture-relocate-later)) - ) +(define *texture-relocate-later* (new 'global 'texture-relocate-later)) ;; failed to figure out what this is: (set! (-> *texture-relocate-later* memcpy) #f) diff --git a/test/decompiler/reference/timer-h_REF.gc b/test/decompiler/reference/timer-h_REF.gc index 9e22285e9e..eaf1041b73 100644 --- a/test/decompiler/reference/timer-h_REF.gc +++ b/test/decompiler/reference/timer-h_REF.gc @@ -89,7 +89,10 @@ ) ;; failed to figure out what this is: -(timer-init (the-as timer-bank #x10000800) (the-as timer-mode 130)) +(timer-init + (the-as timer-bank #x10000800) + (new 'static 'timer-mode :clks (timer-clock-selection busclk/256) :cue #x1) + ) ;; definition of type profile-frame (deftype profile-frame (structure) diff --git a/test/decompiler/test_FormBeforeExpressions.cpp b/test/decompiler/test_FormBeforeExpressions.cpp index 084df07407..334b81fadf 100644 --- a/test/decompiler/test_FormBeforeExpressions.cpp +++ b/test/decompiler/test_FormBeforeExpressions.cpp @@ -784,9 +784,9 @@ TEST_F(FormRegressionTest, NewMethod) { "(begin (when\n" " (begin\n" " (set! v1-0 object)\n" - " (set! t9-0 (-> v1-0 methods-by-name new))\n" // object new - " (set! v1-1 a1-0)\n" // ? - " (set! a2-1 (-> a1-0 size))\n" // math + " (set! t9-0 (method-of-type v1-0 new))\n" // object new + " (set! v1-1 a1-0)\n" // ? + " (set! a2-1 (-> a1-0 size))\n" // math " (set! a1-1 (-> a1-0 heap-base))\n" " (set! a1-2 (*.ui a2-0 a1-1))\n" " (set! a2-2 (+ a2-1 a1-2))\n" @@ -875,7 +875,7 @@ TEST_F(FormRegressionTest, TypeOf) { std::string expected = "(begin\n" " (set! v1-1 (rtype-of a0-0))\n" - " (set! t9-0 (-> v1-1 methods-by-name print))\n" // print method. + " (set! t9-0 (method-of-type v1-1 print))\n" // print method. " (set! v0-0 (call! a0-0))\n" " (ret-value v0-0)\n" " )"; diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index 9761312449..a3687785ac 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -19,13 +19,11 @@ const std::unordered_set g_object_files_to_decompile = { "gsound-h", "timer-h", "timer", "vif-h", "dma-h", "video-h", "vu1-user-h", "dma", "dma-buffer", "dma-bucket", "dma-disasm", "pad", "gs", "display-h", "vector", "file-io", "loader-h", "texture-h", "level-h", "math-camera-h", /* math-camera, */ "font-h", "decomp-h", "display", - "connect", "text-h", "settings-h", "capture", "memory-usage-h", - /* gap */ - "mspace-h", "drawable-h", "drawable-group-h", - /* gap */ - "lights-h", - /* gap */ - "sky-h", "mood-h", /* "time-of-day-h", */ + "connect", "text-h", "settings-h", "capture", "memory-usage-h", /* "texture", */ "main-h", + "mspace-h", "drawable-h", "drawable-group-h", "drawable-inline-array-h", "draw-node-h", + "drawable-tree-h", "drawable-actor-h", "drawable-ambient-h", "game-task-h", "hint-control-h", + "generic-h", "lights-h", "ocean-h", "ocean-trans-tables", /* "ocean-tables", "ocean-frames", */ + "sky-h", "mood-h", /* "time-of-day-h", */ /* gap */ "bounding-box", /* gap */ @@ -33,22 +31,20 @@ const std::unordered_set g_object_files_to_decompile = { // the object files to check against a reference in test/decompiler/reference const std::vector g_object_files_to_check_against_reference = { - "gcommon", // NOTE: this file needs work, but adding it for now just to test the framework. - "gstring-h", "gkernel-h", "gkernel", "gstring", "dgo-h", "gstate", "types-h", "vu1-macros", - "math", "vector-h", "bounding-box-h", "matrix-h", "quaternion-h", "euler-h", "transform-h", - "geometry-h", "trigonometry-h", - /* transformq-h, */ - "matrix", "transform", "quaternion", "euler", /* geometry, trigonometry */ + "gcommon", "gstring-h", "gkernel-h", "gkernel", + /*"pskernel",*/ "gstring", "dgo-h", "gstate", "types-h", "vu1-macros", "math", "vector-h", + "bounding-box-h", "matrix-h", "quaternion-h", "euler-h", "transform-h", "geometry-h", + "trigonometry-h", /* transformq-h, */ "matrix", "transform", "quaternion", + "euler", /* geometry, trigonometry */ "gsound-h", "timer-h", /* timer, */ "vif-h", "dma-h", "video-h", "vu1-user-h", "dma", "dma-buffer", "dma-bucket", "dma-disasm", "pad", "gs", "display-h", "vector", "file-io", "loader-h", "texture-h", "level-h", "math-camera-h", /* math-camera, */ "font-h", "decomp-h", "display", "connect", "text-h", "settings-h", "capture", "memory-usage-h", - /* gap */ - "mspace-h", "drawable-h", "drawable-group-h", - /* gap */ - "lights-h", - /* gap */ - "sky-h", "mood-h", /* "time-of-day-h", */ + /* "texture", */ "main-h", "mspace-h", "drawable-h", "drawable-group-h", + "drawable-inline-array-h", "draw-node-h", "drawable-tree-h", "drawable-actor-h", + "drawable-ambient-h", "game-task-h", "hint-control-h", "generic-h", "lights-h", "ocean-h", + "ocean-trans-tables", /* "ocean-tables", "ocean-frames", */ + "sky-h", "mood-h", /* "time-of-day-h", */ /* gap */ "bounding-box", /* gap */ "sync-info-h", "sync-info"}; @@ -155,9 +151,6 @@ const std::unordered_set skip_in_compiling = { // bad decisions on float vs int128 "vector-degf", "vector-degmod", "vector-deg-diff", "vector-degi", - // connect - "(method 9 engine)", // methods-by-name stuff. - // capture "(method 3 gs-store-image-packet)", // print giftag weirdness @@ -170,6 +163,8 @@ const std::unordered_set skip_in_compiling = { // default location for the data. It can be changed with a command line argument. std::string g_iso_data_path = ""; +bool g_dump_mode = false; + } // namespace int main(int argc, char** argv) { lg::initialize(); @@ -178,6 +173,10 @@ int main(int argc, char** argv) { bool got_arg = false; for (int i = 1; i < argc; i++) { auto arg = std::string(argv[i]); + if (arg == "--dump-mode") { + g_dump_mode = true; + continue; + } if (arg.length() > 2 && arg[0] == '-' && arg[1] == '-') { continue; } @@ -445,7 +444,15 @@ TEST_F(OfflineDecompilation, Reference) { strip_trailing_newlines(reference); strip_trailing_newlines(src); - EXPECT_EQ(reference, src); + if (g_dump_mode) { + if (reference != src) { + fmt::print("----------------- {}\n", file); + fmt::print("{}\n", src); + EXPECT_TRUE(false); + } + } else { + EXPECT_EQ(reference, src); + } } }