diff --git a/common/type_system/Type.h b/common/type_system/Type.h index 277b0f3e31..544e1e7b9b 100644 --- a/common/type_system/Type.h +++ b/common/type_system/Type.h @@ -222,6 +222,9 @@ class Field { return m_array_size; } + double field_score() const { return m_field_score; } + void set_field_score(double value) { m_field_score = value; } + private: friend class TypeSystem; void set_alignment(int alignment) { m_alignment = alignment; } @@ -239,6 +242,8 @@ class Field { int m_alignment = -1; bool m_skip_in_static_decomp = false; bool m_placed_by_user = false; // was this field placed manually by the user? + + double m_field_score = 0.; }; class StructureType : public ReferenceType { diff --git a/common/type_system/TypeFieldLookup.cpp b/common/type_system/TypeFieldLookup.cpp index 2ffff91d3c..f1bf59bba3 100644 --- a/common/type_system/TypeFieldLookup.cpp +++ b/common/type_system/TypeFieldLookup.cpp @@ -3,6 +3,7 @@ * Reverse field lookup used in the decompiler. */ +#include #include "third-party/fmt/core.h" #include "TypeSystem.h" @@ -31,6 +32,24 @@ bool deref_matches(const DerefInfo& expected, } } // namespace +/*! + * Convert the linked list to a vector of tokens. + */ +std::vector ReverseLookupNode::to_vector() const { + std::vector nodes_reversed = {}; + std::vector result; + const ReverseLookupNode* node = this; + while (node) { + nodes_reversed.push_back(node); + node = node->prev; + } + + for (auto it = nodes_reversed.rbegin(); it != nodes_reversed.rend(); it++) { + result.push_back((*it)->token); + } + return result; +} + /*! * Convert a Token in a field path to a string for debugging. */ @@ -48,227 +67,140 @@ std::string FieldReverseLookupOutput::Token::print() const { } } -/*! - * Main reverse lookup. Check the success field of the result to see if it was successful. - * Will return the type of result as well as the path taken to get there. - * The path can be arbitrarily long because we could be looking through nested inline structures. - * The result is _always_ an actual dereference and there is no way for this to return "no deref". - * The "offset" should always be the actual memory offset in the load instruction. - * This is the "offset into memory" - "boxed offset" - */ -FieldReverseLookupOutput TypeSystem::reverse_field_lookup( - const FieldReverseLookupInput& input) const { - if (debug_reverse_lookup) { - fmt::print("reverse_field_lookup on {} offset {} deref {} stride {}\n", input.base_type.print(), - input.offset, input.deref.has_value(), input.stride); - } - FieldReverseLookupOutput result; - result.success = try_reverse_lookup(input, &result.tokens, &result.addr_of, &result.result_type); - // todo check for only one var lookup. - return result; -} +namespace { + +void try_reverse_lookup(const FieldReverseLookupInput& input, + const TypeSystem& ts, + const ReverseLookupNode* parent, + FieldReverseMultiLookupOutput* output, + int max_count); + +void try_reverse_lookup_other(const FieldReverseLookupInput& input, + const TypeSystem& ts, + const ReverseLookupNode* parent, + FieldReverseMultiLookupOutput* output, + int max_count); /*! - * Reverse lookup helper. Returns true if successful. It's okay to call this an have it fail. - * Will set path/addr_of/result_type if successful. - */ -bool TypeSystem::try_reverse_lookup(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const { - if (debug_reverse_lookup) { - fmt::print(" try_reverse_lookup on {} offset {} deref {} stride {}\n", input.base_type.print(), - input.offset, input.deref.has_value(), input.stride); - } - - auto base_input_type = input.base_type.base_type(); - if (base_input_type == "pointer") { - return try_reverse_lookup_pointer(input, path, addr_of, result_type); - } else if (base_input_type == "inline-array") { - return try_reverse_lookup_inline_array(input, path, addr_of, result_type); - } else if (base_input_type == "array" && input.base_type.has_single_arg()) { - return try_reverse_lookup_array(input, path, addr_of, result_type); - } else { - return try_reverse_lookup_other(input, path, addr_of, result_type); - } - return false; -} - -/*! - * Handle a dereference of a pointer. This can be: + * Handle a dereference of a pointer/boxed array. This can be: * - just dereferencing a pointer * - accessing a variable element of a pointer-style array * - getting the address of a variable element of a pointer-style array * - accessing a constant element of a pointer-style array * - getting the address of a constant element of a pointer-style array */ -bool TypeSystem::try_reverse_lookup_pointer(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const { - if (!input.base_type.has_single_arg()) { - return false; +void try_reverse_lookup_array_like(const FieldReverseLookupInput& input, + const TypeSystem& ts, + const ReverseLookupNode* parent, + FieldReverseMultiLookupOutput* output, + int max_count, + bool boxed_array) { + if ((int)output->results.size() >= max_count) { + return; } - auto di = get_deref_info(input.base_type); - bool is_integer = tc(TypeSpec("integer"), input.base_type.get_single_arg()); - bool is_basic = tc(TypeSpec("basic"), input.base_type.get_single_arg()); + + if (!input.base_type.has_single_arg()) { + // not a typed pointer. + return; + } + + if (boxed_array && input.offset < ARRAY_DATA_OFFSET) { + // we are accessing a field in an array so we can treat this like any other structure. + // this will add the basic offset, so we can pass in the input unchanged. + try_reverse_lookup_other(input, ts, parent, output, max_count); + return; + } + + auto array_data_type = + boxed_array ? ts.make_pointer_typespec(input.base_type.get_single_arg()) : input.base_type; + auto di = ts.get_deref_info(array_data_type); + bool is_integer = ts.tc(TypeSpec("integer"), input.base_type.get_single_arg()); + bool is_basic = ts.tc(TypeSpec("basic"), input.base_type.get_single_arg()); assert(di.mem_deref); // it's accessing a pointer. auto elt_type = di.result_type; + if (input.stride) { // variable access to the array. + // this is an array of values, nothing inline, so we must get an _exact_ match for this to work. if (input.stride != di.stride) { // mismatched array strides, fail! - return false; - } - if (input.offset != 0) { - // can't access within an element of a pointer array. - // todo - this could be some sort of constant folding for the next operation. - return false; + return; } - FieldReverseLookupOutput::Token token; - token.kind = FieldReverseLookupOutput::Token::Kind::VAR_IDX; - path->push_back(token); + if (input.offset != (boxed_array ? ARRAY_DATA_OFFSET : 0)) { + // can't access within an element of a pointer array. + // todo - this could be some sort of constant folding for the next operation. + // for example, something like (&+ (&-> array-of-uint32s 3) 1) + return; + } + + // add this to our path. + ReverseLookupNode variable_node; + variable_node.prev = parent; + variable_node.token.kind = FieldReverseLookupOutput::Token::Kind::VAR_IDX; + if (input.deref.has_value()) { + // input did a load or store, we need to check the size/signed/kind. if (deref_matches(di, input.deref.value(), is_integer, is_basic)) { // access element of array - *addr_of = false; - *result_type = elt_type; - return true; + // success! + output->results.emplace_back(false, elt_type, variable_node.to_vector()); + // no other way to access an array with the given type. + return; } else { - // this isn't the right type of dereference. - return false; + // this isn't the right type of dereference, no way to make this work. + return; } } else { // get the address of a variable indexed element of a pointer-style array - *addr_of = true; - *result_type = make_pointer_typespec(elt_type); - return true; + output->results.emplace_back(true, ts.make_pointer_typespec(elt_type), + variable_node.to_vector()); + return; } } else { // either access array or just plain deref a pointer. - int elt_idx = input.offset / di.stride; - int offset_into_elt = input.offset - (elt_idx * di.stride); + int offset = input.offset - (boxed_array ? ARRAY_DATA_OFFSET : 0); + int elt_idx = offset / di.stride; + int offset_into_elt = offset - (elt_idx * di.stride); if (offset_into_elt) { - // should line up correctly. - return false; + // shouldn't have a weird offset. + return; } - FieldReverseLookupOutput::Token token; - token.kind = FieldReverseLookupOutput::Token::Kind::CONSTANT_IDX; - token.idx = elt_idx; + ReverseLookupNode constant_node; + constant_node.prev = parent; + constant_node.token.kind = FieldReverseLookupOutput::Token::Kind::CONSTANT_IDX; + constant_node.token.idx = elt_idx; if (input.deref.has_value()) { if (!deref_matches(di, input.deref.value(), is_integer, is_basic)) { // this isn't the right type of dereference - return false; + return; } // always push back an index so we're never ambiguous. - path->push_back(token); - - // access constant idx element of array - *addr_of = false; - *result_type = elt_type; - return true; + output->results.emplace_back(false, elt_type, constant_node.to_vector()); + return; } else { // we want (&-> arr 0) - path->push_back(token); - // get address of constant idx element of array - *addr_of = true; - *result_type = make_pointer_typespec(elt_type); - return true; - } - } -} + output->results.emplace_back(true, ts.make_pointer_typespec(elt_type), + constant_node.to_vector()); -/*! - * Handle a dereference with an "array" type. - * This has two cases: - * - accessing a field of the array class, not including the array data. Like any other structure. - * - accessing the data array part of the array class, very similar to the pointer-style array. - */ -bool TypeSystem::try_reverse_lookup_array(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const { - // type should be (array elt-type) - if (!input.base_type.has_single_arg()) { - return false; - } - - if (input.offset < ARRAY_DATA_OFFSET) { - // we are accessing a field in an array so we can treat this like any other structure. - // this will add the basic offset, so we can pass in the input unchanged. - return try_reverse_lookup_other(input, path, addr_of, result_type); - } - - // this is the data type - (pointer elt-type). this is stored at an offset of ARRAY_DATA_OFFSET. - auto array_data_type = make_pointer_typespec(input.base_type.get_single_arg()); - auto di = get_deref_info(array_data_type); - bool is_integer = tc(TypeSpec("integer"), input.base_type.get_single_arg()); - bool is_basic = tc(TypeSpec("basic"), input.base_type.get_single_arg()); - assert(di.mem_deref); // it's accessing a pointer. - auto elt_type = di.result_type; - if (input.stride) { - if (input.offset != ARRAY_DATA_OFFSET) { - // might be constant propagated other offsets here? - return false; - } - - // variable access to the array. - if (input.stride != di.stride) { - // mismatched array strides, fail! - return false; - } - - FieldReverseLookupOutput::Token token; - token.kind = FieldReverseLookupOutput::Token::Kind::VAR_IDX; - path->push_back(token); - if (input.deref.has_value()) { - if (deref_matches(di, input.deref.value(), is_integer, is_basic)) { - // access element of array - *addr_of = false; - *result_type = elt_type; - return true; - } else { - // this isn't the right type of dereference. - return false; - } - } else { - // get the address of a variable indexed element of a pointer-style array - *addr_of = true; - *result_type = make_pointer_typespec(elt_type); - return true; - } - } else { - // either access array or just plain deref a pointer. - int elt_idx = (input.offset - ARRAY_DATA_OFFSET) / di.stride; - int offset_into_elt = (input.offset - ARRAY_DATA_OFFSET) - (elt_idx * di.stride); - if (offset_into_elt) { - // should line up correctly. - return false; - } - - FieldReverseLookupOutput::Token token; - token.kind = FieldReverseLookupOutput::Token::Kind::CONSTANT_IDX; - token.idx = elt_idx; - // always put array index, even if it's zero. - path->push_back(token); - if (input.deref.has_value()) { - if (!deref_matches(di, input.deref.value(), is_integer, is_basic)) { - // this isn't the right type of dereference - return false; + // also just return the array + if (elt_idx == 0) { + if (boxed_array) { + auto vec = parent->to_vector(); + FieldReverseLookupOutput::Token tok; + tok.kind = FieldReverseLookupOutput::Token::Kind::FIELD; + tok.field_score = 0.0; // don't bother + tok.name = "data"; + vec.push_back(tok); + output->results.emplace_back(false, array_data_type, vec); + } else { + output->results.emplace_back(false, input.base_type, parent->to_vector()); + } } - // access constant idx element of array - *addr_of = false; - *result_type = elt_type; - return true; - } else { - // get address of constant idx element of array - *addr_of = true; - *result_type = make_pointer_typespec(elt_type); - return true; + return; } } } @@ -281,24 +213,33 @@ bool TypeSystem::try_reverse_lookup_array(const FieldReverseLookupInput& input, * - get a constant idx reference object (we pick this over just getting the array for idx = 0) * - get something inside a constant idx reference object */ -bool TypeSystem::try_reverse_lookup_inline_array(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const { - auto di = get_deref_info(input.base_type); +void try_reverse_lookup_inline_array(const FieldReverseLookupInput& input, + const TypeSystem& ts, + const ReverseLookupNode* parent, + FieldReverseMultiLookupOutput* output, + int max_count) { + if ((int)output->results.size() >= max_count) { + return; + } + auto di = ts.get_deref_info(input.base_type); assert(di.can_deref); - assert(!di.mem_deref); // if we make integer arrays allowed to be inline-array, this will break. + assert(!di.mem_deref); if (input.stride && input.stride == di.stride && input.offset < di.stride) { // variable lookup. - FieldReverseLookupOutput::Token token; - token.kind = FieldReverseLookupOutput::Token::Kind::VAR_IDX; - path->push_back(token); + ReverseLookupNode var_idx_node; + var_idx_node.prev = parent; + + var_idx_node.token.kind = FieldReverseLookupOutput::Token::Kind::VAR_IDX; if (input.offset == 0 && !input.deref.has_value()) { - *addr_of = false; - *result_type = di.result_type; - return true; + // put the element first, to match the old behavior. + output->results.emplace_back(false, di.result_type, var_idx_node.to_vector()); + // keep trying! + } + + if ((int)output->results.size() >= max_count) { + return; } FieldReverseLookupInput next_input; @@ -306,7 +247,8 @@ bool TypeSystem::try_reverse_lookup_inline_array(const FieldReverseLookupInput& next_input.stride = 0; next_input.offset = input.offset; next_input.base_type = di.result_type; - return try_reverse_lookup(next_input, path, addr_of, result_type); + try_reverse_lookup(next_input, ts, &var_idx_node, output, max_count); + return; } // constant lookup, or accessing within the first one @@ -315,24 +257,33 @@ bool TypeSystem::try_reverse_lookup_inline_array(const FieldReverseLookupInput& // how many bytes into the element we look int offset_into_elt = input.offset - (elt_idx * di.stride); // the expected number of bytes into the element we would look to grab a ref to the elt. - int expected_offset_into_elt = lookup_type(di.result_type)->get_offset(); + int expected_offset_into_elt = ts.lookup_type(di.result_type)->get_offset(); - FieldReverseLookupOutput::Token token; - token.kind = FieldReverseLookupOutput::Token::Kind::CONSTANT_IDX; - token.idx = elt_idx; + ReverseLookupNode const_idx_node; + const_idx_node.prev = parent; + const_idx_node.token.kind = FieldReverseLookupOutput::Token::Kind::CONSTANT_IDX; + const_idx_node.token.idx = elt_idx; if (offset_into_elt == expected_offset_into_elt && !input.deref.has_value()) { // just get an element (possibly zero, and we want to include the 0 if so) // for the degenerate inline-array case, it seems more likely that we get the zeroth object - // rather than the array? Either way, this code should be compatible with both approaches. - path->push_back(token); - *addr_of = false; - *result_type = di.result_type; - return true; + // rather than the array, so this goes before that case. + output->results.emplace_back(false, di.result_type, const_idx_node.to_vector()); + if ((int)output->results.size() >= max_count) { + return; + } + // keep trying more stuff. + } + + // can we just return the array? + if (expected_offset_into_elt == offset_into_elt && !input.deref.has_value() && elt_idx == 0) { + output->results.emplace_back(false, input.base_type, parent->to_vector()); + if ((int)output->results.size() >= max_count) { + return; + } } // otherwise access within the element - path->push_back(token); FieldReverseLookupInput next_input; next_input.deref = input.deref; @@ -340,7 +291,7 @@ bool TypeSystem::try_reverse_lookup_inline_array(const FieldReverseLookupInput& // try_reverse_lookup expects "offset_into_field - boxed_offset" next_input.offset = offset_into_elt - expected_offset_into_elt; next_input.base_type = di.result_type; - return try_reverse_lookup(next_input, path, addr_of, result_type); + try_reverse_lookup(next_input, ts, &const_idx_node, output, max_count); } /*! @@ -348,24 +299,30 @@ bool TypeSystem::try_reverse_lookup_inline_array(const FieldReverseLookupInput& * - Access a field which requires mem deref. * - Get address of a field which requires mem deref. */ -bool TypeSystem::try_reverse_lookup_other(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const { - auto type_info = lookup_type(input.base_type); +void try_reverse_lookup_other(const FieldReverseLookupInput& input, + const TypeSystem& ts, + const ReverseLookupNode* parent, + FieldReverseMultiLookupOutput* output, + int max_count) { + auto type_info = ts.lookup_type(input.base_type); auto structure_type = dynamic_cast(type_info); if (!structure_type) { - return false; + return; } auto corrected_offset = input.offset + type_info->get_offset(); // loop over fields. We may need to try multiple fields. for (auto& field : structure_type->fields()) { + // todo, remove this and replace with score. if (field.skip_in_decomp()) { continue; } - auto field_deref = lookup_field_info(type_info->get_name(), field.name()); + if ((int)output->results.size() >= max_count) { + return; + } + + auto field_deref = ts.lookup_field_info(type_info->get_name(), field.name()); // how many bytes do we look at? In the case where we're just getting an address, we assume // one byte, so we'll always pass the size check. @@ -375,7 +332,7 @@ bool TypeSystem::try_reverse_lookup_other(const FieldReverseLookupInput& input, } if (corrected_offset >= field.offset() && - (corrected_offset + effective_load_size <= field.offset() + get_size_in_type(field) || + (corrected_offset + effective_load_size <= field.offset() + ts.get_size_in_type(field) || field.is_dynamic())) { // the field size looks okay. int offset_into_field = corrected_offset - field.offset(); @@ -383,6 +340,7 @@ bool TypeSystem::try_reverse_lookup_other(const FieldReverseLookupInput& input, FieldReverseLookupOutput::Token token; token.kind = FieldReverseLookupOutput::Token::Kind::FIELD; token.name = field.name(); + token.field_score = field.field_score(); if (field_deref.needs_deref) { if (offset_into_field == 0) { @@ -390,10 +348,10 @@ bool TypeSystem::try_reverse_lookup_other(const FieldReverseLookupInput& input, // needs deref, offset is 0, did a deref. // Check the deref is right... // (pointer ) - TypeSpec loc_type = make_pointer_typespec(field_deref.type); - auto di = get_deref_info(loc_type); - bool is_integer = tc(TypeSpec("integer"), field_deref.type); - bool is_basic = tc(TypeSpec("basic"), field_deref.type); + TypeSpec loc_type = ts.make_pointer_typespec(field_deref.type); + auto di = ts.get_deref_info(loc_type); + bool is_integer = ts.tc(TypeSpec("integer"), field_deref.type); + bool is_basic = ts.tc(TypeSpec("basic"), field_deref.type); if (!deref_matches(di, input.deref.value(), is_integer, is_basic)) { continue; // try another field! } @@ -401,20 +359,23 @@ bool TypeSystem::try_reverse_lookup_other(const FieldReverseLookupInput& input, if (input.stride) { continue; } - path->push_back(token); - *addr_of = false; - *result_type = field_deref.type; - return true; + ReverseLookupNode node; + node.prev = parent; + node.token = token; + output->results.emplace_back(false, field_deref.type, node.to_vector()); + continue; // try more! } else { // needs a deref, offset is 0, didn't do a deref. // we're taking the address if (input.stride) { continue; } - path->push_back(token); - *addr_of = true; - *result_type = make_pointer_typespec(field_deref.type); - return true; + ReverseLookupNode node; + node.prev = parent; + node.token = token; + output->results.emplace_back(true, ts.make_pointer_typespec(field_deref.type), + node.to_vector()); + continue; // try more! } } else { if (input.deref.has_value()) { @@ -431,32 +392,121 @@ bool TypeSystem::try_reverse_lookup_other(const FieldReverseLookupInput& input, // no deref needed int expected_offset_into_field = 0; if (field.is_inline()) { - expected_offset_into_field = lookup_type(field.type())->get_offset(); + expected_offset_into_field = ts.lookup_type(field.type())->get_offset(); } if (offset_into_field == expected_offset_into_field && !input.deref.has_value() && !input.stride) { - // get the inline field exactly - path->push_back(token); - *result_type = field_deref.type; - *addr_of = false; - return true; + ReverseLookupNode node; + node.prev = parent; + node.token = token; + output->results.emplace_back(false, field_deref.type, node.to_vector()); + continue; // try more! } else { FieldReverseLookupInput next_input; next_input.deref = input.deref; next_input.offset = offset_into_field - expected_offset_into_field; next_input.stride = input.stride; next_input.base_type = field_deref.type; - auto old_path = *path; - path->push_back(token); - if (try_reverse_lookup(next_input, path, addr_of, result_type)) { - return true; - } else { - *path = old_path; - continue; - } + ReverseLookupNode node; + node.prev = parent; + node.token = token; + try_reverse_lookup(next_input, ts, &node, output, max_count); } } } } - return false; +} + +/*! + * Reverse lookup helper. Returns true if successful. It's okay to call this an have it fail. + * Will set path/addr_of/result_type if successful. + */ +void try_reverse_lookup(const FieldReverseLookupInput& input, + const TypeSystem& ts, + const ReverseLookupNode* parent, + FieldReverseMultiLookupOutput* output, + int max_count) { + if (debug_reverse_lookup) { + fmt::print(" try_reverse_lookup on {} offset {} deref {} stride {}\n", input.base_type.print(), + input.offset, input.deref.has_value(), input.stride); + } + + auto base_input_type = input.base_type.base_type(); + if (base_input_type == "pointer") { + try_reverse_lookup_array_like(input, ts, parent, output, max_count, false); + } else if (base_input_type == "inline-array") { + return try_reverse_lookup_inline_array(input, ts, parent, output, max_count); + } else if (base_input_type == "array" && input.base_type.has_single_arg()) { + try_reverse_lookup_array_like(input, ts, parent, output, max_count, true); + } else { + return try_reverse_lookup_other(input, ts, parent, output, max_count); + } +} +} // namespace + +/*! + * Old single reverse lookup. Check the success field of the result to see if it was successful. + * Will return the type of result as well as the path taken to get there. + * The path can be arbitrarily long because we could be looking through nested inline structures. + * The result is _always_ an actual dereference and there is no way for this to return "no deref". + * The "offset" should always be the actual memory offset in the load instruction. + * This is the "offset into memory" - "boxed offset" + */ +FieldReverseLookupOutput TypeSystem::reverse_field_lookup( + const FieldReverseLookupInput& input) const { + // just use the multi-lookup set to 1 and grab the first result. + auto multi_result = reverse_field_multi_lookup(input, 100); + + for (auto& result : multi_result.results) { + // compute the score. + result.total_score = 0; + for (auto& tok : result.tokens) { + result.total_score += tok.score(); + } + } + + // use stable sort to make sure we break ties by being first in the order. + std::stable_sort(multi_result.results.begin(), multi_result.results.end(), + [](const FieldReverseLookupOutput& a, const FieldReverseLookupOutput& b) { + return a.total_score > b.total_score; + }); + + /* + if (multi_result.results.size() > 1) { + fmt::print("Multiple:\n"); + for (auto& result : multi_result.results) { + fmt::print(" [{}] [{}] ", result.total_score, result.result_type.print()); + for (auto& tok : result.tokens) { + fmt::print("{} ", tok.print()); + } + fmt::print("\n"); + } + fmt::print("\n\n\n"); + } + */ + + FieldReverseLookupOutput result; + if (multi_result.success) { + result = multi_result.results.at(0); + result.success = true; + } else { + result.success = false; + } + return result; +} + +FieldReverseMultiLookupOutput TypeSystem::reverse_field_multi_lookup( + const FieldReverseLookupInput& input, + int max_count) const { + if (debug_reverse_lookup) { + fmt::print("reverse_field_lookup on {} offset {} deref {} stride {}\n", input.base_type.print(), + input.offset, input.deref.has_value(), input.stride); + } + + FieldReverseMultiLookupOutput result; + try_reverse_lookup(input, *this, nullptr, &result, max_count); + if (!result.results.empty()) { + result.success = true; + } + return result; } diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index 494b358bf2..b88f8645eb 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -767,7 +767,8 @@ int TypeSystem::add_field_to_type(StructureType* type, bool is_dynamic, int array_size, int offset_override, - bool skip_in_static_decomp) { + bool skip_in_static_decomp, + double score) { if (type->lookup_field(field_name, nullptr)) { throw_typesystem_error("Type {} already has a field named {}\n", type->get_name(), field_name); } @@ -807,6 +808,7 @@ int TypeSystem::add_field_to_type(StructureType* type, if (skip_in_static_decomp) { field.set_skip_in_static_decomp(); } + field.set_field_score(score); int after_field = offset + get_size_in_type(field); if (type->get_size_in_memory() < after_field) { diff --git a/common/type_system/TypeSystem.h b/common/type_system/TypeSystem.h index da521b9ccf..641cfa694a 100644 --- a/common/type_system/TypeSystem.h +++ b/common/type_system/TypeSystem.h @@ -71,21 +71,53 @@ struct FieldReverseLookupInput { TypeSpec base_type; // the type of the thing we're accessing }; +constexpr double CONSTANT_INDEX_SCORE = -10.0; + struct FieldReverseLookupOutput { struct Token { enum class Kind { FIELD, CONSTANT_IDX, VAR_IDX } kind; std::string name; - int idx; + int idx = -1; + double field_score = 0.0; + + double score() { + switch (kind) { + case Kind::FIELD: + return field_score; + case Kind::CONSTANT_IDX: + return CONSTANT_INDEX_SCORE; + case Kind::VAR_IDX: // this is unavoidable, so don't bother with a score. + default: + return 0.; + } + } std::string print() const; }; + FieldReverseLookupOutput() = default; + FieldReverseLookupOutput(bool addr, TypeSpec type, std::vector tok) + : success(true), addr_of(addr), result_type(std::move(type)), tokens(std::move(tok)) {} + bool success = false; bool addr_of = false; // do we take the address of this result? + double total_score = 0.; TypeSpec result_type; std::vector tokens; }; +struct FieldReverseMultiLookupOutput { + std::vector results; + bool success = false; +}; + +struct ReverseLookupNode { + const ReverseLookupNode* prev = nullptr; + FieldReverseLookupOutput::Token token; + + std::vector to_vector() const; +}; + class TypeSystem { public: TypeSystem(); @@ -97,6 +129,8 @@ class TypeSystem { DerefInfo get_deref_info(const TypeSpec& ts) const; FieldReverseLookupOutput reverse_field_lookup(const FieldReverseLookupInput& input) const; + FieldReverseMultiLookupOutput reverse_field_multi_lookup(const FieldReverseLookupInput& input, + int max_count = 100) const; bool fully_defined_type_exists(const std::string& name) const; bool fully_defined_type_exists(const TypeSpec& type) const; @@ -158,7 +192,8 @@ class TypeSystem { bool is_dynamic = false, int array_size = -1, int offset_override = -1, - bool skip_in_static_decomp = false); + bool skip_in_static_decomp = false, + double score = 0.0); void add_builtin_types(); @@ -204,26 +239,6 @@ class TypeSystem { int get_size_in_type(const Field& field) const; private: - bool try_reverse_lookup(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const; - bool try_reverse_lookup_pointer(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const; - bool try_reverse_lookup_inline_array(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const; - bool try_reverse_lookup_array(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const; - bool try_reverse_lookup_other(const FieldReverseLookupInput& input, - std::vector* path, - bool* addr_of, - TypeSpec* result_type) const; std::string lca_base(const std::string& a, const std::string& b) const; bool typecheck_base_types(const std::string& expected, const std::string& actual) const; int get_alignment_in_type(const Field& field); diff --git a/common/type_system/deftype.cpp b/common/type_system/deftype.cpp index b59ae6b8f5..d2653fddfc 100644 --- a/common/type_system/deftype.cpp +++ b/common/type_system/deftype.cpp @@ -71,6 +71,15 @@ int64_t get_int(const goos::Object& obj) { throw std::runtime_error(obj.print() + " was supposed to be an integer, but isn't"); } +double get_float(const goos::Object& obj) { + if (obj.is_int()) { + return obj.integer_obj.value; + } else if (obj.is_float()) { + return obj.float_obj.value; + } + throw std::runtime_error(obj.print() + " was supposed to be an number, but isn't"); +} + void add_field(StructureType* structure, TypeSystem* ts, const goos::Object& def) { auto rest = &def; @@ -85,6 +94,7 @@ void add_field(StructureType* structure, TypeSystem* ts, const goos::Object& def bool is_dynamic = false; int offset_override = -1; int offset_assert = -1; + double score = 0; bool skip_in_decomp = false; if (!rest->is_empty_list()) { @@ -104,6 +114,9 @@ void add_field(StructureType* structure, TypeSystem* ts, const goos::Object& def } else if (opt_name == ":offset") { offset_override = get_int(car(rest)); rest = cdr(rest); + } else if (opt_name == ":score") { + score = get_float(car(rest)); + rest = cdr(rest); } else if (opt_name == ":offset-assert") { offset_assert = get_int(car(rest)); if (offset_assert == -1) { @@ -119,7 +132,7 @@ void add_field(StructureType* structure, TypeSystem* ts, const goos::Object& def } int actual_offset = ts->add_field_to_type(structure, name, type, is_inline, is_dynamic, - array_size, offset_override, skip_in_decomp); + array_size, offset_override, skip_in_decomp, score); if (offset_assert != -1 && actual_offset != offset_assert) { throw std::runtime_error("Field " + name + " was placed at " + std::to_string(actual_offset) + " but offset-assert was set to " + std::to_string(offset_assert)); diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index ed7f92f0e2..e5d8b0c762 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1540,7 +1540,7 @@ (word uint32 4 :offset 0) (dword uint64 2 :offset 0) (quad uint128 :offset 0) - (vector vector :inline :offset 0) + (vector vector :inline :offset 0 :score -100) (vector4w vector4w :inline :offset 0) ) :method-count-assert 9 @@ -4654,10 +4654,11 @@ (hvdf-off vector :inline :offset-assert 736) (guard vector :inline :offset-assert 752) (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) - (giftex uint128 :offset 768) - (gifgr uint128 :offset 784) - (giftex-trans uint128 :offset 800) - (gifgr-trans uint128 :offset 816) + (vis-gifs-quads uint128 4 :offset 768) ;; added + (giftex vis-gif-tag :offset 768) + (gifgr vis-gif-tag :offset 784) + (giftex-trans vis-gif-tag :offset 800) + (gifgr-trans vis-gif-tag :offset 816) (pfog0 float :offset-assert 832) (pfog1 float :offset-assert 836) (trans vector :inline :offset-assert 848) diff --git a/goal_src/engine/camera/math-camera-h.gc b/goal_src/engine/camera/math-camera-h.gc index 5079840ee4..62236bada7 100644 --- a/goal_src/engine/camera/math-camera-h.gc +++ b/goal_src/engine/camera/math-camera-h.gc @@ -79,10 +79,11 @@ (hvdf-off vector :inline :offset-assert 736) (guard vector :inline :offset-assert 752) (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) - (giftex uint128 :offset 768) - (gifgr uint128 :offset 784) - (giftex-trans uint128 :offset 800) - (gifgr-trans uint128 :offset 816) + (vis-gifs-quads uint128 4 :offset 768) + (giftex vis-gif-tag :offset 768) + (gifgr vis-gif-tag :offset 784) + (giftex-trans vis-gif-tag :offset 800) + (gifgr-trans vis-gif-tag :offset 816) (pfog0 float :offset-assert 832) (pfog1 float :offset-assert 836) (trans vector :inline :offset-assert 848) diff --git a/goal_src/engine/camera/math-camera.gc b/goal_src/engine/camera/math-camera.gc index 5c5cb0b4df..1eec9a9d39 100644 --- a/goal_src/engine/camera/math-camera.gc +++ b/goal_src/engine/camera/math-camera.gc @@ -241,31 +241,34 @@ (let ((v1-20 (make-u128 0 (shl #x301ec000 32))))) (let ((v1-23 (make-u128 0 (shl #x303ec000 32))))) (let ((pfog (-> math-cam pfog0))) - (let ((vis-gif-0 (-> math-cam vis-gifs))) - (set! (-> vis-gif-0 0 fog0) (the-as uint pfog)) - (set! (-> vis-gif-0 0 strip) (the-as uint #x301e4000)) - (set! (-> vis-gif-0 0 regs) (the-as uint 1042)) - (set! (-> vis-gif-0 0 fan) (the-as uint #x301ec000)) - ) - (let ((vis-gif-1 (-> math-cam vis-gifs 1))) - (set! (-> vis-gif-1 fog0) (the-as uint pfog)) - (set! (-> vis-gif-1 strip) (make-u128 0 (shl #x20164000 32))) - (set! (-> vis-gif-1 regs) (the-as uint 65)) - (set! (-> vis-gif-1 fan) (the-as uint #x301ec000)) - ) - (let ((vis-gif-1-again (-> math-cam vis-gifs))) - (set! (-> vis-gif-1-again 0 fog0) (the-as uint pfog)) - (set! (-> vis-gif-1-again 0 strip) (the-as uint #x303e4000)) - (set! (-> vis-gif-1-again 0 regs) (the-as uint 1042)) - (set! (-> vis-gif-1-again 0 fan) (the-as uint #x303ec000)) - ) - (let ((vis-gif-1-again-again (-> math-cam vis-gifs))) - (set! (-> vis-gif-1-again-again 0 fog0) (the-as uint pfog)) - (set! (-> vis-gif-1-again-again 0 strip) (the-as uint #x303e4000)) - (set! (-> vis-gif-1-again-again 0 regs) (the-as uint 1042)) - (set! (-> vis-gif-1-again-again 0 fan) (the-as uint #x303ec000)) - ) + (let ((vis-gif-0 (-> math-cam vis-gifs))) + (set! (-> vis-gif-0 0 fog0) (the-as uint pfog)) + (set! (-> vis-gif-0 0 strip) (the-as uint #x301e4000)) + (set! (-> vis-gif-0 0 regs) (the-as uint 1042)) + (set! (-> vis-gif-0 0 fan) (the-as uint #x301ec000)) ) + (let ((vis-gif-1 (&-> math-cam gifgr))) + (set! (-> vis-gif-1 0) (the-as vis-gif-tag pfog)) + (set! + (-> vis-gif-1 1) + (the-as vis-gif-tag (make-u128 0 (shl #x20164000 32))) + ) + (set! (-> vis-gif-1 2) (the-as vis-gif-tag 65)) + (set! (-> vis-gif-1 3) (the-as vis-gif-tag #x301ec000)) + ) + (let ((vis-gif-1-again (-> math-cam vis-gifs))) + (set! (-> vis-gif-1-again 0 fog0) (the-as uint pfog)) + (set! (-> vis-gif-1-again 0 strip) (the-as uint #x303e4000)) + (set! (-> vis-gif-1-again 0 regs) (the-as uint 1042)) + (set! (-> vis-gif-1-again 0 fan) (the-as uint #x303ec000)) + ) + (let ((vis-gif-1-again-again (-> math-cam vis-gifs))) + (set! (-> vis-gif-1-again-again 0 fog0) (the-as uint pfog)) + (set! (-> vis-gif-1-again-again 0 strip) (the-as uint #x303e4000)) + (set! (-> vis-gif-1-again-again 0 regs) (the-as uint 1042)) + (set! (-> vis-gif-1-again-again 0 fan) (the-as uint #x303ec000)) + ) + ) ;; update sprite stuff. (if (nonzero? sprite-distorter-generate-tables) diff --git a/test/decompiler/reference/engine/anim/joint-h_REF.gc b/test/decompiler/reference/engine/anim/joint-h_REF.gc index e2b2798b98..393e4cc4e2 100644 --- a/test/decompiler/reference/engine/anim/joint-h_REF.gc +++ b/test/decompiler/reference/engine/anim/joint-h_REF.gc @@ -87,15 +87,15 @@ (format #t "~Tpostbind-function: ~A~%" (-> obj postbind-function)) (format #t "~Teffect: ~A~%" (-> obj effect)) (format #t "~Tchannel[0] @ #x~X~%" (-> obj channel)) - (format #t "~Tframe-group0: ~A~%" (-> obj channel 0 frame-group)) - (format #t "~Tframe-num0: ~f~%" (-> obj channel 0 frame-num)) - (format #t "~Tframe-interp0: ~f~%" (-> obj channel 0 frame-interp)) - (format #t "~Tframe-group1: ~A~%" (-> obj channel 1 frame-group)) - (format #t "~Tframe-num1: ~f~%" (-> obj channel 1 frame-num)) - (format #t "~Tframe-interp1: ~f~%" (-> obj channel 1 frame-interp)) - (format #t "~Tframe-group2: ~A~%" (-> obj channel 2 frame-group)) - (format #t "~Tframe-num2: ~f~%" (-> obj channel 2 frame-num)) - (format #t "~Tframe-interp2: ~f~%" (-> obj channel 2 frame-interp)) + (format #t "~Tframe-group0: ~A~%" (-> obj frame-group0)) + (format #t "~Tframe-num0: ~f~%" (-> obj frame-num0)) + (format #t "~Tframe-interp0: ~f~%" (-> obj frame-interp0)) + (format #t "~Tframe-group1: ~A~%" (-> obj frame-group1)) + (format #t "~Tframe-num1: ~f~%" (-> obj frame-num1)) + (format #t "~Tframe-interp1: ~f~%" (-> obj frame-interp1)) + (format #t "~Tframe-group2: ~A~%" (-> obj frame-group2)) + (format #t "~Tframe-num2: ~f~%" (-> obj frame-num2)) + (format #t "~Tframe-interp2: ~f~%" (-> obj frame-interp2)) obj ) diff --git a/test/decompiler/reference/engine/anim/mspace-h_REF.gc b/test/decompiler/reference/engine/anim/mspace-h_REF.gc index e342d2e469..ec3fd2a895 100644 --- a/test/decompiler/reference/engine/anim/mspace-h_REF.gc +++ b/test/decompiler/reference/engine/anim/mspace-h_REF.gc @@ -61,7 +61,7 @@ (defmethod inspect bone ((obj bone)) (format #t "[~8x] ~A~%" obj 'bone) (format #t "~Ttransform: #~%" (-> obj transform)) - (format #t "~Tposition: #~%" (-> obj transform vector 3)) + (format #t "~Tposition: #~%" (-> obj position)) (format #t "~Tscale: #~%" (-> obj scale)) (format #t "~Tcache: #~%" (-> obj cache)) obj diff --git a/test/decompiler/reference/engine/camera/camera-h_REF.gc b/test/decompiler/reference/engine/camera/camera-h_REF.gc index a06aa44e21..1ce84a0d5b 100644 --- a/test/decompiler/reference/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/camera-h_REF.gc @@ -563,21 +563,21 @@ (t9-0 obj) ) (format #t "~T~Ttrans: ~`vector`P~%" (-> obj stack)) - (format #t "~T~Tinv-camera-rot: ~`matrix`P~%" (&-> obj stack 16)) + (format #t "~T~Tinv-camera-rot: ~`matrix`P~%" (-> obj inv-camera-rot)) (format #t "~T~Tfov: ~f~%" (-> obj fov)) (format #t "~T~Tinterp-val: ~f~%" (-> obj interp-val)) (format #t "~T~Tinterp-step: ~f~%" (-> obj interp-step)) (format #t "~T~Tdist-from-src: ~f~%" (-> obj dist-from-src)) (format #t "~T~Tdist-from-dest: ~f~%" (-> obj dist-from-dest)) - (format #t "~T~Tflip-control-axis: #~%" (&-> obj stack 112)) - (format #t "~T~Tvelocity: #~%" (&-> obj stack 128)) - (format #t "~T~Ttracking-status: ~D~%" (-> obj tracking-status)) - (format #t "~T~Ttracking-options: ~D~%" (-> obj tracking-options)) (format #t - "~T~Ttracking: #~%" - (&-> obj stack 160) + "~T~Tflip-control-axis: #~%" + (-> obj flip-control-axis) ) + (format #t "~T~Tvelocity: #~%" (-> obj velocity)) + (format #t "~T~Ttracking-status: ~D~%" (-> obj tracking-status)) + (format #t "~T~Ttracking-options: ~D~%" (-> obj tracking-options)) + (format #t "~T~Ttracking: #~%" (-> obj tracking)) obj ) @@ -649,52 +649,48 @@ (format #t "~T~Tfov: ~f~%" (-> obj fov)) (format #t "~T~Tfov0: ~f~%" (-> obj fov0)) (format #t "~T~Tfov1: ~f~%" (-> obj fov1)) - (format #t "~T~Tfov-index: #~%" (&-> obj stack 32)) - (format - #t - "~T~Ttracking: #~%" - (&-> obj stack 80) - ) + (format #t "~T~Tfov-index: #~%" (-> obj fov-index)) + (format #t "~T~Ttracking: #~%" (-> obj tracking)) (format #t "~T~Tview-off-param: ~f~%" (-> obj view-off-param)) - (format #t "~T~Tview-off: ~`vector`P~%" (&-> obj stack 304)) + (format #t "~T~Tview-off: ~`vector`P~%" (-> obj view-off)) (format #t "~T~Tmin-z-override: ~f~%" (-> obj min-z-override)) - (format #t "~T~Tview-flat: ~`vector`P~%" (&-> obj stack 336)) + (format #t "~T~Tview-flat: ~`vector`P~%" (-> obj view-flat)) (format #t "~T~Tstring-vel-dir: ~D~%" (-> obj string-vel-dir)) - (format #t "~T~Tstring-trans: ~`vector`P~%" (&-> obj stack 368)) + (format #t "~T~Tstring-trans: ~`vector`P~%" (-> obj string-trans)) (format #t "~T~Tposition-spline: #~%" - (&-> obj stack 384) + (-> obj position-spline) ) - (format #t "~T~Tpivot-pt: ~`vector`P~%" (&-> obj stack 2032)) + (format #t "~T~Tpivot-pt: ~`vector`P~%" (-> obj pivot-pt)) (format #t "~T~Tpivot-rad: ~f~%" (-> obj pivot-rad)) - (format #t "~T~Tcircular-follow: #~%" (&-> obj stack 2064)) + (format #t "~T~Tcircular-follow: #~%" (-> obj circular-follow)) (format #t "~T~Tmax-angle-offset: ~f~%" (-> obj max-angle-offset)) (format #t "~T~Tmax-angle-curr: ~f~%" (-> obj max-angle-curr)) (format #t "~T~Toptions: ~D~%" (-> obj options)) (format #t "~T~Tcam-entity: ~A~%" (-> obj cam-entity)) - (format #t "~T~Tvelocity: ~`vector`P~%" (&-> obj stack 2096)) - (format #t "~T~Tdesired-pos: ~`vector`P~%" (&-> obj stack 2112)) + (format #t "~T~Tvelocity: ~`vector`P~%" (-> obj velocity)) + (format #t "~T~Tdesired-pos: ~`vector`P~%" (-> obj desired-pos)) (format #t "~T~Ttime-dist-too-far: ~D~%" (-> obj time-dist-too-far)) (format #t "~T~Tlos-state: ~D~%" (-> obj los-state)) - (format #t "~T~Tgood-point: ~`vector`P~%" (&-> obj stack 2144)) + (format #t "~T~Tgood-point: ~`vector`P~%" (-> obj good-point)) (format #t "~T~Tlos-tgt-spline-pt: ~D~%" (-> obj los-tgt-spline-pt)) (format #t "~T~Tlos-tgt-spline-pt-incarnation: ~D~%" (-> obj los-tgt-spline-pt-incarnation) ) - (format #t "~T~Tlos-last-pos: ~`vector`P~%" (&-> obj stack 2176)) - (format #t "~T~Tintro-curve: #~%" (&-> obj stack 2192)) - (format #t "~T~Tintro-offset: #~%" (&-> obj stack 2224)) + (format #t "~T~Tlos-last-pos: ~`vector`P~%" (-> obj los-last-pos)) + (format #t "~T~Tintro-curve: #~%" (-> obj intro-curve)) + (format #t "~T~Tintro-offset: #~%" (-> obj intro-offset)) (format #t "~T~Tintro-t: ~f~%" (-> obj intro-t)) (format #t "~T~Tintro-t-step: ~f~%" (-> obj intro-t-step)) (format #t "~T~Toutro-exit-value: ~f~%" (-> obj outro-exit-value)) (format #t "~T~Tspline-exists: ~A~%" (-> obj spline-exists)) - (format #t "~T~Tspline-curve: #~%" (&-> obj stack 2256)) - (format #t "~T~Tspline-offset: #~%" (&-> obj stack 2288)) - (format #t "~T~Tindex: #~%" (&-> obj stack 2304)) - (format #t "~T~Tsaved-pt: #~%" (&-> obj stack 2352)) + (format #t "~T~Tspline-curve: #~%" (-> obj spline-curve)) + (format #t "~T~Tspline-offset: #~%" (-> obj spline-offset)) + (format #t "~T~Tindex: #~%" (-> obj index)) + (format #t "~T~Tsaved-pt: #~%" (-> obj saved-pt)) (format #t "~T~Tspline-tt: ~f~%" (-> obj spline-tt)) (format #t "~T~Tspline-follow-dist: ~f~%" (-> obj spline-follow-dist)) (format #t "~T~Tchange-event-from: #x~X~%" (-> obj change-event-from)) @@ -704,8 +700,8 @@ (format #t "~T~Thave-phony-joystick: ~A~%" (-> obj have-phony-joystick)) (format #t "~T~Tphony-joystick-x: ~f~%" (-> obj phony-joystick-x)) (format #t "~T~Tphony-joystick-y: ~f~%" (-> obj phony-joystick-y)) - (format #t "~T~Tstring-min-val: #~%" (&-> obj stack 2416)) - (format #t "~T~Tstring-max-val: #~%" (&-> obj stack 2432)) + (format #t "~T~Tstring-min-val: #~%" (-> obj string-min-val)) + (format #t "~T~Tstring-max-val: #~%" (-> obj string-max-val)) (format #t "~T~Tstring-val-locked: ~A~%" (-> obj string-val-locked)) obj ) @@ -779,7 +775,7 @@ ) (format #t "~T~Tmaster-options: ~D~%" (-> obj master-options)) (format #t "~T~Tnum-slaves: ~D~%" (-> obj num-slaves)) - (format #t "~T~Tslave[2] @ #x~X~%" (&-> obj stack 8)) + (format #t "~T~Tslave[2] @ #x~X~%" (-> obj slave)) (format #t "~T~Tslave-options: ~D~%" (-> obj slave-options)) (format #t "~T~Tview-off-param-save: ~f~%" (-> obj view-off-param-save)) (format #t "~T~Tchanger: #x~X~%" (-> obj changer)) @@ -788,18 +784,22 @@ (format #t "~T~TstringMaxLength: ~f~%" (-> obj stringMaxLength)) (format #t "~T~TstringMinHeight: ~f~%" (-> obj stringMinHeight)) (format #t "~T~TstringMaxHeight: ~f~%" (-> obj stringMaxHeight)) - (format #t "~T~Tstring-min: #~%" (&-> obj stack 48)) + (format + #t + "~T~Tstring-min: #~%" + (-> obj string-min) + ) (format #t "~T~Tstring-max: #~%" - (&-> obj stack 112) + (-> obj string-max) ) (format #t "~T~Tstring-push-z: ~f~%" (-> obj string-push-z)) (format #t "~T~TstringCliffHeight: ~f~%" (-> obj stringCliffHeight)) (format #t "~T~Tno-intro: ~D~%" (-> obj no-intro)) (format #t "~T~Tforce-blend: ~D~%" (-> obj force-blend)) (format #t "~T~Tforce-blend-time: ~D~%" (-> obj force-blend-time)) - (format #t "~T~Tlocal-down: ~`vector`P~%" (&-> obj stack 192)) + (format #t "~T~Tlocal-down: ~`vector`P~%" (-> obj local-down)) (format #t "~T~Tdrawable-target: ~D~%" (-> obj drawable-target)) (format #t "~T~Twhich-bone: ~D~%" (-> obj which-bone)) (format #t "~T~Tpov-handle: ~D~%" (-> obj pov-handle)) @@ -809,28 +809,28 @@ (format #t "~T~Ton-ground: ~A~%" (-> obj on-ground)) (format #t "~T~Tunder-water: ~D~%" (-> obj under-water)) (format #t "~T~Ton-pole: ~A~%" (-> obj on-pole)) - (format #t "~T~Ttgt-rot-mat: ~`matrix`P~%" (&-> obj stack 272)) - (format #t "~T~Ttgt-face-mat: ~`matrix`P~%" (&-> obj stack 336)) - (format #t "~T~Ttpos-old: ~`vector`P~%" (&-> obj stack 400)) - (format #t "~T~Ttpos-curr: ~`vector`P~%" (&-> obj stack 416)) + (format #t "~T~Ttgt-rot-mat: ~`matrix`P~%" (-> obj tgt-rot-mat)) + (format #t "~T~Ttgt-face-mat: ~`matrix`P~%" (-> obj tgt-face-mat)) + (format #t "~T~Ttpos-old: ~`vector`P~%" (-> obj tpos-old)) + (format #t "~T~Ttpos-curr: ~`vector`P~%" (-> obj tpos-curr)) (format #t "~T~Ttarget-height: ~f~%" (-> obj target-height)) - (format #t "~T~Ttpos-old-adj: ~`vector`P~%" (&-> obj stack 448)) - (format #t "~T~Ttpos-curr-adj: ~`vector`P~%" (&-> obj stack 464)) - (format #t "~T~Ttpos-tgt: ~`vector`P~%" (&-> obj stack 480)) + (format #t "~T~Ttpos-old-adj: ~`vector`P~%" (-> obj tpos-old-adj)) + (format #t "~T~Ttpos-curr-adj: ~`vector`P~%" (-> obj tpos-curr-adj)) + (format #t "~T~Ttpos-tgt: ~`vector`P~%" (-> obj tpos-tgt)) (format #t "~T~Tupspeed: ~f~%" (-> obj upspeed)) - (format #t "~T~Tpitch-off: ~`vector`P~%" (&-> obj stack 512)) + (format #t "~T~Tpitch-off: ~`vector`P~%" (-> obj pitch-off)) (format #t "~T~Tfoot-offset: ~f~%" (-> obj foot-offset)) (format #t "~T~Thead-offset: ~f~%" (-> obj head-offset)) (format #t "~T~Ttarget-spline: #~%" - (&-> obj stack 544) + (-> obj target-spline) ) - (format #t "~T~Tease-from: #~%" (&-> obj stack 2192)) + (format #t "~T~Tease-from: #~%" (-> obj ease-from)) (format #t "~T~Tease-t: ~f~%" (-> obj ease-t)) (format #t "~T~Tease-step: ~f~%" (-> obj ease-step)) - (format #t "~T~Tease-to: #~%" (&-> obj stack 2224)) - (format #t "~T~Toutro-curve: #~%" (&-> obj stack 2240)) + (format #t "~T~Tease-to: #~%" (-> obj ease-to)) + (format #t "~T~Toutro-curve: #~%" (-> obj outro-curve)) (format #t "~T~Toutro-t: ~f~%" (-> obj outro-t)) (format #t "~T~Toutro-t-step: ~f~%" (-> obj outro-t-step)) (format #t "~T~Toutro-exit-value: ~f~%" (-> obj outro-exit-value)) diff --git a/test/decompiler/reference/engine/camera/math-camera-h_REF.gc b/test/decompiler/reference/engine/camera/math-camera-h_REF.gc index cf51ea526b..be396e5a04 100644 --- a/test/decompiler/reference/engine/camera/math-camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/math-camera-h_REF.gc @@ -72,53 +72,54 @@ ;; definition of type math-camera (deftype math-camera (basic) - ((d float :offset-assert 4) - (f float :offset-assert 8) - (fov float :offset-assert 12) - (x-ratio float :offset-assert 16) - (y-ratio float :offset-assert 20) - (x-pix float :offset-assert 24) - (x-clip float :offset-assert 28) - (x-clip-ratio-in float :offset-assert 32) - (x-clip-ratio-over float :offset-assert 36) - (y-pix float :offset-assert 40) - (y-clip float :offset-assert 44) - (y-clip-ratio-in float :offset-assert 48) - (y-clip-ratio-over float :offset-assert 52) - (cull-info cull-info :inline :offset-assert 56) - (fog-start float :offset-assert 120) - (fog-end float :offset-assert 124) - (fog-max float :offset-assert 128) - (fog-min float :offset-assert 132) - (reset int32 :offset-assert 136) - (smooth-step float :offset-assert 140) - (smooth-t float :offset-assert 144) - (perspective matrix :inline :offset-assert 160) - (isometric matrix :inline :offset-assert 224) - (sprite-2d matrix :inline :offset-assert 288) - (sprite-2d-hvdf vector :inline :offset-assert 352) - (camera-rot matrix :inline :offset-assert 368) - (inv-camera-rot matrix :inline :offset-assert 432) - (inv-camera-rot-smooth matrix :inline :offset-assert 496) - (inv-camera-rot-smooth-from quaternion :inline :offset-assert 560) - (camera-temp matrix :inline :offset-assert 576) - (prev-camera-temp matrix :inline :offset-assert 640) - (hmge-scale vector :inline :offset-assert 704) - (inv-hmge-scale vector :inline :offset-assert 720) - (hvdf-off vector :inline :offset-assert 736) - (guard vector :inline :offset-assert 752) - (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) - (giftex uint128 :offset 768) - (gifgr uint128 :offset 784) - (giftex-trans uint128 :offset 800) - (gifgr-trans uint128 :offset 816) - (pfog0 float :offset-assert 832) - (pfog1 float :offset-assert 836) - (trans vector :inline :offset-assert 848) - (plane uint128 4 :offset-assert 864) - (guard-plane uint128 4 :offset-assert 928) - (shrub-mat matrix :inline :offset-assert 992) - (fov-correction-factor float :offset-assert 1056) + ((d float :offset-assert 4) + (f float :offset-assert 8) + (fov float :offset-assert 12) + (x-ratio float :offset-assert 16) + (y-ratio float :offset-assert 20) + (x-pix float :offset-assert 24) + (x-clip float :offset-assert 28) + (x-clip-ratio-in float :offset-assert 32) + (x-clip-ratio-over float :offset-assert 36) + (y-pix float :offset-assert 40) + (y-clip float :offset-assert 44) + (y-clip-ratio-in float :offset-assert 48) + (y-clip-ratio-over float :offset-assert 52) + (cull-info cull-info :inline :offset-assert 56) + (fog-start float :offset-assert 120) + (fog-end float :offset-assert 124) + (fog-max float :offset-assert 128) + (fog-min float :offset-assert 132) + (reset int32 :offset-assert 136) + (smooth-step float :offset-assert 140) + (smooth-t float :offset-assert 144) + (perspective matrix :inline :offset-assert 160) + (isometric matrix :inline :offset-assert 224) + (sprite-2d matrix :inline :offset-assert 288) + (sprite-2d-hvdf vector :inline :offset-assert 352) + (camera-rot matrix :inline :offset-assert 368) + (inv-camera-rot matrix :inline :offset-assert 432) + (inv-camera-rot-smooth matrix :inline :offset-assert 496) + (inv-camera-rot-smooth-from quaternion :inline :offset-assert 560) + (camera-temp matrix :inline :offset-assert 576) + (prev-camera-temp matrix :inline :offset-assert 640) + (hmge-scale vector :inline :offset-assert 704) + (inv-hmge-scale vector :inline :offset-assert 720) + (hvdf-off vector :inline :offset-assert 736) + (guard vector :inline :offset-assert 752) + (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) + (vis-gifs-quads uint128 4 :offset 768) + (giftex vis-gif-tag :offset 768) + (gifgr vis-gif-tag :offset 784) + (giftex-trans vis-gif-tag :offset 800) + (gifgr-trans vis-gif-tag :offset 816) + (pfog0 float :offset-assert 832) + (pfog1 float :offset-assert 836) + (trans vector :inline :offset-assert 848) + (plane uint128 4 :offset-assert 864) + (guard-plane uint128 4 :offset-assert 928) + (shrub-mat matrix :inline :offset-assert 992) + (fov-correction-factor float :offset-assert 1056) ) :method-count-assert 9 :size-assert #x424 @@ -176,10 +177,10 @@ (format #t "~Thvdf-off: #~%" (-> obj hvdf-off)) (format #t "~Tguard: #~%" (-> obj guard)) (format #t "~Tvis-gifs[4] @ #x~X~%" (-> obj vis-gifs)) - (format #t "~Tgiftex: ~D~%" (-> obj giftex)) - (format #t "~Tgifgr: ~D~%" (-> obj gifgr)) - (format #t "~Tgiftex-trans: ~D~%" (-> obj giftex-trans)) - (format #t "~Tgifgr-trans: ~D~%" (-> obj gifgr-trans)) + (format #t "~Tgiftex: ~D~%" (-> obj vis-gifs-quads 0)) + (format #t "~Tgifgr: ~D~%" (-> obj vis-gifs-quads 1)) + (format #t "~Tgiftex-trans: ~D~%" (-> obj vis-gifs-quads 2)) + (format #t "~Tgifgr-trans: ~D~%" (-> obj vis-gifs-quads 3)) (format #t "~Tpfog0: ~f~%" (-> obj pfog0)) (format #t "~Tpfog1: ~f~%" (-> obj pfog1)) (format #t "~Ttrans: ~`vector`P~%" (-> obj trans)) diff --git a/test/decompiler/reference/engine/camera/math-camera_REF.gc b/test/decompiler/reference/engine/camera/math-camera_REF.gc index 6c7ee71ad0..e35a38d4a6 100644 --- a/test/decompiler/reference/engine/camera/math-camera_REF.gc +++ b/test/decompiler/reference/engine/camera/math-camera_REF.gc @@ -288,11 +288,14 @@ (set! (-> vis-gif-0 0 regs) (the-as uint 1042)) (set! (-> vis-gif-0 0 fan) (the-as uint #x301ec000)) ) - (let ((vis-gif-1 (-> math-cam vis-gifs 1))) - (set! (-> vis-gif-1 fog0) (the-as uint pfog)) - (set! (-> vis-gif-1 strip) (make-u128 0 (shl #x20164000 32))) - (set! (-> vis-gif-1 regs) (the-as uint 65)) - (set! (-> vis-gif-1 fan) (the-as uint #x301ec000)) + (let ((vis-gif-1 (&-> math-cam gifgr))) + (set! (-> vis-gif-1 0) (the-as vis-gif-tag pfog)) + (set! + (-> vis-gif-1 1) + (the-as vis-gif-tag (make-u128 0 (shl #x20164000 32))) + ) + (set! (-> vis-gif-1 2) (the-as vis-gif-tag 65)) + (set! (-> vis-gif-1 3) (the-as vis-gif-tag #x301ec000)) ) (let ((vis-gif-1-again (-> math-cam vis-gifs))) (set! (-> vis-gif-1-again 0 fog0) (the-as uint pfog)) @@ -699,7 +702,7 @@ ) (.lvf vf7 (&-> *math-camera* hmge-scale quad)) (.lvf vf8 (&-> *math-camera* hvdf-off quad)) - (.lvf vf9 (&-> *math-camera* giftex)) + (.lvf vf9 (&-> *math-camera* vis-gifs-quads 0)) (let ((v1-13 255)) (.mov vf6 v1-13) ) diff --git a/test/decompiler/reference/engine/collide/collide-edge-grab-h_REF.gc b/test/decompiler/reference/engine/collide/collide-edge-grab-h_REF.gc index 1787b64f2f..fa7aa1f5d7 100644 --- a/test/decompiler/reference/engine/collide/collide-edge-grab-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-edge-grab-h_REF.gc @@ -38,8 +38,8 @@ (format #t "~Tactor-handle: ~D~%" (-> obj actor-handle)) (format #t "~Thanging-matrix: #~%" (-> obj hanging-matrix)) (format #t "~Tedge-vertex[2] @ #x~X~%" (-> obj world-vertex)) - (format #t "~Tcenter-hold: ~`vector`P~%" (-> obj world-vertex 2)) - (format #t "~Ttri-vertex[3] @ #x~X~%" (-> obj world-vertex 3)) + (format #t "~Tcenter-hold: ~`vector`P~%" (-> obj center-hold)) + (format #t "~Ttri-vertex[3] @ #x~X~%" (-> obj tri-vertex)) (format #t "~Tleft-hand-hold: #~%" (-> obj left-hand-hold)) (format #t "~Tright-hand-hold: #~%" (-> obj right-hand-hold)) (format #t "~Tcenter-hold-old: ~`vector`P~%" (-> obj center-hold-old)) @@ -256,12 +256,12 @@ (format #t "~Tlocal-player-leap-up-spheres[6] @ #x~X~%" - (-> obj local-player-spheres 6) + (-> obj local-player-leap-up-spheres) ) (format #t "~Tworld-player-leap-up-spheres[6] @ #x~X~%" - (-> obj world-player-spheres 6) + (-> obj world-player-leap-up-spheres) ) (format #t "~Tverts[64] @ #x~X~%" (-> obj verts)) (format #t "~Tedges[96] @ #x~X~%" (-> obj edges)) @@ -318,7 +318,3 @@ ;; definition (perm) for symbol *edge-grab-info*, type edge-grab-info (define-perm *edge-grab-info* edge-grab-info (new 'global 'edge-grab-info)) - - - - diff --git a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc index 5a71a1bcf9..a10ffdd6a3 100644 --- a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc @@ -38,8 +38,8 @@ (format #t "~T~Tanim-mode: ~A~%" (-> obj anim-mode)) (format #t "~T~Tcur-grab-handle: ~D~%" (-> obj cur-grab-handle)) (format #t "~T~Tcur-target-handle: ~D~%" (-> obj cur-target-handle)) - (format #t "~T~Told-grab-pos: ~`vector`P~%" (&-> obj stack 112)) - (format #t "~T~Tjoint[4] @ #x~X~%" (&-> obj stack 128)) + (format #t "~T~Told-grab-pos: ~`vector`P~%" (-> obj old-grab-pos)) + (format #t "~T~Tjoint[4] @ #x~X~%" (-> obj joint)) (format #t "~T~Tnew-post-hook: ~A~%" (-> obj new-post-hook)) (format #t "~T~Tcur-post-hook: ~A~%" (-> obj cur-post-hook)) (format #t "~T~Tclone-copy-trans: ~A~%" (-> obj clone-copy-trans)) @@ -72,7 +72,7 @@ (format #t "~T~Tmode: #x~X~%" (-> obj mode)) (format #t "~T~Tenable: ~A~%" (-> obj enable)) (format #t "~T~Tradius: (meters ~m)~%" (-> obj radius)) - (format #t "~T~Tworld-sphere: #~%" (&-> obj stack 80)) + (format #t "~T~Tworld-sphere: #~%" (-> obj world-sphere)) obj ) @@ -111,11 +111,11 @@ (format #t "~T~Tduration: ~D~%" (-> obj duration)) (format #t "~T~Tlinger-duration: ~D~%" (-> obj linger-duration)) (format #t "~T~Tstart-time: ~D~%" (-> obj start-time)) - (format #t "~T~Toffset: ~`vector`P~%" (&-> obj stack 48)) + (format #t "~T~Toffset: ~`vector`P~%" (-> obj offset)) (format #t "~T~Tuserdata: ~A~%" (-> obj userdata)) - (format #t "~T~Tuser-time[2] @ #x~X~%" (&-> obj stack 72)) - (format #t "~T~Tuser-vector[2] @ #x~X~%" (&-> obj stack 96)) - (format #t "~T~Tuser-handle[2] @ #x~X~%" (&-> obj stack 128)) + (format #t "~T~Tuser-time[2] @ #x~X~%" (-> obj user-time)) + (format #t "~T~Tuser-vector[2] @ #x~X~%" (-> obj user-vector)) + (format #t "~T~Tuser-handle[2] @ #x~X~%" (-> obj user-handle)) obj ) @@ -226,7 +226,7 @@ (t9-0 obj) ) (format #t "~T~Troot: ~A~%" (-> obj root)) - (format #t "~T~Tdir: ~`vector`P~%" (&-> obj stack 16)) + (format #t "~T~Tdir: ~`vector`P~%" (-> obj dir)) (format #t "~T~Trange: (meters ~m)~%" (-> obj range)) (format #t "~T~Tedge-length: (meters ~m)~%" (-> obj edge-length)) obj @@ -294,8 +294,8 @@ (format #t "~T~Told-global-mask: ~D~%" (-> obj old-global-mask)) (format #t "~T~Tmask-to-clear: ~D~%" (-> obj mask-to-clear)) (format #t "~T~Tcam-joint-index: ~D~%" (-> obj cam-joint-index)) - (format #t "~T~Told-pos: #~%" (&-> obj stack 32)) - (format #t "~T~Told-mat-z: #~%" (&-> obj stack 48)) + (format #t "~T~Told-pos: #~%" (-> obj old-pos)) + (format #t "~T~Told-mat-z: #~%" (-> obj old-mat-z)) (format #t "~T~Thad-valid-frame: ~A~%" (-> obj had-valid-frame)) (format #t "~T~Tborder-value: ~A~%" (-> obj border-value)) (format #t "~T~Tdie?: ~A~%" (-> obj die?)) diff --git a/test/decompiler/reference/engine/game/projectiles-h_REF.gc b/test/decompiler/reference/engine/game/projectiles-h_REF.gc index 8e3b0e612b..d3b8048446 100644 --- a/test/decompiler/reference/engine/game/projectiles-h_REF.gc +++ b/test/decompiler/reference/engine/game/projectiles-h_REF.gc @@ -48,19 +48,19 @@ (let ((t9-0 (method-of-type process-drawable inspect))) (t9-0 obj) ) - (format #t "~T~Tbase-trans: ~`vector`P~%" (&-> obj stack 64)) - (format #t "~T~Ttarget: ~`vector`P~%" (&-> obj stack 80)) - (format #t "~T~Ttarget-base: ~`vector`P~%" (&-> obj stack 96)) - (format #t "~T~Tparent-base: ~`vector`P~%" (&-> obj stack 112)) - (format #t "~T~Tparent-quat: ~`vector`P~%" (&-> obj stack 128)) - (format #t "~T~Tbase-vector: ~`vector`P~%" (&-> obj stack 144)) + (format #t "~T~Tbase-trans: ~`vector`P~%" (-> obj base-trans)) + (format #t "~T~Ttarget: ~`vector`P~%" (-> obj target)) + (format #t "~T~Ttarget-base: ~`vector`P~%" (-> obj target-base)) + (format #t "~T~Tparent-base: ~`vector`P~%" (-> obj parent-base)) + (format #t "~T~Tparent-quat: ~`vector`P~%" (-> obj parent-quat)) + (format #t "~T~Tbase-vector: ~`vector`P~%" (-> obj base-vector)) (format #t "~T~Ttimeout: ~D~%" (-> obj timeout)) (format #t "~T~Toptions: ~D~%" (-> obj options)) (format #t "~T~Tlast-target: ~D~%" (-> obj last-target)) (format #t "~T~Tnotify-handle: ~D~%" (-> obj notify-handle)) (format #t "~T~Tmax-speed: ~f~%" (-> obj max-speed)) (format #t "~T~Tmax-turn: ~f~%" (-> obj max-turn)) - (format #t "~T~Told-dist[16] @ #x~X~%" (&-> obj stack 200)) + (format #t "~T~Told-dist[16] @ #x~X~%" (-> obj old-dist)) (format #t "~T~Told-dist-count: ~D~%" (-> obj old-dist-count)) (format #t "~T~Thits: ~D~%" (-> obj hits)) (format #t "~T~Tmax-hits: ~D~%" (-> obj max-hits)) @@ -118,7 +118,3 @@ ;; failed to figure out what this is: (let ((v0-6 0)) ) - - - - diff --git a/test/decompiler/reference/engine/game/task/task-control-h_REF.gc b/test/decompiler/reference/engine/game/task/task-control-h_REF.gc index 97b11c85a5..9d0e2a770e 100644 --- a/test/decompiler/reference/engine/game/task/task-control-h_REF.gc +++ b/test/decompiler/reference/engine/game/task/task-control-h_REF.gc @@ -162,9 +162,13 @@ (t9-0 obj) ) (format #t "~T~Ttasks: ~A~%" (-> obj tasks)) - (format #t "~T~Tquery: #~%" (&-> obj stack 68)) - (format #t "~T~Told-target-pos: #~%" (&-> obj stack 96)) - (format #t "~T~Tcell-for-task: ~D~%" (-> obj stack 144)) + (format #t "~T~Tquery: #~%" (-> obj query)) + (format + #t + "~T~Told-target-pos: #~%" + (-> obj old-target-pos) + ) + (format #t "~T~Tcell-for-task: ~D~%" (-> obj cell-for-task)) (format #t "~T~Tcell-x: ~D~%" (-> obj cell-x)) (format #t "~T~Tcam-joint-index: ~D~%" (-> obj cam-joint-index)) (format #t "~T~Tskippable: ~A~%" (-> obj skippable)) @@ -174,12 +178,12 @@ (format #t "~T~Ttalk-message: ~D~%" (-> obj talk-message)) (format #t "~T~Tlast-talk: ~D~%" (-> obj last-talk)) (format #t "~T~Tbounce-away: ~A~%" (-> obj bounce-away)) - (format #t "~T~Tambient: #~%" (&-> obj stack 208)) + (format #t "~T~Tambient: #~%" (-> obj ambient)) (format #t "~T~Tcenter-joint-index: ~D~%" (-> obj center-joint-index)) (format #t "~T~Tdraw-bounds-y-offset: ~f~%" (-> obj draw-bounds-y-offset)) (format #t "~T~Tneck-joint-index: ~D~%" (-> obj neck-joint-index)) (format #t "~T~Tfuel-cell-anim: ~A~%" (-> obj fuel-cell-anim)) - (format #t "~T~Tsound-flava: ~D~%" (-> obj stack 240)) + (format #t "~T~Tsound-flava: ~D~%" (-> obj sound-flava)) (format #t "~T~Thave-flava: ~A~%" (-> obj have-flava)) (format #t "~T~Tmusic: ~A~%" (-> obj music)) (format #t "~T~Thave-music: ~A~%" (-> obj have-music)) diff --git a/test/decompiler/reference/engine/gfx/generic/generic-h_REF.gc b/test/decompiler/reference/engine/gfx/generic/generic-h_REF.gc index 2f0607fcb4..dc955bdf2a 100644 --- a/test/decompiler/reference/engine/gfx/generic/generic-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/generic/generic-h_REF.gc @@ -29,12 +29,12 @@ (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)) + (format #t "~Ttex: #~%" (&-> obj vt vector4w w)) + (format #t "~Tnrm: #~%" (-> obj nrm)) + (format #t "~Tnc: #~%" (-> obj nrm)) + (format #t "~Tclr: #~%" (&-> obj nc vector4w w)) + (format #t "~Tdtex: #~%" (-> obj nrm)) + (format #t "~Tdclr: #~%" (&-> obj nrm y)) obj ) @@ -169,8 +169,8 @@ (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)) + (format #t "~Theader: #~%" (-> obj header)) + (format #t "~Twork-area[0] @ #x~X~%" (-> obj work-area)) obj ) @@ -346,10 +346,10 @@ (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)) + (format #t "~Tfan-prim: ~D~%" (-> obj fan-prim)) + (format #t "~Tstr-prim: ~D~%" (-> obj str-prim)) + (format #t "~Tregs: ~D~%" (-> obj regs)) + (format #t "~Tnum-strips: ~D~%" (-> obj num-strips)) obj ) @@ -379,10 +379,10 @@ (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)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) + (format #t "~Tz: ~D~%" (-> obj z)) + (format #t "~Tw: ~D~%" (-> obj w)) obj ) @@ -495,7 +495,3 @@ *gsf-buffer* (the-as gsf-buffer (kmalloc global 9216 (kmalloc-flags align-64) "malloc")) ) - - - - diff --git a/test/decompiler/reference/engine/gfx/generic/generic-vu1-h_REF.gc b/test/decompiler/reference/engine/gfx/generic/generic-vu1-h_REF.gc index 15e893e2f3..005057f4c0 100644 --- a/test/decompiler/reference/engine/gfx/generic/generic-vu1-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/generic/generic-vu1-h_REF.gc @@ -20,8 +20,8 @@ (format #t "~Tdata[32] @ #x~X~%" (-> obj data)) (format #t "~Tvector[8] @ #x~X~%" (-> obj data)) (format #t "~Tt-mtx: #~%" (-> obj data)) - (format #t "~Tn-mtx: #~%" (&-> obj data 16)) - (format #t "~Tscale: #~%" (&-> obj data 28)) + (format #t "~Tn-mtx: #~%" (-> obj n-mtx)) + (format #t "~Tscale: #~%" (-> obj scale)) obj ) diff --git a/test/decompiler/reference/engine/gfx/generic/generic-work-h_REF.gc b/test/decompiler/reference/engine/gfx/generic/generic-work-h_REF.gc index 13f4e8227e..4ce1455c19 100644 --- a/test/decompiler/reference/engine/gfx/generic/generic-work-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/generic/generic-work-h_REF.gc @@ -75,7 +75,7 @@ (format #t "~Tadnop2: #~%" (-> obj adnop2)) (format #t "~Tdps: ~D~%" (-> obj dps)) (format #t "~Tkickoff: ~D~%" (-> obj kickoff)) - (format #t "~Tstrips: ~D~%" (-> obj strgif qword hword 6)) + (format #t "~Tstrips: ~D~%" (-> obj strips)) obj ) diff --git a/test/decompiler/reference/engine/gfx/hw/vu1-user-h_REF.gc b/test/decompiler/reference/engine/gfx/hw/vu1-user-h_REF.gc index 5e8baeeb3d..87d46d503b 100644 --- a/test/decompiler/reference/engine/gfx/hw/vu1-user-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/hw/vu1-user-h_REF.gc @@ -103,8 +103,8 @@ (defmethod inspect dma-foreground-sink-group ((obj dma-foreground-sink-group)) (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~Tsink[3] @ #x~X~%" (-> obj sink)) - (format #t "~Tmerc-sink: ~A~%" (-> obj sink 0)) - (format #t "~Tgeneric-sink: ~A~%" (-> obj sink 1)) + (format #t "~Tmerc-sink: ~A~%" (-> obj merc-sink)) + (format #t "~Tgeneric-sink: ~A~%" (-> obj generic-sink)) (format #t "~Tlevel: ~A~%" (-> obj level)) obj ) diff --git a/test/decompiler/reference/engine/gfx/lights-h_REF.gc b/test/decompiler/reference/engine/gfx/lights-h_REF.gc index 9b9e607ccb..20e150f7d1 100644 --- a/test/decompiler/reference/engine/gfx/lights-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/lights-h_REF.gc @@ -66,10 +66,10 @@ (format #t "[~8x] ~A~%" obj 'light-ellipse) (format #t "~Tmatrix: #~%" (-> obj matrix)) (format #t "~Tcolor: #~%" (-> obj color)) - (format #t "~Tname: ~A~%" (-> obj matrix vector 0 w)) - (format #t "~Tdecay-start: ~f~%" (-> obj matrix vector 1 w)) - (format #t "~Tambient-point-ratio: ~f~%" (-> obj matrix vector 2 w)) - (format #t "~Tlevel: ~f~%" (-> obj matrix vector 3 w)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tdecay-start: ~f~%" (-> obj decay-start)) + (format #t "~Tambient-point-ratio: ~f~%" (-> obj ambient-point-ratio)) + (format #t "~Tlevel: ~f~%" (-> obj level)) (format #t "~Tfunc-symbol: ~A~%" (-> obj color w)) (format #t "~Tfunc: ~A~%" (-> obj color w)) obj diff --git a/test/decompiler/reference/engine/gfx/merc/merc-h_REF.gc b/test/decompiler/reference/engine/gfx/merc/merc-h_REF.gc index 73d6b78303..ccfa1282f7 100644 --- a/test/decompiler/reference/engine/gfx/merc/merc-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/merc/merc-h_REF.gc @@ -23,7 +23,7 @@ (format #t "~Tvertex-skip: ~D~%" (-> obj vertex-skip)) (format #t "~Tvertex-count: ~D~%" (-> obj vertex-count)) (format #t "~Tcurrent-loc: ~D~%" (-> obj current-loc)) - (format #t "~Tdata[0] @ #x~X~%" (&-> obj _data 16)) + (format #t "~Tdata[0] @ #x~X~%" (-> obj data2)) obj ) @@ -548,10 +548,10 @@ (format #t "~Tdummy-bytes[48] @ #x~X~%" (&-> obj fragment-count)) (format #t "~Tenvmap-tint: ~D~%" (-> obj envmap-tint)) (format #t "~Tquery: ~A~%" (-> obj query)) - (format #t "~Tneeds-clip: ~D~%" (-> obj dummy-bytes 8)) - (format #t "~Tuse-isometric: ~D~%" (-> obj dummy-bytes 9)) - (format #t "~Tuse-attached-shader: ~D~%" (-> obj dummy-bytes 10)) - (format #t "~Tdisplay-triangles: ~D~%" (-> obj dummy-bytes 11)) + (format #t "~Tneeds-clip: ~D~%" (-> obj needs-clip)) + (format #t "~Tuse-isometric: ~D~%" (-> obj use-isometric)) + (format #t "~Tuse-attached-shader: ~D~%" (-> obj use-attached-shader)) + (format #t "~Tdisplay-triangles: ~D~%" (-> obj display-triangles)) (format #t "~Tdeath-vertex-skip: ~D~%" (-> obj two-mat-count)) (format #t "~Tdeath-start-vertex: ~D~%" (-> obj two-mat-reuse-count)) (format #t "~Tdeath-effect: ~D~%" (-> obj death-effect)) diff --git a/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc b/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc index 98fba2050e..3e7905129a 100644 --- a/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc @@ -44,8 +44,8 @@ (format #t "[~8x] ~A~%" obj 'shrub-view-data) (format #t "~Tdata[3] @ #x~X~%" (-> obj data)) (format #t "~Ttexture-giftag: #~%" (-> obj data)) - (format #t "~Tconsts: #~%" (&-> obj data 1)) - (format #t "~Tfog-clamp: #~%" (&-> obj data 2)) + (format #t "~Tconsts: #~%" (-> obj consts)) + (format #t "~Tfog-clamp: #~%" (-> obj fog-clamp)) (format #t "~Ttex-start-ptr: ~D~%" (-> obj consts x)) (format #t "~Tgifbufsum: ~f~%" (-> obj consts x)) (format #t "~Tmtx-buf-ptr: ~D~%" (-> obj consts y)) @@ -240,9 +240,9 @@ (let ((text-dst2 (the-as qword (+ (the-as int tex-dst) 16))) (src-2 (the-as qword (&+ (the-as pointer src) 16))) ) - (set! (-> dst data 0) (-> src-2 data 0)) - (set! (-> dst data 1) (-> src-2 data 1)) - (set! (-> dst data 2) (-> src-2 data 2)) + (set! (-> dst vector4w x) (the-as int (-> src-2 data 0))) + (set! (-> dst vector4w y) (the-as int (-> src-2 data 1))) + (set! (-> dst vector4w z) (the-as int (-> src-2 data 2))) (set! dst (the-as qword (+ (the-as int dst) 16))) (let ((src-3 (the-as qword (&+ (the-as pointer src-2) 16)))) (dotimes (t0-4 3) diff --git a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc index dc0ba08d58..dfba764fb2 100644 --- a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc @@ -107,7 +107,7 @@ (format #t "[~8x] ~A~%" obj 'sky-moon-data) (format #t "~Tdata[2] @ #x~X~%" (-> obj data)) (format #t "~Tpos: #~%" (-> obj data)) - (format #t "~Tscale: #~%" (&-> obj data 1)) + (format #t "~Tscale: #~%" (-> obj scale)) obj ) diff --git a/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc b/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc index 5e54ff3e27..426eafcbad 100644 --- a/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc @@ -206,8 +206,8 @@ (format #t "~Tmatrix: ~D~%" (-> obj matrix)) (format #t "~Tlast-spawn-frame: ~D~%" (-> obj last-spawn-frame)) (format #t "~Tlast-spawn-time: ~D~%" (-> obj last-spawn-time)) - (format #t "~Tcenter: ~`vector`P~%" (&-> obj _data 32)) - (format #t "~Tdata[0] @ #x~X~%" (&-> obj _data 48)) + (format #t "~Tcenter: ~`vector`P~%" (-> obj center)) + (format #t "~Tdata[0] @ #x~X~%" (-> obj data)) obj ) diff --git a/test/decompiler/reference/engine/gfx/texture-h_REF.gc b/test/decompiler/reference/engine/gfx/texture-h_REF.gc index 88f27d1782..f938375936 100644 --- a/test/decompiler/reference/engine/gfx/texture-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/texture-h_REF.gc @@ -334,15 +334,15 @@ (format #t "[~8x] ~A~%" obj 'adgif-shader) (format #t "~Tquad[5] @ #x~X~%" (-> obj quad)) (format #t "~Tprims[10] @ #x~X~%" (-> obj quad)) - (format #t "~Ttex0: #x~X~%" (-> obj quad 0 dword 0)) - (format #t "~Ttex1: #x~X~%" (-> obj quad 1 dword 0)) - (format #t "~Tmiptbp1: #x~X~%" (-> obj quad 2 dword 0)) - (format #t "~Tclamp: #x~X~%" (-> obj quad 3 dword 0)) - (format #t "~Tclamp-reg: ~D~%" (-> obj quad 3 dword 1)) - (format #t "~Talpha: #x~X~%" (-> obj quad 4 dword 0)) - (format #t "~Tlink-test: ~D~%" (-> obj quad 0 data 2)) - (format #t "~Ttexture-id: ~D~%" (-> obj quad 1 data 2)) - (format #t "~Tnext: #x~X~%" (-> obj quad 2 data 2)) + (format #t "~Ttex0: #x~X~%" (-> obj tex0)) + (format #t "~Ttex1: #x~X~%" (-> obj tex1)) + (format #t "~Tmiptbp1: #x~X~%" (-> obj miptbp1)) + (format #t "~Tclamp: #x~X~%" (-> obj clamp)) + (format #t "~Tclamp-reg: ~D~%" (-> obj clamp-reg)) + (format #t "~Talpha: #x~X~%" (-> obj alpha)) + (format #t "~Tlink-test: ~D~%" (-> obj link-test)) + (format #t "~Ttexture-id: ~D~%" (-> obj texture-id)) + (format #t "~Tnext: #x~X~%" (-> obj next)) obj ) diff --git a/test/decompiler/reference/engine/gfx/tfrag/subdivide-h_REF.gc b/test/decompiler/reference/engine/gfx/tfrag/subdivide-h_REF.gc index 2f4782f9dc..0ff6bc2607 100644 --- a/test/decompiler/reference/engine/gfx/tfrag/subdivide-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/tfrag/subdivide-h_REF.gc @@ -62,7 +62,7 @@ (format #t "~Tdata[32] @ #x~X~%" (-> obj data)) (format #t "~Tvector[8] @ #x~X~%" (-> obj data)) (format #t "~Tk0s[4] @ #x~X~%" (-> obj data)) - (format #t "~Tk1s[4] @ #x~X~%" (&-> obj data 16)) + (format #t "~Tk1s[4] @ #x~X~%" (-> obj k1s)) obj ) @@ -83,10 +83,10 @@ (defmethod inspect gs-packed-rgba ((obj gs-packed-rgba)) (format #t "[~8x] ~A~%" obj 'gs-packed-rgba) (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) - (format #t "~Tred: ~D~%" (-> obj data 0)) - (format #t "~Tgreen: ~D~%" (-> obj data 1)) - (format #t "~Tblue: ~D~%" (-> obj data 2)) - (format #t "~Talpha: ~D~%" (-> obj data 3)) + (format #t "~Tred: ~D~%" (-> obj red)) + (format #t "~Tgreen: ~D~%" (-> obj green)) + (format #t "~Tblue: ~D~%" (-> obj blue)) + (format #t "~Talpha: ~D~%" (-> obj alpha)) obj ) @@ -109,10 +109,10 @@ (defmethod inspect gs-packed-xyzw ((obj gs-packed-xyzw)) (format #t "[~8x] ~A~%" obj 'gs-packed-xyzw) (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) - (format #t "~Tz: ~D~%" (-> obj data 2)) - (format #t "~Tw: ~D~%" (-> obj data 3)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) + (format #t "~Tz: ~D~%" (-> obj z)) + (format #t "~Tw: ~D~%" (-> obj w)) (format #t "~Tquad: ~D~%" (-> obj quad)) obj ) @@ -135,9 +135,9 @@ (defmethod inspect gs-packed-stq ((obj gs-packed-stq)) (format #t "[~8x] ~A~%" obj 'gs-packed-stq) (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) - (format #t "~Ttex-s: ~f~%" (-> obj data 0)) - (format #t "~Ttex-t: ~f~%" (-> obj data 1)) - (format #t "~Ttex-q: ~f~%" (-> obj data 2)) + (format #t "~Ttex-s: ~f~%" (-> obj tex-s)) + (format #t "~Ttex-t: ~f~%" (-> obj tex-t)) + (format #t "~Ttex-q: ~f~%" (-> obj tex-q)) (format #t "~Tquad: ~D~%" (-> obj quad)) obj ) diff --git a/test/decompiler/reference/engine/gfx/tfrag/tfrag-h_REF.gc b/test/decompiler/reference/engine/gfx/tfrag/tfrag-h_REF.gc index bf13aed127..eca5148c88 100644 --- a/test/decompiler/reference/engine/gfx/tfrag/tfrag-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/tfrag/tfrag-h_REF.gc @@ -95,12 +95,12 @@ (format #t "~Tcolor-indices: #x~X~%" (-> obj color-indices)) (format #t "~Tcolors: #x~X~%" (-> obj color-indices)) (format #t "~Tdma-chain[3] @ #x~X~%" (-> obj dma-chain)) - (format #t "~Tdma-common: #x~X~%" (-> obj dma-chain 0)) - (format #t "~Tdma-level-0: #x~X~%" (-> obj dma-chain 0)) - (format #t "~Tdma-base: #x~X~%" (-> obj dma-chain 1)) - (format #t "~Tdma-level-1: #x~X~%" (-> obj dma-chain 2)) + (format #t "~Tdma-common: #x~X~%" (-> obj dma-common)) + (format #t "~Tdma-level-0: #x~X~%" (-> obj dma-common)) + (format #t "~Tdma-base: #x~X~%" (-> obj dma-base)) + (format #t "~Tdma-level-1: #x~X~%" (-> obj dma-level-1)) (format #t "~Tdma-qwc[4] @ #x~X~%" (-> obj dma-qwc)) - (format #t "~Tshader: #x~X~%" (-> obj dma-qwc 1)) + (format #t "~Tshader: #x~X~%" (-> obj shader)) (format #t "~Tnum-shaders: ~D~%" (-> obj num-shaders)) (format #t "~Tnum-base-colors: ~D~%" (-> obj num-base-colors)) (format #t "~Tnum-level0-colors: ~D~%" (-> obj num-level0-colors)) @@ -199,7 +199,7 @@ (format #t "~Tdata[16] @ #x~X~%" (-> obj data)) (format #t "~Tvector[4] @ #x~X~%" (-> obj data)) (format #t "~Tk0s[2] @ #x~X~%" (-> obj data)) - (format #t "~Tk1s[2] @ #x~X~%" (&-> obj data 8)) + (format #t "~Tk1s[2] @ #x~X~%" (-> obj k1s)) obj ) @@ -232,18 +232,18 @@ (format #t "~Tdata[56] @ #x~X~%" (-> obj data)) (format #t "~Tvector[14] @ #x~X~%" (-> obj data)) (format #t "~Tfog: #~%" (-> obj data)) - (format #t "~Tval: #~%" (&-> obj data 4)) - (format #t "~Tstrgif: #~%" (&-> obj data 8)) - (format #t "~Tfangif: #~%" (&-> obj data 12)) - (format #t "~Tadgif: #~%" (&-> obj data 16)) - (format #t "~Thvdf-offset: #~%" (&-> obj data 20)) - (format #t "~Thmge-scale: #~%" (&-> obj data 24)) - (format #t "~Tinvh-scale: #~%" (&-> obj data 28)) - (format #t "~Tambient: #~%" (&-> obj data 32)) - (format #t "~Tguard: #~%" (&-> obj data 36)) - (format #t "~Tdists: #~%" (&-> obj data 40)) - (format #t "~Tk0s[2] @ #x~X~%" (&-> obj data 40)) - (format #t "~Tk1s[2] @ #x~X~%" (&-> obj data 48)) + (format #t "~Tval: #~%" (-> obj val)) + (format #t "~Tstrgif: #~%" (-> obj strgif)) + (format #t "~Tfangif: #~%" (-> obj fangif)) + (format #t "~Tadgif: #~%" (-> obj adgif)) + (format #t "~Thvdf-offset: #~%" (-> obj hvdf-offset)) + (format #t "~Thmge-scale: #~%" (-> obj hmge-scale)) + (format #t "~Tinvh-scale: #~%" (-> obj invh-scale)) + (format #t "~Tambient: #~%" (-> obj ambient)) + (format #t "~Tguard: #~%" (-> obj guard)) + (format #t "~Tdists: #~%" (-> obj dists)) + (format #t "~Tk0s[2] @ #x~X~%" (-> obj dists)) + (format #t "~Tk1s[2] @ #x~X~%" (-> obj dists k1s)) obj ) diff --git a/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc b/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc index 63ffba07ca..76009b8778 100644 --- a/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc +++ b/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc @@ -16,14 +16,14 @@ (let ((s4-1 (-> s4-0 envmap-shader))) (when (nonzero? s4-1) (adgif-shader-login-no-remap s4-1) - (set! (-> s4-1 quad 1 dword 0) (the-as uint 96)) - (set! (-> s4-1 quad 3 dword 0) (the-as uint 5)) - (set! (-> s4-1 quad 4 dword 0) (the-as uint 88)) - (set! (-> s4-1 quad 0 dword 1) (the-as uint 6)) - (set! (-> s4-1 quad 1 dword 1) (the-as uint 20)) - (set! (-> s4-1 quad 2 dword 1) (the-as uint 52)) - (set! (-> s4-1 quad 3 dword 1) (the-as uint 8)) - (set! (-> s4-1 quad 4 dword 1) (the-as uint 66)) + (set! (-> s4-1 tex1) (the-as uint 96)) + (set! (-> s4-1 clamp) (the-as uint 5)) + (set! (-> s4-1 alpha) (the-as uint 88)) + (set! (-> s4-1 prims 1) (the-as uint 6)) + (set! (-> s4-1 prims 3) (the-as uint 20)) + (set! (-> s4-1 prims 5) (the-as uint 52)) + (set! (-> s4-1 clamp-reg) (the-as uint 8)) + (set! (-> s4-1 prims 9) (the-as uint 66)) ) ) ) @@ -168,7 +168,3 @@ ) obj ) - - - - diff --git a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc index ba92e459c9..ef50bc4a70 100644 --- a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc @@ -74,10 +74,10 @@ (format #t "~Tbottom-height: (meters ~m)~%" (-> obj bottom-height)) (format #t "~Theight: (meters ~m)~%" (-> obj height)) (format #t "~Theight-offset[4] @ #x~X~%" (-> obj height-offset)) - (format #t "~Treal-ocean-offset: (meters ~m)~%" (-> obj height-offset 0)) - (format #t "~Tocean-offset: (meters ~m)~%" (-> obj height-offset 1)) - (format #t "~Tbob-offset: (meters ~m)~%" (-> obj height-offset 2)) - (format #t "~Talign-offset: (meters ~m)~%" (-> obj height-offset 3)) + (format #t "~Treal-ocean-offset: (meters ~m)~%" (-> obj real-ocean-offset)) + (format #t "~Tocean-offset: (meters ~m)~%" (-> obj ocean-offset)) + (format #t "~Tbob-offset: (meters ~m)~%" (-> obj bob-offset)) + (format #t "~Talign-offset: (meters ~m)~%" (-> obj align-offset)) (format #t "~Tswim-depth: (meters ~m)~%" (-> obj swim-depth)) (format #t "~Tbob: #~%" (-> obj bob)) (format #t "~Tvolume: ~D~%" (-> obj volume)) diff --git a/test/decompiler/reference/engine/level/level-h_REF.gc b/test/decompiler/reference/engine/level/level-h_REF.gc index e64cc550df..91a8f24d94 100644 --- a/test/decompiler/reference/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/engine/level/level-h_REF.gc @@ -87,9 +87,9 @@ (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~Tname-list[3] @ #x~X~%" (-> obj name-list)) (format #t "~Tindex: ~D~%" (-> obj index)) - (format #t "~Tname: ~A~%" (-> obj name-list 0)) - (format #t "~Tvisname: ~A~%" (-> obj name-list 1)) - (format #t "~Tnickname: ~A~%" (-> obj name-list 2)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tvisname: ~A~%" (-> obj visname)) + (format #t "~Tnickname: ~A~%" (-> obj nickname)) (format #t "~Tpackages: ~A~%" (-> obj packages)) (format #t "~Tsound-banks: ~A~%" (-> obj sound-banks)) (format #t "~Tmusic-bank: ~A~%" (-> obj music-bank)) diff --git a/test/decompiler/reference/engine/math/matrix_REF.gc b/test/decompiler/reference/engine/math/matrix_REF.gc index ae11d6d5a5..11b92f81a0 100644 --- a/test/decompiler/reference/engine/math/matrix_REF.gc +++ b/test/decompiler/reference/engine/math/matrix_REF.gc @@ -223,15 +223,15 @@ (defun vector3s-matrix*! ((dst vector3s) (vec vector3s) (mat matrix)) (let ((temp-vec3 (new-stack-vector0))) (let ((v1-0 temp-vec3)) - (set! (-> v1-0 x) (-> vec data 0)) - (set! (-> v1-0 y) (-> vec data 1)) - (set! (-> v1-0 z) (-> vec data 2)) + (set! (-> v1-0 x) (-> vec x)) + (set! (-> v1-0 y) (-> vec y)) + (set! (-> v1-0 z) (-> vec z)) (set! (-> v1-0 w) 1.0) ) (vector-matrix*! temp-vec3 temp-vec3 mat) - (set! (-> dst data 0) (-> temp-vec3 x)) - (set! (-> dst data 1) (-> temp-vec3 y)) - (set! (-> dst data 2) (-> temp-vec3 z)) + (set! (-> dst x) (-> temp-vec3 x)) + (set! (-> dst y) (-> temp-vec3 y)) + (set! (-> dst z) (-> temp-vec3 z)) ) dst ) @@ -241,15 +241,15 @@ (defun vector3s-rotate*! ((dst vector3s) (vec vector3s) (mat matrix)) (let ((temp-vec3 (new-stack-vector0))) (let ((v1-0 temp-vec3)) - (set! (-> v1-0 x) (-> vec data 0)) - (set! (-> v1-0 y) (-> vec data 1)) - (set! (-> v1-0 z) (-> vec data 2)) + (set! (-> v1-0 x) (-> vec x)) + (set! (-> v1-0 y) (-> vec y)) + (set! (-> v1-0 z) (-> vec z)) (set! (-> v1-0 w) 1.0) ) (vector-rotate*! temp-vec3 temp-vec3 mat) - (set! (-> dst data 0) (-> temp-vec3 x)) - (set! (-> dst data 1) (-> temp-vec3 y)) - (set! (-> dst data 2) (-> temp-vec3 z)) + (set! (-> dst x) (-> temp-vec3 x)) + (set! (-> dst y) (-> temp-vec3 y)) + (set! (-> dst z) (-> temp-vec3 z)) ) dst ) diff --git a/test/decompiler/reference/engine/math/vector-h_REF.gc b/test/decompiler/reference/engine/math/vector-h_REF.gc index 18409cd3d7..a0ee1b7e62 100644 --- a/test/decompiler/reference/engine/math/vector-h_REF.gc +++ b/test/decompiler/reference/engine/math/vector-h_REF.gc @@ -125,10 +125,10 @@ (defmethod inspect vector4ub ((obj vector4ub)) (format #t "[~8x] ~A~%" obj 'vector4ub) (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) - (format #t "~Tz: ~D~%" (-> obj data 2)) - (format #t "~Tw: ~D~%" (-> obj data 3)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) + (format #t "~Tz: ~D~%" (-> obj z)) + (format #t "~Tw: ~D~%" (-> obj w)) (format #t "~Tclr: ~D~%" (-> obj clr)) obj ) @@ -150,10 +150,10 @@ (defmethod inspect vector4b ((obj vector4b)) (format #t "[~8x] ~A~%" obj 'vector4b) (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) - (format #t "~Tz: ~D~%" (-> obj data 2)) - (format #t "~Tw: ~D~%" (-> obj data 3)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) + (format #t "~Tz: ~D~%" (-> obj z)) + (format #t "~Tw: ~D~%" (-> obj w)) obj ) @@ -173,8 +173,8 @@ (defmethod inspect vector2h ((obj vector2h)) (format #t "[~8x] ~A~%" obj 'vector2h) (format #t "~Tdata[2] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) obj ) @@ -195,8 +195,8 @@ (defmethod inspect vector2uh ((obj vector2uh)) (format #t "[~8x] ~A~%" obj 'vector2uh) (format #t "~Tdata[2] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) (format #t "~Tval: ~D~%" (-> obj val)) obj ) @@ -217,8 +217,8 @@ (defmethod inspect vector3h ((obj vector3h)) (format #t "[~8x] ~A~%" obj 'vector3h) (format #t "~Tdata[2] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) (format #t "~Tz: ~D~%" (-> obj z)) obj ) @@ -239,8 +239,8 @@ (defmethod inspect vector2w ((obj vector2w)) (format #t "[~8x] ~A~%" obj 'vector2w) (format #t "~Tdata[2] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) obj ) @@ -388,10 +388,10 @@ (defmethod inspect vector4h ((obj vector4h)) (format #t "[~8x] ~A~%" obj 'vector4h) (format #t "~Tdata[4] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~D~%" (-> obj data 0)) - (format #t "~Ty: ~D~%" (-> obj data 1)) - (format #t "~Tz: ~D~%" (-> obj data 2)) - (format #t "~Tw: ~D~%" (-> obj data 3)) + (format #t "~Tx: ~D~%" (-> obj x)) + (format #t "~Ty: ~D~%" (-> obj y)) + (format #t "~Tz: ~D~%" (-> obj z)) + (format #t "~Tw: ~D~%" (-> obj w)) (format #t "~Tlong: ~D~%" (-> obj long)) obj ) @@ -658,7 +658,7 @@ (format #t "~Tquad[2] @ #x~X~%" (-> obj data)) (format #t "~Tvector[2] @ #x~X~%" (-> obj data)) (format #t "~Tmin: #~%" (-> obj data)) - (format #t "~Tmax: #~%" (&-> obj data 4)) + (format #t "~Tmax: #~%" (-> obj max)) obj ) @@ -815,9 +815,9 @@ (defmethod inspect vector3s ((obj vector3s)) (format #t "[~8x] ~A~%" obj 'vector3s) (format #t "~Tdata[3] @ #x~X~%" (-> obj data)) - (format #t "~Tx: ~f~%" (-> obj data 0)) - (format #t "~Ty: ~f~%" (-> obj data 1)) - (format #t "~Tz: ~f~%" (-> obj data 2)) + (format #t "~Tx: ~f~%" (-> obj x)) + (format #t "~Ty: ~f~%" (-> obj y)) + (format #t "~Tz: ~f~%" (-> obj z)) obj ) @@ -963,7 +963,3 @@ ;; definition for symbol *zero-vector*, type vector (define *zero-vector* (new 'static 'vector)) - - - - diff --git a/test/decompiler/reference/engine/ps2/memcard-h_REF.gc b/test/decompiler/reference/engine/ps2/memcard-h_REF.gc index 506f0a27ae..7810b5c69c 100644 --- a/test/decompiler/reference/engine/ps2/memcard-h_REF.gc +++ b/test/decompiler/reference/engine/ps2/memcard-h_REF.gc @@ -32,11 +32,11 @@ (format #t "~Tpresent: ~D~%" (-> obj present)) (format #t "~Tblind-data[16] @ #x~X~%" (-> obj blind-data)) (format #t "~Tblind-data-int8[64] @ #x~X~%" (-> obj blind-data)) - (format #t "~Tlevel-index: ~D~%" (-> obj blind-data 0)) - (format #t "~Tfuel-cell-count: ~f~%" (-> obj blind-data 1)) - (format #t "~Tmoney-count: ~f~%" (-> obj blind-data 2)) - (format #t "~Tbuzzer-count: ~f~%" (-> obj blind-data 3)) - (format #t "~Tcompletion-percentage: ~f~%" (-> obj blind-data 4)) + (format #t "~Tlevel-index: ~D~%" (-> obj level-index)) + (format #t "~Tfuel-cell-count: ~f~%" (-> obj fuel-cell-count)) + (format #t "~Tmoney-count: ~f~%" (-> obj money-count)) + (format #t "~Tbuzzer-count: ~f~%" (-> obj buzzer-count)) + (format #t "~Tcompletion-percentage: ~f~%" (-> obj completion-percentage)) (format #t "~Tminute: #x~X~%" (-> obj minute)) (format #t "~Thour: #x~X~%" (-> obj hour)) (format #t "~Tweek: #x~X~%" (-> obj week)) diff --git a/test/decompiler/reference/engine/sound/gsound-h_REF.gc b/test/decompiler/reference/engine/sound/gsound-h_REF.gc index aacce6cb6d..ce77d455c0 100644 --- a/test/decompiler/reference/engine/sound/gsound-h_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound-h_REF.gc @@ -617,63 +617,95 @@ (defmethod inspect sound-rpc-union ((obj sound-rpc-union)) (format #t "[~8x] ~A~%" obj 'sound-rpc-union) (format #t "~Tdata[20] @ #x~X~%" (-> obj data)) - (format #t "~Tload-bank: #~%" (-> obj data 0)) - (format #t "~Tunload-bank: #~%" (-> obj data 0)) - (format #t "~Tplay: #~%" (-> obj data 0)) - (format #t "~Tpause-sound: #~%" (-> obj data 0)) - (format #t "~Tstop-sound: #~%" (-> obj data 0)) + (format #t "~Tload-bank: #~%" (-> obj load-bank)) + (format + #t + "~Tunload-bank: #~%" + (-> obj load-bank) + ) + (format #t "~Tplay: #~%" (-> obj load-bank)) + (format + #t + "~Tpause-sound: #~%" + (-> obj load-bank) + ) + (format + #t + "~Tstop-sound: #~%" + (-> obj load-bank) + ) (format #t "~Tcontinue-sound: #~%" - (-> obj data 0) + (-> obj load-bank) ) - (format #t "~Tset-param: #~%" (-> obj data 0)) + (format #t "~Tset-param: #~%" (-> obj load-bank)) (format #t "~Tset-master-volume: #~%" - (-> obj data 0) + (-> obj load-bank) + ) + (format + #t + "~Tpause-group: #~%" + (-> obj load-bank) + ) + (format + #t + "~Tstop-group: #~%" + (-> obj load-bank) ) - (format #t "~Tpause-group: #~%" (-> obj data 0)) - (format #t "~Tstop-group: #~%" (-> obj data 0)) (format #t "~Tcontinue-group: #~%" - (-> obj data 0) + (-> obj load-bank) ) (format #t "~Tget-irx-version: #~%" - (-> obj data 0) + (-> obj load-bank) ) (format #t "~Tset-falloff-curve: #~%" - (-> obj data 0) + (-> obj load-bank) ) (format #t "~Tset-sound-falloff: #~%" - (-> obj data 0) + (-> obj load-bank) + ) + (format + #t + "~Treload-info: #~%" + (-> obj load-bank) ) - (format #t "~Treload-info: #~%" (-> obj data 0)) (format #t "~Tset-language: #~%" - (-> obj data 0) + (-> obj load-bank) + ) + (format + #t + "~Tset-reverb: #~%" + (-> obj load-bank) ) - (format #t "~Tset-reverb: #~%" (-> obj data 0)) (format #t "~Tset-ear-trans: #~%" - (-> obj data 0) + (-> obj load-bank) + ) + (format #t "~Tset-flava: #~%" (-> obj load-bank)) + (format #t "~Tshutdown: #~%" (-> obj load-bank)) + (format + #t + "~Tlist-sounds: #~%" + (-> obj load-bank) ) - (format #t "~Tset-flava: #~%" (-> obj data 0)) - (format #t "~Tshutdown: #~%" (-> obj data 0)) - (format #t "~Tlist-sounds: #~%" (-> obj data 0)) (format #t "~Tunload-music: #~%" - (-> obj data 0) + (-> obj load-bank) ) obj ) diff --git a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc index 74689b81af..73afb5e7d9 100644 --- a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc +++ b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc @@ -404,7 +404,7 @@ (a0-5 (new 'stack-no-clear 'vector)) ) (let ((v1-6 (-> gp-0 target)) - (a1-5 (-> csp bone transform vector 3)) + (a1-5 (-> csp bone position)) ) (.lvf vf4 (&-> v1-6 quad)) (.lvf vf5 (&-> a1-5 quad)) diff --git a/test/decompiler/reference/engine/target/target-h_REF.gc b/test/decompiler/reference/engine/target/target-h_REF.gc index 6f38ae740a..5dbbbf4eea 100644 --- a/test/decompiler/reference/engine/target/target-h_REF.gc +++ b/test/decompiler/reference/engine/target/target-h_REF.gc @@ -52,17 +52,21 @@ (format #t "~T~Tcam-user-mode: ~A~%" (-> obj cam-user-mode)) (format #t "~T~Tsidekick: #x~X~%" (-> obj sidekick)) (format #t "~T~Tmanipy: #x~X~%" (-> obj manipy)) - (format #t "~T~Tattack-info: #~%" (&-> obj stack 112)) - (format #t "~T~Tattack-info-rec: #~%" (&-> obj stack 224)) + (format #t "~T~Tattack-info: #~%" (-> obj attack-info)) + (format + #t + "~T~Tattack-info-rec: #~%" + (-> obj attack-info-rec) + ) (format #t "~T~Tanim-seed: ~D~%" (-> obj anim-seed)) - (format #t "~T~Talt-cam-pos: ~`vector`P~%" (&-> obj stack 336)) + (format #t "~T~Talt-cam-pos: ~`vector`P~%" (-> obj alt-cam-pos)) (format #t "~T~Tsnowball: ~A~%" (-> obj snowball)) (format #t "~T~Ttube: ~A~%" (-> obj tube)) (format #t "~T~Tflut: ~A~%" (-> obj flut)) (format #t "~T~Tcurrent-level: ~A~%" (-> obj current-level)) - (format #t "~T~Tsaved-pos: #~%" (&-> obj stack 368)) + (format #t "~T~Tsaved-pos: #~%" (-> obj saved-pos)) (format #t "~T~Tsaved-owner: ~D~%" (-> obj saved-owner)) - (format #t "~T~Talt-neck-pos: ~`vector`P~%" (&-> obj stack 432)) + (format #t "~T~Talt-neck-pos: ~`vector`P~%" (-> obj alt-neck-pos)) (format #t "~T~Tfp-hud: ~D~%" (-> obj fp-hud)) (format #t "~T~Tno-load-wait: ~D~%" (-> obj no-load-wait)) (format #t "~T~Tno-look-around-wait: ~D~%" (-> obj no-look-around-wait)) diff --git a/test/decompiler/reference/engine/ui/hud-h_REF.gc b/test/decompiler/reference/engine/ui/hud-h_REF.gc index c124fe0c7c..aaebeabba2 100644 --- a/test/decompiler/reference/engine/ui/hud-h_REF.gc +++ b/test/decompiler/reference/engine/ui/hud-h_REF.gc @@ -126,10 +126,10 @@ (format #t "~T~Ttrigger-time: ~D~%" (-> obj trigger-time)) (format #t "~T~Tlast-hide-time: ~D~%" (-> obj last-hide-time)) (format #t "~T~Tnb-of-icons: ~D~%" (-> obj nb-of-icons)) - (format #t "~T~Ticons[6] @ #x~X~%" (&-> obj stack 108)) + (format #t "~T~Ticons[6] @ #x~X~%" (-> obj icons)) (format #t "~T~Tmax-nb-of-particles: ~D~%" (-> obj max-nb-of-particles)) (format #t "~T~Tnb-of-particles: ~D~%" (-> obj nb-of-particles)) - (format #t "~T~Tparticles[7] @ #x~X~%" (&-> obj stack 140)) + (format #t "~T~Tparticles[7] @ #x~X~%" (-> obj particles)) obj ) diff --git a/test/decompiler/reference/engine/ui/progress-h_REF.gc b/test/decompiler/reference/engine/ui/progress-h_REF.gc index a9a6e51468..98915e4bd4 100644 --- a/test/decompiler/reference/engine/ui/progress-h_REF.gc +++ b/test/decompiler/reference/engine/ui/progress-h_REF.gc @@ -289,15 +289,15 @@ (-> obj last-option-index-change) ) (format #t "~T~Tvideo-mode-timeout: ~D~%" (-> obj video-mode-timeout)) - (format #t "~T~Tdisplay-state-stack[5] @ #x~X~%" (&-> obj stack 200)) - (format #t "~T~Toption-index-stack[5] @ #x~X~%" (&-> obj stack 240)) + (format #t "~T~Tdisplay-state-stack[5] @ #x~X~%" (-> obj display-state-stack)) + (format #t "~T~Toption-index-stack[5] @ #x~X~%" (-> obj option-index-stack)) (format #t "~T~Tdisplay-state-pos: ~D~%" (-> obj display-state-pos)) (format #t "~T~Tnb-of-icons: ~D~%" (-> obj nb-of-icons)) - (format #t "~T~Ticons[6] @ #x~X~%" (&-> obj stack 268)) + (format #t "~T~Ticons[6] @ #x~X~%" (-> obj icons)) (format #t "~T~Tmax-nb-of-particles: ~D~%" (-> obj max-nb-of-particles)) (format #t "~T~Tnb-of-particles: ~D~%" (-> obj nb-of-particles)) - (format #t "~T~Tparticles[40] @ #x~X~%" (&-> obj stack 300)) - (format #t "~T~Tparticle-state[40] @ #x~X~%" (&-> obj stack 460)) + (format #t "~T~Tparticles[40] @ #x~X~%" (-> obj particles)) + (format #t "~T~Tparticle-state[40] @ #x~X~%" (-> obj particle-state)) obj ) @@ -310,7 +310,3 @@ ;; failed to figure out what this is: (let ((v0-12 0)) ) - - - - diff --git a/test/decompiler/reference/levels/beach/air-h_REF.gc b/test/decompiler/reference/levels/beach/air-h_REF.gc index 63f2302622..5f7498abdb 100644 --- a/test/decompiler/reference/levels/beach/air-h_REF.gc +++ b/test/decompiler/reference/levels/beach/air-h_REF.gc @@ -21,28 +21,28 @@ (defmethod inspect air-box ((obj air-box)) (format #t "[~8x] ~A~%" obj 'air-box) (format #t "~Tvecs[2] @ #x~X~%" (-> obj vecs)) - (format #t "~Tx-pos: ~f~%" (the-as float (-> obj vecs 0 x))) - (format #t "~Theight-level: ~f~%" (the-as float (-> obj vecs 0 y))) - (format #t "~Tz-pos: ~f~%" (the-as float (-> obj vecs 0 z))) - (format #t "~Tcos-angle: ~f~%" (-> obj vecs 0 w)) - (format #t "~Tx-length: ~f~%" (-> obj vecs 1 x)) - (format #t "~Tz-length: ~f~%" (-> obj vecs 1 z)) - (format #t "~Tsin-angle: ~f~%" (-> obj vecs 1 w)) + (format #t "~Tx-pos: ~f~%" (the-as float (-> obj x-pos))) + (format #t "~Theight-level: ~f~%" (the-as float (-> obj height-level))) + (format #t "~Tz-pos: ~f~%" (the-as float (-> obj z-pos))) + (format #t "~Tcos-angle: ~f~%" (-> obj cos-angle)) + (format #t "~Tx-length: ~f~%" (-> obj x-length)) + (format #t "~Tz-length: ~f~%" (-> obj z-length)) + (format #t "~Tsin-angle: ~f~%" (-> obj sin-angle)) obj ) ;; definition for function point-in-air-box-area? (defun point-in-air-box-area? ((arg0 float) (arg1 float) (arg2 air-box)) (let ((v0-0 #f)) - (let ((f0-2 (+ (* arg0 (-> arg2 vecs 0 w)) (* arg1 (-> arg2 vecs 1 w)))) - (f1-5 (- (* arg1 (-> arg2 vecs 0 w)) (* arg0 (-> arg2 vecs 1 w)))) + (let ((f0-2 (+ (* arg0 (-> arg2 cos-angle)) (* arg1 (-> arg2 sin-angle)))) + (f1-5 (- (* arg1 (-> arg2 cos-angle)) (* arg0 (-> arg2 sin-angle)))) ) (if (and (>= f0-2 0.0) (>= f1-5 0.0) - (< f0-2 (-> arg2 vecs 1 x)) - (< f1-5 (-> arg2 vecs 1 z)) + (< f0-2 (-> arg2 x-length)) + (< f1-5 (-> arg2 z-length)) ) (set! v0-0 #t) ) @@ -53,21 +53,21 @@ ;; definition for function point-in-air-box? (defun point-in-air-box? ((arg0 vector) (arg1 air-box)) - (when (< (-> arg1 vecs 0 y) (-> arg0 y)) - (let ((f1-2 (- (-> arg0 x) (the-as float (-> arg1 vecs 0 x)))) - (f2-1 (- (-> arg0 z) (-> arg1 vecs 0 z))) + (when (< (-> arg1 height-level) (-> arg0 y)) + (let ((f1-2 (- (-> arg0 x) (the-as float (-> arg1 x-pos)))) + (f2-1 (- (-> arg0 z) (-> arg1 z-pos))) (v1-0 arg1) (v0-0 #f) ) - (let ((f0-5 (+ (* f1-2 (-> v1-0 vecs 0 w)) (* f2-1 (-> v1-0 vecs 1 w)))) - (f1-4 (- (* f2-1 (-> v1-0 vecs 0 w)) (* f1-2 (-> v1-0 vecs 1 w)))) + (let ((f0-5 (+ (* f1-2 (-> v1-0 cos-angle)) (* f2-1 (-> v1-0 sin-angle)))) + (f1-4 (- (* f2-1 (-> v1-0 cos-angle)) (* f1-2 (-> v1-0 sin-angle)))) ) (if (and (>= f0-5 0.0) (>= f1-4 0.0) - (< f0-5 (-> v1-0 vecs 1 x)) - (< f1-4 (-> v1-0 vecs 1 z)) + (< f0-5 (-> v1-0 x-length)) + (< f1-4 (-> v1-0 z-length)) ) (set! v0-0 #t) ) @@ -80,7 +80,3 @@ ;; failed to figure out what this is: (let ((v0-2 0)) ) - - - - diff --git a/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc b/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc index 59c67dd10b..961774512f 100644 --- a/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc +++ b/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc @@ -233,11 +233,15 @@ (let ((t9-0 (method-of-type process-drawable inspect))) (t9-0 obj) ) - (format #t "~T~Thit-from-dir: ~`vector`P~%" (&-> obj stack 64)) - (format #t "~T~Tevent-param-point: ~`vector`P~%" (&-> obj stack 80)) - (format #t "~T~Tfrustration-point: ~`vector`P~%" (&-> obj stack 96)) - (format #t "~T~Tjump-dest: ~`vector`P~%" (&-> obj stack 112)) - (format #t "~T~Tjump-trajectory: #~%" (&-> obj stack 128)) + (format #t "~T~Thit-from-dir: ~`vector`P~%" (-> obj hit-from-dir)) + (format #t "~T~Tevent-param-point: ~`vector`P~%" (-> obj event-param-point)) + (format #t "~T~Tfrustration-point: ~`vector`P~%" (-> obj frustration-point)) + (format #t "~T~Tjump-dest: ~`vector`P~%" (-> obj jump-dest)) + (format + #t + "~T~Tjump-trajectory: #~%" + (-> obj jump-trajectory) + ) (format #t "~T~Tjump-time: ~D~%" (-> obj jump-time)) (format #t "~T~Tnav-info: ~A~%" (-> obj nav-info)) (format #t "~T~Ttarget-speed: ~f~%" (-> obj target-speed)) @@ -263,7 +267,3 @@ ;; failed to figure out what this is: (let ((v0-4 0)) ) - - - -