support non-virtual gos in decompiler (#707)

This commit is contained in:
water111
2021-07-17 18:07:21 -04:00
committed by GitHub
parent 0ed587cba9
commit b70fcb2f7a
48 changed files with 824 additions and 733 deletions
+1
View File
@@ -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
+15
View File
@@ -0,0 +1,15 @@
#include "state.h"
/*!
* Convert a (state <blah> ...) 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<TypeSpec> 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);
}
+9
View File
@@ -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);
+33 -1
View File
@@ -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");
}
+78 -1
View File
@@ -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<SetFormFormElement*>(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<GenericElement>(
GenericOperator::make_function(
pool.alloc_single_element_form<ConstantTokenElement>(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<GenericElement>(
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<GenericElement>(
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<GenericElement>(
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<GenericElement>(
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<GenericElement>(
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<GenericElement>(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<GenericElement>(
GenericOperator::make_fixed(FixedOperatorKind::NEW), stack_new_args));
assert(!go_next_state);
return;
}
}
+18 -15
View File
@@ -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
@@ -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)"],
@@ -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"
}
}
}
+7
View File
@@ -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;
}
+6
View File
@@ -71,6 +71,8 @@ std::string TP_Type::print() const {
return fmt::format("<pcpyud-and {}>", m_ts.print());
case Kind::LABEL_ADDR:
return "<label-addr>";
case Kind::ENTER_STATE_FUNCTION:
return "<enter-state-func>";
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);
+9
View File
@@ -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<int, TP_Type> 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()) {
+7 -25
View File
@@ -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)
)
)
)
+5 -5
View File
@@ -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
+19 -11
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
)
+1 -1
View File
@@ -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
)
+3 -7
View File
@@ -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))
@@ -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
)
+47 -49
View File
@@ -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
)
)
+11 -1
View File
@@ -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)
)
)
+79 -113
View File
@@ -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)))
+3 -6
View File
@@ -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)
)
+4 -4
View File
@@ -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)
)
)
)
+41 -55
View File
@@ -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)
)
+3
View File
@@ -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)
+14 -6
View File
@@ -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
)
)
)
)
+3 -1
View File
@@ -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)
)
+1 -1
View File
@@ -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)
)
+4 -4
View File
@@ -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
@@ -205,4 +205,11 @@
(set! (-> vec y) ,yv)
(set! (-> vec z) ,zv)
(set! (-> vec w) ,wv)))
)
)
(defmacro go (next-state &rest args)
`(with-pp
(set! (-> pp next-state) ,next-state)
((the (function _varargs_ object) enter-state) ,@args)
)
)
@@ -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))
@@ -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)
)
)
)
@@ -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
@@ -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)
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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)
)
@@ -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
)
)
@@ -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)
)
)
@@ -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)
)
)
)
@@ -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)
)
)
@@ -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)
)
)
@@ -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))
@@ -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*)
)
+26 -23
View File
@@ -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"