diff --git a/common/goos/PrettyPrinter2.cpp b/common/goos/PrettyPrinter2.cpp index 8f2f8cd118..102eee7b04 100644 --- a/common/goos/PrettyPrinter2.cpp +++ b/common/goos/PrettyPrinter2.cpp @@ -267,7 +267,8 @@ void break_list(Node* node) { name == "when" || name == "behavior" || name == "lambda" || name == "defpart" || name == "define") { node->top_line_count = 2; - } else if (name == "let" || name == "let*" || name == "rlet") { + } else if (name == "let" || name == "let*" || name == "rlet" || + name == "with-dma-buffer-add-bucket") { // special case for things like let. node->top_line_count = 2; // (let if (node->child_nodes.size() > 1 && node->child_nodes[1].child_nodes.size() > 1 && diff --git a/common/type_system/defenum.cpp b/common/type_system/defenum.cpp index 560c5411eb..95b99874ca 100644 --- a/common/type_system/defenum.cpp +++ b/common/type_system/defenum.cpp @@ -131,7 +131,7 @@ EnumType* parse_defenum(const goos::Object& defenum, auto entry_val = value.integer_obj.value; if (!integer_fits(entry_val, type->get_load_size(), type->get_load_signed())) { - lg::warn("Integer {} does not fit inside a {}\n", entry_val, type->get_name()); + lg::warn("Integer {} does not fit inside a {}", entry_val, type->get_name()); } if (!entries.size()) { diff --git a/decompiler/Function/Function.h b/decompiler/Function/Function.h index d32f5a95d1..846a32ee9e 100644 --- a/decompiler/Function/Function.h +++ b/decompiler/Function/Function.h @@ -118,6 +118,7 @@ class Function { int end_word = -1; // not inclusive, but does include padding. FunctionName guessed_name; + std::string state_handler_as_anon_func; bool suspected_asm = false; bool is_inspect_method = false; diff --git a/decompiler/IR2/AtomicOp.h b/decompiler/IR2/AtomicOp.h index 2bf81b5e74..9dcb36791f 100644 --- a/decompiler/IR2/AtomicOp.h +++ b/decompiler/IR2/AtomicOp.h @@ -516,6 +516,8 @@ class StoreOp : public AtomicOp { void collect_vars(RegAccessSet& vars) const override; const SimpleExpression& addr() const { return m_addr; } const SimpleAtom& value() const { return m_value; } + Kind kind() const { return m_kind; } + int store_size() const { return m_size; } private: int m_size; diff --git a/decompiler/IR2/AtomicOpForm.cpp b/decompiler/IR2/AtomicOpForm.cpp index b3c53a6916..2f621514e2 100644 --- a/decompiler/IR2/AtomicOpForm.cpp +++ b/decompiler/IR2/AtomicOpForm.cpp @@ -476,6 +476,7 @@ FormElement* StoreOp::get_as_form(FormPool& pool, const Env& env) const { } } // print warning about failed store, but only if decompilation passes without any major errors + // TODO move this elsewhere! they CAN be deleted later and this would cause false positives. if (!env.func->warnings.has_errors()) { env.func->warnings.warning("Failed store: {} at op {}", to_string(env), m_my_idx); } diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index 2482b6f20d..239a1d0c4c 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -2959,6 +2959,69 @@ goos::Object DefstateElement::to_form_internal(const Env& env) const { // DefskelgroupElement //////////////////////////////// +WithDmaBufferAddBucketElement::WithDmaBufferAddBucketElement(RegisterAccess dma_buf, + Form* dma_buf_val, + Form* bucket, + const std::vector& body) + : m_dma_buf(dma_buf), m_dma_buf_val(dma_buf_val), m_bucket(bucket), m_body(body) { + m_dma_buf_val->parent_element = this; + m_bucket->parent_element = this; + for (auto& e : m_body) { + e->parent_form = nullptr; + } +} + +void WithDmaBufferAddBucketElement::apply(const std::function& f) { + f(this); + m_dma_buf_val->apply(f); + m_bucket->apply(f); + for (auto& e : m_body) { + e->apply(f); + } +} + +void WithDmaBufferAddBucketElement::apply_form(const std::function& f) { + m_dma_buf_val->apply_form(f); + m_bucket->apply_form(f); + for (auto& e : m_body) { + e->apply_form(f); + } +} + +void WithDmaBufferAddBucketElement::collect_vars(RegAccessSet& vars, bool recursive) const { + m_dma_buf_val->collect_vars(vars, recursive); + m_bucket->collect_vars(vars, recursive); + for (auto& e : m_body) { + e->collect_vars(vars, recursive); + } +} + +void WithDmaBufferAddBucketElement::get_modified_regs(RegSet& regs) const { + m_dma_buf_val->get_modified_regs(regs); + m_bucket->get_modified_regs(regs); + for (auto& e : m_body) { + e->get_modified_regs(regs); + } +} + +goos::Object WithDmaBufferAddBucketElement::to_form_internal(const Env& env) const { + std::vector forms; + forms.push_back(pretty_print::to_symbol("with-dma-buffer-add-bucket")); + forms.push_back(pretty_print::build_list( + {pretty_print::build_list({pretty_print::to_symbol(env.get_variable_name(m_dma_buf)), + m_dma_buf_val->to_form(env)}), + m_bucket->to_form(env)})); + for (auto& e : m_body) { + forms.push_back(e->to_form(env)); + } + + return pretty_print::build_list(forms); +} + +//////////////////////////////// +// DefskelgroupElement +//////////////////////////////// + DefskelgroupElement::DefskelgroupElement(const std::string& name, const DefskelgroupElement::Info& info, const StaticInfo& data) @@ -2991,14 +3054,12 @@ void DefskelgroupElement::apply_form(const std::function& f) { } void DefskelgroupElement::collect_vars(RegAccessSet& vars, bool recursive) const { - if (recursive) { - for (auto& e : m_info.lods) { - e.mgeo->collect_vars(vars, recursive); - e.lod_dist->collect_vars(vars, recursive); - } - m_info.janim->collect_vars(vars, recursive); - m_info.jgeo->collect_vars(vars, recursive); + for (auto& e : m_info.lods) { + e.mgeo->collect_vars(vars, recursive); + e.lod_dist->collect_vars(vars, recursive); } + m_info.janim->collect_vars(vars, recursive); + m_info.jgeo->collect_vars(vars, recursive); } void DefskelgroupElement::get_modified_regs(RegSet& regs) const { diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 9bffbd7a41..43f3d1d710 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -261,6 +261,7 @@ class StoreElement : public FormElement { void collect_vars(RegAccessSet& vars, bool recursive) const override; void get_modified_regs(RegSet& regs) const override; void push_to_stack(const Env& env, FormPool& pool, FormStack& stack) override; + const StoreOp* op() const { return m_op; } private: // todo - we may eventually want to use a different representation for more @@ -1804,6 +1805,33 @@ class DefpartElement : public FormElement { int m_id; }; +// for that macro +class WithDmaBufferAddBucketElement : public FormElement { + public: + WithDmaBufferAddBucketElement(RegisterAccess dma_buf, + Form* dma_buf_val, + Form* bucket, + const std::vector& body); + + goos::Object to_form_internal(const Env& env) const override; + void apply(const std::function& f) override; + void apply_form(const std::function& f) override; + void collect_vars(RegAccessSet& vars, bool recursive) const override; + void update_from_stack(const Env& env, + FormPool& pool, + FormStack& stack, + std::vector* result, + bool allow_side_effects) override; + void get_modified_regs(RegSet& regs) const override; + bool allow_in_if() const override { return false; } + + private: + RegisterAccess m_dma_buf; + Form* m_dma_buf_val; + Form* m_bucket; + std::vector m_body; +}; + class ResLumpMacroElement : public FormElement { public: enum class Kind { DATA, STRUCT, VALUE, INVALID }; diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 0f61705bbb..215fd30f09 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -6121,6 +6121,15 @@ void ResLumpMacroElement::update_from_stack(const Env&, result->push_back(this); } +void WithDmaBufferAddBucketElement::update_from_stack(const Env&, + FormPool&, + FormStack&, + std::vector* result, + bool) { + mark_popped(); + result->push_back(this); +} + void LabelDerefElement::update_from_stack(const Env& env, FormPool& pool, FormStack& stack, diff --git a/decompiler/ObjectFile/ObjectFileDB.h b/decompiler/ObjectFile/ObjectFileDB.h index e09f663d12..dce95c4ad4 100644 --- a/decompiler/ObjectFile/ObjectFileDB.h +++ b/decompiler/ObjectFile/ObjectFileDB.h @@ -75,11 +75,12 @@ struct LetRewriteStats { int vector_dot = 0; int rand_float_gen = 0; int set_let = 0; + int with_dma_buf_add_bucket = 0; int total() const { return dotimes + countdown + abs + abs2 + unused + ja + case_no_else + case_with_else + set_vector + set_vector2 + send_event + font_context_meth + proc_new + attack_info + - vector_dot + rand_float_gen + set_let; + vector_dot + rand_float_gen + set_let + with_dma_buf_add_bucket; } std::string print() const { @@ -103,6 +104,7 @@ struct LetRewriteStats { out += fmt::format(" vector_dot: {}\n", vector_dot); out += fmt::format(" rand_float_gen: {}\n", rand_float_gen); out += fmt::format(" set_let: {}\n", set_let); + out += fmt::format(" with_dma_buf_add_bucket: {}\n", with_dma_buf_add_bucket); return out; } @@ -125,6 +127,7 @@ struct LetRewriteStats { result.vector_dot = vector_dot + other.vector_dot; result.rand_float_gen = rand_float_gen + other.rand_float_gen; result.set_let = rand_float_gen + other.set_let; + result.with_dma_buf_add_bucket = rand_float_gen + other.with_dma_buf_add_bucket; return result; } @@ -146,6 +149,7 @@ struct LetRewriteStats { vector_dot += other.vector_dot; rand_float_gen += other.rand_float_gen; set_let += other.set_let; + with_dma_buf_add_bucket += other.with_dma_buf_add_bucket; return *this; } }; diff --git a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp index d2ec205650..f5d1a71fd9 100644 --- a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp +++ b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp @@ -902,6 +902,10 @@ std::string ObjectFileDB::ir2_function_to_string(ObjectFileData& data, Function& result += "; .function " + func.name() + "\n"; result += ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"; result += func.prologue.to_string(2) + "\n"; + if (func.guessed_name.kind == FunctionName::FunctionKind::NV_STATE || + func.guessed_name.kind == FunctionName::FunctionKind::V_STATE) { + result += fmt::format(" ; function renamed from {}\n", func.state_handler_as_anon_func); + } if (func.warnings.has_warnings()) { result += ";; Warnings:\n" + func.warnings.get_warning_text(true) + "\n"; } diff --git a/decompiler/analysis/find_defstates.cpp b/decompiler/analysis/find_defstates.cpp index 03b3585a00..3c369e3ba9 100644 --- a/decompiler/analysis/find_defstates.cpp +++ b/decompiler/analysis/find_defstates.cpp @@ -134,6 +134,7 @@ std::vector get_defstate_entries( lg::info("RENAME: {} to ", handler_func->name()); } + handler_func->state_handler_as_anon_func = handler_func->name(); if (virtual_child) { handler_func->guessed_name.set_as_v_state(*virtual_child, state_name, handler_kind); } else { diff --git a/decompiler/analysis/insert_lets.cpp b/decompiler/analysis/insert_lets.cpp index e2b5bb409a..f4aa468ddd 100644 --- a/decompiler/analysis/insert_lets.cpp +++ b/decompiler/analysis/insert_lets.cpp @@ -1048,7 +1048,6 @@ FormElement* rewrite_as_case_with_else(LetElement* in, const Env& env, FormPool& } return pool.alloc_element(in->entries().at(0).src, entries, cond->else_ir); - return nullptr; } bool var_name_equal(const Env& env, const std::string& a, std::optional b) { @@ -1724,8 +1723,7 @@ FormElement* rewrite_attack_info(LetElement* in, const Env& env, FormPool& pool) * Attempt to rewrite a let as another form. If it cannot be rewritten, this will return nullptr. */ FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool, LetRewriteStats& stats) { - // these are ordered based on frequency. for best performance, you check the most likely rewrites - // first! + // ordered based on frequency. for best performance, you check the most likely rewrites first! auto as_unused = rewrite_empty_let(in, env, pool); if (as_unused) { @@ -1994,11 +1992,161 @@ FormElement* rewrite_multi_let_as_vector_dot(LetElement* in, const Env& env, For return in; } +FormElement* rewrite_with_dma_buf_add_bucket(LetElement* in, const Env& env, FormPool& pool) { + if (in->entries().size() != 2) { + return nullptr; + } + + static auto dma_buf_base_matcher = + Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("base")}); + // dma buffer part can be anything, really. + auto buf_reg = in->entries().at(0).dest; + auto buf_dst = env.get_variable_name(buf_reg); + auto bucket_dst = env.get_variable_name(in->entries().at(1).dest); + auto buf_src = in->entries().at(0).src; + // check for (-> buf_dst base) now + auto mr_buf_base = match(dma_buf_base_matcher, in->entries().at(1).src); + if (!mr_buf_base.matched) { + return nullptr; + } + if (!var_name_equal(env, buf_dst, mr_buf_base.maps.regs.at(0))) { + lg::print("dma buf bad name\n"); + return nullptr; + } + + auto last_part = in->body()->try_as_element(); + bool empty = last_part != nullptr; + + if (empty) { + lg::print("check this out!! empty thing unhandled for now\n"); + return nullptr; + } + + last_part = dynamic_cast(in->body()->at(in->body()->size() - 1)); + if (!last_part) { + lg::error("NO LAST PART AHH wtf!!"); + return nullptr; + } + + if (last_part->entries().size() != 1 || last_part->body()->size() != 2) { + return nullptr; + } + auto buf_end_dst = env.get_variable_name(last_part->entries().at(0).dest); + + auto dmatag_let = dynamic_cast(last_part->body()->at(0)); + + if (!dmatag_let || dmatag_let->entries().size() != 1 || dmatag_let->body()->size() != 4) { + return nullptr; + } + + auto dmatag_dst = env.get_variable_name(dmatag_let->entries().at(0).dest); + + auto mr_last_part = match(dma_buf_base_matcher, last_part->entries().at(0).src); + auto mr_dmatag = match(dma_buf_base_matcher, dmatag_let->entries().at(0).src); + if (!mr_last_part.matched || !mr_dmatag.matched) { + lg::print("dma buf bad match 2\n"); + return nullptr; + } + if (!var_name_equal(env, buf_dst, mr_last_part.maps.regs.at(0)) || + !var_name_equal(env, buf_dst, mr_dmatag.maps.regs.at(0))) { + lg::print("dma buf bad name 2\n"); + return nullptr; + } + + auto set_dmatag_hdr = dynamic_cast(dmatag_let->body()->at(0)); + auto set_dmatag_w1 = dynamic_cast(dmatag_let->body()->at(1)); + auto set_dmatag_w2 = dynamic_cast(dmatag_let->body()->at(2)); + auto set_dmatag_push = dynamic_cast(dmatag_let->body()->at(3)); + + if (!set_dmatag_hdr || !set_dmatag_w1 || !set_dmatag_w2 || !set_dmatag_push) { + lg::print("dma store bad\n"); + return nullptr; + } + + // check dmatag now + auto mr_dmatag_hdr = match( + Matcher::set(Matcher::deref(Matcher::cast("(pointer int64)", Matcher::any_reg(0)), false, {}), + Matcher::integer(0x20000000)), + set_dmatag_hdr); + if (!mr_dmatag_hdr.matched || !var_name_equal(env, dmatag_dst, mr_dmatag_hdr.maps.regs.at(0))) { + return nullptr; + } + + if (set_dmatag_w1->op()->kind() != StoreOp::Kind::INTEGER || + set_dmatag_w1->op()->store_size() != 4 || !set_dmatag_w1->op()->value().is_int(0) || + set_dmatag_w1->op()->addr().kind() != SimpleExpression::Kind::ADD || + set_dmatag_w1->op()->addr().args() != 2 || !set_dmatag_w1->op()->addr().get_arg(0).is_var() || + !var_name_equal(env, dmatag_dst, set_dmatag_w1->op()->addr().get_arg(0).var()) || + !set_dmatag_w1->op()->addr().get_arg(1).is_int(8)) { + return nullptr; + } + if (set_dmatag_w2->op()->kind() != StoreOp::Kind::INTEGER || + set_dmatag_w2->op()->store_size() != 4 || !set_dmatag_w2->op()->value().is_int(0) || + set_dmatag_w2->op()->addr().kind() != SimpleExpression::Kind::ADD || + set_dmatag_w2->op()->addr().args() != 2 || !set_dmatag_w2->op()->addr().get_arg(0).is_var() || + !var_name_equal(env, dmatag_dst, set_dmatag_w2->op()->addr().get_arg(0).var()) || + !set_dmatag_w2->op()->addr().get_arg(1).is_int(12)) { + return nullptr; + } + + auto mr_dmatag_push = match( + Matcher::set(Matcher::deref(Matcher::any_reg(1), false, {DerefTokenMatcher::string("base")}), + Matcher::op_fixed(FixedOperatorKind::ADDITION_PTR, + {Matcher::any_reg(0), Matcher::integer(16)})), + set_dmatag_push); + if (!mr_dmatag_push.matched || !var_name_equal(env, dmatag_dst, mr_dmatag_push.maps.regs.at(0)) || + !var_name_equal(env, buf_dst, mr_dmatag_push.maps.regs.at(1))) { + return nullptr; + } + + auto mr_bucket_add_tag_func = match( + Matcher::func( + Matcher::symbol("dma-bucket-insert-tag"), + {Matcher::deref(Matcher::symbol("*display*"), false, + {DerefTokenMatcher::string("frames"), DerefTokenMatcher::any_expr(0), + DerefTokenMatcher::string("bucket-group")}), + Matcher::any(1), Matcher::any_reg(2), + Matcher::cast("(pointer dma-tag)", Matcher::any_reg(3))}), + last_part->body()->at(1)); + if (!mr_bucket_add_tag_func.matched || + !var_name_equal(env, bucket_dst, mr_bucket_add_tag_func.maps.regs.at(2)) || + !var_name_equal(env, buf_end_dst, mr_bucket_add_tag_func.maps.regs.at(3))) { + return nullptr; + } + auto mr_submatch = match( + Matcher::deref(Matcher::symbol("*display*"), false, {DerefTokenMatcher::string("on-screen")}), + mr_bucket_add_tag_func.maps.forms.at(0)); + if (!mr_submatch.matched) { + return nullptr; + } + + std::vector body; + + for (int i = 0, m = in->body()->size() - 1; i < m; ++i) { + if (dynamic_cast(in->body()->at(i))) { + // eliminate "(empty-form)" + continue; + } + body.push_back(in->body()->at(i)); + } + + auto elt = pool.alloc_element( + buf_reg, buf_src, mr_bucket_add_tag_func.maps.forms.at(1), body); + elt->parent_form = in->parent_form; + return elt; +} + FormElement* rewrite_multi_let(LetElement* in, const Env& env, FormPool& pool, LetRewriteStats& stats) { if (in->entries().size() >= 2) { + auto as_with_dma_buf_add_bucket = rewrite_with_dma_buf_add_bucket(in, env, pool); + if (as_with_dma_buf_add_bucket) { + stats.with_dma_buf_add_bucket++; + return as_with_dma_buf_add_bucket; + } + auto as_rand_float_gen = rewrite_rand_float_gen(in, env, pool); if (as_rand_float_gen) { stats.rand_float_gen++; diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 9b7ee80330..30e9b5a450 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -6777,6 +6777,7 @@ (progress-memcard-insert-card-with-jak2 #x19c) (progress-memcard-insert-card-with-space-to-save #x19d) (progress-memcard-formatting-required-notice #x19e) + (text-x19f #x19f) (progress-memcard-loading-data #x1a0) (text-x1a1 #x01a1) (text-x1a2 #x01a2) @@ -12439,13 +12440,42 @@ :pack-me ;; agh ) -(define-extern mc-sync (function int)) -(define-extern show-mc-info (function dma-buffer none)) +;; +++memcard-h:mc-status-code +(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) + ) +;; ---memcard-h:mc-status-code (define-extern mc-run (function none)) -(define-extern mc-check-result (function int)) +(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)) +(declare-type mc-slot-info structure) +(define-extern mc-sync (function int)) (define-extern mc-get-slot-info (function int mc-slot-info none)) +(define-extern mc-check-result (function mc-status-code)) +;; mc-makefile ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; game-info-h ;; @@ -12595,31 +12625,6 @@ ) ) -;; +++memcard-h:mc-status-code -(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) - ) -;; ---memcard-h:mc-status-code - - ;; +++game-info-h:game-secrets (defenum game-secrets :type uint32 @@ -12783,13 +12788,13 @@ (task-perm-by-index (_type_ int) entity-perm 15) (copy-perms-from-level! (_type_ level) int 16) (copy-perms-to-level! (_type_ level) int 17) - (game-info-method-18 (_type_ symbol) _type_ 18) + (debug-inspect (_type_ symbol) _type_ 18) (get-current-continue-forced (_type_) continue-point 19) (get-continue-by-name (_type_ string) continue-point 20) (set-continue! (_type_ basic symbol) continue-point 21) (game-info-method-22 (_type_) int 22) - (game-info-method-23 (_type_ game-save string) int 23) - (game-info-method-24 (_type_ game-save) none 24) + (save-game (_type_ game-save string) game-save 23) + (load-game (_type_ game-save) game-save 24) (you-suck-stage (_type_ symbol) int 25) (you-suck-scale (_type_ object) float 26) (get-next-attack-id (_type_) uint 27) @@ -24781,16 +24786,16 @@ (game-time time-frame :offset 48) (secrets uint32 :offset 56) (features uint32 :offset 60) - (tag game-save-tag :dynamic :offset-assert 80) ;; guessed by decompiler + (tag game-save-tag :inline :dynamic :offset-assert 80) ;; guessed by decompiler ) :method-count-assert 12 :size-assert #x50 :flag-assert #xc00000050 (:methods (new (symbol type int) _type_ 0) - (game-save-method-9 (_type_ string) none 9) ;; (save-to-file (_type_ string) _type_ 9) - (game-save-method-10 (_type_ string) none 10) ;; (load-from-file! (_type_ string) _type_ 10) - (game-save-method-11 (_type_ symbol) none 11) ;; (debug-print (_type_ symbol) _type_ 11) + (save-to-file (_type_ string) _type_ 9) + (load-from-file (_type_ string) _type_ 10) + (debug-inspect (_type_ symbol) _type_ 11) ) ) @@ -24799,12 +24804,12 @@ (slot int32 :offset-assert 132) (which int32 :offset-assert 136) (buffer kheap :offset-assert 140) - (mode basic :offset-assert 144) + (mode symbol :offset-assert 144) (result mc-status-code :offset-assert 148) ;; guessed by decompiler (save game-save :offset-assert 152) ;; guessed by decompiler (info mc-slot-info :inline :offset-assert 156) (notify handle :offset-assert 456) - (force basic :offset-assert 464) + (force symbol :offset-assert 464) (state-time time-frame :offset-assert 472) (icon hud-sprite :inline :offset-assert 480) ) @@ -24819,18 +24824,18 @@ (create-file () _type_ :state 18) ;; (save () _type_ :state 18) (save () _type_ :state 19) ;; (restore () _type_ :state 19) (restore () _type_ :state 20) ;; (error (mc-status-code) _type_ :state 20) - (error () _type_ :state 21) ;; (done () _type_ :state 21) + (error (mc-status-code) _type_ :state 21) ;; (done () _type_ :state 21) (done () _type_ :state 22) ;; (unformat-card () _type_ :state 22) ) ) (define-extern game-save-elt->string (function game-save-elt string)) (define-extern *auto-save-info* mc-slot-info) -;; (define-extern auto-save-post function) ;; (function none :behavior auto-save) -;; (define-extern auto-save-init-by-other function) ;; (function symbol process-tree int int none :behavior auto-save) -(define-extern auto-save-command (function symbol int int process-tree symbol none)) -(define-extern auto-save-check (function none)) -(define-extern auto-save-user (function none)) +(define-extern auto-save-post (function pointer :behavior auto-save)) +(define-extern auto-save-init-by-other (function symbol process int int symbol object :behavior auto-save)) +(define-extern auto-save-command (function symbol int int process-tree symbol (pointer auto-save))) +(define-extern auto-save-check (function int)) +(define-extern auto-save-user (function (pointer auto-save))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; settings ;; diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index cab8de2319..ee13fca774 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -363,6 +363,9 @@ 117, // goto L91 120 ], + + "(anon-function 11 game-save)": [0, 3, 4, 5], + "update-actor-hash": [0, 2, 4] }, @@ -391,7 +394,8 @@ [68, 1], [101, 1], [130, 1] - ] + ], + "auto-save-post": [[158, 1]] }, "mips2c_functions_by_name": [ diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index bfc199dba3..07b05856ae 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -988,12 +988,8 @@ "(enter cam-circular)": [[32, "collide-query"]], "(method 26 rigid-body)": [[16, ["inline-array", "vector", 8]]], "(method 47 rigid-body-object)": [[16, "matrix"]], - "(method 16 sky-work)": [ - [16, "vector"] - ], - "(method 17 sky-work)": [ - [16, "vector"] - ], + "(method 16 sky-work)": [[16, "vector"]], + "(method 17 sky-work)": [[16, "vector"]], // stack casts can't be guessed in a "run in process" (since the arg numbers are shifted?) "lightning-start": [ [16, "vector"], @@ -1005,6 +1001,7 @@ [48, "vector"], [64, "vector"] ], + "(method 24 game-info)": [[16, ["array", "uint16", 512]]], "add-a-bunch": [[16, "vector"]], "(method 23 grid-hash)": [ [16, "grid-hash-box"], diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 0cc49604c9..8dc884b4a5 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -363,8 +363,7 @@ [[140, 147], "a0", "dma-packet"], [[149, 156], "a0", "gs-gif-tag"], [160, "a0", "(pointer int64)"], - [162, "a0", "(pointer gs-reg64)"], - [[166, 172], "v1", "dma-packet"] + [162, "a0", "(pointer gs-reg64)"] ], "(method 3 generic-tie-interp-point)": [[19, "gp", "(pointer uint128)"]], "(method 19 res-lump)": [ @@ -411,9 +410,7 @@ "display-loop-main": [[223, "t9", "(function none)"]], "end-display": [ [205, "f1", "float"], - [205, "f0", "float"], - [[85, 90], "v1", "dma-packet"], - [[235, 240], "v1", "dma-packet"] + [205, "f0", "float"] ], "(method 18 res-lump)": [["_stack_", 16, "object"]], "(method 21 res-lump)": [ @@ -626,8 +623,7 @@ [[87, 92], "a0", "dma-packet"], [[111, 115], "a0", "dma-packet"], [[129, 133], "a0", "dma-packet"], - [[150, 154], "a0", "dma-packet"], - [[159, 162], "v1", "dma-packet"] + [[150, 154], "a0", "dma-packet"] ], // sprite-distort "sprite-init-distorter": [ @@ -673,7 +669,6 @@ [241, "v1", "float"], [[324, 327], "v1", "dma-packet"] ], - "warp-test": [[[18, 23], "v1", "dma-packet"]], "fx-copy-buf": [ [[17, 22], "t3", "dma-packet"], [[2, 8], "a2", "dma-packet"], @@ -1186,8 +1181,7 @@ [[33, 38], "a3", "(pointer uint128)"], [[46, 52], "a1", "(pointer uint128)"], [[60, 65], "a0", "dma-packet"], - [[65, 74], "a0", "(pointer uint64)"], - [[77, 80], "a0", "dma-packet"] + [[65, 74], "a0", "(pointer uint64)"] ], "camera-line2d": [ [4, "a2", "cam-dbg-scratch"], @@ -1501,8 +1495,7 @@ [[85, 89], "a3", "vector4w-2"], [[102, 106], "a3", "vector4w-2"], [[122, 126], "a1", "vector4w-2"], - [[129, 148], "a0", "(pointer uint64)"], - [[151, 154], "a0", "dma-packet"] + [[129, 148], "a0", "(pointer uint64)"] ], "internal-draw-debug-line": [ [[5, 224], "s5", "rgba"], @@ -1510,24 +1503,20 @@ [[109, 115], "a3", "dma-packet"], [[118, 124], "a3", "gs-gif-tag"], [[232, 245], "a1", "(inline-array vector4w-2)"], - [[107, 267], "a0", "(pointer uint64)"], - [[268, 273], "a0", "dma-packet"] + [[107, 267], "a0", "(pointer uint64)"] ], - "internal-draw-debug-text-3d": [[[53, 56], "v1", "dma-packet"]], "add-debug-flat-triangle": [ [[70, 76], "a3", "dma-packet"], [[79, 85], "a3", "gs-gif-tag"], [[108, 127], "a3", "(inline-array vector)"], - [[68, 149], "a0", "(pointer uint64)"], - [[150, 155], "a0", "dma-packet"] + [[68, 149], "a0", "(pointer uint64)"] ], "add-debug-line2d": [ [[60, 64], "a2", "dma-packet"], [[70, 73], "a2", "gs-gif-tag"], [[78, 81], "a2", "vector4w-2"], [[86, 89], "a2", "vector4w-2"], - [[97, 111], "a0", "(pointer uint64)"], - [[114, 117], "v1", "dma-packet"] + [[97, 111], "a0", "(pointer uint64)"] ], "add-debug-rot-matrix": [ [[9, 12], "t0", "float"], @@ -1536,11 +1525,8 @@ ], "add-debug-cspace": [[[4, 6], "a3", "float"]], "add-debug-points": [[[52, 57], "a3", "rgba"]], - "debug-percent-bar": [[[44, 49], "v1", "dma-packet"]], - "debug-pad-display": [[[72, 77], "v1", "dma-packet"]], "add-debug-light": [[[17, 20], "t0", "float"]], "drawable-frag-count": [[[14, 20], "s5", "drawable-group"]], - "add-debug-cursor": [[[35, 40], "v1", "dma-packet"]], "add-boundary-shader": [ [[6, 12], "a0", "gs-gif-tag"], [[14, 31], "s5", "adgif-shader"] @@ -1920,7 +1906,6 @@ [244, "s3", "clm-item"] ], "cam-layout-init": [[10, "v1", "connection"]], - "cam-layout-print": [[[21, 24], "v1", "dma-packet"]], "clmf-pos-rot": [ [68, "a1", "res-tag"], [139, "v1", "res-tag"], @@ -1956,14 +1941,7 @@ [207, "v1", "int"] ], "debug-menu-rebuild": [[7, "a0", "debug-menu-item"]], - "debug-menu-render": [ - [[45, 49], "v1", "dma-packet"], - [[108, 111], "v1", "dma-packet"] - ], - "debug-menu-item-submenu-render": [[[39, 44], "v1", "dma-packet"]], - "debug-menu-item-flag-render": [[[44, 49], "v1", "dma-packet"]], - "debug-menu-item-function-render": [[[46, 51], "v1", "dma-packet"]], - "debug-menu-item-var-render": [[[94, 98], "v1", "dma-packet"]], + "debug-menu-render": [[[108, 111], "v1", "dma-packet"]], "debug-menu-send-msg": [ [[3, 14], "s2", "debug-menu-item"], [[14, 21], "s2", "debug-menu-item-submenu"] @@ -2111,8 +2089,7 @@ [[134, 141], "a0", "dma-packet"], [[143, 150], "a0", "gs-gif-tag"], [154, "a0", "(pointer int64)"], - [156, "a0", "(pointer gs-reg64)"], - [[160, 166], "v1", "dma-packet"] + [156, "a0", "(pointer gs-reg64)"] ], "(method 14 texture-pool)": [[22, "a3", "(pointer int32)"]], "(method 13 texture-page)": [ @@ -2213,9 +2190,104 @@ [[6, 14], "v1", "continue-point"] ], "(method 23 game-info)": [ - [178, "a0", "(pointer game-save-tag)"], + [178, "a0", "pointer"], [329, "s3", "game-save-tag"], - [662, "a2", "game-save-tag"] + [662, "a2", "game-save-tag"], + [63, "v1", "connection"], + [181, "s2", "int"], + [1162, "a0", "pointer"], + [[182, 191], "v1", "(inline-array game-save-tag)"], + [333, "s3", "pointer"], + [199, "v1", "(inline-array game-save-tag)"], + [215, "v1", "(inline-array game-save-tag)"], + [231, "v1", "(inline-array game-save-tag)"], + [247, "v1", "(inline-array game-save-tag)"], + [263, "v1", "(inline-array game-save-tag)"], + [279, "v1", "(inline-array game-save-tag)"], + [295, "v1", "(inline-array game-save-tag)"], + [312, "s3", "(inline-array game-save-tag)"], + [335, "v1", "(inline-array game-save-tag)"], + [342, "v1", "(inline-array game-save-tag)"], + [348, "v1", "(inline-array game-save-tag)"], + [376, "v1", "(inline-array game-save-tag)"], + [377, "v1", "(inline-array game-save-tag)"], + [501, "v1", "(inline-array game-save-tag)"], + [555, "s4", "int"], + [522, "s4", "pointer"], + [495, "v1", "pointer"], + [535, "s4", "pointer"], + [349, "v1", "(inline-array game-save-tag)"], + [356, "v1", "(inline-array game-save-tag)"], + [363, "v1", "(inline-array game-save-tag)"], + [370, "v1", "(inline-array game-save-tag)"], + [378, "v1", "(inline-array game-save-tag)"], + [385, "v1", "(inline-array game-save-tag)"], + [392, "v1", "(inline-array game-save-tag)"], + [399, "v1", "(inline-array game-save-tag)"], + [406, "v1", "(inline-array game-save-tag)"], + [413, "v1", "(inline-array game-save-tag)"], + [420, "v1", "(inline-array game-save-tag)"], + [427, "v1", "(inline-array game-save-tag)"], + [434, "v1", "(inline-array game-save-tag)"], + [441, "v1", "(inline-array game-save-tag)"], + [448, "v1", "(inline-array game-save-tag)"], + [455, "v1", "(inline-array game-save-tag)"], + [462, "v1", "(inline-array game-save-tag)"], + [483, "v1", "(inline-array game-save-tag)"], + [504, "v1", "(inline-array game-save-tag)"], + [529, "s4", "(inline-array game-save-tag)"], + [559, "v1", "(inline-array game-save-tag)"], + [589, "a0", "(inline-array game-save-tag)"], + [617, "a0", "(inline-array game-save-tag)"], + [632, "a2", "(pointer float)"], + [650, "s4", "(inline-array game-save-tag)"], + [664, "a3", "(pointer uint8)"], + [675, "a0", "(inline-array game-save-tag)"], + [698, "a3", "(pointer uint32)"], + [714, "v1", "(inline-array game-save-tag)"], + [721, "v1", "(inline-array game-save-tag)"], + [728, "v1", "(inline-array game-save-tag)"], + [735, "v1", "(inline-array game-save-tag)"], + [742, "v1", "(inline-array game-save-tag)"], + [749, "v1", "(inline-array game-save-tag)"], + [756, "v1", "(inline-array game-save-tag)"], + [763, "v1", "(inline-array game-save-tag)"], + [770, "v1", "(inline-array game-save-tag)"], + [777, "v1", "(inline-array game-save-tag)"], + [784, "v1", "(inline-array game-save-tag)"], + [800, "a2", "(pointer time-frame)"], + [806, "v1", "(inline-array game-save-tag)"], + [822, "a2", "(pointer time-frame)"], + [828, "v1", "(inline-array game-save-tag)"], + [850, "v1", "(inline-array game-save-tag)"], + [844, "a2", "(pointer time-frame)"], + [866, "a2", "(pointer time-frame)"], + [874, "a0", "(inline-array game-save-tag)"], + [890, "a3", "(pointer uint16)"], + [900, "a0", "(inline-array game-save-tag)"], + [926, "a0", "(inline-array game-save-tag)"], + [952, "a0", "(inline-array game-save-tag)"], + [981, "a0", "(inline-array game-save-tag)"], + [1011, "v1", "(inline-array game-save-tag)"], + [1019, "v1", "(inline-array game-save-tag)"], + [1027, "v1", "(inline-array game-save-tag)"], + [1035, "v1", "(inline-array game-save-tag)"], + [1043, "v1", "(inline-array game-save-tag)"], + [1051, "v1", "(inline-array game-save-tag)"], + [1059, "v1", "(inline-array game-save-tag)"], + [1069, "v1", "(inline-array game-save-tag)"], + [1079, "v1", "(inline-array game-save-tag)"], + [1091, "v1", "(inline-array game-save-tag)"], + [1103, "v1", "(inline-array game-save-tag)"], + [1115, "v1", "(inline-array game-save-tag)"], + [1127, "v1", "(inline-array game-save-tag)"], + [1144, "v1", "(inline-array game-save-tag)"], + [604, "a3", "(pointer uint16)"], + [703, "a3", "(pointer int32)"], + [916, "a3", "(pointer uint16)"], + [942, "a3", "(pointer uint16)"], + [968, "a3", "(pointer time-frame)"], + [1001, "a3", "(pointer int8)"] ], "(anon-function 55 task-control)": [ [14, "v1", "symbol"], @@ -2341,8 +2413,6 @@ "(anon-function 54 script)": [[66, "v1", "entity-actor"]], "(anon-function 53 script)": [[40, "v1", "entity-actor"]], "(anon-function 71 script)": [[4, "v1", "symbol"]], - "letterbox": [[[27, 33], "v1", "dma-packet"]], - "blackout": [[[18, 23], "v1", "dma-packet"]], "(method 12 level)": [ [[182, 185], "a0", "texture-anim-array"], [343, "a0", "symbol"], @@ -2623,7 +2693,6 @@ [137, "v1", "progress"], [159, "v1", "progress"] ], - "end-scan": [[[18, 22], "v1", "dma-packet"]], "(code target-board-jump)": [[17, "v1", "art-joint-anim"]], "(code target-board-get-on)": [[55, "v1", "art-joint-anim"]], "(code target-board-jump-kick)": [[15, "v1", "art-joint-anim"]], @@ -2961,7 +3030,6 @@ [59, "a0", "(pointer gs-reg64)"], [61, "a0", "(pointer gs-alpha)"], [63, "a0", "(pointer gs-reg64)"], - [[107, 114], "v1", "dma-packet"], [105, "v1", "dma-packet"], [99, "a0", "dma-packet"], [97, "a1", "dma-packet"] @@ -3663,8 +3731,38 @@ ], "lightning-draw-all": [ [39, "v1", "connection"], - [40, "s1", "dma-buffer"], - [[88, 91], "v1", "dma-packet"] + [40, "s1", "dma-buffer"] + ], + "(method 24 game-info)": [ + [808, "s4", "pointer"], + [156, "s4", "pointer"], + [360, "a1", "pointer"], + [490, "a1", "pointer"], + [521, "a2", "pointer"], + [673, "v1", "pointer"], + [97, "v1", "pointer"], + [141, "s4", "game-save-tag"], + [172, "s4", "game-save-tag"], + [187, "s4", "(inline-array game-save-tag)"], + [202, "s4", "(inline-array game-save-tag)"], + [219, "s4", "(inline-array game-save-tag)"], + [232, "s4", "(inline-array game-save-tag)"], + [238, "s4", "(inline-array game-save-tag)"], + [244, "s4", "(inline-array game-save-tag)"], + [[250, 325], "s4", "(inline-array game-save-tag)"], + [328, "s4", "(inline-array game-save-tag)"], + [[342, 399], "s4", "(inline-array game-save-tag)"], + [[411, 511], "s4", "(inline-array game-save-tag)"], + [[539, 673], "s4", "(inline-array game-save-tag)"], + [[701, 805], "s4", "(inline-array game-save-tag)"], + [[4, 94], "v1", "(inline-array game-save-tag)"], + [495, "a2", "(pointer uint8)"] + ], + "(method 11 game-save)": [ + [270, "s4", "pointer"], + [[83, 97], "s4", "(inline-array game-save-tag)"], + [107, "s4", "(inline-array game-save-tag)"], + [[116, 267], "s4", "(inline-array game-save-tag)"] ], "(code active process-taskable)": [ [40, "gp", "handle"], diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index a523d1e854..7d8e144c53 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -148,7 +148,6 @@ "a0-21": ["pkt4", "dma-packet"], "a0-25": ["pkt5", "dma-packet"], "a0-30": ["pkt6", "dma-packet"], - "v1-27": ["pkt7", "dma-packet"], "v1-34": "mem-use" } }, @@ -252,7 +251,6 @@ "a3-6": ["a3-6", "vector4w-2"], "a3-8": ["a3-8", "vector4w-2"], "a1-30": ["a1-30", "vector4w-2"], - "a0-6": ["a0-6", "dma-packet"], "a0-5": ["a0-5", "(pointer uint64)"] } }, @@ -269,14 +267,12 @@ "a3-17": "tag-end", "a3-2": ["pkt1", "dma-packet"], "a3-4": ["giftag", "gs-gif-tag"], - "a1-50": ["a1-50", "(inline-array vector4w-2)"], - "a0-29": ["pkt2", "dma-packet"] + "a1-50": ["a1-50", "(inline-array vector4w-2)"] } }, "internal-draw-debug-text-3d": { "args": ["bucket", "text", "position", "color", "screen-offset"], "vars": { - "v1-12": ["pkt", "dma-packet"], "s5-0": "tag-start", "a3-4": "tag-end", "s2-0": "screen-pos", @@ -298,8 +294,7 @@ "a3-7": "tag-end", "a3-1": ["pkt1", "dma-packet"], "a3-3": ["giftag", "gs-gif-tag"], - "a3-5": ["a3-5", "(inline-array vector)"], - "a0-13": ["pkt2", "dma-packet"] + "a3-5": ["a3-5", "(inline-array vector)"] } }, "debug-draw-buffers": { @@ -334,7 +329,6 @@ "a0-18": ["a0-18", "(pointer uint64)"], "s5-0": "tag-start", "a3-11": "tag-end", - "v1-12": ["v1-12", "dma-packet"], "s2-0": "p0", "v1-9": "p1", "s4-0": "buf" @@ -513,8 +507,7 @@ "vars": { "s0-0": "buf", "s5-0": "tag-start", - "a3-3": "tag-end", - "v1-9": ["pkt", "dma-packet"] + "a3-3": "tag-end" } }, "debug-pad-display": { @@ -525,8 +518,7 @@ "s5-1": "j", "s3-0": "buf", "s4-0": "tag-start", - "a3-1": "tag-end", - "v1-16": ["pkt", "dma-packet"] + "a3-1": "tag-end" } }, "add-debug-light": { @@ -573,8 +565,7 @@ "vars": { "s4-0": "buf", "s5-0": "tag-start", - "a3-2": "tag-end", - "v1-9": ["pkt", "dma-packet"] + "a3-2": "tag-end" } }, "add-boundary-shader": { diff --git a/goal_src/jak2/engine/debug/debug.gc b/goal_src/jak2/engine/debug/debug.gc index 2e738de0eb..31b6e4aac3 100644 --- a/goal_src/jak2/engine/debug/debug.gc +++ b/goal_src/jak2/engine/debug/debug.gc @@ -80,116 +80,100 @@ (set! (-> pt-copy quad) (-> pt quad)) (set! (-> pt-copy w) 1.0) (when (transform-point-qword! (the-as vector4w (-> s5-0 vector)) pt-copy) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) - (let ((a0-5 (the-as (pointer uint64) (-> buf base)))) - (let* ((a1-3 buf) - (a3-0 (the-as dma-packet (-> a1-3 base))) - ) - (set! (-> a3-0 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> a3-0 vif0) (new 'static 'vif-tag)) - (set! (-> a3-0 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) - (set! (-> a1-3 base) (&+ (the-as pointer a3-0) 16)) - ) - (let* ((a1-4 buf) - (a3-2 (the-as gs-gif-tag (-> a1-4 base))) - ) - (set! (-> a3-2 tag) - (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1) - :nreg #x8 + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) + (let ((a0-5 (the-as (pointer uint64) (-> buf base)))) + (let* ((a1-3 buf) + (a3-0 (the-as dma-packet (-> a1-3 base))) + ) + (set! (-> a3-0 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> a3-0 vif0) (new 'static 'vif-tag)) + (set! (-> a3-0 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a1-3 base) (&+ (the-as pointer a3-0) 16)) + ) + (let* ((a1-4 buf) + (a3-2 (the-as gs-gif-tag (-> a1-4 base))) + ) + (set! (-> a3-2 tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1) + :nreg #x8 + ) ) - ) - (set! (-> a3-2 regs) - (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id xyzf2) - :regs2 (gif-reg-id rgbaq) - :regs3 (gif-reg-id xyzf2) - :regs4 (gif-reg-id rgbaq) - :regs5 (gif-reg-id xyzf2) - :regs6 (gif-reg-id rgbaq) - :regs7 (gif-reg-id xyzf2) + (set! (-> a3-2 regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id xyzf2) + :regs2 (gif-reg-id rgbaq) + :regs3 (gif-reg-id xyzf2) + :regs4 (gif-reg-id rgbaq) + :regs5 (gif-reg-id xyzf2) + :regs6 (gif-reg-id rgbaq) + :regs7 (gif-reg-id xyzf2) + ) ) + (set! (-> a1-4 base) (&+ (the-as pointer a3-2) 16)) + ) + (set! (-> s5-0 vector 1 x) 255) + (set! (-> s5-0 vector 1 y) 128) + (set! (-> s5-0 vector 1 z) 128) + (set! (-> s5-0 vector 1 w) 128) + (set! (-> s5-0 vector 0 y) (the-as int (+ (-> s5-0 vector 0 y) 288))) + (let* ((a1-11 buf) + (a3-4 (the-as vector4w-2 (-> a1-11 base))) + ) + (set! (-> a3-4 vector 0 quad) (-> s5-0 vector 1 quad)) + (set! (-> a3-4 vector 1 quad) (-> s5-0 vector 0 quad)) + (set! (-> a1-11 base) (&+ (the-as pointer a3-4) 32)) + ) + (set! (-> s5-0 vector 0 x) (the-as int (+ (-> s5-0 vector 0 x) -256))) + (set! (-> s5-0 vector 0 y) (the-as int (+ (-> s5-0 vector 0 y) -288))) + (set! (-> s5-0 vector 1 x) 128) + (set! (-> s5-0 vector 1 y) 255) + (let* ((a1-18 buf) + (a3-6 (the-as vector4w-2 (-> a1-18 base))) + ) + (set! (-> a3-6 vector 0 quad) (-> s5-0 vector 1 quad)) + (set! (-> a3-6 vector 1 quad) (-> s5-0 vector 0 quad)) + (set! (-> a1-18 base) (&+ (the-as pointer a3-6) 32)) + ) + (set! (-> s5-0 vector 0 x) (the-as int (+ (-> s5-0 vector 0 x) 512))) + (set! (-> s5-0 vector 1 y) 128) + (set! (-> s5-0 vector 1 z) 255) + (let* ((a1-23 buf) + (a3-8 (the-as vector4w-2 (-> a1-23 base))) + ) + (set! (-> a3-8 vector 0 quad) (-> s5-0 vector 1 quad)) + (set! (-> a3-8 vector 1 quad) (-> s5-0 vector 0 quad)) + (set! (-> a1-23 base) (&+ (the-as pointer a3-8) 32)) + ) + (set! (-> s5-0 vector 0 x) (the-as int (+ (-> s5-0 vector 0 x) -256))) + (set! (-> s5-0 vector 0 y) (the-as int (+ (-> s5-0 vector 0 y) -288))) + (set! (-> s5-0 vector 1 x) 255) + (set! (-> s5-0 vector 1 y) 128) + (let* ((a3-10 buf) + (a1-30 (the-as vector4w-2 (-> a3-10 base))) + ) + (set! (-> a1-30 vector 0 quad) (-> s5-0 vector 1 quad)) + (set! (-> a1-30 vector 1 quad) (-> s5-0 vector 0 quad)) + (set! (-> a3-10 base) (&+ (the-as pointer a1-30) 32)) + ) + (let ((a3-14 (/ (the-as int (+ (- -16 (the-as int a0-5)) (the-as int (-> buf base)))) 16))) + (cond + ((nonzero? a3-14) + (logior! (-> a0-5 0) (shr (shl a3-14 48) 48)) + (logior! (-> a0-5 1) (shl (shr (shl a3-14 48) 48) 32)) + ) + (else + (set! (-> buf base) a0-5) ) - (set! (-> a1-4 base) (&+ (the-as pointer a3-2) 16)) - ) - (set! (-> s5-0 vector 1 x) 255) - (set! (-> s5-0 vector 1 y) 128) - (set! (-> s5-0 vector 1 z) 128) - (set! (-> s5-0 vector 1 w) 128) - (set! (-> s5-0 vector 0 y) (the-as int (+ (-> s5-0 vector 0 y) 288))) - (let* ((a1-11 buf) - (a3-4 (the-as vector4w-2 (-> a1-11 base))) - ) - (set! (-> a3-4 vector 0 quad) (-> s5-0 vector 1 quad)) - (set! (-> a3-4 vector 1 quad) (-> s5-0 vector 0 quad)) - (set! (-> a1-11 base) (&+ (the-as pointer a3-4) 32)) - ) - (set! (-> s5-0 vector 0 x) (the-as int (+ (-> s5-0 vector 0 x) -256))) - (set! (-> s5-0 vector 0 y) (the-as int (+ (-> s5-0 vector 0 y) -288))) - (set! (-> s5-0 vector 1 x) 128) - (set! (-> s5-0 vector 1 y) 255) - (let* ((a1-18 buf) - (a3-6 (the-as vector4w-2 (-> a1-18 base))) - ) - (set! (-> a3-6 vector 0 quad) (-> s5-0 vector 1 quad)) - (set! (-> a3-6 vector 1 quad) (-> s5-0 vector 0 quad)) - (set! (-> a1-18 base) (&+ (the-as pointer a3-6) 32)) - ) - (set! (-> s5-0 vector 0 x) (the-as int (+ (-> s5-0 vector 0 x) 512))) - (set! (-> s5-0 vector 1 y) 128) - (set! (-> s5-0 vector 1 z) 255) - (let* ((a1-23 buf) - (a3-8 (the-as vector4w-2 (-> a1-23 base))) - ) - (set! (-> a3-8 vector 0 quad) (-> s5-0 vector 1 quad)) - (set! (-> a3-8 vector 1 quad) (-> s5-0 vector 0 quad)) - (set! (-> a1-23 base) (&+ (the-as pointer a3-8) 32)) - ) - (set! (-> s5-0 vector 0 x) (the-as int (+ (-> s5-0 vector 0 x) -256))) - (set! (-> s5-0 vector 0 y) (the-as int (+ (-> s5-0 vector 0 y) -288))) - (set! (-> s5-0 vector 1 x) 255) - (set! (-> s5-0 vector 1 y) 128) - (let* ((a3-10 buf) - (a1-30 (the-as vector4w-2 (-> a3-10 base))) - ) - (set! (-> a1-30 vector 0 quad) (-> s5-0 vector 1 quad)) - (set! (-> a1-30 vector 1 quad) (-> s5-0 vector 0 quad)) - (set! (-> a3-10 base) (&+ (the-as pointer a1-30) 32)) - ) - (let ((a3-14 (/ (the-as int (+ (- -16 (the-as int a0-5)) (the-as int (-> buf base)))) 16))) - (cond - ((nonzero? a3-14) - (logior! (-> a0-5 0) (shr (shl a3-14 48) 48)) - (logior! (-> a0-5 1) (shl (shr (shl a3-14 48) 48) 32)) - ) - (else - (set! (-> buf base) a0-5) ) ) ) ) - (let ((tag-end (-> buf base))) - (let ((a0-6 (the-as dma-packet (-> buf base)))) - (set! (-> a0-6 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> a0-6 vif0) (new 'static 'vif-tag)) - (set! (-> a0-6 vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer a0-6) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) - ) ) #f ) @@ -237,105 +221,95 @@ (when (and (transform-point-qword! (the-as vector4w (-> s4-0 vector)) sv-128) (transform-point-qword! (-> s4-0 vector 1) sv-144) ) - (let* ((buf2 (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf2 base)) - ) - (let ((a0-28 (the-as (pointer uint64) (-> buf2 base)))) - (let* ((pkt1 (the-as dma-packet (-> buf2 base)))) - (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> pkt1 vif0) (new 'static 'vif-tag)) - (set! (-> pkt1 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) - (set! (-> buf2 base) (&+ (the-as pointer pkt1) 16)) - ) - (let* ((giftag (the-as gs-gif-tag (-> buf2 base)))) - (set! (-> giftag tag) - (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) - :nreg #x4 - ) - ) - (set! (-> giftag regs) - (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id xyzf2) - :regs2 (gif-reg-id rgbaq) - :regs3 (gif-reg-id xyzf2) - ) - ) - (set! (-> buf2 base) (&+ (the-as pointer giftag) 16)) - ) - (case var-mode - (('fade-depth) - (let ((f0-3 (fmax 0.2 (fmin 1.0 (* 0.00000005960465 (the float (-> s4-0 vector 0 z))))))) - (set! (-> s3-0 vector 0 x) (the int (* (the float (-> var-start-color r)) f0-3))) - (set! (-> s3-0 vector 0 y) (the int (* (the float (-> var-start-color g)) f0-3))) - (set! (-> s3-0 vector 0 z) (the int (* (the float (-> var-start-color b)) f0-3))) - ) - (set! (-> s3-0 vector 0 w) (the-as int (-> var-start-color a))) - ) - (else - (set! (-> s3-0 vector 0 x) (the-as int (-> var-start-color r))) - (set! (-> s3-0 vector 0 y) (the-as int (-> var-start-color g))) - (set! (-> s3-0 vector 0 z) (the-as int (-> var-start-color b))) - (set! (-> s3-0 vector 0 w) (the-as int (-> var-start-color a))) + (with-dma-buffer-add-bucket ((buf2 (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) + (let ((a0-28 (the-as (pointer uint64) (-> buf2 base)))) + (let* ((a1-6 buf2) + (pkt1 (the-as dma-packet (-> a1-6 base))) + ) + (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt1 vif0) (new 'static 'vif-tag)) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a1-6 base) (&+ (the-as pointer pkt1) 16)) ) - ) - (cond - ((= var-mode 'fade-depth) - (let ((f0-7 (fmax 0.2 (fmin 1.0 (* 0.00000005960465 (the float (-> s4-0 vector 1 z))))))) - (set! (-> s3-0 vector 1 x) (the int (* (the float (-> var-end-color r)) f0-7))) - (set! (-> s3-0 vector 1 y) (the int (* (the float (-> var-end-color g)) f0-7))) - (set! (-> s3-0 vector 1 z) (the int (* (the float (-> var-end-color b)) f0-7))) - ) - (set! (-> s3-0 vector 1 w) (the-as int (-> var-end-color a))) - ) - (else - (set! (-> s3-0 vector 1 x) (the-as int (-> var-end-color r))) - (set! (-> s3-0 vector 1 y) (the-as int (-> var-end-color g))) - (set! (-> s3-0 vector 1 z) (the-as int (-> var-end-color b))) - (set! (-> s3-0 vector 1 w) (the-as int (-> var-end-color a))) + (let* ((a1-7 buf2) + (giftag (the-as gs-gif-tag (-> a1-7 base))) + ) + (set! (-> giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) + :nreg #x4 + ) + ) + (set! (-> giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id xyzf2) + :regs2 (gif-reg-id rgbaq) + :regs3 (gif-reg-id xyzf2) + ) + ) + (set! (-> a1-7 base) (&+ (the-as pointer giftag) 16)) ) - ) - (set! (-> s4-0 vector 0 z) (the-as int (+ (-> s4-0 vector 0 z) -8192))) - (set! (-> s4-0 vector 1 z) (the-as int (+ (-> s4-0 vector 1 z) -8192))) - (let* ((a1-50 (the-as (inline-array vector4w-2) (-> buf2 base)))) - (set! (-> a1-50 0 vector 0 quad) (-> s3-0 vector 0 quad)) - (set! (-> a1-50 0 vector 1 quad) (-> s4-0 vector 0 quad)) - (set! (-> a1-50 1 vector 0 quad) (-> s3-0 vector 1 quad)) - (set! (-> a1-50 1 vector 1 quad) (-> s4-0 vector 1 quad)) - (set! (-> buf2 base) (&+ (the-as pointer a1-50) 64)) - ) - (let ((a3-11 (/ (the-as int (+ (- -16 (the-as int a0-28)) (the-as int (-> buf2 base)))) 16))) - (cond - ((nonzero? a3-11) - (logior! (-> a0-28 0) (shr (shl a3-11 48) 48)) - (logior! (-> a0-28 1) (shl (shr (shl a3-11 48) 48) 32)) + (case var-mode + (('fade-depth) + (let ((f0-3 (fmax 0.2 (fmin 1.0 (* 0.00000005960465 (the float (-> s4-0 vector 0 z))))))) + (set! (-> s3-0 vector 0 x) (the int (* (the float (-> var-start-color r)) f0-3))) + (set! (-> s3-0 vector 0 y) (the int (* (the float (-> var-start-color g)) f0-3))) + (set! (-> s3-0 vector 0 z) (the int (* (the float (-> var-start-color b)) f0-3))) + ) + (set! (-> s3-0 vector 0 w) (the-as int (-> var-start-color a))) ) (else - (set! (-> buf2 base) a0-28) + (set! (-> s3-0 vector 0 x) (the-as int (-> var-start-color r))) + (set! (-> s3-0 vector 0 y) (the-as int (-> var-start-color g))) + (set! (-> s3-0 vector 0 z) (the-as int (-> var-start-color b))) + (set! (-> s3-0 vector 0 w) (the-as int (-> var-start-color a))) + ) + ) + (cond + ((= var-mode 'fade-depth) + (let ((f0-7 (fmax 0.2 (fmin 1.0 (* 0.00000005960465 (the float (-> s4-0 vector 1 z))))))) + (set! (-> s3-0 vector 1 x) (the int (* (the float (-> var-end-color r)) f0-7))) + (set! (-> s3-0 vector 1 y) (the int (* (the float (-> var-end-color g)) f0-7))) + (set! (-> s3-0 vector 1 z) (the int (* (the float (-> var-end-color b)) f0-7))) + ) + (set! (-> s3-0 vector 1 w) (the-as int (-> var-end-color a))) + ) + (else + (set! (-> s3-0 vector 1 x) (the-as int (-> var-end-color r))) + (set! (-> s3-0 vector 1 y) (the-as int (-> var-end-color g))) + (set! (-> s3-0 vector 1 z) (the-as int (-> var-end-color b))) + (set! (-> s3-0 vector 1 w) (the-as int (-> var-end-color a))) + ) + ) + (set! (-> s4-0 vector 0 z) (the-as int (+ (-> s4-0 vector 0 z) -8192))) + (set! (-> s4-0 vector 1 z) (the-as int (+ (-> s4-0 vector 1 z) -8192))) + (let* ((a3-7 buf2) + (a1-50 (the-as (inline-array vector4w-2) (-> a3-7 base))) + ) + (set! (-> a1-50 0 vector 0 quad) (-> s3-0 vector 0 quad)) + (set! (-> a1-50 0 vector 1 quad) (-> s4-0 vector 0 quad)) + (set! (-> a1-50 1 vector 0 quad) (-> s3-0 vector 1 quad)) + (set! (-> a1-50 1 vector 1 quad) (-> s4-0 vector 1 quad)) + (set! (-> a3-7 base) (&+ (the-as pointer a1-50) 64)) + ) + (let ((a3-11 (/ (the-as int (+ (- -16 (the-as int a0-28)) (the-as int (-> buf2 base)))) 16))) + (cond + ((nonzero? a3-11) + (logior! (-> a0-28 0) (shr (shl a3-11 48) 48)) + (logior! (-> a0-28 1) (shl (shr (shl a3-11 48) 48) 32)) + ) + (else + (set! (-> buf2 base) a0-28) + ) ) ) ) ) - (let ((tag-end (-> buf2 base))) - (let ((pkt2 (the-as dma-packet (-> buf2 base)))) - (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt2 vif0) (new 'static 'vif-tag)) - (set! (-> pkt2 vif1) (new 'static 'vif-tag)) - (set! (-> buf2 base) (&+ (the-as pointer pkt2) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) - ) ) ) ) @@ -346,42 +320,28 @@ (let ((screen-pos (new 'stack-no-clear 'vector4w))) (set! (-> screen-pos quad) (the-as uint128 0)) (when (transform-point-qword! screen-pos position) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) - (let ((font-ctx (new - 'stack - 'font-context - *font-default-matrix* - (the-as int (+ (-> screen-offset x) -1792 (/ (-> screen-pos x) 16))) - (the-as int (+ (-> screen-offset y) -1855 (/ (-> screen-pos y) 16))) - 0.0 - color - (font-flags shadow kerning) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) + (let ((font-ctx (new + 'stack + 'font-context + *font-default-matrix* + (the-as int (+ (-> screen-offset x) -1792 (/ (the-as int (-> screen-pos x)) 16))) + (the-as int (+ (-> screen-offset y) -1855 (/ (the-as int (-> screen-pos y)) 16))) + 0.0 + color + (font-flags shadow kerning) + ) ) - ) + ) + (let ((v1-10 font-ctx)) + (set! (-> v1-10 origin z) (the float (/ (the-as int (-> screen-pos z)) 16))) ) - (let ((v1-10 font-ctx)) - (set! (-> v1-10 origin z) (the float (/ (-> screen-pos z) 16))) - ) - (draw-string text buf font-ctx) - ) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) + (draw-string text buf font-ctx) ) ) ) - ) ) ) @@ -433,37 +393,39 @@ (transform-point-qword! (-> s5-0 vector 1) s2-0) (transform-point-qword! (-> s5-0 vector 2) s1-0) ) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) (let ((a0-12 (the-as (pointer uint64) (-> buf base)))) - (let* ((pkt1 (the-as dma-packet (-> buf base)))) + (let* ((a1-6 buf) + (pkt1 (the-as dma-packet (-> a1-6 base))) + ) (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) (set! (-> pkt1 vif0) (new 'static 'vif-tag)) (set! (-> pkt1 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) - (set! (-> buf base) (&+ (the-as pointer pkt1) 16)) + (set! (-> a1-6 base) (&+ (the-as pointer pkt1) 16)) ) - (let* ((giftag (the-as gs-gif-tag (-> buf base)))) - (set! (-> giftag tag) - (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type tri) :iip #x1 :abe #x1) - :nreg #x6 - ) + (let* ((a1-7 buf) + (giftag (the-as gs-gif-tag (-> a1-7 base))) ) - (set! (-> giftag regs) - (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id xyzf2) - :regs2 (gif-reg-id rgbaq) - :regs3 (gif-reg-id xyzf2) - :regs4 (gif-reg-id rgbaq) - :regs5 (gif-reg-id xyzf2) - ) + (set! (-> giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri) :iip #x1 :abe #x1) + :nreg #x6 + ) ) - (set! (-> buf base) (&+ (the-as pointer giftag) 16)) + (set! (-> giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id xyzf2) + :regs2 (gif-reg-id rgbaq) + :regs3 (gif-reg-id xyzf2) + :regs4 (gif-reg-id rgbaq) + :regs5 (gif-reg-id xyzf2) + ) + ) + (set! (-> a1-7 base) (&+ (the-as pointer giftag) 16)) ) (set! (-> s4-0 vector 0 x) (the-as int (-> color r))) (set! (-> s4-0 vector 0 y) (the-as int (-> color g))) @@ -472,14 +434,16 @@ (set! (-> s5-0 vector 0 z) (the-as int (+ (-> s5-0 vector 0 z) -8192))) (set! (-> s5-0 vector 1 z) (the-as int (+ (-> s5-0 vector 1 z) -8192))) (set! (-> s5-0 vector 2 z) (the-as int (+ (-> s5-0 vector 2 z) -8192))) - (let* ((a3-5 (the-as (inline-array vector) (-> buf base)))) + (let* ((a1-21 buf) + (a3-5 (the-as (inline-array vector) (-> a1-21 base))) + ) (set! (-> a3-5 0 quad) (-> s4-0 vector 0 quad)) (set! (-> a3-5 1 quad) (-> s5-0 vector 0 quad)) (set! (-> a3-5 2 quad) (-> s4-0 vector 0 quad)) (set! (-> a3-5 3 quad) (-> s5-0 vector 1 quad)) (set! (-> a3-5 4 quad) (-> s4-0 vector 0 quad)) (set! (-> a3-5 5 quad) (-> s5-0 vector 2 quad)) - (set! (-> buf base) (&+ (the-as pointer a3-5) 96)) + (set! (-> a1-21 base) (&+ (the-as pointer a3-5) 96)) ) (let ((a1-25 (/ (the-as int (+ (- -16 (the-as int a0-12)) (the-as int (-> buf base)))) 16))) (cond @@ -493,20 +457,6 @@ ) ) ) - (let ((tag-end (-> buf base))) - (let ((pkt2 (the-as dma-packet (-> buf base)))) - (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt2 vif0) (new 'static 'vif-tag)) - (set! (-> pkt2 vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt2) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) ) @@ -674,90 +624,76 @@ (if (not enable) (return #f) ) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) - (let ((p0 (new 'stack 'vector4w)) - (p1 (new 'stack 'vector4w)) - ) - (set! (-> p0 quad) (-> start quad)) - (set! (-> p1 quad) (-> end quad)) - (set! (-> p0 x) (the-as int (* (+ (-> p0 x) 2048) 16))) - (set! (-> p0 y) (* -16 (the-as int (- 2048 (the-as int (-> p0 y)))))) - (set! (-> p0 z) #x7fffff) - (set! (-> p1 x) (the-as int (* (+ (-> p1 x) 2048) 16))) - (set! (-> p1 y) (* -16 (the-as int (- 2048 (the-as int (-> p1 y)))))) - (set! (-> p1 z) #x7fffff) - (let ((a0-18 (the-as (pointer uint64) (-> buf base)))) - (let* ((a1-7 buf) - (a2-3 (the-as dma-packet (-> a1-7 base))) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) + (let ((p0 (new 'stack 'vector4w))) + (let ((p1 (new 'stack 'vector4w))) + (set! (-> p0 quad) (-> start quad)) + (set! (-> p1 quad) (-> end quad)) + (set! (-> p0 x) (the-as int (* (+ (-> p0 x) 2048) 16))) + (set! (-> p0 y) (* -16 (the-as int (- 2048 (the-as int (-> p0 y)))))) + (set! (-> p0 z) #x7fffff) + (set! (-> p1 x) (the-as int (* (+ (-> p1 x) 2048) 16))) + (set! (-> p1 y) (* -16 (the-as int (- 2048 (the-as int (-> p1 y)))))) + (set! (-> p1 z) #x7fffff) + (let ((a0-18 (the-as (pointer uint64) (-> buf base)))) + (let* ((a1-7 buf) + (a2-3 (the-as dma-packet (-> a1-7 base))) + ) + (set! (-> a2-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> a2-3 vif0) (new 'static 'vif-tag)) + (set! (-> a2-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a1-7 base) (&+ (the-as pointer a2-3) 16)) + ) + (let* ((a1-8 buf) + (giftag (the-as gs-gif-tag (-> a1-8 base))) + ) + (set! (-> giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) + :nreg #x4 + ) + ) + (set! (-> giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id xyzf2) + :regs2 (gif-reg-id rgbaq) + :regs3 (gif-reg-id xyzf2) + ) + ) + (set! (-> a1-8 base) (&+ (the-as pointer giftag) 16)) + ) + (let* ((a1-9 buf) + (v0 (the-as vector4w-2 (-> a1-9 base))) + ) + (set! (-> v0 vector 0 quad) (-> color quad)) + (set! (-> v0 vector 1 quad) (-> p0 quad)) + (set! (-> a1-9 base) (&+ (the-as pointer v0) 32)) + ) + (let* ((a1-10 buf) + (v1 (the-as vector4w-2 (-> a1-10 base))) + ) + (set! (-> v1 vector 0 quad) (-> color quad)) + (set! (-> v1 vector 1 quad) (-> p1 quad)) + (set! (-> a1-10 base) (&+ (the-as pointer v1) 32)) + ) + (let ((a1-14 (/ (the-as int (+ (- -16 (the-as int a0-18)) (the-as int (-> buf base)))) 16))) + (cond + ((nonzero? a1-14) + (logior! (-> a0-18 0) (shr (shl a1-14 48) 48)) + (logior! (-> a0-18 1) (shl (shr (shl a1-14 48) 48) 32)) ) - (set! (-> a2-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> a2-3 vif0) (new 'static 'vif-tag)) - (set! (-> a2-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) - (set! (-> a1-7 base) (&+ (the-as pointer a2-3) 16)) - ) - (let* ((a1-8 buf) - (giftag (the-as gs-gif-tag (-> a1-8 base))) - ) - (set! (-> giftag tag) (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) - :nreg #x4 - ) + (else + (set! (-> buf base) a0-18) ) - (set! (-> giftag regs) (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id xyzf2) - :regs2 (gif-reg-id rgbaq) - :regs3 (gif-reg-id xyzf2) - ) - ) - (set! (-> a1-8 base) (&+ (the-as pointer giftag) 16)) - ) - (let* ((a1-9 buf) - (v0 (the-as vector4w-2 (-> a1-9 base))) - ) - (set! (-> v0 vector 0 quad) (-> color quad)) - (set! (-> v0 vector 1 quad) (-> p0 quad)) - (set! (-> a1-9 base) (&+ (the-as pointer v0) 32)) - ) - (let* ((a1-10 buf) - (v1 (the-as vector4w-2 (-> a1-10 base))) - ) - (set! (-> v1 vector 0 quad) (-> color quad)) - (set! (-> v1 vector 1 quad) (-> p1 quad)) - (set! (-> a1-10 base) (&+ (the-as pointer v1) 32)) - ) - (let ((a1-14 (/ (the-as int (+ (- -16 (the-as int a0-18)) (the-as int (-> buf base)))) 16))) - (cond - ((nonzero? a1-14) - (logior! (-> a0-18 0) (shr (shl a1-14 48) 48)) - (logior! (-> a0-18 1) (shl (shr (shl a1-14 48) 48) 32)) - ) - (else - (set! (-> buf base) a0-18) ) ) ) ) ) - (let ((tag-end (-> buf base))) - (let ((v1-12 (the-as dma-packet (-> buf base)))) - (set! (-> v1-12 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-12 vif0) (new 'static 'vif-tag)) - (set! (-> v1-12 vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer v1-12) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) #f ) @@ -1135,8 +1071,9 @@ ) (defun-debug add-debug-circle ((enable symbol) (bucket bucket-id) (position vector) (radius float) (color rgba) (orientation matrix)) - (local-vars (i int) (sv-64 vector) (sv-80 vector)) "Draw a 2D circle in 3D. orientation may be #f, which will default to drawing in the xz plane." + (local-vars (i int) (sv-64 vector) (sv-80 vector)) + "note: you may pass #f for orientation" (if (not enable) (return #f) ) @@ -1194,9 +1131,9 @@ (defun-debug add-debug-rot-matrix ((enable symbol) (bucket bucket-id) (mat matrix) (position vector)) "Draw the rotation vectors of a matrix at the given position." - (add-debug-vector enable bucket position (-> mat vector 0) (meters 2.0) (new 'static 'rgba :r #xff :a #x80)) - (add-debug-vector enable bucket position (-> mat vector 1) (meters 2.0) (new 'static 'rgba :g #xff :a #x80)) - (add-debug-vector enable bucket position (-> mat vector 2) (meters 2.0) (new 'static 'rgba :b #xff :a #x80)) + (add-debug-vector enable bucket position (-> mat vector 0) (meters 2) (new 'static 'rgba :r #xff :a #x80)) + (add-debug-vector enable bucket position (-> mat vector 1) (meters 2) (new 'static 'rgba :g #xff :a #x80)) + (add-debug-vector enable bucket position (-> mat vector 2) (meters 2) (new 'static 'rgba :b #xff :a #x80)) mat ) @@ -1207,12 +1144,13 @@ (add-debug-rot-matrix enable bucket mat position) ) ) + 0 (none) ) (defun-debug add-debug-cspace ((enable symbol) (bucket bucket-id) (csp cspace)) "Draw the cspace bone transformation matrix." - (add-debug-matrix enable bucket (-> csp bone transform) (meters 2.0)) + (add-debug-matrix enable bucket (-> csp bone transform) (meters 2)) csp ) @@ -1250,6 +1188,7 @@ (orientation matrix) ) "Draw an arc with the given start and end angle. orientation may be #f, which defaults to drawing along the xz plane." + "note: you may pass #f for orientation" (local-vars (line-start vector) (line-end vector) (i int) (sv-96 vector) (sv-112 vector)) (if (not enable) (return #f) @@ -1386,25 +1325,11 @@ (if (not enable) (return #f) ) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) (draw-sprite2d-xy buf x sv-16 s1-0 s3-0 (new 'static 'rgba :a #x40)) (draw-sprite2d-xy buf x (+ sv-16 2) (the int (* sv-32 (the float s1-0))) (+ s3-0 -4) s2-0) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) #f @@ -1456,9 +1381,9 @@ (set! (-> stick-history 0 x) (* (sin (-> pad stick0-dir)) (-> pad stick0-speed))) (set! (-> stick-history 0 y) (* (cos (-> pad stick0-dir)) (-> pad stick0-speed))) (dotimes (j 32) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug2) + ) (draw-sprite2d-xy buf (the int (* 120.0 (-> stick-history j x))) @@ -1467,20 +1392,6 @@ 10 (new 'static 'rgba :a #x80 :r (- 255 (* 7 j))) ) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug2) - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) ) @@ -1505,7 +1416,7 @@ bucket position (-> light direction) - (meters 3.0) + (meters 3) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) ) (let ((sphere-pos (new-stack-vector0))) @@ -1690,49 +1601,35 @@ (defun-debug add-debug-cursor ((enable symbol) (bucket bucket-id) (x int) (y int) (arg4 int)) (when enable - (let* ((buf (-> *display* frames (-> *display* on-screen) global-buf)) - (tag-start (-> buf base)) - ) - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((v1-7 arg4)) - (draw-string-xy - "X" - buf - (+ x -5) - (+ y -4) - (cond - ((= v1-7 1) - (font-color precursor-#ec3b00) - ) - ((= v1-7 2) - (font-color yellow-#f3f300) - ) - ((= v1-7 4) - (font-color green-#3df23d) - ) - (else - (font-color default-#cddbcd) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf)) + bucket + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((v1-7 arg4)) + (draw-string-xy + "X" + buf + (+ x -5) + (+ y -4) + (cond + ((= v1-7 1) + (font-color precursor-#ec3b00) + ) + ((= v1-7 2) + (font-color yellow-#f3f300) + ) + ((= v1-7 4) + (font-color green-#3df23d) + ) + (else + (font-color default-#cddbcd) + ) ) + (font-flags shadow) ) - (font-flags shadow) - ) - ) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) ) ) ) - ) 0 (none) ) @@ -1877,41 +1774,41 @@ sv-32 ) ) - (let* ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (s5-0 (-> s4-0 base)) - ) - (let* ((v1-16 s4-0) - (a0-3 (the-as dma-packet (-> v1-16 base))) - ) - (set! (-> a0-3 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) - (set! (-> a0-3 vif0) (new 'static 'vif-tag)) - (set! (-> a0-3 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) - (set! (-> v1-16 base) (the-as pointer (the-as dma-packet (&+ a0-3 16)))) + (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + buf + ) + (let ((v1-16 s4-0)) + (let ((a0-3 (the-as dma-packet (-> v1-16 base)))) + (set! (-> a0-3 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) + (set! (-> a0-3 vif0) (new 'static 'vif-tag)) + (set! (-> a0-3 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-16 base) (the-as pointer (the-as dma-packet (&+ a0-3 16)))) + ) ) - (let* ((v1-17 s4-0) - (a0-5 (the-as gs-gif-tag (-> v1-17 base))) - ) - (set! (-> a0-5 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) - (set! (-> a0-5 regs) GIF_REGS_ALL_AD) - (set! (-> v1-17 base) (the-as pointer (the-as gs-gif-tag (&+ a0-5 16)))) + (let ((v1-17 s4-0)) + (let ((a0-5 (the-as gs-gif-tag (-> v1-17 base)))) + (set! (-> a0-5 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) + (set! (-> a0-5 regs) GIF_REGS_ALL_AD) + (set! (-> v1-17 base) (the-as pointer (the-as gs-gif-tag (&+ a0-5 16)))) + ) ) - (let* ((v1-18 s4-0) - (a0-7 (-> v1-18 base)) - ) - (set! (-> (the-as (pointer gs-zbuf) a0-7) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) - (set! (-> (the-as (pointer gs-reg64) a0-7) 1) (gs-reg64 zbuf-1)) - (set! (-> (the-as (pointer gs-test) a0-7) 2) (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) - ) - (set! (-> (the-as (pointer gs-reg64) a0-7) 3) (gs-reg64 test-1)) - (set! (-> (the-as (pointer gs-alpha) a0-7) 4) (new 'static 'gs-alpha :b #x1 :d #x1)) - (set! (-> (the-as (pointer gs-reg64) a0-7) 5) (gs-reg64 alpha-1)) - (set! (-> v1-18 base) (&+ a0-7 48)) + (let ((v1-18 s4-0)) + (let ((a0-7 (-> v1-18 base))) + (set! (-> (the-as (pointer gs-zbuf) a0-7) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (set! (-> (the-as (pointer gs-reg64) a0-7) 1) (gs-reg64 zbuf-1)) + (set! (-> (the-as (pointer gs-test) a0-7) 2) (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (set! (-> (the-as (pointer gs-reg64) a0-7) 3) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-alpha) a0-7) 4) (new 'static 'gs-alpha :b #x1 :d #x1)) + (set! (-> (the-as (pointer gs-reg64) a0-7) 5) (gs-reg64 alpha-1)) + (set! (-> v1-18 base) (&+ a0-7 48)) + ) ) (set! sv-16 (-> s4-0 base)) (&+! (-> s4-0 base) 16) @@ -1923,20 +1820,6 @@ (set! (-> (the-as dma-packet sv-16) vif0) (new 'static 'vif-tag)) (set! (-> (the-as dma-packet sv-16) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-25)) ) - (let ((a3-2 (-> s4-0 base))) - (let ((v1-29 (the-as dma-packet (-> s4-0 base)))) - (set! (-> v1-29 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-29 vif0) (new 'static 'vif-tag)) - (set! (-> v1-29 vif1) (new 'static 'vif-tag)) - (set! (-> s4-0 base) (the-as pointer (the-as dma-packet (&+ v1-29 16)))) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - buf - s5-0 - (the-as (pointer dma-tag) a3-2) - ) - ) ) 0 (none) diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index 06f8b45888..71ece9ccbf 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -82,9 +82,6 @@ (test 22) ;; hi 64 ) -;; NOTE - for scene -(define-extern auto-save-user (function none)) - ;; DECOMP BEGINS (deftype process-drawable (process) diff --git a/goal_src/jak2/engine/game/game-info-h.gc b/goal_src/jak2/engine/game/game-info-h.gc index 956175575a..f2ad5d2bca 100644 --- a/goal_src/jak2/engine/game/game-info-h.gc +++ b/goal_src/jak2/engine/game/game-info-h.gc @@ -346,13 +346,13 @@ (task-perm-by-index (_type_ int) entity-perm 15) (copy-perms-from-level! (_type_ level) int 16) (copy-perms-to-level! (_type_ level) int 17) - (game-info-method-18 (_type_ symbol) _type_ 18) + (debug-inspect (_type_ symbol) _type_ 18) (get-current-continue-forced (_type_) continue-point 19) (get-continue-by-name (_type_ string) continue-point 20) (set-continue! (_type_ basic symbol) continue-point 21) (game-info-method-22 (_type_) int 22) - (game-info-method-23 (_type_ game-save string) int 23) - (game-info-method-24 (_type_ game-save) none 24) + (save-game (_type_ game-save string) game-save 23) + (load-game (_type_ game-save) game-save 24) (you-suck-stage (_type_ symbol) int 25) (you-suck-scale (_type_ object) float 26) (get-next-attack-id (_type_) uint 27) diff --git a/goal_src/jak2/engine/game/game-info.gc b/goal_src/jak2/engine/game/game-info.gc index 464cebccbd..7270a21518 100644 --- a/goal_src/jak2/engine/game/game-info.gc +++ b/goal_src/jak2/engine/game/game-info.gc @@ -504,7 +504,7 @@ ((= v1-135 'debug) (reset-actors arg0) (if arg1 - (game-info-method-24 obj arg1) + (load-game obj arg1) ) ) ((= v1-135 'play) @@ -536,7 +536,7 @@ (close! (-> *game-info* sub-task-list 1) 'event) (set-continue! *game-info* arg2 #f) (when arg3 - (game-info-method-24 *game-info* arg3) + (load-game *game-info* arg3) (set! arg2 (get-current-continue-forced *game-info*)) (reset-actors 'life) (send-event (handle->process (-> *game-info* auto-save-proc)) 'done) @@ -1395,7 +1395,7 @@ obj ) -(defmethod game-info-method-18 game-info ((obj game-info) (arg0 symbol)) +(defmethod debug-inspect game-info ((obj game-info) (arg0 symbol)) (local-vars (sv-16 int) (sv-24 int) diff --git a/goal_src/jak2/engine/game/game-save.gc b/goal_src/jak2/engine/game/game-save.gc index 89c6334be1..84270c4f57 100644 --- a/goal_src/jak2/engine/game/game-save.gc +++ b/goal_src/jak2/engine/game/game-save.gc @@ -5,8 +5,2321 @@ ;; name in dgo: game-save ;; dgos: ENGINE, GAME -;; NOTE - for default-menu -(define-extern auto-save-command (function symbol int int process-tree symbol none)) +(defenum game-save-elt + :type uint16 + (task-deaths 402) + (task-node-list 306) + (task-list 300) + (real-time 102) + (aspect-ratio 509) + (play-hints 507) + (continue-deaths 401) + (node-close-time 419) + (continue-time 408) + (dialog-volume 502) + (vibration 506) + (real-frame-time 105) + (task-complete-time 409) + (total-game-time 108) + (frame-time 104) + (in-level-time 414) + (sfx-volume 500) + (life 201) + (gun-ammo 216) + (task-start-time 415) + (auto-save-count 413) + (eco-pill-dark-total 212) + (game-time 103) + (screenx 504) + (death-movie-tick 207) + (buzzer-total 205) + (bigmap-data 308) + (stereo-mode 513) + (task-pickup-time 407) + (name 100) + (level-open-list 305) + (disk-tester 600) + (camera-stick-dir 510) + (continue 200) + (deaths-per-level 411) + (karma 210) + (scores 221) + (session-time 106) + (bg-time 107) + (screeny 505) + (total-trys 421) + (music-volume 501) + (node-death-count 416) + (gem 218) + (base-time 101) + (node-name 420) + (eco-pill-dark 211) + (skill-total 209) + (bigmap-offsets 309) + (death-pos 412) + (talker-state 307) + (features 214) + (game-start-time 403) + (hit-time 406) + (subtitle 511) + (total-deaths 400) + (death-time 405) + (video-mode 508) + (fuel-cell 206) + (node-gem-count 417) + (skill 208) + (subtitle-language 512) + (secrets 220) + (shield 213) + (gun-type 215) + (gem-total 219) + (node-skill-count 418) + (money-per-level 204) + (money-total 203) + (money 202) + (enter-level-time 410) + (purchase-secrets 222) + (perm-list 301) + (language 503) + ) ;; DECOMP BEGINS +(defun-debug game-save-elt->string ((arg0 game-save-elt)) + (enum->string game-save-elt arg0) + ) + +(deftype game-save-tag (structure) + ((user-object object 2 :offset 0) + (user-uint64 uint64 :offset 0) + (user-float0 float :offset 0) + (user-float float 2 :offset 0) + (user-int32 int32 2 :offset 0) + (user-uint32 uint32 2 :offset 0) + (user-int16 int16 4 :offset 0) + (user-uint16 uint16 4 :offset 0) + (user-int8 int8 8 :offset 0) + (user-int80 int8 :offset 0) + (user-int81 int8 :offset 1) + (user-uint8 uint8 8 :offset 0) + (elt-count int32 :offset-assert 8) + (elt-size uint16 :offset-assert 12) + (elt-type game-save-elt :offset-assert 14) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + + +(deftype game-save (basic) + ((version int32 :offset-assert 4) + (allocated-length int32 :offset-assert 8) + (length int32 :offset-assert 12) + (info-int32 int32 16 :offset-assert 16) + (info-int8 int8 64 :offset 16) + (level-index int32 :offset 16) + (gem-count float :offset 20) + (skill-count float :offset 24) + (completion-percentage float :offset 28) + (minute uint8 :offset 36) + (hour uint8 :offset 37) + (week uint8 :offset 38) + (day uint8 :offset 39) + (month uint8 :offset 40) + (year uint8 :offset 41) + (new-game int32 :offset 44) + (game-time time-frame :offset 48) + (secrets uint32 :offset 56) + (features uint32 :offset 60) + (tag game-save-tag :inline :dynamic :offset-assert 80) + ) + :method-count-assert 12 + :size-assert #x50 + :flag-assert #xc00000050 + (:methods + (new (symbol type int) _type_ 0) + (save-to-file (_type_ string) _type_ 9) + (load-from-file (_type_ string) _type_ 10) + (debug-inspect (_type_ symbol) _type_ 11) + ) + ) + + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of game-save ((obj game-save)) + (the-as int (+ (-> game-save size) (-> obj allocated-length))) + ) + +(defmethod new game-save ((allocation symbol) (type-to-make type) (arg0 int)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) arg0))))) + (set! (-> v0-0 version) 3) + (set! (-> v0-0 allocated-length) arg0) + v0-0 + ) + ) + +(defmethod debug-inspect game-save ((obj game-save) (arg0 symbol)) + (local-vars (sv-16 int) (sv-32 string) (sv-48 string)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tversion: ~D~%" (-> obj version)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tlevel-index: ~D~%" (-> obj level-index)) + (format #t "~Tgem-count: ~f~%" (-> obj gem-count)) + (format #t "~Tskill-count: ~f~%" (-> obj skill-count)) + (format #t "~Tcompletion-percentage: ~f~%" (-> obj completion-percentage)) + (format + #t + "~Tsave-time: ~x:~x ~x/~x/~x~%" + (-> obj hour) + (-> obj minute) + (-> obj day) + (-> obj month) + (-> obj year) + ) + (format #t "~Tgame-time: ~E~%" (-> obj game-time)) + (format #t "~Tsecrets: #x~x~%" (-> obj secrets)) + (format #t "~Tfeatures: #x~x~%" (-> obj features)) + (format #t "~Ttag[]: @ #x~X~%" (-> obj tag)) + (let ((s4-0 (the-as object (-> obj tag))) + (s3-0 0) + ) + (while (< (the-as int s4-0) (the-as int (&-> obj tag 0 user-int8 (-> obj length)))) + (let ((s2-0 format) + (s1-0 #t) + (s0-0 "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f ") + ) + (set! sv-16 s3-0) + (let ((a3-2 (game-save-elt->string (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) + (t0-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (t1-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) + (t2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + (t3-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (s2-0 s1-0 s0-0 sv-16 a3-2 t0-1 t1-1 t2-1 t3-0) + ) + ) + (let ((v1-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) + (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) + (format #t "= \"~G\"~%" (-> (the-as (inline-array game-save-tag) s4-0) 1)) + (format #t "~%") + ) + ) + (when arg0 + (case (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type) + (((game-save-elt node-death-count) (game-save-elt node-skill-count) (game-save-elt node-gem-count)) + (dotimes (s2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (let ((s1-1 format) + (s0-1 #t) + ) + (set! sv-32 " ~-32S: ~D~%") + (let ((a2-15 (game-task-node->string (the-as game-task-node s2-1))) + (a3-3 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1)) + ) + (s1-1 s0-1 sv-32 a2-15 a3-3) + ) + ) + ) + ) + (((game-save-elt node-close-time)) + (dotimes (s2-2 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (let ((s1-2 format) + (s0-2 #t) + ) + (set! sv-48 " ~-32S: ~D~%") + (let ((a2-16 (game-task-node->string (the-as game-task-node s2-2))) + (a3-4 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-2 8)))) + ) + ) + (s1-2 s0-2 sv-48 a2-16 a3-4) + ) + ) + ) + ) + (((game-save-elt enter-level-time)) + (dotimes (s2-3 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (when (< s2-3 (-> *task-level* length)) + (let ((a2-17 (task-level->string s2-3))) + (if a2-17 + (format + #t + " ~-32S: ~D~%" + a2-17 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-3 8)))) + ) + ) + ) + ) + ) + ) + (((game-save-elt in-level-time)) + (dotimes (s2-4 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (when (< s2-4 (-> *task-level* length)) + (let ((a2-18 (task-level->string s2-4))) + (if a2-18 + (format + #t + " ~-32S: ~D~%" + a2-18 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-4 8)))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-complete-time) (game-save-elt task-start-time)) + (dotimes (s2-5 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (let ((a2-19 (game-task->string (the-as game-task s2-5)))) + (if a2-19 + (format + #t + " ~-32S: ~D~%" + a2-19 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-5 8)))) + ) + ) + ) + ) + ) + (((game-save-elt disk-tester)) + 0 + ) + ) + ) + (set! s4-0 (&+ + (the-as pointer s4-0) + (logand -16 (+ (* (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) + ) + 31 + ) + ) + ) + ) + (+! s3-0 1) + ) + ) + obj + ) + +(defmethod inspect game-save ((obj game-save)) + (debug-inspect obj #f) + ) + +(defmethod save-game game-info ((obj game-info) (arg0 game-save) (arg1 string)) + (with-pp + (dotimes (s4-0 (-> *level* length)) + (let ((a1-1 (-> *level* level s4-0))) + (if (= (-> a1-1 status) 'active) + (copy-perms-from-level! obj a1-1) + ) + ) + ) + (set! (-> arg0 length) 0) + (set! (-> arg0 version) 3) + (let ((s4-1 (get-continue-by-name obj (-> obj current-continue name)))) + (when (not s4-1) + (format + 0 + "ERROR: SAVE: attempting to save continue ~A which is not in level-info~%" + (-> obj current-continue name) + ) + (set! s4-1 (get-continue-by-name obj "title-start")) + ) + (let ((v1-19 (-> *task-manager-engine* alive-list next0))) + *task-manager-engine* + (let ((s2-0 (-> v1-19 next0))) + (while (!= v1-19 (-> *task-manager-engine* alive-list-end)) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer pp)) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'fail-continue) + (let ((a1-6 (send-event-function (the-as process-tree (-> (the-as connection v1-19) param1)) a1-5))) + (when a1-6 + (let ((a0-13 (get-continue-by-name obj (the-as string a1-6)))) + (if a0-13 + (set! s4-1 a0-13) + ) + ) + ) + ) + ) + (set! v1-19 s2-0) + *task-manager-engine* + (set! s2-0 (-> s2-0 next0)) + ) + ) + ) + (set! (-> arg0 level-index) (the-as int (-> (lookup-level-info (-> s4-1 level)) task-level))) + (set! (-> arg0 gem-count) (-> obj gem)) + (set! (-> arg0 skill-count) (-> obj skill)) + (set! (-> arg0 completion-percentage) (calculate-percentage obj)) + (set! (-> arg0 game-time) (+ -300000 (-> *display* total-game-clock frame-counter))) + (set! (-> arg0 secrets) (the-as uint (-> obj purchase-secrets))) + (set! (-> arg0 features) (the-as uint (-> obj features))) + (when (string= (-> s4-1 name) "title-start") + (set! (-> arg0 new-game) 1) + (set! (-> arg0 level-index) 0) + (set! (-> arg0 gem-count) 0.0) + (set! (-> arg0 skill-count) 0.0) + (set! (-> arg0 completion-percentage) 0.0) + (set! (-> arg0 game-time) 0) + (set! (-> arg0 features) (the-as uint 0)) + (set! (-> arg0 secrets) (the-as uint 0)) + (when (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! (-> arg0 new-game) 2) + (set! (-> arg0 secrets) (the-as uint #x8000)) + ) + ) + (let ((s2-1 (new 'stack 'scf-time))) + (scf-get-time s2-1) + (when (zero? (-> s2-1 stat)) + (set! (-> arg0 minute) (-> s2-1 minute)) + (set! (-> arg0 hour) (-> s2-1 hour)) + (set! (-> arg0 day) (-> s2-1 day)) + (set! (-> arg0 week) (-> s2-1 week)) + (set! (-> arg0 month) (-> s2-1 month)) + (set! (-> arg0 year) (-> s2-1 year)) + ) + ) + (let ((s2-2 (the-as object (-> arg0 tag)))) + (let ((s1-0 (-> (the-as (inline-array game-save-tag) s2-2) 0))) + (set! (-> s1-0 elt-type) (game-save-elt name)) + (set! (-> s1-0 elt-count) (+ (length arg1) 1)) + (set! (-> s1-0 elt-size) (the-as uint 1)) + ) + (copy-charp<-charp (the-as (pointer uint8) (-> (the-as (inline-array game-save-tag) s2-2) 1)) (-> arg1 data)) + (let ((v1-59 + (the-as + (inline-array game-save-tag) + (+ (the-as int s2-2) + (the-as + int + (&+ (logand -16 (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s2-2) 0 elt-count)) 15)) 16) + ) + ) + ) + ) + ) + (let ((a0-31 (-> v1-59 0))) + (set! (-> a0-31 elt-type) (game-save-elt base-time)) + (set! (-> a0-31 elt-count) 2) + (set! (-> a0-31 elt-size) (the-as uint 8)) + ) + (let ((s3-1 (-> v1-59 1))) + (save! (-> *display* base-clock) (the-as (pointer uint64) s3-1)) + (let ((v1-63 (the-as object (&+ s3-1 16)))) + (let ((a0-33 (-> (the-as (inline-array game-save-tag) v1-63) 0))) + (set! (-> a0-33 elt-type) (game-save-elt game-time)) + (set! (-> a0-33 elt-count) 2) + (set! (-> a0-33 elt-size) (the-as uint 8)) + ) + (let ((s3-2 (&+ (the-as game-save-tag v1-63) 16))) + (save! (-> *display* game-clock) (the-as (pointer uint64) s3-2)) + (let ((v1-67 (the-as object (&+ s3-2 16)))) + (let ((a0-35 (-> (the-as (inline-array game-save-tag) v1-67) 0))) + (set! (-> a0-35 elt-type) (game-save-elt total-game-time)) + (set! (-> a0-35 elt-count) 2) + (set! (-> a0-35 elt-size) (the-as uint 8)) + ) + (let ((s3-3 (&+ (the-as game-save-tag v1-67) 16))) + (save! (-> *display* total-game-clock) (the-as (pointer uint64) s3-3)) + (let ((v1-71 (the-as object (&+ s3-3 16)))) + (let ((a0-37 (-> (the-as (inline-array game-save-tag) v1-71) 0))) + (set! (-> a0-37 elt-type) (game-save-elt real-time)) + (set! (-> a0-37 elt-count) 2) + (set! (-> a0-37 elt-size) (the-as uint 8)) + ) + (let ((s3-4 (&+ (the-as game-save-tag v1-71) 16))) + (save! (-> *display* real-clock) (the-as (pointer uint64) s3-4)) + (let ((v1-75 (the-as object (&+ s3-4 16)))) + (let ((a0-39 (-> (the-as (inline-array game-save-tag) v1-75) 0))) + (set! (-> a0-39 elt-type) (game-save-elt frame-time)) + (set! (-> a0-39 elt-count) 2) + (set! (-> a0-39 elt-size) (the-as uint 8)) + ) + (let ((s3-5 (&+ (the-as game-save-tag v1-75) 16))) + (save! (-> *display* frame-clock) (the-as (pointer uint64) s3-5)) + (let ((v1-79 (the-as object (&+ s3-5 16)))) + (let ((a0-41 (-> (the-as (inline-array game-save-tag) v1-79) 0))) + (set! (-> a0-41 elt-type) (game-save-elt real-frame-time)) + (set! (-> a0-41 elt-count) 2) + (set! (-> a0-41 elt-size) (the-as uint 8)) + ) + (let ((s3-6 (&+ (the-as game-save-tag v1-79) 16))) + (save! (-> *display* real-frame-clock) (the-as (pointer uint64) s3-6)) + (let ((v1-83 (the-as object (&+ s3-6 16)))) + (let ((a0-43 (-> (the-as (inline-array game-save-tag) v1-83) 0))) + (set! (-> a0-43 elt-type) (game-save-elt session-time)) + (set! (-> a0-43 elt-count) 2) + (set! (-> a0-43 elt-size) (the-as uint 8)) + ) + (let ((s3-7 (&+ (the-as game-save-tag v1-83) 16))) + (save! (-> *display* session-clock) (the-as (pointer uint64) s3-7)) + (let ((v1-87 (the-as object (&+ s3-7 16)))) + (let ((a0-45 (-> (the-as (inline-array game-save-tag) v1-87) 0))) + (set! (-> a0-45 elt-type) (game-save-elt bg-time)) + (set! (-> a0-45 elt-count) 2) + (set! (-> a0-45 elt-size) (the-as uint 8)) + ) + (let ((s3-8 (&+ (the-as game-save-tag v1-87) 16))) + (save! (-> *display* bg-clock) (the-as (pointer uint64) s3-8)) + (let ((s3-9 (the-as object (&+ s3-8 16)))) + (let ((s4-2 (-> s4-1 name))) + (let ((s2-3 (-> (the-as (inline-array game-save-tag) s3-9) 0))) + (set! (-> s2-3 elt-type) (game-save-elt continue)) + (set! (-> s2-3 elt-count) (+ (length s4-2) 1)) + (set! (-> s2-3 elt-size) (the-as uint 1)) + ) + (copy-charp<-charp (the-as (pointer uint8) (&+ (the-as game-save-tag s3-9) 16)) (-> s4-2 data)) + ) + (let ((v1-99 (the-as + object + (&+ (the-as pointer s3-9) (+ (logand -16 (+ (-> (the-as game-save-tag s3-9) elt-count) 15)) 16)) + ) + ) + ) + (let ((a0-52 (-> (the-as (inline-array game-save-tag) v1-99) 0))) + (set! (-> a0-52 elt-type) (game-save-elt life)) + (set! (-> a0-52 elt-count) 0) + (set! (-> a0-52 user-float0) (-> obj life)) + ) + (let ((v1-100 (the-as (inline-array game-save-tag) (&+ (the-as pointer v1-99) 16)))) + (let ((a0-53 (-> v1-100 0))) + (set! (-> a0-53 elt-type) (game-save-elt buzzer-total)) + (set! (-> a0-53 elt-count) 0) + (set! (-> a0-53 user-float0) (-> obj buzzer-total)) + ) + (let ((v1-101 (the-as object (-> v1-100 1)))) + (let ((a0-54 (-> (the-as (inline-array game-save-tag) v1-101) 0))) + (set! (-> a0-54 elt-type) (game-save-elt fuel-cell)) + (set! (-> a0-54 elt-count) 0) + (set! (-> a0-54 user-float0) (-> obj fuel)) + ) + (let ((v1-102 (the-as object (&+ (the-as game-save-tag v1-101) 16)))) + (let ((a0-55 (-> (the-as (inline-array game-save-tag) v1-102) 0))) + (set! (-> a0-55 elt-type) (game-save-elt death-movie-tick)) + (set! (-> a0-55 elt-count) 0) + (set! (-> a0-55 user-uint64) (the-as uint (-> obj death-movie-tick))) + ) + (let ((v1-103 (the-as object (&+ (the-as game-save-tag v1-102) 16)))) + (let ((a0-56 (-> (the-as (inline-array game-save-tag) v1-103) 0))) + (set! (-> a0-56 elt-type) (game-save-elt money)) + (set! (-> a0-56 elt-count) 0) + (set! (-> a0-56 user-float0) (-> obj money)) + ) + (let ((v1-104 (the-as (inline-array game-save-tag) (&+ (the-as game-save-tag v1-103) 16)))) + (let ((a0-57 (-> v1-104 0))) + (set! (-> a0-57 elt-type) (game-save-elt money-total)) + (set! (-> a0-57 elt-count) 0) + (set! (-> a0-57 user-float0) (-> obj money-total)) + ) + (let ((v1-106 (the-as object (-> (the-as (inline-array game-save-tag) (-> v1-104 1)) 2)))) + (let ((a0-58 (-> (the-as (inline-array game-save-tag) v1-106) 0))) + (set! (-> a0-58 elt-type) (game-save-elt skill)) + (set! (-> a0-58 elt-count) 0) + (set! (-> a0-58 user-float0) (-> obj skill)) + ) + (let ((v1-107 (the-as object (&+ (the-as game-save-tag v1-106) 16)))) + (let ((a0-59 (-> (the-as (inline-array game-save-tag) v1-107) 0))) + (set! (-> a0-59 elt-type) (game-save-elt skill-total)) + (set! (-> a0-59 elt-count) 0) + (set! (-> a0-59 user-float0) (-> obj skill-total)) + ) + (let ((v1-108 (the-as object (&+ (the-as game-save-tag v1-107) 16)))) + (let ((a0-60 (-> (the-as (inline-array game-save-tag) v1-108) 0))) + (set! (-> a0-60 elt-type) (game-save-elt gem)) + (set! (-> a0-60 elt-count) 0) + (set! (-> a0-60 user-float0) (-> obj gem)) + ) + (let ((v1-109 (the-as object (&+ (the-as game-save-tag v1-108) 16)))) + (let ((a0-61 (-> (the-as (inline-array game-save-tag) v1-109) 0))) + (set! (-> a0-61 elt-type) (game-save-elt gem-total)) + (set! (-> a0-61 elt-count) 0) + (set! (-> a0-61 user-float0) (-> obj gem-total)) + ) + (let ((v1-110 (the-as object (&+ (the-as game-save-tag v1-109) 16)))) + (let ((a0-62 (-> (the-as (inline-array game-save-tag) v1-110) 0))) + (set! (-> a0-62 elt-type) (game-save-elt karma)) + (set! (-> a0-62 elt-count) 0) + (set! (-> a0-62 user-float0) (-> obj karma)) + ) + (let ((v1-111 (the-as object (&+ (the-as game-save-tag v1-110) 16)))) + (let ((a0-63 (-> (the-as (inline-array game-save-tag) v1-111) 0))) + (set! (-> a0-63 elt-type) (game-save-elt eco-pill-dark)) + (set! (-> a0-63 elt-count) 0) + (set! (-> a0-63 user-float0) (-> obj eco-pill-dark)) + ) + (let ((v1-112 (the-as object (&+ (the-as game-save-tag v1-111) 16)))) + (let ((a0-64 (-> (the-as (inline-array game-save-tag) v1-112) 0))) + (set! (-> a0-64 elt-type) (game-save-elt eco-pill-dark-total)) + (set! (-> a0-64 elt-count) 0) + (set! (-> a0-64 user-float0) (-> obj eco-pill-dark-total)) + ) + (let ((v1-113 (the-as object (&+ (the-as game-save-tag v1-112) 16)))) + (let ((a0-65 (-> (the-as (inline-array game-save-tag) v1-113) 0))) + (set! (-> a0-65 elt-type) (game-save-elt shield)) + (set! (-> a0-65 elt-count) 0) + (set! (-> a0-65 user-float0) (-> obj shield)) + ) + (let ((v1-114 (the-as object (&+ (the-as game-save-tag v1-113) 16)))) + (let ((a0-66 (-> (the-as (inline-array game-save-tag) v1-114) 0))) + (set! (-> a0-66 elt-type) (game-save-elt features)) + (set! (-> a0-66 elt-count) 0) + (set! (-> a0-66 user-uint64) (the-as uint (-> obj features))) + ) + (let ((v1-115 (the-as object (&+ (the-as game-save-tag v1-114) 16)))) + (let ((a0-67 (-> (the-as (inline-array game-save-tag) v1-115) 0))) + (set! (-> a0-67 elt-type) (game-save-elt secrets)) + (set! (-> a0-67 elt-count) 0) + (set! (-> a0-67 user-uint64) (the-as uint (-> obj secrets))) + ) + (let ((v1-116 (the-as object (&+ (the-as game-save-tag v1-115) 16)))) + (let ((a0-68 (-> (the-as (inline-array game-save-tag) v1-116) 0))) + (set! (-> a0-68 elt-type) (game-save-elt purchase-secrets)) + (set! (-> a0-68 elt-count) 0) + (set! (-> a0-68 user-uint64) (the-as uint (-> obj purchase-secrets))) + ) + (let ((v1-117 (the-as object (&+ (the-as game-save-tag v1-116) 16)))) + (let ((a0-69 (-> (the-as (inline-array game-save-tag) v1-117) 0))) + (set! (-> a0-69 elt-type) (game-save-elt gun-type)) + (set! (-> a0-69 elt-count) 0) + (set! (-> a0-69 user-uint64) (the-as uint (-> obj gun-type))) + ) + (let ((v1-118 (the-as object (&+ (the-as game-save-tag v1-117) 16)))) + (let ((a0-70 (-> (the-as (inline-array game-save-tag) v1-118) 0))) + (set! (-> a0-70 elt-type) (game-save-elt gun-ammo)) + (set! (-> a0-70 elt-count) 4) + (set! (-> a0-70 elt-size) (the-as uint 4)) + ) + (let ((v1-119 (&+ (the-as game-save-tag v1-118) 16))) + (dotimes (a0-71 4) + (set! (-> v1-119 user-object a0-71) (-> obj gun-ammo a0-71)) + ) + (let ((v1-120 (the-as object (&+ v1-119 16)))) + (let ((a0-74 (-> (the-as (inline-array game-save-tag) v1-120) 0))) + (set! (-> a0-74 elt-type) (game-save-elt level-open-list)) + (set! (-> a0-74 elt-count) 32) + (set! (-> a0-74 elt-size) (the-as uint 1)) + ) + (let ((v1-121 (the-as object (&+ (the-as game-save-tag v1-120) 16)))) + (dotimes (a0-75 32) + (set! (-> (the-as (pointer uint8) (&+ (the-as pointer v1-121) a0-75))) (-> obj level-opened a0-75)) + ) + (let ((v1-122 (the-as object (-> (the-as (inline-array game-save-tag) v1-121) 2))) + (s3-10 (-> obj sub-task-list length)) + ) + (let ((a0-79 (-> (the-as (inline-array game-save-tag) v1-122) 0))) + (set! (-> a0-79 elt-type) (game-save-elt node-name)) + (set! (-> a0-79 elt-count) s3-10) + (set! (-> a0-79 elt-size) (the-as uint 64)) + ) + (let ((s4-3 (the-as object (&+ (the-as game-save-tag v1-122) 16)))) + (dotimes (s2-4 s3-10) + (copyn-charp<-string (the-as (pointer uint8) s4-3) (-> obj sub-task-list s2-4 name) 64) + (set! s4-3 (&+ (the-as pointer s4-3) 64)) + ) + (let ((s3-11 (-> obj perm-list length))) + (let ((v1-129 (-> (the-as (inline-array game-save-tag) s4-3) 0))) + (set! (-> v1-129 elt-type) (game-save-elt perm-list)) + (set! (-> v1-129 elt-count) s3-11) + (set! (-> v1-129 elt-size) (the-as uint 16)) + ) + (let ((s4-4 (the-as object (&+ (the-as pointer s4-3) 16)))) + (dotimes (s2-5 s3-11) + (mem-copy! (&+ (the-as pointer s4-4) (* s2-5 16)) (the-as pointer (-> obj perm-list data s2-5)) 16) + ) + (let ((v1-137 (the-as object (+ (the-as int s4-4) (logand -16 (+ (* s3-11 16) 15))))) + (s4-5 (-> obj task-perm-list length)) + ) + (let ((a0-88 (-> (the-as (inline-array game-save-tag) v1-137) 0))) + (set! (-> a0-88 elt-type) (game-save-elt task-list)) + (set! (-> a0-88 elt-count) s4-5) + (set! (-> a0-88 elt-size) (the-as uint 16)) + ) + (let ((s3-12 (+ (the-as int v1-137) 16))) + (dotimes (s2-6 s4-5) + (mem-copy! (the-as pointer (+ s3-12 (* s2-6 16))) (the-as pointer (-> obj task-perm-list data s2-6)) 16) + ) + (let ((a0-92 (the-as object (+ s3-12 (logand -16 (+ (* s4-5 16) 15))))) + (v1-147 (-> obj unknown-pad6 allocated-length)) + ) + (let ((a1-88 (-> (the-as (inline-array game-save-tag) a0-92) 0))) + (set! (-> a1-88 elt-type) (game-save-elt talker-state)) + (set! (-> a1-88 elt-count) v1-147) + (set! (-> a1-88 elt-size) (the-as uint 2)) + ) + (let ((a0-93 (+ (the-as int a0-92) 16))) + (dotimes (a1-89 v1-147) + (set! (-> (the-as (pointer uint16) (+ a0-93 (* a1-89 2))) 0) (-> obj unknown-pad6 a1-89)) + ) + (let ((a0-94 (the-as object (+ a0-93 (logand -16 (+ (* v1-147 2) 15))))) + (v1-153 (-> obj game-score allocated-length)) + ) + (let ((a1-93 (-> (the-as (inline-array game-save-tag) a0-94) 0))) + (set! (-> a1-93 elt-type) (game-save-elt scores)) + (set! (-> a1-93 elt-count) v1-153) + (set! (-> a1-93 elt-size) (the-as uint 4)) + ) + (let ((a0-95 (+ (the-as int a0-94) 16))) + (dotimes (a1-94 v1-153) + (set! (-> (the-as (pointer float) (+ a0-95 (* a1-94 4))) 0) (-> obj game-score a1-94)) + ) + (let ((s4-6 (the-as object (+ a0-95 (logand -16 (+ (* v1-153 4) 15)))))) + ((method-of-object *bigmap* bigmap-method-13)) + (let ((v1-161 (-> *bigmap* compressed-next-index))) + (let ((a0-97 (-> (the-as (inline-array game-save-tag) s4-6) 0))) + (set! (-> a0-97 elt-type) (game-save-elt bigmap-data)) + (set! (-> a0-97 elt-count) (the-as int v1-161)) + (set! (-> a0-97 elt-size) (the-as uint 1)) + ) + (let ((a0-98 (+ (the-as int s4-6) 16))) + (dotimes (a1-100 (the-as int v1-161)) + (set! (-> (the-as (pointer uint8) (+ a0-98 a1-100)) 0) + (-> (the-as game-save-tag (+ (-> *bigmap* compressed-data) a1-100)) user-uint8 0) + ) + ) + (let ((a0-99 (the-as object (+ a0-98 (logand -16 (+ v1-161 15))))) + (v1-165 20) + ) + (let ((a1-104 (-> (the-as (inline-array game-save-tag) a0-99) 0))) + (set! (-> a1-104 elt-type) (game-save-elt bigmap-offsets)) + (set! (-> a1-104 elt-count) v1-165) + (set! (-> a1-104 elt-size) (the-as uint 4)) + ) + (let ((a0-100 (+ (the-as int a0-99) 16))) + (dotimes (a1-105 v1-165) + (if (-> *bigmap* compressed-masks a1-105) + (set! (-> (the-as (pointer uint32) (+ a0-100 (* a1-105 4))) 0) + (- (-> *bigmap* compressed-masks a1-105) (-> *bigmap* compressed-data)) + ) + (set! (-> (the-as (pointer int32) (+ a0-100 (* a1-105 4))) 0) -1) + ) + ) + (let ((v1-169 (the-as object (+ a0-100 (logand -16 (+ (* v1-165 4) 15)))))) + (let ((a0-102 (-> (the-as (inline-array game-save-tag) v1-169) 0))) + (set! (-> a0-102 elt-type) (game-save-elt auto-save-count)) + (set! (-> a0-102 elt-count) 0) + (set! (-> a0-102 user-uint64) (the-as uint (-> obj auto-save-count))) + ) + (let ((v1-170 (the-as object (+ (the-as int v1-169) 16)))) + (let ((a0-103 (-> (the-as (inline-array game-save-tag) v1-170) 0))) + (set! (-> a0-103 elt-type) (game-save-elt total-deaths)) + (set! (-> a0-103 elt-count) 0) + (set! (-> a0-103 user-uint64) (the-as uint (-> obj total-deaths))) + ) + (let ((v1-171 (the-as object (+ (the-as int v1-170) 16)))) + (let ((a0-104 (-> (the-as (inline-array game-save-tag) v1-171) 0))) + (set! (-> a0-104 elt-type) (game-save-elt total-trys)) + (set! (-> a0-104 elt-count) 0) + (set! (-> a0-104 user-uint64) (the-as uint (-> obj total-trys))) + ) + (let ((v1-172 (the-as object (+ (the-as int v1-171) 16)))) + (let ((a0-105 (-> (the-as (inline-array game-save-tag) v1-172) 0))) + (set! (-> a0-105 elt-type) (game-save-elt continue-deaths)) + (set! (-> a0-105 elt-count) 0) + (set! (-> a0-105 user-uint64) (the-as uint (-> obj continue-deaths))) + ) + (let ((v1-173 (the-as object (+ (the-as int v1-172) 16)))) + (let ((a0-106 (-> (the-as (inline-array game-save-tag) v1-173) 0))) + (set! (-> a0-106 elt-type) (game-save-elt task-deaths)) + (set! (-> a0-106 elt-count) 0) + (set! (-> a0-106 user-uint64) (the-as uint (-> obj task-deaths))) + ) + (let ((v1-174 (the-as object (+ (the-as int v1-173) 16)))) + (let ((a0-107 (-> (the-as (inline-array game-save-tag) v1-174) 0))) + (set! (-> a0-107 elt-type) (game-save-elt game-start-time)) + (set! (-> a0-107 elt-count) 0) + (set! (-> a0-107 user-uint64) (the-as uint (-> obj game-start-time))) + ) + (let ((v1-175 (the-as object (+ (the-as int v1-174) 16)))) + (let ((a0-108 (-> (the-as (inline-array game-save-tag) v1-175) 0))) + (set! (-> a0-108 elt-type) (game-save-elt continue-time)) + (set! (-> a0-108 elt-count) 0) + (set! (-> a0-108 user-uint64) (the-as uint (-> obj continue-time))) + ) + (let ((v1-176 (the-as object (+ (the-as int v1-175) 16)))) + (let ((a0-109 (-> (the-as (inline-array game-save-tag) v1-176) 0))) + (set! (-> a0-109 elt-type) (game-save-elt death-time)) + (set! (-> a0-109 elt-count) 0) + (set! (-> a0-109 user-uint64) (the-as uint (-> obj death-time))) + ) + (let ((v1-177 (the-as object (+ (the-as int v1-176) 16)))) + (let ((a0-110 (-> (the-as (inline-array game-save-tag) v1-177) 0))) + (set! (-> a0-110 elt-type) (game-save-elt hit-time)) + (set! (-> a0-110 elt-count) 0) + (set! (-> a0-110 user-uint64) (the-as uint (-> obj hit-time))) + ) + (let ((v1-178 (the-as object (+ (the-as int v1-177) 16)))) + (let ((a0-111 (-> (the-as (inline-array game-save-tag) v1-178) 0))) + (set! (-> a0-111 elt-type) (game-save-elt task-pickup-time)) + (set! (-> a0-111 elt-count) 0) + (set! (-> a0-111 user-uint64) (the-as uint (-> obj task-pickup-time))) + ) + (let ((v1-179 (the-as object (+ (the-as int v1-178) 16)))) + (let ((a0-112 (-> (the-as (inline-array game-save-tag) v1-179) 0))) + (set! (-> a0-112 elt-type) (game-save-elt task-complete-time)) + (set! (-> a0-112 elt-count) 110) + (set! (-> a0-112 elt-size) (the-as uint 8)) + ) + (let ((v1-180 (+ (the-as int v1-179) 16))) + (dotimes (a0-113 110) + (set! (-> (the-as (pointer time-frame) (+ v1-180 (* a0-113 8))) 0) (-> obj unknown-array1 a0-113)) + ) + (let ((v1-181 (the-as object (+ v1-180 880)))) + (let ((a0-116 (-> (the-as (inline-array game-save-tag) v1-181) 0))) + (set! (-> a0-116 elt-type) (game-save-elt task-start-time)) + (set! (-> a0-116 elt-count) 110) + (set! (-> a0-116 elt-size) (the-as uint 8)) + ) + (let ((v1-182 (+ (the-as int v1-181) 16))) + (dotimes (a0-117 110) + (set! (-> (the-as (pointer time-frame) (+ v1-182 (* a0-117 8))) 0) (-> obj task-close-times a0-117)) + ) + (let ((v1-183 (the-as object (+ v1-182 880)))) + (let ((a0-120 (-> (the-as (inline-array game-save-tag) v1-183) 0))) + (set! (-> a0-120 elt-type) (game-save-elt enter-level-time)) + (set! (-> a0-120 elt-count) 32) + (set! (-> a0-120 elt-size) (the-as uint 8)) + ) + (let ((v1-184 (+ (the-as int v1-183) 16))) + (dotimes (a0-121 32) + (set! (-> (the-as (pointer time-frame) (+ v1-184 (* a0-121 8))) 0) (-> obj task-enter-times a0-121)) + ) + (let ((v1-185 (the-as object (+ v1-184 256)))) + (let ((a0-124 (-> (the-as (inline-array game-save-tag) v1-185) 0))) + (set! (-> a0-124 elt-type) (game-save-elt in-level-time)) + (set! (-> a0-124 elt-count) 32) + (set! (-> a0-124 elt-size) (the-as uint 8)) + ) + (let ((v1-186 (+ (the-as int v1-185) 16))) + (dotimes (a0-125 32) + (set! (-> (the-as (pointer time-frame) (+ v1-186 (* a0-125 8))) 0) (-> obj task-in-times a0-125)) + ) + (let ((a0-128 (the-as object (+ v1-186 256))) + (v1-188 (-> obj sub-task-list length)) + ) + (let ((a1-153 (-> (the-as (inline-array game-save-tag) a0-128) 0))) + (set! (-> a1-153 elt-type) (game-save-elt node-death-count)) + (set! (-> a1-153 elt-count) v1-188) + (set! (-> a1-153 elt-size) (the-as uint 2)) + ) + (let ((a0-129 (+ (the-as int a0-128) 16))) + (dotimes (a1-154 v1-188) + (set! (-> (the-as (pointer uint16) (+ a0-129 (* a1-154 2))) 0) (-> obj sub-task-list a1-154 death-count)) + ) + (let ((a0-130 (the-as object (+ a0-129 (logand -16 (+ (* v1-188 2) 15)))))) + (let ((a1-159 (-> (the-as (inline-array game-save-tag) a0-130) 0))) + (set! (-> a1-159 elt-type) (game-save-elt node-gem-count)) + (set! (-> a1-159 elt-count) v1-188) + (set! (-> a1-159 elt-size) (the-as uint 2)) + ) + (let ((a0-131 (+ (the-as int a0-130) 16))) + (dotimes (a1-160 v1-188) + (set! (-> (the-as (pointer uint16) (+ a0-131 (* a1-160 2))) 0) (-> obj sub-task-list a1-160 gem-count)) + ) + (let ((a0-132 (the-as object (+ a0-131 (logand -16 (+ (* v1-188 2) 15)))))) + (let ((a1-165 (-> (the-as (inline-array game-save-tag) a0-132) 0))) + (set! (-> a1-165 elt-type) (game-save-elt node-skill-count)) + (set! (-> a1-165 elt-count) v1-188) + (set! (-> a1-165 elt-size) (the-as uint 2)) + ) + (let ((a0-133 (+ (the-as int a0-132) 16))) + (dotimes (a1-166 v1-188) + (set! (-> (the-as (pointer uint16) (+ a0-133 (* a1-166 2))) 0) (-> obj sub-task-list a1-166 skill-count)) + ) + (let ((a0-134 (the-as object (+ a0-133 (logand -16 (+ (* v1-188 2) 15)))))) + (let ((a1-171 (-> (the-as (inline-array game-save-tag) a0-134) 0))) + (set! (-> a1-171 elt-type) (game-save-elt node-close-time)) + (set! (-> a1-171 elt-count) v1-188) + (set! (-> a1-171 elt-size) (the-as uint 8)) + ) + (let ((a0-135 (+ (the-as int a0-134) 16))) + (dotimes (a1-172 v1-188) + (set! (-> (the-as (pointer time-frame) (+ a0-135 (* a1-172 8))) 0) (-> obj sub-task-list a1-172 close-time)) + ) + (let ((a0-136 (the-as object (+ a0-135 (logand -16 (+ (* v1-188 8) 15))))) + (v1-194 (-> obj sub-task-list length)) + ) + (let ((a1-176 (-> (the-as (inline-array game-save-tag) a0-136) 0))) + (set! (-> a1-176 elt-type) (game-save-elt task-node-list)) + (set! (-> a1-176 elt-count) v1-194) + (set! (-> a1-176 elt-size) (the-as uint 1)) + ) + (let ((a0-137 (+ (the-as int a0-136) 16))) + (dotimes (a1-177 v1-194) + (set! (-> (the-as (pointer int8) (+ a0-137 a1-177)) 0) + (if (logtest? (-> obj sub-task-list a1-177 flags) (game-task-node-flag closed)) + 1 + 0 + ) + ) + ) + (let ((v1-197 (the-as object (+ a0-137 (logand -16 (+ v1-194 15)))))) + (let ((a0-139 (-> (the-as (inline-array game-save-tag) v1-197) 0))) + (set! (-> a0-139 elt-type) (game-save-elt sfx-volume)) + (set! (-> a0-139 elt-count) 0) + (set! (-> a0-139 user-float0) (-> *setting-control* user-default sfx-volume)) + ) + (let ((v1-198 (the-as object (+ (the-as int v1-197) 16)))) + (let ((a0-140 (-> (the-as (inline-array game-save-tag) v1-198) 0))) + (set! (-> a0-140 elt-type) (game-save-elt music-volume)) + (set! (-> a0-140 elt-count) 0) + (set! (-> a0-140 user-float0) (-> *setting-control* user-default music-volume)) + ) + (let ((v1-199 (the-as object (+ (the-as int v1-198) 16)))) + (let ((a0-141 (-> (the-as (inline-array game-save-tag) v1-199) 0))) + (set! (-> a0-141 elt-type) (game-save-elt dialog-volume)) + (set! (-> a0-141 elt-count) 0) + (set! (-> a0-141 user-float0) (-> *setting-control* user-default dialog-volume)) + ) + (let ((v1-200 (the-as object (+ (the-as int v1-199) 16)))) + (let ((a0-142 (-> (the-as (inline-array game-save-tag) v1-200) 0))) + (set! (-> a0-142 elt-type) (game-save-elt language)) + (set! (-> a0-142 elt-count) 0) + (set! (-> a0-142 user-uint64) (the-as uint (-> *setting-control* user-default language))) + ) + (let ((v1-201 (the-as object (+ (the-as int v1-200) 16)))) + (let ((a0-143 (-> (the-as (inline-array game-save-tag) v1-201) 0))) + (set! (-> a0-143 elt-type) (game-save-elt subtitle-language)) + (set! (-> a0-143 elt-count) 0) + (set! (-> a0-143 user-uint64) (the-as uint (-> *setting-control* user-default subtitle-language))) + ) + (let ((v1-202 (the-as object (+ (the-as int v1-201) 16)))) + (let ((a0-144 (-> (the-as (inline-array game-save-tag) v1-202) 0))) + (set! (-> a0-144 elt-type) (game-save-elt stereo-mode)) + (set! (-> a0-144 elt-count) 0) + (set! (-> a0-144 user-uint64) (the-as uint (-> *setting-control* user-default stereo-mode))) + ) + (let ((v1-203 (the-as object (+ (the-as int v1-202) 16)))) + (let ((a0-145 (-> (the-as (inline-array game-save-tag) v1-203) 0))) + (set! (-> a0-145 elt-type) (game-save-elt screenx)) + (set! (-> a0-145 elt-count) 0) + (set! (-> a0-145 user-float0) (the float (-> *setting-control* user-default display-dx))) + ) + (let ((v1-204 (the-as object (+ (the-as int v1-203) 16)))) + (let ((a0-146 (-> (the-as (inline-array game-save-tag) v1-204) 0))) + (set! (-> a0-146 elt-type) (game-save-elt screeny)) + (set! (-> a0-146 elt-count) 0) + (set! (-> a0-146 user-float0) (the float (-> *setting-control* user-default display-dy))) + ) + (let ((v1-205 (the-as object (+ (the-as int v1-204) 16)))) + (let ((a0-147 (-> (the-as (inline-array game-save-tag) v1-205) 0))) + (set! (-> a0-147 elt-type) (game-save-elt vibration)) + (set! (-> a0-147 elt-count) 0) + (set! (-> a0-147 user-uint64) (the-as uint (if (-> *setting-control* user-default vibration) + 1 + 0 + ) + ) + ) + ) + (let ((v1-206 (the-as object (+ (the-as int v1-205) 16)))) + (let ((a0-148 (-> (the-as (inline-array game-save-tag) v1-206) 0))) + (set! (-> a0-148 elt-type) (game-save-elt subtitle)) + (set! (-> a0-148 elt-count) 0) + (set! (-> a0-148 user-uint64) (the-as uint (if (-> *setting-control* user-default subtitle) + 1 + 0 + ) + ) + ) + ) + (let ((v1-207 (the-as object (+ (the-as int v1-206) 16)))) + (let ((a0-149 (-> (the-as (inline-array game-save-tag) v1-207) 0))) + (set! (-> a0-149 elt-type) (game-save-elt camera-stick-dir)) + (set! (-> a0-149 elt-count) 0) + (set! (-> a0-149 user-uint64) (the-as uint (if (-> *setting-control* user-default unknowng-symbol-00) + 1 + 0 + ) + ) + ) + ) + (let ((v1-208 (the-as object (+ (the-as int v1-207) 16)))) + (let ((a0-150 (-> (the-as (inline-array game-save-tag) v1-208) 0))) + (set! (-> a0-150 elt-type) (game-save-elt play-hints)) + (set! (-> a0-150 elt-count) 0) + (set! (-> a0-150 user-uint64) (the-as uint (if (-> *setting-control* user-default play-hints) + 1 + 0 + ) + ) + ) + ) + (let ((v1-209 (the-as object (+ (the-as int v1-208) 16)))) + (let ((a0-151 (-> (the-as (inline-array game-save-tag) v1-209) 0))) + (set! (-> a0-151 elt-type) (game-save-elt video-mode)) + (set! (-> a0-151 elt-count) 0) + (let ((a1-220 (-> *setting-control* user-default video-mode))) + (set! (-> a0-151 user-uint64) (the-as uint (cond + ((= a1-220 'ntsc) + 1 + ) + ((= a1-220 'pal) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + ) + (let ((v1-210 (the-as object (+ (the-as int v1-209) 16)))) + (let ((a0-152 (-> (the-as (inline-array game-save-tag) v1-210) 0))) + (set! (-> a0-152 elt-type) (game-save-elt aspect-ratio)) + (set! (-> a0-152 elt-count) 0) + (let ((a1-224 (-> *setting-control* user-default aspect-ratio))) + (set! (-> a0-152 user-uint64) (the-as uint (cond + ((= a1-224 'aspect4x3) + 1 + ) + ((= a1-224 'aspect16x9) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + ) + (set! (-> arg0 length) (- (+ (the-as int v1-210) 16) (the-as int (the-as pointer (-> arg0 tag))))) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (if (< (-> arg0 allocated-length) (-> arg0 length)) + (format + 0 + "ERROR: SAVEGAME: fatal error, save is using ~D of ~D bytes." + (-> arg0 length) + (-> arg0 allocated-length) + ) + ) + arg0 + ) + ) + +(defmethod load-game game-info ((obj game-info) (arg0 game-save)) + (let ((v1-0 (the-as object (-> arg0 tag)))) + (while (< (the-as int v1-0) (the-as int (&-> arg0 tag 0 user-int8 (-> arg0 length)))) + (case (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-type) + (((game-save-elt sfx-volume)) + (set! (-> *setting-control* user-default sfx-volume) + (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ) + ) + (((game-save-elt music-volume)) + (set! (-> *setting-control* user-default music-volume) + (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ) + ) + (((game-save-elt dialog-volume)) + (set! (-> *setting-control* user-default dialog-volume) + (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ) + ) + (((game-save-elt language)) + (set! (-> *setting-control* user-default language) + (the-as language-enum (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) + ) + ) + (((game-save-elt subtitle-language)) + (set! (-> *setting-control* user-default subtitle-language) + (the-as language-enum (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) + ) + ) + (((game-save-elt stereo-mode)) + (set! (-> *setting-control* user-default stereo-mode) + (the-as int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) + ) + ) + (((game-save-elt vibration)) + (set! (-> *setting-control* user-default vibration) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt subtitle)) + (set! (-> *setting-control* user-default subtitle) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt camera-stick-dir)) + (set! (-> *setting-control* user-default unknowng-symbol-00) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt play-hints)) + (set! (-> *setting-control* user-default play-hints) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt screenx)) + (set! (-> *setting-control* user-default display-dx) + (the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)) + ) + ) + (((game-save-elt screeny)) + (set! (-> *setting-control* user-default display-dy) + (the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)) + ) + ) + ) + (set! v1-0 (&+ + (the-as pointer v1-0) + (logand -16 (+ (* (the-as int (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-size)) + (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-count) + ) + 31 + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> arg0 new-game)) + (case (-> arg0 new-game) + ((2) + (logior! (-> *game-info* secrets) (game-secrets hero-mode)) + (logior! (-> *game-info* purchase-secrets) (game-secrets hero-mode)) + ) + ) + (set-continue! obj "game-start" #f) + (set! arg0 arg0) + (goto cfg-230) + ) + (let ((s4-0 (the-as object (-> arg0 tag))) + (s3-0 (new 'stack-no-clear 'array 'uint16 512)) + ) + (dotimes (v1-14 512) + (set! (-> s3-0 v1-14) (the-as uint -1)) + ) + (while (< (the-as int s4-0) (the-as int (&-> arg0 tag 0 user-int8 (-> arg0 length)))) + (case (-> (the-as game-save-tag s4-0) elt-type) + (((game-save-elt node-name)) + (dotimes (s2-0 (-> (the-as game-save-tag s4-0) elt-count)) + (dotimes (s1-0 (-> obj sub-task-list length)) + (let ((v1-20 (-> obj sub-task-list s1-0))) + (when (string-charp= (-> v1-20 name) (the-as (pointer uint8) (+ (+ (* s2-0 64) 16) (the-as int s4-0)))) + (set! (-> s3-0 s2-0) (the-as uint s1-0)) + (goto cfg-45) + ) + ) + ) + (label cfg-45) + ) + ) + (((game-save-elt base-time)) + ) + (((game-save-elt game-time)) + (load! (-> *display* game-clock) (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1))) + (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) + ) + (((game-save-elt total-game-time)) + (load! + (-> *display* total-game-clock) + (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1)) + ) + (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) + ) + (((game-save-elt continue)) + (format (clear *temp-string*) "~G" (-> (the-as (inline-array game-save-tag) s4-0) 1)) + (set-continue! obj *temp-string* #f) + ) + (((game-save-elt life)) + (set! (-> obj life) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt buzzer-total)) + (set! (-> obj buzzer-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt fuel-cell)) + (set! (-> obj fuel) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt death-movie-tick)) + (set! (-> obj death-movie-tick) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt skill)) + (set! (-> obj skill) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt skill-total)) + (set! (-> obj skill-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt gem)) + (set! (-> obj gem) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt gem-total)) + (set! (-> obj gem-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt karma)) + (set! (-> obj karma) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt eco-pill-dark)) + (set! (-> obj eco-pill-dark) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt eco-pill-dark-total)) + (set! (-> obj eco-pill-dark-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt shield)) + (set! (-> obj shield) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt features)) + (set! (-> obj features) (the-as game-feature (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt secrets)) + (set! (-> obj secrets) (the-as game-secrets (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt purchase-secrets)) + (set! (-> obj purchase-secrets) + (the-as game-secrets (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt gun-type)) + (set! (-> obj gun-type) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt gun-ammo)) + (let ((v1-67 (min 4 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-89 v1-67) + (set! (-> obj gun-ammo a0-89) + (the-as float (-> (the-as (inline-array game-save-tag) s4-0) 1 user-object a0-89)) + ) + ) + ) + ) + (((game-save-elt money)) + (set! (-> obj money) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt money-total)) + (set! (-> obj money-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt level-open-list)) + (let ((v1-73 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-97 v1-73) + (set! (-> obj level-opened a0-97) + (-> (the-as (pointer uint8) (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s4-0) 1)) a0-97))) + ) + ) + ) + ) + (((game-save-elt perm-list)) + (let ((s2-3 (min (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) (-> obj perm-list allocated-length)))) + (set! (-> obj perm-list length) s2-3) + (dotimes (s1-1 s2-3) + (mem-copy! + (the-as pointer (-> obj perm-list data s1-1)) + (the-as pointer (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s1-1 16))) + 16 + ) + ) + ) + ) + (((game-save-elt task-list)) + (let ((s2-5 + (min (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) (-> obj task-perm-list allocated-length)) + ) + ) + (set! (-> obj task-perm-list length) s2-5) + (dotimes (s1-2 s2-5) + (mem-copy! + (the-as pointer (-> obj task-perm-list data s1-2)) + (the-as pointer (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s1-2 16))) + 16 + ) + ) + ) + ) + (((game-save-elt talker-state)) + (let ((v1-95 (-> obj unknown-pad6 allocated-length)) + (a0-108 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + ) + (dotimes (a1-57 v1-95) + (cond + ((>= a1-57 a0-108) + (set! (-> obj unknown-pad6 a1-57) (the-as uint 0)) + 0 + ) + (else + (set! (-> obj unknown-pad6 a1-57) (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a1-57)) + ) + ) + ) + ) + ) + (((game-save-elt scores)) + (let ((v1-99 (-> obj game-score allocated-length)) + (a0-111 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + ) + (dotimes (a1-58 v1-99) + (if (>= a1-58 a0-111) + (set! (-> obj game-score a1-58) 0.0) + (set! (-> obj game-score a1-58) + (the-as float (-> (the-as (inline-array game-save-tag) s4-0) 1 user-object a1-58)) + ) + ) + ) + ) + ) + (((game-save-elt bigmap-data)) + (initialize *bigmap*) + (let ((v1-104 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (set! (-> *bigmap* compressed-next-index) (the-as uint v1-104)) + (dotimes (a0-116 v1-104) + (set! (-> (the-as (pointer uint8) (+ (-> *bigmap* compressed-data) a0-116)) 0) + (-> (the-as (pointer uint8) (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s4-0) 1)) a0-116))) + ) + ) + ) + ) + (((game-save-elt bigmap-offsets)) + (let ((a1-62 20) + (v1-107 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (a0-120 (-> *bigmap* compressed-data)) + ) + (cond + ((= a1-62 v1-107) + (dotimes (a1-63 v1-107) + (let ((a2-27 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-object a1-63))) + (if (< (the-as int a2-27) 0) + (set! (-> *bigmap* compressed-masks a1-63) (the-as uint #f)) + (set! (-> *bigmap* compressed-masks a1-63) (the-as uint (+ a0-120 (the-as uint a2-27)))) + ) + ) + ) + ) + (else + (initialize *bigmap*) + ) + ) + ) + ) + (((game-save-elt auto-save-count)) + (set! (-> obj auto-save-count) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt total-deaths)) + (set! (-> obj total-deaths) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt total-trys)) + (set! (-> obj total-trys) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt continue-deaths)) + (set! (-> obj continue-deaths) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt task-deaths)) + (set! (-> obj task-deaths) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt game-start-time)) + (set! (-> obj game-start-time) + (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt continue-time)) + (set! (-> obj continue-time) + (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt death-time)) + (set! (-> obj death-time) (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt hit-time)) + (set! (-> obj hit-time) (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt task-pickup-time)) + (set! (-> obj task-pickup-time) + (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt enter-level-time)) + (let ((v1-123 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-145 v1-123) + (set! (-> obj task-enter-times a0-145) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-145 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt in-level-time)) + (let ((v1-127 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-149 v1-127) + (set! (-> obj task-in-times a0-149) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-149 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-complete-time)) + (let ((v1-131 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-153 v1-131) + (set! (-> obj unknown-array1 a0-153) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-153 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-start-time)) + (let ((v1-135 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-157 v1-135) + (set! (-> obj task-close-times a0-157) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-157 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-node-list)) + (let ((s2-6 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (s1-3 s2-6) + (if (and (nonzero? (-> (the-as (pointer uint8) (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s4-0) 1)) s1-3))) + ) + (>= (-> (the-as (pointer int16) (&+ s3-0 (* s1-3 2)))) 0) + ) + (close! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* s1-3 2))))) 'event) + ) + ) + ) + ) + (((game-save-elt node-death-count)) + (let ((v1-155 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-164 v1-155) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-164 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-164 2)))) death-count) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a0-164) + ) + ) + ) + ) + ) + (((game-save-elt node-gem-count)) + (let ((v1-158 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-167 v1-158) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-167 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-167 2)))) gem-count) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a0-167) + ) + ) + ) + ) + ) + (((game-save-elt node-skill-count)) + (let ((v1-161 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-170 v1-161) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-170 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-170 2)))) skill-count) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a0-170) + ) + ) + ) + ) + ) + (((game-save-elt node-close-time)) + (let ((v1-165 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-172 v1-165) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-172 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-172 2)))) close-time) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-172 8))) + ) + ) + ) + ) + ) + ) + ) + ) + (set! s4-0 (&+ + (the-as pointer s4-0) + (logand -16 (+ (* (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) + ) + 31 + ) + ) + ) + ) + ) + ) + (dotimes (s4-1 (-> *level* length)) + (let ((a1-106 (-> *level* level s4-1))) + (if (= (-> a1-106 status) 'active) + (copy-perms-to-level! obj a1-106) + ) + ) + ) + (label cfg-230) + arg0 + ) + +(defmethod save-to-file game-save ((obj game-save) (arg0 string)) + (let ((s5-0 (new 'stack 'file-stream arg0 'write))) + (file-stream-write s5-0 (&-> obj type) (+ (-> obj type size) (-> obj length))) + (file-stream-close s5-0) + ) + obj + ) + +(defmethod load-from-file game-save ((obj game-save) (arg0 string)) + (let ((s5-0 (new 'stack 'file-stream arg0 'read))) + (let ((s3-0 (file-stream-length s5-0)) + (s4-0 (-> obj allocated-length)) + ) + (cond + ((>= (asize-of obj) s3-0) + (cond + ((= (file-stream-read s5-0 (&-> obj type) s3-0) s3-0) + (set! (-> obj type) game-save) + ) + (else + (format 0 "ERROR: SAVEGAME: save file ~A did not read correctly.~%" s5-0) + (set! (-> obj length) 0) + 0 + ) + ) + ) + (else + (format 0 "ERROR: SAVEGAME: save file ~A is too big~%" s5-0) + ) + ) + (set! (-> obj allocated-length) s4-0) + ) + (when (!= (-> obj version) 3) + (format 0 "ERROR: SAVEGAME: save file ~A was version ~d, but only ~d is supported.~%" s5-0 (-> obj version) 3) + (set! (-> obj length) 0) + 0 + ) + (file-stream-close s5-0) + ) + obj + ) + +(define *auto-save-info* (new 'global 'mc-slot-info)) + +(deftype auto-save (process) + ((card int32 :offset-assert 128) + (slot int32 :offset-assert 132) + (which int32 :offset-assert 136) + (buffer kheap :offset-assert 140) + (mode symbol :offset-assert 144) + (result mc-status-code :offset-assert 148) + (save game-save :offset-assert 152) + (info mc-slot-info :inline :offset-assert 156) + (notify handle :offset-assert 456) + (force symbol :offset-assert 464) + (state-time time-frame :offset-assert 472) + (icon hud-sprite :inline :offset-assert 480) + ) + :heap-base #x1a0 + :method-count-assert 23 + :size-assert #x214 + :flag-assert #x1701a00214 + (:methods + (get-heap () _type_ :state 14) + (get-card () _type_ :state 15) + (format-card () _type_ :state 16) + (unformat-card () _type_ :state 17) + (create-file () _type_ :state 18) + (save () _type_ :state 19) + (restore () _type_ :state 20) + (error (mc-status-code) _type_ :state 21) + (done () _type_ :state 22) + ) + ) + + +;; WARN: Failed store: (s.w! (+ v1-45 8) 0) at op 192 +;; WARN: Failed store: (s.w! (+ v1-45 12) 0) at op 193 +(defbehavior auto-save-post auto-save () + (when (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) + (let ((gp-0 (new + 'stack + 'font-context + *font-default-matrix* + 32 + 320 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-5 gp-0)) + (set! (-> v1-5 width) (the float (the-as float #x1b8))) + ) + (let ((v1-6 gp-0)) + (set! (-> v1-6 height) (the float (the-as float #x50))) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning)) + (format (clear *temp-string*) "~S / ~S ~D~%" (-> self mode) (-> self state name) (-> self which)) + (print-game-text *temp-string* gp-0 #f 44 320) + ) + ) + (when (and (= (-> self mode) 'auto-save) (not (and (-> self next-state) (= (-> self next-state name) 'done)))) + (let ((gp-1 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 80 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-17 gp-1)) + (set! (-> v1-17 scale) 0.8) + ) + (let ((v1-18 gp-1)) + (set! (-> v1-18 width) (the float (the-as float #x1b0))) + ) + (let ((v1-19 gp-1)) + (set! (-> v1-19 height) (the float (the-as float #x14))) + ) + (set! (-> gp-1 flags) (font-flags shadow kerning middle left large)) + (when (and (>= 1 (-> *game-info* auto-save-count)) (-> self next-state) (= (-> self next-state name) 'save)) + (print-game-text (lookup-text! *common-text* (game-text-id text-x19f) #f) gp-1 #f 44 320) + (set! (-> gp-1 origin x) 20.0) + (set! (-> gp-1 origin y) 130.0) + (let ((v1-30 gp-1)) + (set! (-> v1-30 scale) 0.7) + ) + (let ((v1-31 gp-1)) + (set! (-> v1-31 height) (the float (the-as float #xc8))) + ) + (let ((s5-2 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id progress-memcard-dont-remove) #f) 1) + (s5-2 *temp-string* gp-1 #f 44 320) + ) + ) + ) + (when (< (mod (-> *display* real-clock frame-counter) 300) 270) + (with-dma-buffer-add-bucket ((s5-3 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id bucket-320) + ) + (hud-sprite-method-9 (-> self icon) s5-3 (-> self level)) + ) + ) + ) + ) + +auto-save-post + +(defbehavior auto-save-init-by-other auto-save ((arg0 symbol) (arg1 process) (arg2 int) (arg3 int) (arg4 symbol)) + (when (handle->process (-> *game-info* auto-save-proc)) + (send-event arg1 'notify 'error 16) + (return #f) + ) + (set! (-> *game-info* auto-save-proc) (process->handle self)) + (set! (-> *game-info* auto-save-status) (mc-status-code ok)) + (stack-size-set! (-> self main-thread) 512) + (logclear! (-> self mask) (process-mask freeze pause menu progress)) + (set! (-> self card) arg2) + (set! (-> self which) arg3) + (set! (-> self buffer) #f) + (set! (-> self mode) arg0) + (set! (-> self result) (mc-status-code ok)) + (set! (-> self save) #f) + (set! (-> self notify) (process->handle arg1)) + (set! (-> self force) arg4) + (cond + ((= arg0 'auto-save) + (if (not (-> *setting-control* user-current auto-save)) + (go-virtual error (mc-status-code no-auto-save)) + ) + (when (and (zero? (-> self card)) (-> *setting-control* user-current auto-save)) + (set! (-> self card) (-> *game-info* auto-save-card)) + (set! (-> self which) (-> *game-info* auto-save-which)) + ) + (set-setting! 'allow-pause #f 0 0) + (apply-settings *setting-control*) + ) + ((= arg0 'error) + (set! (-> *setting-control* user-default auto-save) #f) + (go-virtual error (mc-status-code no-card)) + ) + ) + (set! (-> *setting-control* user-default auto-save) #f) + (set-vector! (-> self icon color) 128 128 128 128) + (set! (-> self icon pos x) 440) + (set! (-> self icon pos y) 200) + (set! (-> self icon pos z) #xffffff) + (set! (-> self icon pos w) 0) + (set! (-> self icon scale-x) 2.0) + (set! (-> self icon scale-y) 2.0) + (set! (-> self icon angle) 0.0) + (set! (-> self icon flags) (the-as uint 0)) + (set! (-> self icon tex) (lookup-texture-by-id (new 'static 'texture-id :index #x48 :page #x67a))) + (go-virtual get-heap) + ) + +(defstate get-heap (auto-save) + :virtual #t + :code (behavior () + (case (-> self mode) + (('auto-save) + (when (zero? (-> *game-info* auto-save-count)) + (set! (-> self event-hook) (-> (method-of-object self error) event)) + (set! (-> self post-hook) #f) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + (while (< (- (-> *display* real-clock frame-counter) (-> self state-time)) (seconds 0.2)) + (if (not (progress-allowed?)) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + ) + (suspend) + ) + (activate-progress *dproc* 'icon-info) + (while *progress-process* + (suspend) + ) + (set! (-> self event-hook) #f) + ) + (+! (-> *game-info* auto-save-count) 1) + ) + ) + (while (or (< (-> *display* base-clock frame-counter) (-> *game-info* blackout-time)) + (!= (-> *setting-control* user-current bg-a) 0.0) + (!= (-> *setting-control* user-current bg-a-force) 0.0) + ) + (suspend) + ) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + (let ((a0-9 (reserve-alloc *art-control*))) + (while (not a0-9) + (if (>= (- (-> *display* real-clock frame-counter) (-> self state-time)) (seconds 60)) + (go-virtual error (mc-status-code no-memory)) + ) + (suspend) + (set! a0-9 (reserve-alloc *art-control*)) + ) + (set! (-> self buffer) a0-9) + ) + (format #t "got buffer #x~X~%" (-> self buffer base)) + (go-virtual get-card) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate get-card (auto-save) + :virtual #t + :code (behavior () + (label cfg-0) + (mc-get-slot-info (-> self slot) (-> self info)) + (when (zero? (-> self info known)) + (suspend) + (goto cfg-0) + ) + (cond + ((zero? (-> self info handle)) + (go-virtual error (mc-status-code no-card)) + ) + ((zero? (-> self card)) + (set! (-> self card) (-> self info handle)) + ) + ((!= (-> self info handle) (-> self card)) + (go-virtual error (mc-status-code bad-handle)) + ) + ) + (case (-> self mode) + (('save 'auto-save) + (if (-> self force) + (go-virtual format-card) + (go-virtual save) + ) + ) + (('save-last) + (set! (-> self which) (-> self info last-file)) + (if (= (-> self which) -1) + (go-virtual error (mc-status-code no-last)) + (go-virtual save) + ) + ) + (('restore) + (go-virtual restore) + ) + (('format-card) + (go-virtual format-card) + ) + (('unformat-card) + (go-virtual unformat-card) + ) + (('create-file) + (go-virtual create-file) + ) + (else + (go-virtual done) + ) + ) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate format-card (auto-save) + :virtual #t + :code (behavior () + (b! (nonzero? (-> self info formatted)) cfg-11 :delay (empty-form)) + (label cfg-1) + (set! (-> self result) (mc-format (-> self card))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-1) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (let ((v1-4 (-> self result))) + (b! (nonzero? v1-4) cfg-5 :delay (nop!)) + (b! #t cfg-10 :delay (nop!)) + (label cfg-5) + (b! (= v1-4 (mc-status-code format-failed)) cfg-1 :delay (nop!)) + (nop!) + (if (= v1-4 (mc-status-code ok)) + (goto cfg-11) + (go-virtual error (-> self result)) + ) + ) + (label cfg-10) + (suspend) + ) + #f + (label cfg-11) + (case (-> self mode) + (('create-file 'save 'save-last 'auto-save 'restore) + (label cfg-21) + (mc-get-slot-info (-> self slot) (-> self info)) + (when (zero? (-> self info known)) + (suspend) + (goto cfg-21) + ) + (go-virtual create-file) + ) + ) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate unformat-card (auto-save) + :virtual #t + :code (behavior () + (when (nonzero? (-> self info formatted)) + (label cfg-1) + (set! (-> self result) (mc-unformat (-> self card))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-1) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (case (-> self result) + (((mc-status-code busy)) + ) + (((mc-status-code ok)) + (goto cfg-10) + ) + (else + (go-virtual error (-> self result)) + ) + ) + (suspend) + ) + #f + ) + (label cfg-10) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate create-file (auto-save) + :virtual #t + :code (behavior () + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (if (< (-> self info mem-actual) (-> self info mem-required)) + (go-virtual error (mc-status-code no-space)) + ) + (let ((v1-12 (-> self buffer))) + (set! (-> v1-12 current) (-> v1-12 base)) + ) + (label cfg-6) + (set! (-> self result) (mc-create-file (-> self card) (the-as uint (-> self buffer base)))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-6) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (case (-> self result) + (((mc-status-code busy)) + ) + (((mc-status-code ok)) + (goto cfg-15) + ) + (else + (go-virtual error (-> self result)) + ) + ) + (suspend) + ) + #f + ) + ) + (label cfg-15) + (case (-> self mode) + (('restore) + (go-virtual restore) + ) + (('save 'save-last 'auto-save) + (label cfg-23) + (mc-get-slot-info (-> self slot) (-> self info)) + (when (zero? (-> self info known)) + (suspend) + (goto cfg-23) + ) + (go-virtual save) + ) + ) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate save (auto-save) + :virtual #t + :code (behavior () + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (go-virtual error (mc-status-code no-file)) + ) + ) + (let ((v1-10 (-> self buffer))) + (set! (-> v1-10 current) (-> v1-10 base)) + ) + (let ((gp-0 (the-as object loading-level))) + (set! loading-level (-> self buffer)) + (set! (-> self save) (new 'loading-level 'game-save #x20000)) + (save-game *game-info* (-> self save) "save") + (set! loading-level (the-as kheap gp-0)) + 0 + (label cfg-5) + (set! (-> self result) + (mc-save (-> self card) (-> self which) (&-> (-> self save) type) (the-as int (-> self save info-int32))) + ) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-5) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (let ((v1-20 (-> self result))) + (set! gp-0 (cond + ((= v1-20 (mc-status-code busy)) + #f + ) + ((= v1-20 (mc-status-code ok)) + (goto cfg-18) + gp-0 + ) + ((= v1-20 (mc-status-code write-error)) + (suspend) + gp-0 + ) + (else + (case (-> self mode) + (('auto-save) + (seekl! (-> *game-info* auto-save-count) 0 1) + ) + ) + (go-virtual error (-> self result)) + ) + ) + ) + ) + (suspend) + ) + ) + #f + (label cfg-18) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate restore (auto-save) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('progress-allowed?) + #t + ) + (('done) + (go-virtual done) + ) + ) + ) + :code (behavior () + (local-vars (gp-0 object)) + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (go-virtual error (mc-status-code no-file)) + ) + ) + (let ((v1-10 (-> self buffer))) + (set! (-> v1-10 current) (-> v1-10 base)) + ) + (if (zero? (-> self info file (-> self which) present)) + (go-virtual error (mc-status-code no-save)) + ) + (label cfg-6) + (set! (-> self result) (mc-load (-> self card) (-> self which) (-> self buffer base))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-6) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (let ((v1-22 (-> self result))) + (set! gp-0 (cond + ((= v1-22 (mc-status-code busy)) + #f + ) + ((= v1-22 (mc-status-code ok)) + (goto cfg-19) + gp-0 + ) + ((= v1-22 (mc-status-code read-error)) + (suspend) + gp-0 + ) + ((= v1-22 (mc-status-code new-game)) + (go-virtual error (mc-status-code no-save)) + ) + (else + (go-virtual error (-> self result)) + ) + ) + ) + ) + (suspend) + ) + #f + (label cfg-19) + (set! (-> self save) (the-as game-save (&+ (-> self buffer base) 4))) + (let ((v1-34 (-> self save))) + (set! (-> v1-34 type) game-save) + (if (!= (-> v1-34 version) 3) + (go-virtual error (mc-status-code bad-version)) + ) + ) + (set-setting! 'music-volume 'abs 0 0) + (set-setting! 'sfx-volume 'abs 0 0) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (-> self save) (the-as string #f)) + (set-master-mode 'game) + (add-setting! 'process-mask 'set 0 (process-mask progress)) + (apply-settings *setting-control*) + (sleep-code) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate error (auto-save) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (cond + ((= v1-0 'progress-allowed?) + #t + ) + ((= v1-0 'die) + (deactivate self) + ) + ) + ) + ) + ) + :code (behavior ((arg0 mc-status-code)) + (if (-> self buffer) + (reserve-free *art-control* (-> self buffer)) + ) + (set! (-> self result) arg0) + (let ((s5-0 *auto-save-info*)) + (mem-copy! (the-as pointer s5-0) (the-as pointer (-> self info)) 300) + (send-event (handle->process (-> self notify)) 'notify 'error (-> self result) s5-0) + ) + (let ((t9-3 format) + (a0-8 #t) + (a1-3 "SAVE ERROR: ~A~%") + (v1-13 (-> self result)) + ) + (t9-3 a0-8 a1-3 (cond + ((= v1-13 (mc-status-code bad-version)) + "bad-version" + ) + ((= v1-13 (mc-status-code no-save)) + "no-save" + ) + ((= v1-13 (mc-status-code no-last)) + "no-last" + ) + ((= v1-13 (mc-status-code no-space)) + "no-space" + ) + ((= v1-13 (mc-status-code internal-error)) + "internal-error" + ) + ((= v1-13 (mc-status-code no-memory)) + "no-memory" + ) + ((= v1-13 (mc-status-code bad-handle)) + "bad-handle" + ) + ((= v1-13 (mc-status-code busy)) + "busy" + ) + ((= v1-13 (mc-status-code write-error)) + "write-error" + ) + ((= v1-13 (mc-status-code read-error)) + "read-error" + ) + ((= v1-13 (mc-status-code no-card)) + "no-card" + ) + ((= v1-13 (mc-status-code no-format)) + "no-format" + ) + ((= v1-13 (mc-status-code ok)) + "ok" + ) + ((= v1-13 (mc-status-code no-process)) + "no-process" + ) + ((= v1-13 (mc-status-code no-auto-save)) + "no-auto-save" + ) + ((= v1-13 (mc-status-code no-file)) + "no-file" + ) + ((= v1-13 (mc-status-code format-failed)) + "format-failed" + ) + ((= v1-13 (mc-status-code new-game)) + "new-game" + ) + (else + "*unknown*" + ) + ) + ) + ) + (if (= (-> self result) (mc-status-code no-auto-save)) + (return #f) + ) + (case (-> self mode) + (('auto-save 'error) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + (set! (-> *game-info* auto-save-status) arg0) + (while (< (- (-> *display* real-clock frame-counter) (-> self state-time)) (seconds 0.2)) + (if (not (progress-allowed?)) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + ) + (suspend) + ) + (if (= arg0 (mc-status-code no-card)) + (activate-progress *dproc* 'card-removed) + (activate-progress *dproc* 'error-auto-saving) + ) + ) + ) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate done (auto-save) + :virtual #t + :code (behavior () + (if (and (-> self buffer) + (or (-> *art-control* reserve-buffer) (nonzero? (-> *art-control* dma-reserve-buffer-count))) + ) + (reserve-free *art-control* (-> self buffer)) + ) + (set! (-> *game-info* auto-save-status) (mc-status-code ok)) + (case (-> self mode) + (('save 'save-last 'auto-save 'restore) + (set! (-> *setting-control* user-default auto-save) #t) + (set! (-> *game-info* auto-save-card) (-> self card)) + (set! (-> *game-info* auto-save-which) (-> self which)) + ) + ) + (case (-> self mode) + (('auto-save) + ) + (else + (set! (-> *game-info* auto-save-proc) (the-as handle #f)) + ) + ) + (let ((gp-0 *auto-save-info*)) + (mem-copy! (the-as pointer gp-0) (the-as pointer (-> self info)) 300) + (send-event (handle->process (-> self notify)) 'notify 'done 1 gp-0) + ) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defun auto-save-command ((arg0 symbol) (arg1 int) (arg2 int) (arg3 process-tree) (arg4 symbol)) + (format #t "AUTO SAVE COMMAND ~S~%" arg0) + (process-spawn auto-save arg0 arg3 arg1 arg2 arg4 :to *target-pool* :stack *kernel-dram-stack*) + ) + +(defun auto-save-check () + (when (and (-> *setting-control* user-current auto-save) (not (handle->process (-> *game-info* auto-save-proc)))) + (mc-get-slot-info 0 *auto-save-info*) + (if (and (nonzero? (-> *auto-save-info* known)) + (or (zero? (-> *auto-save-info* handle)) (!= (-> *auto-save-info* handle) (-> *game-info* auto-save-card))) + ) + (auto-save-command 'error 0 0 *default-pool* #f) + ) + ) + 0 + ) + +(defun auto-save-user () + (case *kernel-boot-message* + (('play 'preview) + (auto-save-command 'auto-save 0 0 *default-pool* #f) + ) + ) + ) diff --git a/goal_src/jak2/engine/game/task/task-control-h.gc b/goal_src/jak2/engine/game/task/task-control-h.gc index a5c7b70081..2b195a92ab 100644 --- a/goal_src/jak2/engine/game/task/task-control-h.gc +++ b/goal_src/jak2/engine/game/task/task-control-h.gc @@ -7,6 +7,8 @@ (define-extern task-node-reset (function symbol int)) +(define-extern game-task-node->string (function game-task-node string)) + (defenum game-task-actor :bitfield #f :type uint8 diff --git a/goal_src/jak2/engine/gfx/hw/display-h.gc b/goal_src/jak2/engine/gfx/hw/display-h.gc index dff98ee3e9..9f207122d4 100644 --- a/goal_src/jak2/engine/gfx/hw/display-h.gc +++ b/goal_src/jak2/engine/gfx/hw/display-h.gc @@ -128,4 +128,4 @@ (defmacro current-frame () `(-> *display* frames (-> *display* on-screen)) - ) \ No newline at end of file + ) diff --git a/goal_src/jak2/engine/ps2/memcard-h.gc b/goal_src/jak2/engine/ps2/memcard-h.gc index 596d175df7..8aabe2e9ab 100644 --- a/goal_src/jak2/engine/ps2/memcard-h.gc +++ b/goal_src/jak2/engine/ps2/memcard-h.gc @@ -86,7 +86,7 @@ (let ((v0-0 0)) (while (zero? v0-0) (mc-run) - (set! v0-0 (mc-check-result)) + (set! v0-0 (the-as int (mc-check-result))) ) v0-0 ) diff --git a/goal_src/jak2/engine/ps2/pad.gc b/goal_src/jak2/engine/ps2/pad.gc index a57496895c..96dc0a5f72 100644 --- a/goal_src/jak2/engine/ps2/pad.gc +++ b/goal_src/jak2/engine/ps2/pad.gc @@ -72,6 +72,7 @@ :flag-assert #x900000008 ) +(define-extern scf-get-time (function scf-time none)) ;; this gets set to #f later on. (define *cheat-mode* #t) diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index 03553b8a56..b470f6a4a9 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -195,6 +195,7 @@ (progress-memcard-insert-card-with-jak2 #x19c) (progress-memcard-insert-card-with-space-to-save #x19d) (progress-memcard-formatting-required-notice #x19e) + (text-x19f #x19f) (progress-memcard-loading-data #x1a0) (text-x1a1 #x01a1) (text-x1a2 #x01a2) diff --git a/goal_src/jak2/kernel-defs.gc b/goal_src/jak2/kernel-defs.gc index a72d3e44f0..860afcaa99 100644 --- a/goal_src/jak2/kernel-defs.gc +++ b/goal_src/jak2/kernel-defs.gc @@ -146,10 +146,6 @@ (define-extern new-dynamic-structure (function symbol type int structure)) -(define-extern mc-run (function none)) -(define-extern mc-check-result (function int)) -(declare-type mc-slot-info structure) -(define-extern mc-get-slot-info (function int mc-slot-info none)) (define-extern rpc-busy? (function int uint)) (define-extern rpc-call (function int uint uint uint int uint int uint)) (define-extern string->symbol (function string symbol)) @@ -159,6 +155,44 @@ (define-extern kset-language (function language-enum int)) (define-extern syncv (function int int)) + +;; +++memcard-h:mc-status-code +(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) + ) +;; ---memcard-h:mc-status-code + +(define-extern mc-run (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)) +(declare-type mc-slot-info structure) +(define-extern mc-sync (function int)) +(define-extern mc-get-slot-info (function int mc-slot-info none)) + +(define-extern mc-check-result (function mc-status-code)) +;; mc-makefile + (define-extern __pc-get-mips2c (function string function)) (define-extern dma-sync (function pointer int int int)) diff --git a/scripts/batch/test-types2.bat b/scripts/batch/test2-types.bat similarity index 100% rename from scripts/batch/test-types2.bat rename to scripts/batch/test2-types.bat diff --git a/test/decompiler/reference/jak1/decompiler-macros.gc b/test/decompiler/reference/jak1/decompiler-macros.gc index 3c6f8d6a32..c90ce9deaf 100644 --- a/test/decompiler/reference/jak1/decompiler-macros.gc +++ b/test/decompiler/reference/jak1/decompiler-macros.gc @@ -1302,4 +1302,61 @@ :regs14 (gif-reg-id a+d) :regs15 (gif-reg-id a+d) ) - ) \ No newline at end of file + ) + +;; dma-buffer + +(defmacro with-dma-bucket (bindings &rest body) + "Start a new dma-bucket in body that will be finished at the end. + The bindings are the dma-buffer, dma-bucket and bucket-id respectively." + + (let ((buf (first bindings)) + (bucket (second bindings)) + (bucket-id (third bindings)) + ) + + (with-gensyms (buf-start bucket-edge pkt) + `(let ((,buf-start (-> ,buf base))) + + ,@body + + ;; we end the chain with a next. The bucket system will patch the next chain to this, + ;; and then patch all the buckets togehter before sending the DMA. + (let ((,bucket-edge (the (pointer dma-tag) (-> ,buf base)))) + (let ((,pkt (the-as dma-packet (-> ,buf base)))) + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> ,pkt vif0) (new 'static 'vif-tag :cmd (vif-cmd nop))) + (set! (-> ,pkt vif1) (new 'static 'vif-tag :cmd (vif-cmd nop))) + + (set! (-> ,buf base) (&+ (the-as pointer ,pkt) (size-of dma-packet))) + + ) + (dma-bucket-insert-tag ,bucket ,bucket-id + ,buf-start ;; the first thing in this chain, bucket will patch previous to this + ,bucket-edge ;; end of this chain (ptr to next tag) + ) + ) + ) + ) + + ) + ) + +(defmacro with-dma-buffer-add-bucket (bindings &key (bucket-group (-> (current-frame) bucket-group)) &rest body) + "Bind a dma-buffer to a variable and use it on a block to allow adding things to a new bucket. + usage: (with-dma-buffer-add-bucket ((buffer-name buffer) bucket-id) &rest body) + example: (with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-no-zbuf)) ...)" + + `(let ((,(caar bindings) ,(cadar bindings))) + (with-dma-bucket (,(caar bindings) ,bucket-group ,(cadr bindings)) + ,@body + ) + ) + ) + +;; display-h + +(defmacro current-frame () + `(-> *display* frames (-> *display* on-screen)) + ) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 6c8c142080..d53a815e65 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -1214,4 +1214,57 @@ ;; add to level (add-to-loading-level ,name) ) - ) \ No newline at end of file + ) + +(defmacro with-dma-bucket (bindings &rest body) + "Start a new dma-bucket in body that will be finished at the end. + The bindings are the dma-buffer, dma-bucket and bucket-id respectively." + + (let ((buf (first bindings)) + (bucket (second bindings)) + (bucket-id (third bindings)) + ) + + (with-gensyms (buf-start bucket-edge pkt) + `(let ((,buf-start (-> ,buf base))) + + ,@body + + ;; we end the chain with a next. The bucket system will patch the next chain to this, + ;; and then patch all the buckets togehter before sending the DMA. + (let ((,bucket-edge (the (pointer dma-tag) (-> ,buf base)))) + (let ((,pkt (the-as dma-packet (-> ,buf base)))) + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> ,pkt vif0) (new 'static 'vif-tag :cmd (vif-cmd nop))) + (set! (-> ,pkt vif1) (new 'static 'vif-tag :cmd (vif-cmd nop))) + + (set! (-> ,buf base) (&+ (the-as pointer ,pkt) (size-of dma-packet))) + + ) + (dma-bucket-insert-tag ,bucket ,bucket-id + ,buf-start ;; the first thing in this chain, bucket will patch previous to this + ,bucket-edge ;; end of this chain (ptr to next tag) + ) + ) + ) + ) + + ) + ) + +(defmacro with-dma-buffer-add-bucket (bindings &key (bucket-group (-> (current-frame) bucket-group)) &rest body) + "Bind a dma-buffer to a variable and use it on a block to allow adding things to a new bucket. + usage: (with-dma-buffer-add-bucket ((buffer-name buffer) bucket-id) &rest body) + example: (with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-no-zbuf)) ...)" + + `(let ((,(caar bindings) ,(cadar bindings))) + (with-dma-bucket (,(caar bindings) ,bucket-group ,(cadr bindings)) + ,@body + ) + ) + ) + +(defmacro current-frame () + `(-> *display* frames (-> *display* on-screen)) + ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc index 9b1bd76110..6c80c38236 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc @@ -1,40 +1,30 @@ -;;-*-Lisp-*- (in-package goal) -;; this file is debug only (declare-file (debug)) (when *debug-segment* -;; failed to figure out what this is: (when (or (not *camera-old-cpu*) (zero? *camera-old-cpu*)) (set! *camera-old-cpu* 0) 0 ) -;; failed to figure out what this is: (when (or (not *camera-old-vu*) (zero? *camera-old-vu*)) (set! *camera-old-vu* 0) 0 ) -;; failed to figure out what this is: (when (or (not *camera-old-tfrag-bytes*) (zero? *camera-old-tfrag-bytes*)) (set! *camera-old-tfrag-bytes* 0) 0 ) -;; definition (perm) for symbol *camera-old-level*, type string (define-perm *camera-old-level* string (new 'global 'string 128 (the-as string #f))) -;; definition (perm) for symbol *camera-old-stat-string-tfrag*, type string (define-perm *camera-old-stat-string-tfrag* string (new 'global 'string 128 (the-as string #f))) -;; definition (perm) for symbol *camera-old-stat-string-tfrag-near*, type string (define-perm *camera-old-stat-string-tfrag-near* string (new 'global 'string 128 (the-as string #f))) -;; definition (perm) for symbol *camera-old-stat-string-total*, type string (define-perm *camera-old-stat-string-total* string (new 'global 'string 128 (the-as string #f))) -;; definition of type cam-dbg-scratch (deftype cam-dbg-scratch (structure) ((linevec4w vector4w 2 :inline :offset-assert 0) (color vector4w :inline :offset-assert 32) @@ -58,7 +48,6 @@ :flag-assert #x9000001d0 ) -;; definition for method 3 of type cam-dbg-scratch (defmethod inspect cam-dbg-scratch ((obj cam-dbg-scratch)) (when (not obj) (set! obj obj) @@ -85,8 +74,6 @@ obj ) -;; definition for function cam-slave-options->string -;; WARN: Return type mismatch object vs string. (defun cam-slave-options->string ((arg0 cam-slave-options) (arg1 object)) (if (= (logand arg0 (cam-slave-options SAME_SIDE)) (cam-slave-options SAME_SIDE)) (format arg1 "SAME_SIDE ") @@ -165,8 +152,6 @@ (the-as string arg1) ) -;; definition for function cam-index-options->string -;; WARN: Return type mismatch object vs string. (defun cam-index-options->string ((arg0 cam-index-options) (arg1 object)) (if (= (logand arg0 (cam-index-options SPHERICAL)) (cam-index-options SPHERICAL)) (format arg1 "RADIAL ") @@ -177,7 +162,6 @@ (the-as string arg1) ) -;; definition for function slave-los-state->string (defun slave-los-state->string ((arg0 slave-los-state)) (case arg0 (((slave-los-state between)) @@ -198,12 +182,10 @@ ) ) -;; definition for function cam-line-dma -;; INFO: Used lq/sq (defun cam-line-dma () - (let* ((v1-5 (-> *display* frames (-> *display* on-screen) debug-buf)) - (a2-0 (-> v1-5 base)) - ) + (with-dma-buffer-add-bucket ((v1-5 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug-no-zbuf1) + ) (let ((a0-1 (the-as object (-> v1-5 base)))) (let* ((a1-0 v1-5) (a3-0 (the-as object (-> a1-0 base))) @@ -260,24 +242,9 @@ ) ) ) - (let ((a3-16 (-> v1-5 base))) - (let ((a0-2 (the-as object (-> v1-5 base)))) - (set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-2) vif1) (new 'static 'vif-tag)) - (set! (-> v1-5 base) (&+ (the-as pointer a0-2) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug-no-zbuf1) - a2-0 - (the-as (pointer dma-tag) a3-16) - ) - ) ) ) -;; definition for function camera-line2d (defun camera-line2d ((arg0 vector4w) (arg1 vector4w)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 x) (the-as int (* (+ (-> arg0 x) 1792) 16))) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 y) @@ -294,9 +261,6 @@ (cam-line-dma) ) -;; definition for function camera-plot-float-func -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun camera-plot-float-func ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 (function float float)) (arg5 vector4w)) (let ((f30-0 (- arg1 arg0)) (f24-0 (- arg3 arg2)) @@ -397,9 +361,6 @@ (none) ) -;; definition for function camera-line-setup -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun camera-line-setup ((arg0 vector4w)) (let ((v1-0 (-> arg0 quad))) (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-0) @@ -409,10 +370,6 @@ (none) ) -;; definition for function camera-line-draw -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. -;; WARN: Function camera-line-draw has a return type of none, but the expression builder found a return statement. (defun camera-line-draw ((arg0 vector) (arg1 vector)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 0 quad) (-> arg0 quad)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 1 quad) (-> arg1 quad)) @@ -439,8 +396,6 @@ (none) ) -;; definition for function camera-line -;; WARN: Return type mismatch int vs none. (defun camera-line ((arg0 vector) (arg1 vector) (arg2 vector4w)) (camera-line-setup arg2) (camera-line-draw arg0 arg1) @@ -448,14 +403,12 @@ (none) ) -;; definition for function camera-line-rel (defun camera-line-rel ((arg0 vector) (arg1 vector) (arg2 vector4w)) (vector+! (-> (the-as cam-dbg-scratch #x70000000) rel-vec) arg0 arg1) (camera-line arg0 (-> (the-as cam-dbg-scratch #x70000000) rel-vec) arg2) (none) ) -;; definition for function camera-line-rel-len (defun camera-line-rel-len ((arg0 vector) (arg1 vector) (arg2 float) (arg3 vector4w)) (vector-normalize-copy! (-> (the-as cam-dbg-scratch #x70000000) rel-vec) arg1 arg2) (vector+! @@ -467,8 +420,6 @@ (none) ) -;; definition for function camera-sphere -;; WARN: Return type mismatch int vs none. (defun camera-sphere ((arg0 vector) (arg1 float) (arg2 vector4w)) (camera-line-setup arg2) (dotimes (s4-0 10) @@ -518,7 +469,6 @@ (none) ) -;; definition for function camera-cross (defun camera-cross ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector4w) (arg4 meters)) (vector-normalize-copy! (the-as vector (-> (the-as cam-dbg-scratch #x70000000) crossvec)) arg0 arg4) (vector+! @@ -581,9 +531,6 @@ (none) ) -;; definition for function camera-bounding-box-draw -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun camera-bounding-box-draw ((arg0 bounding-box) (arg1 basic) (arg2 rgba)) (camera-line-setup (new 'static 'vector4w :x #x7f :y #x7f :z #x7f :w #x80)) (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 0 quad) (-> arg0 min quad)) @@ -632,7 +579,6 @@ (none) ) -;; definition of type cam-debug-tri (deftype cam-debug-tri (structure) ((vertex vector 3 :inline :offset-assert 0) (intersect vector :inline :offset-assert 48) @@ -643,7 +589,6 @@ :flag-assert #x900000044 ) -;; definition for method 3 of type cam-debug-tri (defmethod inspect cam-debug-tri ((obj cam-debug-tri)) (when (not obj) (set! obj obj) @@ -657,20 +602,14 @@ obj ) -;; definition for symbol *cam-debug-los-tri-current*, type int (define *cam-debug-los-tri-current* 0) -;; definition for symbol *cam-debug-los-tri*, type (inline-array cam-debug-tri) (define *cam-debug-los-tri* (the-as (inline-array cam-debug-tri) (malloc 'debug #x8fc0))) -;; definition for symbol *cam-debug-coll-tri-current*, type int (define *cam-debug-coll-tri-current* 0) -;; definition for symbol *cam-debug-coll-tri*, type (inline-array cam-debug-tri) (define *cam-debug-coll-tri* (the-as (inline-array cam-debug-tri) (malloc 'debug #x8fc0))) -;; definition for function cam-debug-reset-coll-tri -;; WARN: Return type mismatch int vs none. (defun cam-debug-reset-coll-tri () (set! *cam-debug-los-tri-current* 0) (set! *cam-debug-coll-tri-current* 0) @@ -678,9 +617,6 @@ (none) ) -;; definition for function cam-debug-add-los-tri -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun cam-debug-add-los-tri ((arg0 (inline-array collide-cache-tri)) (arg1 vector) (arg2 vector)) (cond ((>= *cam-debug-los-tri-current* 460) @@ -703,9 +639,6 @@ (none) ) -;; definition for function cam-debug-add-coll-tri -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun cam-debug-add-coll-tri ((arg0 cam-debug-tri) (arg1 vector) (arg2 cam-debug-tri)) (cond ((>= *cam-debug-coll-tri-current* 460) @@ -728,8 +661,6 @@ (none) ) -;; definition for function cam-debug-draw-tris -;; INFO: Used lq/sq (defun cam-debug-draw-tris () (camera-line-setup (new 'stack 'vector4w)) (when *display-cam-los-marks* @@ -787,7 +718,6 @@ ) ) -;; definition for function camera-fov-draw (defun camera-fov-draw ((arg0 int) (arg1 int) (arg2 vector) (arg3 float) (arg4 float) (arg5 vector4w)) (vector+float*! (the-as vector (-> (the-as cam-dbg-scratch #x70000000) fov-vv)) @@ -808,9 +738,6 @@ (none) ) -;; definition for function camera-fov-frame -;; INFO: Used lq/sq -;; WARN: Return type mismatch none vs symbol. (defun camera-fov-frame ((arg0 matrix) (arg1 vector) (arg2 float) (arg3 float) (arg4 float) (arg5 vector4w)) (vector-float*! (-> (the-as cam-dbg-scratch #x70000000) fov-vert) (-> arg0 vector 1) (* arg3 (tan arg2))) (vector-float*! @@ -912,8 +839,6 @@ ) ) -;; definition for method 11 of type tracking-spline -;; WARN: Return type mismatch int vs none. (defmethod debug-point-info tracking-spline ((obj tracking-spline) (arg0 int)) (if (= arg0 (-> obj used-point)) (format 0 "u") @@ -942,8 +867,6 @@ (none) ) -;; definition for method 12 of type tracking-spline -;; WARN: Return type mismatch int vs none. (defmethod debug-all-points tracking-spline ((obj tracking-spline)) (let ((s5-0 (-> obj used-point))) (while (!= s5-0 -134250495) @@ -956,8 +879,6 @@ (none) ) -;; definition for method 23 of type tracking-spline -;; WARN: Return type mismatch int vs none. (defmethod debug-draw-spline tracking-spline ((obj tracking-spline)) (let ((s5-0 (-> obj used-point))) (let ((s4-0 (-> obj point (-> obj used-point) next))) @@ -1015,7 +936,6 @@ (none) ) -;; definition for function debug-euler (defun debug-euler ((arg0 cam-dbg-scratch)) (let ((s4-0 (new 'stack-no-clear 'euler-angles)) (gp-0 (new 'stack-no-clear 'matrix)) @@ -1103,7 +1023,6 @@ ) ) -;; definition for function bike-cam-limit (defun bike-cam-limit ((arg0 float)) (let* ((f0-1 (* 10012.444 arg0)) (f30-0 (fmax 0.0 f0-1)) @@ -1115,9 +1034,6 @@ ) ) -;; definition for function camera-slave-debug -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun camera-slave-debug ((arg0 camera-slave)) (when *display-camera-marks* (if (-> *setting-control* cam-current use-point-of-interest) @@ -1305,9 +1221,6 @@ (none) ) -;; definition for function master-draw-coordinates -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun master-draw-coordinates ((arg0 vector)) (let ((s5-0 (new-stack-vector0)) (gp-0 (new-stack-vector0)) @@ -1397,7 +1310,6 @@ (none) ) -;; definition of type cam-collision-record (deftype cam-collision-record (structure) ((pos vector :inline :offset-assert 0) (vel vector :inline :offset-assert 16) @@ -1420,7 +1332,6 @@ :flag-assert #x9000000a8 ) -;; definition for method 3 of type cam-collision-record (defmethod inspect cam-collision-record ((obj cam-collision-record)) (when (not obj) (set! obj obj) @@ -1446,7 +1357,6 @@ obj ) -;; definition of type cam-collision-record-array (deftype cam-collision-record-array (inline-array-class) ((data cam-collision-record :dynamic :offset-assert 16) ) @@ -1455,7 +1365,6 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type cam-collision-record-array (defmethod inspect cam-collision-record-array ((obj cam-collision-record-array)) (when (not obj) (set! obj obj) @@ -1469,24 +1378,16 @@ obj ) -;; failed to figure out what this is: (set! (-> cam-collision-record-array heap-base) (the-as uint 176)) -;; definition for symbol *cam-collision-record-first*, type int (define *cam-collision-record-first* 0) -;; definition for symbol *cam-collision-record-last*, type int (define *cam-collision-record-last* 0) -;; definition for symbol *cam-collision-record-show*, type int (define *cam-collision-record-show* 0) -;; definition for symbol *cam-collision-record*, type cam-collision-record-array (define *cam-collision-record* (new 'debug 'cam-collision-record-array 600)) -;; definition for function cam-collision-record-save -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) (with-pp (when *record-cam-collide-history* @@ -1525,8 +1426,6 @@ ) ) -;; definition for function cam-collision-record-step -;; WARN: Return type mismatch int vs none. (defun cam-collision-record-step ((arg0 int)) (set! *cam-collision-record-show* (+ *cam-collision-record-show* arg0)) (while (>= *cam-collision-record-show* 600) @@ -1539,9 +1438,6 @@ (none) ) -;; definition for function cam-collision-record-draw -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun cam-collision-record-draw () (cond ((cpad-pressed? 0 down) @@ -1700,8 +1596,6 @@ (none) ) -;; definition for function camera-master-debug -;; WARN: Return type mismatch int vs none. (defun camera-master-debug ((arg0 camera-master)) (when *display-cam-other* (let ((f0-1 (* 0.5 (-> *camera-other-fov* data)))) @@ -1762,8 +1656,6 @@ (none) ) -;; definition for function debug-set-camera-pos-rot! -;; INFO: Used lq/sq (defun debug-set-camera-pos-rot! ((arg0 vector) (arg1 matrix)) (when (and *camera* *camera-combiner*) (set! (-> *camera-combiner* trans quad) (-> arg0 quad)) @@ -1785,9 +1677,6 @@ arg0 ) -;; definition (debug) for function cam-restore -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun-debug cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc index 6dc1a4c112..e471583851 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc @@ -1,13 +1,9 @@ -;;-*-Lisp-*- (in-package goal) -;; this file is debug only (declare-file (debug)) (when *debug-segment* -;; definition for symbol *camera-layout-blink*, type symbol (define *camera-layout-blink* #f) -;; definition of type cam-layout-bank (deftype cam-layout-bank (basic) ((spline-t float :offset-assert 4) (spline-step float :offset-assert 8) @@ -21,7 +17,6 @@ :flag-assert #x90000001c ) -;; definition for method 3 of type cam-layout-bank (defmethod inspect cam-layout-bank ((obj cam-layout-bank)) (when (not obj) (set! obj obj) @@ -38,7 +33,6 @@ obj ) -;; definition for symbol *CAM_LAYOUT-bank*, type cam-layout-bank (define *CAM_LAYOUT-bank* (new 'static 'cam-layout-bank :spline-t 0.01 :spline-step 0.0016666667 @@ -49,10 +43,8 @@ ) ) -;; definition for symbol *camera-layout-message-ypos*, type int (define *camera-layout-message-ypos* 30) -;; definition of type clm-basic (deftype clm-basic (basic) () :method-count-assert 9 @@ -60,7 +52,6 @@ :flag-assert #x900000004 ) -;; definition for method 3 of type clm-basic (defmethod inspect clm-basic ((obj clm-basic)) (when (not obj) (set! obj obj) @@ -71,7 +62,6 @@ obj ) -;; definition of type clm-item-action (deftype clm-item-action (structure) ((button uint64 :offset-assert 0) (options uint64 :offset-assert 8) @@ -87,7 +77,6 @@ :flag-assert #x90000001c ) -;; definition for method 3 of type clm-item-action (defmethod inspect clm-item-action ((obj clm-item-action)) (when (not obj) (set! obj obj) @@ -103,7 +92,6 @@ obj ) -;; definition of type clm-item (deftype clm-item (clm-basic) ((description string :offset-assert 4) (button-symbol symbol :offset-assert 8) @@ -114,7 +102,6 @@ :flag-assert #x90000002c ) -;; definition for method 3 of type clm-item (defmethod inspect clm-item ((obj clm-item)) (when (not obj) (set! obj obj) @@ -128,7 +115,6 @@ obj ) -;; definition of type clm-list-item (deftype clm-list-item (basic) ((description string :offset-assert 4) (track-val symbol :offset-assert 8) @@ -145,7 +131,6 @@ :flag-assert #x90000001c ) -;; definition for method 3 of type clm-list-item (defmethod inspect clm-list-item ((obj clm-list-item)) (when (not obj) (set! obj obj) @@ -162,7 +147,6 @@ obj ) -;; definition of type clm-list (deftype clm-list (clm-basic) ((tracker symbol :offset-assert 4) (cur-list-item int32 :offset-assert 8) @@ -173,7 +157,6 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type clm-list (defmethod inspect clm-list ((obj clm-list)) (when (not obj) (set! obj obj) @@ -187,7 +170,6 @@ obj ) -;; definition of type clm (deftype clm (basic) ((title string :offset-assert 4) (items (array clm-basic) :offset-assert 8) @@ -197,7 +179,6 @@ :flag-assert #x90000000c ) -;; definition for method 3 of type clm (defmethod inspect clm ((obj clm)) (when (not obj) (set! obj obj) @@ -210,19 +191,14 @@ obj ) -;; definition for symbol *volume-point-current*, type int (define *volume-point-current* 0) -;; definition for symbol *volume-point*, type vector-array (define *volume-point* (new 'debug 'vector-array 1000)) -;; definition for symbol *volume-normal-current*, type int (define *volume-normal-current* 0) -;; definition for symbol *volume-normal*, type vector-array (define *volume-normal* (new 'debug 'vector-array 600)) -;; definition of type volume-descriptor-array (deftype volume-descriptor-array (inline-array-class) ((data plane-volume :inline :dynamic :offset 16) ) @@ -231,7 +207,6 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type volume-descriptor-array (defmethod inspect volume-descriptor-array ((obj volume-descriptor-array)) (when (not obj) (set! obj obj) @@ -245,16 +220,12 @@ obj ) -;; failed to figure out what this is: (set! (-> volume-descriptor-array heap-base) (the-as uint 24)) -;; definition for symbol *volume-descriptor-current*, type int (define *volume-descriptor-current* 0) -;; definition for symbol *volume-descriptor*, type vol-control (define *volume-descriptor* (the-as vol-control (new 'debug 'volume-descriptor-array 100))) -;; definition of type cam-layout (deftype cam-layout (process) ((cam-entity entity-camera :offset-assert 128) (num-entities int32 :offset-assert 132) @@ -274,7 +245,6 @@ ) ) -;; definition for method 3 of type cam-layout (defmethod inspect cam-layout ((obj cam-layout)) (when (not obj) (set! obj obj) @@ -295,30 +265,14 @@ obj ) -;; definition for function cam-layout-print (defun cam-layout-print ((arg0 int) (arg1 int) (arg2 string)) - (let* ((s5-0 (-> *display* frames (-> *display* on-screen) debug-buf)) - (gp-0 (-> s5-0 base)) - ) + (with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug2) + ) (draw-string-xy arg2 s5-0 arg0 arg1 (font-color #dadada) (font-flags shadow kerning)) - (let ((a3-2 (-> s5-0 base))) - (let ((v1-6 (the-as object (-> s5-0 base)))) - (set! (-> (the-as dma-packet v1-6) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-6) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-6) vif1) (new 'static 'vif-tag)) - (set! (-> s5-0 base) (&+ (the-as pointer v1-6) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug2) - gp-0 - (the-as (pointer dma-tag) a3-2) - ) - ) ) ) -;; definition for function cam-layout-intersect-dist (defun cam-layout-intersect-dist ((arg0 vector) (arg1 vector) (arg2 vector)) (let ((f0-1 (vector-dot arg1 arg0)) (f1-1 (vector-dot arg2 arg0)) @@ -330,44 +284,6 @@ ) ) -;; definition for function cam-layout-entity-volume-info-create -;; INFO: Used lq/sq -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: Stack slot offset 164 signed mismatch -;; WARN: new jak 2 until loop case, check carefully (defbehavior cam-layout-entity-volume-info-create cam-layout ((arg0 entity-camera) (arg1 symbol)) (local-vars (sv-16 res-tag) @@ -544,7 +460,6 @@ #f ) -;; definition for function cam-layout-entity-volume-info (defbehavior cam-layout-entity-volume-info cam-layout () (dotimes (gp-0 (-> self num-volumes)) (cond @@ -590,8 +505,6 @@ #f ) -;; definition for function v-slrp! -;; INFO: Used lq/sq (defun v-slrp! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) (let ((s2-0 (new-stack-vector0)) (s1-0 (new-stack-vector0)) @@ -621,7 +534,6 @@ ) ) -;; definition of type interp-test-info (deftype interp-test-info (structure) ((from vector :inline :offset-assert 0) (to vector :inline :offset-assert 16) @@ -635,7 +547,6 @@ :flag-assert #x90000003c ) -;; definition for method 3 of type interp-test-info (defmethod inspect interp-test-info ((obj interp-test-info)) (when (not obj) (set! obj obj) @@ -652,8 +563,6 @@ obj ) -;; definition for function interp-test -;; INFO: Used lq/sq (defun interp-test ((arg0 (function vector vector vector float vector float none)) (arg1 interp-test-info)) (let ((s3-0 (new-stack-vector0)) (s5-0 (new-stack-vector0)) @@ -675,8 +584,6 @@ (none) ) -;; definition for function interp-test-deg -;; INFO: Used lq/sq (defun interp-test-deg ((arg0 (function vector vector vector vector float none)) (arg1 interp-test-info)) (let ((s3-0 (new-stack-vector0)) (s5-0 (new-stack-vector0)) @@ -698,9 +605,6 @@ (none) ) -;; definition for function cam-layout-entity-info -;; INFO: Used lq/sq -;; WARN: Function cam-layout-entity-info has a return type of none, but the expression builder found a return statement. (defun cam-layout-entity-info ((arg0 entity-actor)) (if (not arg0) (return #f) @@ -961,7 +865,6 @@ (none) ) -;; definition for function clmf-button-test (defun clmf-button-test () "Displays the message `button test`" (cam-layout-print 16 *camera-layout-message-ypos* "button test") @@ -970,7 +873,6 @@ #f ) -;; definition for function clmf-bna (defun clmf-bna () "Displays the message `button not available`" (cam-layout-print 16 *camera-layout-message-ypos* "button not applicable") @@ -979,7 +881,6 @@ #t ) -;; definition for function clmf-implement (defun clmf-implement () "Displays the message `button not implemented yet`" (cam-layout-print 16 *camera-layout-message-ypos* "button not implemented yet") @@ -988,8 +889,6 @@ #t ) -;; definition for function clmf-input -;; INFO: Used lq/sq (defun clmf-input ((arg0 vector) (arg1 vector) (arg2 int)) (vector-reset! arg0) (vector-reset! arg1) @@ -1036,8 +935,6 @@ arg1 ) -;; definition for function clmf-pos-rot -;; INFO: Used lq/sq (defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) (local-vars (s2-0 structure) (s3-1 vector) (sv-192 matrix)) (cam-layout-print 16 *camera-layout-message-ypos* "x/z pos: left stick, down: l1, up: r1") @@ -1146,7 +1043,6 @@ #t ) -;; definition for function clmf-next-volume (defbehavior clmf-next-volume cam-layout ((arg0 int)) (if (zero? (-> self num-volumes)) (return #f) @@ -1158,7 +1054,6 @@ #t ) -;; definition for function clmf-next-vol-dpad (defun clmf-next-vol-dpad () (local-vars (a0-1 int)) (cam-layout-print 16 *camera-layout-message-ypos* "dpad selects volume") @@ -1185,17 +1080,14 @@ #t ) -;; definition for function clmf-to-edit-cam (defun clmf-to-edit-cam () (clmf-next-volume 0) (set! *clm* *clm-edit*) #t ) -;; definition for symbol *last-cur-entity*, type int (define *last-cur-entity* -1) -;; definition for function clmf-next-entity (defbehavior clmf-next-entity cam-layout ((arg0 int)) (let ((v1-0 (/ arg0 8))) (when (zero? (-> self num-entities)) @@ -1250,46 +1142,38 @@ #t ) -;; definition for function clmf-to-spline-attr (defun clmf-to-spline-attr () (set! *clm* *clm-spline-attr*) #t ) -;; definition for function clmf-to-intro-attr (defun clmf-to-intro-attr () (set! *clm* *clm-intro-attr*) #t ) -;; definition for function clmf-to-index-attr (defun clmf-to-index-attr () (set! *clm* *clm-index-attr*) #t ) -;; definition for function clmf-to-focalpull-attr (defun clmf-to-focalpull-attr () (set! *clm* *clm-focalpull-attr*) #t ) -;; definition for function clmf-to-edit (defbehavior clmf-to-edit cam-layout () (set! (-> self res-key) -1000000000.0) (set! *clm* *clm-edit*) #t ) -;; definition for function clmf-to-select (defun clmf-to-select () (set! *camera-layout-blink* #f) (set! *clm* *clm-select*) #t ) -;; definition for function clmf-look-through -;; INFO: Used lq/sq (defbehavior clmf-look-through cam-layout () (set! (-> *camera-other-fov* data) (cam-slave-get-fov (-> self cam-entity))) (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) *camera-other-trans* 'trans) @@ -1300,7 +1184,6 @@ #f ) -;; definition for function fov->maya (defun fov->maya ((arg0 float)) (if (= arg0 0.0) 0.0 @@ -1308,8 +1191,6 @@ ) ) -;; definition for function cam-layout-save-cam-rot -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-cam-rot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s3-0 (-> arg2 quat)) (s5-0 (res-lump-struct arg2 'rot-offset vector)) @@ -1334,9 +1215,6 @@ (none) ) -;; definition for function cam-layout-save-cam-trans -;; INFO: Used lq/sq -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-cam-trans ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s1-0 (-> arg2 trans)) (s5-0 (method-of-type res-lump get-property-struct)) @@ -1406,9 +1284,6 @@ (none) ) -;; definition for function cam-layout-save-pivot -;; INFO: Used lq/sq -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-pivot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s2-0 (res-lump-struct arg2 'pivot vector)) (s4-0 (method-of-type res-lump get-property-struct)) @@ -1454,9 +1329,6 @@ (none) ) -;; definition for function cam-layout-save-align -;; INFO: Used lq/sq -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-align ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s2-0 (res-lump-struct arg2 'align vector)) (s4-0 (method-of-type res-lump get-property-struct)) @@ -1502,9 +1374,6 @@ (none) ) -;; definition for function cam-layout-save-interesting -;; INFO: Used lq/sq -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-interesting ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s2-0 (res-lump-struct arg2 'interesting vector)) (s4-0 (method-of-type res-lump get-property-struct)) @@ -1550,8 +1419,6 @@ (none) ) -;; definition for function cam-layout-save-fov -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-fov ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f28-0 (res-lump-float arg2 'fov)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -1591,8 +1458,6 @@ (none) ) -;; definition for function cam-layout-save-focalpull -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-focalpull ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'focalPull)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -1624,8 +1489,6 @@ (none) ) -;; definition for function cam-layout-save-flags -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s4-0 (res-lump-value arg2 'flags uint128 :time -1000000000.0)) (s5-0 (method-of-type res-lump get-property-value)) @@ -1680,8 +1543,6 @@ (none) ) -;; definition for function cam-layout-save-focalpull-flags -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-focalpull-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s4-0 (res-lump-value arg2 'focalpull-flags uint128 :time -1000000000.0)) (s5-0 (method-of-type res-lump get-property-value)) @@ -1736,8 +1597,6 @@ (none) ) -;; definition for function cam-layout-save-campoints-flags -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-campoints-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s4-0 (res-lump-value arg2 'campoints-flags uint128 :time -1000000000.0)) (s5-0 (method-of-type res-lump get-property-value)) @@ -1792,8 +1651,6 @@ (none) ) -;; definition for function cam-layout-save-introsplinetime -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-introsplinetime ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f28-0 (res-lump-float arg2 'intro-time)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -1833,8 +1690,6 @@ (none) ) -;; definition for function cam-layout-save-introsplineexitval -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-introsplineexitval ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'intro-exitValue)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -1869,8 +1724,6 @@ (none) ) -;; definition for function cam-layout-save-interptime -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-interptime ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'interpTime)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -1902,8 +1755,6 @@ (none) ) -;; definition for function cam-layout-save-splineoffset -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-splineoffset ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (when (and (not (res-lump-struct arg2 'pivot structure)) (res-lump-struct arg2 'spline-offset structure)) (let ((s5-1 (res-lump-struct arg2 'spline-offset vector))) @@ -1924,8 +1775,6 @@ (none) ) -;; definition for function cam-layout-save-spline-follow-dist-offset -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-spline-follow-dist-offset ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'spline-follow-dist-offset))) (when (the int f30-0) @@ -1938,8 +1787,6 @@ (none) ) -;; definition for function cam-layout-save-campointsoffset -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-campointsoffset ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s5-0 (res-lump-struct arg2 'campoints-offset vector))) (when s5-0 @@ -1958,8 +1805,6 @@ (none) ) -;; definition for function cam-layout-save-tiltAdjust -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-tiltAdjust ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'tiltAdjust)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -1991,8 +1836,6 @@ (none) ) -;; definition for function cam-layout-save-stringMinLength -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-stringMinLength ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'stringMinLength)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -2024,8 +1867,6 @@ (none) ) -;; definition for function cam-layout-save-stringMaxLength -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-stringMaxLength ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'stringMaxLength)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -2057,8 +1898,6 @@ (none) ) -;; definition for function cam-layout-save-stringMinHeight -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-stringMinHeight ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'stringMinHeight)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -2090,8 +1929,6 @@ (none) ) -;; definition for function cam-layout-save-stringMaxHeight -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-stringMaxHeight ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'stringMaxHeight)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -2123,8 +1960,6 @@ (none) ) -;; definition for function cam-layout-save-stringCliffHeight -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-stringCliffHeight ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'stringCliffHeight)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -2156,8 +1991,6 @@ (none) ) -;; definition for function cam-layout-save-maxAngle -;; WARN: Return type mismatch object vs none. (defun cam-layout-save-maxAngle ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((f30-0 (res-lump-float arg2 'maxAngle)) (s3-0 (method-of-type res-lump get-property-value-float)) @@ -2189,7 +2022,6 @@ (none) ) -;; definition for function clmf-save-single (defbehavior clmf-save-single cam-layout ((arg0 entity-camera) (arg1 symbol) (arg2 symbol)) (clear *temp-string*) (if arg2 @@ -2230,7 +2062,6 @@ ) ) -;; definition for function clmf-save-one (defbehavior clmf-save-one cam-layout ((arg0 symbol)) (let ((s5-1 (logtest? (the-as int arg0) 8)) (gp-1 (logtest? (the-as int arg0) 16)) @@ -2249,7 +2080,6 @@ #t ) -;; definition for function clmf-save-all (defbehavior clmf-save-all cam-layout ((arg0 symbol)) (let ((s5-1 (logtest? (the-as int arg0) 8)) (gp-1 (logtest? (the-as int arg0) 16)) @@ -2280,7 +2110,6 @@ #t ) -;; definition of type clmf-cam-flag-toggle-info (deftype clmf-cam-flag-toggle-info (structure) ((key float :offset-assert 0) (force-on int32 :offset-assert 4) @@ -2291,7 +2120,6 @@ :flag-assert #x90000000c ) -;; definition for method 3 of type clmf-cam-flag-toggle-info (defmethod inspect clmf-cam-flag-toggle-info ((obj clmf-cam-flag-toggle-info)) (when (not obj) (set! obj obj) @@ -2305,7 +2133,6 @@ obj ) -;; definition for function clmf-cam-flag-toggle (defbehavior clmf-cam-flag-toggle cam-layout ((arg0 int) (arg1 int)) (let ((s4-0 (/ arg0 8)) (gp-0 (new 'stack 'clmf-cam-flag-toggle-info)) @@ -2429,7 +2256,6 @@ #t ) -;; definition for function clmf-cam-flag (defbehavior clmf-cam-flag cam-layout ((arg0 string) (arg1 uint) (arg2 uint)) (let ((s5-0 (/ (the-as int arg1) 8)) (f30-0 (-> self res-key)) @@ -2503,7 +2329,6 @@ #t ) -;; definition for function clmf-cam-float-adjust (defbehavior clmf-cam-float-adjust cam-layout ((arg0 symbol) (arg1 (pointer float))) (cam-layout-print 16 *camera-layout-message-ypos* "left stick adjusts value") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 14)) @@ -2529,7 +2354,6 @@ #t ) -;; definition for function clmf-cam-meters (defbehavior clmf-cam-meters cam-layout ((arg0 meters) (arg1 symbol)) (let ((f0-0 (cam-slave-get-float (-> self cam-entity) arg1 0.0))) (format arg0 ": ~M" f0-0) @@ -2537,19 +2361,16 @@ #t ) -;; definition for function clmf-cam-fov (defbehavior clmf-cam-fov cam-layout ((arg0 degrees) (arg1 symbol)) (format arg0 ": ~R" (cam-slave-get-fov (-> self cam-entity))) #t ) -;; definition for function clmf-cam-deg (defbehavior clmf-cam-deg cam-layout ((arg0 degrees) (arg1 symbol)) (format arg0 ": ~R" (cam-slave-get-float (-> self cam-entity) arg1 0.0)) #t ) -;; definition for function clmf-cam-intro-time (defbehavior clmf-cam-intro-time cam-layout ((arg0 float) (arg1 symbol)) (let ((f30-0 (cam-slave-get-intro-step (-> self cam-entity)))) (format arg0 ": ~f" (/ 0.016666668 f30-0)) @@ -2558,20 +2379,16 @@ #t ) -;; definition for function clmf-cam-interp-time (defbehavior clmf-cam-interp-time cam-layout ((arg0 float) (arg1 symbol)) (format arg0 ": ~f" (cam-slave-get-interp-time (-> self cam-entity))) #t ) -;; definition for function clmf-cam-float (defbehavior clmf-cam-float cam-layout ((arg0 float) (arg1 symbol)) (format arg0 ": ~f" (cam-slave-get-float (-> self cam-entity) arg1 0.0)) #t ) -;; definition for function clmf-cam-string -;; INFO: Used lq/sq (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) (local-vars (r0-0 uint128) (v1-5 uint128) (sv-16 int)) (format arg0 ":") @@ -2594,7 +2411,6 @@ #t ) -;; definition for symbol *clm-focalpull-attr*, type clm (define *clm-focalpull-attr* (new 'static 'clm :title "---focalpull attributes--" @@ -2649,7 +2465,6 @@ ) ) -;; definition for symbol *clm-index-attr*, type clm (define *clm-index-attr* (new 'static 'clm :title "---index attributes--" @@ -2704,7 +2519,6 @@ ) ) -;; definition for symbol *clm-intro-attr*, type clm (define *clm-intro-attr* (new 'static 'clm :title "---intro attributes--" @@ -2755,7 +2569,6 @@ ) ) -;; definition for symbol *clm-spline-attr*, type clm (define *clm-spline-attr* (new 'static 'clm :title "---spline attributes--" @@ -2792,7 +2605,6 @@ ) ) -;; definition for symbol *clm-cam-attr*, type clm (define *clm-cam-attr* (new 'static 'clm :title "---camera attributes--" @@ -3094,7 +2906,6 @@ ) ) -;; definition for symbol *clm-cam-lookthrough*, type clm (define *clm-cam-lookthrough* (new 'static 'clm :title "---cam-lookthrough---" @@ -3147,7 +2958,6 @@ ) ) -;; definition for symbol *clm-edit*, type clm (define *clm-edit* (new 'static 'clm :title "---edit---" @@ -3279,7 +3089,6 @@ ) ) -;; definition for symbol *clm-save-all*, type clm (define *clm-save-all* (new 'static 'clm :title "---save all?---" @@ -3303,7 +3112,6 @@ ) ) -;; definition for symbol *clm-save-one*, type clm (define *clm-save-one* (new 'static 'clm :title "---single save?---" @@ -3327,7 +3135,6 @@ ) ) -;; definition for symbol *clm-select*, type clm (define *clm-select* (new 'static 'clm :title "---camera---" @@ -3371,10 +3178,8 @@ ) ) -;; definition for symbol *clm*, type clm (define *clm* *clm-select*) -;; definition for function cam-layout-do-action (defbehavior cam-layout-do-action cam-layout ((arg0 clm-item-action)) (let ((s5-0 (-> arg0 func value))) (cond @@ -3419,7 +3224,6 @@ ) ) -;; definition for function cam-layout-function-call (defbehavior cam-layout-function-call cam-layout ((arg0 symbol) (arg1 string) (arg2 int) (arg3 basic)) (let ((gp-0 (-> arg0 value))) (cond @@ -3435,7 +3239,6 @@ #f ) -;; definition for function cam-layout-do-menu (defbehavior cam-layout-do-menu cam-layout ((arg0 clm)) (set! *camera-layout-message-ypos* 30) (+! (-> *CAM_LAYOUT-bank* spline-t) (-> *CAM_LAYOUT-bank* spline-step)) @@ -3581,7 +3384,6 @@ #f ) -;; failed to figure out what this is: (defstate cam-layout-active (cam-layout) :code (behavior () (until #f @@ -3594,7 +3396,6 @@ ) ) -;; definition for function cam-layout-init (defbehavior cam-layout-init cam-layout () (set! (-> self res-key) -1000000000.0) (set! (-> self num-entities) 0) @@ -3616,13 +3417,11 @@ (go cam-layout-active) ) -;; definition for function cam-layout-stop (defun cam-layout-stop () (set! *cam-layout* #f) (kill-by-name "cam-layout" *active-pool*) ) -;; definition for function cam-layout-start (defun cam-layout-start () (let ((a0-1 (new 'global 'file-stream "dd_next/caminfo/garbage" 'read))) (file-stream-close a0-1) @@ -3649,7 +3448,6 @@ *cam-layout* ) -;; definition for function cam-layout-restart (defun cam-layout-restart () (cam-layout-stop) (cam-layout-start) diff --git a/test/decompiler/reference/jak2/engine/debug/debug_REF.gc b/test/decompiler/reference/jak2/engine/debug/debug_REF.gc index bd38a5f7b2..183da01365 100644 --- a/test/decompiler/reference/jak2/engine/debug/debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/debug_REF.gc @@ -1,14 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition for function transform-float-point -;; ERROR: Bad vector register dependency: vf1 -;; ERROR: Bad vector register dependency: vf2 -;; ERROR: Bad vector register dependency: vf3 -;; ERROR: Bad vector register dependency: vf4 -;; ERROR: Bad vector register dependency: vf6 -;; ERROR: Bad vector register dependency: vf8 -;; ERROR: Bad vector register dependency: vf9 (defun transform-float-point ((in vector) (out vector4w)) (rlet ((acc :class vf) (Q :class vf) @@ -40,8 +31,6 @@ ) ) -;; definition (debug) for function add-debug-point -;; INFO: Used lq/sq (defun-debug add-debug-point ((enable-draw symbol) (bucket bucket-id) (pt vector)) (if (not enable-draw) (return #f) @@ -52,9 +41,9 @@ (set! (-> pt-copy quad) (-> pt quad)) (set! (-> pt-copy w) 1.0) (when (transform-point-qword! (the-as vector4w (-> s5-0 vector)) pt-copy) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) (let ((a0-5 (the-as (pointer uint64) (-> buf base)))) (let* ((a1-3 buf) (a3-0 (the-as dma-packet (-> a1-3 base))) @@ -144,31 +133,13 @@ ) ) ) - (let ((tag-end (-> buf base))) - (let ((a0-6 (the-as dma-packet (-> buf base)))) - (set! (-> a0-6 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> a0-6 vif0) (new 'static 'vif-tag)) - (set! (-> a0-6 vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer a0-6) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) ) #f ) -;; definition (debug) for function debug-line-clip? -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition (debug) for function internal-draw-debug-line -;; INFO: Used lq/sq (defun-debug internal-draw-debug-line ((bucket bucket-id) (start vector) (end vector) (start-color rgba) (mode symbol) (end-color rgba)) (local-vars (var-end vector) (sv-128 vector) (sv-144 vector)) (set! var-end end) @@ -206,9 +177,9 @@ (when (and (transform-point-qword! (the-as vector4w (-> s4-0 vector)) sv-128) (transform-point-qword! (-> s4-0 vector 1) sv-144) ) - (let* ((buf2 (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf2 base)) - ) + (with-dma-buffer-add-bucket ((buf2 (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) (let ((a0-28 (the-as (pointer uint64) (-> buf2 base)))) (let* ((a1-6 buf2) (pkt1 (the-as dma-packet (-> a1-6 base))) @@ -293,20 +264,6 @@ ) ) ) - (let ((tag-end (-> buf2 base))) - (let ((pkt2 (the-as dma-packet (-> buf2 base)))) - (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt2 vif0) (new 'static 'vif-tag)) - (set! (-> pkt2 vif1) (new 'static 'vif-tag)) - (set! (-> buf2 base) (&+ (the-as pointer pkt2) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) ) @@ -314,15 +271,13 @@ ) ) -;; definition (debug) for function internal-draw-debug-text-3d -;; INFO: Used lq/sq (defun-debug internal-draw-debug-text-3d ((bucket bucket-id) (text string) (position vector) (color font-color) (screen-offset vector2h)) (let ((screen-pos (new 'stack-no-clear 'vector4w))) (set! (-> screen-pos quad) (the-as uint128 0)) (when (transform-point-qword! screen-pos position) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) (let ((font-ctx (new 'stack 'font-context @@ -340,26 +295,11 @@ ) (draw-string text buf font-ctx) ) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) ) ) -;; definition (debug) for function add-debug-outline-triangle (defun-debug add-debug-outline-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) (when enable (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) @@ -369,7 +309,6 @@ #f ) -;; definition (debug) for function add-debug-triangle-normal (defun-debug add-debug-triangle-normal ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) (when enable (let ((s4-0 (new 'stack-no-clear 'vector)) @@ -386,8 +325,6 @@ #f ) -;; definition (debug) for function add-debug-flat-triangle -;; INFO: Used lq/sq (defun-debug add-debug-flat-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) (local-vars (sv-160 vector) (sv-176 vector)) (set! sv-160 p0) @@ -414,9 +351,9 @@ (transform-point-qword! (-> s5-0 vector 1) s2-0) (transform-point-qword! (-> s5-0 vector 2) s1-0) ) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) (let ((a0-12 (the-as (pointer uint64) (-> buf base)))) (let* ((a1-6 buf) (pkt1 (the-as dma-packet (-> a1-6 base))) @@ -478,20 +415,6 @@ ) ) ) - (let ((tag-end (-> buf base))) - (let ((pkt2 (the-as dma-packet (-> buf base)))) - (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt2 vif0) (new 'static 'vif-tag)) - (set! (-> pkt2 vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt2) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) ) @@ -499,9 +422,7 @@ #f ) -;; this part is debug only (when *debug-segment* -;; definition of type debug-line (deftype debug-line (structure) ((flags int32 :offset-assert 0) (bucket bucket-id :offset-assert 4) @@ -516,7 +437,6 @@ :flag-assert #x90000003c ) -;; definition for method 3 of type debug-line (defmethod inspect debug-line ((obj debug-line)) (when (not obj) (set! obj obj) @@ -534,7 +454,6 @@ obj ) -;; definition of type debug-text-3d (deftype debug-text-3d (structure) ((flags int32 :offset-assert 0) (bucket bucket-id :offset-assert 4) @@ -548,7 +467,6 @@ :flag-assert #x90000002c ) -;; definition for method 3 of type debug-text-3d (defmethod inspect debug-text-3d ((obj debug-text-3d)) (when (not obj) (set! obj obj) @@ -565,7 +483,6 @@ obj ) -;; definition of type debug-tracking-thang (deftype debug-tracking-thang (basic) ((length int32 :offset-assert 4) (allocated-length int32 :offset-assert 8) @@ -575,7 +492,6 @@ :flag-assert #x90000000c ) -;; definition for method 3 of type debug-tracking-thang (defmethod inspect debug-tracking-thang ((obj debug-tracking-thang)) (when (not obj) (set! obj obj) @@ -588,31 +504,23 @@ obj ) -;; definition for symbol *debug-lines*, type (inline-array debug-line) (define *debug-lines* (the-as (inline-array debug-line) (malloc 'debug #x100000))) -;; definition for symbol *debug-lines-trk*, type debug-tracking-thang (define *debug-lines-trk* (new 'debug 'debug-tracking-thang)) -;; failed to figure out what this is: (set! (-> *debug-lines-trk* allocated-length) #x4000) -;; definition for symbol *debug-text-3ds*, type (inline-array debug-text-3d) (define *debug-text-3ds* (the-as (inline-array debug-text-3d) (malloc 'debug #x6000))) -;; definition for symbol *debug-text-3d-trk*, type debug-tracking-thang (define *debug-text-3d-trk* (new 'debug 'debug-tracking-thang)) -;; failed to figure out what this is: (set! (-> *debug-text-3d-trk* allocated-length) 512) -;; failed to figure out what this is: (dotimes (gp-0 (-> *debug-text-3d-trk* allocated-length)) (set! (-> *debug-text-3ds* gp-0 str) (new 'debug 'string 80 (the-as string #f))) ) ) -;; definition (debug) for function get-debug-line (defun-debug get-debug-line () (cond ((< (-> *debug-lines-trk* length) (-> *debug-lines-trk* allocated-length)) @@ -625,7 +533,6 @@ ) ) -;; definition (debug) for function get-debug-text-3d (defun-debug get-debug-text-3d () (cond ((< (-> *debug-text-3d-trk* length) (-> *debug-text-3d-trk* allocated-length)) @@ -638,7 +545,6 @@ ) ) -;; definition (debug) for function debug-reset-buffers (defun-debug debug-reset-buffers () (set! (-> *debug-lines-trk* length) 0) (set! (-> *debug-text-3d-trk* length) 0) @@ -646,7 +552,6 @@ #f ) -;; definition (debug) for function debug-draw-buffers (defun-debug debug-draw-buffers () (dotimes (i (-> *debug-lines-trk* length)) (let ((line (-> *debug-lines* i))) @@ -674,8 +579,6 @@ #f ) -;; definition (debug) for function add-debug-line -;; INFO: Used lq/sq (defun-debug add-debug-line ((enable symbol) (bucket bucket-id) (start vector) @@ -706,102 +609,84 @@ #f ) -;; definition (debug) for function add-debug-line2d -;; INFO: Used lq/sq (defun-debug add-debug-line2d ((enable symbol) (bucket bucket-id) (start vector4w) (end vector4w) (color vector4w)) (if (not enable) (return #f) ) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) - (let ((p0 (new 'stack 'vector4w)) - (p1 (new 'stack 'vector4w)) - ) - (set! (-> p0 quad) (-> start quad)) - (set! (-> p1 quad) (-> end quad)) - (set! (-> p0 x) (the-as int (* (+ (-> p0 x) 2048) 16))) - (set! (-> p0 y) (* -16 (the-as int (- 2048 (the-as int (-> p0 y)))))) - (set! (-> p0 z) #x7fffff) - (set! (-> p1 x) (the-as int (* (+ (-> p1 x) 2048) 16))) - (set! (-> p1 y) (* -16 (the-as int (- 2048 (the-as int (-> p1 y)))))) - (set! (-> p1 z) #x7fffff) - (let ((a0-18 (the-as (pointer uint64) (-> buf base)))) - (let* ((a1-7 buf) - (a2-3 (the-as dma-packet (-> a1-7 base))) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) + (let ((p0 (new 'stack 'vector4w))) + (let ((p1 (new 'stack 'vector4w))) + (set! (-> p0 quad) (-> start quad)) + (set! (-> p1 quad) (-> end quad)) + (set! (-> p0 x) (the-as int (* (+ (-> p0 x) 2048) 16))) + (set! (-> p0 y) (* -16 (the-as int (- 2048 (the-as int (-> p0 y)))))) + (set! (-> p0 z) #x7fffff) + (set! (-> p1 x) (the-as int (* (+ (-> p1 x) 2048) 16))) + (set! (-> p1 y) (* -16 (the-as int (- 2048 (the-as int (-> p1 y)))))) + (set! (-> p1 z) #x7fffff) + (let ((a0-18 (the-as (pointer uint64) (-> buf base)))) + (let* ((a1-7 buf) + (a2-3 (the-as dma-packet (-> a1-7 base))) + ) + (set! (-> a2-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> a2-3 vif0) (new 'static 'vif-tag)) + (set! (-> a2-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a1-7 base) (&+ (the-as pointer a2-3) 16)) + ) + (let* ((a1-8 buf) + (giftag (the-as gs-gif-tag (-> a1-8 base))) + ) + (set! (-> giftag tag) (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) + :nreg #x4 + ) + ) + (set! (-> giftag regs) (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id xyzf2) + :regs2 (gif-reg-id rgbaq) + :regs3 (gif-reg-id xyzf2) + ) + ) + (set! (-> a1-8 base) (&+ (the-as pointer giftag) 16)) + ) + (let* ((a1-9 buf) + (v0 (the-as vector4w-2 (-> a1-9 base))) + ) + (set! (-> v0 vector 0 quad) (-> color quad)) + (set! (-> v0 vector 1 quad) (-> p0 quad)) + (set! (-> a1-9 base) (&+ (the-as pointer v0) 32)) + ) + (let* ((a1-10 buf) + (v1 (the-as vector4w-2 (-> a1-10 base))) + ) + (set! (-> v1 vector 0 quad) (-> color quad)) + (set! (-> v1 vector 1 quad) (-> p1 quad)) + (set! (-> a1-10 base) (&+ (the-as pointer v1) 32)) + ) + (let ((a1-14 (/ (the-as int (+ (- -16 (the-as int a0-18)) (the-as int (-> buf base)))) 16))) + (cond + ((nonzero? a1-14) + (logior! (-> a0-18 0) (shr (shl a1-14 48) 48)) + (logior! (-> a0-18 1) (shl (shr (shl a1-14 48) 48) 32)) ) - (set! (-> a2-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> a2-3 vif0) (new 'static 'vif-tag)) - (set! (-> a2-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) - (set! (-> a1-7 base) (&+ (the-as pointer a2-3) 16)) - ) - (let* ((a1-8 buf) - (giftag (the-as gs-gif-tag (-> a1-8 base))) - ) - (set! (-> giftag tag) (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) - :nreg #x4 - ) + (else + (set! (-> buf base) a0-18) ) - (set! (-> giftag regs) (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id xyzf2) - :regs2 (gif-reg-id rgbaq) - :regs3 (gif-reg-id xyzf2) - ) - ) - (set! (-> a1-8 base) (&+ (the-as pointer giftag) 16)) - ) - (let* ((a1-9 buf) - (v0 (the-as vector4w-2 (-> a1-9 base))) - ) - (set! (-> v0 vector 0 quad) (-> color quad)) - (set! (-> v0 vector 1 quad) (-> p0 quad)) - (set! (-> a1-9 base) (&+ (the-as pointer v0) 32)) - ) - (let* ((a1-10 buf) - (v1 (the-as vector4w-2 (-> a1-10 base))) - ) - (set! (-> v1 vector 0 quad) (-> color quad)) - (set! (-> v1 vector 1 quad) (-> p1 quad)) - (set! (-> a1-10 base) (&+ (the-as pointer v1) 32)) - ) - (let ((a1-14 (/ (the-as int (+ (- -16 (the-as int a0-18)) (the-as int (-> buf base)))) 16))) - (cond - ((nonzero? a1-14) - (logior! (-> a0-18 0) (shr (shl a1-14 48) 48)) - (logior! (-> a0-18 1) (shl (shr (shl a1-14 48) 48) 32)) - ) - (else - (set! (-> buf base) a0-18) ) ) ) ) ) - (let ((tag-end (-> buf base))) - (let ((v1-12 (the-as dma-packet (-> buf base)))) - (set! (-> v1-12 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-12 vif0) (new 'static 'vif-tag)) - (set! (-> v1-12 vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer v1-12) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) #f ) -;; definition (debug) for function add-debug-box -;; INFO: Used lq/sq (defun-debug add-debug-box ((enable symbol) (bucket bucket-id) (c1 vector) (c2 vector) (color rgba)) (let ((p0 (new-stack-vector0))) (set! (-> p0 quad) (-> c1 quad)) @@ -850,9 +735,6 @@ #f ) -;; definition (debug) for function add-debug-box-with-transform -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs symbol. (defun-debug add-debug-box-with-transform ((enable symbol) (bucket bucket-id) (box bounding-box) (trans matrix) (color rgba)) (b! (not enable) cfg-5 :delay (nop!)) (let ((points (new 'stack-no-clear 'inline-array 'vector 8))) @@ -888,8 +770,6 @@ (the-as symbol 0) ) -;; definition (debug) for function add-debug-x -;; INFO: Used lq/sq (defun-debug add-debug-x ((enable symbol) (bucket bucket-id) (position vector) (color rgba)) (if (not enable) (return #f) @@ -907,8 +787,6 @@ #f ) -;; definition (debug) for function add-debug-cross -;; INFO: Used lq/sq (defun-debug add-debug-cross ((enable symbol) (bucket bucket-id) (position vector) (radius float)) (if (not enable) (return #f) @@ -982,8 +860,6 @@ #f ) -;; definition (debug) for function add-debug-text-3d -;; INFO: Used lq/sq (defun-debug add-debug-text-3d ((enable symbol) (bucket bucket-id) (text string) @@ -1044,7 +920,6 @@ #f ) -;; definition (debug) for function add-debug-sphere-with-transform (defun-debug add-debug-sphere-with-transform ((enable symbol) (bucket bucket-id) (position vector) (radius meters) (trans matrix) (color rgba)) (rlet ((acc :class vf) (vf0 :class vf) @@ -1074,7 +949,6 @@ ) ) -;; definition (debug) for function add-debug-sphere (defun-debug add-debug-sphere ((enable symbol) (bucket bucket-id) (position vector) (radius meters) (color rgba)) (if enable (add-debug-sphere-from-table bucket position radius color 6) @@ -1082,14 +956,12 @@ #f ) -;; definition (debug) for function add-debug-text-sphere (defun-debug add-debug-text-sphere ((enable symbol) (bucket bucket-id) (position vector) (radius meters) (text string) (color rgba)) (add-debug-sphere enable bucket position radius color) (add-debug-text-3d enable bucket text position (font-color default-#cddbcd) (the-as vector2h #f)) #f ) -;; definition (debug) for function add-debug-spheres (defun-debug add-debug-spheres ((enable symbol) (bucket bucket-id) (origins (inline-array vector)) (count int) (color rgba)) (when enable (let ((origin (-> origins 0))) @@ -1102,23 +974,6 @@ #f ) -;; definition (debug) for function add-debug-line-sphere -;; INFO: Used lq/sq -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Return type mismatch int vs none. (defun-debug add-debug-line-sphere ((enable symbol) (bucket bucket-id) (position vector) (forward vector) (arg4 float) (color rgba)) (local-vars (var-bucket bucket-id) @@ -1194,8 +1049,6 @@ (none) ) -;; definition (debug) for function add-debug-circle -;; INFO: Used lq/sq (defun-debug add-debug-circle ((enable symbol) (bucket bucket-id) (position vector) (radius float) (color rgba) (orientation matrix)) "note: you may pass #f for orientation" (local-vars (i int) (sv-64 vector) (sv-80 vector)) @@ -1232,8 +1085,6 @@ #f ) -;; definition (debug) for function add-debug-vector -;; INFO: Used lq/sq (defun-debug add-debug-vector ((enable symbol) (bucket bucket-id) (position vector) (direction vector) (length meters) (color rgba)) (if (not enable) (return #f) @@ -1247,7 +1098,6 @@ #f ) -;; definition (debug) for function add-debug-matrix (defun-debug add-debug-matrix ((enable symbol) (bucket bucket-id) (mat matrix) (line-length meters)) (add-debug-vector enable @@ -1276,7 +1126,6 @@ mat ) -;; definition (debug) for function add-debug-rot-matrix (defun-debug add-debug-rot-matrix ((enable symbol) (bucket bucket-id) (mat matrix) (position vector)) (add-debug-vector enable @@ -1291,8 +1140,6 @@ mat ) -;; definition (debug) for function add-debug-quaternion -;; WARN: Return type mismatch int vs none. (defun-debug add-debug-quaternion ((enable symbol) (bucket bucket-id) (position vector) (quat quaternion)) (when enable (let ((mat (quaternion->matrix (new 'stack-no-clear 'matrix) quat))) @@ -1303,20 +1150,11 @@ (none) ) -;; definition (debug) for function add-debug-cspace (defun-debug add-debug-cspace ((enable symbol) (bucket bucket-id) (csp cspace)) (add-debug-matrix enable bucket (-> csp bone transform) (meters 2)) csp ) -;; definition (debug) for function add-debug-yrot-vector -;; INFO: Used lq/sq -;; WARN: Stack slot offset 32 signed mismatch -;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 -;; WARN: Stack slot offset 32 signed mismatch -;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 -;; WARN: Stack slot offset 32 signed mismatch -;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defun-debug add-debug-yrot-vector ((enable symbol) (bucket bucket-id) (position vector) (angle float) (line-length float) (color rgba)) (local-vars (var-angle float)) (set! var-angle angle) @@ -1340,8 +1178,6 @@ #f ) -;; definition (debug) for function add-debug-arc -;; INFO: Used lq/sq (defun-debug add-debug-arc ((enable symbol) (bucket bucket-id) (position vector) @@ -1395,8 +1231,6 @@ #f ) -;; definition (debug) for function add-debug-curve -;; INFO: Used lq/sq (defun-debug add-debug-curve ((enable symbol) (bucket bucket-id) (cverts (inline-array vector)) @@ -1425,7 +1259,6 @@ #f ) -;; definition (debug) for function add-debug-curve2 (defun-debug add-debug-curve2 ((enable symbol) (bucket bucket-id) (curve curve) (color rgba) (arg4 symbol)) (if enable (add-debug-curve @@ -1441,8 +1274,6 @@ #f ) -;; definition (debug) for function add-debug-points -;; INFO: Used lq/sq (defun-debug add-debug-points ((enable symbol) (bucket bucket-id) (points (inline-array vector)) @@ -1499,10 +1330,6 @@ #f ) -;; definition (debug) for function debug-percent-bar -;; INFO: Used lq/sq -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch (defun-debug debug-percent-bar ((enable symbol) (bucket bucket-id) (x int) (y int) (percentage float) (color rgba) (width int) (height int)) (local-vars (sv-16 int) (sv-32 float)) (set! sv-16 y) @@ -1514,32 +1341,16 @@ (if (not enable) (return #f) ) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + bucket + ) (draw-sprite2d-xy buf x sv-16 s1-0 s3-0 (new 'static 'rgba :a #x40)) (draw-sprite2d-xy buf x (+ sv-16 2) (the int (* sv-32 (the float s1-0))) (+ s3-0 -4) s2-0) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) #f ) -;; definition (debug) for function debug-pad-display -;; INFO: Used lq/sq (defun-debug debug-pad-display ((pad cpad-info)) (let ((stick-history (new 'static 'inline-array vector 32 (new 'static 'vector) @@ -1585,9 +1396,9 @@ (set! (-> stick-history 0 x) (* (sin (-> pad stick0-dir)) (-> pad stick0-speed))) (set! (-> stick-history 0 y) (* (cos (-> pad stick0-dir)) (-> pad stick0-speed))) (dotimes (j 32) - (let* ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug2) + ) (draw-sprite2d-xy buf (the int (* 120.0 (-> stick-history j x))) @@ -1596,28 +1407,12 @@ 10 (new 'static 'rgba :a #x80 :r (- 255 (* 7 j))) ) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug2) - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) ) #f ) -;; definition (debug) for function add-debug-light -;; INFO: Used lq/sq (defun-debug add-debug-light ((enable symbol) (bucket bucket-id) (light light) (position vector) (text string)) (rlet ((acc :class vf) (vf0 :class vf) @@ -1671,7 +1466,6 @@ ) ) -;; definition (debug) for function add-debug-lights (defun-debug add-debug-lights ((enable symbol) (bucket bucket-id) (lights (inline-array light)) (position vector)) (if (not enable) (return #f) @@ -1683,7 +1477,6 @@ #f ) -;; definition (debug) for function drawable-frag-count (defun-debug drawable-frag-count ((drbl drawable)) (let ((count 0)) (cond @@ -1702,8 +1495,6 @@ ) ) -;; definition for method 3 of type debug-vertex-stats -;; INFO: this function exists in multiple non-identical object files (defmethod inspect debug-vertex-stats ((obj debug-vertex-stats)) (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~Tlength: ~D~%" (-> obj length)) @@ -1734,15 +1525,12 @@ obj ) -;; definition (debug) for function history-init (defun-debug history-init ((history pos-history) (num-points int)) (set! (-> history num-points) num-points) (set! (-> history points) (the-as (inline-array vector) #f)) history ) -;; definition (debug) for function history-draw-and-update -;; INFO: Used lq/sq (defun-debug history-draw-and-update ((history pos-history) (draw symbol) (pos vector)) (if (and draw (not (-> history points))) (set! (-> history points) (the-as (inline-array vector) (malloc 'debug (* (-> history num-points) 16)))) @@ -1773,8 +1561,6 @@ #f ) -;; definition (debug) for function dma-timeout-cam -;; INFO: Used lq/sq (defun-debug dma-timeout-cam () (let ((pos (new-stack-vector0)) (rot (new-stack-matrix0)) @@ -1803,7 +1589,6 @@ ) ) -;; definition (debug) for function display-file-info (defun-debug display-file-info () (when (and *display-file-info* (!= *master-mode* 'menu)) (dotimes (i (-> *level* length)) @@ -1823,14 +1608,11 @@ 0 ) -;; definition (debug) for function add-debug-cursor -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun-debug add-debug-cursor ((enable symbol) (bucket bucket-id) (x int) (y int) (arg4 int)) (when enable - (let* ((buf (-> *display* frames (-> *display* on-screen) global-buf)) - (tag-start (-> buf base)) - ) + (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf)) + bucket + ) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) (let ((v1-7 arg4)) (draw-string-xy @@ -1855,37 +1637,17 @@ (font-flags shadow) ) ) - (let ((tag-end (-> buf base))) - (let ((pkt (the-as dma-packet (-> buf base)))) - (set! (-> pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt vif0) (new 'static 'vif-tag)) - (set! (-> pkt vif1) (new 'static 'vif-tag)) - (set! (-> buf base) (&+ (the-as pointer pkt) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - tag-start - (the-as (pointer dma-tag) tag-end) - ) - ) ) ) 0 (none) ) -;; this part is debug only (when *debug-segment* -;; definition for symbol *boundary-polygon*, type (inline-array sky-vertex) (define *boundary-polygon* (the-as (inline-array sky-vertex) (malloc 'debug 768))) ) -;; definition (debug) for function init-boundary-regs -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition (debug) for function add-boundary-shader -;; WARN: Return type mismatch pointer vs none. (defun-debug add-boundary-shader ((tex-id texture-id) (buf dma-buffer)) (let ((tex (lookup-texture-by-id tex-id))) (when tex @@ -1917,18 +1679,9 @@ (none) ) -;; definition (debug) for function draw-boundary-polygon -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition (debug) for function render-boundary-quad -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition (debug) for function render-boundary-tri -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition (debug) for function add-debug-bound-internal -;; INFO: Used lq/sq -;; WARN: Return type mismatch symbol vs none. (defun-debug add-debug-bound-internal ((buf dma-buffer) (pts (inline-array vector)) (num-pts int) (color0 rgba) (color1 rgba) (flip-tex int)) (rlet ((vf27 :class vf)) (set-vector! @@ -1991,10 +1744,6 @@ ) ) -;; definition (debug) for function add-debug-bound -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. -;; WARN: Function add-debug-bound has a return type of none, but the expression builder found a return statement. (defun-debug add-debug-bound ((buf bucket-id) (pts (inline-array vector)) (c0 int) (c1 rgba) (flash rgba) (arg5 int)) (local-vars (sv-16 pointer) (sv-32 int)) (set! sv-32 arg5) @@ -2010,41 +1759,41 @@ sv-32 ) ) - (let* ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (s5-0 (-> s4-0 base)) - ) - (let* ((v1-16 s4-0) - (a0-3 (the-as dma-packet (-> v1-16 base))) - ) - (set! (-> a0-3 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) - (set! (-> a0-3 vif0) (new 'static 'vif-tag)) - (set! (-> a0-3 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) - (set! (-> v1-16 base) (the-as pointer (the-as dma-packet (&+ a0-3 16)))) + (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + buf + ) + (let ((v1-16 s4-0)) + (let ((a0-3 (the-as dma-packet (-> v1-16 base)))) + (set! (-> a0-3 dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))) + (set! (-> a0-3 vif0) (new 'static 'vif-tag)) + (set! (-> a0-3 vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-16 base) (the-as pointer (the-as dma-packet (&+ a0-3 16)))) + ) ) - (let* ((v1-17 s4-0) - (a0-5 (the-as gs-gif-tag (-> v1-17 base))) - ) - (set! (-> a0-5 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) - (set! (-> a0-5 regs) GIF_REGS_ALL_AD) - (set! (-> v1-17 base) (the-as pointer (the-as gs-gif-tag (&+ a0-5 16)))) + (let ((v1-17 s4-0)) + (let ((a0-5 (the-as gs-gif-tag (-> v1-17 base)))) + (set! (-> a0-5 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3)) + (set! (-> a0-5 regs) GIF_REGS_ALL_AD) + (set! (-> v1-17 base) (the-as pointer (the-as gs-gif-tag (&+ a0-5 16)))) + ) ) - (let* ((v1-18 s4-0) - (a0-7 (-> v1-18 base)) - ) - (set! (-> (the-as (pointer gs-zbuf) a0-7) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) - (set! (-> (the-as (pointer gs-reg64) a0-7) 1) (gs-reg64 zbuf-1)) - (set! (-> (the-as (pointer gs-test) a0-7) 2) (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :zte #x1 - :ztst (gs-ztest greater-equal) - ) - ) - (set! (-> (the-as (pointer gs-reg64) a0-7) 3) (gs-reg64 test-1)) - (set! (-> (the-as (pointer gs-alpha) a0-7) 4) (new 'static 'gs-alpha :b #x1 :d #x1)) - (set! (-> (the-as (pointer gs-reg64) a0-7) 5) (gs-reg64 alpha-1)) - (set! (-> v1-18 base) (&+ a0-7 48)) + (let ((v1-18 s4-0)) + (let ((a0-7 (-> v1-18 base))) + (set! (-> (the-as (pointer gs-zbuf) a0-7) 0) (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (set! (-> (the-as (pointer gs-reg64) a0-7) 1) (gs-reg64 zbuf-1)) + (set! (-> (the-as (pointer gs-test) a0-7) 2) (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (set! (-> (the-as (pointer gs-reg64) a0-7) 3) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-alpha) a0-7) 4) (new 'static 'gs-alpha :b #x1 :d #x1)) + (set! (-> (the-as (pointer gs-reg64) a0-7) 5) (gs-reg64 alpha-1)) + (set! (-> v1-18 base) (&+ a0-7 48)) + ) ) (set! sv-16 (-> s4-0 base)) (&+! (-> s4-0 base) 16) @@ -2056,30 +1805,7 @@ (set! (-> (the-as dma-packet sv-16) vif0) (new 'static 'vif-tag)) (set! (-> (the-as dma-packet sv-16) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-25)) ) - (let ((a3-2 (-> s4-0 base))) - (let ((v1-29 (the-as dma-packet (-> s4-0 base)))) - (set! (-> v1-29 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-29 vif0) (new 'static 'vif-tag)) - (set! (-> v1-29 vif1) (new 'static 'vif-tag)) - (set! (-> s4-0 base) (the-as pointer (the-as dma-packet (&+ v1-29 16)))) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - buf - s5-0 - (the-as (pointer dma-tag) a3-2) - ) - ) ) 0 (none) ) - -;; definition (debug) for function cpu-delay -;; ERROR: function was not converted to expressions. Cannot decompile. - -;; definition (debug) for function qword-read-time -;; ERROR: function was not converted to expressions. Cannot decompile. - -;; definition (debug) for function bugfix? -;; ERROR: function was not converted to expressions. Cannot decompile. diff --git a/test/decompiler/reference/jak2/engine/debug/menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/menu_REF.gc index 674af1d75f..9742660b74 100644 --- a/test/decompiler/reference/jak2/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/menu_REF.gc @@ -1,10 +1,7 @@ -;;-*-Lisp-*- (in-package goal) -;; this file is debug only (declare-file (debug)) (when *debug-segment* -;; definition of type debug-menu-context (deftype debug-menu-context (basic) ((is-active symbol :offset-assert 4) (sel-length int32 :offset-assert 8) @@ -24,7 +21,6 @@ ) ) -;; definition for method 3 of type debug-menu-context (defmethod inspect debug-menu-context ((obj debug-menu-context)) (when (not obj) (set! obj obj) @@ -44,7 +40,6 @@ obj ) -;; definition for method 0 of type debug-menu-context (defmethod new debug-menu-context ((allocation symbol) (type-to-make type)) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> gp-0 is-active) #f) @@ -69,7 +64,6 @@ ) ) -;; definition of type debug-menu-node (deftype debug-menu-node (basic) ((name string :offset-assert 4) (parent debug-menu :offset-assert 8) @@ -81,7 +75,6 @@ :flag-assert #x900000014 ) -;; definition for method 3 of type debug-menu-node (defmethod inspect debug-menu-node ((obj debug-menu-node)) (when (not obj) (set! obj obj) @@ -96,13 +89,11 @@ obj ) -;; definition for method 2 of type debug-menu-node (defmethod print debug-menu-node ((obj debug-menu-node)) (format #t "#<~A ~A @ #x~X>" (-> obj type) (-> obj name) obj) obj ) -;; definition of type debug-menu (deftype debug-menu (debug-menu-node) ((context debug-menu-context :offset-assert 20) (selected-item debug-menu-item :offset-assert 24) @@ -118,7 +109,6 @@ ) ) -;; definition for method 3 of type debug-menu (defmethod inspect debug-menu ((obj debug-menu)) (when (not obj) (set! obj obj) @@ -138,7 +128,6 @@ obj ) -;; definition for method 0 of type debug-menu (defmethod new debug-menu ((allocation symbol) (type-to-make type) (arg0 debug-menu-context) (arg1 string)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> v0-0 context) arg0) @@ -150,7 +139,6 @@ ) ) -;; definition of type debug-menu-item (deftype debug-menu-item (debug-menu-node) ((id int32 :offset-assert 20) ) @@ -159,7 +147,6 @@ :flag-assert #x900000018 ) -;; definition for method 3 of type debug-menu-item (defmethod inspect debug-menu-item ((obj debug-menu-item)) (when (not obj) (set! obj obj) @@ -175,7 +162,6 @@ obj ) -;; definition of type debug-menu-item-submenu (deftype debug-menu-item-submenu (debug-menu-item) ((submenu debug-menu :offset-assert 24) ) @@ -187,7 +173,6 @@ ) ) -;; definition for method 3 of type debug-menu-item-submenu (defmethod inspect debug-menu-item-submenu ((obj debug-menu-item-submenu)) (when (not obj) (set! obj obj) @@ -204,7 +189,6 @@ obj ) -;; definition for method 0 of type debug-menu-item-submenu (defmethod new debug-menu-item-submenu ((allocation symbol) (type-to-make type) (arg0 string) (arg1 debug-menu)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> v0-0 name) arg0) @@ -217,7 +201,6 @@ ) ) -;; definition of type debug-menu-item-function (deftype debug-menu-item-function (debug-menu-item) ((activate-func (function object object) :offset-assert 24) (hilite-timer int8 :offset-assert 28) @@ -230,7 +213,6 @@ ) ) -;; definition for method 3 of type debug-menu-item-function (defmethod inspect debug-menu-item-function ((obj debug-menu-item-function)) (when (not obj) (set! obj obj) @@ -248,7 +230,6 @@ obj ) -;; definition for method 0 of type debug-menu-item-function (defmethod new debug-menu-item-function ((allocation symbol) (type-to-make type) (arg0 string) (arg1 object) (arg2 (function object object))) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> v0-0 name) arg0) @@ -262,7 +243,6 @@ ) ) -;; definition of type debug-menu-item-flag (deftype debug-menu-item-flag (debug-menu-item) ((activate-func (function object debug-menu-msg object) :offset-assert 24) (is-on object :offset-assert 28) @@ -275,7 +255,6 @@ ) ) -;; definition for method 3 of type debug-menu-item-flag (defmethod inspect debug-menu-item-flag ((obj debug-menu-item-flag)) (when (not obj) (set! obj obj) @@ -293,7 +272,6 @@ obj ) -;; definition for method 0 of type debug-menu-item-flag (defmethod new debug-menu-item-flag ((allocation symbol) (type-to-make type) (arg0 string) @@ -312,7 +290,6 @@ ) ) -;; definition of type debug-menu-item-var (deftype debug-menu-item-var (debug-menu-item) ((display-str string :offset-assert 24) (grabbed-joypad-p symbol :offset-assert 28) @@ -349,7 +326,6 @@ ) ) -;; definition for method 3 of type debug-menu-item-var (defmethod inspect debug-menu-item-var ((obj debug-menu-item-var)) (when (not obj) (set! obj obj) @@ -391,7 +367,6 @@ obj ) -;; definition for function debug-menu-item-var-update-display-str (defun debug-menu-item-var-update-display-str ((arg0 debug-menu-item-var)) (cond ((-> arg0 float-p) @@ -430,7 +405,6 @@ arg0 ) -;; definition for function debug-menu-item-var-make-int (defun debug-menu-item-var-make-int ((arg0 debug-menu-item-var) (arg1 (function int debug-menu-msg int int int)) (arg2 int) @@ -468,7 +442,6 @@ arg0 ) -;; definition for function debug-menu-item-var-make-float (defun debug-menu-item-var-make-float ((arg0 debug-menu-item-var) (arg1 (function int debug-menu-msg float float float)) (arg2 float) @@ -498,7 +471,6 @@ arg0 ) -;; definition for method 0 of type debug-menu-item-var (defmethod new debug-menu-item-var ((allocation symbol) (type-to-make type) (arg0 string) (arg1 int) (arg2 int)) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (let ((v1-2 (/ arg2 8))) @@ -527,7 +499,6 @@ ) ) -;; definition for function debug-menu-context-grab-joypad (defun debug-menu-context-grab-joypad ((arg0 debug-menu-context) (arg1 basic) (arg2 (function basic none))) (cond ((-> arg0 joypad-func) @@ -541,14 +512,12 @@ ) ) -;; definition for function debug-menu-context-release-joypad (defun debug-menu-context-release-joypad ((arg0 debug-menu-context)) (set! (-> arg0 joypad-func) #f) (set! (-> arg0 joypad-item) #f) #f ) -;; definition for function debug-menu-item-get-max-width (defun debug-menu-item-get-max-width ((arg0 debug-menu-item) (arg1 debug-menu)) (local-vars (v0-1 int)) 0 @@ -585,7 +554,6 @@ v0-1 ) -;; definition for function debug-menu-context-default-selection (defun debug-menu-context-default-selection ((arg0 debug-menu-context) (arg1 symbol)) (when (or (zero? (-> arg0 sel-length)) (not arg1)) (let ((s5-0 (-> arg0 root-menu))) @@ -607,7 +575,6 @@ arg0 ) -;; definition for function debug-menu-rebuild (defun debug-menu-rebuild ((arg0 debug-menu)) (let ((s4-0 0) (s5-0 0) @@ -632,7 +599,6 @@ arg0 ) -;; definition for function debug-menu-context-set-root-menu (defun debug-menu-context-set-root-menu ((arg0 debug-menu-context) (arg1 debug-menu)) (let ((s4-0 (-> arg0 is-active))) (if s4-0 @@ -647,7 +613,6 @@ arg0 ) -;; definition for function debug-menu-append-item (defun debug-menu-append-item ((arg0 debug-menu) (arg1 debug-menu-node)) (let* ((gp-0 (-> arg0 context)) (s4-0 (-> gp-0 is-active)) @@ -665,7 +630,6 @@ arg1 ) -;; definition for function debug-menu-remove-all-items (defun debug-menu-remove-all-items ((arg0 debug-menu)) (let* ((gp-0 (-> arg0 context)) (s4-0 (-> gp-0 is-active)) @@ -683,9 +647,6 @@ arg0 ) -;; definition for function debug-menu-func-decode -;; WARN: Return type mismatch object vs function. -;; WARN: Using new Jak 2 rtype-of (defun debug-menu-func-decode ((arg0 object)) (let ((v1-2 (rtype-of arg0))) (the-as function (cond @@ -703,16 +664,6 @@ ) ) -;; definition for function debug-menu-make-from-template -;; INFO: Used lq/sq -;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 -;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 -;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 -;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 -;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 -;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 -;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 -;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 (defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair)) (local-vars (s4-0 debug-menu-node) @@ -888,8 +839,6 @@ s4-0 ) -;; definition for function debug-menu-find-from-template -;; WARN: Return type mismatch object vs debug-menu. (defun debug-menu-find-from-template ((arg0 debug-menu-context) (arg1 pair)) (let ((s5-0 (the-as object (-> arg0 root-menu)))) (while (begin (label cfg-12) (and s5-0 (type? s5-0 debug-menu) (not (null? arg1)))) @@ -919,7 +868,6 @@ ) ) -;; definition for function debug-menu-item-submenu-render (defun debug-menu-item-submenu-render ((arg0 debug-menu-item-submenu) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) (let ((s5-0 (-> arg0 parent context font))) (let ((v1-2 s5-0) @@ -940,31 +888,16 @@ ) ) ) - (let* ((s3-0 (-> *display* frames (-> *display* on-screen) debug-buf)) - (s4-0 (-> s3-0 base)) - ) + (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug3) + ) (draw-string-adv (-> arg0 name) s3-0 s5-0) (draw-string-adv "..." s3-0 s5-0) - (let ((a3-1 (-> s3-0 base))) - (let ((v1-9 (the-as object (-> s3-0 base)))) - (set! (-> (the-as dma-packet v1-9) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-9) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-9) vif1) (new 'static 'vif-tag)) - (set! (-> s3-0 base) (&+ (the-as pointer v1-9) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug3) - s4-0 - (the-as (pointer dma-tag) a3-1) - ) - ) ) ) arg0 ) -;; definition for function debug-menu-item-function-render (defun debug-menu-item-function-render ((arg0 debug-menu-item-function) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) (let ((v1-2 (-> arg0 parent context font))) (let ((a0-1 v1-2) @@ -991,30 +924,15 @@ ) ) ) - (let* ((s4-0 (-> *display* frames (-> *display* on-screen) debug-buf)) - (s5-0 (-> s4-0 base)) - ) + (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug3) + ) (draw-string (-> arg0 name) s4-0 v1-2) - (let ((a3-1 (-> s4-0 base))) - (let ((v1-3 (the-as object (-> s4-0 base)))) - (set! (-> (the-as dma-packet v1-3) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-3) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-3) vif1) (new 'static 'vif-tag)) - (set! (-> s4-0 base) (&+ (the-as pointer v1-3) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug3) - s5-0 - (the-as (pointer dma-tag) a3-1) - ) - ) ) ) arg0 ) -;; definition for function debug-menu-item-flag-render (defun debug-menu-item-flag-render ((arg0 debug-menu-item-flag) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) (let ((v1-2 (-> arg0 parent context font))) (let ((a0-1 v1-2) @@ -1041,30 +959,15 @@ ) ) ) - (let* ((s4-0 (-> *display* frames (-> *display* on-screen) debug-buf)) - (s5-0 (-> s4-0 base)) - ) + (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug3) + ) (draw-string (-> arg0 name) s4-0 v1-2) - (let ((a3-1 (-> s4-0 base))) - (let ((v1-3 (the-as object (-> s4-0 base)))) - (set! (-> (the-as dma-packet v1-3) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-3) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-3) vif1) (new 'static 'vif-tag)) - (set! (-> s4-0 base) (&+ (the-as pointer v1-3) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug3) - s5-0 - (the-as (pointer dma-tag) a3-1) - ) - ) ) ) arg0 ) -;; definition for function debug-menu-item-var-render (defun debug-menu-item-var-render ((arg0 debug-menu-item-var) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) (let ((s5-0 (-> arg0 parent context font))) (let ((v1-2 s5-0) @@ -1088,9 +991,9 @@ ) ) ) - (let* ((s1-0 (-> *display* frames (-> *display* on-screen) debug-buf)) - (s4-0 (-> s1-0 base)) - ) + (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug3) + ) (draw-string-adv (-> arg0 name) s1-0 s5-0) (draw-string-adv ":" s1-0 s5-0) (cond @@ -1114,26 +1017,11 @@ ) ) ) - (let ((a3-1 (-> s1-0 base))) - (let ((v1-16 (the-as object (-> s1-0 base)))) - (set! (-> (the-as dma-packet v1-16) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-16) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-16) vif1) (new 'static 'vif-tag)) - (set! (-> s1-0 base) (the-as pointer (&+ (the-as dma-packet v1-16) 16))) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug3) - s4-0 - (the-as (pointer dma-tag) a3-1) - ) - ) ) ) arg0 ) -;; definition for function debug-menu-item-render (defun debug-menu-item-render ((arg0 debug-menu-item) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) (when (> (-> arg0 refresh-delay) 0) (+! (-> arg0 refresh-ctr) -1) @@ -1162,8 +1050,6 @@ arg0 ) -;; definition for function debug-menu-render -;; INFO: Used lq/sq (defun debug-menu-render ((arg0 debug-menu) (arg1 int) (arg2 int) (arg3 debug-menu-node) (arg4 int)) (local-vars (sv-16 dma-buffer) (sv-32 pointer)) (let ((v1-0 0)) @@ -1184,24 +1070,10 @@ (set! arg2 (- arg2 (* 15 (+ v1-0 -16)))) ) ) - (let* ((s0-0 (-> *display* frames (-> *display* on-screen) debug-buf)) - (s1-0 (-> s0-0 base)) - ) + (with-dma-buffer-add-bucket ((s0-0 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug3) + ) (draw-sprite2d-xy s0-0 arg1 arg2 (-> arg0 pix-width) (-> arg0 pix-height) (new 'static 'rgba :a #x40)) - (let ((a3-2 (-> s0-0 base))) - (let ((v1-9 (the-as object (-> s0-0 base)))) - (set! (-> (the-as dma-packet v1-9) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-9) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-9) vif1) (new 'static 'vif-tag)) - (set! (-> s0-0 base) (&+ (the-as pointer v1-9) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug3) - s1-0 - (the-as (pointer dma-tag) a3-2) - ) - ) ) (let* ((s3-1 (+ arg1 3)) (s2-1 (+ arg2 5)) @@ -1249,7 +1121,6 @@ arg0 ) -;; definition for function debug-menu-context-render (defun debug-menu-context-render ((arg0 debug-menu-context)) (let ((s4-0 6)) (dotimes (s5-0 (-> arg0 sel-length)) @@ -1264,7 +1135,6 @@ arg0 ) -;; definition for function debug-menu-context-select-next-or-prev-item (defun debug-menu-context-select-next-or-prev-item ((arg0 debug-menu-context) (arg1 int)) (local-vars (v1-6 object)) (let ((s5-0 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1)))) @@ -1309,7 +1179,6 @@ arg0 ) -;; definition for function debug-menu-context-select-new-item (defun debug-menu-context-select-new-item ((arg0 debug-menu-context) (arg1 int)) (let* ((a2-0 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1))) (a1-1 (-> a2-0 selected-item)) @@ -1363,7 +1232,6 @@ arg0 ) -;; definition for function debug-menu-context-open-submenu (defun debug-menu-context-open-submenu ((arg0 debug-menu-context) (arg1 debug-menu)) (let ((v1-0 (-> arg0 sel-length))) (when (>= v1-0 8) @@ -1383,7 +1251,6 @@ (debug-menu-context-send-msg arg0 (debug-menu-msg activate) (debug-menu-dest current-selection)) ) -;; definition for function debug-menu-context-close-submenu (defun debug-menu-context-close-submenu ((arg0 debug-menu-context)) (debug-menu-context-send-msg arg0 (debug-menu-msg deactivate) (debug-menu-dest current-selection)) (if (< 1 (-> arg0 sel-length)) @@ -1392,7 +1259,6 @@ arg0 ) -;; definition for function debug-menu-item-submenu-msg (defun debug-menu-item-submenu-msg ((arg0 debug-menu-item-submenu) (arg1 debug-menu-msg)) (when (= arg1 (debug-menu-msg press)) (let ((a0-1 (-> arg0 parent context))) @@ -1402,7 +1268,6 @@ arg0 ) -;; definition for function debug-menu-item-function-msg (defun debug-menu-item-function-msg ((arg0 debug-menu-item-function) (arg1 debug-menu-msg)) (cond ((= arg1 (debug-menu-msg press)) @@ -1426,7 +1291,6 @@ arg0 ) -;; definition for function debug-menu-item-flag-msg (defun debug-menu-item-flag-msg ((arg0 debug-menu-item-flag) (arg1 debug-menu-msg)) (cond ((= arg1 (debug-menu-msg press)) @@ -1447,7 +1311,6 @@ arg0 ) -;; definition for function debug-menu-item-var-joypad-handler (defun debug-menu-item-var-joypad-handler ((arg0 debug-menu-item-var) (arg1 debug-menu-msg)) (cond ((not (cpad-hold? arg1 x)) @@ -1574,7 +1437,6 @@ arg0 ) -;; definition for function debug-menu-item-var-msg (defun debug-menu-item-var-msg ((arg0 debug-menu-item-var) (arg1 debug-menu-msg)) (cond ((= arg1 (debug-menu-msg deactivate)) @@ -1622,7 +1484,6 @@ arg0 ) -;; definition for function debug-menu-item-send-msg (defun debug-menu-item-send-msg ((arg0 debug-menu-item) (arg1 debug-menu-msg)) (cond ((= (-> arg0 type) debug-menu-item-submenu) @@ -1644,7 +1505,6 @@ arg0 ) -;; definition for function debug-menu-send-msg (defun debug-menu-send-msg ((arg0 debug-menu) (arg1 debug-menu-msg) (arg2 symbol)) (let* ((s3-0 (-> arg0 items)) (s2-0 (car s3-0)) @@ -1661,7 +1521,6 @@ arg0 ) -;; definition for function debug-menu-context-send-msg (defun debug-menu-context-send-msg ((arg0 debug-menu-context) (arg1 debug-menu-msg) (arg2 debug-menu-dest)) (cond ((= arg2 (debug-menu-dest root)) @@ -1703,7 +1562,6 @@ arg0 ) -;; definition for function debug-menu-context-activate-selection (defun debug-menu-context-activate-selection ((arg0 debug-menu-context)) (let ((a0-1 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1) selected-item))) (debug-menu-item-send-msg a0-1 (debug-menu-msg press)) @@ -1711,7 +1569,6 @@ arg0 ) -;; definition for function debug-menus-default-joypad-func (defun debug-menus-default-joypad-func ((arg0 debug-menu-context)) (cond ((cpad-pressed? (-> arg0 joypad-number) square) @@ -1742,7 +1599,6 @@ arg0 ) -;; definition for function debug-menus-active (defun debug-menus-active ((arg0 debug-menu-context)) (when (not (-> arg0 is-hidden)) (cond @@ -1763,7 +1619,6 @@ arg0 ) -;; definition for function debug-menus-handler (defun debug-menus-handler ((arg0 debug-menu-context)) (if (-> arg0 is-active) (debug-menus-active arg0) @@ -1771,7 +1626,6 @@ arg0 ) -;; failed to figure out what this is: 0 ) diff --git a/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc index c86525e926..3ab2009af9 100644 --- a/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc @@ -1,9 +1,7 @@ -;;-*-Lisp-*- (in-package goal) (local-vars (gp-0 game-info)) -;; definition of type game-bank (deftype game-bank (basic) ((life-max-default float :offset-assert 4) (life-start-default float :offset-assert 8) @@ -16,7 +14,6 @@ :flag-assert #x900000018 ) -;; definition for method 3 of type game-bank (defmethod inspect game-bank ((obj game-bank)) (when (not obj) (set! obj obj) @@ -32,7 +29,6 @@ obj ) -;; definition for symbol *GAME-bank*, type game-bank (define *GAME-bank* (new 'static 'game-bank :life-max-default 99.0 :life-start-default 5.0 @@ -42,7 +38,6 @@ ) ) -;; definition of type actor-id (deftype actor-id (uint32) () :method-count-assert 9 @@ -50,7 +45,6 @@ :flag-assert #x900000004 ) -;; definition of type highscore-info (deftype highscore-info (structure) ((flags highscore-flags :offset-assert 0) (award-scores float 3 :offset-assert 4) @@ -66,7 +60,6 @@ ) ) -;; definition for method 3 of type highscore-info (defmethod inspect highscore-info ((obj highscore-info)) (when (not obj) (set! obj obj) @@ -82,7 +75,6 @@ obj ) -;; definition of type level-buffer-state (deftype level-buffer-state (structure) ((name symbol :offset-assert 0) (display? symbol :offset-assert 4) @@ -95,7 +87,6 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type level-buffer-state (defmethod inspect level-buffer-state ((obj level-buffer-state)) (when (not obj) (set! obj obj) @@ -110,7 +101,6 @@ obj ) -;; definition of type load-state (deftype load-state (basic) ((want level-buffer-state 6 :inline :offset-assert 4) (want-sound symbol 3 :offset-assert 100) @@ -140,7 +130,6 @@ ) ) -;; definition for method 3 of type load-state (defmethod inspect load-state ((obj load-state)) (when (not obj) (set! obj obj) @@ -163,12 +152,10 @@ obj ) -;; definition for method 0 of type load-state (defmethod new load-state ((allocation symbol) (type-to-make type)) (reset! (object-new allocation type-to-make (the-as int (-> type-to-make size)))) ) -;; definition of type continue-point (deftype continue-point (basic) ((name string :offset-assert 4) (level symbol :offset-assert 8) @@ -192,7 +179,6 @@ ) ) -;; definition for method 3 of type continue-point (defmethod inspect continue-point ((obj continue-point)) (when (not obj) (set! obj obj) @@ -220,7 +206,6 @@ obj ) -;; definition of type game-info (deftype game-info (basic) ((mode symbol :offset-assert 4) (save-name string :offset-assert 8) @@ -332,13 +317,13 @@ (task-perm-by-index (_type_ int) entity-perm 15) (copy-perms-from-level! (_type_ level) int 16) (copy-perms-to-level! (_type_ level) int 17) - (game-info-method-18 (_type_ symbol) _type_ 18) + (debug-inspect (_type_ symbol) _type_ 18) (get-current-continue-forced (_type_) continue-point 19) (get-continue-by-name (_type_ string) continue-point 20) (set-continue! (_type_ basic symbol) continue-point 21) (game-info-method-22 (_type_) int 22) - (game-info-method-23 (_type_ game-save string) int 23) - (game-info-method-24 (_type_ game-save) none 24) + (save-game (_type_ game-save string) game-save 23) + (load-game (_type_ game-save) game-save 24) (you-suck-stage (_type_ symbol) int 25) (you-suck-scale (_type_ object) float 26) (get-next-attack-id (_type_) uint 27) @@ -348,7 +333,6 @@ ) ) -;; definition for method 3 of type game-info (defmethod inspect game-info ((obj game-info)) (when (not obj) (set! obj obj) @@ -445,7 +429,6 @@ obj ) -;; definition for method 27 of type game-info (defmethod get-next-attack-id game-info ((obj game-info)) (let ((v0-0 (+ (-> obj attack-id) 1))) (set! (-> obj attack-id) v0-0) @@ -453,7 +436,6 @@ ) ) -;; failed to figure out what this is: (set! gp-0 (when (or (not *game-info*) (zero? *game-info*)) (set! gp-0 (new 'static 'game-info :mode 'debug :current-continue #f :last-continue #f)) diff --git a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc index bf6f5c0266..1a73c24c87 100644 --- a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc @@ -1,7 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition for method 9 of type border-plane (defmethod debug-draw border-plane ((obj border-plane)) (let* ((v1-0 (-> obj action)) (plane-color (if (= v1-0 'load) @@ -30,17 +28,14 @@ 0 ) -;; definition for method 10 of type border-plane (defmethod point-past-plane? border-plane ((obj border-plane) (arg0 vector)) (>= (vector-dot (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)) (-> obj normal)) 0.0) ) -;; definition for method 11 of type game-info (defmethod task-complete? game-info ((obj game-info) (arg0 game-task)) (logtest? (-> obj task-perm-list data arg0 status) (entity-perm-status complete)) ) -;; definition for method 12 of type game-info (defmethod subtask-index-by-name game-info ((obj game-info) (arg0 string)) (let ((subtasks (-> *game-info* sub-task-list))) (dotimes (i (-> subtasks length)) @@ -56,7 +51,6 @@ 0 ) -;; definition for method 13 of type game-info (defmethod set-subtask-hook! game-info ((obj game-info) (arg0 int) (arg1 int) (arg2 function)) (let ((subtask (-> obj sub-task-list arg0))) (if (and subtask (-> subtask info)) @@ -66,7 +60,6 @@ arg2 ) -;; definition for symbol *default-continue*, type continue-point (define *default-continue* (new 'static 'continue-point :name "default" @@ -89,8 +82,6 @@ ) ) -;; definition for method 10 of type continue-point -;; INFO: Used lq/sq (defmethod continue-point-method-10 continue-point ((obj continue-point) (arg0 load-state)) (let ((v1-0 (lookup-level-info (-> obj vis-nick)))) (set! (-> obj vis-nick) (if v1-0 @@ -124,9 +115,6 @@ obj ) -;; definition for method 11 of type continue-point -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defmethod move-camera! continue-point ((obj continue-point)) (set! (-> *camera-combiner* trans quad) (-> obj camera-trans quad)) (let ((gp-0 (-> *camera-combiner* inv-camera-rot)) @@ -149,7 +137,6 @@ (none) ) -;; definition for method 19 of type game-info (defmethod get-current-continue-forced game-info ((obj game-info)) (cond ((and (= (-> obj mode) 'play) (-> obj current-continue)) @@ -166,7 +153,6 @@ ) ) -;; definition for method 20 of type game-info (defmethod get-continue-by-name game-info ((obj game-info) (arg0 string)) (if (not arg0) (return (the-as continue-point #f)) @@ -189,8 +175,6 @@ (the-as continue-point #f) ) -;; definition for method 21 of type game-info -;; WARN: Using new Jak 2 rtype-of (defmethod set-continue! game-info ((obj game-info) (arg0 basic) (arg1 symbol)) (let ((s5-0 (-> obj current-continue))) (if (null? arg0) @@ -240,12 +224,10 @@ (-> obj current-continue) ) -;; definition for method 15 of type game-info (defmethod task-perm-by-index game-info ((obj game-info) (arg0 int)) (-> obj task-perm-list data arg0) ) -;; definition for method 30 of type game-info (defmethod calculate-percentage game-info ((obj game-info)) (let ((story-total 0) (story-complete 0) @@ -282,12 +264,10 @@ ) ) -;; definition for function task-level->string (defun task-level->string ((arg0 int)) (symbol->string (-> *task-level* arg0)) ) -;; definition for function level-name->task-level (defun level-name->task-level ((arg0 symbol)) (let ((v1-0 (lookup-level-info arg0))) (if v1-0 @@ -297,10 +277,6 @@ ) ) -;; definition for method 9 of type game-info -;; INFO: Used lq/sq -;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 512] -;; ERROR: Expression building failed: In (method 9 game-info): Expression pass could not find the set-to-run function. Found t9-31 instead. Make sure there are no casts on this function. (defmethod initialize! game-info ((obj game-info) (arg0 symbol) (arg1 game-save) (arg2 string)) (local-vars (v0-17 none) @@ -380,7 +356,7 @@ ((= v1-135 'debug) (reset-actors arg0) (if arg1 - (game-info-method-24 obj arg1) + (load-game obj arg1) ) ) ((= v1-135 'play) @@ -410,7 +386,7 @@ (close! (-> *game-info* sub-task-list 1) 'event) (set-continue! *game-info* arg2 #f) (when arg3 - (game-info-method-24 *game-info* arg3) + (load-game *game-info* arg3) (set! arg2 (get-current-continue-forced *game-info*)) (reset-actors 'life) (send-event (handle->process (-> *game-info* auto-save-proc)) 'done) @@ -453,7 +429,6 @@ (ret-value v0-32) ) -;; definition for method 10 of type game-info (defmethod give game-info ((obj game-info) (arg0 symbol) (arg1 float) (arg2 handle)) (local-vars (ammo-max float)) (with-pp @@ -629,13 +604,10 @@ ) ) -;; definition for method 22 of type game-info (defmethod game-info-method-22 game-info ((obj game-info)) 0 ) -;; definition for method 10 of type fact-info-target -;; WARN: Return type mismatch float vs none. (defmethod reset! fact-info-target ((obj fact-info-target) (arg0 symbol)) (when (or (not arg0) (= arg0 'eco)) (set! (-> obj eco-timeout) 0) @@ -667,7 +639,6 @@ (none) ) -;; definition for method 11 of type fact-info-target (defmethod pickup-collectable! fact-info-target ((obj fact-info-target) (arg0 pickup-type) (arg1 float) (arg2 handle)) (case arg0 (((pickup-type health) (pickup-type eco-green)) @@ -1012,7 +983,6 @@ ) ) -;; definition for method 14 of type game-info (defmethod actor-perm game-info ((obj game-info) (arg0 actor-id)) (let ((game-perms (-> obj perm-list))) (countdown (i (-> game-perms length)) @@ -1024,8 +994,6 @@ (the-as entity-perm #f) ) -;; definition for method 16 of type game-info -;; INFO: Used lq/sq (defmethod copy-perms-from-level! game-info ((obj game-info) (arg0 level)) (let ((game-perms (-> obj perm-list)) (level-entities (-> arg0 bsp level entity)) @@ -1051,8 +1019,6 @@ 0 ) -;; definition for method 17 of type game-info -;; INFO: Used lq/sq (defmethod copy-perms-to-level! game-info ((obj game-info) (arg0 level)) (let ((level-entities (-> arg0 bsp level entity))) (dotimes (i (-> level-entities length)) @@ -1069,14 +1035,11 @@ 0 ) -;; definition for method 2 of type continue-point (defmethod print continue-point ((obj continue-point)) (format #t "#<~A ~S @ #x~X>" (-> obj type) (-> obj name) obj) obj ) -;; definition for method 9 of type continue-point -;; INFO: Used lq/sq (defmethod debug-draw continue-point ((obj continue-point)) (add-debug-x #t (bucket-id debug-no-zbuf1) (-> obj trans) (new 'static 'rgba :r #xff :a #x80)) (add-debug-text-3d @@ -1100,7 +1063,6 @@ 0 ) -;; definition (debug) for function trsq->continue-point (defun-debug trsq->continue-point ((arg0 trsq)) (let ((v1-1 (level-get-target-inside *level*))) (format #t "~%(static-continue-point ~A ()~%" (symbol->string (-> v1-1 name))) @@ -1155,8 +1117,6 @@ 0 ) -;; definition for function position->stream -;; WARN: Return type mismatch int vs none. (defun position->stream ((arg0 string) (arg1 symbol) (arg2 symbol)) (format arg0 @@ -1227,7 +1187,6 @@ (none) ) -;; definition for function bug-report-display (defun bug-report-display ((arg0 symbol)) (case *bug-report-output-mode* (('*stdcon*) @@ -1269,7 +1228,6 @@ 0 ) -;; definition (debug) for function print-continues (defun-debug print-continues () (let ((levels *level-load-list*)) (while (not (null? levels)) @@ -1289,15 +1247,12 @@ 0 ) -;; definition for method 2 of type game-task-info (defmethod print game-task-info ((obj game-task-info)) (format #t "#" (-> obj name) obj) obj ) -;; definition for method 18 of type game-info -;; INFO: Used lq/sq -(defmethod game-info-method-18 game-info ((obj game-info) (arg0 symbol)) +(defmethod debug-inspect game-info ((obj game-info) (arg0 symbol)) (local-vars (sv-16 int) (sv-24 int) @@ -1509,7 +1464,6 @@ obj ) -;; definition for method 25 of type game-info (defmethod you-suck-stage game-info ((obj game-info) (arg0 symbol)) (cond ((logtest? (-> *game-info* secrets) (game-secrets hero-mode)) @@ -1544,12 +1498,10 @@ ) ) -;; definition for method 26 of type game-info (defmethod you-suck-scale game-info ((obj game-info) (arg0 object)) (* 0.25 (the float (you-suck-stage obj #f))) ) -;; definition for method 9 of type cpad-info (defmethod adjust-to-screen-flip cpad-info ((obj cpad-info)) (when (logtest? (-> *game-info* secrets) (game-secrets hflip-screen)) (set! (-> obj leftx) (- 255 (the-as int (-> obj leftx)))) @@ -1558,7 +1510,6 @@ 0 ) -;; definition for method 28 of type game-info (defmethod game-info-method-28 game-info ((obj game-info) (arg0 game-score) (arg1 float)) (when (!= arg1 0.0) (let ((v1-3 (&+ (-> obj game-score data) (* (* arg0 8) 4)))) @@ -1608,12 +1559,10 @@ -1 ) -;; definition for method 29 of type game-info (defmethod get-game-score-ref game-info ((obj game-info) (arg0 int)) (&+ (-> obj game-score data) (* (* arg0 8) 4)) ) -;; definition for method 9 of type highscore-info (defmethod get-rank highscore-info ((obj highscore-info) (arg0 float)) (let ((v0-0 0)) (cond @@ -1650,10 +1599,8 @@ ) ) -;; failed to figure out what this is: (kmemopen global "game-info") -;; failed to figure out what this is: (let ((gp-0 *game-info*)) (set! (-> gp-0 task-counter) (the-as uint 1)) (when (zero? (-> gp-0 perm-list)) @@ -1710,13 +1657,10 @@ (set! (-> gp-0 distance) 0.0) ) -;; failed to figure out what this is: 0 -;; failed to figure out what this is: (kmemclose) -;; definition for symbol *highscore-info-array*, type (array highscore-info) (define *highscore-info-array* (new 'static 'boxed-array :type highscore-info (new 'static 'highscore-info) diff --git a/test/decompiler/reference/jak2/engine/game/game-save_REF.gc b/test/decompiler/reference/jak2/engine/game/game-save_REF.gc new file mode 100644 index 0000000000..cddcc2912c --- /dev/null +++ b/test/decompiler/reference/jak2/engine/game/game-save_REF.gc @@ -0,0 +1,2539 @@ +(in-package goal) + +(defun-debug game-save-elt->string ((arg0 game-save-elt)) + (case arg0 + (((game-save-elt task-deaths)) + "task-deaths" + ) + (((game-save-elt task-node-list)) + "task-node-list" + ) + (((game-save-elt task-list)) + "task-list" + ) + (((game-save-elt real-time)) + "real-time" + ) + (((game-save-elt aspect-ratio)) + "aspect-ratio" + ) + (((game-save-elt play-hints)) + "play-hints" + ) + (((game-save-elt continue-deaths)) + "continue-deaths" + ) + (((game-save-elt node-close-time)) + "node-close-time" + ) + (((game-save-elt continue-time)) + "continue-time" + ) + (((game-save-elt dialog-volume)) + "dialog-volume" + ) + (((game-save-elt vibration)) + "vibration" + ) + (((game-save-elt real-frame-time)) + "real-frame-time" + ) + (((game-save-elt task-complete-time)) + "task-complete-time" + ) + (((game-save-elt total-game-time)) + "total-game-time" + ) + (((game-save-elt frame-time)) + "frame-time" + ) + (((game-save-elt in-level-time)) + "in-level-time" + ) + (((game-save-elt sfx-volume)) + "sfx-volume" + ) + (((game-save-elt life)) + "life" + ) + (((game-save-elt gun-ammo)) + "gun-ammo" + ) + (((game-save-elt task-start-time)) + "task-start-time" + ) + (((game-save-elt auto-save-count)) + "auto-save-count" + ) + (((game-save-elt eco-pill-dark-total)) + "eco-pill-dark-total" + ) + (((game-save-elt game-time)) + "game-time" + ) + (((game-save-elt screenx)) + "screenx" + ) + (((game-save-elt death-movie-tick)) + "death-movie-tick" + ) + (((game-save-elt buzzer-total)) + "buzzer-total" + ) + (((game-save-elt bigmap-data)) + "bigmap-data" + ) + (((game-save-elt stereo-mode)) + "stereo-mode" + ) + (((game-save-elt task-pickup-time)) + "task-pickup-time" + ) + (((game-save-elt name)) + "name" + ) + (((game-save-elt level-open-list)) + "level-open-list" + ) + (((game-save-elt disk-tester)) + "disk-tester" + ) + (((game-save-elt camera-stick-dir)) + "camera-stick-dir" + ) + (((game-save-elt continue)) + "continue" + ) + (((game-save-elt deaths-per-level)) + "deaths-per-level" + ) + (((game-save-elt karma)) + "karma" + ) + (((game-save-elt scores)) + "scores" + ) + (((game-save-elt session-time)) + "session-time" + ) + (((game-save-elt bg-time)) + "bg-time" + ) + (((game-save-elt screeny)) + "screeny" + ) + (((game-save-elt total-trys)) + "total-trys" + ) + (((game-save-elt music-volume)) + "music-volume" + ) + (((game-save-elt node-death-count)) + "node-death-count" + ) + (((game-save-elt gem)) + "gem" + ) + (((game-save-elt base-time)) + "base-time" + ) + (((game-save-elt node-name)) + "node-name" + ) + (((game-save-elt eco-pill-dark)) + "eco-pill-dark" + ) + (((game-save-elt skill-total)) + "skill-total" + ) + (((game-save-elt bigmap-offsets)) + "bigmap-offsets" + ) + (((game-save-elt death-pos)) + "death-pos" + ) + (((game-save-elt talker-state)) + "talker-state" + ) + (((game-save-elt features)) + "features" + ) + (((game-save-elt game-start-time)) + "game-start-time" + ) + (((game-save-elt hit-time)) + "hit-time" + ) + (((game-save-elt subtitle)) + "subtitle" + ) + (((game-save-elt total-deaths)) + "total-deaths" + ) + (((game-save-elt death-time)) + "death-time" + ) + (((game-save-elt video-mode)) + "video-mode" + ) + (((game-save-elt fuel-cell)) + "fuel-cell" + ) + (((game-save-elt node-gem-count)) + "node-gem-count" + ) + (((game-save-elt skill)) + "skill" + ) + (((game-save-elt subtitle-language)) + "subtitle-language" + ) + (((game-save-elt secrets)) + "secrets" + ) + (((game-save-elt shield)) + "shield" + ) + (((game-save-elt gun-type)) + "gun-type" + ) + (((game-save-elt gem-total)) + "gem-total" + ) + (((game-save-elt node-skill-count)) + "node-skill-count" + ) + (((game-save-elt money-per-level)) + "money-per-level" + ) + (((game-save-elt money-total)) + "money-total" + ) + (((game-save-elt money)) + "money" + ) + (((game-save-elt enter-level-time)) + "enter-level-time" + ) + (((game-save-elt purchase-secrets)) + "purchase-secrets" + ) + (((game-save-elt perm-list)) + "perm-list" + ) + (((game-save-elt language)) + "language" + ) + (else + "*unknown*" + ) + ) + ) + +(deftype game-save-tag (structure) + ((user-object object 2 :offset 0) + (user-uint64 uint64 :offset 0) + (user-float0 float :offset 0) + (user-float float 2 :offset 0) + (user-int32 int32 2 :offset 0) + (user-uint32 uint32 2 :offset 0) + (user-int16 int16 4 :offset 0) + (user-uint16 uint16 4 :offset 0) + (user-int8 int8 8 :offset 0) + (user-int80 int8 :offset 0) + (user-int81 int8 :offset 1) + (user-uint8 uint8 8 :offset 0) + (elt-count int32 :offset-assert 8) + (elt-size uint16 :offset-assert 12) + (elt-type game-save-elt :offset-assert 14) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(defmethod inspect game-save-tag ((obj game-save-tag)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'game-save-tag) + (format #t "~1Tuser-object[2] @ #x~X~%" (-> obj user-object)) + (format #t "~1Tuser-uint64: ~D~%" (-> obj user-uint64)) + (format #t "~1Tuser-float0: ~f~%" (-> obj user-float0)) + (format #t "~1Tuser-float[2] @ #x~X~%" (-> obj user-object)) + (format #t "~1Tuser-int32[2] @ #x~X~%" (-> obj user-object)) + (format #t "~1Tuser-uint32[2] @ #x~X~%" (-> obj user-object)) + (format #t "~1Tuser-int16[4] @ #x~X~%" (-> obj user-object)) + (format #t "~1Tuser-uint16[4] @ #x~X~%" (-> obj user-object)) + (format #t "~1Tuser-int8[8] @ #x~X~%" (-> obj user-object)) + (format #t "~1Tuser-int80: ~D~%" (-> obj user-int80)) + (format #t "~1Tuser-int81: ~D~%" (-> obj user-int81)) + (format #t "~1Tuser-uint8[8] @ #x~X~%" (-> obj user-object)) + (format #t "~1Telt-count: ~D~%" (-> obj elt-count)) + (format #t "~1Telt-size: ~D~%" (-> obj elt-size)) + (format #t "~1Telt-type: ~D~%" (-> obj elt-type)) + (label cfg-4) + obj + ) + +(deftype game-save (basic) + ((version int32 :offset-assert 4) + (allocated-length int32 :offset-assert 8) + (length int32 :offset-assert 12) + (info-int32 int32 16 :offset-assert 16) + (info-int8 int8 64 :offset 16) + (level-index int32 :offset 16) + (gem-count float :offset 20) + (skill-count float :offset 24) + (completion-percentage float :offset 28) + (minute uint8 :offset 36) + (hour uint8 :offset 37) + (week uint8 :offset 38) + (day uint8 :offset 39) + (month uint8 :offset 40) + (year uint8 :offset 41) + (new-game int32 :offset 44) + (game-time time-frame :offset 48) + (secrets uint32 :offset 56) + (features uint32 :offset 60) + (tag game-save-tag :inline :dynamic :offset-assert 80) + ) + :method-count-assert 12 + :size-assert #x50 + :flag-assert #xc00000050 + (:methods + (new (symbol type int) _type_ 0) + (save-to-file (_type_ string) _type_ 9) + (load-from-file (_type_ string) _type_ 10) + (debug-inspect (_type_ symbol) _type_ 11) + ) + ) + +(defmethod inspect game-save ((obj game-save)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tversion: ~D~%" (-> obj version)) + (format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~1Tlength: ~D~%" (-> obj length)) + (format #t "~1Tinfo-int32[16] @ #x~X~%" (-> obj info-int32)) + (format #t "~1Tinfo-int8[64] @ #x~X~%" (-> obj info-int32)) + (format #t "~1Tlevel-index: ~D~%" (-> obj level-index)) + (format #t "~1Tgem-count: ~f~%" (-> obj gem-count)) + (format #t "~1Tskill-count: ~f~%" (-> obj skill-count)) + (format #t "~1Tcompletion-percentage: ~f~%" (-> obj completion-percentage)) + (format #t "~1Tminute: #x~X~%" (-> obj minute)) + (format #t "~1Thour: #x~X~%" (-> obj hour)) + (format #t "~1Tweek: #x~X~%" (-> obj week)) + (format #t "~1Tday: #x~X~%" (-> obj day)) + (format #t "~1Tmonth: #x~X~%" (-> obj month)) + (format #t "~1Tyear: #x~X~%" (-> obj year)) + (format #t "~1Tnew-game: ~D~%" (-> obj new-game)) + (format #t "~1Tgame-time: ~D~%" (-> obj game-time)) + (format #t "~1Tsecrets: ~D~%" (-> obj secrets)) + (format #t "~1Tfeatures: ~D~%" (-> obj features)) + (format #t "~1Ttag[0] @ #x~X~%" (-> obj tag)) + (label cfg-4) + obj + ) + +(defmethod asize-of game-save ((obj game-save)) + (the-as int (+ (-> game-save size) (-> obj allocated-length))) + ) + +(defmethod new game-save ((allocation symbol) (type-to-make type) (arg0 int)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) arg0))))) + (set! (-> v0-0 version) 3) + (set! (-> v0-0 allocated-length) arg0) + v0-0 + ) + ) + +(defmethod debug-inspect game-save ((obj game-save) (arg0 symbol)) + (local-vars (sv-16 int) (sv-32 string) (sv-48 string)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tversion: ~D~%" (-> obj version)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tlevel-index: ~D~%" (-> obj level-index)) + (format #t "~Tgem-count: ~f~%" (-> obj gem-count)) + (format #t "~Tskill-count: ~f~%" (-> obj skill-count)) + (format #t "~Tcompletion-percentage: ~f~%" (-> obj completion-percentage)) + (format + #t + "~Tsave-time: ~x:~x ~x/~x/~x~%" + (-> obj hour) + (-> obj minute) + (-> obj day) + (-> obj month) + (-> obj year) + ) + (format #t "~Tgame-time: ~E~%" (-> obj game-time)) + (format #t "~Tsecrets: #x~x~%" (-> obj secrets)) + (format #t "~Tfeatures: #x~x~%" (-> obj features)) + (format #t "~Ttag[]: @ #x~X~%" (-> obj tag)) + (let ((s4-0 (the-as object (-> obj tag))) + (s3-0 0) + ) + (while (< (the-as int s4-0) (the-as int (&-> obj tag 0 user-int8 (-> obj length)))) + (let ((s2-0 format) + (s1-0 #t) + (s0-0 "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f ") + ) + (set! sv-16 s3-0) + (let ((a3-2 (game-save-elt->string (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) + (t0-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (t1-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) + (t2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + (t3-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (s2-0 s1-0 s0-0 sv-16 a3-2 t0-1 t1-1 t2-1 t3-0) + ) + ) + (let ((v1-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) + (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) + (format #t "= \"~G\"~%" (-> (the-as (inline-array game-save-tag) s4-0) 1)) + (format #t "~%") + ) + ) + (when arg0 + (case (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type) + (((game-save-elt node-death-count) (game-save-elt node-skill-count) (game-save-elt node-gem-count)) + (dotimes (s2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (let ((s1-1 format) + (s0-1 #t) + ) + (set! sv-32 " ~-32S: ~D~%") + (let ((a2-15 (game-task-node->string (the-as game-task-node s2-1))) + (a3-3 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1)) + ) + (s1-1 s0-1 sv-32 a2-15 a3-3) + ) + ) + ) + ) + (((game-save-elt node-close-time)) + (dotimes (s2-2 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (let ((s1-2 format) + (s0-2 #t) + ) + (set! sv-48 " ~-32S: ~D~%") + (let ((a2-16 (game-task-node->string (the-as game-task-node s2-2))) + (a3-4 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-2 8)))) + ) + ) + (s1-2 s0-2 sv-48 a2-16 a3-4) + ) + ) + ) + ) + (((game-save-elt enter-level-time)) + (dotimes (s2-3 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (when (< s2-3 (-> *task-level* length)) + (let ((a2-17 (task-level->string s2-3))) + (if a2-17 + (format + #t + " ~-32S: ~D~%" + a2-17 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-3 8)))) + ) + ) + ) + ) + ) + ) + (((game-save-elt in-level-time)) + (dotimes (s2-4 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (when (< s2-4 (-> *task-level* length)) + (let ((a2-18 (task-level->string s2-4))) + (if a2-18 + (format + #t + " ~-32S: ~D~%" + a2-18 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-4 8)))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-complete-time) (game-save-elt task-start-time)) + (dotimes (s2-5 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (let ((a2-19 (game-task->string (the-as game-task s2-5)))) + (if a2-19 + (format + #t + " ~-32S: ~D~%" + a2-19 + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-5 8)))) + ) + ) + ) + ) + ) + (((game-save-elt disk-tester)) + 0 + ) + ) + ) + (set! s4-0 (&+ + (the-as pointer s4-0) + (logand -16 (+ (* (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) + ) + 31 + ) + ) + ) + ) + (+! s3-0 1) + ) + ) + obj + ) + +(defmethod inspect game-save ((obj game-save)) + (debug-inspect obj #f) + ) + +(defmethod save-game game-info ((obj game-info) (arg0 game-save) (arg1 string)) + (with-pp + (dotimes (s4-0 (-> *level* length)) + (let ((a1-1 (-> *level* level s4-0))) + (if (= (-> a1-1 status) 'active) + (copy-perms-from-level! obj a1-1) + ) + ) + ) + (set! (-> arg0 length) 0) + (set! (-> arg0 version) 3) + (let ((s4-1 (get-continue-by-name obj (-> obj current-continue name)))) + (when (not s4-1) + (format + 0 + "ERROR: SAVE: attempting to save continue ~A which is not in level-info~%" + (-> obj current-continue name) + ) + (set! s4-1 (get-continue-by-name obj "title-start")) + ) + (let ((v1-19 (-> *task-manager-engine* alive-list next0))) + *task-manager-engine* + (let ((s2-0 (-> v1-19 next0))) + (while (!= v1-19 (-> *task-manager-engine* alive-list-end)) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer pp)) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'fail-continue) + (let ((a1-6 (send-event-function (the-as process-tree (-> (the-as connection v1-19) param1)) a1-5))) + (when a1-6 + (let ((a0-13 (get-continue-by-name obj (the-as string a1-6)))) + (if a0-13 + (set! s4-1 a0-13) + ) + ) + ) + ) + ) + (set! v1-19 s2-0) + *task-manager-engine* + (set! s2-0 (-> s2-0 next0)) + ) + ) + ) + (set! (-> arg0 level-index) (the-as int (-> (lookup-level-info (-> s4-1 level)) task-level))) + (set! (-> arg0 gem-count) (-> obj gem)) + (set! (-> arg0 skill-count) (-> obj skill)) + (set! (-> arg0 completion-percentage) (calculate-percentage obj)) + (set! (-> arg0 game-time) (+ -300000 (-> *display* total-game-clock frame-counter))) + (set! (-> arg0 secrets) (the-as uint (-> obj purchase-secrets))) + (set! (-> arg0 features) (the-as uint (-> obj features))) + (when (string= (-> s4-1 name) "title-start") + (set! (-> arg0 new-game) 1) + (set! (-> arg0 level-index) 0) + (set! (-> arg0 gem-count) 0.0) + (set! (-> arg0 skill-count) 0.0) + (set! (-> arg0 completion-percentage) 0.0) + (set! (-> arg0 game-time) 0) + (set! (-> arg0 features) (the-as uint 0)) + (set! (-> arg0 secrets) (the-as uint 0)) + (when (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! (-> arg0 new-game) 2) + (set! (-> arg0 secrets) (the-as uint #x8000)) + ) + ) + (let ((s2-1 (new 'stack 'scf-time))) + (scf-get-time s2-1) + (when (zero? (-> s2-1 stat)) + (set! (-> arg0 minute) (-> s2-1 minute)) + (set! (-> arg0 hour) (-> s2-1 hour)) + (set! (-> arg0 day) (-> s2-1 day)) + (set! (-> arg0 week) (-> s2-1 week)) + (set! (-> arg0 month) (-> s2-1 month)) + (set! (-> arg0 year) (-> s2-1 year)) + ) + ) + (let ((s2-2 (the-as object (-> arg0 tag)))) + (let ((s1-0 (-> (the-as (inline-array game-save-tag) s2-2) 0))) + (set! (-> s1-0 elt-type) (game-save-elt name)) + (set! (-> s1-0 elt-count) (+ (length arg1) 1)) + (set! (-> s1-0 elt-size) (the-as uint 1)) + ) + (copy-charp<-charp (the-as (pointer uint8) (-> (the-as (inline-array game-save-tag) s2-2) 1)) (-> arg1 data)) + (let ((v1-59 + (the-as + (inline-array game-save-tag) + (+ (the-as int s2-2) + (the-as + int + (&+ (logand -16 (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s2-2) 0 elt-count)) 15)) 16) + ) + ) + ) + ) + ) + (let ((a0-31 (-> v1-59 0))) + (set! (-> a0-31 elt-type) (game-save-elt base-time)) + (set! (-> a0-31 elt-count) 2) + (set! (-> a0-31 elt-size) (the-as uint 8)) + ) + (let ((s3-1 (-> v1-59 1))) + (save! (-> *display* base-clock) (the-as (pointer uint64) s3-1)) + (let ((v1-63 (the-as object (&+ s3-1 16)))) + (let ((a0-33 (-> (the-as (inline-array game-save-tag) v1-63) 0))) + (set! (-> a0-33 elt-type) (game-save-elt game-time)) + (set! (-> a0-33 elt-count) 2) + (set! (-> a0-33 elt-size) (the-as uint 8)) + ) + (let ((s3-2 (&+ (the-as game-save-tag v1-63) 16))) + (save! (-> *display* game-clock) (the-as (pointer uint64) s3-2)) + (let ((v1-67 (the-as object (&+ s3-2 16)))) + (let ((a0-35 (-> (the-as (inline-array game-save-tag) v1-67) 0))) + (set! (-> a0-35 elt-type) (game-save-elt total-game-time)) + (set! (-> a0-35 elt-count) 2) + (set! (-> a0-35 elt-size) (the-as uint 8)) + ) + (let ((s3-3 (&+ (the-as game-save-tag v1-67) 16))) + (save! (-> *display* total-game-clock) (the-as (pointer uint64) s3-3)) + (let ((v1-71 (the-as object (&+ s3-3 16)))) + (let ((a0-37 (-> (the-as (inline-array game-save-tag) v1-71) 0))) + (set! (-> a0-37 elt-type) (game-save-elt real-time)) + (set! (-> a0-37 elt-count) 2) + (set! (-> a0-37 elt-size) (the-as uint 8)) + ) + (let ((s3-4 (&+ (the-as game-save-tag v1-71) 16))) + (save! (-> *display* real-clock) (the-as (pointer uint64) s3-4)) + (let ((v1-75 (the-as object (&+ s3-4 16)))) + (let ((a0-39 (-> (the-as (inline-array game-save-tag) v1-75) 0))) + (set! (-> a0-39 elt-type) (game-save-elt frame-time)) + (set! (-> a0-39 elt-count) 2) + (set! (-> a0-39 elt-size) (the-as uint 8)) + ) + (let ((s3-5 (&+ (the-as game-save-tag v1-75) 16))) + (save! (-> *display* frame-clock) (the-as (pointer uint64) s3-5)) + (let ((v1-79 (the-as object (&+ s3-5 16)))) + (let ((a0-41 (-> (the-as (inline-array game-save-tag) v1-79) 0))) + (set! (-> a0-41 elt-type) (game-save-elt real-frame-time)) + (set! (-> a0-41 elt-count) 2) + (set! (-> a0-41 elt-size) (the-as uint 8)) + ) + (let ((s3-6 (&+ (the-as game-save-tag v1-79) 16))) + (save! (-> *display* real-frame-clock) (the-as (pointer uint64) s3-6)) + (let ((v1-83 (the-as object (&+ s3-6 16)))) + (let ((a0-43 (-> (the-as (inline-array game-save-tag) v1-83) 0))) + (set! (-> a0-43 elt-type) (game-save-elt session-time)) + (set! (-> a0-43 elt-count) 2) + (set! (-> a0-43 elt-size) (the-as uint 8)) + ) + (let ((s3-7 (&+ (the-as game-save-tag v1-83) 16))) + (save! (-> *display* session-clock) (the-as (pointer uint64) s3-7)) + (let ((v1-87 (the-as object (&+ s3-7 16)))) + (let ((a0-45 (-> (the-as (inline-array game-save-tag) v1-87) 0))) + (set! (-> a0-45 elt-type) (game-save-elt bg-time)) + (set! (-> a0-45 elt-count) 2) + (set! (-> a0-45 elt-size) (the-as uint 8)) + ) + (let ((s3-8 (&+ (the-as game-save-tag v1-87) 16))) + (save! (-> *display* bg-clock) (the-as (pointer uint64) s3-8)) + (let ((s3-9 (the-as object (&+ s3-8 16)))) + (let ((s4-2 (-> s4-1 name))) + (let ((s2-3 (-> (the-as (inline-array game-save-tag) s3-9) 0))) + (set! (-> s2-3 elt-type) (game-save-elt continue)) + (set! (-> s2-3 elt-count) (+ (length s4-2) 1)) + (set! (-> s2-3 elt-size) (the-as uint 1)) + ) + (copy-charp<-charp (the-as (pointer uint8) (&+ (the-as game-save-tag s3-9) 16)) (-> s4-2 data)) + ) + (let ((v1-99 (the-as + object + (&+ (the-as pointer s3-9) (+ (logand -16 (+ (-> (the-as game-save-tag s3-9) elt-count) 15)) 16)) + ) + ) + ) + (let ((a0-52 (-> (the-as (inline-array game-save-tag) v1-99) 0))) + (set! (-> a0-52 elt-type) (game-save-elt life)) + (set! (-> a0-52 elt-count) 0) + (set! (-> a0-52 user-float0) (-> obj life)) + ) + (let ((v1-100 (the-as (inline-array game-save-tag) (&+ (the-as pointer v1-99) 16)))) + (let ((a0-53 (-> v1-100 0))) + (set! (-> a0-53 elt-type) (game-save-elt buzzer-total)) + (set! (-> a0-53 elt-count) 0) + (set! (-> a0-53 user-float0) (-> obj buzzer-total)) + ) + (let ((v1-101 (the-as object (-> v1-100 1)))) + (let ((a0-54 (-> (the-as (inline-array game-save-tag) v1-101) 0))) + (set! (-> a0-54 elt-type) (game-save-elt fuel-cell)) + (set! (-> a0-54 elt-count) 0) + (set! (-> a0-54 user-float0) (-> obj fuel)) + ) + (let ((v1-102 (the-as object (&+ (the-as game-save-tag v1-101) 16)))) + (let ((a0-55 (-> (the-as (inline-array game-save-tag) v1-102) 0))) + (set! (-> a0-55 elt-type) (game-save-elt death-movie-tick)) + (set! (-> a0-55 elt-count) 0) + (set! (-> a0-55 user-uint64) (the-as uint (-> obj death-movie-tick))) + ) + (let ((v1-103 (the-as object (&+ (the-as game-save-tag v1-102) 16)))) + (let ((a0-56 (-> (the-as (inline-array game-save-tag) v1-103) 0))) + (set! (-> a0-56 elt-type) (game-save-elt money)) + (set! (-> a0-56 elt-count) 0) + (set! (-> a0-56 user-float0) (-> obj money)) + ) + (let ((v1-104 (the-as (inline-array game-save-tag) (&+ (the-as game-save-tag v1-103) 16)))) + (let ((a0-57 (-> v1-104 0))) + (set! (-> a0-57 elt-type) (game-save-elt money-total)) + (set! (-> a0-57 elt-count) 0) + (set! (-> a0-57 user-float0) (-> obj money-total)) + ) + (let ((v1-106 (the-as object (-> (the-as (inline-array game-save-tag) (-> v1-104 1)) 2)))) + (let ((a0-58 (-> (the-as (inline-array game-save-tag) v1-106) 0))) + (set! (-> a0-58 elt-type) (game-save-elt skill)) + (set! (-> a0-58 elt-count) 0) + (set! (-> a0-58 user-float0) (-> obj skill)) + ) + (let ((v1-107 (the-as object (&+ (the-as game-save-tag v1-106) 16)))) + (let ((a0-59 (-> (the-as (inline-array game-save-tag) v1-107) 0))) + (set! (-> a0-59 elt-type) (game-save-elt skill-total)) + (set! (-> a0-59 elt-count) 0) + (set! (-> a0-59 user-float0) (-> obj skill-total)) + ) + (let ((v1-108 (the-as object (&+ (the-as game-save-tag v1-107) 16)))) + (let ((a0-60 (-> (the-as (inline-array game-save-tag) v1-108) 0))) + (set! (-> a0-60 elt-type) (game-save-elt gem)) + (set! (-> a0-60 elt-count) 0) + (set! (-> a0-60 user-float0) (-> obj gem)) + ) + (let ((v1-109 (the-as object (&+ (the-as game-save-tag v1-108) 16)))) + (let ((a0-61 (-> (the-as (inline-array game-save-tag) v1-109) 0))) + (set! (-> a0-61 elt-type) (game-save-elt gem-total)) + (set! (-> a0-61 elt-count) 0) + (set! (-> a0-61 user-float0) (-> obj gem-total)) + ) + (let ((v1-110 (the-as object (&+ (the-as game-save-tag v1-109) 16)))) + (let ((a0-62 (-> (the-as (inline-array game-save-tag) v1-110) 0))) + (set! (-> a0-62 elt-type) (game-save-elt karma)) + (set! (-> a0-62 elt-count) 0) + (set! (-> a0-62 user-float0) (-> obj karma)) + ) + (let ((v1-111 (the-as object (&+ (the-as game-save-tag v1-110) 16)))) + (let ((a0-63 (-> (the-as (inline-array game-save-tag) v1-111) 0))) + (set! (-> a0-63 elt-type) (game-save-elt eco-pill-dark)) + (set! (-> a0-63 elt-count) 0) + (set! (-> a0-63 user-float0) (-> obj eco-pill-dark)) + ) + (let ((v1-112 (the-as object (&+ (the-as game-save-tag v1-111) 16)))) + (let ((a0-64 (-> (the-as (inline-array game-save-tag) v1-112) 0))) + (set! (-> a0-64 elt-type) (game-save-elt eco-pill-dark-total)) + (set! (-> a0-64 elt-count) 0) + (set! (-> a0-64 user-float0) (-> obj eco-pill-dark-total)) + ) + (let ((v1-113 (the-as object (&+ (the-as game-save-tag v1-112) 16)))) + (let ((a0-65 (-> (the-as (inline-array game-save-tag) v1-113) 0))) + (set! (-> a0-65 elt-type) (game-save-elt shield)) + (set! (-> a0-65 elt-count) 0) + (set! (-> a0-65 user-float0) (-> obj shield)) + ) + (let ((v1-114 (the-as object (&+ (the-as game-save-tag v1-113) 16)))) + (let ((a0-66 (-> (the-as (inline-array game-save-tag) v1-114) 0))) + (set! (-> a0-66 elt-type) (game-save-elt features)) + (set! (-> a0-66 elt-count) 0) + (set! (-> a0-66 user-uint64) (the-as uint (-> obj features))) + ) + (let ((v1-115 (the-as object (&+ (the-as game-save-tag v1-114) 16)))) + (let ((a0-67 (-> (the-as (inline-array game-save-tag) v1-115) 0))) + (set! (-> a0-67 elt-type) (game-save-elt secrets)) + (set! (-> a0-67 elt-count) 0) + (set! (-> a0-67 user-uint64) (the-as uint (-> obj secrets))) + ) + (let ((v1-116 (the-as object (&+ (the-as game-save-tag v1-115) 16)))) + (let ((a0-68 (-> (the-as (inline-array game-save-tag) v1-116) 0))) + (set! (-> a0-68 elt-type) (game-save-elt purchase-secrets)) + (set! (-> a0-68 elt-count) 0) + (set! (-> a0-68 user-uint64) (the-as uint (-> obj purchase-secrets))) + ) + (let ((v1-117 (the-as object (&+ (the-as game-save-tag v1-116) 16)))) + (let ((a0-69 (-> (the-as (inline-array game-save-tag) v1-117) 0))) + (set! (-> a0-69 elt-type) (game-save-elt gun-type)) + (set! (-> a0-69 elt-count) 0) + (set! (-> a0-69 user-uint64) (the-as uint (-> obj gun-type))) + ) + (let ((v1-118 (the-as object (&+ (the-as game-save-tag v1-117) 16)))) + (let ((a0-70 (-> (the-as (inline-array game-save-tag) v1-118) 0))) + (set! (-> a0-70 elt-type) (game-save-elt gun-ammo)) + (set! (-> a0-70 elt-count) 4) + (set! (-> a0-70 elt-size) (the-as uint 4)) + ) + (let ((v1-119 (&+ (the-as game-save-tag v1-118) 16))) + (dotimes (a0-71 4) + (set! (-> v1-119 user-object a0-71) (-> obj gun-ammo a0-71)) + ) + (let ((v1-120 (the-as object (&+ v1-119 16)))) + (let ((a0-74 (-> (the-as (inline-array game-save-tag) v1-120) 0))) + (set! (-> a0-74 elt-type) (game-save-elt level-open-list)) + (set! (-> a0-74 elt-count) 32) + (set! (-> a0-74 elt-size) (the-as uint 1)) + ) + (let ((v1-121 (the-as object (&+ (the-as game-save-tag v1-120) 16)))) + (dotimes (a0-75 32) + (set! (-> (the-as (pointer uint8) (&+ (the-as pointer v1-121) a0-75))) (-> obj level-opened a0-75)) + ) + (let ((v1-122 (the-as object (-> (the-as (inline-array game-save-tag) v1-121) 2))) + (s3-10 (-> obj sub-task-list length)) + ) + (let ((a0-79 (-> (the-as (inline-array game-save-tag) v1-122) 0))) + (set! (-> a0-79 elt-type) (game-save-elt node-name)) + (set! (-> a0-79 elt-count) s3-10) + (set! (-> a0-79 elt-size) (the-as uint 64)) + ) + (let ((s4-3 (the-as object (&+ (the-as game-save-tag v1-122) 16)))) + (dotimes (s2-4 s3-10) + (copyn-charp<-string (the-as (pointer uint8) s4-3) (-> obj sub-task-list s2-4 name) 64) + (set! s4-3 (&+ (the-as pointer s4-3) 64)) + ) + (let ((s3-11 (-> obj perm-list length))) + (let ((v1-129 (-> (the-as (inline-array game-save-tag) s4-3) 0))) + (set! (-> v1-129 elt-type) (game-save-elt perm-list)) + (set! (-> v1-129 elt-count) s3-11) + (set! (-> v1-129 elt-size) (the-as uint 16)) + ) + (let ((s4-4 (the-as object (&+ (the-as pointer s4-3) 16)))) + (dotimes (s2-5 s3-11) + (mem-copy! (&+ (the-as pointer s4-4) (* s2-5 16)) (the-as pointer (-> obj perm-list data s2-5)) 16) + ) + (let ((v1-137 (the-as object (+ (the-as int s4-4) (logand -16 (+ (* s3-11 16) 15))))) + (s4-5 (-> obj task-perm-list length)) + ) + (let ((a0-88 (-> (the-as (inline-array game-save-tag) v1-137) 0))) + (set! (-> a0-88 elt-type) (game-save-elt task-list)) + (set! (-> a0-88 elt-count) s4-5) + (set! (-> a0-88 elt-size) (the-as uint 16)) + ) + (let ((s3-12 (+ (the-as int v1-137) 16))) + (dotimes (s2-6 s4-5) + (mem-copy! (the-as pointer (+ s3-12 (* s2-6 16))) (the-as pointer (-> obj task-perm-list data s2-6)) 16) + ) + (let ((a0-92 (the-as object (+ s3-12 (logand -16 (+ (* s4-5 16) 15))))) + (v1-147 (-> obj unknown-pad6 allocated-length)) + ) + (let ((a1-88 (-> (the-as (inline-array game-save-tag) a0-92) 0))) + (set! (-> a1-88 elt-type) (game-save-elt talker-state)) + (set! (-> a1-88 elt-count) v1-147) + (set! (-> a1-88 elt-size) (the-as uint 2)) + ) + (let ((a0-93 (+ (the-as int a0-92) 16))) + (dotimes (a1-89 v1-147) + (set! (-> (the-as (pointer uint16) (+ a0-93 (* a1-89 2))) 0) (-> obj unknown-pad6 a1-89)) + ) + (let ((a0-94 (the-as object (+ a0-93 (logand -16 (+ (* v1-147 2) 15))))) + (v1-153 (-> obj game-score allocated-length)) + ) + (let ((a1-93 (-> (the-as (inline-array game-save-tag) a0-94) 0))) + (set! (-> a1-93 elt-type) (game-save-elt scores)) + (set! (-> a1-93 elt-count) v1-153) + (set! (-> a1-93 elt-size) (the-as uint 4)) + ) + (let ((a0-95 (+ (the-as int a0-94) 16))) + (dotimes (a1-94 v1-153) + (set! (-> (the-as (pointer float) (+ a0-95 (* a1-94 4))) 0) (-> obj game-score a1-94)) + ) + (let ((s4-6 (the-as object (+ a0-95 (logand -16 (+ (* v1-153 4) 15)))))) + ((method-of-object *bigmap* bigmap-method-13)) + (let ((v1-161 (-> *bigmap* compressed-next-index))) + (let ((a0-97 (-> (the-as (inline-array game-save-tag) s4-6) 0))) + (set! (-> a0-97 elt-type) (game-save-elt bigmap-data)) + (set! (-> a0-97 elt-count) (the-as int v1-161)) + (set! (-> a0-97 elt-size) (the-as uint 1)) + ) + (let ((a0-98 (+ (the-as int s4-6) 16))) + (dotimes (a1-100 (the-as int v1-161)) + (set! (-> (the-as (pointer uint8) (+ a0-98 a1-100)) 0) + (-> (the-as game-save-tag (+ (-> *bigmap* compressed-data) a1-100)) user-uint8 0) + ) + ) + (let ((a0-99 (the-as object (+ a0-98 (logand -16 (+ v1-161 15))))) + (v1-165 20) + ) + (let ((a1-104 (-> (the-as (inline-array game-save-tag) a0-99) 0))) + (set! (-> a1-104 elt-type) (game-save-elt bigmap-offsets)) + (set! (-> a1-104 elt-count) v1-165) + (set! (-> a1-104 elt-size) (the-as uint 4)) + ) + (let ((a0-100 (+ (the-as int a0-99) 16))) + (dotimes (a1-105 v1-165) + (if (-> *bigmap* compressed-masks a1-105) + (set! (-> (the-as (pointer uint32) (+ a0-100 (* a1-105 4))) 0) + (- (-> *bigmap* compressed-masks a1-105) (-> *bigmap* compressed-data)) + ) + (set! (-> (the-as (pointer int32) (+ a0-100 (* a1-105 4))) 0) -1) + ) + ) + (let ((v1-169 (the-as object (+ a0-100 (logand -16 (+ (* v1-165 4) 15)))))) + (let ((a0-102 (-> (the-as (inline-array game-save-tag) v1-169) 0))) + (set! (-> a0-102 elt-type) (game-save-elt auto-save-count)) + (set! (-> a0-102 elt-count) 0) + (set! (-> a0-102 user-uint64) (the-as uint (-> obj auto-save-count))) + ) + (let ((v1-170 (the-as object (+ (the-as int v1-169) 16)))) + (let ((a0-103 (-> (the-as (inline-array game-save-tag) v1-170) 0))) + (set! (-> a0-103 elt-type) (game-save-elt total-deaths)) + (set! (-> a0-103 elt-count) 0) + (set! (-> a0-103 user-uint64) (the-as uint (-> obj total-deaths))) + ) + (let ((v1-171 (the-as object (+ (the-as int v1-170) 16)))) + (let ((a0-104 (-> (the-as (inline-array game-save-tag) v1-171) 0))) + (set! (-> a0-104 elt-type) (game-save-elt total-trys)) + (set! (-> a0-104 elt-count) 0) + (set! (-> a0-104 user-uint64) (the-as uint (-> obj total-trys))) + ) + (let ((v1-172 (the-as object (+ (the-as int v1-171) 16)))) + (let ((a0-105 (-> (the-as (inline-array game-save-tag) v1-172) 0))) + (set! (-> a0-105 elt-type) (game-save-elt continue-deaths)) + (set! (-> a0-105 elt-count) 0) + (set! (-> a0-105 user-uint64) (the-as uint (-> obj continue-deaths))) + ) + (let ((v1-173 (the-as object (+ (the-as int v1-172) 16)))) + (let ((a0-106 (-> (the-as (inline-array game-save-tag) v1-173) 0))) + (set! (-> a0-106 elt-type) (game-save-elt task-deaths)) + (set! (-> a0-106 elt-count) 0) + (set! (-> a0-106 user-uint64) (the-as uint (-> obj task-deaths))) + ) + (let ((v1-174 (the-as object (+ (the-as int v1-173) 16)))) + (let ((a0-107 (-> (the-as (inline-array game-save-tag) v1-174) 0))) + (set! (-> a0-107 elt-type) (game-save-elt game-start-time)) + (set! (-> a0-107 elt-count) 0) + (set! (-> a0-107 user-uint64) (the-as uint (-> obj game-start-time))) + ) + (let ((v1-175 (the-as object (+ (the-as int v1-174) 16)))) + (let ((a0-108 (-> (the-as (inline-array game-save-tag) v1-175) 0))) + (set! (-> a0-108 elt-type) (game-save-elt continue-time)) + (set! (-> a0-108 elt-count) 0) + (set! (-> a0-108 user-uint64) (the-as uint (-> obj continue-time))) + ) + (let ((v1-176 (the-as object (+ (the-as int v1-175) 16)))) + (let ((a0-109 (-> (the-as (inline-array game-save-tag) v1-176) 0))) + (set! (-> a0-109 elt-type) (game-save-elt death-time)) + (set! (-> a0-109 elt-count) 0) + (set! (-> a0-109 user-uint64) (the-as uint (-> obj death-time))) + ) + (let ((v1-177 (the-as object (+ (the-as int v1-176) 16)))) + (let ((a0-110 (-> (the-as (inline-array game-save-tag) v1-177) 0))) + (set! (-> a0-110 elt-type) (game-save-elt hit-time)) + (set! (-> a0-110 elt-count) 0) + (set! (-> a0-110 user-uint64) (the-as uint (-> obj hit-time))) + ) + (let ((v1-178 (the-as object (+ (the-as int v1-177) 16)))) + (let ((a0-111 (-> (the-as (inline-array game-save-tag) v1-178) 0))) + (set! (-> a0-111 elt-type) (game-save-elt task-pickup-time)) + (set! (-> a0-111 elt-count) 0) + (set! (-> a0-111 user-uint64) (the-as uint (-> obj task-pickup-time))) + ) + (let ((v1-179 (the-as object (+ (the-as int v1-178) 16)))) + (let ((a0-112 (-> (the-as (inline-array game-save-tag) v1-179) 0))) + (set! (-> a0-112 elt-type) (game-save-elt task-complete-time)) + (set! (-> a0-112 elt-count) 110) + (set! (-> a0-112 elt-size) (the-as uint 8)) + ) + (let ((v1-180 (+ (the-as int v1-179) 16))) + (dotimes (a0-113 110) + (set! (-> (the-as (pointer time-frame) (+ v1-180 (* a0-113 8))) 0) (-> obj unknown-array1 a0-113)) + ) + (let ((v1-181 (the-as object (+ v1-180 880)))) + (let ((a0-116 (-> (the-as (inline-array game-save-tag) v1-181) 0))) + (set! (-> a0-116 elt-type) (game-save-elt task-start-time)) + (set! (-> a0-116 elt-count) 110) + (set! (-> a0-116 elt-size) (the-as uint 8)) + ) + (let ((v1-182 (+ (the-as int v1-181) 16))) + (dotimes (a0-117 110) + (set! (-> (the-as (pointer time-frame) (+ v1-182 (* a0-117 8))) 0) (-> obj task-close-times a0-117)) + ) + (let ((v1-183 (the-as object (+ v1-182 880)))) + (let ((a0-120 (-> (the-as (inline-array game-save-tag) v1-183) 0))) + (set! (-> a0-120 elt-type) (game-save-elt enter-level-time)) + (set! (-> a0-120 elt-count) 32) + (set! (-> a0-120 elt-size) (the-as uint 8)) + ) + (let ((v1-184 (+ (the-as int v1-183) 16))) + (dotimes (a0-121 32) + (set! (-> (the-as (pointer time-frame) (+ v1-184 (* a0-121 8))) 0) (-> obj task-enter-times a0-121)) + ) + (let ((v1-185 (the-as object (+ v1-184 256)))) + (let ((a0-124 (-> (the-as (inline-array game-save-tag) v1-185) 0))) + (set! (-> a0-124 elt-type) (game-save-elt in-level-time)) + (set! (-> a0-124 elt-count) 32) + (set! (-> a0-124 elt-size) (the-as uint 8)) + ) + (let ((v1-186 (+ (the-as int v1-185) 16))) + (dotimes (a0-125 32) + (set! (-> (the-as (pointer time-frame) (+ v1-186 (* a0-125 8))) 0) (-> obj task-in-times a0-125)) + ) + (let ((a0-128 (the-as object (+ v1-186 256))) + (v1-188 (-> obj sub-task-list length)) + ) + (let ((a1-153 (-> (the-as (inline-array game-save-tag) a0-128) 0))) + (set! (-> a1-153 elt-type) (game-save-elt node-death-count)) + (set! (-> a1-153 elt-count) v1-188) + (set! (-> a1-153 elt-size) (the-as uint 2)) + ) + (let ((a0-129 (+ (the-as int a0-128) 16))) + (dotimes (a1-154 v1-188) + (set! (-> (the-as (pointer uint16) (+ a0-129 (* a1-154 2))) 0) (-> obj sub-task-list a1-154 death-count)) + ) + (let ((a0-130 (the-as object (+ a0-129 (logand -16 (+ (* v1-188 2) 15)))))) + (let ((a1-159 (-> (the-as (inline-array game-save-tag) a0-130) 0))) + (set! (-> a1-159 elt-type) (game-save-elt node-gem-count)) + (set! (-> a1-159 elt-count) v1-188) + (set! (-> a1-159 elt-size) (the-as uint 2)) + ) + (let ((a0-131 (+ (the-as int a0-130) 16))) + (dotimes (a1-160 v1-188) + (set! (-> (the-as (pointer uint16) (+ a0-131 (* a1-160 2))) 0) (-> obj sub-task-list a1-160 gem-count)) + ) + (let ((a0-132 (the-as object (+ a0-131 (logand -16 (+ (* v1-188 2) 15)))))) + (let ((a1-165 (-> (the-as (inline-array game-save-tag) a0-132) 0))) + (set! (-> a1-165 elt-type) (game-save-elt node-skill-count)) + (set! (-> a1-165 elt-count) v1-188) + (set! (-> a1-165 elt-size) (the-as uint 2)) + ) + (let ((a0-133 (+ (the-as int a0-132) 16))) + (dotimes (a1-166 v1-188) + (set! (-> (the-as (pointer uint16) (+ a0-133 (* a1-166 2))) 0) (-> obj sub-task-list a1-166 skill-count)) + ) + (let ((a0-134 (the-as object (+ a0-133 (logand -16 (+ (* v1-188 2) 15)))))) + (let ((a1-171 (-> (the-as (inline-array game-save-tag) a0-134) 0))) + (set! (-> a1-171 elt-type) (game-save-elt node-close-time)) + (set! (-> a1-171 elt-count) v1-188) + (set! (-> a1-171 elt-size) (the-as uint 8)) + ) + (let ((a0-135 (+ (the-as int a0-134) 16))) + (dotimes (a1-172 v1-188) + (set! (-> (the-as (pointer time-frame) (+ a0-135 (* a1-172 8))) 0) (-> obj sub-task-list a1-172 close-time)) + ) + (let ((a0-136 (the-as object (+ a0-135 (logand -16 (+ (* v1-188 8) 15))))) + (v1-194 (-> obj sub-task-list length)) + ) + (let ((a1-176 (-> (the-as (inline-array game-save-tag) a0-136) 0))) + (set! (-> a1-176 elt-type) (game-save-elt task-node-list)) + (set! (-> a1-176 elt-count) v1-194) + (set! (-> a1-176 elt-size) (the-as uint 1)) + ) + (let ((a0-137 (+ (the-as int a0-136) 16))) + (dotimes (a1-177 v1-194) + (set! (-> (the-as (pointer int8) (+ a0-137 a1-177)) 0) + (if (logtest? (-> obj sub-task-list a1-177 flags) (game-task-node-flag closed)) + 1 + 0 + ) + ) + ) + (let ((v1-197 (the-as object (+ a0-137 (logand -16 (+ v1-194 15)))))) + (let ((a0-139 (-> (the-as (inline-array game-save-tag) v1-197) 0))) + (set! (-> a0-139 elt-type) (game-save-elt sfx-volume)) + (set! (-> a0-139 elt-count) 0) + (set! (-> a0-139 user-float0) (-> *setting-control* user-default sfx-volume)) + ) + (let ((v1-198 (the-as object (+ (the-as int v1-197) 16)))) + (let ((a0-140 (-> (the-as (inline-array game-save-tag) v1-198) 0))) + (set! (-> a0-140 elt-type) (game-save-elt music-volume)) + (set! (-> a0-140 elt-count) 0) + (set! (-> a0-140 user-float0) (-> *setting-control* user-default music-volume)) + ) + (let ((v1-199 (the-as object (+ (the-as int v1-198) 16)))) + (let ((a0-141 (-> (the-as (inline-array game-save-tag) v1-199) 0))) + (set! (-> a0-141 elt-type) (game-save-elt dialog-volume)) + (set! (-> a0-141 elt-count) 0) + (set! (-> a0-141 user-float0) (-> *setting-control* user-default dialog-volume)) + ) + (let ((v1-200 (the-as object (+ (the-as int v1-199) 16)))) + (let ((a0-142 (-> (the-as (inline-array game-save-tag) v1-200) 0))) + (set! (-> a0-142 elt-type) (game-save-elt language)) + (set! (-> a0-142 elt-count) 0) + (set! (-> a0-142 user-uint64) (the-as uint (-> *setting-control* user-default language))) + ) + (let ((v1-201 (the-as object (+ (the-as int v1-200) 16)))) + (let ((a0-143 (-> (the-as (inline-array game-save-tag) v1-201) 0))) + (set! (-> a0-143 elt-type) (game-save-elt subtitle-language)) + (set! (-> a0-143 elt-count) 0) + (set! (-> a0-143 user-uint64) (the-as uint (-> *setting-control* user-default subtitle-language))) + ) + (let ((v1-202 (the-as object (+ (the-as int v1-201) 16)))) + (let ((a0-144 (-> (the-as (inline-array game-save-tag) v1-202) 0))) + (set! (-> a0-144 elt-type) (game-save-elt stereo-mode)) + (set! (-> a0-144 elt-count) 0) + (set! (-> a0-144 user-uint64) (the-as uint (-> *setting-control* user-default stereo-mode))) + ) + (let ((v1-203 (the-as object (+ (the-as int v1-202) 16)))) + (let ((a0-145 (-> (the-as (inline-array game-save-tag) v1-203) 0))) + (set! (-> a0-145 elt-type) (game-save-elt screenx)) + (set! (-> a0-145 elt-count) 0) + (set! (-> a0-145 user-float0) (the float (-> *setting-control* user-default display-dx))) + ) + (let ((v1-204 (the-as object (+ (the-as int v1-203) 16)))) + (let ((a0-146 (-> (the-as (inline-array game-save-tag) v1-204) 0))) + (set! (-> a0-146 elt-type) (game-save-elt screeny)) + (set! (-> a0-146 elt-count) 0) + (set! (-> a0-146 user-float0) (the float (-> *setting-control* user-default display-dy))) + ) + (let ((v1-205 (the-as object (+ (the-as int v1-204) 16)))) + (let ((a0-147 (-> (the-as (inline-array game-save-tag) v1-205) 0))) + (set! (-> a0-147 elt-type) (game-save-elt vibration)) + (set! (-> a0-147 elt-count) 0) + (set! (-> a0-147 user-uint64) (the-as uint (if (-> *setting-control* user-default vibration) + 1 + 0 + ) + ) + ) + ) + (let ((v1-206 (the-as object (+ (the-as int v1-205) 16)))) + (let ((a0-148 (-> (the-as (inline-array game-save-tag) v1-206) 0))) + (set! (-> a0-148 elt-type) (game-save-elt subtitle)) + (set! (-> a0-148 elt-count) 0) + (set! (-> a0-148 user-uint64) (the-as uint (if (-> *setting-control* user-default subtitle) + 1 + 0 + ) + ) + ) + ) + (let ((v1-207 (the-as object (+ (the-as int v1-206) 16)))) + (let ((a0-149 (-> (the-as (inline-array game-save-tag) v1-207) 0))) + (set! (-> a0-149 elt-type) (game-save-elt camera-stick-dir)) + (set! (-> a0-149 elt-count) 0) + (set! (-> a0-149 user-uint64) (the-as uint (if (-> *setting-control* user-default unknowng-symbol-00) + 1 + 0 + ) + ) + ) + ) + (let ((v1-208 (the-as object (+ (the-as int v1-207) 16)))) + (let ((a0-150 (-> (the-as (inline-array game-save-tag) v1-208) 0))) + (set! (-> a0-150 elt-type) (game-save-elt play-hints)) + (set! (-> a0-150 elt-count) 0) + (set! (-> a0-150 user-uint64) (the-as uint (if (-> *setting-control* user-default play-hints) + 1 + 0 + ) + ) + ) + ) + (let ((v1-209 (the-as object (+ (the-as int v1-208) 16)))) + (let ((a0-151 (-> (the-as (inline-array game-save-tag) v1-209) 0))) + (set! (-> a0-151 elt-type) (game-save-elt video-mode)) + (set! (-> a0-151 elt-count) 0) + (let ((a1-220 (-> *setting-control* user-default video-mode))) + (set! (-> a0-151 user-uint64) (the-as uint (cond + ((= a1-220 'ntsc) + 1 + ) + ((= a1-220 'pal) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + ) + (let ((v1-210 (the-as object (+ (the-as int v1-209) 16)))) + (let ((a0-152 (-> (the-as (inline-array game-save-tag) v1-210) 0))) + (set! (-> a0-152 elt-type) (game-save-elt aspect-ratio)) + (set! (-> a0-152 elt-count) 0) + (let ((a1-224 (-> *setting-control* user-default aspect-ratio))) + (set! (-> a0-152 user-uint64) (the-as uint (cond + ((= a1-224 'aspect4x3) + 1 + ) + ((= a1-224 'aspect16x9) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + ) + (set! (-> arg0 length) (- (+ (the-as int v1-210) 16) (the-as int (the-as pointer (-> arg0 tag))))) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (if (< (-> arg0 allocated-length) (-> arg0 length)) + (format + 0 + "ERROR: SAVEGAME: fatal error, save is using ~D of ~D bytes." + (-> arg0 length) + (-> arg0 allocated-length) + ) + ) + arg0 + ) + ) + +(defmethod load-game game-info ((obj game-info) (arg0 game-save)) + (let ((v1-0 (the-as object (-> arg0 tag)))) + (while (< (the-as int v1-0) (the-as int (&-> arg0 tag 0 user-int8 (-> arg0 length)))) + (case (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-type) + (((game-save-elt sfx-volume)) + (set! (-> *setting-control* user-default sfx-volume) + (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ) + ) + (((game-save-elt music-volume)) + (set! (-> *setting-control* user-default music-volume) + (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ) + ) + (((game-save-elt dialog-volume)) + (set! (-> *setting-control* user-default dialog-volume) + (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ) + ) + (((game-save-elt language)) + (set! (-> *setting-control* user-default language) + (the-as language-enum (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) + ) + ) + (((game-save-elt subtitle-language)) + (set! (-> *setting-control* user-default subtitle-language) + (the-as language-enum (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) + ) + ) + (((game-save-elt stereo-mode)) + (set! (-> *setting-control* user-default stereo-mode) + (the-as int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) + ) + ) + (((game-save-elt vibration)) + (set! (-> *setting-control* user-default vibration) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt subtitle)) + (set! (-> *setting-control* user-default subtitle) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt camera-stick-dir)) + (set! (-> *setting-control* user-default unknowng-symbol-00) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt play-hints)) + (set! (-> *setting-control* user-default play-hints) + (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ) + ) + (((game-save-elt screenx)) + (set! (-> *setting-control* user-default display-dx) + (the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)) + ) + ) + (((game-save-elt screeny)) + (set! (-> *setting-control* user-default display-dy) + (the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)) + ) + ) + ) + (set! v1-0 (&+ + (the-as pointer v1-0) + (logand -16 (+ (* (the-as int (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-size)) + (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-count) + ) + 31 + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> arg0 new-game)) + (case (-> arg0 new-game) + ((2) + (logior! (-> *game-info* secrets) (game-secrets hero-mode)) + (logior! (-> *game-info* purchase-secrets) (game-secrets hero-mode)) + ) + ) + (set-continue! obj "game-start" #f) + (set! arg0 arg0) + (goto cfg-230) + ) + (let ((s4-0 (the-as object (-> arg0 tag))) + (s3-0 (new 'stack-no-clear 'array 'uint16 512)) + ) + (dotimes (v1-14 512) + (set! (-> s3-0 v1-14) (the-as uint -1)) + ) + (while (< (the-as int s4-0) (the-as int (&-> arg0 tag 0 user-int8 (-> arg0 length)))) + (case (-> (the-as game-save-tag s4-0) elt-type) + (((game-save-elt node-name)) + (dotimes (s2-0 (-> (the-as game-save-tag s4-0) elt-count)) + (dotimes (s1-0 (-> obj sub-task-list length)) + (let ((v1-20 (-> obj sub-task-list s1-0))) + (when (string-charp= (-> v1-20 name) (the-as (pointer uint8) (+ (+ (* s2-0 64) 16) (the-as int s4-0)))) + (set! (-> s3-0 s2-0) (the-as uint s1-0)) + (goto cfg-45) + ) + ) + ) + (label cfg-45) + ) + ) + (((game-save-elt base-time)) + ) + (((game-save-elt game-time)) + (load! (-> *display* game-clock) (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1))) + (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) + ) + (((game-save-elt total-game-time)) + (load! + (-> *display* total-game-clock) + (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1)) + ) + (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) + ) + (((game-save-elt continue)) + (format (clear *temp-string*) "~G" (-> (the-as (inline-array game-save-tag) s4-0) 1)) + (set-continue! obj *temp-string* #f) + ) + (((game-save-elt life)) + (set! (-> obj life) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt buzzer-total)) + (set! (-> obj buzzer-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt fuel-cell)) + (set! (-> obj fuel) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt death-movie-tick)) + (set! (-> obj death-movie-tick) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt skill)) + (set! (-> obj skill) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt skill-total)) + (set! (-> obj skill-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt gem)) + (set! (-> obj gem) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt gem-total)) + (set! (-> obj gem-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt karma)) + (set! (-> obj karma) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt eco-pill-dark)) + (set! (-> obj eco-pill-dark) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt eco-pill-dark-total)) + (set! (-> obj eco-pill-dark-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt shield)) + (set! (-> obj shield) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt features)) + (set! (-> obj features) (the-as game-feature (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt secrets)) + (set! (-> obj secrets) (the-as game-secrets (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt purchase-secrets)) + (set! (-> obj purchase-secrets) + (the-as game-secrets (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt gun-type)) + (set! (-> obj gun-type) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt gun-ammo)) + (let ((v1-67 (min 4 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-89 v1-67) + (set! (-> obj gun-ammo a0-89) + (the-as float (-> (the-as (inline-array game-save-tag) s4-0) 1 user-object a0-89)) + ) + ) + ) + ) + (((game-save-elt money)) + (set! (-> obj money) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt money-total)) + (set! (-> obj money-total) (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) + ) + (((game-save-elt level-open-list)) + (let ((v1-73 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-97 v1-73) + (set! (-> obj level-opened a0-97) + (-> (the-as (pointer uint8) (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s4-0) 1)) a0-97))) + ) + ) + ) + ) + (((game-save-elt perm-list)) + (let ((s2-3 (min (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) (-> obj perm-list allocated-length)))) + (set! (-> obj perm-list length) s2-3) + (dotimes (s1-1 s2-3) + (mem-copy! + (the-as pointer (-> obj perm-list data s1-1)) + (the-as pointer (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s1-1 16))) + 16 + ) + ) + ) + ) + (((game-save-elt task-list)) + (let ((s2-5 + (min (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) (-> obj task-perm-list allocated-length)) + ) + ) + (set! (-> obj task-perm-list length) s2-5) + (dotimes (s1-2 s2-5) + (mem-copy! + (the-as pointer (-> obj task-perm-list data s1-2)) + (the-as pointer (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s1-2 16))) + 16 + ) + ) + ) + ) + (((game-save-elt talker-state)) + (let ((v1-95 (-> obj unknown-pad6 allocated-length)) + (a0-108 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + ) + (dotimes (a1-57 v1-95) + (cond + ((>= a1-57 a0-108) + (set! (-> obj unknown-pad6 a1-57) (the-as uint 0)) + 0 + ) + (else + (set! (-> obj unknown-pad6 a1-57) (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a1-57)) + ) + ) + ) + ) + ) + (((game-save-elt scores)) + (let ((v1-99 (-> obj game-score allocated-length)) + (a0-111 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + ) + (dotimes (a1-58 v1-99) + (if (>= a1-58 a0-111) + (set! (-> obj game-score a1-58) 0.0) + (set! (-> obj game-score a1-58) + (the-as float (-> (the-as (inline-array game-save-tag) s4-0) 1 user-object a1-58)) + ) + ) + ) + ) + ) + (((game-save-elt bigmap-data)) + (initialize *bigmap*) + (let ((v1-104 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (set! (-> *bigmap* compressed-next-index) (the-as uint v1-104)) + (dotimes (a0-116 v1-104) + (set! (-> (the-as (pointer uint8) (+ (-> *bigmap* compressed-data) a0-116)) 0) + (-> (the-as (pointer uint8) (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s4-0) 1)) a0-116))) + ) + ) + ) + ) + (((game-save-elt bigmap-offsets)) + (let ((a1-62 20) + (v1-107 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) + (a0-120 (-> *bigmap* compressed-data)) + ) + (cond + ((= a1-62 v1-107) + (dotimes (a1-63 v1-107) + (let ((a2-27 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-object a1-63))) + (if (< (the-as int a2-27) 0) + (set! (-> *bigmap* compressed-masks a1-63) (the-as uint #f)) + (set! (-> *bigmap* compressed-masks a1-63) (the-as uint (+ a0-120 (the-as uint a2-27)))) + ) + ) + ) + ) + (else + (initialize *bigmap*) + ) + ) + ) + ) + (((game-save-elt auto-save-count)) + (set! (-> obj auto-save-count) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt total-deaths)) + (set! (-> obj total-deaths) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt total-trys)) + (set! (-> obj total-trys) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt continue-deaths)) + (set! (-> obj continue-deaths) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt task-deaths)) + (set! (-> obj task-deaths) (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt game-start-time)) + (set! (-> obj game-start-time) + (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt continue-time)) + (set! (-> obj continue-time) + (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt death-time)) + (set! (-> obj death-time) (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt hit-time)) + (set! (-> obj hit-time) (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64))) + ) + (((game-save-elt task-pickup-time)) + (set! (-> obj task-pickup-time) + (the-as time-frame (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) + ) + ) + (((game-save-elt enter-level-time)) + (let ((v1-123 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-145 v1-123) + (set! (-> obj task-enter-times a0-145) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-145 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt in-level-time)) + (let ((v1-127 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-149 v1-127) + (set! (-> obj task-in-times a0-149) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-149 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-complete-time)) + (let ((v1-131 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-153 v1-131) + (set! (-> obj unknown-array1 a0-153) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-153 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-start-time)) + (let ((v1-135 (min 32 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)))) + (dotimes (a0-157 v1-135) + (set! (-> obj task-close-times a0-157) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-157 8))) + ) + ) + ) + ) + ) + ) + (((game-save-elt task-node-list)) + (let ((s2-6 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (s1-3 s2-6) + (if (and (nonzero? (-> (the-as (pointer uint8) (&+ (the-as pointer (-> (the-as (inline-array game-save-tag) s4-0) 1)) s1-3))) + ) + (>= (-> (the-as (pointer int16) (&+ s3-0 (* s1-3 2)))) 0) + ) + (close! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* s1-3 2))))) 'event) + ) + ) + ) + ) + (((game-save-elt node-death-count)) + (let ((v1-155 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-164 v1-155) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-164 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-164 2)))) death-count) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a0-164) + ) + ) + ) + ) + ) + (((game-save-elt node-gem-count)) + (let ((v1-158 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-167 v1-158) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-167 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-167 2)))) gem-count) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a0-167) + ) + ) + ) + ) + ) + (((game-save-elt node-skill-count)) + (let ((v1-161 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-170 v1-161) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-170 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-170 2)))) skill-count) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 a0-170) + ) + ) + ) + ) + ) + (((game-save-elt node-close-time)) + (let ((v1-165 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count))) + (dotimes (a0-172 v1-165) + (if (>= (-> (the-as (pointer int16) (&+ s3-0 (* a0-172 2)))) 0) + (set! (-> obj sub-task-list (-> (the-as (pointer int16) (&+ s3-0 (* a0-172 2)))) close-time) + (the-as + time-frame + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* a0-172 8))) + ) + ) + ) + ) + ) + ) + ) + ) + (set! s4-0 (&+ + (the-as pointer s4-0) + (logand -16 (+ (* (the-as int (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) + ) + 31 + ) + ) + ) + ) + ) + ) + (dotimes (s4-1 (-> *level* length)) + (let ((a1-106 (-> *level* level s4-1))) + (if (= (-> a1-106 status) 'active) + (copy-perms-to-level! obj a1-106) + ) + ) + ) + (label cfg-230) + arg0 + ) + +(defmethod save-to-file game-save ((obj game-save) (arg0 string)) + (let ((s5-0 (new 'stack 'file-stream arg0 'write))) + (file-stream-write s5-0 (&-> obj type) (+ (-> obj type size) (-> obj length))) + (file-stream-close s5-0) + ) + obj + ) + +(defmethod load-from-file game-save ((obj game-save) (arg0 string)) + (let ((s5-0 (new 'stack 'file-stream arg0 'read))) + (let ((s3-0 (file-stream-length s5-0)) + (s4-0 (-> obj allocated-length)) + ) + (cond + ((>= (asize-of obj) s3-0) + (cond + ((= (file-stream-read s5-0 (&-> obj type) s3-0) s3-0) + (set! (-> obj type) game-save) + ) + (else + (format 0 "ERROR: SAVEGAME: save file ~A did not read correctly.~%" s5-0) + (set! (-> obj length) 0) + 0 + ) + ) + ) + (else + (format 0 "ERROR: SAVEGAME: save file ~A is too big~%" s5-0) + ) + ) + (set! (-> obj allocated-length) s4-0) + ) + (when (!= (-> obj version) 3) + (format 0 "ERROR: SAVEGAME: save file ~A was version ~d, but only ~d is supported.~%" s5-0 (-> obj version) 3) + (set! (-> obj length) 0) + 0 + ) + (file-stream-close s5-0) + ) + obj + ) + +(define *auto-save-info* (new 'global 'mc-slot-info)) + +(deftype auto-save (process) + ((card int32 :offset-assert 128) + (slot int32 :offset-assert 132) + (which int32 :offset-assert 136) + (buffer kheap :offset-assert 140) + (mode symbol :offset-assert 144) + (result mc-status-code :offset-assert 148) + (save game-save :offset-assert 152) + (info mc-slot-info :inline :offset-assert 156) + (notify handle :offset-assert 456) + (force symbol :offset-assert 464) + (state-time time-frame :offset-assert 472) + (icon hud-sprite :inline :offset-assert 480) + ) + :heap-base #x1a0 + :method-count-assert 23 + :size-assert #x214 + :flag-assert #x1701a00214 + (:methods + (get-heap () _type_ :state 14) + (get-card () _type_ :state 15) + (format-card () _type_ :state 16) + (unformat-card () _type_ :state 17) + (create-file () _type_ :state 18) + (save () _type_ :state 19) + (restore () _type_ :state 20) + (error (mc-status-code) _type_ :state 21) + (done () _type_ :state 22) + ) + ) + +(defmethod inspect auto-save ((obj auto-save)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~2Tcard: ~D~%" (-> obj card)) + (format #t "~2Tslot: ~D~%" (-> obj slot)) + (format #t "~2Twhich: ~D~%" (-> obj which)) + (format #t "~2Tbuffer: #~%" (-> obj buffer)) + (format #t "~2Tmode: ~A~%" (-> obj mode)) + (format #t "~2Tresult: ~D~%" (-> obj result)) + (format #t "~2Tsave: ~A~%" (-> obj save)) + (format #t "~2Tinfo: #~%" (-> obj info)) + (format #t "~2Tnotify: ~D~%" (-> obj notify)) + (format #t "~2Tforce: ~A~%" (-> obj force)) + (format #t "~2Tstate-time: ~D~%" (-> obj state-time)) + (format #t "~2Ticon: #~%" (-> obj icon)) + (label cfg-4) + obj + ) + +(defbehavior auto-save-post auto-save () + (when (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) + (let ((gp-0 (new + 'stack + 'font-context + *font-default-matrix* + 32 + 320 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-5 gp-0)) + (set! (-> v1-5 width) (the float (the-as float #x1b8))) + ) + (let ((v1-6 gp-0)) + (set! (-> v1-6 height) (the float (the-as float #x50))) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning)) + (format (clear *temp-string*) "~S / ~S ~D~%" (-> self mode) (-> self state name) (-> self which)) + (print-game-text *temp-string* gp-0 #f 44 320) + ) + ) + (when (and (= (-> self mode) 'auto-save) (not (and (-> self next-state) (= (-> self next-state name) 'done)))) + (let ((gp-1 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 80 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-17 gp-1)) + (set! (-> v1-17 scale) 0.8) + ) + (let ((v1-18 gp-1)) + (set! (-> v1-18 width) (the float (the-as float #x1b0))) + ) + (let ((v1-19 gp-1)) + (set! (-> v1-19 height) (the float (the-as float #x14))) + ) + (set! (-> gp-1 flags) (font-flags shadow kerning middle left large)) + (when (and (>= 1 (-> *game-info* auto-save-count)) (-> self next-state) (= (-> self next-state name) 'save)) + (print-game-text (lookup-text! *common-text* (game-text-id text-x19f) #f) gp-1 #f 44 320) + (set! (-> gp-1 origin x) 20.0) + (set! (-> gp-1 origin y) 130.0) + (let ((v1-30 gp-1)) + (set! (-> v1-30 scale) 0.7) + ) + (let ((v1-31 gp-1)) + (set! (-> v1-31 height) (the float (the-as float #xc8))) + ) + (let ((s5-2 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id progress-memcard-dont-remove) #f) 1) + (s5-2 *temp-string* gp-1 #f 44 320) + ) + ) + ) + (when (< (mod (-> *display* real-clock frame-counter) 300) 270) + (with-dma-buffer-add-bucket ((s5-3 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id bucket-320) + ) + (hud-sprite-method-9 (-> self icon) s5-3 (-> self level)) + ) + ) + ) + ) + +auto-save-post + +(defbehavior auto-save-init-by-other auto-save ((arg0 symbol) (arg1 process) (arg2 int) (arg3 int) (arg4 symbol)) + (when (handle->process (-> *game-info* auto-save-proc)) + (send-event arg1 'notify 'error 16) + (return #f) + ) + (set! (-> *game-info* auto-save-proc) (process->handle self)) + (set! (-> *game-info* auto-save-status) (mc-status-code ok)) + (stack-size-set! (-> self main-thread) 512) + (logclear! (-> self mask) (process-mask freeze pause menu progress)) + (set! (-> self card) arg2) + (set! (-> self which) arg3) + (set! (-> self buffer) #f) + (set! (-> self mode) arg0) + (set! (-> self result) (mc-status-code ok)) + (set! (-> self save) #f) + (set! (-> self notify) (process->handle arg1)) + (set! (-> self force) arg4) + (cond + ((= arg0 'auto-save) + (if (not (-> *setting-control* user-current auto-save)) + (go-virtual error (mc-status-code no-auto-save)) + ) + (when (and (zero? (-> self card)) (-> *setting-control* user-current auto-save)) + (set! (-> self card) (-> *game-info* auto-save-card)) + (set! (-> self which) (-> *game-info* auto-save-which)) + ) + (set-setting! 'allow-pause #f 0 0) + (apply-settings *setting-control*) + ) + ((= arg0 'error) + (set! (-> *setting-control* user-default auto-save) #f) + (go-virtual error (mc-status-code no-card)) + ) + ) + (set! (-> *setting-control* user-default auto-save) #f) + (set-vector! (-> self icon color) 128 128 128 128) + (set! (-> self icon pos x) 440) + (set! (-> self icon pos y) 200) + (set! (-> self icon pos z) #xffffff) + (set! (-> self icon pos w) 0) + (set! (-> self icon scale-x) 2.0) + (set! (-> self icon scale-y) 2.0) + (set! (-> self icon angle) 0.0) + (set! (-> self icon flags) (the-as uint 0)) + (set! (-> self icon tex) (lookup-texture-by-id (new 'static 'texture-id :index #x48 :page #x67a))) + (go-virtual get-heap) + ) + +(defstate get-heap (auto-save) + :virtual #t + :code (behavior () + (case (-> self mode) + (('auto-save) + (when (zero? (-> *game-info* auto-save-count)) + (set! (-> self event-hook) (-> (method-of-object self error) event)) + (set! (-> self post-hook) #f) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + (while (< (- (-> *display* real-clock frame-counter) (-> self state-time)) (seconds 0.2)) + (if (not (progress-allowed?)) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + ) + (suspend) + ) + (activate-progress *dproc* 'icon-info) + (while *progress-process* + (suspend) + ) + (set! (-> self event-hook) #f) + ) + (+! (-> *game-info* auto-save-count) 1) + ) + ) + (while (or (< (-> *display* base-clock frame-counter) (-> *game-info* blackout-time)) + (!= (-> *setting-control* user-current bg-a) 0.0) + (!= (-> *setting-control* user-current bg-a-force) 0.0) + ) + (suspend) + ) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + (let ((a0-9 (reserve-alloc *art-control*))) + (while (not a0-9) + (if (>= (- (-> *display* real-clock frame-counter) (-> self state-time)) (seconds 60)) + (go-virtual error (mc-status-code no-memory)) + ) + (suspend) + (set! a0-9 (reserve-alloc *art-control*)) + ) + (set! (-> self buffer) a0-9) + ) + (format #t "got buffer #x~X~%" (-> self buffer base)) + (go-virtual get-card) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate get-card (auto-save) + :virtual #t + :code (behavior () + (label cfg-0) + (mc-get-slot-info (-> self slot) (-> self info)) + (when (zero? (-> self info known)) + (suspend) + (goto cfg-0) + ) + (cond + ((zero? (-> self info handle)) + (go-virtual error (mc-status-code no-card)) + ) + ((zero? (-> self card)) + (set! (-> self card) (-> self info handle)) + ) + ((!= (-> self info handle) (-> self card)) + (go-virtual error (mc-status-code bad-handle)) + ) + ) + (case (-> self mode) + (('save 'auto-save) + (if (-> self force) + (go-virtual format-card) + (go-virtual save) + ) + ) + (('save-last) + (set! (-> self which) (-> self info last-file)) + (if (= (-> self which) -1) + (go-virtual error (mc-status-code no-last)) + (go-virtual save) + ) + ) + (('restore) + (go-virtual restore) + ) + (('format-card) + (go-virtual format-card) + ) + (('unformat-card) + (go-virtual unformat-card) + ) + (('create-file) + (go-virtual create-file) + ) + (else + (go-virtual done) + ) + ) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate format-card (auto-save) + :virtual #t + :code (behavior () + (b! (nonzero? (-> self info formatted)) cfg-11 :delay (empty-form)) + (label cfg-1) + (set! (-> self result) (mc-format (-> self card))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-1) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (let ((v1-4 (-> self result))) + (b! (nonzero? v1-4) cfg-5 :delay (nop!)) + (b! #t cfg-10 :delay (nop!)) + (label cfg-5) + (b! (= v1-4 (mc-status-code format-failed)) cfg-1 :delay (nop!)) + (nop!) + (if (= v1-4 (mc-status-code ok)) + (goto cfg-11) + (go-virtual error (-> self result)) + ) + ) + (label cfg-10) + (suspend) + ) + #f + (label cfg-11) + (case (-> self mode) + (('create-file 'save 'save-last 'auto-save 'restore) + (label cfg-21) + (mc-get-slot-info (-> self slot) (-> self info)) + (when (zero? (-> self info known)) + (suspend) + (goto cfg-21) + ) + (go-virtual create-file) + ) + ) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate unformat-card (auto-save) + :virtual #t + :code (behavior () + (when (nonzero? (-> self info formatted)) + (label cfg-1) + (set! (-> self result) (mc-unformat (-> self card))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-1) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (case (-> self result) + (((mc-status-code busy)) + ) + (((mc-status-code ok)) + (goto cfg-10) + ) + (else + (go-virtual error (-> self result)) + ) + ) + (suspend) + ) + #f + ) + (label cfg-10) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate create-file (auto-save) + :virtual #t + :code (behavior () + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (if (< (-> self info mem-actual) (-> self info mem-required)) + (go-virtual error (mc-status-code no-space)) + ) + (let ((v1-12 (-> self buffer))) + (set! (-> v1-12 current) (-> v1-12 base)) + ) + (label cfg-6) + (set! (-> self result) (mc-create-file (-> self card) (the-as uint (-> self buffer base)))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-6) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (case (-> self result) + (((mc-status-code busy)) + ) + (((mc-status-code ok)) + (goto cfg-15) + ) + (else + (go-virtual error (-> self result)) + ) + ) + (suspend) + ) + #f + ) + ) + (label cfg-15) + (case (-> self mode) + (('restore) + (go-virtual restore) + ) + (('save 'save-last 'auto-save) + (label cfg-23) + (mc-get-slot-info (-> self slot) (-> self info)) + (when (zero? (-> self info known)) + (suspend) + (goto cfg-23) + ) + (go-virtual save) + ) + ) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate save (auto-save) + :virtual #t + :code (behavior () + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (go-virtual error (mc-status-code no-file)) + ) + ) + (let ((v1-10 (-> self buffer))) + (set! (-> v1-10 current) (-> v1-10 base)) + ) + (let ((gp-0 (the-as object loading-level))) + (set! loading-level (-> self buffer)) + (set! (-> self save) (new 'loading-level 'game-save #x20000)) + (save-game *game-info* (-> self save) "save") + (set! loading-level (the-as kheap gp-0)) + 0 + (label cfg-5) + (set! (-> self result) + (mc-save (-> self card) (-> self which) (&-> (-> self save) type) (the-as int (-> self save info-int32))) + ) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-5) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (let ((v1-20 (-> self result))) + (set! gp-0 (cond + ((= v1-20 (mc-status-code busy)) + #f + ) + ((= v1-20 (mc-status-code ok)) + (goto cfg-18) + gp-0 + ) + ((= v1-20 (mc-status-code write-error)) + (suspend) + gp-0 + ) + (else + (case (-> self mode) + (('auto-save) + (seekl! (-> *game-info* auto-save-count) 0 1) + ) + ) + (go-virtual error (-> self result)) + ) + ) + ) + ) + (suspend) + ) + ) + #f + (label cfg-18) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate restore (auto-save) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('progress-allowed?) + #t + ) + (('done) + (go-virtual done) + ) + ) + ) + :code (behavior () + (local-vars (gp-0 object)) + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (go-virtual error (mc-status-code no-file)) + ) + ) + (let ((v1-10 (-> self buffer))) + (set! (-> v1-10 current) (-> v1-10 base)) + ) + (if (zero? (-> self info file (-> self which) present)) + (go-virtual error (mc-status-code no-save)) + ) + (label cfg-6) + (set! (-> self result) (mc-load (-> self card) (-> self which) (-> self buffer base))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-6) + ) + (until #f + (set! (-> self result) (mc-check-result)) + (let ((v1-22 (-> self result))) + (set! gp-0 (cond + ((= v1-22 (mc-status-code busy)) + #f + ) + ((= v1-22 (mc-status-code ok)) + (goto cfg-19) + gp-0 + ) + ((= v1-22 (mc-status-code read-error)) + (suspend) + gp-0 + ) + ((= v1-22 (mc-status-code new-game)) + (go-virtual error (mc-status-code no-save)) + ) + (else + (go-virtual error (-> self result)) + ) + ) + ) + ) + (suspend) + ) + #f + (label cfg-19) + (set! (-> self save) (the-as game-save (&+ (-> self buffer base) 4))) + (let ((v1-34 (-> self save))) + (set! (-> v1-34 type) game-save) + (if (!= (-> v1-34 version) 3) + (go-virtual error (mc-status-code bad-version)) + ) + ) + (set-setting! 'music-volume 'abs 0 0) + (set-setting! 'sfx-volume 'abs 0 0) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (-> self save) (the-as string #f)) + (set-master-mode 'game) + (add-setting! 'process-mask 'set 0 (process-mask progress)) + (apply-settings *setting-control*) + (sleep-code) + (go-virtual done) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate error (auto-save) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (cond + ((= v1-0 'progress-allowed?) + #t + ) + ((= v1-0 'die) + (deactivate self) + ) + ) + ) + ) + ) + :code (behavior ((arg0 mc-status-code)) + (if (-> self buffer) + (reserve-free *art-control* (-> self buffer)) + ) + (set! (-> self result) arg0) + (let ((s5-0 *auto-save-info*)) + (mem-copy! (the-as pointer s5-0) (the-as pointer (-> self info)) 300) + (send-event (handle->process (-> self notify)) 'notify 'error (-> self result) s5-0) + ) + (let ((t9-3 format) + (a0-8 #t) + (a1-3 "SAVE ERROR: ~A~%") + (v1-13 (-> self result)) + ) + (t9-3 a0-8 a1-3 (cond + ((= v1-13 (mc-status-code bad-version)) + "bad-version" + ) + ((= v1-13 (mc-status-code no-save)) + "no-save" + ) + ((= v1-13 (mc-status-code no-last)) + "no-last" + ) + ((= v1-13 (mc-status-code no-space)) + "no-space" + ) + ((= v1-13 (mc-status-code internal-error)) + "internal-error" + ) + ((= v1-13 (mc-status-code no-memory)) + "no-memory" + ) + ((= v1-13 (mc-status-code bad-handle)) + "bad-handle" + ) + ((= v1-13 (mc-status-code busy)) + "busy" + ) + ((= v1-13 (mc-status-code write-error)) + "write-error" + ) + ((= v1-13 (mc-status-code read-error)) + "read-error" + ) + ((= v1-13 (mc-status-code no-card)) + "no-card" + ) + ((= v1-13 (mc-status-code no-format)) + "no-format" + ) + ((= v1-13 (mc-status-code ok)) + "ok" + ) + ((= v1-13 (mc-status-code no-process)) + "no-process" + ) + ((= v1-13 (mc-status-code no-auto-save)) + "no-auto-save" + ) + ((= v1-13 (mc-status-code no-file)) + "no-file" + ) + ((= v1-13 (mc-status-code format-failed)) + "format-failed" + ) + ((= v1-13 (mc-status-code new-game)) + "new-game" + ) + (else + "*unknown*" + ) + ) + ) + ) + (if (= (-> self result) (mc-status-code no-auto-save)) + (return #f) + ) + (case (-> self mode) + (('auto-save 'error) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + (set! (-> *game-info* auto-save-status) arg0) + (while (< (- (-> *display* real-clock frame-counter) (-> self state-time)) (seconds 0.2)) + (if (not (progress-allowed?)) + (set! (-> self state-time) (-> *display* real-clock frame-counter)) + ) + (suspend) + ) + (if (= arg0 (mc-status-code no-card)) + (activate-progress *dproc* 'card-removed) + (activate-progress *dproc* 'error-auto-saving) + ) + ) + ) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defstate done (auto-save) + :virtual #t + :code (behavior () + (if (and (-> self buffer) + (or (-> *art-control* reserve-buffer) (nonzero? (-> *art-control* dma-reserve-buffer-count))) + ) + (reserve-free *art-control* (-> self buffer)) + ) + (set! (-> *game-info* auto-save-status) (mc-status-code ok)) + (case (-> self mode) + (('save 'save-last 'auto-save 'restore) + (set! (-> *setting-control* user-default auto-save) #t) + (set! (-> *game-info* auto-save-card) (-> self card)) + (set! (-> *game-info* auto-save-which) (-> self which)) + ) + ) + (case (-> self mode) + (('auto-save) + ) + (else + (set! (-> *game-info* auto-save-proc) (the-as handle #f)) + ) + ) + (let ((gp-0 *auto-save-info*)) + (mem-copy! (the-as pointer gp-0) (the-as pointer (-> self info)) 300) + (send-event (handle->process (-> self notify)) 'notify 'done 1 gp-0) + ) + (none) + ) + :post (the-as (function none :behavior auto-save) auto-save-post) + ) + +(defun auto-save-command ((arg0 symbol) (arg1 int) (arg2 int) (arg3 process-tree) (arg4 symbol)) + (format #t "AUTO SAVE COMMAND ~S~%" arg0) + (process-spawn auto-save arg0 arg3 arg1 arg2 arg4 :to *target-pool* :stack *kernel-dram-stack*) + ) + +(defun auto-save-check () + (when (and (-> *setting-control* user-current auto-save) (not (handle->process (-> *game-info* auto-save-proc)))) + (mc-get-slot-info 0 *auto-save-info*) + (if (and (nonzero? (-> *auto-save-info* known)) + (or (zero? (-> *auto-save-info* handle)) (!= (-> *auto-save-info* handle) (-> *game-info* auto-save-card))) + ) + (auto-save-command 'error 0 0 *default-pool* #f) + ) + ) + 0 + ) + +(defun auto-save-user () + (case *kernel-boot-message* + (('play 'preview) + (auto-save-command 'auto-save 0 0 *default-pool* #f) + ) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc index fa5c836f95..837e83387a 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc @@ -1,7 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition of type sprite-header (deftype sprite-header (structure) ((header qword 1 :inline :offset-assert 0) (num-sprites int32 :offset 0) @@ -11,7 +9,6 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type sprite-header (defmethod inspect sprite-header ((obj sprite-header)) (when (not obj) (set! obj obj) @@ -24,14 +21,11 @@ obj ) -;; definition for function sprite-setup-header -;; WARN: Return type mismatch int vs none. (defun sprite-setup-header ((hdr sprite-header) (num-sprites int)) (set! (-> hdr num-sprites) num-sprites) (none) ) -;; definition of type sprite-hvdf-data (deftype sprite-hvdf-data (structure) ((data qword 76 :inline :offset-assert 0) ) @@ -40,7 +34,6 @@ :flag-assert #x9000004c0 ) -;; definition for method 3 of type sprite-hvdf-data (defmethod inspect sprite-hvdf-data ((obj sprite-hvdf-data)) (when (not obj) (set! obj obj) @@ -52,7 +45,6 @@ obj ) -;; definition of type sprite-hvdf-control (deftype sprite-hvdf-control (structure) ((alloc int8 76 :offset-assert 0) ) @@ -61,7 +53,6 @@ :flag-assert #x90000004c ) -;; definition for method 3 of type sprite-hvdf-control (defmethod inspect sprite-hvdf-control ((obj sprite-hvdf-control)) (when (not obj) (set! obj obj) @@ -73,7 +64,6 @@ obj ) -;; definition of type sprite-aux-elem (deftype sprite-aux-elem (structure) ((aux-type sprite-aux-type :offset-assert 0) (data vector 3 :offset-assert 4) @@ -87,7 +77,6 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type sprite-aux-elem (defmethod inspect sprite-aux-elem ((obj sprite-aux-elem)) (when (not obj) (set! obj obj) @@ -103,7 +92,6 @@ obj ) -;; definition of type sprite-aux-list (deftype sprite-aux-list (basic) ((num-entries int32 :offset-assert 4) (entry int32 :offset-assert 8) @@ -117,8 +105,6 @@ ) ) -;; definition for method 3 of type sprite-aux-list -;; INFO: this function exists in multiple non-identical object files (defmethod inspect sprite-aux-list ((obj sprite-aux-list)) (when (not obj) (set! obj obj) @@ -132,7 +118,6 @@ obj ) -;; definition for method 0 of type sprite-aux-list (defmethod new sprite-aux-list ((allocation symbol) (type-to-make type) (size int)) (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* size 16)))))) (set! (-> v0-0 num-entries) size) @@ -141,9 +126,6 @@ ) ) -;; definition for method 3 of type sprite-aux-list -;; INFO: this function exists in multiple non-identical object files -;; WARN: Return type mismatch symbol vs sprite-aux-list. (defmethod inspect sprite-aux-list ((obj sprite-aux-list)) (format #t "[~X] sprite-aux-list:~%" obj) (format #t "~Tnum-entries: ~D~%" (-> obj num-entries)) @@ -154,16 +136,12 @@ (the-as sprite-aux-list #f) ) -;; definition for function clear-sprite-aux-list -;; WARN: Return type mismatch int vs none. (defun clear-sprite-aux-list () (set! (-> *sprite-aux-list* entry) 0) 0 (none) ) -;; definition for function add-to-sprite-aux-list -;; WARN: Return type mismatch int vs none. (defun add-to-sprite-aux-list ((system sparticle-system) (sprite-info sparticle-cpuinfo) (sprite-vec sprite-vec-data-3d) (arg3 uint)) (let ((s2-0 (-> sprite-info sp-func))) (if (and (nonzero? s2-0) (not (paused?))) @@ -198,7 +176,6 @@ (none) ) -;; definition of type sprite-frame-data (deftype sprite-frame-data (structure) ((cdata vector 16 :inline :offset 0) (xy-array vector 8 :inline :offset 0) @@ -238,7 +215,6 @@ :flag-assert #x9000002a0 ) -;; definition for method 3 of type sprite-frame-data (defmethod inspect sprite-frame-data ((obj sprite-frame-data)) (when (not obj) (set! obj obj) @@ -283,9 +259,6 @@ obj ) -;; definition for function sprite-setup-frame-data -;; INFO: Used lq/sq -;; WARN: Return type mismatch float vs none. (defun sprite-setup-frame-data ((data sprite-frame-data) (tbp-offset uint)) (set! (-> data hmge-scale quad) (-> *math-camera* hmge-scale quad)) (set! (-> data inv-hmge-scale quad) (-> *math-camera* inv-hmge-scale quad)) @@ -449,10 +422,8 @@ (none) ) -;; definition for symbol sprite-vu1-block, type vu-function (define sprite-vu1-block (new 'static 'vu-function :length #x35f :qlength #x1b0)) -;; definition for method 0 of type sprite-array-2d (defmethod new sprite-array-2d ((allocation symbol) (type-to-make type) (group-0-size int) (group-1-size int)) (let* ((sprite-count (+ group-0-size group-1-size)) (vec-data-size (* 3 sprite-count)) @@ -474,7 +445,6 @@ ) ) -;; definition for method 0 of type sprite-array-3d (defmethod new sprite-array-3d ((allocation symbol) (type-to-make type) (group-0-size int) (group-1-size int)) (let* ((sprite-count (+ group-0-size group-1-size)) (vec-data-size (* 3 sprite-count)) @@ -496,7 +466,6 @@ ) ) -;; definition for function sprite-set-3d-quaternion! (defun sprite-set-3d-quaternion! ((sprite sprite-vec-data-3d) (quat quaternion)) (local-vars (v1-0 float) (v1-1 float)) (rlet ((vf0 :class vf) @@ -524,7 +493,6 @@ ) ) -;; definition for function sprite-get-3d-quaternion! (defun sprite-get-3d-quaternion! ((out quaternion) (sprite sprite-vec-data-3d)) (let ((f0-0 (-> sprite qx-qy-qz-sy x)) (f1-0 (-> sprite qx-qy-qz-sy y)) @@ -538,9 +506,6 @@ out ) -;; definition for function sprite-add-matrix-data -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun sprite-add-matrix-data ((dma-buff dma-buffer) (matrix-mode uint)) (let ((count 900)) (cond @@ -623,8 +588,6 @@ (none) ) -;; definition for function sprite-add-frame-data -;; WARN: Return type mismatch pointer vs none. (defun sprite-add-frame-data ((dma-buff dma-buffer) (tbp-offset uint)) (let ((s5-0 42)) (let* ((v1-0 dma-buff) @@ -641,8 +604,6 @@ (none) ) -;; definition for function sprite-add-2d-chunk -;; WARN: Return type mismatch pointer vs none. (defun sprite-add-2d-chunk ((sprites sprite-array-2d) (start-sprite-idx int) (num-sprites int) (dma-buff dma-buffer) (mscal-addr int)) (let ((qwc-pkt1 1)) (let* ((v1-0 dma-buff) @@ -693,7 +654,6 @@ (none) ) -;; definition for function sprite-add-2d-all (defun sprite-add-2d-all ((sprites sprite-array-2d) (dma-buff dma-buffer) (group-idx int)) (when (> (-> sprites num-valid group-idx) 0) (let ((current-sprite-idx 0) @@ -716,8 +676,6 @@ (none) ) -;; definition for function sprite-add-3d-chunk -;; WARN: Return type mismatch pointer vs none. (defun sprite-add-3d-chunk ((sprites sprite-array-3d) (start-sprite-idx int) (num-sprites int) (dma-buff dma-buffer)) (let ((qwc-pkt1 1)) (let* ((v1-0 dma-buff) @@ -768,7 +726,6 @@ (none) ) -;; definition for function sprite-add-3d-all (defun sprite-add-3d-all ((sprites sprite-array-3d) (dma-buff dma-buffer) (group-idx int)) (when (> (-> sprites num-valid group-idx) 0) (let ((current-sprite-idx (if (zero? group-idx) @@ -789,114 +746,98 @@ (none) ) -;; definition for function sprite-draw -;; WARN: Return type mismatch int vs none. (defun sprite-draw ((disp display)) (let ((dma-mem-begin (-> *display* frames (-> *display* on-screen) global-buf base))) - (let* ((dma-buff (-> *display* frames (-> *display* on-screen) global-buf)) - (dma-bucket-begin (-> dma-buff base)) - ) + (with-dma-buffer-add-bucket ((dma-buff (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) (when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1)) (sprite-init-distorter dma-buff) (sprite-draw-distorters dma-buff) ) - (let* ((v1-17 dma-buff) - (pkt1 (the-as dma-packet (-> v1-17 base))) - ) - (set! (-> pkt1 dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) - (set! (-> pkt1 vif0) (new 'static 'vif-tag)) - (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1)) - (set! (-> v1-17 base) (&+ (the-as pointer pkt1) 16)) + (let ((v1-17 dma-buff)) + (let ((pkt1 (the-as dma-packet (-> v1-17 base)))) + (set! (-> pkt1 dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))) + (set! (-> pkt1 vif0) (new 'static 'vif-tag)) + (set! (-> pkt1 vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-17 base) (&+ (the-as pointer pkt1) 16)) + ) ) - (let* ((v1-18 dma-buff) - (giftag (the-as gs-gif-tag (-> v1-18 base))) - ) - (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2)) - (set! (-> giftag regs) GIF_REGS_ALL_AD) - (set! (-> v1-18 base) (the-as pointer (&+ giftag 16))) + (let ((v1-18 dma-buff)) + (let ((giftag (the-as gs-gif-tag (-> v1-18 base)))) + (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2)) + (set! (-> giftag regs) GIF_REGS_ALL_AD) + (set! (-> v1-18 base) (the-as pointer (&+ giftag 16))) + ) ) - (let* ((v1-19 dma-buff) - (a0-10 (-> v1-19 base)) - ) - (set! (-> (the-as (pointer gs-test) a0-10) 0) - (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :afail #x1 - :zte #x1 - :ztst (gs-ztest greater-equal) + (let ((v1-19 dma-buff)) + (let ((a0-10 (-> v1-19 base))) + (set! (-> (the-as (pointer gs-test) a0-10) 0) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :afail #x1 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) ) - ) - (set! (-> (the-as (pointer gs-reg64) a0-10) 1) (gs-reg64 test-1)) - (set! (-> (the-as (pointer gs-clamp) a0-10) 2) - (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)) - ) - (set! (-> (the-as (pointer gs-reg64) a0-10) 3) (gs-reg64 clamp-1)) - (set! (-> v1-19 base) (&+ a0-10 32)) + (set! (-> (the-as (pointer gs-reg64) a0-10) 1) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-clamp) a0-10) 2) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)) + ) + (set! (-> (the-as (pointer gs-reg64) a0-10) 3) (gs-reg64 clamp-1)) + (set! (-> v1-19 base) (&+ a0-10 32)) + ) ) (dma-buffer-add-vu-function dma-buff sprite-vu1-block 1) (sprite-add-frame-data dma-buff (the-as uint 408)) - (let* ((v1-20 dma-buff) - (pkt2 (the-as dma-packet (-> v1-20 base))) - ) - (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> pkt2 vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm #x0)) - (set! (-> pkt2 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) - (set! (-> v1-20 base) (&+ (the-as pointer pkt2) 16)) + (let ((v1-20 dma-buff)) + (let ((pkt2 (the-as dma-packet (-> v1-20 base)))) + (set! (-> pkt2 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt2 vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm #x0)) + (set! (-> pkt2 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-20 base) (&+ (the-as pointer pkt2) 16)) + ) ) - (let* ((v1-21 dma-buff) - (pkt3 (the-as dma-packet (-> v1-21 base))) - ) - (set! (-> pkt3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> pkt3 vif0) (new 'static 'vif-tag :cmd (vif-cmd base))) - (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x190 :cmd (vif-cmd offset))) - (set! (-> v1-21 base) (&+ (the-as pointer pkt3) 16)) + (let ((v1-21 dma-buff)) + (let ((pkt3 (the-as dma-packet (-> v1-21 base)))) + (set! (-> pkt3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt3 vif0) (new 'static 'vif-tag :cmd (vif-cmd base))) + (set! (-> pkt3 vif1) (new 'static 'vif-tag :imm #x190 :cmd (vif-cmd offset))) + (set! (-> v1-21 base) (&+ (the-as pointer pkt3) 16)) + ) ) (sprite-add-matrix-data dma-buff (the-as uint 0)) (sprite-add-3d-all *sprite-array-3d* dma-buff 0) (sprite-add-2d-all *sprite-array-2d* dma-buff 0) - (let* ((v1-22 dma-buff) - (pkt4 (the-as dma-packet (-> v1-22 base))) - ) - (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> pkt4 vif0) (new 'static 'vif-tag)) - (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) - (set! (-> v1-22 base) (&+ (the-as pointer pkt4) 16)) + (let ((v1-22 dma-buff)) + (let ((pkt4 (the-as dma-packet (-> v1-22 base)))) + (set! (-> pkt4 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt4 vif0) (new 'static 'vif-tag)) + (set! (-> pkt4 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-22 base) (&+ (the-as pointer pkt4) 16)) + ) ) (sprite-add-matrix-data dma-buff (the-as uint 1)) (sprite-add-2d-all *sprite-array-2d* dma-buff 1) - (let* ((v1-23 dma-buff) - (pkt5 (the-as dma-packet (-> v1-23 base))) - ) - (set! (-> pkt5 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> pkt5 vif0) (new 'static 'vif-tag)) - (set! (-> pkt5 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) - (set! (-> v1-23 base) (&+ (the-as pointer pkt5) 16)) + (let ((v1-23 dma-buff)) + (let ((pkt5 (the-as dma-packet (-> v1-23 base)))) + (set! (-> pkt5 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt5 vif0) (new 'static 'vif-tag)) + (set! (-> pkt5 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-23 base) (&+ (the-as pointer pkt5) 16)) + ) ) (sprite-glow-init-engine dma-buff) (sprite-glow-draw dma-buff) (simple-sprite-system-method-10 *simple-sprite-system* dma-buff) - (let* ((v1-26 dma-buff) - (pkt6 (the-as dma-packet (-> v1-26 base))) - ) - (set! (-> pkt6 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> pkt6 vif0) (new 'static 'vif-tag)) - (set! (-> pkt6 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) - (set! (-> v1-26 base) (&+ (the-as pointer pkt6) 16)) - ) - (let ((a3-0 (-> dma-buff base))) - (let ((pkt7 (the-as dma-packet (-> dma-buff base)))) - (set! (-> pkt7 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> pkt7 vif0) (new 'static 'vif-tag)) - (set! (-> pkt7 vif1) (new 'static 'vif-tag)) - (set! (-> dma-buff base) (&+ (the-as pointer pkt7) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id particles) - dma-bucket-begin - (the-as (pointer dma-tag) a3-0) + (let ((v1-26 dma-buff)) + (let ((pkt6 (the-as dma-packet (-> v1-26 base)))) + (set! (-> pkt6 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> pkt6 vif0) (new 'static 'vif-tag)) + (set! (-> pkt6 vif1) (new 'static 'vif-tag :cmd (vif-cmd flushe) :msk #x1)) + (set! (-> v1-26 base) (&+ (the-as pointer pkt6) 16)) ) ) ) @@ -916,7 +857,6 @@ (none) ) -;; definition for function sprite-allocate-user-hvdf (defun sprite-allocate-user-hvdf () (dotimes (v1-0 76) (when (zero? (-> *sprite-hvdf-control* alloc v1-0)) @@ -927,8 +867,6 @@ 0 ) -;; definition for function sprite-release-user-hvdf -;; WARN: Return type mismatch int vs none. (defun sprite-release-user-hvdf ((idx int)) (when (and (>= idx 1) (< idx 76)) (set! (-> *sprite-hvdf-control* alloc idx) 0) @@ -938,37 +876,26 @@ (none) ) -;; definition for function sprite-get-user-hvdf -;; WARN: Return type mismatch qword vs vector. (defun sprite-get-user-hvdf ((idx int)) (the-as vector (-> *sprite-hvdf-data* data idx)) ) -;; failed to figure out what this is: (kmemopen global "sprite-tables") -;; definition for symbol *sprite-hvdf-data*, type sprite-hvdf-data (define *sprite-hvdf-data* (new 'global 'sprite-hvdf-data)) -;; definition for symbol *sprite-hvdf-control*, type sprite-hvdf-control (define *sprite-hvdf-control* (new 'global 'sprite-hvdf-control)) -;; failed to figure out what this is: (dotimes (v1-25 76) (set! (-> *sprite-hvdf-control* alloc v1-25) 0) ) -;; failed to figure out what this is: (set! (-> *sprite-hvdf-control* alloc 0) 1) -;; definition for symbol *sprite-aux-list*, type sprite-aux-list (define *sprite-aux-list* (new 'global 'sprite-aux-list 256)) -;; definition for symbol *sprite-array-2d*, type sprite-array-2d (define *sprite-array-2d* (new 'global 'sprite-array-2d 1920 128)) -;; definition for symbol *sprite-array-3d*, type sprite-array-3d (define *sprite-array-3d* (new 'global 'sprite-array-3d 256 0)) -;; failed to figure out what this is: (kmemclose) diff --git a/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc b/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc index 960060fd5a..4179ab5ca0 100644 --- a/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc @@ -1,7 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition for method 2 of type texture-page (defmethod print texture-page ((obj texture-page)) (format #t @@ -15,18 +13,14 @@ obj ) -;; definition for method 4 of type texture-page (defmethod length texture-page ((obj texture-page)) (-> obj length) ) -;; definition for method 5 of type texture-page -;; WARN: Return type mismatch uint vs int. (defmethod asize-of texture-page ((obj texture-page)) (the-as int (+ (-> obj type size) (* (-> obj length) 4))) ) -;; definition for method 8 of type texture-page (defmethod mem-usage texture-page ((obj texture-page) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 83 (-> arg0 length))) (set! (-> arg0 data 82 name) "texture") @@ -43,7 +37,6 @@ obj ) -;; definition for function texture-bpp (defun texture-bpp ((tex-fmt gs-psm)) (case tex-fmt (((gs-psm mt8)) @@ -61,20 +54,16 @@ ) ) -;; definition for function texture-qwc (defun texture-qwc ((width int) (height int) (tex-fmt gs-psm)) (let ((v1-0 (texture-bpp tex-fmt))) (/ (+ (* (* width height) v1-0) 127) 128) ) ) -;; definition for function physical-address (defun physical-address ((ptr pointer)) (logand #xfffffff ptr) ) -;; definition for function dma-buffer-add-ref-texture -;; WARN: Return type mismatch symbol vs none. (defun dma-buffer-add-ref-texture ((dma-buf dma-buffer) (tex-data-ptr pointer) (width int) (height int) (tex-fmt gs-psm)) (let ((padr (physical-address tex-data-ptr)) (qwc-remaining (texture-qwc width height tex-fmt)) @@ -125,7 +114,6 @@ (none) ) -;; definition for method 2 of type texture (defmethod print texture ((obj texture)) (format #t @@ -147,7 +135,6 @@ obj ) -;; definition for function gs-find-block (defun gs-find-block ((bx int) (by int) (fmt gs-psm)) (cond ((= fmt (gs-psm ct32)) @@ -186,7 +173,6 @@ ) ) -;; definition for function gs-page-width (defun gs-page-width ((arg0 gs-psm)) (case arg0 (((gs-psm ct32) (gs-psm ct24) (gs-psm ct16) (gs-psm ct16s)) @@ -202,7 +188,6 @@ ) ) -;; definition for function gs-page-height (defun gs-page-height ((arg0 gs-psm)) (case arg0 (((gs-psm ct32) (gs-psm ct24)) @@ -224,7 +209,6 @@ ) ) -;; definition for function gs-block-width (defun gs-block-width ((arg0 gs-psm)) (case arg0 (((gs-psm ct32) (gs-psm ct24)) @@ -243,7 +227,6 @@ ) ) -;; definition for function gs-block-height (defun gs-block-height ((arg0 gs-psm)) (case arg0 (((gs-psm ct32) (gs-psm ct24) (gs-psm ct16) (gs-psm ct16s)) @@ -259,7 +242,6 @@ ) ) -;; definition for function gs-largest-block (defun gs-largest-block ((arg0 int) (arg1 int) (arg2 gs-psm)) (let* ((s5-0 (gs-block-width arg2)) (v1-0 (gs-block-height arg2)) @@ -278,7 +260,6 @@ ) ) -;; definition for function gs-blocks-used (defun gs-blocks-used ((arg0 int) (arg1 int) (arg2 gs-psm)) (let* ((s4-0 (gs-page-width arg2)) (v1-0 (gs-page-height arg2)) @@ -296,12 +277,10 @@ ) ) -;; definition for method 0 of type texture-pool (defmethod new texture-pool ((allocation symbol) (type-to-make type)) (initialize! (object-new allocation type-to-make (the-as int (-> type-to-make size)))) ) -;; definition for method 15 of type texture-pool (defmethod allocate-vram-words! texture-pool ((obj texture-pool) (arg0 int)) (let ((v0-0 (-> obj cur))) (+! (-> obj cur) arg0) @@ -309,7 +288,6 @@ ) ) -;; definition for method 18 of type texture-pool (defmethod get-common-page-slot-by-id texture-pool ((obj texture-pool) (tpage-id int)) (case tpage-id ((33) @@ -324,7 +302,6 @@ ) ) -;; definition for method 9 of type texture-pool (defmethod initialize! texture-pool ((obj texture-pool)) (set! (-> obj cur) 0) (set! (-> obj top) (-> obj cur)) @@ -347,7 +324,6 @@ obj ) -;; definition for method 10 of type texture-page (defmethod get-leftover-block-count texture-page ((obj texture-page) (num-segments int) (upload-offset int)) (let ((offset upload-offset)) (dotimes (i num-segments) @@ -357,7 +333,6 @@ ) ) -;; definition for method 10 of type texture-pool (defmethod print-usage texture-pool ((obj texture-pool)) (format #t "--------------------~%") (format @@ -372,15 +347,12 @@ obj ) -;; definition for method 16 of type texture-pool (defmethod allocate-segment texture-pool ((obj texture-pool) (seg texture-pool-segment) (num-words int)) (set! (-> seg size) (the-as uint num-words)) (set! (-> seg dest) (the-as uint (allocate-vram-words! obj num-words))) seg ) -;; definition for method 12 of type texture-pool -;; WARN: Return type mismatch int vs none. (defmethod allocate-defaults texture-pool ((obj texture-pool)) (format #t "texture start #x~x~%" (/ (-> obj cur) 64)) (allocate-segment obj (-> obj segment-common) #x3e000) @@ -408,13 +380,11 @@ (none) ) -;; definition for method 9 of type texture-page (defmethod remove-data-from-heap texture-page ((obj texture-page) (heap kheap)) (set! (-> heap current) (-> obj segment 0 block-data)) obj ) -;; definition for function texture-page-default-allocate (defun texture-page-default-allocate ((pool texture-pool) (tpage texture-page) (heap kheap) (tpage-id int)) (dotimes (seg 3) (let ((vram-loc (allocate-vram-words! pool (the-as int (-> tpage segment seg size))))) @@ -438,7 +408,6 @@ tpage ) -;; definition for function texture-page-common-allocate (defun texture-page-common-allocate ((pool texture-pool) (tpage texture-page) (heap kheap) (tpage-id int)) (let ((vram-loc (-> pool segment-common dest))) (dotimes (seg 3) @@ -450,7 +419,6 @@ tpage ) -;; definition for function texture-page-font-allocate (defun texture-page-font-allocate ((pool texture-pool) (tpage texture-page) (heap kheap) (tpage-id int)) (texture-page-common-allocate pool tpage heap tpage-id) (upload-now! tpage (tex-upload-mode seg0-1-2)) @@ -470,8 +438,6 @@ tpage ) -;; definition for method 22 of type texture-pool -;; WARN: Return type mismatch int vs none. (defmethod lay-out-sprite-tex texture-pool ((obj texture-pool)) (let ((vram-loc 0)) (countdown (level-idx 7) @@ -501,8 +467,6 @@ (none) ) -;; definition for method 23 of type texture-pool -;; WARN: Return type mismatch int vs none. (defmethod lay-out-hud-tex texture-pool ((obj texture-pool)) (let ((level-idx 0)) (countdown (vram-loc 7) @@ -532,8 +496,6 @@ (none) ) -;; definition for method 24 of type texture-pool -;; WARN: Return type mismatch int vs none. (defmethod lay-out-warp-tex texture-pool ((obj texture-pool)) (let ((vram-loc 0)) (countdown (level-idx 7) @@ -586,8 +548,6 @@ (none) ) -;; definition for method 25 of type texture-pool -;; WARN: Return type mismatch int vs none. (defmethod clear-ids texture-pool ((obj texture-pool)) (dotimes (v1-0 128) (set! (-> obj ids v1-0) (the-as uint 0)) @@ -596,8 +556,6 @@ (none) ) -;; definition for method 20 of type texture-pool -;; WARN: Return type mismatch symbol vs none. (defmethod update-sprites texture-pool ((obj texture-pool)) (lay-out-sprite-tex obj) (clear-ids obj) @@ -605,8 +563,6 @@ (none) ) -;; definition for method 19 of type texture-pool -;; WARN: Return type mismatch symbol vs none. (defmethod update-warp-and-hud texture-pool ((obj texture-pool)) (lay-out-hud-tex obj) (lay-out-warp-tex obj) @@ -615,15 +571,12 @@ (none) ) -;; definition for method 21 of type texture-pool -;; WARN: Return type mismatch symbol vs none. (defmethod mark-hud-warp-sprite-dirty texture-pool ((obj texture-pool)) (set! (-> obj update-sprites-flag) #t) (set! (-> obj update-flag) #t) (none) ) -;; definition for function texture-page-common-boot-allocate (defun texture-page-common-boot-allocate ((pool texture-pool) (tpage texture-page) (heap kheap) (tpage-id int)) (let ((common-page-slot-id (get-common-page-slot-by-id pool tpage-id))) (cond @@ -680,8 +633,6 @@ tpage ) -;; definition for function upload-vram-data -;; WARN: Return type mismatch symbol vs none. (defun upload-vram-data ((buf dma-buffer) (dest int) (data pointer) (height int) (width int)) (while (> height 0) (let ((height-this-time (min 2048 height))) @@ -722,7 +673,6 @@ (none) ) -;; definition for function upload-vram-pages (defun upload-vram-pages ((pool texture-pool) (dest-seg texture-pool-segment) (tpage texture-page) @@ -741,9 +691,9 @@ (return 0) ) (let ((num-chunks 0)) - (let* ((dma-buf (-> *display* frames (-> *display* on-screen) global-buf)) - (s4-0 (-> dma-buf base)) - ) + (with-dma-buffer-add-bucket ((dma-buf (-> *display* frames (-> *display* on-screen) global-buf)) + bucket + ) (set! data-ptr (-> tpage segment 0 block-data)) (set! vram-ptr (shr (-> tpage segment 0 dest) 12)) (set! tpage-num-chunks (the-as int (-> tpage segment 0 size))) @@ -808,40 +758,26 @@ ) (+! num-chunks chunks-pending) ) - (let* ((v1-51 dma-buf) - (a0-24 (the-as dma-packet (-> v1-51 base))) - ) - (set! (-> a0-24 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) - (set! (-> a0-24 vif0) (new 'static 'vif-tag)) - (set! (-> a0-24 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) - (set! (-> v1-51 base) (the-as pointer (&+ a0-24 16))) - ) - (let* ((v1-52 dma-buf) - (a0-26 (the-as gs-gif-tag (-> v1-52 base))) - ) - (set! (-> a0-26 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) - (set! (-> a0-26 regs) GIF_REGS_ALL_AD) - (set! (-> v1-52 base) (the-as pointer (&+ a0-26 16))) - ) - (let* ((v1-53 dma-buf) - (a0-28 (-> v1-53 base)) - ) - (set! (-> (the-as (pointer int64) a0-28) 0) 1) - (set! (-> (the-as (pointer gs-reg64) a0-28) 1) (gs-reg64 texflush)) - (set! (-> v1-53 base) (&+ a0-28 16)) - ) - (let ((a3-3 (-> dma-buf base))) - (let ((v1-54 (the-as dma-packet (-> dma-buf base)))) - (set! (-> v1-54 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-54 vif0) (new 'static 'vif-tag)) - (set! (-> v1-54 vif1) (new 'static 'vif-tag)) - (set! (-> dma-buf base) (the-as pointer (&+ v1-54 16))) + (let ((v1-51 dma-buf)) + (let ((a0-24 (the-as dma-packet (-> v1-51 base)))) + (set! (-> a0-24 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-24 vif0) (new 'static 'vif-tag)) + (set! (-> a0-24 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-51 base) (the-as pointer (&+ a0-24 16))) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - s4-0 - (the-as (pointer dma-tag) a3-3) + ) + (let ((v1-52 dma-buf)) + (let ((a0-26 (the-as gs-gif-tag (-> v1-52 base)))) + (set! (-> a0-26 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-26 regs) GIF_REGS_ALL_AD) + (set! (-> v1-52 base) (the-as pointer (&+ a0-26 16))) + ) + ) + (let ((v1-53 dma-buf)) + (let ((a0-28 (-> v1-53 base))) + (set! (-> (the-as (pointer int64) a0-28) 0) 1) + (set! (-> (the-as (pointer gs-reg64) a0-28) 1) (gs-reg64 texflush)) + (set! (-> v1-53 base) (&+ a0-28 16)) ) ) ) @@ -849,7 +785,6 @@ ) ) -;; definition for function update-vram-pages (defun update-vram-pages ((pool texture-pool) (dest-seg texture-pool-segment) (tpage texture-page) (mode tex-upload-mode)) (-> tpage segment 0 block-data) (let ((vram-ptr (shr (-> tpage segment 0 dest) 12)) @@ -902,7 +837,6 @@ 0 ) -;; definition for function upload-vram-pages-pris (defun upload-vram-pages-pris ((pool texture-pool) (dest-seg texture-pool-segment) (tpage texture-page) @@ -922,9 +856,9 @@ (return 0) ) (let ((total-chunks-uploaded 0)) - (let* ((dma-buf (-> *display* frames (-> *display* on-screen) global-buf)) - (s4-0 (-> dma-buf base)) - ) + (with-dma-buffer-add-bucket ((dma-buf (-> *display* frames (-> *display* on-screen) global-buf)) + bucket + ) (set! data-ptr (-> tpage segment 0 block-data)) (set! vram-ptr (shr (-> tpage segment 0 dest) 12)) (set! tpage-num-chunks (the-as int (-> tpage size))) @@ -974,40 +908,26 @@ ) (+! total-chunks-uploaded chunks-pending) ) - (let* ((v1-40 dma-buf) - (a0-27 (the-as dma-packet (-> v1-40 base))) - ) - (set! (-> a0-27 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) - (set! (-> a0-27 vif0) (new 'static 'vif-tag)) - (set! (-> a0-27 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) - (set! (-> v1-40 base) (the-as pointer (&+ a0-27 16))) - ) - (let* ((v1-41 dma-buf) - (a0-29 (the-as gs-gif-tag (-> v1-41 base))) - ) - (set! (-> a0-29 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) - (set! (-> a0-29 regs) GIF_REGS_ALL_AD) - (set! (-> v1-41 base) (the-as pointer (&+ a0-29 16))) - ) - (let* ((v1-42 dma-buf) - (a0-31 (-> v1-42 base)) - ) - (set! (-> (the-as (pointer int64) a0-31) 0) 1) - (set! (-> (the-as (pointer gs-reg64) a0-31) 1) (gs-reg64 texflush)) - (set! (-> v1-42 base) (&+ a0-31 16)) - ) - (let ((a3-5 (-> dma-buf base))) - (let ((v1-43 (the-as dma-packet (-> dma-buf base)))) - (set! (-> v1-43 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-43 vif0) (new 'static 'vif-tag)) - (set! (-> v1-43 vif1) (new 'static 'vif-tag)) - (set! (-> dma-buf base) (the-as pointer (&+ v1-43 16))) + (let ((v1-40 dma-buf)) + (let ((a0-27 (the-as dma-packet (-> v1-40 base)))) + (set! (-> a0-27 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt))) + (set! (-> a0-27 vif0) (new 'static 'vif-tag)) + (set! (-> a0-27 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-40 base) (the-as pointer (&+ a0-27 16))) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - bucket - s4-0 - (the-as (pointer dma-tag) a3-5) + ) + (let ((v1-41 dma-buf)) + (let ((a0-29 (the-as gs-gif-tag (-> v1-41 base)))) + (set! (-> a0-29 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1)) + (set! (-> a0-29 regs) GIF_REGS_ALL_AD) + (set! (-> v1-41 base) (the-as pointer (&+ a0-29 16))) + ) + ) + (let ((v1-42 dma-buf)) + (let ((a0-31 (-> v1-42 base))) + (set! (-> (the-as (pointer int64) a0-31) 0) 1) + (set! (-> (the-as (pointer gs-reg64) a0-31) 1) (gs-reg64 texflush)) + (set! (-> v1-42 base) (&+ a0-31 16)) ) ) ) @@ -1015,7 +935,6 @@ ) ) -;; definition for function texture-page-level-allocate (defun texture-page-level-allocate ((pool texture-pool) (tpage texture-page) (heap kheap) (tpage-id int)) (if (zero? (-> *level* loading-level code-memory-end)) (set! (-> *level* loading-level code-memory-end) (the-as pointer tpage)) @@ -1034,7 +953,6 @@ tpage ) -;; definition for function texture-page-size-check (defun texture-page-size-check ((pool texture-pool) (lev level) (silent symbol)) (let ((gp-0 0)) (let ((v1-0 (-> lev texture-page 0))) @@ -1164,8 +1082,6 @@ ) ) -;; definition for method 13 of type texture-pool -;; WARN: Return type mismatch int vs none. (defmethod login-level-textures texture-pool ((pool texture-pool) (lev level) (num-tpage-ids int) (tpage-ids (pointer texture-id))) (dotimes (v1-0 18) (set! (-> lev texture-page v1-0) #f) @@ -1198,9 +1114,6 @@ (none) ) -;; definition for method 14 of type texture-pool -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defmethod add-level-tpage-dma texture-pool ((pool texture-pool) (lev level) (cat tpage-category) (bucket bucket-id)) (with-pp (let ((tpage (-> lev texture-page cat))) @@ -1392,9 +1305,6 @@ ) ) -;; definition for function set-skull-gem-masks -;; INFO: Used lq/sq -;; WARN: Return type mismatch uint128 vs none. (defun set-skull-gem-masks () (local-vars (v0-3 uint128) (v1-2 uint128) (v1-3 uint128)) (let ((gp-0 (-> *level* default-level texture-mask))) @@ -1415,9 +1325,6 @@ (none) ) -;; definition for function upload-textures -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defun upload-textures ((arg0 texture-pool)) (cond ((not (-> *blit-displays-work* screen-copied)) @@ -1487,17 +1394,12 @@ (none) ) -;; failed to figure out what this is: (kmemopen global "texture-dma-buffers") -;; definition for symbol *txt-dma-list*, type dma-buffer (define *txt-dma-list* (new 'global 'dma-buffer 4096)) -;; failed to figure out what this is: (kmemclose) -;; definition for method 13 of type texture-page -;; WARN: Return type mismatch int vs none. (defmethod upload-now! texture-page ((obj texture-page) (arg0 tex-upload-mode)) (let ((gp-0 *txt-dma-list*)) (let ((v1-0 gp-0)) @@ -1540,7 +1442,6 @@ (none) ) -;; definition for method 12 of type texture-page (defmethod add-to-dma-buffer texture-page ((obj texture-page) (arg0 dma-buffer) (arg1 tex-upload-mode)) (local-vars (sv-16 int)) (let ((v1-0 arg1)) @@ -1570,7 +1471,6 @@ sv-16 ) -;; definition for function texture-relocate (defun texture-relocate ((dma-buff dma-buffer) (tex texture) (dest-loc int) (dest-fmt gs-psm) (clut-dst int)) (dotimes (v1-0 (the-as int (-> tex num-mips))) (let ((t1-1 (ash (-> tex w) (- v1-0))) @@ -1701,30 +1601,6 @@ dma-buff ) -;; definition for method 11 of type texture-pool -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 20 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Return type mismatch int vs none. (defmethod setup-font-texture texture-pool ((obj texture-pool)) (local-vars (sv-16 int) (sv-20 int)) (let ((s3-0 (-> obj font-palette))) @@ -1834,26 +1710,19 @@ (none) ) -;; definition for method 5 of type texture-page-dir -;; WARN: Return type mismatch uint vs int. (defmethod asize-of texture-page-dir ((obj texture-page-dir)) (the-as int (+ (-> texture-page-dir size) (* 12 (+ (-> obj length) -1)))) ) -;; definition for method 4 of type texture-page-dir (defmethod length texture-page-dir ((obj texture-page-dir)) (-> obj length) ) -;; definition for method 7 of type texture-page-dir -;; WARN: Return type mismatch texture-page-dir vs none. (defmethod relocate texture-page-dir ((obj texture-page-dir) (arg0 kheap) (arg1 (pointer uint8))) (set! *texture-page-dir* obj) (none) ) -;; definition for method 11 of type texture-page -;; WARN: Return type mismatch texture-page vs none. (defmethod relocate-dests! texture-page ((obj texture-page) (new-dest int) (segs int)) (let ((new-tbp (shr new-dest 6)) (old-tbp (shr (-> obj segment segs dest) 6)) @@ -1889,7 +1758,6 @@ (none) ) -;; definition for method 7 of type texture-page (defmethod relocate texture-page ((obj texture-page) (loading-heap kheap) (name (pointer uint8))) (cond ((or (not obj) (not (file-info-correct-version? (-> obj info) (file-kind tpage) 0))) @@ -1934,7 +1802,6 @@ ) ) -;; definition for function relocate-later (defun relocate-later () (let ((gp-0 *texture-relocate-later*)) (let ((s5-0 (-> gp-0 entry)) @@ -1953,7 +1820,6 @@ #f ) -;; definition for function texture-page-login (defun texture-page-login ((tex-id texture-id) (alloc-func (function texture-pool texture-page kheap int texture-page)) (heap kheap)) (when (and (nonzero? (-> tex-id page)) (< (-> tex-id page) (the-as uint (-> *texture-page-dir* length)))) (let ((dir-entry (-> *texture-page-dir* entries (-> tex-id page)))) @@ -1975,7 +1841,6 @@ ) ) -;; definition for function lookup-texture-by-id (defun lookup-texture-by-id ((arg0 texture-id)) (let ((a0-2 (texture-page-login arg0 texture-page-default-allocate loading-level)) (v1-0 (the-as texture-page #f)) @@ -1986,7 +1851,6 @@ ) ) -;; definition for function lookup-texture-by-id-fast (defun lookup-texture-by-id-fast ((arg0 texture-id)) (let ((a1-2 (if (and (nonzero? (-> arg0 page)) (< (-> arg0 page) (the-as uint (-> *texture-page-dir* length)))) (-> *texture-page-dir* entries (-> arg0 page)) @@ -2000,7 +1864,6 @@ ) ) -;; definition for function lookup-texture-by-name (defun lookup-texture-by-name ((arg0 string) (arg1 string) (arg2 (pointer texture-page))) (local-vars (sv-16 texture-page-dir)) (set! sv-16 *texture-page-dir*) @@ -2023,8 +1886,6 @@ (the-as texture #f) ) -;; definition for function lookup-texture-id-by-name -;; WARN: Return type mismatch int vs texture-id. (defun lookup-texture-id-by-name ((arg0 string) (arg1 string)) (local-vars (sv-16 texture-page-dir)) (set! sv-16 *texture-page-dir*) @@ -2044,7 +1905,6 @@ (the-as texture-id 0) ) -;; definition for function lookup-level-texture-by-name (defun lookup-level-texture-by-name ((arg0 string) (arg1 level) (arg2 (pointer texture-page))) (dotimes (s3-0 18) (let ((s2-0 (-> arg1 texture-page s3-0))) @@ -2065,8 +1925,6 @@ (lookup-texture-by-name arg0 (the-as string #f) arg2) ) -;; definition for method 17 of type texture-pool -;; WARN: Return type mismatch int vs none. (defmethod unload-page texture-pool ((obj texture-pool) (arg0 texture-page)) (local-vars (a0-2 int)) (let ((v1-0 *texture-page-dir*)) @@ -2087,13 +1945,10 @@ (none) ) -;; definition for symbol *shader-list*, type pair (define *shader-list* '()) -;; definition for symbol *edit-shader*, type texture-id (define *edit-shader* (new 'static 'texture-id)) -;; definition for function link-texture-by-id (defun link-texture-by-id ((arg0 texture-id) (arg1 adgif-shader)) (when (not (or (zero? (-> arg0 page)) (>= (-> arg0 page) (the-as uint (-> *texture-page-dir* length))))) (let ((s4-0 (-> *texture-page-dir* entries (-> arg0 page)))) @@ -2109,7 +1964,6 @@ ) ) -;; definition for method 9 of type texture-page-dir (defmethod unlink-shaders-in-heap texture-page-dir ((obj texture-page-dir) (heap kheap)) (local-vars (dist-past-end uint)) (let ((mem-start (-> heap base)) @@ -2156,11 +2010,7 @@ 0 ) -;; definition for function adgif-shader<-texture! -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function adgif-shader-update! -;; WARN: Return type mismatch gs-tex1 vs none. (defun adgif-shader-update! ((arg0 adgif-shader) (arg1 texture)) (let ((s5-0 (the int (/ 256.0 (-> arg1 uv-dist))))) (case (-> arg0 tex1 l) @@ -2175,17 +2025,13 @@ (none) ) -;; definition for function adgif-shader<-texture-with-update! -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function hack-texture (defun hack-texture ((arg0 texture)) (set! (-> arg0 uv-dist) 1000000.0) (set! (-> arg0 masks data 0 dist) (+ 40960000.0 (-> arg0 masks data 0 dist))) (set! (-> arg0 masks data 1 dist) (+ 40960000.0 (-> arg0 masks data 1 dist))) ) -;; definition for function adgif-shader-login (defun adgif-shader-login ((arg0 adgif-shader)) (when (logtest? (-> arg0 link-test) (link-test-flags needs-log-in)) (logclear! (-> arg0 link-test) (link-test-flags needs-log-in bit-9)) @@ -2219,7 +2065,6 @@ ) ) -;; definition for function adgif-shader-login-no-remap (defun adgif-shader-login-no-remap ((arg0 adgif-shader)) (when (logtest? (-> arg0 link-test) (link-test-flags needs-log-in)) (logclear! (-> arg0 link-test) (link-test-flags needs-log-in bit-9)) @@ -2247,7 +2092,6 @@ ) ) -;; definition for function adgif-shader-login-fast (defun adgif-shader-login-fast ((arg0 adgif-shader)) (when (logtest? (-> arg0 link-test) (link-test-flags needs-log-in)) (logclear! (-> arg0 link-test) (link-test-flags needs-log-in bit-9)) @@ -2276,7 +2120,6 @@ ) ) -;; definition for function adgif-shader-login-no-remap-fast (defun adgif-shader-login-no-remap-fast ((arg0 adgif-shader)) (when (logtest? (-> arg0 link-test) (link-test-flags needs-log-in)) (logclear! (-> arg0 link-test) (link-test-flags needs-log-in bit-9)) @@ -2304,13 +2147,11 @@ ) ) -;; failed to figure out what this is: (when (not *debug-segment*) (set! adgif-shader-login adgif-shader-login-fast) (set! adgif-shader-login-no-remap adgif-shader-login-no-remap-fast) ) -;; definition for function adgif-shader<-texture-simple! (defun adgif-shader<-texture-simple! ((arg0 adgif-shader) (arg1 texture)) (set! (-> arg0 tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) (set! (-> arg0 tex0 tfx) 0) @@ -2327,8 +2168,6 @@ arg0 ) -;; definition for function set-dirty-mask! -;; WARN: Return type mismatch int vs none. (defun set-dirty-mask! ((arg0 level) (arg1 int) (arg2 int) (arg3 int)) (let ((s4-0 (sar (+ arg2 #x3fff) 14)) (s5-0 (sar (+ arg3 #x3fff) 14)) @@ -2357,8 +2196,6 @@ (none) ) -;; definition (debug) for function texture-page-dir-inspect -;; WARN: Return type mismatch texture-page-dir vs none. (defun-debug texture-page-dir-inspect ((arg0 texture-page-dir) (arg1 symbol)) (format #t "[~8x] ~A~%" arg0 (-> arg0 type)) (let ((v1-0 *texture-pool*)) @@ -2455,15 +2292,9 @@ (none) ) -;; definition for method 3 of type texture-page-dir (defmethod inspect texture-page-dir ((obj texture-page-dir)) (texture-page-dir-inspect obj #f) obj ) -;; definition for symbol *texture-pool*, type texture-pool (define *texture-pool* (new 'global 'texture-pool)) - - - - diff --git a/test/decompiler/reference/jak2/engine/ps2/memcard-h_REF.gc b/test/decompiler/reference/jak2/engine/ps2/memcard-h_REF.gc index c526694317..0865845363 100644 --- a/test/decompiler/reference/jak2/engine/ps2/memcard-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ps2/memcard-h_REF.gc @@ -1,7 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition of type mc-handle (deftype mc-handle (int32) () :method-count-assert 9 @@ -9,7 +7,6 @@ :flag-assert #x900000004 ) -;; definition of type mc-file-info (deftype mc-file-info (structure) ((present int32 :offset-assert 0) (blind-data float 16 :offset 4) @@ -35,7 +32,6 @@ :flag-assert #x900000044 ) -;; definition for method 3 of type mc-file-info (defmethod inspect mc-file-info ((obj mc-file-info)) (when (not obj) (set! obj obj) @@ -63,7 +59,6 @@ obj ) -;; definition of type mc-slot-info (deftype mc-slot-info (structure) ((handle int32 :offset-assert 0) (known int32 :offset-assert 4) @@ -80,7 +75,6 @@ :flag-assert #x90000012c ) -;; definition for method 3 of type mc-slot-info (defmethod inspect mc-slot-info ((obj mc-slot-info)) (when (not obj) (set! obj obj) @@ -99,67 +93,15 @@ obj ) -;; definition for function mc-sync (defun mc-sync () (let ((v0-0 0)) (while (zero? v0-0) (mc-run) - (set! v0-0 (mc-check-result)) + (set! v0-0 (the-as int (mc-check-result))) ) v0-0 ) ) -;; definition for function show-mc-info -;; WARN: Return type mismatch int vs none. -(defun show-mc-info ((arg0 dma-buffer)) - (let ((s5-0 (new 'stack-no-clear 'mc-slot-info))) - (dotimes (s4-0 2) - (mc-get-slot-info s4-0 s5-0) - (cond - ((zero? (-> s5-0 known)) - (format (clear *temp-string*) "SLOT ~D: EXAMINING SLOT~%" s4-0) - *temp-string* - ) - ((zero? (-> s5-0 handle)) - (format (clear *temp-string*) "SLOT ~D: NO CARD~%" s4-0) - *temp-string* - ) - ((zero? (-> s5-0 formatted)) - (format (clear *temp-string*) "SLOT ~D: CARD [~D] : NOT FORMATTED~%" s4-0 (-> s5-0 handle)) - *temp-string* - ) - ((zero? (-> s5-0 inited)) - (format - (clear *temp-string*) - "SLOT ~D: CARD [~D] : NO FILE [~D/~D]~%" - s4-0 - (-> s5-0 handle) - (-> s5-0 mem-required) - (-> s5-0 mem-actual) - ) - *temp-string* - ) - (else - (format (clear *temp-string*) "SLOT ~D: CARD [~D] : " s4-0 (-> s5-0 handle)) - *temp-string* - (format - *temp-string* - "SAVES ~D ~D ~D ~D : LAST ~D~%" - (-> s5-0 file 0 present) - (-> s5-0 file 1 present) - (-> s5-0 file 2 present) - (-> s5-0 file 3 present) - (-> s5-0 last-file) - ) - ) - ) - (draw-string-xy *temp-string* arg0 32 (+ (* 12 s4-0) 8) (font-color precursor-#ec3b00) (font-flags shadow)) - ) - ) - 0 - (none) - ) -;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc index 13deb8a336..d3892494c8 100644 --- a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc @@ -1,7 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition of type progress-global-state (deftype progress-global-state (basic) ((aspect-ratio-choice symbol :offset-assert 4) (video-mode-choice symbol :offset-assert 8) @@ -56,7 +54,6 @@ :flag-assert #x9000000e8 ) -;; definition for method 3 of type progress-global-state (defmethod inspect progress-global-state ((obj progress-global-state)) (when (not obj) (set! obj obj) @@ -114,25 +111,18 @@ obj ) -;; definition for symbol *progress-stack*, type (pointer uint8) (define *progress-stack* (the-as (pointer uint8) (malloc 'global #x3800))) -;; definition for symbol *progress-process*, type (pointer progress) (define *progress-process* (the-as (pointer progress) #f)) -;; definition for symbol *progress-state*, type progress-global-state (define *progress-state* (new 'static 'progress-global-state :which-slot -1 :last-slot-saved -1)) -;; failed to figure out what this is: (kmemopen global "mc-slot-info") -;; definition for symbol *progress-save-info*, type mc-slot-info (define *progress-save-info* (new 'global 'mc-slot-info)) -;; failed to figure out what this is: (kmemclose) -;; definition for function min-max-wrap-around (defun min-max-wrap-around ((arg0 int) (arg1 int) (arg2 int)) (let ((v1-2 (+ (- 1 arg1) arg2))) (while (< arg0 arg1) @@ -145,7 +135,6 @@ arg0 ) -;; definition for function progress-intro-start (defun progress-intro-start ((arg0 symbol)) (set! (-> *game-info* mode) 'play) (if arg0 @@ -156,7 +145,6 @@ 0 ) -;; definition for method 24 of type progress (defmethod init-defaults progress ((obj progress)) "Initialize default menu settings." (set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio)) @@ -226,7 +214,6 @@ (set-setting-by-param *setting-control* 'extra-bank '((force2 menu1)) 0 0) ) -;; definition of type hud-ring-cell (deftype hud-ring-cell (process-drawable) ((parent-override (pointer progress) :offset 16) (joint-idx int32 :offset-assert 200) @@ -242,7 +229,6 @@ ) ) -;; definition for method 3 of type hud-ring-cell (defmethod inspect hud-ring-cell ((obj hud-ring-cell)) (when (not obj) (set! obj obj) @@ -258,8 +244,6 @@ obj ) -;; definition for function hud-ring-cell-init-by-other -;; INFO: Used lq/sq (defbehavior hud-ring-cell-init-by-other hud-ring-cell ((arg0 int) (arg1 float) (arg2 int)) (set! (-> self root) (new 'process 'trsqv)) (initialize-skeleton @@ -328,7 +312,6 @@ (go-virtual idle) ) -;; failed to figure out what this is: (defstate idle (hud-ring-cell) :virtual #t :code (behavior () @@ -419,7 +402,6 @@ ) ) -;; definition for function progress-init-by-other (defbehavior progress-init-by-other progress ((arg0 symbol)) (hide-hud #f) (disable-level-text-file-loading) @@ -480,8 +462,6 @@ (go-virtual come-in) ) -;; definition for function set-ring-position -;; INFO: Used lq/sq (defun set-ring-position ((arg0 progress)) (let ((s3-0 (new-stack-vector0)) (s4-0 (new 'stack-no-clear 'vector)) @@ -505,8 +485,6 @@ ) ) -;; definition for function activate-progress -;; WARN: Return type mismatch int vs none. (defun activate-progress ((arg0 process) (arg1 symbol)) (when *target* (when (progress-allowed?) @@ -539,7 +517,6 @@ (none) ) -;; definition for method 10 of type progress (defmethod deactivate progress ((obj progress)) (remove-setting-by-arg0 *setting-control* 'extra-bank) ((method-of-object *bigmap* bigmap-method-15)) @@ -552,8 +529,6 @@ (none) ) -;; definition for function deactivate-progress -;; WARN: Return type mismatch int vs none. (defun deactivate-progress () (if *progress-process* (deactivate (-> *progress-process* 0)) @@ -562,8 +537,6 @@ (none) ) -;; definition for function hide-progress-screen -;; WARN: Return type mismatch int vs none. (defun hide-progress-screen () (if (and *progress-process* *progress-state* (!= (-> *progress-state* starting-state) 'title)) (set-next-state (-> *progress-process* 0) 'go-away 0) @@ -572,7 +545,6 @@ (none) ) -;; definition for method 26 of type progress (defmethod progress-method-26 progress ((obj progress)) (and *progress-process* (-> *progress-process* 0 next-state) @@ -580,7 +552,6 @@ ) ) -;; definition for function progress-allowed? (defun progress-allowed? () (not (or (-> *setting-control* user-current talking) (-> *setting-control* user-current movie) @@ -606,7 +577,6 @@ ) ) -;; definition for method 27 of type progress (defmethod can-go-back? progress ((obj progress)) (and (= (-> obj menu-transition) 0.0) (not (-> obj selected-option)) @@ -631,8 +601,6 @@ ) ) -;; definition for function menu-update-purchase-secrets -;; WARN: Return type mismatch symbol vs none. (defun menu-update-purchase-secrets ((arg0 menu-secret-option)) (let* ((a1-1 (logtest? (-> *game-info* secrets) (game-secrets hero-mode))) (v1-3 (if (not a1-1) @@ -666,7 +634,6 @@ (none) ) -;; definition for method 28 of type progress (defmethod progress-method-28 progress ((obj progress) (arg0 symbol)) (let ((v1-0 *progress-save-info*) (v0-0 arg0) @@ -764,7 +731,6 @@ ) ) -;; definition for method 29 of type progress (defmethod progress-method-29 progress ((obj progress)) (let ((v1-0 (-> obj state-pos))) (cond @@ -781,7 +747,6 @@ 0 ) -;; definition for method 30 of type progress (defmethod progress-method-30 progress ((obj progress)) (let ((v1-0 (-> obj state-pos))) (cond @@ -805,7 +770,6 @@ 0 ) -;; definition for method 31 of type progress (defmethod set-next-state progress ((obj progress) (arg0 symbol) (arg1 int)) "Set the next menu state specified by arg0 at the index specified by arg1." (set! (-> *progress-state* clear-screen) #f) @@ -852,7 +816,6 @@ 0 ) -;; definition for method 32 of type progress (defmethod set-menu-options progress ((obj progress) (arg0 symbol)) "Set the menu options for the menu state specified by arg0." (set! (-> obj current-options) #f) @@ -1060,8 +1023,6 @@ 0 ) -;; definition for method 25 of type progress -;; WARN: Return type mismatch int vs none. (defmethod progress-method-25 progress ((obj progress)) (mc-get-slot-info 0 *progress-save-info*) (when (-> obj current-options) @@ -1157,8 +1118,6 @@ (none) ) -;; definition for function progress-trans -;; WARN: Return type mismatch int vs none. (defbehavior progress-trans progress () (cond ((and (= (-> self next) 'none) @@ -1342,7 +1301,6 @@ (none) ) -;; definition for function begin-scan (defun begin-scan ((arg0 hud-box) (arg1 progress)) (cond ((or (= (-> arg1 current) 'bigmap) (= (-> arg1 next) 'bigmap)) @@ -1377,48 +1335,15 @@ 0 ) -;; definition for function end-scan (defun end-scan ((arg0 hud-box) (arg1 float)) - (let* ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (gp-0 (-> s5-0 base)) - ) + (with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id bucket-320) + ) (hud-box-method-13 arg0 s5-0 arg1) - (let ((a3-0 (-> s5-0 base))) - (let ((v1-8 (the-as object (-> s5-0 base)))) - (set! (-> (the-as dma-packet v1-8) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-8) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-8) vif1) (new 'static 'vif-tag)) - (set! (-> s5-0 base) (the-as pointer (&+ (the-as dma-packet v1-8) 16))) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id bucket-320) - gp-0 - (the-as (pointer dma-tag) a3-0) - ) - ) ) 0 ) -;; definition for function progress-post -;; INFO: Used lq/sq -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Stack slot offset 148 signed mismatch -;; WARN: Return type mismatch int vs none. (defbehavior progress-post progress () (local-vars (sv-144 font-context) (sv-148 int) (sv-152 hud-box) (sv-156 symbol)) (when (-> self current-options) @@ -1527,7 +1452,6 @@ (none) ) -;; failed to figure out what this is: (defstate come-in (progress) :virtual #t :enter (behavior () @@ -1572,7 +1496,6 @@ :post (the-as (function none :behavior progress) ja-post) ) -;; failed to figure out what this is: (defstate idle (progress) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -1795,7 +1718,6 @@ :post progress-post ) -;; failed to figure out what this is: (defstate go-away (progress) :virtual #t :enter (behavior () @@ -1839,7 +1761,6 @@ :post (the-as (function none :behavior progress) ja-post) ) -;; failed to figure out what this is: (defstate gone (progress) :virtual #t :code (behavior () @@ -1857,13 +1778,11 @@ ) ) -;; definition for method 9 of type menu-option (defmethod respond-progress menu-option ((obj menu-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." 0 ) -;; definition for method 9 of type menu-on-off-option (defmethod respond-progress menu-on-off-option ((obj menu-on-off-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((v1-1 (&-> *progress-state* on-off-choice)) @@ -1914,7 +1833,6 @@ 0 ) -;; definition for method 9 of type menu-yes-no-option (defmethod respond-progress menu-yes-no-option ((obj menu-yes-no-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((v1-1 (&-> *progress-state* yes-no-choice)) @@ -1956,7 +1874,6 @@ 0 ) -;; definition for method 9 of type menu-slider-option (defmethod respond-progress menu-slider-option ((obj menu-slider-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (-> *bigmap* progress-minimap) @@ -2039,7 +1956,6 @@ 0 ) -;; definition for method 9 of type menu-stereo-mode-sound-option (defmethod respond-progress menu-stereo-mode-sound-option ((obj menu-stereo-mode-sound-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (-> *bigmap* progress-minimap) @@ -2078,7 +1994,6 @@ 0 ) -;; definition for method 9 of type menu-main-menu-option (defmethod respond-progress menu-main-menu-option ((obj menu-main-menu-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (cond @@ -2174,7 +2089,6 @@ 0 ) -;; definition for method 9 of type menu-sub-menu-option (defmethod respond-progress menu-sub-menu-option ((obj menu-sub-menu-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (and (-> *progress-state* secrets-unlocked) @@ -2235,7 +2149,6 @@ 0 ) -;; definition for method 9 of type menu-unlocked-menu-option (defmethod respond-progress menu-unlocked-menu-option ((obj menu-unlocked-menu-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((s4-0 (memcard-unlocked-secrets? #t))) @@ -2377,7 +2290,6 @@ 0 ) -;; definition for method 9 of type menu-memcard-slot-option (defmethod respond-progress menu-memcard-slot-option ((obj menu-memcard-slot-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (memcard-unlocked-secrets? #t) @@ -2423,7 +2335,6 @@ 0 ) -;; definition for method 9 of type menu-already-exists-option (defmethod respond-progress menu-already-exists-option ((obj menu-already-exists-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((s4-0 (&-> *progress-state* yes-no-choice)) @@ -2466,7 +2377,6 @@ 0 ) -;; definition for method 9 of type menu-create-game-option (defmethod respond-progress menu-create-game-option ((obj menu-create-game-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((s4-0 (&-> *progress-state* yes-no-choice)) @@ -2512,7 +2422,6 @@ 0 ) -;; definition for method 9 of type menu-insufficient-space-option (defmethod respond-progress menu-insufficient-space-option ((obj menu-insufficient-space-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((s5-0 (&-> *progress-state* yes-no-choice)) @@ -2608,7 +2517,6 @@ 0 ) -;; definition for method 9 of type menu-secrets-insufficient-space-option (defmethod respond-progress menu-secrets-insufficient-space-option ((obj menu-secrets-insufficient-space-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (&-> *progress-state* yes-no-choice) @@ -2627,7 +2535,6 @@ 0 ) -;; definition for method 9 of type menu-video-mode-warning-option (defmethod respond-progress menu-video-mode-warning-option ((obj menu-video-mode-warning-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((v1-1 (&-> *progress-state* yes-no-choice)) @@ -2666,7 +2573,6 @@ 0 ) -;; definition for method 9 of type menu-video-mode-ok-option (defmethod respond-progress menu-video-mode-ok-option ((obj menu-video-mode-ok-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((v1-1 (&-> *progress-state* yes-no-choice)) @@ -2713,7 +2619,6 @@ 0 ) -;; definition for method 9 of type menu-progressive-mode-warning-option (defmethod respond-progress menu-progressive-mode-warning-option ((obj menu-progressive-mode-warning-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((v1-1 (&-> *progress-state* yes-no-choice)) @@ -2759,7 +2664,6 @@ 0 ) -;; definition for method 9 of type menu-progressive-mode-ok-option (defmethod respond-progress menu-progressive-mode-ok-option ((obj menu-progressive-mode-ok-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((v1-1 (&-> *progress-state* yes-no-choice)) @@ -2808,7 +2712,6 @@ 0 ) -;; definition for method 9 of type menu-card-removed-option (defmethod respond-progress menu-card-removed-option ((obj menu-card-removed-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) @@ -2820,7 +2723,6 @@ 0 ) -;; definition for method 9 of type menu-insert-card-option (defmethod respond-progress menu-insert-card-option ((obj menu-insert-card-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." *progress-save-info* @@ -2838,7 +2740,6 @@ 0 ) -;; definition for method 9 of type menu-error-loading-option (defmethod respond-progress menu-error-loading-option ((obj menu-error-loading-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) @@ -2850,7 +2751,6 @@ 0 ) -;; definition for method 9 of type menu-error-auto-saving-option (defmethod respond-progress menu-error-auto-saving-option ((obj menu-error-auto-saving-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) @@ -2862,7 +2762,6 @@ 0 ) -;; definition for method 9 of type menu-error-disc-removed-option (defmethod respond-progress menu-error-disc-removed-option ((obj menu-error-disc-removed-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) @@ -2876,7 +2775,6 @@ 0 ) -;; definition for method 9 of type menu-error-reading-option (defmethod respond-progress menu-error-reading-option ((obj menu-error-reading-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) @@ -2888,7 +2786,6 @@ 0 ) -;; definition for method 9 of type menu-icon-info-option (defmethod respond-progress menu-icon-info-option ((obj menu-icon-info-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) @@ -2900,7 +2797,6 @@ 0 ) -;; definition for method 9 of type menu-quit-option (defmethod respond-progress menu-quit-option ((obj menu-quit-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((v1-1 (&-> *progress-state* yes-no-choice)) @@ -2945,7 +2841,6 @@ 0 ) -;; definition for method 9 of type menu-format-card-option (defmethod respond-progress menu-format-card-option ((obj menu-format-card-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let ((s4-0 (&-> *progress-state* yes-no-choice)) @@ -2990,8 +2885,6 @@ 0 ) -;; definition for method 9 of type menu-select-start-option -;; WARN: disable def twice: 110. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod respond-progress menu-select-start-option ((obj menu-select-start-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (set! (-> arg0 sliding-height) (seek-ease @@ -3091,7 +2984,6 @@ 0 ) -;; definition for method 9 of type menu-select-scene-option (defmethod respond-progress menu-select-scene-option ((obj menu-select-scene-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (set! (-> arg0 sliding-height) (seek-ease @@ -3171,7 +3063,6 @@ 0 ) -;; definition for method 9 of type menu-bigmap-option (defmethod respond-progress menu-bigmap-option ((obj menu-bigmap-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." ((method-of-object *bigmap* bigmap-method-12)) @@ -3180,7 +3071,6 @@ 0 ) -;; definition for method 9 of type menu-missions-option (defmethod respond-progress menu-missions-option ((obj menu-missions-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (set! (-> arg0 sliding-height) (seek-ease @@ -3234,7 +3124,6 @@ 0 ) -;; definition for method 9 of type menu-highscores-option (defmethod respond-progress menu-highscores-option ((obj menu-highscores-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (set! (-> arg0 sliding) (seek-ease @@ -3306,7 +3195,6 @@ 0 ) -;; definition for method 9 of type menu-secret-option (defmethod respond-progress menu-secret-option ((obj menu-secret-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (let* ((s5-1 (logtest? (-> *game-info* secrets) (game-secrets hero-mode))) @@ -3429,7 +3317,6 @@ 0 ) -;; definition for method 9 of type menu-game-option (defmethod respond-progress menu-game-option ((obj menu-game-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (-> *progress-state* game-options-vibrations) @@ -3615,7 +3502,6 @@ 0 ) -;; definition for function update-center-screen (defun update-center-screen () (with-pp (let ((v1-0 #f)) @@ -3670,7 +3556,6 @@ ) ) -;; definition for method 9 of type menu-graphic-option (defmethod respond-progress menu-graphic-option ((obj menu-graphic-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (-> *progress-state* graphic-options-aspect-ratio) @@ -3867,7 +3752,6 @@ 0 ) -;; definition for function update-restart-quit (defun update-restart-quit ((arg0 menu-option) (arg1 progress) (arg2 symbol)) (let ((v1-1 (&-> *progress-state* yes-no-choice)) (gp-0 #f) @@ -3908,7 +3792,6 @@ 0 ) -;; definition for method 9 of type menu-qr-option (defmethod respond-progress menu-qr-option ((obj menu-qr-option) (arg0 progress) (arg1 object)) "Handle progress menu navigation logic." (-> *progress-state* qr-options-restart) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index fdd59bf7c4..c883fdbd18 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -165,7 +165,9 @@ "update-time-of-day", "close-sky-buffer", // asm "(method 29 level)", "(method 9 level)", "level-update-after-load", "(method 25 level)", "(method 9 level)", - "(method 12 level)", "(method 10 level)" + "(method 12 level)", "(method 10 level)", + + "(method 3 game-save)" ], "skip_compile_states": {