From b70fcb2f7a7ed8acd370f714e8d01ca6cc821ffb Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:07:21 -0400 Subject: [PATCH] support non-virtual gos in decompiler (#707) --- common/CMakeLists.txt | 1 + common/type_system/state.cpp | 15 ++ common/type_system/state.h | 9 + decompiler/IR2/AtomicOpTypeAnalysis.cpp | 34 +++- decompiler/IR2/FormExpressionAnalysis.cpp | 79 ++++++- decompiler/config/all-types.gc | 33 +-- .../jak1_ntsc_black_label/type_casts.jsonc | 10 +- .../jak1_ntsc_black_label/var_names.jsonc | 15 +- decompiler/util/DecompilerTypeSystem.cpp | 7 + decompiler/util/TP_Type.cpp | 6 + decompiler/util/TP_Type.h | 9 + goal_src/engine/collide/collide-frag.gc | 32 +-- goal_src/engine/collide/collide-mesh-h.gc | 10 +- goal_src/engine/collide/collide-shape-h.gc | 30 ++- goal_src/engine/collide/collide-target-h.gc | 2 +- goal_src/engine/draw/drawable-actor-h.gc | 2 +- goal_src/engine/draw/drawable-ambient-h.gc | 2 +- goal_src/engine/draw/drawable-h.gc | 10 +- goal_src/engine/draw/drawable-inline-array.gc | 7 +- goal_src/engine/game/fact-h.gc | 96 +++++---- goal_src/engine/game/game-h.gc | 12 +- goal_src/engine/geometry/vol-h.gc | 192 +++++++----------- goal_src/engine/gfx/lights.gc | 9 +- goal_src/engine/level/level.gc | 8 +- goal_src/engine/target/joint-mod-h.gc | 96 ++++----- goal_src/engine/target/pat-h.gc | 3 + goal_src/engine/target/surface-h.gc | 20 +- goal_src/kernel-defs.gc | 4 +- goal_src/kernel/gkernel-h.gc | 2 +- goal_src/kernel/gkernel.gc | 8 +- .../decompiler/reference/decompiler-macros.gc | 9 +- .../reference/engine/anim/aligner-h_REF.gc | 7 +- .../engine/collide/collide-frag_REF.gc | 14 +- .../engine/collide/collide-mesh-h_REF.gc | 16 +- .../engine/collide/collide-shape-h_REF.gc | 86 ++++---- .../engine/collide/collide-target-h_REF.gc | 20 +- .../engine/draw/drawable-actor-h_REF.gc | 2 +- .../engine/draw/drawable-ambient-h_REF.gc | 2 +- .../reference/engine/draw/drawable-h_REF.gc | 4 +- .../engine/draw/drawable-inline-array_REF.gc | 8 +- .../reference/engine/game/fact-h_REF.gc | 169 ++++++++------- .../reference/engine/geometry/vol-h_REF.gc | 181 ++++++++--------- .../reference/engine/gfx/tie/prototype_REF.gc | 6 +- .../reference/engine/nav/navigate-h_REF.gc | 87 ++++---- .../reference/engine/nav/path-h_REF.gc | 109 +++++----- .../engine/target/joint-mod-h_REF.gc | 12 +- .../reference/kernel/gkernel_REF.gc | 13 +- test/decompiler/test_gkernel_decomp.cpp | 49 ++--- 48 files changed, 824 insertions(+), 733 deletions(-) create mode 100644 common/type_system/state.cpp create mode 100644 common/type_system/state.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index fde51701b3..bcf36d3a68 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -12,6 +12,7 @@ add_library(common log/log.cpp type_system/defenum.cpp type_system/deftype.cpp + type_system/state.cpp type_system/Type.cpp type_system/TypeFieldLookup.cpp type_system/TypeSpec.cpp diff --git a/common/type_system/state.cpp b/common/type_system/state.cpp new file mode 100644 index 0000000000..b601df7471 --- /dev/null +++ b/common/type_system/state.cpp @@ -0,0 +1,15 @@ +#include "state.h" + +/*! + * Convert a (state ...) to the function required to go. Must be state. + */ +TypeSpec state_to_go_function(const TypeSpec& state_type) { + assert(state_type.base_type() == "state"); + std::vector arg_types; + for (int i = 0; i < (int)state_type.arg_count() - 1; i++) { + arg_types.push_back(state_type.get_arg(i)); + } + + arg_types.push_back(TypeSpec("none")); // none for the return. + return TypeSpec("function", arg_types); +} \ No newline at end of file diff --git a/common/type_system/state.h b/common/type_system/state.h new file mode 100644 index 0000000000..1d1ebd5f7f --- /dev/null +++ b/common/type_system/state.h @@ -0,0 +1,9 @@ +#pragma once + +#include "common/type_system/TypeSpec.h" + +/*! + * This contains type system utilities related to state and process + */ + +TypeSpec state_to_go_function(const TypeSpec& state_type); diff --git a/decompiler/IR2/AtomicOpTypeAnalysis.cpp b/decompiler/IR2/AtomicOpTypeAnalysis.cpp index dabf071443..9f472e93b1 100644 --- a/decompiler/IR2/AtomicOpTypeAnalysis.cpp +++ b/decompiler/IR2/AtomicOpTypeAnalysis.cpp @@ -5,6 +5,7 @@ #include "decompiler/util/TP_Type.h" #include "decompiler/util/DecompilerTypeSystem.h" #include "decompiler/IR2/bitfields.h" +#include "common/type_system/state.h" namespace decompiler { @@ -81,6 +82,8 @@ TP_Type SimpleAtom::get_type(const TypeState& input, // which actually means that you get the first address in the symbol table. // it's not really a linked symbol, but the basic op builder represents it as one. return TP_Type::make_from_ts(TypeSpec("pointer")); + } else if (m_string == "enter-state") { + return TP_Type::make_enter_state(); } // look up the type of the symbol @@ -798,9 +801,18 @@ TypeState SetVarConditionOp::propagate_types_internal(const TypeState& input, TypeState StoreOp::propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) { + TypeState output = input; + + // look for setting the next state of the current process + IR2_RegOffset ro; + if (get_as_reg_offset(m_addr, &ro)) { + if (ro.reg == Register(Reg::GPR, Reg::S6) && ro.offset == 72) { + output.next_state_type = m_value.get_type(input, env, dts); + } + } (void)env; (void)dts; - return input; + return output; } TP_Type LoadVarOp::get_src_type(const TypeState& input, @@ -1113,6 +1125,26 @@ TypeState CallOp::propagate_types_internal(const TypeState& input, throw std::runtime_error("Called something that was not a function: " + in_type.print()); } + // If we call enter-state, update our type. + if (in_tp.kind == TP_Type::Kind::ENTER_STATE_FUNCTION) { + // this is a GO! + auto state_type = input.next_state_type.typespec(); + if (state_type.base_type() != "state") { + throw std::runtime_error( + fmt::format("At op {}, called enter-state, but the current next-state has type {}, which " + "is not a valid state.", + m_my_idx, input.next_state_type.print())); + } + + if (state_type.arg_count() == 0) { + throw std::runtime_error(fmt::format( + "At op {}, tried to enter-state, but the type of (-> s6 next-state) is just a plain " + "state. The decompiler must know the specific state type.", + m_my_idx)); + } + in_type = state_to_go_function(state_type); + } + if (in_type.arg_count() < 1) { throw std::runtime_error("Called a function, but we do not know its type"); } diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index d65f80958d..84e1735093 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -7,6 +7,7 @@ #include "decompiler/util/data_decompile.h" #include "decompiler/IR2/bitfields.h" #include "common/util/BitUtils.h" +#include "common/type_system/state.h" /* * TODO @@ -2334,6 +2335,34 @@ void AbsElement::update_from_stack(const Env& env, result->push_back(new_form); } +namespace { +/*! + * Try to recognize setting the next state. + */ +Form* get_set_next_state(FormElement* set_elt, const Env& env) { + auto as_set = dynamic_cast(set_elt); + if (!as_set) { + return nullptr; + } + + auto dst = as_set->dst(); + auto dst_matcher = + Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("next-state")}); + auto mr = match(dst_matcher, dst); + if (!mr.matched) { + fmt::print("failed to match dst {}\n", dst->to_string(env)); + return nullptr; + } + + if (mr.maps.regs.at(0)->reg() != Register(Reg::GPR, Reg::S6)) { + fmt::print("failed to match pp reg, got {}\n", mr.maps.regs.at(0)->reg().to_string()); + return nullptr; + } + + return as_set->src(); +} +} // namespace + /////////////////// // FunctionCallElement /////////////////// @@ -2354,11 +2383,42 @@ void FunctionCallElement::update_from_stack(const Env& env, } TypeSpec function_type; - auto& tp_type = env.get_types_before_op(all_pop_vars.at(0).idx()).get(all_pop_vars.at(0).reg()); + auto& in_type_state = env.get_types_before_op(all_pop_vars.at(0).idx()); + auto& tp_type = in_type_state.get(all_pop_vars.at(0).reg()); if (env.has_type_analysis()) { function_type = tp_type.typespec(); } + // if we're actually a go: + Form* go_next_state = nullptr; + if (tp_type.kind == TP_Type::Kind::ENTER_STATE_FUNCTION) { + auto& next_state_type = in_type_state.next_state_type; + if (next_state_type.typespec().base_type() != "state") { + throw std::runtime_error("Bad state type in expressions (not state): " + + next_state_type.print()); + } + if (next_state_type.typespec().arg_count() == 0) { + throw std::runtime_error("Bad state type in expressions (no args): " + + next_state_type.print()); + } + + // modify our type for the go. + function_type = state_to_go_function(next_state_type.typespec()); + + // up next, we need to deal with the + // (set! (-> pp next-state) process-drawable-art-error) + auto stack_back = stack.pop_back(pool); + + auto next_state = get_set_next_state(stack_back, env); + if (!next_state) { + throw std::runtime_error( + fmt::format("Expressions couldn't figure out this go. The back of the stack was {} and " + "we expected to see something set (-> pp next-state) instead.", + stack_back->to_string(env))); + } + go_next_state = next_state; + } + bool swap_function = tp_type.kind == TP_Type::Kind::NON_VIRTUAL_METHOD && all_pop_vars.size() >= 2; if (tp_type.kind == TP_Type::Kind::NON_VIRTUAL_METHOD) { @@ -2410,6 +2470,16 @@ void FunctionCallElement::update_from_stack(const Env& env, FormElement* new_form = nullptr; + if (go_next_state) { + arg_forms.insert(arg_forms.begin(), go_next_state); + auto go_form = pool.alloc_element( + GenericOperator::make_function( + pool.alloc_single_element_form(nullptr, "go")), + arg_forms); + result->push_back(go_form); + return; + } + { // deal with virtual method calls. auto matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::METHOD_OF_OBJECT), @@ -2448,6 +2518,7 @@ void FunctionCallElement::update_from_stack(const Env& env, new_form = pool.alloc_element( GenericOperator::make_function(mr.maps.forms.at(1)), arg_forms); result->push_back(new_form); + assert(!go_next_state); return; } } @@ -2496,6 +2567,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto new_op = pool.alloc_element( GenericOperator::make_fixed(FixedOperatorKind::OBJECT_NEW), new_args); result->push_back(new_op); + assert(!go_next_state); return; } if (name == "new" && type_1 == "type") { @@ -2503,6 +2575,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto new_op = pool.alloc_element( GenericOperator::make_fixed(FixedOperatorKind::TYPE_NEW), new_args); result->push_back(new_op); + assert(!go_next_state); return; } else if (name == "new") { constexpr int allocation = 2; @@ -2538,6 +2611,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto cons_op = pool.alloc_element( GenericOperator::make_fixed(FixedOperatorKind::CONS), cons_args); result->push_back(cons_op); + assert(!go_next_state); return; } else { // just normal construction on the heap @@ -2547,6 +2621,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto new_op = pool.alloc_element( GenericOperator::make_fixed(FixedOperatorKind::NEW), new_args); result->push_back(new_op); + assert(!go_next_state); return; } } @@ -2596,6 +2671,7 @@ void FunctionCallElement::update_from_stack(const Env& env, auto gop = GenericOperator::make_function(method_op); result->push_back(pool.alloc_element(gop, arg_forms)); + assert(!go_next_state); return; } @@ -2633,6 +2709,7 @@ void FunctionCallElement::update_from_stack(const Env& env, } result->push_back(pool.alloc_element( GenericOperator::make_fixed(FixedOperatorKind::NEW), stack_new_args)); + assert(!go_next_state); return; } } diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 66fb25521f..3c304cee86 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -962,13 +962,15 @@ ;; - Types (define-extern process-tree type) ; deftype provided by C Kernel +(declare-type process basic) + (deftype process-tree (basic) ((name basic :offset-assert 4) (mask process-mask :offset-assert 8) (parent (pointer process-tree) :offset-assert 12) (brother (pointer process-tree) :offset-assert 16) (child (pointer process-tree) :offset-assert 20) - (ppointer (pointer process-tree) :offset-assert 24) + (ppointer (pointer process) :offset-assert 24) (self process-tree :offset-assert 28) ) (:methods @@ -5831,8 +5833,8 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 (_type_) _type_ 9) ;; probably login or init. - (dummy-10 (_type_ drawable display-frame) int 10) ;; display-frame is from the method inspect tool + (login (_type_) _type_ 9) ;; probably login or init. + (draw (_type_ drawable display-frame) int 10) ;; display-frame is from the method inspect tool (dummy-11 (_type_ int) none 11) ; int - length (dummy-12 (_type_ int) none 12) ; int - length (dummy-13 (_type_ int) none 13) ; int - length @@ -9654,7 +9656,8 @@ ;; - Symbols -(define-extern process-drawable-art-error state) +(declare-type process-drawable process) +(define-extern process-drawable-art-error (state string process-drawable)) (define-extern *FACT-bank* fact-bank) ;; unknown type @@ -10489,7 +10492,7 @@ ((vertex vector 3 :inline :offset-assert 0) (intersect vector :inline :offset-assert 48) (normal vector :inline :offset-assert 64) - (pat uint32 :offset-assert 80) + (pat pat-surface :offset-assert 80) ) :method-count-assert 9 :size-assert #x54 @@ -10497,9 +10500,9 @@ ) (deftype collide-mesh-tri (structure) - ((vertex-index uint8 3 :offset-assert 0) - (unused uint8 :offset-assert 3) - (pat uint32 :offset-assert 4) + ((vertex-index uint8 3 :offset-assert 0) + (unused uint8 :offset-assert 3) + (pat pat-surface :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -10549,7 +10552,7 @@ ((vertex vector 3 :inline :offset-assert 0) (normal vector :inline :offset-assert 48) (bbox4w bounding-box4w :inline :offset-assert 64) - (pat uint32 :offset 60) + (pat pat-surface :offset 60) ) :method-count-assert 9 :size-assert #x60 @@ -10703,7 +10706,7 @@ ) (deftype collide-shape-prim-sphere (collide-shape-prim) - ((pat uint32 :offset-assert 72) + ((pat pat-surface :offset-assert 72) ) :method-count-assert 28 :size-assert #x4c @@ -10805,7 +10808,7 @@ (max-iteration-count uint8 :offset-assert 144) (nav-flags uint8 :offset-assert 145) (pad-byte uint8 2 :offset-assert 146) - (pat-ignore-mask uint32 :offset-assert 148) + (pat-ignore-mask pat-surface :offset-assert 148) (event-self basic :offset-assert 152) (event-other basic :offset-assert 156) (root-prim basic :offset-assert 160) @@ -10853,9 +10856,9 @@ ((rider-time uint64 :offset-assert 184) (rider-last-move vector :inline :offset-assert 192) (trans-old vector 3 :inline :offset-assert 208) - (poly-pat uint32 :offset-assert 256) - (cur-pat uint32 :offset-assert 260) - (ground-pat uint32 :offset-assert 264) + (poly-pat pat-surface :offset-assert 256) + (cur-pat pat-surface :offset-assert 260) + (ground-pat pat-surface :offset-assert 264) (status uint64 :offset-assert 272) (old-status uint64 :offset-assert 280) (prev-status uint64 :offset-assert 288) @@ -10919,7 +10922,7 @@ (surface-normal vector :inline :offset-assert 80) (time uint64 :offset-assert 96) (status uint64 :offset-assert 104) - (pat uint32 :offset-assert 112) + (pat pat-surface :offset-assert 112) (reaction-flag uint32 :offset-assert 116) ) :method-count-assert 10 diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 8355f7e1e1..a7123bde12 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -544,7 +544,7 @@ "(method 0 fact-info)": [ [81, "v0", "float"], - [16, "t9", "(function string none)"], + //[16, "t9", "(function string none)"], ["_stack_", 16, "res-tag"], [[32, 43], "v1", "(pointer int32)"], [86, "gp", "fact-info"] @@ -553,7 +553,6 @@ "(method 0 fact-info-target)": [[[3, 20], "gp", "fact-info-target"]], "(method 0 align-control)": [ - [[8, 13], "t9", "(function object object)"], [[14, 18], "v0", "align-control"] ], @@ -609,8 +608,7 @@ "(method 11 joint-mod)": [ [15, "s3", "process-drawable"], - [[26, 66], "s3", "fact-info-enemy"], - [[45, 50], "v1", "(pointer process)"] + [[26, 66], "s3", "fact-info-enemy"] ], "joint-mod-look-at-handler": [[[2, 254], "gp", "joint-mod"]], @@ -721,7 +719,6 @@ "actor-link-subtask-complete-hook": [[1, "v1", "entity-links"]], "(method 0 vol-control)": [ - [[9, 14], "t9", "(function object object)"], [30, "s5", "res-lump"], [36, "s5", "res-lump"], [58, "s5", "res-lump"], @@ -747,7 +744,6 @@ "(method 12 art-group)": [[13, "a0", "art-joint-anim"]], "(method 0 path-control)": [ - [15, "t9", "(function string none)"], ["_stack_", 16, "res-tag"] ], @@ -763,8 +759,6 @@ [77, "a0", "entity-links"] ], - "(method 0 nav-control)": [[17, "t9", "(function string none)"]], - "add-debug-point": [ [125, "a3", "pointer"], [[27, 144], "a0", "(pointer uint64)"], diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index abed42d99e..a1a9576b93 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -1840,8 +1840,7 @@ "vars": { "gp-0": ["obj", "fact-info"], "s5-0": "ent", - "sv-16": "tag", - "t9-1": ["go-func", "(function string none)"] + "sv-16": "tag" } }, @@ -1983,8 +1982,7 @@ "vars": { "s1-0": "proc-drawable", "s3-1": ["enemy-facts", "fact-info-enemy"], - "f30-0": "dist", - "v1-12": ["ppointer", "(pointer process)"] + "f30-0": "dist" } }, @@ -2382,5 +2380,14 @@ "sv-32":"load-status", "sv-40":"heap-free" } + }, + + "(method 16 process-drawable)" : { + "vars": { + "s3-0":"body-T-world", + "s0-0":"world-T-body", + "s2-0":"grav-rt-body", + "a1-5":"vel-rt-body" + } } } diff --git a/decompiler/util/DecompilerTypeSystem.cpp b/decompiler/util/DecompilerTypeSystem.cpp index bfb28cecdb..916c8c3187 100644 --- a/decompiler/util/DecompilerTypeSystem.cpp +++ b/decompiler/util/DecompilerTypeSystem.cpp @@ -379,6 +379,13 @@ bool DecompilerTypeSystem::tp_lca(TypeState* combined, const TypeState& add) { } } + bool diff = false; + auto new_type = tp_lca(combined->next_state_type, add.next_state_type, &diff); + if (diff) { + result = true; + combined->next_state_type = new_type; + } + return result; } diff --git a/decompiler/util/TP_Type.cpp b/decompiler/util/TP_Type.cpp index bf6048708c..ffbe5f8909 100644 --- a/decompiler/util/TP_Type.cpp +++ b/decompiler/util/TP_Type.cpp @@ -71,6 +71,8 @@ std::string TP_Type::print() const { return fmt::format("", m_ts.print()); case Kind::LABEL_ADDR: return ""; + case Kind::ENTER_STATE_FUNCTION: + return ""; case Kind::INVALID: default: assert(false); @@ -124,6 +126,7 @@ bool TP_Type::operator==(const TP_Type& other) const { case Kind::PCPYUD_BITFIELD_AND: return m_pcpyud == other.m_pcpyud && m_ts == other.m_ts; case Kind::LABEL_ADDR: + case Kind::ENTER_STATE_FUNCTION: return true; case Kind::INVALID: default: @@ -185,6 +188,9 @@ TypeSpec TP_Type::typespec() const { return TypeSpec("int"); case Kind::LABEL_ADDR: return TypeSpec("pointer"); // ? + case Kind::ENTER_STATE_FUNCTION: + // give a general function so we can't call it normally. + return TypeSpec("function"); case Kind::INVALID: default: assert(false); diff --git a/decompiler/util/TP_Type.h b/decompiler/util/TP_Type.h index 9d0010df38..ce076cdb56 100644 --- a/decompiler/util/TP_Type.h +++ b/decompiler/util/TP_Type.h @@ -36,6 +36,7 @@ class TP_Type { PCPYUD_BITFIELD_AND, LEFT_SHIFTED_BITFIELD, // (bitfield << some-constant) LABEL_ADDR, + ENTER_STATE_FUNCTION, INVALID } kind = Kind::UNINITIALIZED; TP_Type() = default; @@ -65,6 +66,7 @@ class TP_Type { case Kind::PCPYUD_BITFIELD: case Kind::PCPYUD_BITFIELD_AND: case Kind::LABEL_ADDR: + case Kind::ENTER_STATE_FUNCTION: return false; case Kind::UNINITIALIZED: case Kind::OBJECT_NEW_METHOD: @@ -254,6 +256,12 @@ class TP_Type { return result; } + static TP_Type make_enter_state() { + TP_Type result; + result.kind = Kind::ENTER_STATE_FUNCTION; + return result; + } + static TP_Type make_label_addr() { TP_Type result; result.kind = Kind::LABEL_ADDR; @@ -352,6 +360,7 @@ class TypeState { std::unordered_map spill_slots; TP_Type gpr_types[32]; TP_Type fpr_types[32]; + TP_Type next_state_type; std::string print_gpr_masked(u32 mask) const; TP_Type& get(const Register& r) { switch (r.get_kind()) { diff --git a/goal_src/engine/collide/collide-frag.gc b/goal_src/engine/collide/collide-frag.gc index c1ea009aa3..c1d95b5eec 100644 --- a/goal_src/engine/collide/collide-frag.gc +++ b/goal_src/engine/collide/collide-frag.gc @@ -6,21 +6,15 @@ ;; dgos: GAME, ENGINE ;; definition for method 9 of type drawable-tree-collide-fragment -(defmethod - dummy-9 - drawable-tree-collide-fragment - ((obj drawable-tree-collide-fragment)) +(defmethod login drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment)) obj ) ;; definition for method 10 of type drawable-tree-collide-fragment -(defmethod - dummy-10 - drawable-tree-collide-fragment - ((obj drawable-tree-collide-fragment) (arg0 drawable) (arg1 display-frame)) +(defmethod draw drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment) (arg0 drawable) (arg1 display-frame)) (when *display-render-collision* (dotimes (s4-0 (-> obj length)) - (dummy-10 (-> obj data s4-0) (-> obj data s4-0) arg1) + (draw (-> obj data s4-0) (-> obj data s4-0) arg1) ) ) 0 @@ -126,33 +120,21 @@ ) ;; definition for method 9 of type drawable-inline-array-collide-fragment -(defmethod - dummy-9 - drawable-inline-array-collide-fragment - ((obj drawable-inline-array-collide-fragment)) +(defmethod login drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment)) obj ) ;; definition for method 10 of type collide-fragment -(defmethod - dummy-10 - collide-fragment - ((obj collide-fragment) (arg0 drawable) (arg1 display-frame)) +(defmethod draw collide-fragment ((obj collide-fragment) (arg0 drawable) (arg1 display-frame)) 0 ) ;; definition for method 10 of type drawable-inline-array-collide-fragment -(defmethod - dummy-10 - drawable-inline-array-collide-fragment - ((obj drawable-inline-array-collide-fragment) - (arg0 drawable) - (arg1 display-frame) - ) +(defmethod draw drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment) (arg0 drawable) (arg1 display-frame)) (dotimes (s4-0 (-> obj length)) (let ((s3-0 (-> obj data s4-0))) (if (sphere-cull (-> s3-0 bsphere)) - (dummy-10 s3-0 s3-0 arg1) + (draw s3-0 s3-0 arg1) ) ) ) diff --git a/goal_src/engine/collide/collide-mesh-h.gc b/goal_src/engine/collide/collide-mesh-h.gc index 05dfe2958d..4af6ed71cf 100644 --- a/goal_src/engine/collide/collide-mesh-h.gc +++ b/goal_src/engine/collide/collide-mesh-h.gc @@ -9,7 +9,7 @@ ((vertex vector 3 :inline :offset-assert 0) (intersect vector :inline :offset-assert 48) (normal vector :inline :offset-assert 64) - (pat uint32 :offset-assert 80) + (pat pat-surface :offset-assert 80) ) :method-count-assert 9 :size-assert #x54 @@ -17,9 +17,9 @@ ) (deftype collide-mesh-tri (structure) - ((vertex-index uint8 3 :offset-assert 0) - (unused uint8 :offset-assert 3) - (pat uint32 :offset-assert 4) + ((vertex-index uint8 3 :offset-assert 0) + (unused uint8 :offset-assert 3) + (pat pat-surface :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -98,7 +98,7 @@ ((vertex vector 3 :inline :offset-assert 0) (normal vector :inline :offset-assert 48) (bbox4w bounding-box4w :inline :offset-assert 64) - (pat uint32 :offset 60) + (pat pat-surface :offset 60) ) :method-count-assert 9 :size-assert #x60 diff --git a/goal_src/engine/collide/collide-shape-h.gc b/goal_src/engine/collide/collide-shape-h.gc index 3ac61960b2..d8160b7534 100644 --- a/goal_src/engine/collide/collide-shape-h.gc +++ b/goal_src/engine/collide/collide-shape-h.gc @@ -177,7 +177,7 @@ ;; sphere collision ;; the pat is stored directly here. (deftype collide-shape-prim-sphere (collide-shape-prim) - ((pat uint32 :offset-assert 72) + ((pat pat-surface :offset-assert 72) ) :method-count-assert 28 :size-assert #x4c @@ -290,7 +290,7 @@ (max-iteration-count uint8 :offset-assert 144) (nav-flags uint8 :offset-assert 145) (pad-byte uint8 2 :offset-assert 146) - (pat-ignore-mask uint32 :offset-assert 148) + (pat-ignore-mask pat-surface :offset-assert 148) (event-self basic :offset-assert 152) (event-other basic :offset-assert 156) (root-prim basic :offset-assert 160) @@ -339,9 +339,9 @@ ((rider-time uint64 :offset-assert 184) (rider-last-move vector :inline :offset-assert 192) (trans-old vector 3 :inline :offset-assert 208) - (poly-pat uint32 :offset-assert 256) - (cur-pat uint32 :offset-assert 260) - (ground-pat uint32 :offset-assert 264) + (poly-pat pat-surface :offset-assert 256) + (cur-pat pat-surface :offset-assert 260) + (ground-pat pat-surface :offset-assert 264) (status uint64 :offset-assert 272) (old-status uint64 :offset-assert 280) (prev-status uint64 :offset-assert 288) @@ -402,7 +402,7 @@ "Allocate a new sphere primitive" (let ((obj (the collide-shape-prim-sphere ((method-of-type collide-shape-prim new) allocation type-to-make cshape prim-id (size-of collide-shape-prim-mesh))))) - (set! (-> obj pat) #x10) + (set! (-> obj pat) (new 'static 'pat-surface :mode (pat-mode obstacle))) (set! (-> obj prim-core prim-type) -1) obj ) @@ -444,7 +444,7 @@ (defmethod asize-of collide-shape-prim-group ((obj collide-shape-prim-group)) "How big is this in memory?" (the-as int - (+ (-> obj type size) (the-as uint (shl (+ (-> obj allocated-prims) -1) 2))) + (+ (-> obj type size) (the-as uint (* (+ (-> obj allocated-prims) -1) 4))) ) ) @@ -461,12 +461,20 @@ (set! (-> obj root-prim) #f) ;; add a special ignore mask for the camera vs other things. - (case (-> proc type symbol) - (('camera) - (set! (-> obj pat-ignore-mask) #x2) - (set! (-> obj pat-ignore-mask) #x1) + (case (-> proc type symbol) + (('camera) + (set! + (-> obj pat-ignore-mask) + (new 'static 'pat-surface :skip #x2 :nocamera #x1) ) ) + (else + (set! + (-> obj pat-ignore-mask) + (new 'static 'pat-surface :skip #x1 :noentity #x1) + ) + ) + ) ;; reset transformation to the origin. (set! (-> obj trans w) 1.0) diff --git a/goal_src/engine/collide/collide-target-h.gc b/goal_src/engine/collide/collide-target-h.gc index 5e9cea9072..bc1b5ccd4e 100644 --- a/goal_src/engine/collide/collide-target-h.gc +++ b/goal_src/engine/collide/collide-target-h.gc @@ -19,7 +19,7 @@ (surface-normal vector :inline :offset-assert 80) (time uint64 :offset-assert 96) (status uint64 :offset-assert 104) - (pat uint32 :offset-assert 112) + (pat pat-surface :offset-assert 112) (reaction-flag uint32 :offset-assert 116) ) :method-count-assert 10 diff --git a/goal_src/engine/draw/drawable-actor-h.gc b/goal_src/engine/draw/drawable-actor-h.gc index 65e416c612..182aa3fb8d 100644 --- a/goal_src/engine/draw/drawable-actor-h.gc +++ b/goal_src/engine/draw/drawable-actor-h.gc @@ -27,6 +27,6 @@ ) -(defmethod dummy-10 drawable-tree-actor ((obj _type_) (arg0 drawable) (arg1 display-frame)) +(defmethod draw drawable-tree-actor ((obj _type_) (arg0 drawable) (arg1 display-frame)) 0 ) diff --git a/goal_src/engine/draw/drawable-ambient-h.gc b/goal_src/engine/draw/drawable-ambient-h.gc index daec1beeb3..bccfc24f5f 100644 --- a/goal_src/engine/draw/drawable-ambient-h.gc +++ b/goal_src/engine/draw/drawable-ambient-h.gc @@ -31,7 +31,7 @@ :flag-assert #x1200000044 ) -(defmethod dummy-10 drawable-tree-ambient ((obj _type_) (arg0 drawable) (arg1 display-frame)) +(defmethod draw drawable-tree-ambient ((obj _type_) (arg0 drawable) (arg1 display-frame)) 0 ) diff --git a/goal_src/engine/draw/drawable-h.gc b/goal_src/engine/draw/drawable-h.gc index 48514eb616..e65ee8af7f 100644 --- a/goal_src/engine/draw/drawable-h.gc +++ b/goal_src/engine/draw/drawable-h.gc @@ -17,8 +17,8 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 (_type_) _type_ 9) ;; probably login or init. - (dummy-10 (_type_ drawable display-frame) int 10) ;; display-frame is from the method inspect tool + (login (_type_) _type_ 9) ;; probably login or init. + (draw (_type_ drawable display-frame) int 10) ;; display-frame is from the method inspect tool (dummy-11 (_type_ int) none 11) ; int - length (dummy-12 (_type_ int) none 12) ; int - length (dummy-13 (_type_ int) none 13) ; int - length @@ -37,9 +37,5 @@ :flag-assert #x1200000024 ) -;; NOTE - I'm guessing there was a define-extern earlier in the build process -;; This is actually set in process-drawable.gc, but it's used by files earlier in the process -;; assuming (state process-drawable) -(define-extern process-drawable-art-error state) - (declare-type process-drawable process) +(define-extern process-drawable-art-error (state string process-drawable)) \ No newline at end of file diff --git a/goal_src/engine/draw/drawable-inline-array.gc b/goal_src/engine/draw/drawable-inline-array.gc index 60ef6c31f2..6ebb628f99 100644 --- a/goal_src/engine/draw/drawable-inline-array.gc +++ b/goal_src/engine/draw/drawable-inline-array.gc @@ -11,14 +11,11 @@ (-> obj length) ) -(defmethod dummy-9 drawable-inline-array ((obj drawable-inline-array)) +(defmethod login drawable-inline-array ((obj drawable-inline-array)) obj ) -(defmethod - dummy-10 - drawable-inline-array - ((obj drawable-inline-array) (arg0 drawable) (arg1 display-frame)) +(defmethod draw drawable-inline-array ((obj drawable-inline-array) (arg0 drawable) (arg1 display-frame)) 0 ) diff --git a/goal_src/engine/game/fact-h.gc b/goal_src/engine/game/fact-h.gc index b43b2dae1d..5c44304a10 100644 --- a/goal_src/engine/game/fact-h.gc +++ b/goal_src/engine/game/fact-h.gc @@ -149,58 +149,56 @@ the entity of the process automatically. Will attempt to read pickup-type and amount from the entity, but if this fails will use the values in the arguments" (local-vars (tag res-tag)) - (with-pp - ;; allocate. - (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (let ((ent (the res-lump (-> proc entity)))) - ;; confirm that we allocated successfully - (when (zero? obj) - (go process-drawable-art-error "memory") - ;; this is already true... - (set! obj (the-as fact-info 0)) - (goto cfg-10) - ) - - ;; remember who we belong to - (set! (-> obj process) proc) - - ;; eco may override the pickup type and amount, so try to get this. - (let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0))) - (cond - (v1-6 - ;; eco-info lookup succeeded, - (let ((a0-6 (-> tag elt-count))) - ;; first thing is pickup type, it's always there - (set! (-> obj pickup-type) (the-as pickup-type (-> v1-6 0))) - ;; pickup amount is optional. - (set! pkup-amount (if (< (the-as uint 1) (the-as uint a0-6)) - (the float (-> v1-6 1)) - pkup-amount - ) - ) - ) - (set! (-> obj pickup-amount) pkup-amount) - ) - (else - ;; no eco-info, use stuff from args - (set! (-> obj pickup-type) pkup-type) - (set! (-> obj pickup-amount) pkup-amount) - ) - ) - ) - - ;; read the options - (set! (-> obj options) (res-lump-value ent 'options uint)) - - ;; TODO - some enum bitfield here. - (if (nonzero? (logand #x80200 (the-as int (-> obj options)))) - (set! (-> obj fade-time) (the-as uint (the int (* 300.0 (res-lump-float ent 'timeout))))) - ) + ;; allocate. + (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (let ((ent (the res-lump (-> proc entity)))) + ;; confirm that we allocated successfully + (when (zero? obj) + (go process-drawable-art-error "memory") + ;; this is already true... + (set! obj (the-as fact-info 0)) + (goto cfg-10) ) - (label cfg-10) - obj + ;; remember who we belong to + (set! (-> obj process) proc) + + ;; eco may override the pickup type and amount, so try to get this. + (let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0))) + (cond + (v1-6 + ;; eco-info lookup succeeded, + (let ((a0-6 (-> tag elt-count))) + ;; first thing is pickup type, it's always there + (set! (-> obj pickup-type) (the-as pickup-type (-> v1-6 0))) + ;; pickup amount is optional. + (set! pkup-amount (if (< (the-as uint 1) (the-as uint a0-6)) + (the float (-> v1-6 1)) + pkup-amount + ) + ) + ) + (set! (-> obj pickup-amount) pkup-amount) + ) + (else + ;; no eco-info, use stuff from args + (set! (-> obj pickup-type) pkup-type) + (set! (-> obj pickup-amount) pkup-amount) + ) + ) + ) + + ;; read the options + (set! (-> obj options) (res-lump-value ent 'options uint)) + + ;; TODO - some enum bitfield here. + (if (nonzero? (logand #x80200 (the-as int (-> obj options)))) + (set! (-> obj fade-time) (the-as uint (the int (* 300.0 (res-lump-float ent 'timeout))))) + ) ) + + (label cfg-10) + obj ) ) diff --git a/goal_src/engine/game/game-h.gc b/goal_src/engine/game/game-h.gc index 31438ff196..a59d48eb93 100644 --- a/goal_src/engine/game/game-h.gc +++ b/goal_src/engine/game/game-h.gc @@ -33,11 +33,21 @@ ;; inherited inspect of process (:methods (deactivate (_type_) none 10) - (dummy-14 (_type_ skeleton-group object) none 14) + ;; add-art? + (dummy-14 (_type_ skeleton-group object) none 14) ;; I think skeleton group is too specific. + + ;; load skeleton group? (dummy-15 (_type_ string object) _type_ 15) + + ;; apply velocity offset? + ;; probably a transformq (dummy-16 (_type_ int (inline-array vector) vector) collide-shape 16) + + ;; something with cspace (dummy-17 (_type_) none 17) (dummy-18 (_type_) symbol 18) + + ;; something with animation (dummy-19 (_type_) none 19) ) ) diff --git a/goal_src/engine/geometry/vol-h.gc b/goal_src/engine/geometry/vol-h.gc index 16e3ed1f25..d6684f194e 100644 --- a/goal_src/engine/geometry/vol-h.gc +++ b/goal_src/engine/geometry/vol-h.gc @@ -52,127 +52,93 @@ ;; INFO: Return type mismatch object vs vol-control. ;; Used lq/sq (defmethod new vol-control ((allocation symbol) (type-to-make type) (arg0 process-drawable)) - (with-pp - (let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size)))))) - (if (zero? (the-as vol-control gp-0)) - (begin - (let ((t9-1 (the-as (function object object) enter-state)) - (a0-1 "memory") - ) - (set! (-> pp next-state) process-drawable-art-error) - (t9-1 a0-1) - ) - (set! gp-0 0) - (goto cfg-13) + (let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size)))))) + (when (zero? (the-as vol-control gp-0)) + (go process-drawable-art-error "memory") + (set! gp-0 0) + (goto cfg-13) + ) + (set! (-> (the-as vol-control gp-0) process) arg0) + (let* ((s5-1 (the-as res-lump (-> (the-as vol-control gp-0) process entity))) + (s4-0 (-> (lookup-tag-idx (the-as entity s5-1) 'vol 'exact 0.0) lo)) + ) + (when (>= (the-as int s4-0) 0) + (let ((s3-0 (the-as uint s4-0)) + (s2-0 (-> s5-1 tag s4-0)) + ) + 0 + (while (= (-> s2-0 name) (-> s5-1 tag s4-0 name)) + (let + ((v1-12 + (make-property-data + s5-1 + 0.0 + (the-as res-tag-pair s3-0) + (the-as pointer #f) ) ) - (set! (-> (the-as vol-control gp-0) process) arg0) - (let* ((s5-1 (-> (the-as vol-control gp-0) process entity)) - (s4-0 - (-> - ((method-of-type res-lump lookup-tag-idx) - (the-as res-lump s5-1) - 'vol - 'exact - 0.0 - ) - lo - ) - ) - ) - (when (>= s4-0 0) - (let ((s3-0 s4-0) - (s2-0 (-> (-> (the-as res-lump s5-1) tag) s4-0)) - ) - (let ((v1-10 0)) - ) - (while (= (-> s2-0 name) (-> (-> (the-as res-lump s5-1) tag) s4-0 name)) - (let - ((v1-12 - (make-property-data - (the-as res-lump s5-1) - 0.0 - (the-as res-tag-pair s3-0) - (the-as pointer #f) - ) - ) - (a0-8 - (-> - (the-as vol-control gp-0) - pos-vol - (-> (the-as vol-control gp-0) pos-vol-count) - ) - ) - ) - (set! (-> a0-8 num-planes) (the-as int (-> s2-0 elt-count))) - (set! (-> a0-8 plane) (the-as uint v1-12)) - ) - (set! - (-> (the-as vol-control gp-0) pos-vol-count) - (+ (-> (the-as vol-control gp-0) pos-vol-count) 1) - ) - (+! s3-0 1) - (set! s2-0 (-> (-> (the-as res-lump s5-1) tag) s3-0)) - ) - ) + (a0-8 + (-> + (the-as vol-control gp-0) + pos-vol + (-> (the-as vol-control gp-0) pos-vol-count) + ) ) + ) + (set! (-> a0-8 num-planes) (the-as int (-> s2-0 elt-count))) + (set! (-> a0-8 plane) (the-as uint v1-12)) ) - (let* ((s5-2 (-> (the-as vol-control gp-0) process entity)) - (s4-1 - (-> - ((method-of-type res-lump lookup-tag-idx) - (the-as res-lump s5-2) - 'cutoutvol - 'exact - 0.0 - ) - lo - ) - ) - ) - (when (>= s4-1 0) - (let ((s3-1 s4-1) - (s2-1 (-> (-> (the-as res-lump s5-2) tag) s4-1)) - ) - (let ((v1-29 0)) - ) - (while (= (-> s2-1 name) (-> (-> (the-as res-lump s5-2) tag) s4-1 name)) - (let - ((v1-31 - (make-property-data - (the-as res-lump s5-2) - 0.0 - (the-as res-tag-pair s3-1) - (the-as pointer #f) - ) - ) - (a0-19 - (-> - (the-as vol-control gp-0) - neg-vol - (-> (the-as vol-control gp-0) neg-vol-count) - ) - ) - ) - (set! (-> a0-19 num-planes) (the-as int (-> s2-1 elt-count))) - (set! (-> a0-19 plane) (the-as uint v1-31)) - ) - (set! - (-> (the-as vol-control gp-0) neg-vol-count) - (+ (-> (the-as vol-control gp-0) neg-vol-count) 1) - ) - (+! s3-1 1) - (set! s2-1 (-> (-> (the-as res-lump s5-2) tag) s3-1)) - ) - ) - ) - ) - (label cfg-13) - (the-as vol-control gp-0) + (+! (-> (the-as vol-control gp-0) pos-vol-count) 1) + (+! s3-0 1) + (set! s2-0 (-> s5-1 tag s3-0)) + ) ) + ) ) + (let* ((s5-2 (the-as res-lump (-> (the-as vol-control gp-0) process entity))) + (s4-1 + (-> (lookup-tag-idx (the-as entity s5-2) 'cutoutvol 'exact 0.0) lo) + ) + ) + (when (>= (the-as int s4-1) 0) + (let ((s3-1 (the-as uint s4-1)) + (s2-1 (-> s5-2 tag s4-1)) + ) + 0 + (while (= (-> s2-1 name) (-> s5-2 tag s4-1 name)) + (let + ((v1-31 + (make-property-data + s5-2 + 0.0 + (the-as res-tag-pair s3-1) + (the-as pointer #f) + ) + ) + (a0-19 + (-> + (the-as vol-control gp-0) + neg-vol + (-> (the-as vol-control gp-0) neg-vol-count) + ) + ) + ) + (set! (-> a0-19 num-planes) (the-as int (-> s2-1 elt-count))) + (set! (-> a0-19 plane) (the-as uint v1-31)) + ) + (+! (-> (the-as vol-control gp-0) neg-vol-count) 1) + (+! s3-1 1) + (set! s2-1 (-> s5-2 tag s3-1)) + ) + ) + ) + ) + (label cfg-13) + (the-as vol-control gp-0) + ) ) + ;; definition for method 11 of type vol-control (defmethod TODO-RENAME-11 vol-control ((obj vol-control)) (and *display-vol-marks* (nonzero? (logand (-> obj flags) 1))) diff --git a/goal_src/engine/gfx/lights.gc b/goal_src/engine/gfx/lights.gc index a4ca0e5fb4..62ce671ca5 100644 --- a/goal_src/engine/gfx/lights.gc +++ b/goal_src/engine/gfx/lights.gc @@ -40,12 +40,9 @@ out ) -(defun light-group-process! ((lights vu-lights) (group light-group) (vector-1 vector) (vector-2 vector)) - "Unused - Seems to do effectively nothing" - ;; NOTE - dead code - ;; (let ((f0-0 (rotate-y<-vector+vector arg3 arg2))) - ;; ) - (vu-lights<-light-group! lights group) +(defun light-group-process! ((arg0 vu-lights) (arg1 light-group) (arg2 vector) (arg3 vector)) + (rotate-y<-vector+vector arg3 arg2) + (vu-lights<-light-group! arg0 arg1) (none) ) diff --git a/goal_src/engine/level/level.gc b/goal_src/engine/level/level.gc index 36be64cba9..4868cd9e7d 100644 --- a/goal_src/engine/level/level.gc +++ b/goal_src/engine/level/level.gc @@ -549,7 +549,7 @@ (1+! (-> level-login-state elts)) ) (else - (dummy-9 (-> current-drawable data idx-in-drawable)) + (login (-> current-drawable data idx-in-drawable)) ) ) ) @@ -561,7 +561,7 @@ (1+! (-> level-login-state elts)) ) (else - (dummy-9 (the-as drawable current-drawable)) + (login (the-as drawable current-drawable)) ) ) ) @@ -594,7 +594,7 @@ ((< (the-as int current-login-pos) (-> (the-as drawable-inline-array-tfrag s1-1) length)) (dotimes (s0-0 200) (when (< (the-as int current-login-pos) (-> (the-as drawable-inline-array-tfrag s1-1) length)) - (dummy-9 (-> (the-as drawable-inline-array-tfrag s1-1) data (the-as uint current-login-pos))) + (login (-> (the-as drawable-inline-array-tfrag s1-1) data (the-as uint current-login-pos))) (1+! current-login-pos) ) ) @@ -616,7 +616,7 @@ (dotimes (sv-32 4) (let ((a0-28 (-> sv-16 geometry sv-32))) (if (nonzero? a0-28) - (dummy-9 a0-28) + (login a0-28) ) ) ) diff --git a/goal_src/engine/target/joint-mod-h.gc b/goal_src/engine/target/joint-mod-h.gc index 2f0e4fcd4f..477544432b 100644 --- a/goal_src/engine/target/joint-mod-h.gc +++ b/goal_src/engine/target/joint-mod-h.gc @@ -177,19 +177,15 @@ (defmethod set-trs! joint-mod ((obj joint-mod) (trans vector) (rot quaternion) (scale vector)) "Set the translation, rotation, and scale." - (when trans - (let ((v1-1 (-> obj trans))) - (set! (-> v1-1 quad) (-> trans quad)) - ) - ) + (if trans + (set! (-> obj trans quad) (-> trans quad)) + ) (if rot - (quaternion-copy! (-> obj quat) rot) - ) - (when scale - (let ((v1-5 (-> obj scale))) - (set! (-> v1-5 quad) (-> scale quad)) - ) - ) + (quaternion-copy! (-> obj quat) rot) + ) + (if scale + (set! (-> obj scale quad) (-> scale quad)) + ) (none) ) @@ -203,9 +199,7 @@ ;; how far are we from the target? (let ((distance (vector-vector-distance (-> obj process root trans) target-trans))) (set! (-> obj shutting-down?) #f) - (let ((v1-6 (-> obj target))) - (set! (-> v1-6 quad) (-> target-trans quad)) - ) + (set! (-> obj target quad) (-> target-trans quad)) (if (< distance (-> obj max-dist)) (set! (-> obj blend) 1.0) ;; in range, set blend to 1.0 to start (set! (-> obj blend) 0.0) ;; not in range, set blend to 0.0 to disable. @@ -259,17 +253,16 @@ ;; success! we consider this a noticed and remember when (set! (-> obj notice-time) (-> *display* base-frame-counter)) ;; and update the look at data - (let ((ppointer (the-as (pointer process) - (if proc - (the-as (pointer process) (-> proc ppointer)) - ) - ) - ) - ) - (set! (-> last-try-to-look-at-data who) - (new 'static 'handle :process ppointer :pid (-> ppointer 0 pid)) - ) + (let ((v1-12 (if proc + (-> proc ppointer) + ) ) + ) + (set! + (-> last-try-to-look-at-data who) + (new 'static 'handle :process v1-12 :pid (-> v1-12 0 pid)) + ) + ) ;; not sure what these are yet. (if (< (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert)) (set! (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert)) @@ -302,9 +295,7 @@ (set-mode! obj (joint-mod-handler-mode look-at)) ) ;; set our target. - (let ((v1-37 (-> obj target))) - (set! (-> v1-37 quad) (-> target-trans quad)) - ) + (set! (-> obj target quad) (-> target-trans quad)) ;; activate us. (set! (-> obj blend) 1.0) (set! (-> obj shutting-down?) #f) @@ -695,38 +686,33 @@ ) ) -;; todo needs better vector-dot stuff (defun joint-mod-wheel-callback ((arg0 cspace) (arg1 transformq)) - (local-vars (f0-3 float)) (let ((s4-0 (the-as joint-mod-wheel (-> arg0 param1)))) - (let ((v1-1 (-> s4-0 process root)) - (s1-0 (new-stack-vector0)) - (s3-0 (new-stack-vector0)) - (s2-0 (new-stack-vector0)) - ) - (let ((f0-0 0.0)) - ) - (let ((f0-1 0.0)) - ) - (vector-z-quaternion! s2-0 (-> v1-1 quat)) - (vector<-cspace! s1-0 arg0) - (vector-! s3-0 s1-0 (-> s4-0 last-position)) - (set! (-> s4-0 last-position quad) (-> s1-0 quad)) - (set! f0-3 (vector-dot s2-0 s3-0)) - ) - (let* ((f0-4 f0-3) - (f1-1 65536.0) - (f2-2 (* 6.28318 (-> s4-0 wheel-radius))) - (f0-5 (* (* f1-1 (/ 1.0 f2-2)) f0-4)) + (let ((v1-1 (-> s4-0 process root)) + (s1-0 (new-stack-vector0)) + (s3-0 (new-stack-vector0)) + (s2-0 (new-stack-vector0)) + ) + 0.0 + 0.0 + (vector-z-quaternion! s2-0 (-> v1-1 quat)) + (vector<-cspace! s1-0 arg0) + (vector-! s3-0 s1-0 (-> s4-0 last-position)) + (set! (-> s4-0 last-position quad) (-> s1-0 quad)) + (let* ((f0-3 (vector-dot s2-0 s3-0)) + (f1-0 65536.0) + (f2-1 (* 6.28318 (-> s4-0 wheel-radius))) + (f0-4 (* (* f1-0 (/ 1.0 f2-1)) f0-3)) ) - (set! (-> s4-0 angle) (+ (-> s4-0 angle) f0-5)) - ) - (quaternion-vector-angle! - (-> arg1 quat) - (-> *joint-axis-vectors* (-> s4-0 wheel-axis)) - (-> s4-0 angle) + (+! (-> s4-0 angle) f0-4) ) ) + (quaternion-vector-angle! + (-> arg1 quat) + (-> *joint-axis-vectors* (-> s4-0 wheel-axis)) + (-> s4-0 angle) + ) + ) (cspace<-parented-transformq-joint! arg0 arg1) (none) ) diff --git a/goal_src/engine/target/pat-h.gc b/goal_src/engine/target/pat-h.gc index 0a03788be6..11ca7157e8 100644 --- a/goal_src/engine/target/pat-h.gc +++ b/goal_src/engine/target/pat-h.gc @@ -5,6 +5,9 @@ ;; name in dgo: pat-h ;; dgos: GAME, ENGINE +;; The "pat" system is used to classify terrain. +;; These are likely stored as part of the level data, so they are quite compact. + (defenum pat-material :type uint8 (stone) diff --git a/goal_src/engine/target/surface-h.gc b/goal_src/engine/target/surface-h.gc index 22c7cfbb5b..ec2cafc7dc 100644 --- a/goal_src/engine/target/surface-h.gc +++ b/goal_src/engine/target/surface-h.gc @@ -105,13 +105,21 @@ ;; if there is no good hook, set it to nothing. (dotimes (v1-3 4) (set! (-> dst hook v1-3) - (if (and (nonzero? (-> src1 hook v1-3)) (!= (-> src1 hook v1-3) nothing)) - (-> src1 hook v1-3) - (if (and (nonzero? (-> src0 hook v1-3)) (!= (-> src0 hook v1-3) nothing)) - (-> src0 hook v1-3) - nothing + (cond + ((and (nonzero? (-> src1 hook v1-3)) + (!= (-> src1 hook v1-3) nothing) ) - ) + (-> src1 hook v1-3) + ) + ((and (nonzero? (-> src0 hook v1-3)) + (!= (-> src0 hook v1-3) nothing) + ) + (-> src0 hook v1-3) + ) + (else + nothing + ) + ) ) ) diff --git a/goal_src/kernel-defs.gc b/goal_src/kernel-defs.gc index 4c411c99ac..5ad5df8681 100644 --- a/goal_src/kernel-defs.gc +++ b/goal_src/kernel-defs.gc @@ -227,13 +227,15 @@ (death 24) ;; 16777216 ) +(declare-type process basic) + (deftype process-tree (basic) ((name basic :offset-assert 4) (mask process-mask :offset-assert 8) (parent (pointer process-tree) :offset-assert 12) (brother (pointer process-tree) :offset-assert 16) (child (pointer process-tree) :offset-assert 20) - (ppointer (pointer process-tree) :offset-assert 24) + (ppointer (pointer process) :offset-assert 24) (self process-tree :offset-assert 28) ) diff --git a/goal_src/kernel/gkernel-h.gc b/goal_src/kernel/gkernel-h.gc index 14eb48d8fd..9c2fa5f505 100644 --- a/goal_src/kernel/gkernel-h.gc +++ b/goal_src/kernel/gkernel-h.gc @@ -204,7 +204,7 @@ (parent (pointer process-tree) :offset-assert 12) (brother (pointer process-tree) :offset-assert 16) (child (pointer process-tree) :offset-assert 20) - (ppointer (pointer process-tree) :offset-assert 24) + (ppointer (pointer process) :offset-assert 24) (self process-tree :offset-assert 28) ) diff --git a/goal_src/kernel/gkernel.gc b/goal_src/kernel/gkernel.gc index a5f7334fa7..9e2535c178 100644 --- a/goal_src/kernel/gkernel.gc +++ b/goal_src/kernel/gkernel.gc @@ -371,7 +371,7 @@ (set! (-> obj child) #f) (set! (-> obj self) obj) - (set! (-> obj ppointer) (&-> obj self)) + (set! (-> obj ppointer) (the (pointer process) (&-> obj self))) obj ) ) @@ -436,7 +436,7 @@ ;; setup reference stuff. (set! (-> obj self) obj) - (set! (-> obj ppointer) (&-> obj self)) + (set! (-> obj ppointer) (the (pointer process) (&-> obj self))) obj ) ) @@ -910,7 +910,7 @@ (set! (-> obj child) #f) ;; setup ref (set! (-> obj self) obj) - (set! (-> obj ppointer) (&-> obj self)) + (set! (-> obj ppointer) (the (pointer process) (&-> obj self))) (dotimes (i count) ;; create each process @@ -994,7 +994,7 @@ (set! (-> obj child) #f) (set! (-> obj self) obj) - (set! (-> obj ppointer) (&-> obj self)) + (set! (-> obj ppointer) (the (pointer process) (&-> obj self))) ;; initialize each process handle ;; build them into a linked list of null-process diff --git a/test/decompiler/reference/decompiler-macros.gc b/test/decompiler/reference/decompiler-macros.gc index 258c10976d..6778c18b22 100644 --- a/test/decompiler/reference/decompiler-macros.gc +++ b/test/decompiler/reference/decompiler-macros.gc @@ -205,4 +205,11 @@ (set! (-> vec y) ,yv) (set! (-> vec z) ,zv) (set! (-> vec w) ,wv))) - ) \ No newline at end of file + ) + +(defmacro go (next-state &rest args) + `(with-pp + (set! (-> pp next-state) ,next-state) + ((the (function _varargs_ object) enter-state) ,@args) + ) + ) \ No newline at end of file diff --git a/test/decompiler/reference/engine/anim/aligner-h_REF.gc b/test/decompiler/reference/engine/anim/aligner-h_REF.gc index adfa6b29ac..952034830d 100644 --- a/test/decompiler/reference/engine/anim/aligner-h_REF.gc +++ b/test/decompiler/reference/engine/anim/aligner-h_REF.gc @@ -53,12 +53,7 @@ ) ) (when (zero? obj) - (let ((t9-1 (the-as (function object object) enter-state)) - (a0-1 "memory") - ) - (set! (-> self next-state) process-drawable-art-error) - (t9-1 a0-1) - ) + (go process-drawable-art-error "memory") (return (the-as align-control 0)) ) (set! (-> obj process) (the-as process-drawable arg0)) diff --git a/test/decompiler/reference/engine/collide/collide-frag_REF.gc b/test/decompiler/reference/engine/collide/collide-frag_REF.gc index c7a281be76..3039343eae 100644 --- a/test/decompiler/reference/engine/collide/collide-frag_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-frag_REF.gc @@ -3,7 +3,7 @@ ;; definition for method 9 of type drawable-tree-collide-fragment (defmethod - dummy-9 + login drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment)) obj @@ -11,12 +11,12 @@ ;; definition for method 10 of type drawable-tree-collide-fragment (defmethod - dummy-10 + draw drawable-tree-collide-fragment ((obj drawable-tree-collide-fragment) (arg0 drawable) (arg1 display-frame)) (when *display-render-collision* (dotimes (s4-0 (-> obj length)) - (dummy-10 (-> obj data s4-0) (-> obj data s4-0) arg1) + (draw (-> obj data s4-0) (-> obj data s4-0) arg1) ) ) 0 @@ -102,7 +102,7 @@ ;; definition for method 9 of type drawable-inline-array-collide-fragment (defmethod - dummy-9 + login drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment)) obj @@ -110,7 +110,7 @@ ;; definition for method 10 of type collide-fragment (defmethod - dummy-10 + draw collide-fragment ((obj collide-fragment) (arg0 drawable) (arg1 display-frame)) 0 @@ -118,7 +118,7 @@ ;; definition for method 10 of type drawable-inline-array-collide-fragment (defmethod - dummy-10 + draw drawable-inline-array-collide-fragment ((obj drawable-inline-array-collide-fragment) (arg0 drawable) @@ -127,7 +127,7 @@ (dotimes (s4-0 (-> obj length)) (let ((s3-0 (-> obj data s4-0))) (if (sphere-cull (-> s3-0 bsphere)) - (dummy-10 s3-0 s3-0 arg1) + (draw s3-0 s3-0 arg1) ) ) ) diff --git a/test/decompiler/reference/engine/collide/collide-mesh-h_REF.gc b/test/decompiler/reference/engine/collide/collide-mesh-h_REF.gc index 364cff33c6..e75c44497b 100644 --- a/test/decompiler/reference/engine/collide/collide-mesh-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-mesh-h_REF.gc @@ -3,10 +3,10 @@ ;; definition of type collide-tri-result (deftype collide-tri-result (structure) - ((vertex vector 3 :inline :offset-assert 0) - (intersect vector :inline :offset-assert 48) - (normal vector :inline :offset-assert 64) - (pat uint32 :offset-assert 80) + ((vertex vector 3 :inline :offset-assert 0) + (intersect vector :inline :offset-assert 48) + (normal vector :inline :offset-assert 64) + (pat pat-surface :offset-assert 80) ) :method-count-assert 9 :size-assert #x54 @@ -25,9 +25,9 @@ ;; definition of type collide-mesh-tri (deftype collide-mesh-tri (structure) - ((vertex-index uint8 3 :offset-assert 0) - (unused uint8 :offset-assert 3) - (pat uint32 :offset-assert 4) + ((vertex-index uint8 3 :offset-assert 0) + (unused uint8 :offset-assert 3) + (pat pat-surface :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -117,7 +117,7 @@ ((vertex vector 3 :inline :offset-assert 0) (normal vector :inline :offset-assert 48) (bbox4w bounding-box4w :inline :offset-assert 64) - (pat uint32 :offset 60) + (pat pat-surface :offset 60) ) :method-count-assert 9 :size-assert #x60 diff --git a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc index 4f33a22fc8..8533f1126c 100644 --- a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc @@ -283,7 +283,7 @@ ;; definition of type collide-shape-prim-sphere (deftype collide-shape-prim-sphere (collide-shape-prim) - ((pat uint32 :offset-assert 72) + ((pat pat-surface :offset-assert 72) ) :method-count-assert 28 :size-assert #x4c @@ -389,17 +389,17 @@ ;; definition of type collide-shape (deftype collide-shape (trsqv) - ((process process :offset-assert 140) - (max-iteration-count uint8 :offset-assert 144) - (nav-flags uint8 :offset-assert 145) - (pad-byte uint8 2 :offset-assert 146) - (pat-ignore-mask uint32 :offset-assert 148) - (event-self basic :offset-assert 152) - (event-other basic :offset-assert 156) - (root-prim basic :offset-assert 160) - (riders basic :offset-assert 164) - (backup-collide-as uint64 :offset-assert 168) - (backup-collide-with uint64 :offset-assert 176) + ((process process :offset-assert 140) + (max-iteration-count uint8 :offset-assert 144) + (nav-flags uint8 :offset-assert 145) + (pad-byte uint8 2 :offset-assert 146) + (pat-ignore-mask pat-surface :offset-assert 148) + (event-self basic :offset-assert 152) + (event-other basic :offset-assert 156) + (root-prim basic :offset-assert 160) + (riders basic :offset-assert 164) + (backup-collide-as uint64 :offset-assert 168) + (backup-collide-with uint64 :offset-assert 176) ) :method-count-assert 56 :size-assert #xb8 @@ -472,31 +472,31 @@ ;; definition of type collide-shape-moving (deftype collide-shape-moving (collide-shape) - ((rider-time uint64 :offset-assert 184) - (rider-last-move vector :inline :offset-assert 192) - (trans-old vector 3 :inline :offset-assert 208) - (poly-pat uint32 :offset-assert 256) - (cur-pat uint32 :offset-assert 260) - (ground-pat uint32 :offset-assert 264) - (status uint64 :offset-assert 272) - (old-status uint64 :offset-assert 280) - (prev-status uint64 :offset-assert 288) - (reaction-flag uint32 :offset-assert 296) - (reaction basic :offset-assert 300) - (no-reaction basic :offset-assert 304) - (local-normal vector :inline :offset-assert 320) - (surface-normal vector :inline :offset-assert 336) - (poly-normal vector :inline :offset-assert 352) - (ground-poly-normal vector :inline :offset-assert 368) - (ground-touch-point vector :inline :offset-assert 384) - (shadow-pos vector :inline :offset-assert 400) - (ground-impact-vel meters :offset-assert 416) - (surface-angle float :offset-assert 420) - (poly-angle float :offset-assert 424) - (touch-angle float :offset-assert 428) - (coverage float :offset-assert 432) - (dynam basic :offset-assert 436) - (surf basic :offset-assert 440) + ((rider-time uint64 :offset-assert 184) + (rider-last-move vector :inline :offset-assert 192) + (trans-old vector 3 :inline :offset-assert 208) + (poly-pat pat-surface :offset-assert 256) + (cur-pat pat-surface :offset-assert 260) + (ground-pat pat-surface :offset-assert 264) + (status uint64 :offset-assert 272) + (old-status uint64 :offset-assert 280) + (prev-status uint64 :offset-assert 288) + (reaction-flag uint32 :offset-assert 296) + (reaction basic :offset-assert 300) + (no-reaction basic :offset-assert 304) + (local-normal vector :inline :offset-assert 320) + (surface-normal vector :inline :offset-assert 336) + (poly-normal vector :inline :offset-assert 352) + (ground-poly-normal vector :inline :offset-assert 368) + (ground-touch-point vector :inline :offset-assert 384) + (shadow-pos vector :inline :offset-assert 400) + (ground-impact-vel meters :offset-assert 416) + (surface-angle float :offset-assert 420) + (poly-angle float :offset-assert 424) + (touch-angle float :offset-assert 428) + (coverage float :offset-assert 432) + (dynam basic :offset-assert 436) + (surf basic :offset-assert 440) ) :method-count-assert 65 :size-assert #x1bc @@ -615,7 +615,7 @@ ) ) ) - (set! (-> obj pat) (the-as uint 16)) + (set! (-> obj pat) (new 'static 'pat-surface :mode (pat-mode obstacle))) (set! (-> obj prim-core prim-type) -1) (the-as collide-shape-prim-sphere obj) ) @@ -728,10 +728,16 @@ (set! (-> obj root-prim) #f) (case (-> proc type symbol) (('camera) - (set! (-> obj pat-ignore-mask) (the-as uint 2)) + (set! + (-> obj pat-ignore-mask) + (new 'static 'pat-surface :skip #x2 :nocamera #x1) + ) ) (else - (set! (-> obj pat-ignore-mask) (the-as uint 1)) + (set! + (-> obj pat-ignore-mask) + (new 'static 'pat-surface :skip #x1 :noentity #x1) + ) ) ) (set! (-> obj trans w) 1.0) diff --git a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc index 4e674ada5c..e52de0bdb5 100644 --- a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc @@ -3,16 +3,16 @@ ;; definition of type collide-history (deftype collide-history (structure) - ((intersect vector :inline :offset-assert 0) - (trans vector :inline :offset-assert 16) - (transv vector :inline :offset-assert 32) - (transv-out vector :inline :offset-assert 48) - (local-normal vector :inline :offset-assert 64) - (surface-normal vector :inline :offset-assert 80) - (time uint64 :offset-assert 96) - (status uint64 :offset-assert 104) - (pat uint32 :offset-assert 112) - (reaction-flag uint32 :offset-assert 116) + ((intersect vector :inline :offset-assert 0) + (trans vector :inline :offset-assert 16) + (transv vector :inline :offset-assert 32) + (transv-out vector :inline :offset-assert 48) + (local-normal vector :inline :offset-assert 64) + (surface-normal vector :inline :offset-assert 80) + (time uint64 :offset-assert 96) + (status uint64 :offset-assert 104) + (pat pat-surface :offset-assert 112) + (reaction-flag uint32 :offset-assert 116) ) :method-count-assert 10 :size-assert #x78 diff --git a/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc index cfacb9db8f..0a2463eabd 100644 --- a/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-actor-h_REF.gc @@ -39,7 +39,7 @@ ;; definition for method 10 of type drawable-tree-actor (defmethod - dummy-10 + draw drawable-tree-actor ((obj drawable-tree-actor) (arg0 drawable) (arg1 display-frame)) 0 diff --git a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc index 447ff3b8ee..1055c0fdf4 100644 --- a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc @@ -42,7 +42,7 @@ ;; definition for method 10 of type drawable-tree-ambient (defmethod - dummy-10 + draw drawable-tree-ambient ((obj drawable-tree-ambient) (arg0 drawable) (arg1 display-frame)) 0 diff --git a/test/decompiler/reference/engine/draw/drawable-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-h_REF.gc index deb9f044e5..ceb774e45e 100644 --- a/test/decompiler/reference/engine/draw/drawable-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-h_REF.gc @@ -10,8 +10,8 @@ :size-assert #x20 :flag-assert #x1200000020 (:methods - (dummy-9 (_type_) _type_ 9) - (dummy-10 (_type_ drawable display-frame) int 10) + (login (_type_) _type_ 9) + (draw (_type_ drawable display-frame) int 10) (dummy-11 (_type_ int) none 11) (dummy-12 (_type_ int) none 12) (dummy-13 (_type_ int) none 13) diff --git a/test/decompiler/reference/engine/draw/drawable-inline-array_REF.gc b/test/decompiler/reference/engine/draw/drawable-inline-array_REF.gc index c05d53d402..e75ec00306 100644 --- a/test/decompiler/reference/engine/draw/drawable-inline-array_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-inline-array_REF.gc @@ -7,13 +7,13 @@ ) ;; definition for method 9 of type drawable-inline-array -(defmethod dummy-9 drawable-inline-array ((obj drawable-inline-array)) +(defmethod login drawable-inline-array ((obj drawable-inline-array)) obj ) ;; definition for method 10 of type drawable-inline-array (defmethod - dummy-10 + draw drawable-inline-array ((obj drawable-inline-array) (arg0 drawable) (arg1 display-frame)) 0 @@ -32,7 +32,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/engine/game/fact-h_REF.gc b/test/decompiler/reference/engine/game/fact-h_REF.gc index ec7405940e..249d7e5b11 100644 --- a/test/decompiler/reference/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/engine/game/fact-h_REF.gc @@ -243,99 +243,92 @@ (pkup-amount float) ) (local-vars (tag res-tag)) - (with-pp - (let - ((obj - (object-new allocation type-to-make (the-as int (-> type-to-make size))) + (let + ((obj + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (let ((ent (-> proc entity))) + (when (zero? obj) + (go process-drawable-art-error "memory") + (set! obj (the-as fact-info 0)) + (goto cfg-10) + ) + (set! (-> obj process) proc) + (set! tag (new 'static 'res-tag)) + (let + ((v1-6 + (the-as + (pointer int32) + ((method-of-type res-lump get-property-data) + ent + 'eco-info + 'interp + 0.0 + (the-as pointer #f) + (& tag) + *res-static-buf* + ) + ) + ) + ) + (cond + (v1-6 + (let ((a0-6 (-> tag elt-count))) + (set! (-> obj pickup-type) (the-as pickup-type (-> v1-6 0))) + (set! pkup-amount (cond + ((< (the-as uint 1) a0-6) + (the float (-> v1-6 1)) + ) + (else + (empty) + pkup-amount + ) + ) + ) + ) + (set! (-> obj pickup-amount) pkup-amount) + ) + (else + (set! (-> obj pickup-type) pkup-type) + (set! (-> obj pickup-amount) pkup-amount) + ) ) ) - (let ((ent (-> proc entity))) - (when (zero? obj) - (let ((go-func (the-as (function string none) enter-state)) - (a0-1 "memory") - ) - (set! (-> pp next-state) process-drawable-art-error) - (go-func a0-1) - ) - (set! obj (the-as fact-info 0)) - (goto cfg-10) - ) - (set! (-> obj process) proc) - (set! tag (new 'static 'res-tag)) - (let - ((v1-6 - (the-as - (pointer int32) - ((method-of-type res-lump get-property-data) - ent - 'eco-info - 'interp - 0.0 - (the-as pointer #f) - (& tag) - *res-static-buf* - ) - ) - ) - ) - (cond - (v1-6 - (let ((a0-6 (-> tag elt-count))) - (set! (-> obj pickup-type) (the-as pickup-type (-> v1-6 0))) - (set! pkup-amount (cond - ((< (the-as uint 1) a0-6) - (the float (-> v1-6 1)) - ) - (else - (empty) - pkup-amount - ) - ) - ) - ) - (set! (-> obj pickup-amount) pkup-amount) - ) - (else - (set! (-> obj pickup-type) pkup-type) - (set! (-> obj pickup-amount) pkup-amount) - ) + (set! + (-> obj options) + (the-as + uint + ((method-of-type res-lump get-property-value) + ent + 'options + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* ) ) + ) + (if (nonzero? (logand #x80200 (the-as int (-> obj options)))) (set! - (-> obj options) + (-> obj fade-time) (the-as uint - ((method-of-type res-lump get-property-value) - ent - 'options - 'interp - -1000000000.0 - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if (nonzero? (logand #x80200 (the-as int (-> obj options)))) - (set! - (-> obj fade-time) - (the-as - uint - (the - int - (* - 300.0 - (the-as - float - ((method-of-type res-lump get-property-value-float) - ent - 'timeout - 'interp - -1000000000.0 - 0.0 - (the-as (pointer res-tag) #f) - *res-static-buf* - ) + (the + int + (* + 300.0 + (the-as + float + ((method-of-type res-lump get-property-value-float) + ent + 'timeout + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* ) ) ) @@ -343,9 +336,9 @@ ) ) ) - (label cfg-10) - obj ) + (label cfg-10) + obj ) ) diff --git a/test/decompiler/reference/engine/geometry/vol-h_REF.gc b/test/decompiler/reference/engine/geometry/vol-h_REF.gc index 50bdc5584c..0425525679 100644 --- a/test/decompiler/reference/engine/geometry/vol-h_REF.gc +++ b/test/decompiler/reference/engine/geometry/vol-h_REF.gc @@ -78,103 +78,96 @@ new vol-control ((allocation symbol) (type-to-make type) (arg0 process-drawable)) - (with-pp - (let - ((gp-0 - (the-as - object - (object-new allocation type-to-make (the-as int (-> type-to-make size))) - ) + (let + ((gp-0 + (the-as + object + (object-new allocation type-to-make (the-as int (-> type-to-make size))) ) ) - (when (zero? (the-as vol-control gp-0)) - (let ((t9-1 (the-as (function object object) enter-state)) - (a0-1 "memory") - ) - (set! (-> pp next-state) process-drawable-art-error) - (t9-1 a0-1) - ) - (set! gp-0 0) - (goto cfg-13) - ) - (set! (-> (the-as vol-control gp-0) process) arg0) - (let* - ((s5-1 (the-as res-lump (-> (the-as vol-control gp-0) process entity))) - (s4-0 (-> (lookup-tag-idx (the-as entity s5-1) 'vol 'exact 0.0) lo)) - ) - (when (>= (the-as int s4-0) 0) - (let ((s3-0 (the-as uint s4-0)) - (s2-0 (-> s5-1 tag s4-0)) - ) - 0 - (while (= (-> s2-0 name) (-> s5-1 tag s4-0 name)) - (let - ((v1-12 - (make-property-data - s5-1 - 0.0 - (the-as res-tag-pair s3-0) - (the-as pointer #f) - ) - ) - (a0-8 - (-> - (the-as vol-control gp-0) - pos-vol - (-> (the-as vol-control gp-0) pos-vol-count) - ) - ) - ) - (set! (-> a0-8 num-planes) (the-as int (-> s2-0 elt-count))) - (set! (-> a0-8 plane) (the-as uint v1-12)) - ) - (+! (-> (the-as vol-control gp-0) pos-vol-count) 1) - (+! s3-0 1) - (set! s2-0 (-> s5-1 tag s3-0)) - ) - ) - ) - ) - (let* - ((s5-2 (the-as res-lump (-> (the-as vol-control gp-0) process entity))) - (s4-1 (-> (lookup-tag-idx (the-as entity s5-2) 'cutoutvol 'exact 0.0) lo)) - ) - (when (>= (the-as int s4-1) 0) - (let ((s3-1 (the-as uint s4-1)) - (s2-1 (-> s5-2 tag s4-1)) - ) - 0 - (while (= (-> s2-1 name) (-> s5-2 tag s4-1 name)) - (let - ((v1-31 - (make-property-data - s5-2 - 0.0 - (the-as res-tag-pair s3-1) - (the-as pointer #f) - ) - ) - (a0-19 - (-> - (the-as vol-control gp-0) - neg-vol - (-> (the-as vol-control gp-0) neg-vol-count) - ) - ) - ) - (set! (-> a0-19 num-planes) (the-as int (-> s2-1 elt-count))) - (set! (-> a0-19 plane) (the-as uint v1-31)) - ) - (+! (-> (the-as vol-control gp-0) neg-vol-count) 1) - (+! s3-1 1) - (set! s2-1 (-> s5-2 tag s3-1)) - ) - ) - ) - ) - (label cfg-13) - (the-as vol-control gp-0) ) + (when (zero? (the-as vol-control gp-0)) + (go process-drawable-art-error "memory") + (set! gp-0 0) + (goto cfg-13) + ) + (set! (-> (the-as vol-control gp-0) process) arg0) + (let* ((s5-1 (the-as res-lump (-> (the-as vol-control gp-0) process entity))) + (s4-0 (-> (lookup-tag-idx (the-as entity s5-1) 'vol 'exact 0.0) lo)) + ) + (when (>= (the-as int s4-0) 0) + (let ((s3-0 (the-as uint s4-0)) + (s2-0 (-> s5-1 tag s4-0)) + ) + 0 + (while (= (-> s2-0 name) (-> s5-1 tag s4-0 name)) + (let + ((v1-12 + (make-property-data + s5-1 + 0.0 + (the-as res-tag-pair s3-0) + (the-as pointer #f) + ) + ) + (a0-8 + (-> + (the-as vol-control gp-0) + pos-vol + (-> (the-as vol-control gp-0) pos-vol-count) + ) + ) + ) + (set! (-> a0-8 num-planes) (the-as int (-> s2-0 elt-count))) + (set! (-> a0-8 plane) (the-as uint v1-12)) + ) + (+! (-> (the-as vol-control gp-0) pos-vol-count) 1) + (+! s3-0 1) + (set! s2-0 (-> s5-1 tag s3-0)) + ) + ) + ) + ) + (let* ((s5-2 (the-as res-lump (-> (the-as vol-control gp-0) process entity))) + (s4-1 + (-> (lookup-tag-idx (the-as entity s5-2) 'cutoutvol 'exact 0.0) lo) + ) + ) + (when (>= (the-as int s4-1) 0) + (let ((s3-1 (the-as uint s4-1)) + (s2-1 (-> s5-2 tag s4-1)) + ) + 0 + (while (= (-> s2-1 name) (-> s5-2 tag s4-1 name)) + (let + ((v1-31 + (make-property-data + s5-2 + 0.0 + (the-as res-tag-pair s3-1) + (the-as pointer #f) + ) + ) + (a0-19 + (-> + (the-as vol-control gp-0) + neg-vol + (-> (the-as vol-control gp-0) neg-vol-count) + ) + ) + ) + (set! (-> a0-19 num-planes) (the-as int (-> s2-1 elt-count))) + (set! (-> a0-19 plane) (the-as uint v1-31)) + ) + (+! (-> (the-as vol-control gp-0) neg-vol-count) 1) + (+! s3-1 1) + (set! s2-1 (-> s5-2 tag s3-1)) + ) + ) + ) + ) + (label cfg-13) + (the-as vol-control gp-0) ) ) diff --git a/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc b/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc index 8b56f3443c..cbfa4f619d 100644 --- a/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc +++ b/test/decompiler/reference/engine/gfx/tie/prototype_REF.gc @@ -9,7 +9,7 @@ (dotimes (s3-0 4) (let ((a0-1 (-> s4-0 geometry s3-0))) (if (nonzero? a0-1) - (dummy-9 a0-1) + (login a0-1) ) ) ) @@ -33,7 +33,7 @@ ;; definition for method 9 of type prototype-inline-array-shrub (defmethod - dummy-9 + login prototype-inline-array-shrub ((obj prototype-inline-array-shrub)) (dotimes (s5-0 (-> obj length)) @@ -41,7 +41,7 @@ (dotimes (s3-0 4) (let ((a0-1 (-> s4-0 geometry s3-0))) (if (nonzero? a0-1) - (dummy-9 a0-1) + (login a0-1) ) ) ) diff --git a/test/decompiler/reference/engine/nav/navigate-h_REF.gc b/test/decompiler/reference/engine/nav/navigate-h_REF.gc index 5f7eea4ada..3be7752698 100644 --- a/test/decompiler/reference/engine/nav/navigate-h_REF.gc +++ b/test/decompiler/reference/engine/nav/navigate-h_REF.gc @@ -548,56 +548,49 @@ (sphere-count int) (nearest-y-threshold-default float) ) - (with-pp - (let - ((obj - (object-new - allocation - type-to-make - (the-as int (+ (-> type-to-make size) (the-as uint (* sphere-count 16)))) - ) + (let + ((obj + (object-new + allocation + type-to-make + (the-as int (+ (-> type-to-make size) (the-as uint (* sphere-count 16)))) ) ) - (when (zero? obj) - (let ((t9-1 (the-as function enter-state)) - (a0-1 "memory") - ) - (set! (-> pp next-state) process-drawable-art-error) - ((the-as (function string none) t9-1) a0-1) - ) - (set! obj (the-as nav-control 0)) - (goto cfg-4) - ) - (set! (-> obj max-spheres) sphere-count) - (set! (-> obj flags) (nav-control-flags bit8 bit13)) - (set! (-> obj mesh) (nav-mesh-connect (-> shape process) shape obj)) - (let ((ent (-> shape process entity))) - (set! - (-> obj nearest-y-threshold) - ((method-of-type res-lump get-property-value-float) - ent - 'nearest-y-threshold - 'interp - -1000000000.0 - nearest-y-threshold-default - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (set! (-> obj shape) shape) - (set! (-> obj process) (-> shape process)) - (set! (-> obj gap-event) #f) - (set! (-> obj current-poly) #f) - (set! (-> obj next-poly) #f) - (set! (-> obj target-poly) #f) - (set! (-> obj user-poly) #f) - (set! (-> obj portal 0) #f) - (set! (-> obj portal 1) #f) - (set! (-> obj nav-cull-radius) 40960.0) - (label cfg-4) - (the-as nav-control obj) ) + (when (zero? obj) + (go process-drawable-art-error "memory") + (set! obj (the-as nav-control 0)) + (goto cfg-4) + ) + (set! (-> obj max-spheres) sphere-count) + (set! (-> obj flags) (nav-control-flags bit8 bit13)) + (set! (-> obj mesh) (nav-mesh-connect (-> shape process) shape obj)) + (let ((ent (-> shape process entity))) + (set! + (-> obj nearest-y-threshold) + ((method-of-type res-lump get-property-value-float) + ent + 'nearest-y-threshold + 'interp + -1000000000.0 + nearest-y-threshold-default + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> obj shape) shape) + (set! (-> obj process) (-> shape process)) + (set! (-> obj gap-event) #f) + (set! (-> obj current-poly) #f) + (set! (-> obj next-poly) #f) + (set! (-> obj target-poly) #f) + (set! (-> obj user-poly) #f) + (set! (-> obj portal 0) #f) + (set! (-> obj portal 1) #f) + (set! (-> obj nav-cull-radius) 40960.0) + (label cfg-4) + (the-as nav-control obj) ) ) diff --git a/test/decompiler/reference/engine/nav/path-h_REF.gc b/test/decompiler/reference/engine/nav/path-h_REF.gc index 5210d2736b..4f5d4c9b33 100644 --- a/test/decompiler/reference/engine/nav/path-h_REF.gc +++ b/test/decompiler/reference/engine/nav/path-h_REF.gc @@ -78,66 +78,59 @@ (time float) ) (local-vars (tag res-tag)) - (with-pp - (let - ((obj - (object-new allocation type-to-make (the-as int (-> type-to-make size))) - ) + (let + ((obj + (object-new allocation type-to-make (the-as int (-> type-to-make size))) ) - (when (zero? obj) - (let ((t9-1 (the-as function enter-state)) - (a0-1 "memory") - ) - (set! (-> pp next-state) process-drawable-art-error) - ((the-as (function string none) t9-1) a0-1) - ) - (set! obj (the-as path-control 0)) - (goto cfg-9) - ) - (set! (-> obj process) (the-as process-drawable proc)) - (set! (-> obj name) name) - (let ((ent (-> proc entity))) - (when (= name 'path) - (let ((lookup-entity (entity-actor-lookup ent 'path-actor 0))) - (if lookup-entity - (set! ent lookup-entity) - ) - ) - ) - (set! tag (new 'static 'res-tag)) - (let - ((data - ((method-of-type res-lump get-property-data) - ent - name - 'interp - time - (the-as pointer #f) - (& tag) - *res-static-buf* - ) - ) - ) - (cond - (data - (set! (-> obj cverts) (the-as (inline-array vector) data)) - (set! (-> obj curve num-cverts) (the-as int (-> tag elt-count))) - ) - (else - (set! - (-> obj flags) - (logior (-> obj flags) (path-control-flag not-found)) - ) - (set! (-> obj cverts) (the-as (inline-array vector) #f)) - (set! (-> obj curve num-cverts) 0) - 0 - ) - ) - ) - ) - (label cfg-9) - (the-as path-control obj) ) + (when (zero? obj) + (go process-drawable-art-error "memory") + (set! obj (the-as path-control 0)) + (goto cfg-9) + ) + (set! (-> obj process) (the-as process-drawable proc)) + (set! (-> obj name) name) + (let ((ent (-> proc entity))) + (when (= name 'path) + (let ((lookup-entity (entity-actor-lookup ent 'path-actor 0))) + (if lookup-entity + (set! ent lookup-entity) + ) + ) + ) + (set! tag (new 'static 'res-tag)) + (let + ((data + ((method-of-type res-lump get-property-data) + ent + name + 'interp + time + (the-as pointer #f) + (& tag) + *res-static-buf* + ) + ) + ) + (cond + (data + (set! (-> obj cverts) (the-as (inline-array vector) data)) + (set! (-> obj curve num-cverts) (the-as int (-> tag elt-count))) + ) + (else + (set! + (-> obj flags) + (logior (-> obj flags) (path-control-flag not-found)) + ) + (set! (-> obj cverts) (the-as (inline-array vector) #f)) + (set! (-> obj curve num-cverts) 0) + 0 + ) + ) + ) + ) + (label cfg-9) + (the-as path-control 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 60a5d302e9..5d3936d711 100644 --- a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc +++ b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc @@ -295,18 +295,14 @@ ) ) (set! (-> obj notice-time) (-> *display* base-frame-counter)) - (let ((ppointer (the-as (pointer process) (if proc - (the-as - (pointer process) - (-> proc ppointer) - ) - ) - ) + (let ((v1-12 (if proc + (-> proc ppointer) + ) ) ) (set! (-> last-try-to-look-at-data who) - (new 'static 'handle :process ppointer :pid (-> ppointer 0 pid)) + (new 'static 'handle :process v1-12 :pid (-> v1-12 0 pid)) ) ) (if (< (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert)) diff --git a/test/decompiler/reference/kernel/gkernel_REF.gc b/test/decompiler/reference/kernel/gkernel_REF.gc index 9f6d723562..60dde208f5 100644 --- a/test/decompiler/reference/kernel/gkernel_REF.gc +++ b/test/decompiler/reference/kernel/gkernel_REF.gc @@ -311,7 +311,7 @@ (set! (-> v0-0 brother) (the-as (pointer process-tree) #f)) (set! (-> v0-0 child) (the-as (pointer process-tree) #f)) (set! (-> v0-0 self) v0-0) - (set! (-> v0-0 ppointer) (&-> v0-0 self)) + (set! (-> v0-0 ppointer) (the-as (pointer process) (&-> v0-0 self))) v0-0 ) ) @@ -404,7 +404,10 @@ (set! (-> (the-as process v0-0) brother) (the-as (pointer process-tree) #f)) (set! (-> (the-as process v0-0) child) (the-as (pointer process-tree) #f)) (set! (-> (the-as process v0-0) self) (the-as process v0-0)) - (set! (-> (the-as process v0-0) ppointer) (&-> (the-as process v0-0) self)) + (set! + (-> (the-as process v0-0) ppointer) + (the-as (pointer process) (&-> (the-as process v0-0) self)) + ) (the-as process v0-0) ) ) @@ -545,7 +548,7 @@ (set! (-> s3-0 brother) (the-as (pointer process-tree) #f)) (set! (-> s3-0 child) (the-as (pointer process-tree) #f)) (set! (-> s3-0 self) s3-0) - (set! (-> s3-0 ppointer) (&-> s3-0 self)) + (set! (-> s3-0 ppointer) (the-as (pointer process) (&-> s3-0 self))) (dotimes (s2-1 arg0) (let ((s1-0 (-> s3-0 child)) (v1-5 ((method-of-type process new) allocation process 'dead arg1)) @@ -653,7 +656,7 @@ (set! (-> obj brother) (the-as (pointer process-tree) #f)) (set! (-> obj child) (the-as (pointer process-tree) #f)) (set! (-> obj self) obj) - (set! (-> obj ppointer) (&-> obj self)) + (set! (-> obj ppointer) (the-as (pointer process) (&-> obj self))) (countdown (v1-4 arg1) (let ((a0-4 (-> obj process-list v1-4))) (set! (-> a0-4 process) *null-process*) @@ -972,7 +975,7 @@ (set! (-> s5-1 2 mask) (the-as process-mask (-> s5-1 1))) (set! (-> obj alive-list prev) (the-as dead-pool-heap-rec (-> s5-1 1))) ) - (set! (-> s5-1 2) (the-as process-tree (-> obj dead-list next))) + (set! (-> s5-1 2) (the-as process (-> obj dead-list next))) (set! (-> obj dead-list next) (the-as dead-pool-heap-rec s5-1)) (set! (-> s5-1 0) *null-process*) ) diff --git a/test/decompiler/test_gkernel_decomp.cpp b/test/decompiler/test_gkernel_decomp.cpp index 526c5cbe29..a4d927710e 100644 --- a/test/decompiler/test_gkernel_decomp.cpp +++ b/test/decompiler/test_gkernel_decomp.cpp @@ -452,7 +452,7 @@ TEST_F(FormRegressionTest, RemoveMethod0ProcessTree) { " (set! (-> v0-0 brother) (the-as (pointer process-tree) #f))\n" " (set! (-> v0-0 child) (the-as (pointer process-tree) #f))\n" " (set! (-> v0-0 self) v0-0)\n" - " (set! (-> v0-0 ppointer) (&-> v0-0 self))\n" + " (set! (-> v0-0 ppointer) (the-as (pointer process) (&-> v0-0 self)))\n" " v0-0\n" " )"; test_with_expr(func, type, expected, false, "process-tree"); @@ -637,35 +637,35 @@ TEST_F(FormRegressionTest, ExprMethod0Process) { " daddiu sp, sp, 48"; std::string type = "(function symbol type basic int process)"; std::string expected = - "(let\n" - " ((v0-0\n" - " (if\n" - " (= (-> arg0 type) symbol)\n" - " (object-new\n" - " arg0\n" - " arg1\n" - " (the-as int (+ (-> process size) (the-as uint arg3)))\n" + "(let ((v0-0 (if (= (-> arg0 type) symbol)\n" + " (object-new\n" + " arg0\n" + " arg1\n" + " (the-as int (+ (-> process size) (the-as uint arg3)))\n" + " )\n" + " (+ (the-as int arg0) 4)\n" + " )\n" " )\n" - " (+ (the-as int arg0) 4)\n" " )\n" - " )\n" - " )\n" " (set! (-> (the-as process v0-0) name) arg2)\n" - " (set! (-> (the-as process v0-0) status) (quote dead))\n" + " (set! (-> (the-as process v0-0) status) 'dead)\n" " (set! (-> (the-as process v0-0) pid) 0)\n" " (set! (-> (the-as process v0-0) pool) #f)\n" " (set! (-> (the-as process v0-0) allocated-length) arg3)\n" " (set! (-> (the-as process v0-0) top-thread) #f)\n" " (set! (-> (the-as process v0-0) main-thread) #f)\n" - " (let\n" - " ((v1-5 (-> (the-as process v0-0) stack)))\n" + " (let ((v1-5 (-> (the-as process v0-0) stack)))\n" " (set! (-> (the-as process v0-0) heap-cur) v1-5)\n" " (set! (-> (the-as process v0-0) heap-base) v1-5)\n" " )\n" - " (set! (-> (the-as process v0-0) heap-top) (&-> (the-as process v0-0) stack (-> (the-as " - "process v0-0) allocated-length)))\n" - " (set! (-> (the-as process v0-0) stack-frame-top) (the-as stack-frame (-> (the-as process " - "v0-0) heap-top)))\n" + " (set!\n" + " (-> (the-as process v0-0) heap-top)\n" + " (&-> (the-as process v0-0) stack (-> (the-as process v0-0) allocated-length))\n" + " )\n" + " (set!\n" + " (-> (the-as process v0-0) stack-frame-top)\n" + " (the-as stack-frame (-> (the-as process v0-0) heap-top))\n" + " )\n" " (set! (-> (the-as process v0-0) stack-frame-top) #f)\n" " (set! (-> (the-as process v0-0) state) #f)\n" " (set! (-> (the-as process v0-0) next-state) #f)\n" @@ -677,7 +677,10 @@ TEST_F(FormRegressionTest, ExprMethod0Process) { " (set! (-> (the-as process v0-0) brother) (the-as (pointer process-tree) #f))\n" " (set! (-> (the-as process v0-0) child) (the-as (pointer process-tree) #f))\n" " (set! (-> (the-as process v0-0) self) (the-as process v0-0))\n" - " (set! (-> (the-as process v0-0) ppointer) (&-> (the-as process v0-0) self))\n" + " (set!\n" + " (-> (the-as process v0-0) ppointer)\n" + " (the-as (pointer process) (&-> (the-as process v0-0) self))\n" + " )\n" " (the-as process v0-0)\n" " )"; test_with_expr(func, type, expected, false, "process", {}, @@ -948,7 +951,7 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPool) { " (set! (-> s3-0 brother) (the-as (pointer process-tree) #f))\n" " (set! (-> s3-0 child) (the-as (pointer process-tree) #f))\n" " (set! (-> s3-0 self) s3-0)\n" - " (set! (-> s3-0 ppointer) (&-> s3-0 self))\n" + " (set! (-> s3-0 ppointer) (the-as (pointer process) (&-> s3-0 self)))\n" " (dotimes\n" " (s2-1 arg2)\n" " (let\n" @@ -1264,7 +1267,7 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPoolHeap) { " (set! (-> obj brother) (the-as (pointer process-tree) #f))\n" " (set! (-> obj child) (the-as (pointer process-tree) #f))\n" " (set! (-> obj self) obj)\n" - " (set! (-> obj ppointer) (&-> obj self))\n" + " (set! (-> obj ppointer) (the-as (pointer process) (&-> obj self)))\n" " (countdown (v1-4 arg3)\n" " (let ((a0-4 (-> obj process-list v1-4)))\n" " (set! (-> a0-4 process) *null-process*)\n" @@ -2240,7 +2243,7 @@ TEST_F(FormRegressionTest, ExprMethod15DeadPoolHeap) { " (set! (-> s5-1 2 mask) (the-as process-mask (-> s5-1 1)))\n" " (set! (-> arg0 alive-list prev) (the-as dead-pool-heap-rec (-> s5-1 1)))\n" " )\n" - " (set! (-> s5-1 2) (the-as process-tree (-> arg0 dead-list next)))\n" + " (set! (-> s5-1 2) (the-as process (-> arg0 dead-list next)))\n" " (set! (-> arg0 dead-list next) (the-as dead-pool-heap-rec s5-1))\n" " (set! (-> s5-1 0) *null-process*)\n" " )\n"