[decomp] game-info (#779)

* support more process stuff

* more of game info

* add ref file

* progress on save
This commit is contained in:
water111
2021-08-22 20:12:47 -04:00
committed by GitHub
parent 30d1e1d6c9
commit 403bb5f4de
117 changed files with 6234 additions and 2243 deletions
+2 -9
View File
@@ -914,26 +914,18 @@ bool ControlFlowGraph::find_infinite_continue() {
int my_block = b0->get_first_block_id();
int dest_block = b0->succ_branch->get_first_block_id();
fmt::print("Considering {} as an infinite continue:\n", b0->to_string());
// fmt::print("Considering {} as an infinite continue:\n", b0->to_string());
if (b0->end_branch.asm_branch) {
return true;
}
if (dest_block >= my_block) {
fmt::print(" Rejecting because destination block {} comes after me {}\n", dest_block,
my_block);
return true;
} else {
fmt::print(" Order OK {} -> {}\n", my_block, dest_block);
}
int prev_count = get_prev_count(b0, b0->succ_branch);
if (prev_count == -1) {
fmt::print(
" Rejecting because we can't find the destination in the current ungrouped sequence.");
return true;
} else {
fmt::print(" Sequencing OK: {} prev's\n", prev_count);
}
replaced = true;
@@ -1232,6 +1224,7 @@ bool ControlFlowGraph::clean_up_asm_branches() {
else {
lg::error("unhandled sequences in clean_up_asm_branches likely seq: {} {}", !!b0_seq,
!!b1_seq);
lg::error("{} {}\n", b0->get_first_block_id(), b1->get_first_block_id());
}
} else {
-2
View File
@@ -289,8 +289,6 @@ void Function::resize_first_block(int new_start, const LinkedObjectFile&) {
basic_blocks.at(0).start_word = new_start;
if (basic_blocks.size() >= 2 && basic_blocks.at(1).start_word == new_start) {
lg::warn("Function {} loops back to the first instruction. This is rare/less tested.",
guessed_name.to_string());
// block 1 is now zero size, so we should eliminate it
auto& block0 = basic_blocks.at(0);
auto& block1 = basic_blocks.at(1);
+8
View File
@@ -629,6 +629,14 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input,
return TP_Type::make_from_ts(TypeSpec("float"));
}
auto& name = env.func->guessed_name;
if (name.kind == FunctionName::FunctionKind::METHOD && name.method_id == 7 &&
env.func->type.arg_count() == 3) {
if (m_kind == Kind::ADD && arg1_type.typespec() == TypeSpec("int")) {
return arg0_type;
}
}
throw std::runtime_error(fmt::format("Cannot get_type_int2: {}, args {} and {}",
to_form(env.file->labels, env).print(), arg0_type.print(),
arg1_type.print()));
+8
View File
@@ -1828,6 +1828,14 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) {
return "l32-false-check";
case FixedOperatorKind::VECTOR_3_DOT:
return "vector-dot";
case FixedOperatorKind::PROCESS_TO_PPOINTER:
return "process->ppointer";
case FixedOperatorKind::PPOINTER_TO_HANDLE:
return "ppointer->handle";
case FixedOperatorKind::PROCESS_TO_HANDLE:
return "process->handle";
case FixedOperatorKind::PPOINTER_TO_PROCESS:
return "ppointer->process";
default:
assert(false);
return "";
+209 -9
View File
@@ -118,6 +118,21 @@ Form* try_cast_simplify(Form* in,
}
}
if (new_type == TypeSpec("handle")) {
auto in_generic = in->try_as_element<GenericElement>();
if (in_generic && (in_generic->op().is_fixed(FixedOperatorKind::PROCESS_TO_HANDLE) ||
in_generic->op().is_fixed(FixedOperatorKind::PPOINTER_TO_HANDLE))) {
return in;
}
}
if (new_type == TypeSpec("process")) {
auto in_generic = in->try_as_element<GenericElement>();
if (in_generic && in_generic->op().is_fixed(FixedOperatorKind::PPOINTER_TO_PROCESS)) {
return in;
}
}
auto type_info = env.dts->ts.lookup_type(new_type);
auto bitfield_info = dynamic_cast<BitFieldType*>(type_info);
if (bitfield_info) {
@@ -1004,6 +1019,17 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
}
}
auto& name = env.func->guessed_name;
if (name.kind == FunctionName::FunctionKind::METHOD && name.method_id == 7 &&
env.func->type.arg_count() == 3) {
if (env.dts->ts.tc(TypeSpec("structure"), arg0_type.typespec()) && (arg1_i || arg1_u)) {
auto new_form = pool.alloc_element<GenericElement>(
GenericOperator::make_fixed(FixedOperatorKind::ADDITION_PTR), args.at(0), args.at(1));
result->push_back(new_form);
return;
}
}
if (false && ((arg0_i && arg1_i) || (arg0_u && arg1_u))) {
auto new_form = pool.alloc_element<GenericElement>(
GenericOperator::make_fixed(FixedOperatorKind::ADDITION), args.at(0), args.at(1));
@@ -1569,6 +1595,46 @@ void SimpleExpressionElement::update_from_stack_logor_or_logand(const Env& env,
return;
}
auto make_handle_matcher = Matcher::op_fixed(
FixedOperatorKind::LOGIOR,
{Matcher::op_fixed(
FixedOperatorKind::SHL,
{Matcher::deref(Matcher::any_reg(0), false,
{DerefTokenMatcher::integer(0), DerefTokenMatcher::string("pid")}),
Matcher::integer(32)}),
Matcher::op_fixed(FixedOperatorKind::ASM_SLLV_R0, {Matcher::any_reg(1)})});
auto handle_mr = match(make_handle_matcher, &hack_form);
if (handle_mr.matched) {
auto var_a = handle_mr.maps.regs.at(0).value();
auto var_b = handle_mr.maps.regs.at(1).value();
if (env.get_variable_name(var_a) == env.get_variable_name(var_b) &&
env.dts->ts.tc(TypeSpec("pointer", {TypeSpec("process")}),
env.get_variable_type(var_a, true))) {
auto* menv = const_cast<Env*>(&env);
menv->disable_use(var_a);
auto repopped = stack.pop_reg(var_b, {}, env, true, stack.size() - 1);
if (!repopped) {
fmt::print("repop failed.\n{}\n", stack.print(env));
repopped = var_to_form(var_b, pool);
}
auto proc_to_ppointer_matcher =
Matcher::op_fixed(FixedOperatorKind::PROCESS_TO_PPOINTER, {Matcher::any(0)});
auto proc_to_ppointer_mr = match(proc_to_ppointer_matcher, repopped);
if (proc_to_ppointer_mr.matched) {
element = pool.alloc_element<GenericElement>(
GenericOperator::make_fixed(FixedOperatorKind::PROCESS_TO_HANDLE),
proc_to_ppointer_mr.maps.forms.at(0));
} else {
element = pool.alloc_element<GenericElement>(
GenericOperator::make_fixed(FixedOperatorKind::PPOINTER_TO_HANDLE), repopped);
}
}
}
result->push_back(element);
}
@@ -2737,7 +2803,8 @@ void FunctionCallElement::update_from_stack(const Env& env,
match_result = match(matcher, temp_form);
if (match_result.matched) {
auto alloc = match_result.maps.strings.at(allocation);
if (alloc != "global" && alloc != "debug" && alloc != "process") {
if (alloc != "global" && alloc != "debug" && alloc != "process" &&
alloc != "loading-level") {
throw std::runtime_error("Unrecognized heap symbol for new: " + alloc);
}
auto type_2 = match_result.maps.strings.at(type_for_arg);
@@ -2994,6 +3061,107 @@ void WhileElement::push_to_stack(const Env& env, FormPool& pool, FormStack& stac
stack.push_form_element(this, true);
}
namespace {
// (if x (-> x ppointer)) -> (process->ppointer x)
Form* try_rewrite_as_process_to_ppointer(CondNoElseElement* value,
FormStack& stack,
FormPool& pool,
const Env& env) {
if (value->entries.size() != 1) {
return nullptr;
}
auto condition = value->entries.at(0).condition;
auto body = value->entries[0].body;
// safe to look for a reg directly here.
auto condition_matcher =
Matcher::op(GenericOpMatcher::condition(IR2_Condition::Kind::TRUTHY), {Matcher::any_reg(0)});
auto condition_mr = match(condition_matcher, condition);
if (!condition_mr.matched) {
return nullptr;
}
auto body_matcher =
Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("ppointer")});
auto body_mr = match(body_matcher, body);
if (!body_mr.matched) {
return nullptr;
}
auto body_var = *body_mr.maps.regs.at(0);
auto condition_var = *condition_mr.maps.regs.at(0);
if (env.get_variable_name(body_var) != env.get_variable_name(condition_var)) {
return nullptr;
}
// fmt::print("Matched condition {} in {}\n", condition_var.to_string(env),
// value->to_string(env));
auto* menv = const_cast<Env*>(&env);
menv->disable_use(body_var);
auto repopped = stack.pop_reg(condition_var, {}, env, true);
if (!repopped) {
repopped = var_to_form(condition_var, pool);
}
return pool.alloc_single_element_form<GenericElement>(
nullptr, GenericOperator::make_fixed(FixedOperatorKind::PROCESS_TO_PPOINTER), repopped);
}
// (if x (-> x 0 self)) -> (ppointer->process x)
Form* try_rewrite_as_pppointer_to_process(CondNoElseElement* value,
FormStack& stack,
FormPool& pool,
const Env& env) {
if (value->entries.size() != 1) {
return nullptr;
}
auto condition = value->entries.at(0).condition;
auto body = value->entries[0].body;
// safe to look for a reg directly here.
auto condition_matcher =
Matcher::op(GenericOpMatcher::condition(IR2_Condition::Kind::TRUTHY), {Matcher::any_reg(0)});
auto condition_mr = match(condition_matcher, condition);
if (!condition_mr.matched) {
return nullptr;
}
auto body_matcher =
Matcher::deref(Matcher::any_reg(0), false,
{DerefTokenMatcher::integer(0), DerefTokenMatcher::string("self")});
auto body_mr = match(body_matcher, body);
if (!body_mr.matched) {
return nullptr;
}
auto body_var = *body_mr.maps.regs.at(0);
auto condition_var = *condition_mr.maps.regs.at(0);
if (env.get_variable_name(body_var) != env.get_variable_name(condition_var)) {
return nullptr;
}
// fmt::print("Matched condition {} in {}\n", condition_var.to_string(env),
// value->to_string(env));
auto* menv = const_cast<Env*>(&env);
menv->disable_use(body_var);
auto repopped = stack.pop_reg(condition_var, {}, env, true);
if (!repopped) {
repopped = var_to_form(condition_var, pool);
}
return pool.alloc_single_element_form<GenericElement>(
nullptr, GenericOperator::make_fixed(FixedOperatorKind::PPOINTER_TO_PROCESS), repopped);
}
} // namespace
///////////////////
// CondNoElseElement
///////////////////
@@ -3049,8 +3217,21 @@ void CondNoElseElement::push_to_stack(const Env& env, FormPool& pool, FormStack&
if (used_as_value) {
// TODO - is this wrong?
stack.push_value_to_reg(write_as_value, pool.alloc_single_form(nullptr, this), true,
env.get_variable_type(final_destination, false));
auto as_process_to_ppointer = try_rewrite_as_process_to_ppointer(this, stack, pool, env);
if (as_process_to_ppointer) {
stack.push_value_to_reg(write_as_value, as_process_to_ppointer, true,
env.get_variable_type(final_destination, false));
} else {
auto as_ppointer_to_process = try_rewrite_as_pppointer_to_process(this, stack, pool, env);
if (as_ppointer_to_process) {
stack.push_value_to_reg(write_as_value, as_ppointer_to_process, true,
env.get_variable_type(final_destination, false));
} else {
stack.push_value_to_reg(write_as_value, pool.alloc_single_form(nullptr, this), true,
env.get_variable_type(final_destination, false));
}
}
} else {
stack.push_form_element(this, true);
}
@@ -3976,7 +4157,8 @@ void ReturnElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
if (var) {
const auto& func_type = env.func->type.last_arg();
return_type = env.get_variable_type(*var, false);
if (func_type != return_type) {
// functions with no return can return stuff.
if (func_type != return_type && func_type != TypeSpec("none")) {
auto as_cast = return_code->try_as_element<CastElement>();
if (as_cast) {
return_code->clear();
@@ -4324,6 +4506,22 @@ void BranchElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
branch_delay = pool.alloc_single_element_form<SetVarElement>(
nullptr, dst, src_form, true, env.get_variable_type(src, true));
} break;
case IR2_BranchDelay::Kind::SET_REG_FALSE: {
auto dst = m_op->branch_delay().var(0);
auto src_form = pool.alloc_single_element_form<SimpleAtomElement>(
nullptr, SimpleAtom::make_sym_val("#f"));
branch_delay = pool.alloc_single_element_form<SetVarElement>(nullptr, dst, src_form, true,
TypeSpec("symbol"));
} break;
case IR2_BranchDelay::Kind::SET_REG_TRUE: {
auto dst = m_op->branch_delay().var(0);
auto src_form = pool.alloc_single_element_form<SimpleAtomElement>(
nullptr, SimpleAtom::make_sym_val("#t"));
branch_delay = pool.alloc_single_element_form<SetVarElement>(nullptr, dst, src_form, true,
TypeSpec("symbol"));
} break;
default:
throw std::runtime_error("Unhandled branch delay in BranchElement::push_to_stack: " +
m_op->to_string(env));
@@ -4552,11 +4750,13 @@ void ArrayFieldAccess::update_with_val(Form* new_val,
{Matcher::integer(m_expected_stride), Matcher::any(0)});
mult_matcher = Matcher::match_or(
{Matcher::cast("uint", mult_matcher), Matcher::cast("int", mult_matcher), mult_matcher});
auto add_matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
{Matcher::any(1), mult_matcher});
add_matcher = Matcher::match_or(
{add_matcher, Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
{mult_matcher, Matcher::any(1)})});
auto op_match =
GenericOpMatcher::or_match({GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
GenericOpMatcher::fixed(FixedOperatorKind::ADDITION_PTR)});
auto add_matcher = Matcher::op(op_match, {Matcher::any(1), mult_matcher});
add_matcher =
Matcher::match_or({add_matcher, Matcher::op(op_match, {mult_matcher, Matcher::any(1)})});
auto mr = match(add_matcher, new_val);
if (!mr.matched) {
+2
View File
@@ -128,6 +128,8 @@ class FormStack {
assert(false);
}
int size() const { return m_stack.size(); }
private:
std::vector<StackEntry> m_stack;
bool m_is_root_stack = false;
+4
View File
@@ -23,6 +23,10 @@ Matcher Matcher::op(const GenericOpMatcher& op, const std::vector<Matcher>& args
return m;
}
Matcher Matcher::op_fixed(FixedOperatorKind op, const std::vector<Matcher>& args) {
return Matcher::op(GenericOpMatcher::fixed(op), args);
}
Matcher Matcher::op_with_rest(const GenericOpMatcher& op, const std::vector<Matcher>& args) {
Matcher m;
m.m_kind = Kind::GENERIC_OP_WITH_REST;
+1
View File
@@ -27,6 +27,7 @@ class Matcher {
static Matcher any_reg(int match_id = -1);
static Matcher any_label(int match_id = -1);
static Matcher op(const GenericOpMatcher& op, const std::vector<Matcher>& args);
static Matcher op_fixed(FixedOperatorKind op, const std::vector<Matcher>& args);
static Matcher op_with_rest(const GenericOpMatcher& op, const std::vector<Matcher>& args);
static Matcher set(const Matcher& dst, const Matcher& src); // form-form
static Matcher set_var(const Matcher& src, int dst_match_id); // var-form
+4
View File
@@ -160,6 +160,10 @@ enum class FixedOperatorKind {
VECTOR_FLOAT_PRODUCT,
L32_NOT_FALSE_CBOOL,
VECTOR_3_DOT,
PROCESS_TO_PPOINTER,
PPOINTER_TO_HANDLE,
PROCESS_TO_HANDLE,
PPOINTER_TO_PROCESS,
INVALID
};
+3
View File
@@ -145,6 +145,9 @@ class BitfieldStaticDefElement : public FormElement {
result->push_back(this);
}
const TypeSpec& bitfield_type() const { return m_type; }
const std::vector<BitFieldDef>& defs() const { return m_field_defs; }
private:
TypeSpec m_type;
std::vector<BitFieldDef> m_field_defs;
-1
View File
@@ -160,7 +160,6 @@ bool convert_to_expressions(
f.guessed_name.to_string());
f.warnings.expression_build_warning(warn);
lg::warn(warn);
return false;
}
}
+32 -15
View File
@@ -7,6 +7,15 @@
namespace decompiler {
namespace {
bool kind_for_lambda(FunctionName::FunctionKind k) {
if (k == FunctionName::FunctionKind::UNIDENTIFIED || k == FunctionName::FunctionKind::NV_STATE ||
k == FunctionName::FunctionKind::V_STATE) {
return true;
}
return false;
}
bool try_convert_lambda(const Function& parent_function,
FormPool& pool,
Form* f,
@@ -17,23 +26,31 @@ bool try_convert_lambda(const Function& parent_function,
auto& env = parent_function.ir2.env;
auto label_kv = env.label_types().find(lab.name);
if (label_kv != env.label_types().end()) {
if (label_kv->second.type_name == "_lambda_") {
auto& file = env.file;
auto other_func = file->try_get_function_at_label(atom->label());
if (other_func) {
goos::Object result;
if (defstate_behavior) {
result = final_output_defstate_anonymous_behavior(*other_func);
} else {
result = final_output_lambda(*other_func);
}
f->clear();
f->push_back(pool.alloc_element<LambdaDefinitionElement>(result));
return true;
}
if (label_kv->second.type_name != "_lambda_") {
lg::error(
"Label {} wasn't marked as a lambda, but it is. Marking lambdas is no longer required.",
lab.name);
}
}
auto& file = env.file;
auto other_func = file->try_get_function_at_label(atom->label());
if (other_func && kind_for_lambda(other_func->guessed_name.kind)) {
if (!other_func->ir2.env.has_local_vars()) {
// don't bother if we don't even have vars.
return false;
}
goos::Object result;
if (defstate_behavior) {
result = final_output_defstate_anonymous_behavior(*other_func);
} else {
result = final_output_lambda(*other_func);
}
f->clear();
f->push_back(pool.alloc_element<LambdaDefinitionElement>(result));
return true;
}
}
return false;
}
+110 -77
View File
@@ -812,6 +812,9 @@
(sound-options #x129)
(hidden-power-cell #x12f) ;; why is this here??
(saving-data #x136)
(do-not-remove-mem-card #x138)
(continue-without-saving #x13f)
(back #x13e)
@@ -2199,7 +2202,7 @@
(rotv vector :inline :offset-assert 80)
(scalev vector :inline :offset-assert 96)
(dir-targ quaternion :inline :offset-assert 112)
(angle-change-time uint64 :offset-assert 128)
(angle-change-time int64 :offset-assert 128)
(old-y-angle-diff float :offset-assert 136)
)
:method-count-assert 28
@@ -2849,9 +2852,9 @@
(playing-id sound-id :offset-assert 8)
(trans vector :inline :offset-assert 16)
(name sound-name :offset-assert 32)
(play-time uint64 :offset-assert 48)
(time-base uint64 :offset-assert 56)
(time-random uint64 :offset-assert 64)
(play-time int64 :offset-assert 48)
(time-base int64 :offset-assert 56)
(time-random int64 :offset-assert 64)
(volume int32 :offset-assert 72)
(pitch int32 :offset-assert 76)
(falloff-near int32 :offset-assert 80)
@@ -3552,10 +3555,10 @@
(align uint8 6 :offset-assert 88)
(direct uint8 6 :offset-assert 94)
(buzz-val uint8 2 :offset-assert 100)
(buzz-time uint64 2 :offset-assert 104)
(buzz-time int64 2 :offset-assert 104)
(buzz basic :offset-assert 120)
(buzz-act int32 :offset-assert 124)
(change-time uint64 :offset-assert 128)
(change-time int64 :offset-assert 128)
)
(:methods
(new (symbol type int) _type_ 0)
@@ -3580,8 +3583,8 @@
(define-extern cpad-set-buzz! (function cpad-info int int int none))
(define-extern cpad-get-data (function cpad-info cpad-info))
(define-extern get-current-time (function uint))
(define-extern get-integral-current-time (function uint))
(define-extern get-current-time (function int))
(define-extern get-integral-current-time (function int))
(define-extern cpad-invalid! (function cpad-info cpad-info))
;; in the kernel.
(define-extern cpad-open (function cpad-info int cpad-info))
@@ -4323,22 +4326,22 @@
(last-screen int32 :offset-assert 564)
(frames virtual-frame 6 :inline :offset-assert 568)
(bg-clear-color rgba 4 :offset-assert 760)
(real-frame-counter uint64 :offset-assert 776)
(base-frame-counter uint64 :offset-assert 784)
(game-frame-counter uint64 :offset-assert 792)
(integral-frame-counter uint64 :offset-assert 800)
(real-integral-frame-counter uint64 :offset-assert 808)
(actual-frame-counter uint64 :offset-assert 816)
(real-actual-frame-counter uint64 :offset-assert 824)
(part-frame-counter uint64 :offset-assert 832)
(old-real-frame-counter uint64 :offset-assert 840)
(old-base-frame-counter uint64 :offset-assert 848)
(old-game-frame-counter uint64 :offset-assert 856)
(old-integral-frame-counter uint64 :offset-assert 864)
(old-real-integral-frame-counter uint64 :offset-assert 872)
(old-actual-frame-counter uint64 :offset-assert 880)
(old-real-actual-frame-counter uint64 :offset-assert 888)
(old-part-frame-counter uint64 :offset-assert 896)
(real-frame-counter int64 :offset-assert 776)
(base-frame-counter int64 :offset-assert 784);; todo, change to signed?
(game-frame-counter int64 :offset-assert 792)
(integral-frame-counter int64 :offset-assert 800)
(real-integral-frame-counter int64 :offset-assert 808)
(actual-frame-counter int64 :offset-assert 816)
(real-actual-frame-counter int64 :offset-assert 824)
(part-frame-counter int64 :offset-assert 832)
(old-real-frame-counter int64 :offset-assert 840)
(old-base-frame-counter int64 :offset-assert 848)
(old-game-frame-counter int64 :offset-assert 856)
(old-integral-frame-counter int64 :offset-assert 864)
(old-real-integral-frame-counter int64 :offset-assert 872)
(old-actual-frame-counter int64 :offset-assert 880)
(old-real-actual-frame-counter int64 :offset-assert 888)
(old-part-frame-counter int64 :offset-assert 896)
(time-ratio float :offset-assert 904)
(seconds-per-frame float :offset-assert 908)
(frames-per-second float :offset-assert 912)
@@ -5463,7 +5466,7 @@
((name basic :offset-assert 4)
(length int16 :offset-assert 8) ;; in use elts of the data array
(allocated-length int16 :offset-assert 10) ;; size of the data array
(engine-time uint64 :offset-assert 16) ;; frame that we last executed
(engine-time int64 :offset-assert 16) ;; frame that we last executed
;; terminating nodes for the next0/prev0 linked lists
(alive-list connectable :inline :offset-assert 32)
(alive-list-end connectable :inline :offset-assert 48)
@@ -6243,8 +6246,8 @@
(num-success-before-killing int8 :offset-assert 13)
(num-attempts int8 :offset-assert 14)
(num-success int8 :offset-assert 15)
(start-time uint64 :offset-assert 16)
(last-time-called uint64 :offset-assert 24)
(start-time int64 :offset-assert 16)
(last-time-called int64 :offset-assert 24)
)
:method-count-assert 9
:size-assert #x20
@@ -8879,7 +8882,7 @@
;; - Functions
(define-extern mc-get-slot-info (function int mc-slot-info))
(define-extern mc-get-slot-info (function int mc-slot-info none))
(define-extern mc-run (function none))
(define-extern mc-check-result (function int))
(define-extern mc-sync (function int))
@@ -8983,6 +8986,29 @@
)
)
(defenum mc-status-code
:type uint32
(busy 0)
(ok 1)
(bad-handle 2)
(format-failed 3)
(internal-error 4)
(write-error 5)
(read-error 6)
(new-game 7)
(no-memory 8)
(no-card 9)
(no-last 10)
(no-format 11)
(no-file 12)
(no-save 13)
(no-space 14)
(bad-version 15)
(no-process 16)
(no-auto-save 17)
)
(declare-type entity-perm structure)
(declare-type game-save basic)
(declare-type entity-perm-array basic)
@@ -9023,7 +9049,7 @@
(death-movie-tick int32 :offset-assert 264)
(want-auto-save symbol :offset-assert 268)
(auto-save-proc handle :offset-assert 272)
(auto-save-status uint32 :offset-assert 280)
(auto-save-status mc-status-code :offset-assert 280)
(auto-save-card int32 :offset-assert 284)
(auto-save-which int32 :offset-assert 288)
(pov-camera-handle handle :offset-assert 296)
@@ -9052,7 +9078,7 @@
(seen-text? (_type_ game-text-id) symbol 21)
(mark-text-as-seen (_type_ game-text-id) none 22)
(got-buzzer? (_type_ game-task int) symbol 23)
(dummy-24 () none 24)
(save-game! (_type_ game-save string) none 24)
(load-game! (_type_ game-save) game-save 25)
(clear-text-seen! (_type_ game-text-id) none 26)
(get-death-count (_type_ symbol) int 27)
@@ -9767,8 +9793,9 @@
:flag-assert #x90000004c
)
(declare-type process-drawable process)
(deftype fact-info (basic)
((process process :offset-assert 4)
((process process-drawable :offset-assert 4)
(pickup-type pickup-type :offset-assert 8)
(pickup-amount float :offset-assert 12)
(pickup-spawn-amount float :offset-assert 16)
@@ -9779,10 +9806,10 @@
:size-assert #x28
:flag-assert #xc00000028
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(new (symbol type process-drawable pickup-type float) _type_ 0)
(TODO-RENAME-9 (_type_ symbol process-tree fact-info int) uint 9) ;; See nav-enemy::process-drawable-death-event-handler
(reset! (_type_ symbol) none 10)
(dummy-11 (_type_) float 11)
(pickup-collectable! (_type_ pickup-type float handle) float 11)
)
)
@@ -9798,7 +9825,7 @@
(eco-pill float :offset-assert 80)
(eco-pill-max float :offset-assert 84)
(health-pickup-time uint64 :offset-assert 88)
(eco-source uint64 :offset-assert 96)
(eco-source handle :offset-assert 96)
(eco-source-time uint64 :offset-assert 104)
(money-pickup-time uint64 :offset-assert 112)
(buzzer-pickup-time uint64 :offset-assert 120)
@@ -9809,7 +9836,7 @@
:size-assert #x90
:flag-assert #xc00000090
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(new (symbol type process-drawable pickup-type float) _type_ 0)
)
)
@@ -9826,7 +9853,7 @@
:size-assert #x44
:flag-assert #xc00000044
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(new (symbol type process-drawable pickup-type float) _type_ 0)
)
)
@@ -10292,7 +10319,7 @@
(max-time int32 :offset-assert 4)
(max-val float :offset-assert 8)
(timer int32 :offset-assert 12)
(start-time uint64 :offset-assert 16)
(start-time int64 :offset-assert 16)
(value float :offset-assert 24)
)
:method-count-assert 11
@@ -10345,7 +10372,7 @@
(xz-max float :offset-assert 8)
(y-max float :offset-assert 12)
(timer int32 :offset-assert 16)
(start-time uint64 :offset-assert 24)
(start-time int64 :offset-assert 24)
(value vector :inline :offset-assert 32)
)
:method-count-assert 13
@@ -10386,7 +10413,7 @@
;; - Types
(deftype smush-control (structure)
((start-time uint64 :offset-assert 0)
((start-time int64 :offset-assert 0)
(period float :offset-assert 8)
(duration float :offset-assert 12)
(amp float :offset-assert 16)
@@ -10493,7 +10520,7 @@
(trans vector :inline :offset-assert 64)
(quat quaternion :inline :offset-assert 80)
(scale vector :inline :offset-assert 96)
(notice-time uint64 :offset-assert 112)
(notice-time int64 :offset-assert 112)
(flex-blend float :offset-assert 120)
(blend float :offset-assert 124)
(max-dist meters :offset-assert 128)
@@ -11020,7 +11047,7 @@
(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)
(time int64 :offset-assert 96)
(status uint64 :offset-assert 104)
(pat pat-surface :offset-assert 112)
(reaction-flag uint32 :offset-assert 116)
@@ -13315,14 +13342,14 @@
(linger-duration uint16 :offset-assert 8)
(flags uint16 :offset-assert 10)
(name basic :offset-assert 12)
(launcher uint32 :offset-assert 16)
(launcher sparticle-group-item :offset-assert 16)
(bounds sphere :inline :offset-assert 32)
)
:method-count-assert 10
:size-assert #x30
:flag-assert #xa00000030
(:methods
(dummy-9 (_type_ process) _type_ 9)
(create-launch-control (_type_ process) sparticle-launch-control 9)
)
)
@@ -13345,8 +13372,8 @@
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-11 (_type_ vector) none 11)
(deactivate (_type_) none 12)
(dummy-13 () none 13)
)
)
@@ -14594,7 +14621,7 @@
(define-extern *dgo-name* string)
(define-extern *load-dgo-rpc* rpc-buffer-pair)
(define-extern *dgo-time* uint)
(define-extern *dgo-time* int)
(define-extern *play-str-rpc* rpc-buffer-pair)
(define-extern *que-str-lock* symbol)
(define-extern *load-str-lock* symbol)
@@ -16606,12 +16633,12 @@
(which int32 :offset-assert 120)
(buffer kheap :offset-assert 124)
(mode basic :offset-assert 128)
(result uint32 :offset-assert 132)
(save basic :offset-assert 136)
(result mc-status-code :offset-assert 132)
(save game-save :offset-assert 136)
(info mc-slot-info :inline :offset-assert 140)
(notify uint64 :offset-assert 440)
(notify handle :offset-assert 440)
(state-time uint64 :offset-assert 448)
(part basic :offset-assert 456)
(part sparticle-launch-control :offset-assert 456)
)
:heap-base #x160
:method-count-assert 23
@@ -16619,37 +16646,43 @@
:flag-assert #x17016001cc
;; inherited inspect of process
(:methods
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(get-heap () _type_ :state 14)
(get-card () _type_ :state 15)
(format-card () _type_ :state 16)
(create-file () _type_ :state 17)
(save () _type_ :state 18)
(restore () _type_ :state 19)
(error (mc-status-code) _type_ :state 20)
(done () _type_ :state 21)
(unformat-card () _type_ :state 22)
)
)
;; - Functions
(define-extern auto-save-command (function symbol int int process-tree none)) ;; TODO - not confirmed
(define-extern auto-save-init-by-other function)
(define-extern auto-save-init-by-other (function symbol process-tree int int none :behavior auto-save))
(define-extern progress-allowed? (function symbol))
(define-extern print-game-text (function string font-context symbol int int float)) ; TODO decomp error, this seems correct though
(define-extern get-aspect-ratio (function symbol))
(define-extern get-task-status (function game-task task-status))
(define-extern lookup-level-info (function symbol level-load-info))
(define-extern calculate-completion function)
(define-extern calculate-completion (function symbol float))
(define-extern game-save-elt->string (function game-save-elt string))
(define-extern progress-level-index->string (function int string))
(define-extern auto-save-post function)
(define-extern auto-save-post (function none :behavior auto-save))
(define-extern auto-save-check (function none))
(define-extern mc-format (function int mc-status-code))
(define-extern mc-unformat (function int mc-status-code))
(define-extern mc-create-file (function int uint mc-status-code))
(define-extern mc-save (function int int pointer int mc-status-code))
(define-extern mc-load (function int int pointer mc-status-code))
;; - Unknowns
(define-extern *auto-save-info* mc-slot-info) ;; unknown type
;;(define-extern scf-get-time object) ;; unknown type
(define-extern *auto-save-info* mc-slot-info)
(define-extern scf-get-time (function scf-time none))
;; ;; unknown type
@@ -19601,7 +19634,7 @@
(define-extern pause-allowed? (function symbol))
(define-extern menu-respond-to-pause (function symbol))
(define-extern hide-progress-screen (function int))
(define-extern set-letterbox-frames (function uint uint))
(define-extern set-letterbox-frames (function int int))
(define-extern letterbox (function none))
(define-extern blackout (function none))
(define-extern main-cheats (function int))
@@ -21959,7 +21992,7 @@
(sim-time-remaining float :offset-assert 688)
(float-height-offset float :offset-assert 692)
(player-attack-id int32 :offset-assert 696)
(player-bonk-timeout uint64 :offset-assert 704)
(player-bonk-timeout int64 :offset-assert 704)
(water-anim water-anim :offset-assert 712)
(player-contact basic :offset-assert 716) ; not a basic
(player-impulse collide-shape-prim-mesh :offset-assert 720)
@@ -22080,15 +22113,15 @@
(momentum-speed float :offset-assert 296)
(acceleration float :offset-assert 300)
(rotate-speed float :offset-assert 304)
(turn-time uint64 :offset-assert 312)
(frustration-time uint64 :offset-assert 320)
(turn-time int64 :offset-assert 312)
(frustration-time int64 :offset-assert 320)
(speed-scale float :offset-assert 328)
(neck joint-mod :offset-assert 332) ; this is what `neck` is on the pelican
(reaction-time uint64 :offset-assert 336)
(notice-time uint64 :offset-assert 344)
(state-timeout uint64 :offset-assert 352)
(free-time uint64 :offset-assert 360)
(touch-time uint64 :offset-assert 368)
(reaction-time int64 :offset-assert 336)
(notice-time int64 :offset-assert 344)
(state-timeout int64 :offset-assert 352)
(free-time int64 :offset-assert 360)
(touch-time int64 :offset-assert 368)
(nav-enemy-flags uint32 :offset-assert 376)
(incomming-attack-id handle :offset-assert 384)
(jump-return-state (state process) :offset-assert 392)
@@ -22879,10 +22912,10 @@
;; - Types
(deftype ticky (structure)
((delay-til-ramp uint64 :offset-assert 0)
(delay-til-timeout uint64 :offset-assert 8)
(starting-time uint64 :offset-assert 16)
(last-tick-time uint64 :offset-assert 24)
((delay-til-ramp int64 :offset-assert 0)
(delay-til-timeout int64 :offset-assert 8)
(starting-time int64 :offset-assert 16)
(last-tick-time int64 :offset-assert 24)
)
:method-count-assert 12
:size-assert #x20
@@ -505,7 +505,12 @@
[496, "(function task-control symbol)"]
],
"game-info": [[17, "(function symbol symbol continue-point symbol none)"]],
"game-info": [
[17, "(function symbol symbol continue-point symbol none)"],
[6, "(function process-drawable none)"],
[7, "(function none :behavior process-drawable)"],
[8, "(function object)"]
],
"default-menu": [
[3, "(function none)"],
@@ -222,17 +222,6 @@
"sp-process-block-2d",
"sp-get-particle",
// game-info BUG
"(method 11 fact-info-target)",
// game-save BUG
"(anon-function 5 game-save)", // BUG:
"(anon-function 6 game-save)", // BUG:
"(anon-function 7 game-save)", // BUG:
"(anon-function 8 game-save)", // BUG:
"(anon-function 9 game-save)", // BUG:
"(anon-function 10 game-save)",
// mood BUG
"update-mood-lava", // BUG:
"update-mood-lightning",
@@ -379,12 +368,6 @@
"(anon-function 10 ice-cube)",
"(anon-function 15 ice-cube)",
"(anon-function 45 lavatube-energy)",
"(anon-function 5 game-save)",
"(anon-function 6 game-save)",
"(anon-function 7 game-save)",
"(anon-function 8 game-save)",
"(anon-function 9 game-save)",
"(anon-function 10 game-save)",
"mistycannon-find-best-solution",
"target-flut-falling-anim-trans",
"kermit-check-to-hit-player?",
@@ -517,7 +500,8 @@
"unpack-comp-rle":[1, 3, 5, 6],
"(method 16 level)":[ 1, 5, 13, 14, 15, 19, 26, 53],
"unpack-comp-huf":[2, 4, 5, 6, 7, 8, 9],
"blerc-execute":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
"blerc-execute":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33],
"(method 11 fact-info-target)":[42],
"(code format-card auto-save)":[3, 4, 5, 6, 7, 8]
}
}
@@ -191,6 +191,34 @@
["L3", "game-info", true]
],
"game-save": [
["L321", "float", true],
["L316", "float", true],
["L317", "float", true],
["L9", "_lambda_", true],
["L20", "_lambda_", true],
["L50", "_lambda_", true],
["L53", "_lambda_", true],
["L67", "_lambda_", true],
["L79", "_lambda_", true],
["L91", "_lambda_", true],
["L98", "_lambda_", true],
["L107", "_lambda_", true],
["L123", "_lambda_", true],
["L271", "_auto_", true],
["L272", "_auto_", true],
["L300", "_auto_", true],
["L293", "_auto_", true],
["L294", "_auto_", true],
["L296", "_auto_", true],
["L297", "_auto_", true],
["L298", "_auto_", true],
["L304", "sparticle-launch-group", true],
["L299", "_auto_", true],
["L302", "_auto_", true]
],
"wind-h": [["L3", "_auto_", true]],
"dynamics-h": [["L6", "_auto_", true]],
@@ -1145,5 +1145,38 @@
[16, "vector"]
],
"(method 11 fact-info-target)": [
[16, "event-message-block"]
],
"(anon-function 6 game-info)": [
[16, "event-message-block"]
],
"(anon-function 8 game-info)": [
[16, "event-message-block"]
],
"(method 24 game-info)": [
[16, "scf-time"]
],
"auto-save-post": [
[16, "font-context"],
[112, "font-context"]
],
"auto-save-init-by-other":[
[16, "event-message-block"]
],
"(code error auto-save)": [
[16, "event-message-block"]
],
"(code done auto-save)": [
[16, "event-message-block"]
],
"placeholder-do-not-add-below!": []
}
@@ -2234,7 +2234,7 @@
],
"(method 32 warrior)": [
[75, "v1", "handle"]
[76, "v1", "handle"]
],
"(method 43 warrior)": [
@@ -2250,5 +2250,55 @@
[19, "v1", "float"]
],
"(method 11 fact-info-target)": [
[135, "v1", "target"],
[148, "v1", "collide-shape"],
[258, "v1", "target"],
[272, "v1", "target"],
[287, "v1", "target"],
[298, "v1", "target"],
[556, "t9", "(function process function vector meters int none)"],
[635, "t9", "(function cpu-thread function process-drawable none)"]
],
"(method 7 process)": [
[[120, 124], "a0", "basic"],
[[127, 130], "a0", "basic"],
[47, "v1", "connection"],
[57, "v1", "connection"],
[[47, 88], "v1", "connection"]
],
"(anon-function 7 game-info)": [
[2, "v1", "collide-shape"]
],
"(method 24 game-info)": [
[112, "s3", "pointer"],
[[113, 165], "a0", "game-save-tag"],
[[148, 166], "s2", "game-save-tag"],
[[148, 168], "s4", "game-save-tag"],
[[171, 222], "a0", "game-save-tag"],
[[234, 241], "a0", "game-save-tag"],
[[253, 276], "a0", "game-save-tag"],
[[283, 302], "a0", "game-save-tag"],
[[319, 325], "a1", "game-save-tag"],
[[342, 348], "a1", "game-save-tag"],
[[395, 468], "a0", "game-save-tag"],
[[480, 488], "a0", "game-save-tag"],
[[500, 506], "a0", "game-save-tag"],
[[521, 528], "a0", "game-save-tag"],
[[543, 650], "a0", "game-save-tag"],
// [329, "a0", "pointer"],
// [338, "a0", "pointer"],
// [[173, 230], "a0", "game-save-tag"],
[252, "a0", "(pointer int32)"],
[654, "a0", "pointer"]
],
"auto-save-post":[
[138, "t9", "(function object string object none)"]
],
"placeholder-do-not-add-below": []
}
@@ -3228,5 +3228,14 @@
"s4-0":"dma-buf"
}
},
"(method 11 fact-info-target)": {
"args":["obj", "kind", "amount", "source-handle"],
"vars":{"f0-29":"buzz-count","f30-0":"eco-lev"}
},
"auto-save-init-by-other": {
"args":["desired-mode", "notify-proc", "card-idx", "file-idx"]
},
"aaaaaaaaaaaaaaaaaaaaaaa": {}
}