mirror of
https://github.com/open-goal/jak-project.git
synced 2025-03-09 00:51:15 +00:00
[decomp] Clean up - part 2 (#687)
* temp * temp2 * basic case support * working for or without else * support more cases * clean up to drawable headers * ocean * format json
This commit is contained in:
parent
d262dac40d
commit
656489e942
@ -444,6 +444,31 @@ PrettyPrinterNode* getNextListOrEmptyListOnLine(PrettyPrinterNode* start) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PrettyPrinterNode* get_case_start_case(PrettyPrinterNode* start) {
|
||||
auto node = start->next;
|
||||
while (node) {
|
||||
switch (node->tok->kind) {
|
||||
case FormToken::TokenKind::OPEN_PAREN:
|
||||
goto loop_end;
|
||||
break;
|
||||
case FormToken::TokenKind::WHITESPACE:
|
||||
break;
|
||||
default:
|
||||
return getNextListOnLine(start);
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
loop_end:
|
||||
node = node->paren;
|
||||
while (node && (!node->tok || node->tok->kind != FormToken::TokenKind::OPEN_PAREN)) {
|
||||
node = node->next;
|
||||
}
|
||||
if (!node) {
|
||||
return getNextListOnLine(start);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get the first open paren on the current line (can start in the middle of line, inclusive of
|
||||
* start) nullptr if there's no open parens on the rest of this line
|
||||
@ -678,8 +703,15 @@ void insertSpecialBreaks(NodePool& pool, PrettyPrinterNode* node) {
|
||||
}
|
||||
}
|
||||
|
||||
if (name == "cond") {
|
||||
auto* start_of_case = getNextListOnLine(node);
|
||||
if (name == "cond" || name == "case") {
|
||||
PrettyPrinterNode* start_of_case;
|
||||
if (name == "cond") {
|
||||
start_of_case = getNextListOnLine(node);
|
||||
} else {
|
||||
start_of_case = get_case_start_case(node);
|
||||
insertNewlineBefore(pool, start_of_case, 0);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
// let's break this case:
|
||||
assert(start_of_case->tok->kind == FormToken::TokenKind::OPEN_PAREN);
|
||||
@ -708,7 +740,23 @@ void insertSpecialBreaks(NodePool& pool, PrettyPrinterNode* node) {
|
||||
}
|
||||
|
||||
// break cond into a multi-line always
|
||||
breakList(pool, node->paren);
|
||||
if (name == "case") {
|
||||
auto next = node->next;
|
||||
if (next) {
|
||||
next = next->next;
|
||||
}
|
||||
if (next->tok && next->tok->kind == FormToken::TokenKind::OPEN_PAREN) {
|
||||
next = next->paren;
|
||||
if (next) {
|
||||
next = next->next;
|
||||
}
|
||||
}
|
||||
if (next) {
|
||||
// insertNewlineAfter(pool, next, 0);
|
||||
}
|
||||
} else {
|
||||
breakList(pool, node->paren);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,6 +280,7 @@ goos::Object UntilLoop_single::to_form() const {
|
||||
}
|
||||
|
||||
int UntilLoop_single::get_first_block_id() const {
|
||||
return block->get_first_block_id();
|
||||
assert(false);
|
||||
return -1;
|
||||
}
|
||||
@ -575,6 +576,10 @@ bool ControlFlowGraph::is_goto_not_end_and_unreachable(CfgVtx* b0, CfgVtx* b1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (b0->end_branch.asm_branch || b1->end_branch.asm_branch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// b0 should be an always branch, not likely.
|
||||
if (!b0->end_branch.has_branch || !b0->end_branch.branch_always || b0->end_branch.branch_likely) {
|
||||
return false;
|
||||
@ -903,6 +908,9 @@ bool ControlFlowGraph::find_infinite_continue() {
|
||||
|
||||
fmt::print("Considering {} as an infinite continue:\n", b0->to_string());
|
||||
|
||||
if (b0->end_branch.asm_branch) {
|
||||
return true;
|
||||
}
|
||||
if (dest_block >= my_block) {
|
||||
fmt::print(" Rejecting because destination block {} comes after me {}\n", dest_block,
|
||||
my_block);
|
||||
@ -1041,6 +1049,10 @@ bool ControlFlowGraph::is_sequence(CfgVtx* b0, CfgVtx* b1, bool allow_self_loops
|
||||
if (!b0 || !b1)
|
||||
return false;
|
||||
|
||||
// if (b0->end_branch.asm_branch || b1->end_branch.asm_branch) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (b0->next != b1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -554,6 +554,14 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input,
|
||||
return TP_Type::make_from_ts(arg1_type.typespec());
|
||||
}
|
||||
|
||||
if (m_kind == Kind::ADD && tc(dts, TypeSpec("structure"), arg0_type) &&
|
||||
arg1_type.is_integer_constant()) {
|
||||
auto type_info = dts.ts.lookup_type(arg0_type.typespec());
|
||||
if (type_info->get_size_in_memory() == arg1_type.get_integer_constant()) {
|
||||
return TP_Type::make_from_ts(arg0_type.typespec());
|
||||
}
|
||||
}
|
||||
|
||||
if (tc(dts, TypeSpec("structure"), arg1_type) && !m_args[0].is_int() &&
|
||||
is_int_or_uint(dts, arg0_type)) {
|
||||
if (arg1_type.typespec() == TypeSpec("symbol") &&
|
||||
|
@ -1363,6 +1363,107 @@ void CondNoElseElement::get_modified_regs(RegSet& regs) const {
|
||||
}
|
||||
}
|
||||
|
||||
CaseElement::CaseElement(Form* value, const std::vector<Entry>& entries, Form* else_body)
|
||||
: m_value(value), m_entries(entries), m_else_body(else_body) {
|
||||
m_value->parent_element = this;
|
||||
for (auto& entry : m_entries) {
|
||||
for (auto& val : entry.vals) {
|
||||
val->parent_element = this;
|
||||
}
|
||||
entry.body->parent_element = this;
|
||||
}
|
||||
if (m_else_body) {
|
||||
m_else_body->parent_element = this;
|
||||
}
|
||||
}
|
||||
|
||||
goos::Object CaseElement::to_form_internal(const Env& env) const {
|
||||
std::vector<goos::Object> list;
|
||||
list.push_back(pretty_print::to_symbol("case"));
|
||||
list.push_back(m_value->to_form(env));
|
||||
for (auto& e : m_entries) {
|
||||
std::vector<goos::Object> entry;
|
||||
|
||||
// cases
|
||||
std::vector<goos::Object> cases;
|
||||
for (auto& val : e.vals) {
|
||||
cases.push_back(val->to_form(env));
|
||||
}
|
||||
entry.push_back(pretty_print::build_list(cases));
|
||||
|
||||
// body
|
||||
e.body->inline_forms(entry, env);
|
||||
list.push_back(pretty_print::build_list(entry));
|
||||
}
|
||||
|
||||
if (m_else_body) {
|
||||
std::vector<goos::Object> entry;
|
||||
entry.push_back(pretty_print::to_symbol("else"));
|
||||
m_else_body->inline_forms(entry, env);
|
||||
list.push_back(pretty_print::build_list(entry));
|
||||
}
|
||||
return pretty_print::build_list(list);
|
||||
}
|
||||
|
||||
void CaseElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
f(this);
|
||||
m_value->apply(f);
|
||||
for (auto& e : m_entries) {
|
||||
for (auto& val : e.vals) {
|
||||
val->apply(f);
|
||||
}
|
||||
e.body->apply(f);
|
||||
}
|
||||
|
||||
if (m_else_body) {
|
||||
m_else_body->apply(f);
|
||||
}
|
||||
}
|
||||
|
||||
void CaseElement::apply_form(const std::function<void(Form*)>& f) {
|
||||
m_value->apply_form(f);
|
||||
for (auto& e : m_entries) {
|
||||
for (auto& val : e.vals) {
|
||||
val->apply_form(f);
|
||||
}
|
||||
e.body->apply_form(f);
|
||||
}
|
||||
|
||||
if (m_else_body) {
|
||||
m_else_body->apply_form(f);
|
||||
}
|
||||
}
|
||||
|
||||
void CaseElement::collect_vars(RegAccessSet& vars, bool recursive) const {
|
||||
if (recursive) {
|
||||
m_value->collect_vars(vars, recursive);
|
||||
for (auto& e : m_entries) {
|
||||
for (auto& val : e.vals) {
|
||||
val->collect_vars(vars, recursive);
|
||||
}
|
||||
e.body->collect_vars(vars, recursive);
|
||||
}
|
||||
|
||||
if (m_else_body) {
|
||||
m_else_body->collect_vars(vars, recursive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CaseElement::get_modified_regs(RegSet& regs) const {
|
||||
m_value->get_modified_regs(regs);
|
||||
for (auto& e : m_entries) {
|
||||
for (auto& val : e.vals) {
|
||||
val->get_modified_regs(regs);
|
||||
}
|
||||
e.body->get_modified_regs(regs);
|
||||
}
|
||||
|
||||
if (m_else_body) {
|
||||
m_else_body->get_modified_regs(regs);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// AbsElement
|
||||
/////////////////////////////
|
||||
|
@ -842,6 +842,27 @@ class CondNoElseElement : public FormElement {
|
||||
bool allow_in_if() const override { return false; }
|
||||
};
|
||||
|
||||
class CaseElement : public FormElement {
|
||||
public:
|
||||
struct Entry {
|
||||
std::vector<Form*> vals;
|
||||
Form* body = nullptr;
|
||||
};
|
||||
|
||||
CaseElement(Form* value, const std::vector<Entry>& entries, Form* else_body);
|
||||
goos::Object to_form_internal(const Env& env) const override;
|
||||
void apply(const std::function<void(FormElement*)>& f) override;
|
||||
void apply_form(const std::function<void(Form*)>& f) override;
|
||||
void collect_vars(RegAccessSet& vars, bool recursive) const override;
|
||||
void get_modified_regs(RegSet& regs) const override;
|
||||
bool allow_in_if() const override { return false; }
|
||||
|
||||
private:
|
||||
Form* m_value = nullptr;
|
||||
std::vector<Entry> m_entries;
|
||||
Form* m_else_body = nullptr; // may be nullptr, if no else.
|
||||
};
|
||||
|
||||
/*!
|
||||
* Represents a (abs x) expression.
|
||||
*/
|
||||
|
@ -883,6 +883,17 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
|
||||
}
|
||||
|
||||
auto arg0_type = env.get_types_before_op(m_my_idx).get(m_expr.get_arg(0).var().reg());
|
||||
|
||||
if (env.dts->ts.tc(TypeSpec("structure"), arg0_type.typespec()) && m_expr.get_arg(1).is_int()) {
|
||||
auto type_info = env.dts->ts.lookup_type(arg0_type.typespec());
|
||||
if (type_info->get_size_in_memory() == m_expr.get_arg(1).get_int()) {
|
||||
auto new_form = pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_fixed(FixedOperatorKind::ADDITION_PTR), args.at(0), args.at(1));
|
||||
result->push_back(new_form);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((arg0_i && arg1_i) || (arg0_u && arg1_u)) {
|
||||
auto new_form = pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_fixed(FixedOperatorKind::ADDITION), args.at(0), args.at(1));
|
||||
@ -2390,8 +2401,8 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
||||
if (tp_type.kind != TP_Type::Kind::NON_VIRTUAL_METHOD) {
|
||||
throw std::runtime_error(fmt::format(
|
||||
"Method internal mismatch. METHOD_OF_TYPE operator didn't get a NON_VIRTUAL_METHOD "
|
||||
"type. Got {} instead.",
|
||||
tp_type.print()));
|
||||
"type. Got {} instead. {} {}",
|
||||
tp_type.print(), name, match_result.maps.forms.at(type_source)->to_string(env)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,8 +625,8 @@ Form* cast_sound_name(FormPool& pool, const Env& env, Form* in) {
|
||||
auto hi = mr.maps.forms.at(1);
|
||||
auto lo = mr.maps.forms.at(0);
|
||||
|
||||
auto hi_int = get_goal_integer_constant(hi, env);
|
||||
auto lo_int = get_goal_integer_constant(lo, env);
|
||||
auto hi_int = get_goal_integer_constant(strip_int_or_uint_cast(hi), env);
|
||||
auto lo_int = get_goal_integer_constant(strip_int_or_uint_cast(lo), env);
|
||||
if (!hi_int || !lo_int) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -63,7 +63,9 @@ class ObjectFileDB {
|
||||
bool print_hex);
|
||||
|
||||
void analyze_functions_ir1(const Config& config);
|
||||
void analyze_functions_ir2(const std::string& output_dir, const Config& config);
|
||||
void analyze_functions_ir2(const std::string& output_dir,
|
||||
const Config& config,
|
||||
bool skip_debug_output = false);
|
||||
void ir2_top_level_pass(const Config& config);
|
||||
void ir2_stack_spill_slot_pass();
|
||||
void ir2_basic_block_pass(const Config& config);
|
||||
|
@ -30,7 +30,9 @@ namespace decompiler {
|
||||
* At this point, we assume that the files are loaded and we've run find_code to locate all
|
||||
* functions, but nothing else.
|
||||
*/
|
||||
void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir, const Config& config) {
|
||||
void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir,
|
||||
const Config& config,
|
||||
bool skip_debug_output) {
|
||||
lg::info("Using IR2 analysis...");
|
||||
lg::info("Processing top-level functions...");
|
||||
ir2_top_level_pass(config);
|
||||
@ -55,8 +57,11 @@ void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir, const Co
|
||||
lg::info("Initial structuring...");
|
||||
ir2_cfg_build_pass();
|
||||
|
||||
lg::info("Storing temporary form result...");
|
||||
ir2_store_current_forms();
|
||||
if (!skip_debug_output) {
|
||||
lg::info("Storing temporary form result...");
|
||||
ir2_store_current_forms();
|
||||
}
|
||||
|
||||
lg::info("Expression building...");
|
||||
ir2_build_expressions(config);
|
||||
lg::info("Re-writing inline asm instructions...");
|
||||
|
@ -36,7 +36,7 @@ If the previous let variables appear in the definition of new one, make the let
|
||||
*/
|
||||
|
||||
namespace {
|
||||
std::vector<Form*> path_up_tree(Form* in, const Env& env) {
|
||||
std::vector<Form*> path_up_tree(Form* in, const Env&) {
|
||||
std::vector<Form*> path;
|
||||
|
||||
while (in) {
|
||||
@ -357,6 +357,174 @@ FormElement* rewrite_empty_let(LetElement* in, const Env&, FormPool&) {
|
||||
return in->entries().at(0).src->try_as_single_element();
|
||||
}
|
||||
|
||||
Form* strip_truthy(Form* in) {
|
||||
auto as_ge = in->try_as_element<GenericElement>();
|
||||
if (as_ge) {
|
||||
if (as_ge->op().kind() == GenericOperator::Kind::CONDITION_OPERATOR &&
|
||||
as_ge->op().condition_kind() == IR2_Condition::Kind::TRUTHY) {
|
||||
in = as_ge->elts().at(0);
|
||||
}
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
ShortCircuitElement* get_or(Form* in) {
|
||||
// strip off truthy
|
||||
in = strip_truthy(in);
|
||||
|
||||
return in->try_as_element<ShortCircuitElement>();
|
||||
}
|
||||
|
||||
FormElement* rewrite_as_case_no_else(LetElement* in, const Env& env, FormPool& pool) {
|
||||
if (in->entries().size() != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* cond = in->body()->try_as_element<CondNoElseElement>();
|
||||
if (!cond) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto case_var = in->entries().at(0).dest;
|
||||
auto& case_var_uses = env.get_use_def_info(case_var);
|
||||
int found_uses = 0;
|
||||
if (case_var_uses.def_count() != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
auto case_var_name = env.get_variable_name(case_var);
|
||||
|
||||
std::vector<CaseElement::Entry> entries;
|
||||
|
||||
for (auto& e : cond->entries) {
|
||||
// first, lets see if its just (= case_var <expr>)
|
||||
auto single_matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::EQ),
|
||||
{Matcher::any_reg(0), Matcher::any(1)});
|
||||
|
||||
auto single_matcher_result = match(single_matcher, e.condition);
|
||||
|
||||
Form* single_value = nullptr;
|
||||
if (single_matcher_result.matched) {
|
||||
auto var_name = env.get_variable_name(*single_matcher_result.maps.regs.at(0));
|
||||
if (var_name == case_var_name) {
|
||||
single_value = single_matcher_result.maps.forms.at(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (single_value) {
|
||||
entries.push_back({{single_value}, e.body});
|
||||
found_uses++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// try as an or (or (= case_var <expr>) ...)
|
||||
auto* as_or = get_or(e.condition);
|
||||
if (!as_or) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CaseElement::Entry current_entry;
|
||||
for (auto& or_case : as_or->entries) {
|
||||
auto or_single_matcher_result = match(single_matcher, strip_truthy(or_case.condition));
|
||||
if (!or_single_matcher_result.matched) {
|
||||
return nullptr;
|
||||
}
|
||||
auto var_name = env.get_variable_name(*or_single_matcher_result.maps.regs.at(0));
|
||||
if (var_name != case_var_name) {
|
||||
return nullptr;
|
||||
}
|
||||
found_uses++;
|
||||
current_entry.vals.push_back(or_single_matcher_result.maps.forms.at(1));
|
||||
}
|
||||
current_entry.body = e.body;
|
||||
entries.push_back(current_entry);
|
||||
|
||||
// no match
|
||||
// return nullptr;
|
||||
}
|
||||
|
||||
if (found_uses != case_var_uses.use_count()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pool.alloc_element<CaseElement>(in->entries().at(0).src, entries, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FormElement* rewrite_as_case_with_else(LetElement* in, const Env& env, FormPool& pool) {
|
||||
if (in->entries().size() != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* cond = in->body()->try_as_element<CondWithElseElement>();
|
||||
if (!cond) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto case_var = in->entries().at(0).dest;
|
||||
auto& case_var_uses = env.get_use_def_info(case_var);
|
||||
int found_uses = 0;
|
||||
if (case_var_uses.def_count() != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
auto case_var_name = env.get_variable_name(case_var);
|
||||
|
||||
std::vector<CaseElement::Entry> entries;
|
||||
|
||||
for (auto& e : cond->entries) {
|
||||
// first, lets see if its just (= case_var <expr>)
|
||||
auto single_matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::EQ),
|
||||
{Matcher::any_reg(0), Matcher::any(1)});
|
||||
|
||||
auto single_matcher_result = match(single_matcher, e.condition);
|
||||
|
||||
Form* single_value = nullptr;
|
||||
if (single_matcher_result.matched) {
|
||||
auto var_name = env.get_variable_name(*single_matcher_result.maps.regs.at(0));
|
||||
if (var_name == case_var_name) {
|
||||
single_value = single_matcher_result.maps.forms.at(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (single_value) {
|
||||
entries.push_back({{single_value}, e.body});
|
||||
found_uses++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// try as an or (or (= case_var <expr>) ...)
|
||||
auto* as_or = get_or(e.condition);
|
||||
if (!as_or) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CaseElement::Entry current_entry;
|
||||
for (auto& or_case : as_or->entries) {
|
||||
auto or_single_matcher_result = match(single_matcher, strip_truthy(or_case.condition));
|
||||
if (!or_single_matcher_result.matched) {
|
||||
return nullptr;
|
||||
}
|
||||
auto var_name = env.get_variable_name(*or_single_matcher_result.maps.regs.at(0));
|
||||
if (var_name != case_var_name) {
|
||||
return nullptr;
|
||||
}
|
||||
found_uses++;
|
||||
current_entry.vals.push_back(or_single_matcher_result.maps.forms.at(1));
|
||||
}
|
||||
current_entry.body = e.body;
|
||||
entries.push_back(current_entry);
|
||||
|
||||
// no match
|
||||
// return nullptr;
|
||||
}
|
||||
|
||||
if (found_uses != case_var_uses.use_count()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pool.alloc_element<CaseElement>(in->entries().at(0).src, entries, cond->else_ir);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Attempt to rewrite a let as another form. If it cannot be rewritten, this will return nullptr.
|
||||
*/
|
||||
@ -386,6 +554,16 @@ FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool) {
|
||||
return as_unused;
|
||||
}
|
||||
|
||||
auto as_case_no_else = rewrite_as_case_no_else(in, env, pool);
|
||||
if (as_case_no_else) {
|
||||
return as_case_no_else;
|
||||
}
|
||||
|
||||
auto as_case_with_else = rewrite_as_case_with_else(in, env, pool);
|
||||
if (as_case_with_else) {
|
||||
return as_case_with_else;
|
||||
}
|
||||
|
||||
// nothing matched.
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ bool run_type_analysis_ir2(const TypeSpec& my_type, DecompilerTypeSystem& dts, F
|
||||
}
|
||||
|
||||
std::vector<TypeState> block_init_types, op_types;
|
||||
std::vector<bool> block_needs_update(func.basic_blocks.size(), true);
|
||||
block_init_types.resize(func.basic_blocks.size());
|
||||
op_types.resize(func.ir2.atomic_ops->ops.size());
|
||||
auto& aop = func.ir2.atomic_ops;
|
||||
@ -111,6 +112,9 @@ bool run_type_analysis_ir2(const TypeSpec& my_type, DecompilerTypeSystem& dts, F
|
||||
run_again = false;
|
||||
// do each block in the topological sort order:
|
||||
for (auto block_id : order.vist_order) {
|
||||
if (!block_needs_update.at(block_id)) {
|
||||
continue;
|
||||
}
|
||||
auto& block = func.basic_blocks.at(block_id);
|
||||
TypeState* init_types = &block_init_types.at(block_id);
|
||||
for (int op_id = aop->block_id_to_first_atomic_op.at(block_id);
|
||||
@ -145,6 +149,7 @@ bool run_type_analysis_ir2(const TypeSpec& my_type, DecompilerTypeSystem& dts, F
|
||||
// for the next op...
|
||||
init_types = &op_types.at(op_id);
|
||||
}
|
||||
block_needs_update.at(block_id) = false;
|
||||
|
||||
// propagate the types: for each possible succ
|
||||
for (auto succ_block_id : {block.succ_ft, block.succ_branch}) {
|
||||
@ -153,6 +158,7 @@ bool run_type_analysis_ir2(const TypeSpec& my_type, DecompilerTypeSystem& dts, F
|
||||
if (dts.tp_lca(&block_init_types.at(succ_block_id), *init_types)) {
|
||||
// if something changed, run again!
|
||||
run_again = true;
|
||||
block_needs_update.at(succ_block_id) = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -498,6 +498,7 @@
|
||||
:type int32
|
||||
:bitfield #f
|
||||
|
||||
(bucket-3 3)
|
||||
(tfrag-tex0 5)
|
||||
;; merc0 10
|
||||
;; generic0 11
|
||||
@ -529,6 +530,7 @@
|
||||
(water-tex1 60)
|
||||
;; merc1 61
|
||||
;; generic1 62
|
||||
(bucket-65 65)
|
||||
;; debug spheres? 67
|
||||
(debug-draw0 67)
|
||||
;; debug text 68
|
||||
@ -3448,7 +3450,7 @@
|
||||
|
||||
(define-extern dma-buffer-add-buckets (function dma-buffer int none))
|
||||
(define-extern dma-buffer-patch-buckets (function dma-bucket int dma-bucket))
|
||||
(define-extern dma-bucket-insert-tag (function dma-bucket int pointer (pointer dma-tag) pointer))
|
||||
(define-extern dma-bucket-insert-tag (function dma-bucket bucket-id pointer (pointer dma-tag) pointer))
|
||||
|
||||
|
||||
;; ----------------------
|
||||
@ -4553,7 +4555,7 @@
|
||||
(dummy-18 () none 18)
|
||||
(dummy-19 () none 19)
|
||||
(unload! (_type_ texture-page) int 20)
|
||||
(upload-one-common! (_type_) symbol 21)
|
||||
(upload-one-common! (_type_ level) symbol 21)
|
||||
(lookup-boot-common-id (_type_ int) int 22)
|
||||
)
|
||||
)
|
||||
@ -4860,7 +4862,7 @@
|
||||
(add-irq-to-tex-buckets! (_type_) none 11)
|
||||
(unload! (_type_) _type_ 12)
|
||||
(bsp-name (_type_) symbol 13)
|
||||
(dummy-14 (_type_ object) none 14)
|
||||
(dummy-14 (_type_ object) memory-usage-block 14)
|
||||
(dummy-15 (_type_ vector) symbol 15)
|
||||
(dummy-16 (_type_) none 16)
|
||||
(load-continue (_type_) _type_ 17)
|
||||
@ -4881,8 +4883,8 @@
|
||||
(declare-type entity-links structure)
|
||||
(deftype level-group (basic)
|
||||
((length int32 :offset-assert 4)
|
||||
(unknown-level-1 level :offset-assert 8)
|
||||
(unknown-level-2 level :offset-assert 12)
|
||||
(log-in-level level :offset-assert 8)
|
||||
(loading-level level :offset-assert 12)
|
||||
(entity-link entity-links :offset-assert 16) ;; not sure what's going on here
|
||||
(border? basic :offset-assert 20)
|
||||
(vis? basic :offset-assert 24)
|
||||
@ -4910,7 +4912,7 @@
|
||||
(level-get-for-use (_type_ symbol symbol) level 11)
|
||||
(activate-levels! (_type_) int 12)
|
||||
(dummy-13 () none 13)
|
||||
(dummy-14 () none 14)
|
||||
(dummy-14 (_type_ object) none 14)
|
||||
(dummy-15 () none 15)
|
||||
(dummy-16 (_type_) int 16)
|
||||
(level-get-target-inside (_type_) level 17)
|
||||
@ -5375,7 +5377,7 @@
|
||||
(sfx-volume float :offset-assert 4)
|
||||
(music-volume float :offset-assert 8)
|
||||
(dialog-volume float :offset-assert 12)
|
||||
(process-mask uint32 :offset-assert 16)
|
||||
(process-mask process-mask :offset-assert 16)
|
||||
(common-page int32 :offset-assert 20)
|
||||
(language int64 :offset-assert 24)
|
||||
(screenx int32 :offset-assert 32)
|
||||
@ -5551,8 +5553,8 @@
|
||||
(define-extern loado (function string kheap object))
|
||||
(define-extern texture-relocate (function dma-buffer texture int gs-psm int dma-buffer))
|
||||
(define-extern dma-buffer-add-ref-texture (function dma-buffer pointer int int gs-psm none))
|
||||
(define-extern upload-vram-pages (function texture-pool texture-pool-segment texture-page int int int))
|
||||
(define-extern upload-vram-pages-pris (function texture-pool texture-pool-segment texture-page int int int))
|
||||
(define-extern upload-vram-pages (function texture-pool texture-pool-segment texture-page int bucket-id int))
|
||||
(define-extern upload-vram-pages-pris (function texture-pool texture-pool-segment texture-page bucket-id int int))
|
||||
(define-extern movie? (function symbol))
|
||||
(define-extern texture-page-near-allocate-1 (function texture-pool texture-page kheap int texture-page))
|
||||
(define-extern texture-page-near-allocate-0 (function texture-pool texture-page kheap int texture-page))
|
||||
@ -5775,7 +5777,7 @@
|
||||
)
|
||||
|
||||
(deftype skeleton (inline-array-class)
|
||||
()
|
||||
((bones bone :inline :dynamic))
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
@ -5819,6 +5821,7 @@
|
||||
|
||||
;; - Types
|
||||
|
||||
(declare-type ambient-list structure)
|
||||
(deftype drawable (basic)
|
||||
((id int16 :offset-assert 4)
|
||||
; (unknown basic :offset-assert 8) ;; - from default-menu::build-instance-list
|
||||
@ -5836,7 +5839,7 @@
|
||||
(dummy-14 () none 14)
|
||||
(dummy-15 (_type_) none 15)
|
||||
(dummy-16 (_type_ object object) object 16)
|
||||
(dummy-17 () none 17)
|
||||
(dummy-17 (_type_ sphere int ambient-list) none 17)
|
||||
)
|
||||
)
|
||||
|
||||
@ -5906,24 +5909,18 @@
|
||||
;; field distance is a float printed as hex?
|
||||
)
|
||||
|
||||
; (deftype drawable-inline-array-node (drawable-inline-array)
|
||||
; ()
|
||||
; :method-count-assert 18
|
||||
; :size-assert #x44
|
||||
; :flag-assert #x1200000044
|
||||
; ;; too many basic blocks
|
||||
; (:methods
|
||||
; (dummy-9 () none 9)
|
||||
; (dummy-10 () none 10)
|
||||
; (dummy-11 () none 11)
|
||||
; (dummy-12 () none 12)
|
||||
; (dummy-13 () none 13)
|
||||
; (dummy-14 () none 14)
|
||||
; (dummy-15 () none 15)
|
||||
; (dummy-16 () none 16)
|
||||
; (dummy-17 () none 17)
|
||||
; )
|
||||
; )
|
||||
(deftype drawable-inline-array-node (drawable-inline-array)
|
||||
((data draw-node 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
:method-count-assert 18
|
||||
:size-assert #x44
|
||||
:flag-assert #x1200000044
|
||||
;; too many basic blocks
|
||||
(:methods
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
(deftype draw-node-dma (structure)
|
||||
((banka draw-node 32 :inline :offset-assert 0)
|
||||
@ -6038,14 +6035,13 @@
|
||||
|
||||
(deftype ambient-list (structure)
|
||||
((num-items int32 :offset-assert 0)
|
||||
(items uint32 2048 :offset-assert 4)
|
||||
(items drawable-ambient 2048 :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2004
|
||||
:flag-assert #x900002004
|
||||
)
|
||||
|
||||
|
||||
;; ----------------------
|
||||
;; File - game-task-h
|
||||
;; Source Path - engine/game/task/game-task-h.gc
|
||||
@ -6515,9 +6511,10 @@
|
||||
)
|
||||
|
||||
(deftype ocean-mid-mask (structure)
|
||||
((mask uint8 8 :offset-assert 0)
|
||||
((mask uint8 8 :offset-assert 0 :do-not-decompile) ;; avoid huge arrays.
|
||||
(dword uint64 :offset 0)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
@ -6532,7 +6529,7 @@
|
||||
)
|
||||
|
||||
(deftype ocean-mid-masks (basic)
|
||||
((data uint32 :offset-assert 4)
|
||||
((data (inline-array ocean-mid-mask) :offset-assert 4)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
@ -6561,7 +6558,7 @@
|
||||
)
|
||||
|
||||
(deftype ocean-trans-indices (basic)
|
||||
((data uint32 2304 :offset-assert 4)
|
||||
((data ocean-trans-index 2304 :inline :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2404
|
||||
@ -6577,7 +6574,7 @@
|
||||
)
|
||||
|
||||
(deftype ocean-near-indices (basic)
|
||||
((data uint32 :offset-assert 4)
|
||||
((data (inline-array ocean-near-index) :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
@ -7443,7 +7440,7 @@
|
||||
)
|
||||
|
||||
(deftype art-mesh-anim (art-element)
|
||||
()
|
||||
((data basic :dynamic))
|
||||
:method-count-assert 13
|
||||
:size-assert #x20
|
||||
:flag-assert #xd00000020
|
||||
@ -8848,8 +8845,8 @@
|
||||
(auto-save-status uint32 :offset-assert 280)
|
||||
(auto-save-card int32 :offset-assert 284)
|
||||
(auto-save-which int32 :offset-assert 288)
|
||||
(pov-camera-handle uint64 :offset-assert 296)
|
||||
(other-camera-handle uint64 :offset-assert 304)
|
||||
(pov-camera-handle handle :offset-assert 296)
|
||||
(other-camera-handle handle :offset-assert 304)
|
||||
(death-pos vector-array :offset-assert 312)
|
||||
(dummy basic :offset-assert 316)
|
||||
(auto-save-count int32 :offset-assert 320)
|
||||
@ -11588,7 +11585,7 @@
|
||||
(unk-data-1 pointer :offset-assert 60)
|
||||
(unk-data-1-len int32 :offset-assert 64)
|
||||
|
||||
(unk-zero-0 uint32 :offset-assert 68)
|
||||
(unk-zero-0 basic :offset-assert 68)
|
||||
|
||||
(name symbol :offset-assert 72)
|
||||
(nickname symbol :offset-assert 76)
|
||||
@ -11616,7 +11613,6 @@
|
||||
:flag-assert #x1400000190
|
||||
(:methods
|
||||
(relocate (_type_ kheap (pointer uint8)) none :replace 7)
|
||||
(dummy-17 () none 17)
|
||||
(dummy-18 (_type_) none 18)
|
||||
(dummy-19 (_type_) none 19)
|
||||
)
|
||||
@ -12324,7 +12320,7 @@
|
||||
(dma-level-0 uint32 :offset 32)
|
||||
(dma-base uint32 :offset 36)
|
||||
(dma-level-1 uint32 :offset 40)
|
||||
(dma-qwc uint32 4 :offset-assert 44)
|
||||
(dma-qwc uint32 4 :offset 44)
|
||||
(shader uint32 :offset 48)
|
||||
(num-shaders uint8 :offset 52)
|
||||
(num-base-colors uint8 :offset 53)
|
||||
@ -12359,7 +12355,7 @@
|
||||
)
|
||||
|
||||
(deftype drawable-tree-tfrag (drawable-tree)
|
||||
()
|
||||
((time-of-day-pal time-of-day-palette :offset 12))
|
||||
:method-count-assert #x12
|
||||
:size-assert #x24
|
||||
:flag-assert #x1200000024
|
||||
@ -14016,7 +14012,7 @@
|
||||
(dummy-17 () none 17)
|
||||
(dummy-18 () none 18)
|
||||
(dummy-19 () none 19)
|
||||
(dummy-20 () none 20)
|
||||
(hidden? (_type_) symbol 20)
|
||||
(dummy-21 () none 21)
|
||||
(dummy-22 () none 22)
|
||||
(TODO-RENAME-23 (_type_ symbol symbol) none 23)
|
||||
@ -14797,9 +14793,9 @@
|
||||
|
||||
(define-extern print-cl-stat function)
|
||||
(define-extern clear-cl-stat function)
|
||||
(define-extern mem-usage-bsp-tree function)
|
||||
(define-extern mem-usage-bsp-tree (function bsp-header (inline-array bsp-node) memory-usage-block int none))
|
||||
(define-extern bsp-camera-asm function)
|
||||
(define-extern print-collide-stats function)
|
||||
(define-extern print-collide-stats (function none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
@ -14817,12 +14813,12 @@
|
||||
(define-extern perf-stat-bucket->string function)
|
||||
(define-extern print-tr-stat function)
|
||||
(define-extern clear-tr-stat function)
|
||||
(define-extern print-terrain-stats function)
|
||||
(define-extern print-terrain-stats (function none))
|
||||
(define-extern update-subdivide-settings! function)
|
||||
(define-extern set-tfrag-dists! function)
|
||||
(define-extern start-perf-stat-collection function)
|
||||
(define-extern end-perf-stat-collection function)
|
||||
(define-extern print-perf-stats function)
|
||||
(define-extern start-perf-stat-collection (function engine display-frame int int none))
|
||||
(define-extern end-perf-stat-collection (function none))
|
||||
(define-extern print-perf-stats (function none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
@ -14944,7 +14940,7 @@
|
||||
(define-extern add-to-sprite-aux-list function)
|
||||
(define-extern sprite-set-3d-quaternion! function)
|
||||
(define-extern sprite-get-3d-quaternion! function)
|
||||
(define-extern sprite-draw function)
|
||||
(define-extern sprite-draw (function display none))
|
||||
(define-extern sprite-allocate-user-hvdf function)
|
||||
(define-extern sprite-release-user-hvdf function)
|
||||
(define-extern sprite-get-user-hvdf function)
|
||||
@ -15348,7 +15344,7 @@
|
||||
(define-extern bones-init function)
|
||||
(define-extern draw-bones-mtx-calc function)
|
||||
(define-extern bones-mtx-calc function)
|
||||
(define-extern bones-mtx-calc-execute function)
|
||||
(define-extern bones-mtx-calc-execute (function none))
|
||||
(define-extern bones-wrapup function)
|
||||
(define-extern dump-qword function)
|
||||
(define-extern bones-debug function)
|
||||
@ -15368,7 +15364,7 @@
|
||||
;;(define-extern bones-vu0-block object) ;; unknown type
|
||||
;;(define-extern *texscroll-globals* object) ;; unknown type
|
||||
;;(define-extern *use-generic* object) ;; unknown type
|
||||
;;(define-extern *merc-global-array* object) ;; unknown type
|
||||
(define-extern *merc-global-array* merc-global-array) ;; unknown type
|
||||
;;(define-extern *bones-first* object) ;; unknown type
|
||||
;;(define-extern *default-shadow-settings* object) ;; unknown type
|
||||
|
||||
@ -15491,7 +15487,7 @@
|
||||
(define-extern high-speed-reject function)
|
||||
(define-extern generic-merc-execute-asm function)
|
||||
(define-extern generic-merc-add-to-cue function)
|
||||
(define-extern generic-merc-execute-all function)
|
||||
(define-extern generic-merc-execute-all (function none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
@ -15589,7 +15585,7 @@
|
||||
(define-extern shadow-add-single-edges function)
|
||||
(define-extern shadow-add-double-tris function)
|
||||
(define-extern shadow-add-double-edges function)
|
||||
(define-extern shadow-execute-all function)
|
||||
(define-extern shadow-execute-all (function dma-buffer shadow-queue none))
|
||||
|
||||
;; - Symbols
|
||||
|
||||
@ -15728,8 +15724,8 @@
|
||||
(define-extern draw-drawable-tree-ice-tfrag function)
|
||||
(define-extern tie-near-make-perspective-matrix function)
|
||||
(define-extern draw-drawable-tree-instance-tie function)
|
||||
(define-extern init-background function)
|
||||
(define-extern finish-background function)
|
||||
(define-extern init-background (function none))
|
||||
(define-extern finish-background (function none))
|
||||
|
||||
;; - Symbols
|
||||
|
||||
@ -15772,7 +15768,7 @@
|
||||
(define-extern shrub-upload-view-data function)
|
||||
(define-extern shrub-init-view-data function)
|
||||
(define-extern mem-usage-shrub-walk function)
|
||||
(define-extern shrub-make-perspective-matrix function)
|
||||
(define-extern shrub-make-perspective-matrix (function matrix none))
|
||||
(define-extern shrub-time function)
|
||||
(define-extern draw-inline-array-instance-shrub function)
|
||||
(define-extern draw-prototype-inline-array-shrub function)
|
||||
@ -16349,7 +16345,7 @@
|
||||
(define-extern close-specific-task! (function game-task task-status int))
|
||||
(define-extern reset-all-hint-controls (function none))
|
||||
(define-extern reset-actors (function symbol none))
|
||||
(define-extern set-blackout-frames (function int uint))
|
||||
(define-extern set-blackout-frames (function int int))
|
||||
(define-extern set-master-mode (function symbol none))
|
||||
(define-extern stop (function symbol int))
|
||||
(define-extern start (function symbol continue-point target))
|
||||
@ -16976,7 +16972,7 @@
|
||||
(define-extern time-of-day-setup (function symbol int none)) ;; not confirmed
|
||||
(define-extern set-time-of-day function)
|
||||
(define-extern init-time-of-day-context (function time-of-day-context none))
|
||||
(define-extern update-time-of-day function)
|
||||
(define-extern update-time-of-day (function time-of-day-context none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
@ -17068,7 +17064,7 @@
|
||||
(define-extern clip-polygon-against-negative-hyperplane function)
|
||||
(define-extern sky-duplicate-polys function)
|
||||
(define-extern sky-tng-setup-clouds function)
|
||||
(define-extern render-sky-tng function)
|
||||
(define-extern render-sky-tng (function time-of-day-context none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
@ -17217,7 +17213,7 @@
|
||||
(define-extern lb-set-camera function)
|
||||
(define-extern lb-set-player function)
|
||||
(define-extern lb-copy function)
|
||||
(define-extern render-boundaries function)
|
||||
(define-extern render-boundaries (function none))
|
||||
(define-extern command-get-time function)
|
||||
|
||||
;; - Unknowns
|
||||
@ -17314,19 +17310,20 @@
|
||||
;; - Functions
|
||||
|
||||
(define-extern set-font-color-alpha function)
|
||||
(define-extern load-game-text-info function)
|
||||
(define-extern load-game-text-info (function string symbol kheap int))
|
||||
(define-extern load-level-text-files (function int none))
|
||||
(define-extern draw-debug-text-box function)
|
||||
(define-extern print-game-text-scaled function)
|
||||
(define-extern disable-level-text-file-loading function)
|
||||
(define-extern enable-level-text-file-loading function)
|
||||
(define-extern link (function pointer pointer int kheap int pointer))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
;;(define-extern *level-text-file-load-flag* object) ;; unknown type
|
||||
;;(define-extern *game-text-line* object) ;; unknown type
|
||||
;;(define-extern *game-text-word* object) ;; unknown type
|
||||
;;(define-extern text-is-loading object) ;; unknown type
|
||||
(define-extern *level-text-file-load-flag* symbol)
|
||||
(define-extern *game-text-line* string)
|
||||
(define-extern *game-text-word* string)
|
||||
(define-extern text-is-loading symbol)
|
||||
|
||||
|
||||
;; ----------------------
|
||||
@ -17485,7 +17482,7 @@
|
||||
(define-extern find-ground-point function)
|
||||
(define-extern default-collision-reaction function)
|
||||
(define-extern simple-collision-reaction function)
|
||||
(define-extern collide-shape-draw-debug-marks function)
|
||||
(define-extern collide-shape-draw-debug-marks (function none))
|
||||
(define-extern debug-report-col-stats function)
|
||||
|
||||
;; - Unknowns
|
||||
@ -19357,7 +19354,7 @@
|
||||
(define-extern toggle-pause (function int))
|
||||
(define-extern deactivate-progress (function none))
|
||||
(define-extern debug-init-buffer (function bucket-id uint uint none))
|
||||
(define-extern real-main-draw-hook function)
|
||||
(define-extern real-main-draw-hook (function none))
|
||||
(define-extern error-sphere function)
|
||||
(define-extern draw-instance-info function)
|
||||
(define-extern find-instance-by-name (function string instance)) ;; TODO - ret not verified
|
||||
@ -19366,7 +19363,7 @@
|
||||
(define-extern find-instance-by-index function)
|
||||
(define-extern prototype-bucket-recalc-fields (function instance none)) ;; TODO - ret not confirmed
|
||||
(define-extern dma-add-process-drawable-hud function)
|
||||
(define-extern foreground-engine-execute function)
|
||||
(define-extern foreground-engine-execute (function engine display-frame int int none))
|
||||
(define-extern main-debug-hook function)
|
||||
(define-extern main-draw-hook function)
|
||||
(define-extern swap-display (function display object))
|
||||
@ -19389,10 +19386,10 @@
|
||||
(define-extern put-display-env (function object none)) ;; unknown type
|
||||
(define-extern *surrogate-dma-buffer* dma-buffer) ;; unknown type
|
||||
(define-extern *screen-shot* symbol) ;; unknown type
|
||||
;;(define-extern *hud-lights* object) ;; unknown type
|
||||
;;(define-extern *instance-mem-usage* object) ;; unknown type
|
||||
;;(define-extern *add-sphere* object) ;; unknown type
|
||||
;;(define-extern *generic-effect-mode* object) ;; unknown type
|
||||
(define-extern *hud-lights* vu-lights) ;; unknown type
|
||||
(define-extern *instance-mem-usage* memory-usage-block) ;; unknown type
|
||||
(define-extern *add-sphere* symbol) ;; unknown type
|
||||
(define-extern *generic-effect-mode* int) ;; unknown type
|
||||
|
||||
|
||||
;; ----------------------
|
||||
@ -20795,8 +20792,8 @@
|
||||
(define-extern render-ocean-far function)
|
||||
(define-extern render-ocean-quad function)
|
||||
(define-extern draw-large-polygon-ocean function)
|
||||
(define-extern draw-ocean function)
|
||||
(define-extern update-ocean function)
|
||||
(define-extern draw-ocean (function none))
|
||||
(define-extern update-ocean (function none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
@ -20924,7 +20921,7 @@
|
||||
(define-extern compute-and-draw-shadow function)
|
||||
(define-extern draw-shadow function)
|
||||
(define-extern add-fake-shadow-to-buffer function)
|
||||
(define-extern swap-fake-shadow-buffers function)
|
||||
(define-extern swap-fake-shadow-buffers (function none))
|
||||
|
||||
|
||||
;; ----------------------
|
||||
@ -20937,7 +20934,7 @@
|
||||
|
||||
(define-extern convert-eye-data function)
|
||||
(define-extern render-eyes function)
|
||||
(define-extern update-eyes function)
|
||||
(define-extern update-eyes (function none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
|
@ -207,7 +207,7 @@
|
||||
"draw-string",
|
||||
|
||||
// decomp
|
||||
"(method 16 level)", // BUG: cfg fails
|
||||
//"(method 16 level)", // BUG: cfg fails
|
||||
"unpack-comp-huf",
|
||||
"unpack-comp-rle",
|
||||
|
||||
@ -277,9 +277,6 @@
|
||||
"render-boundary-quad",
|
||||
"draw-boundary-polygon",
|
||||
|
||||
// text BUG
|
||||
"load-game-text-info",
|
||||
|
||||
// collide-probe
|
||||
"collide-probe-instance-tie",
|
||||
"collide-probe-node",
|
||||
@ -505,8 +502,8 @@
|
||||
" pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%": 2,
|
||||
" pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%": 2,
|
||||
" textures ~192H~5DK ~280Htextures~456H~5DK~%": 2,
|
||||
" entity ~192H~5DK~%":2,
|
||||
" misc ~192H~5DK ~280Hsprite~456H~5DK~%":2
|
||||
" entity ~192H~5DK~%": 2,
|
||||
" misc ~192H~5DK ~280Hsprite~456H~5DK~%": 2
|
||||
},
|
||||
|
||||
"blocks_ending_in_asm_branch": {
|
||||
@ -538,6 +535,10 @@
|
||||
|
||||
"adgif-shader<-texture-with-update!": [0, 1],
|
||||
|
||||
"display-loop": [44, 49, 66, 96]
|
||||
"display-loop": [44, 49, 66, 96],
|
||||
|
||||
"load-game-text-info": [12, 13, 14, 18],
|
||||
|
||||
"real-main-draw-hook": [75, 77]
|
||||
}
|
||||
}
|
||||
|
@ -144,25 +144,28 @@
|
||||
|
||||
"ocean-tables": [
|
||||
// see comment in ocean-tables.gc
|
||||
// ["L26", "ocean-spheres", true],
|
||||
// ["L18", "ocean-spheres", true],
|
||||
// ["L25", "ocean-colors", true],
|
||||
// ["L17", "ocean-colors", true],
|
||||
// ["L23", "ocean-near-indices", true],
|
||||
// ["L15", "ocean-near-indices", true],
|
||||
// ["L9", "ocean-near-indices", true],
|
||||
// ["L22", "ocean-trans-indices", true],
|
||||
// ["L14", "ocean-trans-indices", true],
|
||||
// ["L8", "ocean-trans-indices", true],
|
||||
// ["L21", "ocean-mid-indices", true],
|
||||
// ["L13", "ocean-mid-indices", true],
|
||||
// ["L7", "ocean-mid-indices", true],
|
||||
// ["L19", "ocean-mid-masks", true],
|
||||
// ["L11", "ocean-mid-masks", true],
|
||||
// ["L5", "ocean-mid-masks", true],
|
||||
// ["L4", "ocean-map", true],
|
||||
// ["L3", "ocean-map", true],
|
||||
// ["L2", "ocean-map", true]
|
||||
["L26", "ocean-spheres", true],
|
||||
["L25", "ocean-colors", true],
|
||||
["L23", "ocean-near-indices", true], // ok
|
||||
["L22", "ocean-trans-indices", true],
|
||||
["L21", "ocean-mid-indices", true],
|
||||
["L19", "ocean-mid-masks", true],
|
||||
["L18", "ocean-spheres", true],
|
||||
["L17", "ocean-colors", true],
|
||||
["L15", "ocean-near-indices", true],
|
||||
["L9", "ocean-near-indices", true],
|
||||
|
||||
["L14", "ocean-trans-indices", true],
|
||||
["L8", "ocean-trans-indices", true],
|
||||
|
||||
["L13", "ocean-mid-indices", true],
|
||||
["L7", "ocean-mid-indices", true],
|
||||
|
||||
["L11", "ocean-mid-masks", true],
|
||||
["L5", "ocean-mid-masks", true],
|
||||
["L4", "ocean-map", true],
|
||||
["L3", "ocean-map", true],
|
||||
["L2", "ocean-map", true]
|
||||
],
|
||||
|
||||
"ocean-frames": [["L1", "(pointer uint32)", true, 16384]],
|
||||
@ -556,11 +559,31 @@
|
||||
["L12", "uint64", true]
|
||||
],
|
||||
|
||||
"shadow-cpu": [
|
||||
["L122", "shadow-data", true]
|
||||
],
|
||||
|
||||
"entity-table": [["L8", "(array entity-info)", true]],
|
||||
|
||||
"main": [["L230", "_lambda_", true], ["L309", "float", true]],
|
||||
"main": [
|
||||
["L230", "_lambda_", true],
|
||||
["L309", "float", true],
|
||||
["L306", "screen-filter", true],
|
||||
["L311", "uint64", true],
|
||||
["L312", "uint64", true],
|
||||
["L317", "uint64", true],
|
||||
["L316", "uint64", true],
|
||||
["L320", "uint64", true],
|
||||
["L314", "uint64", true],
|
||||
["L313", "uint64", true],
|
||||
["L315", "uint64", true]
|
||||
],
|
||||
|
||||
"geometry": [["L125", "float", true], ["L126", "float", true], ["L112", "(pointer float)", true, 4]],
|
||||
"geometry": [
|
||||
["L125", "float", true],
|
||||
["L126", "float", true],
|
||||
["L112", "(pointer float)", true, 4]
|
||||
],
|
||||
|
||||
"level": [
|
||||
["L452", "_auto_", true],
|
||||
@ -1163,9 +1186,7 @@
|
||||
["L38", "uint64", true],
|
||||
["L39", "uint64", true]
|
||||
],
|
||||
"memory-usage": [
|
||||
["L15", "_lambda_", true]
|
||||
],
|
||||
"memory-usage": [["L15", "_lambda_", true]],
|
||||
|
||||
"path": [
|
||||
["L47", "float", true],
|
||||
|
@ -497,9 +497,7 @@
|
||||
[64, "vector"]
|
||||
],
|
||||
|
||||
"vector-plane-distance": [
|
||||
[16, "vector"]
|
||||
],
|
||||
"vector-plane-distance": [[16, "vector"]],
|
||||
|
||||
"curve-length": [
|
||||
[16, "vector"],
|
||||
@ -521,17 +519,11 @@
|
||||
[32, "vector"]
|
||||
],
|
||||
|
||||
"mem-size": [
|
||||
[16, "memory-usage-block"]
|
||||
],
|
||||
"mem-size": [[16, "memory-usage-block"]],
|
||||
|
||||
"display-loop": [
|
||||
[16, "sphere"]
|
||||
],
|
||||
"display-loop": [[16, "sphere"]],
|
||||
|
||||
"(method 14 curve-control)": [
|
||||
[16, "vector"]
|
||||
],
|
||||
"(method 14 curve-control)": [[16, "vector"]],
|
||||
|
||||
"(method 19 path-control)": [
|
||||
[16, "vector"],
|
||||
@ -540,14 +532,14 @@
|
||||
[64, "vector"]
|
||||
],
|
||||
|
||||
"progress-allowed?": [[16, "event-message-block"]],
|
||||
|
||||
"(method 9 align-control)": [
|
||||
[16, "matrix"],
|
||||
[80, "quaternion"]
|
||||
],
|
||||
|
||||
"(method 10 align-control)": [
|
||||
[16, "vector"]
|
||||
],
|
||||
"(method 10 align-control)": [[16, "vector"]],
|
||||
|
||||
"placeholder-do-not-add-below!": []
|
||||
}
|
||||
|
@ -407,15 +407,17 @@
|
||||
|
||||
"adgif-shader<-texture-simple!": [[5, "v1", "uint"]],
|
||||
|
||||
"display-frame-start": [
|
||||
[4, "v1", "(pointer uint32)"]
|
||||
],
|
||||
"display-frame-start": [[4, "v1", "(pointer uint32)"]],
|
||||
|
||||
"display-loop": [
|
||||
[152, "v1", "(pointer int32)"],
|
||||
[157, "a0", "(pointer process-drawable)"]
|
||||
],
|
||||
|
||||
"load-game-text-info": [
|
||||
[4, "v1", "game-text-info"]
|
||||
],
|
||||
|
||||
"texture-relocate": [
|
||||
[[17, 21], "t4", "dma-packet"],
|
||||
[[27, 30], "t4", "gs-gif-tag"],
|
||||
@ -804,7 +806,10 @@
|
||||
[[1, 5], "v1", "collide-fragment"]
|
||||
],
|
||||
|
||||
"main-cheats": [[1221, "t9", "(function cpu-thread function none)"]],
|
||||
"main-cheats": [
|
||||
[1221, "t9", "(function cpu-thread function none)"],
|
||||
[[1123, 1126], "v1", "dma-packet"]
|
||||
],
|
||||
"on": [[33, "t9", "(function cpu-thread function none)"]],
|
||||
|
||||
"bg": [[37, "a0", "symbol"]],
|
||||
@ -1158,5 +1163,14 @@
|
||||
[[27, 31], "t9", "(function object object object object)"]
|
||||
],
|
||||
|
||||
"(method 8 tie-fragment)": [
|
||||
[150, "a0", "(pointer int32)"],
|
||||
[[157, 160], "a0", "basic"]
|
||||
],
|
||||
|
||||
"letterbox": [[[29, 33], "v1", "dma-packet"]],
|
||||
|
||||
"blackout": [[[20, 24], "v1", "dma-packet"]],
|
||||
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
@ -1385,24 +1385,22 @@
|
||||
},
|
||||
|
||||
"display-loop": {
|
||||
"vars": {
|
||||
|
||||
}
|
||||
"vars": {}
|
||||
},
|
||||
|
||||
"adgif-shader-login": {
|
||||
"args":"shader",
|
||||
"args": "shader",
|
||||
"vars": {
|
||||
"s5-0":"tex"
|
||||
"s5-0": "tex"
|
||||
}
|
||||
},
|
||||
|
||||
"adgif-shader-login-fast": {
|
||||
"args":["shader"],
|
||||
"vars":{
|
||||
"v1-4":"tex-id",
|
||||
"a0-9":"dir-entry",
|
||||
"s5-0":"tex"
|
||||
"args": ["shader"],
|
||||
"vars": {
|
||||
"v1-4": "tex-id",
|
||||
"a0-9": "dir-entry",
|
||||
"s5-0": "tex"
|
||||
}
|
||||
},
|
||||
|
||||
@ -2317,5 +2315,50 @@
|
||||
"vars": {
|
||||
"v0-0": ["ret-val", "symbol"]
|
||||
}
|
||||
},
|
||||
|
||||
"letterbox": {
|
||||
"vars": {
|
||||
"s5-0": "dma-buf",
|
||||
"v1-5": ["pkt", "dma-packet"]
|
||||
}
|
||||
},
|
||||
|
||||
"blackout": {
|
||||
"vars": {
|
||||
"s5-0": "dma-buf",
|
||||
"gp-0": "sprite-dma-data",
|
||||
"v1-4": ["pkt", "dma-packet"]
|
||||
}
|
||||
},
|
||||
|
||||
"set-master-mode": {
|
||||
"args": ["new-mode"],
|
||||
"vars": { "v1-3": "mode" }
|
||||
},
|
||||
|
||||
"main-cheats": {
|
||||
"vars": {
|
||||
"v1-13": "cheatmode-state",
|
||||
"v1-158": "cheatmode-debug-state",
|
||||
"v1-303": "cheat-language-state",
|
||||
"v1-394": "cheat-pal-state",
|
||||
"s5-9": "dma-buff",
|
||||
"gp-9": "dma-start",
|
||||
"v1-533": ["dma-pkt", "dma-packet"],
|
||||
"gp-10":"timeout",
|
||||
"v1-548":"inactive-timeout",
|
||||
"gp-11":"game-end-proc"
|
||||
}
|
||||
},
|
||||
|
||||
"load-game-text-info": {
|
||||
"args":["txt-name","curr-text","heap"],
|
||||
"vars":{
|
||||
"sv-16":"heap-sym-heap",
|
||||
"sv-24":"lang",
|
||||
"sv-32":"load-status",
|
||||
"sv-40":"heap-free"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace decompiler {
|
||||
class TP_Type;
|
||||
struct TypeState;
|
||||
class TypeState;
|
||||
|
||||
class DecompilerTypeSystem {
|
||||
public:
|
||||
|
@ -335,11 +335,12 @@ class TP_Type {
|
||||
int64_t m_extra_multiplier = 0;
|
||||
};
|
||||
|
||||
struct TypeState {
|
||||
class TypeState {
|
||||
private:
|
||||
public:
|
||||
std::unordered_map<int, TP_Type> spill_slots;
|
||||
TP_Type gpr_types[32];
|
||||
TP_Type fpr_types[32];
|
||||
std::unordered_map<int, TP_Type> spill_slots;
|
||||
|
||||
std::string print_gpr_masked(u32 mask) const;
|
||||
TP_Type& get(const Register& r) {
|
||||
switch (r.get_kind()) {
|
||||
|
@ -275,6 +275,150 @@ std::string print_def(const goos::Object& obj) {
|
||||
}
|
||||
return obj.print();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Start at start_byte, and find the location of the next label.
|
||||
* Will only check labels that are in the given segment.
|
||||
*/
|
||||
int index_of_closest_following_label_in_segment(int start_byte,
|
||||
int seg,
|
||||
const std::vector<DecompilerLabel>& labels) {
|
||||
int result_idx = -1;
|
||||
int closest_byte = -1;
|
||||
for (int i = 0; i < (int)labels.size(); i++) {
|
||||
const auto& label = labels.at(i);
|
||||
if (label.target_segment == seg) {
|
||||
if (result_idx == -1) {
|
||||
result_idx = i;
|
||||
closest_byte = label.offset;
|
||||
} else {
|
||||
if (label.offset > start_byte && label.offset < closest_byte) {
|
||||
result_idx = i;
|
||||
closest_byte = label.offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result_idx;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Attempt to decompile a reference to an inline array, without knowing the size.
|
||||
*/
|
||||
goos::Object decomp_ref_to_inline_array_guess_size(
|
||||
const std::vector<LinkedWord>& words,
|
||||
const std::vector<DecompilerLabel>& labels,
|
||||
int my_seg,
|
||||
int field_location,
|
||||
const TypeSystem& ts,
|
||||
const Field& data_field,
|
||||
const std::vector<std::vector<LinkedWord>>& all_words,
|
||||
const LinkedObjectFile* file,
|
||||
const TypeSpec& array_elt_type,
|
||||
int stride) {
|
||||
fmt::print("Decomp decomp_ref_to_inline_array_guess_size {}\n", array_elt_type.print());
|
||||
|
||||
// verify that the field is the right type.
|
||||
assert(data_field.type() == TypeSpec("inline-array", {array_elt_type}));
|
||||
|
||||
// verify the stride matches the type system
|
||||
auto elt_type_info = ts.lookup_type(array_elt_type);
|
||||
assert(stride == align(elt_type_info->get_size_in_memory(),
|
||||
elt_type_info->get_inline_array_stride_alignment()));
|
||||
|
||||
// the input is the location of the data field.
|
||||
// we expect that to be a label:
|
||||
assert((field_location % 4) == 0);
|
||||
auto pointer_to_data = words.at(field_location / 4);
|
||||
assert(pointer_to_data.kind == LinkedWord::PTR);
|
||||
|
||||
// the data shouldn't have any labels in the middle of it, so we can find the end of the array
|
||||
// by searching for the label after the start label.
|
||||
const auto& start_label = labels.at(pointer_to_data.label_id);
|
||||
int end_label_idx =
|
||||
index_of_closest_following_label_in_segment(start_label.offset, my_seg, labels);
|
||||
assert(end_label_idx >= 0);
|
||||
const auto& end_label = labels.at(end_label_idx);
|
||||
fmt::print("Data is from {} to {}\n", start_label.name, end_label.name);
|
||||
|
||||
// now we can figure out the size
|
||||
int size_bytes = end_label.offset - start_label.offset;
|
||||
int size_elts = size_bytes / stride; // 32 bytes per ocean-near-index
|
||||
int leftover_bytes = size_bytes % stride;
|
||||
fmt::print("Size is {} bytes: {} elts, {} left over\n", size_bytes, size_elts, leftover_bytes);
|
||||
|
||||
// if we have leftover, should verify that its all zeros, or that it's the type pointer
|
||||
// of the next basic in the data section.
|
||||
// ex:
|
||||
// .word <data>
|
||||
// .type <some-other-basic's type tag>
|
||||
// L21: ; label some other basic
|
||||
// <other basic's data>
|
||||
int padding_start = end_label.offset - leftover_bytes;
|
||||
int padding_end = end_label.offset;
|
||||
for (int pad_byte_idx = padding_start; pad_byte_idx < padding_end; pad_byte_idx++) {
|
||||
auto& word = all_words.at(my_seg).at(pad_byte_idx / 4);
|
||||
switch (word.kind) {
|
||||
case LinkedWord::PLAIN_DATA:
|
||||
assert(word.get_byte(pad_byte_idx) == 0);
|
||||
break;
|
||||
case LinkedWord::TYPE_PTR:
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
// now disassemble:
|
||||
std::vector<goos::Object> array_def = {pretty_print::to_symbol(
|
||||
fmt::format("new 'static 'inline-array {} {}", array_elt_type.print(), size_elts))};
|
||||
|
||||
for (int elt = 0; elt < size_elts; elt++) {
|
||||
// for each element, create a fake temporary label at the start to identify it
|
||||
DecompilerLabel fake_label;
|
||||
fake_label.target_segment = my_seg; // same segment
|
||||
fake_label.offset = start_label.offset + elt * stride;
|
||||
array_def.push_back(
|
||||
decompile_at_label(array_elt_type, fake_label, labels, all_words, ts, file));
|
||||
}
|
||||
|
||||
// build into a list.
|
||||
return pretty_print::build_list(array_def);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Decompile the data field of ocean-near-indices, which is an (inline-array ocean-near-index).
|
||||
* This is like a C++ ocean_near_index*, meaning we don't know how long the array is.
|
||||
* We know all the data in a ocean_near_index is just integers, so we can guess that the end
|
||||
* of the array is just the location of the next label.
|
||||
* There's a chance that this will include some padding in the array and make it too long,
|
||||
* but there is no harm in that.
|
||||
*/
|
||||
goos::Object ocean_near_indices_decompile(const std::vector<LinkedWord>& words,
|
||||
const std::vector<DecompilerLabel>& labels,
|
||||
int my_seg,
|
||||
int field_location,
|
||||
const TypeSystem& ts,
|
||||
const Field& data_field,
|
||||
const std::vector<std::vector<LinkedWord>>& all_words,
|
||||
const LinkedObjectFile* file) {
|
||||
return decomp_ref_to_inline_array_guess_size(words, labels, my_seg, field_location, ts,
|
||||
data_field, all_words, file,
|
||||
TypeSpec("ocean-near-index"), 32);
|
||||
}
|
||||
|
||||
goos::Object ocean_mid_masks_decompile(const std::vector<LinkedWord>& words,
|
||||
const std::vector<DecompilerLabel>& labels,
|
||||
int my_seg,
|
||||
int field_location,
|
||||
const TypeSystem& ts,
|
||||
const Field& data_field,
|
||||
const std::vector<std::vector<LinkedWord>>& all_words,
|
||||
const LinkedObjectFile* file) {
|
||||
return decomp_ref_to_inline_array_guess_size(words, labels, my_seg, field_location, ts,
|
||||
data_field, all_words, file,
|
||||
TypeSpec("ocean-mid-mask"), 8);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
goos::Object decompile_structure(const TypeSpec& type,
|
||||
@ -325,11 +469,18 @@ goos::Object decompile_structure(const TypeSpec& type,
|
||||
|
||||
// check alignment
|
||||
if (offset_location % 8) {
|
||||
throw std::runtime_error(fmt::format(
|
||||
"Tried to decompile a structure with type type {} (type offset {}) at label {}, but it has "
|
||||
"alignment {}, which is not valid. {}",
|
||||
std::string error = fmt::format(
|
||||
"Decompiling a structure with type type {} (type offset {}) at label {}, but it has "
|
||||
"alignment {}, which is not valid. This might be okay for a packed inline array, but "
|
||||
"shouldn't happen for basics. {}",
|
||||
type_info->get_name(), type_info->get_offset(), label.name, (offset_location % 8),
|
||||
(offset_location & 0b10) ? "Maybe it is actually a pair?" : ""));
|
||||
(offset_location & 0b10) ? "Maybe it is actually a pair?" : "");
|
||||
|
||||
if (is_basic || !type_info->is_packed()) {
|
||||
throw std::runtime_error(error);
|
||||
} else {
|
||||
// fmt::print("{}\n", error);
|
||||
}
|
||||
}
|
||||
|
||||
// check enough room
|
||||
@ -448,11 +599,22 @@ goos::Object decompile_structure(const TypeSpec& type,
|
||||
fmt::format("Dynamic value field {} in static data type {} not yet implemented",
|
||||
field.name(), actual_type.print()));
|
||||
} else {
|
||||
std::vector<u8> bytes_out;
|
||||
for (int byte_idx = field_start; byte_idx < field_end; byte_idx++) {
|
||||
bytes_out.push_back(obj_words.at(byte_idx / 4).get_byte(byte_idx % 4));
|
||||
if (field.name() == "data" && type.print() == "ocean-near-indices") {
|
||||
// first, get the label:
|
||||
field_defs_out.emplace_back(
|
||||
field.name(), ocean_near_indices_decompile(obj_words, labels, label.target_segment,
|
||||
field_start, ts, field, words, file));
|
||||
} else if (field.name() == "data" && type.print() == "ocean-mid-masks") {
|
||||
field_defs_out.emplace_back(
|
||||
field.name(), ocean_mid_masks_decompile(obj_words, labels, label.target_segment,
|
||||
field_start, ts, field, words, file));
|
||||
} else {
|
||||
std::vector<u8> bytes_out;
|
||||
for (int byte_idx = field_start; byte_idx < field_end; byte_idx++) {
|
||||
bytes_out.push_back(obj_words.at(byte_idx / 4).get_byte(byte_idx % 4));
|
||||
}
|
||||
field_defs_out.emplace_back(field.name(), decompile_value(field.type(), bytes_out, ts));
|
||||
}
|
||||
field_defs_out.emplace_back(field.name(), decompile_value(field.type(), bytes_out, ts));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -175,4 +175,6 @@
|
||||
- Methods can now be `:replace`d to override their type from their parent. Use this with extreme care.
|
||||
- TypeSpecs now support "tags". This can specify a `:behavior` tag for a function.
|
||||
- Lambdas and methods now support `:behavior` to specify the current process type.
|
||||
- `defbehavior` has been added to define a global behavior.
|
||||
- `defbehavior` has been added to define a global behavior.
|
||||
- Auto-generated inspect methods of process now start by calling the parent type's inspect, like in GOAL.
|
||||
- Fields with type `(inline-array thing)` can now be set in statics.
|
13
game/common/game_common_types.h
Normal file
13
game/common/game_common_types.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
//! Supported languages.
|
||||
enum class Language {
|
||||
English = 0,
|
||||
French = 1,
|
||||
German = 2,
|
||||
Spanish = 3,
|
||||
Italian = 4,
|
||||
Japanese = 5,
|
||||
UK_English = 6,
|
||||
// uk english?
|
||||
};
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/util/Timer.h"
|
||||
#include "game/common/game_common_types.h"
|
||||
#include "game/sce/libscf.h"
|
||||
#include "kboot.h"
|
||||
#include "kmachine.h"
|
||||
|
@ -5,23 +5,8 @@
|
||||
* GOAL Boot. Contains the "main" function to launch GOAL runtime.
|
||||
*/
|
||||
|
||||
#ifndef RUNTIME_KBOOT_H
|
||||
#define RUNTIME_KBOOT_H
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
//! Supported languages.
|
||||
enum class Language {
|
||||
English = 0,
|
||||
French = 1,
|
||||
German = 2,
|
||||
Spanish = 3,
|
||||
Italian = 4,
|
||||
Japanese = 5,
|
||||
UK_English = 6,
|
||||
// uk english?
|
||||
};
|
||||
|
||||
struct MasterConfig {
|
||||
u16 language; //! GOAL language 0
|
||||
u16 aspect; //! SCE_ASPECT 2
|
||||
@ -76,5 +61,3 @@ void KernelCheckAndDispatch();
|
||||
void KernelShutdown();
|
||||
|
||||
extern u32 MasterUseKernel;
|
||||
|
||||
#endif // RUNTIME_KBOOT_H
|
||||
|
@ -364,7 +364,7 @@ void load_and_link_dgo_from_c(const char* name, Ptr<kheapinfo> heap, u32 linkFla
|
||||
|
||||
char objName[64];
|
||||
strcpy(objName, (dgoObj + 4).cast<char>().c()); // name from dgo object header
|
||||
lg::debug("[link and exec] {} {}", objName, lastObjectLoaded);
|
||||
lg::debug("[link and exec] {} {} {}", objName, lastObjectLoaded, objSize);
|
||||
link_and_exec(obj, objName, objSize, heap, linkFlag); // link now!
|
||||
|
||||
// inform IOP we are done
|
||||
|
@ -8,14 +8,16 @@
|
||||
//#include "ps2/common_types.h"
|
||||
//#include "kernel/kmachine.h"
|
||||
#include "kmemcard.h"
|
||||
#include <cstdio>
|
||||
|
||||
// static s32 next;
|
||||
// static s32 language;
|
||||
static s32 language;
|
||||
// static MemoryCardOperation op;
|
||||
// static mc_info mc[2];
|
||||
|
||||
void kmemcard_init_globals() {
|
||||
// next = 0;
|
||||
language = 0;
|
||||
}
|
||||
|
||||
///*!
|
||||
@ -65,14 +67,14 @@ void kmemcard_init_globals() {
|
||||
//
|
||||
//}
|
||||
//
|
||||
///*!
|
||||
// * Set the language or something.
|
||||
// */
|
||||
// void MC_set_language(s32 l) {
|
||||
// printf("Language set to %d\n", l);
|
||||
// language = l;
|
||||
//}
|
||||
//
|
||||
/*!
|
||||
* Set the language or something.
|
||||
*/
|
||||
void MC_set_language(s32 l) {
|
||||
printf("Language set to %d\n", l);
|
||||
language = l;
|
||||
}
|
||||
|
||||
// u64 MC_format(s32 param) {
|
||||
// u64 can_add = op.operation == NO_OP;
|
||||
// if(can_add) {
|
||||
|
@ -5,9 +5,6 @@
|
||||
* Memory card interface. Very messy code.
|
||||
*/
|
||||
|
||||
#ifndef JAK_KMEMCARD_H
|
||||
#define JAK_KMEMCARD_H
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "kmachine.h"
|
||||
|
||||
@ -79,5 +76,3 @@ u64 MC_load(s32 param, s32 param2, Ptr<u8> data);
|
||||
void MC_makefile(s32 port, s32 size);
|
||||
u32 MC_check_result();
|
||||
void MC_get_status(s32 slot, Ptr<mc_slot_info> info);
|
||||
|
||||
#endif // JAK_KMEMCARD_H
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "kmalloc.h"
|
||||
#include "kprint.h"
|
||||
#include "fileio.h"
|
||||
#include "kmemcard.h"
|
||||
#include "kboot.h"
|
||||
#include "kdsnetm.h"
|
||||
#include "kdgo.h"
|
||||
@ -1947,7 +1948,7 @@ s32 InitHeapAndSymbol() {
|
||||
// make_function_symbol_from_c("mc-check-result", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-get-slot-info", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-makefile", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("kset-language", &CKernel::not_yet_implemented);
|
||||
make_function_symbol_from_c("kset-language", (void*)MC_set_language);
|
||||
|
||||
// set *debug-segment*
|
||||
auto ds_symbol = intern_from_c("*debug-segment*");
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "srpc.h"
|
||||
#include "game/sce/iop.h"
|
||||
#include "game/common/loader_rpc_types.h"
|
||||
#include "game/common/game_common_types.h"
|
||||
#include "common/versions.h"
|
||||
#include "sbank.h"
|
||||
#include "iso_api.h"
|
||||
@ -16,11 +17,16 @@ uint8_t gLoaderBuf[SRPC_MESSAGE_SIZE];
|
||||
int32_t gSoundEnable = 1;
|
||||
u32 gInfoEE = 0; // EE address where we should send info on each frame.
|
||||
|
||||
// english, french, germain, spanish, italian, japanese, uk.
|
||||
static const char* languages[] = {"ENG", "FRE", "GER", "SPA", "ITA", "JAP", "UKE"};
|
||||
const char* gLanguage = nullptr;
|
||||
|
||||
void srpc_init_globals() {
|
||||
memset((void*)&gMusicTweakInfo, 0, sizeof(gMusicTweakInfo));
|
||||
memset((void*)gLoaderBuf, 0, sizeof(gLoaderBuf));
|
||||
gSoundEnable = 1;
|
||||
gInfoEE = 0;
|
||||
gLanguage = languages[(int)Language::English];
|
||||
}
|
||||
|
||||
// todo Thread_Player
|
||||
@ -71,6 +77,11 @@ void* RPC_Loader(unsigned int /*fno*/, void* data, int size) {
|
||||
gInfoEE = cmd->irx_version.ee_addr;
|
||||
return cmd;
|
||||
} break;
|
||||
case SoundCommand::SET_LANGUAGE: {
|
||||
gLanguage = languages[cmd->set_language.langauge_id];
|
||||
printf("IOP language: %s\n", gLanguage); // added.
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("Unhandled RPC Loader command %d\n", (int)cmd->command);
|
||||
assert(false);
|
||||
|
@ -52,12 +52,17 @@ struct SoundRpcBankCommand {
|
||||
char bank_name[16];
|
||||
};
|
||||
|
||||
struct SoundRpcSetLanguageCommand {
|
||||
u32 langauge_id; // game_common_types.h, Language
|
||||
};
|
||||
|
||||
struct SoundRpcCommand {
|
||||
u16 rsvd1;
|
||||
SoundCommand command;
|
||||
union {
|
||||
SoundRpcGetIrxVersion irx_version;
|
||||
SoundRpcBankCommand load_bank;
|
||||
SoundRpcSetLanguageCommand set_language;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace ee {
|
||||
int sceScfGetAspect() {
|
||||
return SCE_ASPECT_169;
|
||||
return SCE_ASPECT_43;
|
||||
}
|
||||
|
||||
int sceScfGetLanguage() {
|
||||
|
@ -5,6 +5,8 @@
|
||||
;; name in dgo: mspace-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; mspace is the skeleton-based animation system.
|
||||
|
||||
(deftype joint (basic)
|
||||
((name basic :offset-assert 4)
|
||||
(number int32 :offset-assert 8)
|
||||
@ -39,7 +41,7 @@
|
||||
)
|
||||
|
||||
(deftype skeleton (inline-array-class)
|
||||
()
|
||||
((bones bone :inline :dynamic))
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
|
@ -6,6 +6,10 @@
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
||||
;; The math-camera is a global that contains camera projection and culling matrices.
|
||||
;; It also contains some GIF stuff, but these seem to be wrong/unused.
|
||||
;; Some of the code here may be extremely old and unused.
|
||||
|
||||
(deftype vis-gif-tag (structure)
|
||||
((fog0 uint32 :offset-assert 0)
|
||||
(strip uint32 :offset-assert 4)
|
||||
|
@ -535,6 +535,7 @@
|
||||
)
|
||||
|
||||
(defun init-for-transform ((arg0 matrix))
|
||||
"Sets up VU0 registers with camera info. Most rendering stuff doesn't use this."
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf17 :class vf)
|
||||
(vf18 :class vf)
|
||||
|
@ -149,7 +149,7 @@
|
||||
)
|
||||
|
||||
(deftype art-mesh-anim (art-element)
|
||||
()
|
||||
((data basic :dynamic :offset-assert 32))
|
||||
:method-count-assert 13
|
||||
:size-assert #x20
|
||||
:flag-assert #xd00000020
|
||||
|
@ -155,7 +155,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(the-as int arg1)
|
||||
arg1
|
||||
a2-1
|
||||
(the-as (pointer dma-tag) a3-20)
|
||||
)
|
||||
@ -374,7 +374,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(the-as int arg0)
|
||||
arg0
|
||||
a2-1
|
||||
(the-as (pointer dma-tag) a3-16)
|
||||
)
|
||||
@ -424,7 +424,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(the-as int arg0)
|
||||
arg0
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-4)
|
||||
)
|
||||
@ -617,7 +617,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(the-as int arg1)
|
||||
arg1
|
||||
a2-1
|
||||
(the-as (pointer dma-tag) a3-7)
|
||||
)
|
||||
@ -884,7 +884,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(the-as int arg1)
|
||||
arg1
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-11)
|
||||
)
|
||||
@ -1388,7 +1388,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(the-as int arg1)
|
||||
arg1
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-3)
|
||||
)
|
||||
@ -1443,7 +1443,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
67
|
||||
(bucket-id debug-draw0)
|
||||
s4-0
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
|
@ -5,17 +5,24 @@
|
||||
;; name in dgo: memory-usage-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; The memory-usage system is used to track how memory is arranged.
|
||||
;; All basics have a mem-usage method that will add its memory usage to
|
||||
;; a memory-usage-block. It also takes some flags that are currently unknown.
|
||||
|
||||
|
||||
;; Information for a single category.
|
||||
(deftype memory-usage-info (structure)
|
||||
((name string :offset-assert 0)
|
||||
(count int32 :offset-assert 4)
|
||||
(used int32 :offset-assert 8)
|
||||
(total int32 :offset-assert 12)
|
||||
(count int32 :offset-assert 4) ;; meaning depends on category. For textures, it's the number of textures, for example.
|
||||
(used int32 :offset-assert 8) ;; how much memory is in use (not counting padding)
|
||||
(total int32 :offset-assert 12) ;; actual total memory used, including padding to 16-bytes, etc.
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; Memory info for all categories
|
||||
(deftype memory-usage-block (basic)
|
||||
((work-bsp basic :offset-assert 4)
|
||||
(length int32 :offset-assert 8)
|
||||
@ -31,8 +38,14 @@
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; The main RAM usage memory info
|
||||
(define *mem-usage* (new 'debug 'memory-usage-block))
|
||||
|
||||
;; The DMA memory usage info
|
||||
(define *dma-mem-usage* (new 'debug 'memory-usage-block))
|
||||
|
||||
;; Used internally for computing memory info
|
||||
(define *temp-mem-usage* (the-as memory-usage-block #f))
|
||||
|
||||
|
||||
@ -41,7 +54,103 @@
|
||||
(defenum mem-usage-id
|
||||
:bitfield #f
|
||||
:type uint32
|
||||
(drawable-group 0)
|
||||
(tfragment-unknown 1) ;; made up name
|
||||
(tfragment-base 2)
|
||||
(tfragment-common 3)
|
||||
(tfragment-level0 4)
|
||||
(tfragment-level1 5)
|
||||
(tfragment-color 6)
|
||||
(tfragment-debug 7)
|
||||
(tfragment-pal 8)
|
||||
(tie-fragment 9)
|
||||
(tie-gif 10)
|
||||
(tie-point 11)
|
||||
(tie-colors 12)
|
||||
(tie-draw-points 13)
|
||||
(tie-debug 14)
|
||||
;; 15??
|
||||
(tie-pal 16)
|
||||
(tie-generic 17)
|
||||
(instance-tie 18)
|
||||
(instance-tie-colors0 19)
|
||||
(instance-tie-colors1 20)
|
||||
(instance-tie-colors2 21)
|
||||
(instance-tie-colors3 22)
|
||||
(instance-tie-colors 23)
|
||||
(prototype-bucket-shrub 24)
|
||||
(generic-shrub 25)
|
||||
(generic-shrub-data 26)
|
||||
(shrubbery 27)
|
||||
(shrubbery-object 28)
|
||||
(shrubbery-vertex 29)
|
||||
(shrubbery-color 30)
|
||||
(shrubbery-stq 31)
|
||||
(shrubbery-pal 32)
|
||||
(billboard 33)
|
||||
;; ???
|
||||
(entity 43)
|
||||
(camera 44)
|
||||
(nav-mesh 45)
|
||||
;; ??
|
||||
(res 48)
|
||||
(ambient 49)
|
||||
(collide-fragment-0 50)
|
||||
(collision-poly-0 51)
|
||||
(collision-vertex-0 52)
|
||||
(collide-fragment-1 53)
|
||||
(collision-poly-1 54)
|
||||
(collision-vertex-1 55)
|
||||
(bsp-main 56)
|
||||
(bsp-misc 57)
|
||||
(bsp-node 58)
|
||||
(bsp-leaf-vis-self 59)
|
||||
(bsp-leaf-vis-adj 60)
|
||||
(draw-node 61)
|
||||
(pat 62)
|
||||
(level-code 63)
|
||||
(entity-links 64) ;; or ambient links, its messed up
|
||||
(joint 65)
|
||||
(joint-anim-compressed 66)
|
||||
;;
|
||||
(art-group 70)
|
||||
(art-mesh-anim 71)
|
||||
(art-mesh-geo 72)
|
||||
(art-joint-geo 73)
|
||||
(art-joint-anim 74)
|
||||
(merc-ctrl 75)
|
||||
(joint-anim-drawable 76)
|
||||
(blend-shape 77)
|
||||
(collide-mesh 78)
|
||||
(texture 79)
|
||||
(string 80)
|
||||
(array 81)
|
||||
;;
|
||||
(debug-dma 84) ;; maybe
|
||||
(sky-dma 85) ;; maybe
|
||||
;;
|
||||
(4k-dead-pool 87)
|
||||
(8k-dead-pool 88)
|
||||
(16k-dead-pool 89)
|
||||
(nk-dead-pool 90)
|
||||
(target-dead-pool 91)
|
||||
(camera-dead-pool 92)
|
||||
(debug-dead-pool 93)
|
||||
(process-active 94)
|
||||
(heap-total 95)
|
||||
(heap-process 96)
|
||||
(heap-header 97)
|
||||
(heap-thread 98)
|
||||
(heap-root 99)
|
||||
(heap-draw-control 100)
|
||||
(heap-joint-control 101)
|
||||
(heap-cspace 102)
|
||||
(heap-bone 103)
|
||||
(heap-part 104)
|
||||
(heap-collide-prim 105)
|
||||
(heap-misc 106)
|
||||
(shadow-geo 107)
|
||||
(eye-anim 108)
|
||||
)
|
||||
|
||||
;; get a memory usage id as an integer.
|
||||
|
@ -976,7 +976,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s4-0
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
@ -1041,7 +1041,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
@ -1096,7 +1096,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
@ -1213,7 +1213,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s1-0
|
||||
(the-as (pointer dma-tag) a3-2)
|
||||
)
|
||||
@ -1253,7 +1253,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
sv-32
|
||||
(the-as (pointer dma-tag) a3-3)
|
||||
)
|
||||
|
@ -72,7 +72,7 @@
|
||||
bucket
|
||||
)
|
||||
|
||||
(defun dma-bucket-insert-tag ((base dma-bucket) (idx int) (tag-start pointer) (tag-end (pointer dma-tag)))
|
||||
(defun dma-bucket-insert-tag ((base dma-bucket) (idx bucket-id) (tag-start pointer) (tag-end (pointer dma-tag)))
|
||||
"Add a dma chain to the idx bucket"
|
||||
|
||||
;; find the bucket
|
||||
|
@ -213,6 +213,7 @@
|
||||
:type int32
|
||||
:bitfield #f
|
||||
|
||||
(bucket-3 3)
|
||||
(tfrag-tex0 5)
|
||||
;; merc0 10
|
||||
;; generic0 11
|
||||
@ -244,7 +245,7 @@
|
||||
(water-tex1 60)
|
||||
;; merc1 61
|
||||
;; generic1 62
|
||||
;; common tex 65
|
||||
(bucket-65 65)
|
||||
;; debug spheres? 67
|
||||
(debug-draw0 67)
|
||||
;; debug text 68
|
||||
|
@ -17,6 +17,19 @@
|
||||
;; field distance is a float printed as hex?
|
||||
)
|
||||
|
||||
(deftype drawable-inline-array-node (drawable-inline-array)
|
||||
((data draw-node 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
:method-count-assert 18
|
||||
:size-assert #x44
|
||||
:flag-assert #x1200000044
|
||||
;; too many basic blocks
|
||||
(:methods
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
;; the types of these fields are a guess for now.
|
||||
(deftype draw-node-dma (structure)
|
||||
((banka draw-node 32 :inline :offset-assert 0)
|
||||
|
@ -18,14 +18,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod inspect drawable-ambient ((obj drawable-ambient))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tid: ~D~%" (-> obj id))
|
||||
(format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
|
||||
(format #t "~Tambient: ~A~%" (-> obj ambient))
|
||||
obj
|
||||
)
|
||||
|
||||
(deftype drawable-tree-ambient (drawable-tree)
|
||||
()
|
||||
:method-count-assert 18
|
||||
@ -68,25 +60,9 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod inspect level-hint ((obj level-hint))
|
||||
(let ((t9-0 (method-of-type process inspect)))
|
||||
(t9-0 obj)
|
||||
)
|
||||
(format #t "~T~Ttext-id-to-display: ~D~%" (-> obj text-id-to-display))
|
||||
(format #t "~T~Tsound-to-play: ~A~%" (-> obj sound-to-play))
|
||||
(format #t "~T~Ttrans: #<vector @ #x~X>~%" (-> obj trans))
|
||||
(format #t "~T~Tsound-id: ~D~%" (-> obj sound-id))
|
||||
(format #t "~T~Tmode: ~A~%" (-> obj mode))
|
||||
(format #t "~T~Ttotal-time: ~D~%" (-> obj total-time))
|
||||
(format #t "~T~Ttotal-off-time: ~D~%" (-> obj total-off-time))
|
||||
(format #t "~T~Tlast-time: ~D~%" (-> obj last-time))
|
||||
(format #t "~T~Tvoicebox: ~D~%" (-> obj voicebox))
|
||||
obj
|
||||
)
|
||||
|
||||
(deftype ambient-list (structure)
|
||||
((num-items int32 :offset-assert 0)
|
||||
(items uint32 2048 :offset-assert 4)
|
||||
(items drawable-ambient 2048 :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2004
|
||||
@ -95,4 +71,4 @@
|
||||
|
||||
|
||||
(define-extern kill-current-level-hint (function pair pair symbol none))
|
||||
(define-extern level-hint-spawn (function game-text-id string symbol process-tree int none))
|
||||
(define-extern level-hint-spawn (function game-text-id string symbol process-tree int none))
|
||||
|
@ -5,6 +5,8 @@
|
||||
;; name in dgo: drawable-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(declare-type ambient-list structure)
|
||||
|
||||
;; These are the base classes for the draw nodes in the engine.
|
||||
|
||||
(deftype drawable (basic)
|
||||
@ -20,10 +22,10 @@
|
||||
(dummy-11 (_type_ int) none 11) ; int - length
|
||||
(dummy-12 (_type_ int) none 12) ; int - length
|
||||
(dummy-13 (_type_ int) none 13) ; int - length
|
||||
(dummy-14 () none 14)
|
||||
(dummy-14 () none 14) ;; related to culling?
|
||||
(dummy-15 (_type_) none 15)
|
||||
(dummy-16 (_type_ object object) object 16)
|
||||
(dummy-17 () none 17)
|
||||
(dummy-17 (_type_ sphere int ambient-list) none 17)
|
||||
)
|
||||
)
|
||||
|
||||
@ -40,4 +42,4 @@
|
||||
;; assuming (state process-drawable)
|
||||
(define-extern process-drawable-art-error state)
|
||||
|
||||
(declare-type process-drawable process)
|
||||
(declare-type process-drawable process)
|
||||
|
@ -8,6 +8,8 @@
|
||||
;; This extremely confusing "connection system" allows the connection between
|
||||
;; "engines" and "processes". Basically, a process may add connections to an engine.
|
||||
;; A "connection" is really just a function that gets called when the engine runs.
|
||||
;; Another way to use the system is as a queue of messages from processes to the engine,
|
||||
;; without using a function.
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -264,7 +264,7 @@
|
||||
(enter-level-time (array uint64) :offset-assert 212)
|
||||
(in-level-time (array uint64) :offset-assert 216)
|
||||
(blackout-time uint64 :offset-assert 224)
|
||||
(letterbox-time uint64 :offset-assert 232)
|
||||
(letterbox-time uint64 :offset-assert 232) ;; time to turn off letterboxing, base-frame
|
||||
(hint-play-time uint64 :offset-assert 240)
|
||||
(display-text-time uint64 :offset-assert 248)
|
||||
(display-text-handle uint64 :offset-assert 256)
|
||||
@ -274,8 +274,8 @@
|
||||
(auto-save-status uint32 :offset-assert 280)
|
||||
(auto-save-card int32 :offset-assert 284)
|
||||
(auto-save-which int32 :offset-assert 288)
|
||||
(pov-camera-handle uint64 :offset-assert 296)
|
||||
(other-camera-handle uint64 :offset-assert 304)
|
||||
(pov-camera-handle handle :offset-assert 296)
|
||||
(other-camera-handle handle :offset-assert 304)
|
||||
(death-pos vector-array :offset-assert 312)
|
||||
(dummy basic :offset-assert 316)
|
||||
(auto-save-count int32 :offset-assert 320)
|
||||
|
@ -1136,8 +1136,8 @@
|
||||
(set! (-> gp-0 auto-save-status) (the-as uint 1))
|
||||
(set! (-> gp-0 auto-save-card) 0)
|
||||
(set! (-> gp-0 auto-save-which) -1)
|
||||
(set! (-> gp-0 pov-camera-handle) (the-as uint #f))
|
||||
(set! (-> gp-0 other-camera-handle) (the-as uint #f))
|
||||
(set! (-> gp-0 pov-camera-handle) (the-as handle #f))
|
||||
(set! (-> gp-0 other-camera-handle) (the-as handle #f))
|
||||
)
|
||||
|
||||
(defmethod get-death-count game-info ((obj game-info) (arg0 symbol))
|
||||
|
@ -5,6 +5,7 @@
|
||||
;; name in dgo: main-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; Global engine settings:
|
||||
(define *stats-poly* #f)
|
||||
(define *stats-memory* #f)
|
||||
(define *stats-memory-short* #f)
|
||||
@ -91,7 +92,9 @@
|
||||
(define *subdivide-draw-mode* 0)
|
||||
(define *ocean-subdivide-draw-mode* 0)
|
||||
|
||||
;; don't overwrite the dproc if we're reloading this file.
|
||||
;; *dproc* is the display process.
|
||||
;; It is the main loop of the game.
|
||||
;; don't overwrite the dproc if we're reloading this file
|
||||
(define-perm *dproc* process #f)
|
||||
|
||||
(define *run* #f)
|
||||
@ -129,7 +132,7 @@
|
||||
)
|
||||
|
||||
(defun-extern movie? symbol)
|
||||
(defun-extern set-blackout-frames int uint)
|
||||
(defun-extern set-blackout-frames int int)
|
||||
(defun-extern on symbol process)
|
||||
(defun-extern off int)
|
||||
(define-extern set-master-mode (function symbol none))
|
||||
(define-extern set-master-mode (function symbol none))
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,13 +5,29 @@
|
||||
;; name in dgo: settings-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; was manually done
|
||||
;; The settings system handles settings transitions.
|
||||
;; There are three copies of setting data:
|
||||
;; - default
|
||||
;; - target
|
||||
;; - current
|
||||
|
||||
;; Processes may request a setting change. Once the process dies, the change will be reverted.
|
||||
|
||||
;; Internally, the frame's current settings are determined with this process:
|
||||
;; 1). The target settings are set to default.
|
||||
;; 2). Any changes to settings requested by processes are applied to target
|
||||
;; NOTE: these requests are _not_ cleared on every frame.
|
||||
;; 3). Target and current are compared and updated. Mostly this is just copying, but
|
||||
;; some settings may also call a function when they are changed.
|
||||
|
||||
|
||||
;; The full setting state.
|
||||
(deftype setting-data (structure)
|
||||
((border-mode symbol :offset-assert 0)
|
||||
(sfx-volume float :offset-assert 4)
|
||||
(music-volume float :offset-assert 8)
|
||||
(dialog-volume float :offset-assert 12)
|
||||
(process-mask uint32 :offset-assert 16)
|
||||
(process-mask process-mask :offset-assert 16)
|
||||
(common-page int32 :offset-assert 20)
|
||||
(language int64 :offset-assert 24)
|
||||
(screenx int32 :offset-assert 32)
|
||||
@ -97,6 +113,9 @@
|
||||
obj
|
||||
)
|
||||
|
||||
|
||||
;; The setting-control manages the current/target/default system.
|
||||
;; The setting requests are managed by the engine.
|
||||
(deftype setting-control (basic)
|
||||
((current setting-data :inline :offset-assert 16)
|
||||
(target setting-data :inline :offset-assert 224)
|
||||
@ -126,7 +145,8 @@
|
||||
s4-0
|
||||
)
|
||||
|
||||
|
||||
;; believed unused.
|
||||
;; possibly the PS2 BIOS time type.
|
||||
(deftype scf-time (structure)
|
||||
((stat uint8 :offset-assert 0)
|
||||
(second uint8 :offset-assert 1)
|
||||
@ -143,9 +163,3 @@
|
||||
)
|
||||
|
||||
(define-extern *setting-control* setting-control)
|
||||
|
||||
;; TODO - defined in the kernel
|
||||
(define-extern scf-get-volume (function int))
|
||||
(define-extern scf-get-language (function uint))
|
||||
(define-extern scf-get-aspect (function uint))
|
||||
(define-extern *boot-video-mode* int)
|
||||
|
@ -12,250 +12,223 @@
|
||||
(let ((conn (the-as connection (-> arg0 alive-list-end)))
|
||||
(s4-0 (-> arg0 alive-list-end prev0))
|
||||
)
|
||||
(while (!= (the-as connectable conn) (-> arg0 alive-list))
|
||||
(let ((v1-1 (-> conn param0)))
|
||||
(cond
|
||||
((= v1-1 'border-mode)
|
||||
(set! (-> obj border-mode) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'allow-look-around)
|
||||
(set! (-> obj allow-look-around) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'ocean-off)
|
||||
(set! (-> obj ocean-off) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'music)
|
||||
(set! (-> obj music) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'process-mask)
|
||||
(let ((v1-6 (-> conn param1)))
|
||||
(cond
|
||||
((= (the-as symbol v1-6) 'set)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logior
|
||||
(-> obj process-mask)
|
||||
(the-as uint (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-6 'clear)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logand
|
||||
(-> obj process-mask)
|
||||
(the-as uint (lognot (the-as uint (-> conn param3))))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-6 'abs)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(the-as uint (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
(while (!= (the-as connectable conn) (-> arg0 alive-list))
|
||||
(case (-> conn param0)
|
||||
(('border-mode)
|
||||
(set! (-> obj border-mode) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'sfx-volume)
|
||||
(when
|
||||
(or
|
||||
(zero?
|
||||
(logand
|
||||
(-> *kernel-context* prevent-from-run)
|
||||
(process-mask progress)
|
||||
(('allow-look-around)
|
||||
(set! (-> obj allow-look-around) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('ocean-off)
|
||||
(set! (-> obj ocean-off) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('music)
|
||||
(set! (-> obj music) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('process-mask)
|
||||
(case (-> conn param1)
|
||||
(('set)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logior
|
||||
(-> obj process-mask)
|
||||
(the-as uint (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(('clear)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logand
|
||||
(-> obj process-mask)
|
||||
(the-as uint (the-as uint (lognot (the-as uint (-> conn param3)))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(('abs)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(the-as process-mask (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-18 (get-process conn))
|
||||
(a0-22 *progress-process*)
|
||||
)
|
||||
(('sfx-volume)
|
||||
(when (or (zero? (logand (-> *kernel-context* prevent-from-run) (process-mask progress)))
|
||||
(let ((v1-18 (get-process conn))
|
||||
(a0-22 *progress-process*)
|
||||
)
|
||||
(= v1-18 (if a0-22
|
||||
(-> a0-22 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-20 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-20 'rel)
|
||||
(set! (-> obj sfx-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume))
|
||||
)
|
||||
(set! (-> obj sfx-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(('music-volume)
|
||||
(let ((v1-25 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-25 'rel)
|
||||
(set! (-> obj music-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj music-volume))
|
||||
)
|
||||
(set! (-> obj music-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
(= v1-18 (if a0-22
|
||||
(-> a0-22 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-20 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-20 'rel)
|
||||
(set!
|
||||
(-> obj sfx-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume))
|
||||
(('ambient-volume)
|
||||
(let ((v1-30 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-30 'rel)
|
||||
(set! (-> obj ambient-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj ambient-volume))
|
||||
)
|
||||
(set! (-> obj ambient-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
(set! (-> obj sfx-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'music-volume)
|
||||
(let ((v1-25 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-25 'rel)
|
||||
(set!
|
||||
(-> obj music-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj music-volume))
|
||||
)
|
||||
(set! (-> obj music-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'ambient-volume)
|
||||
(let ((v1-30 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-30 'rel)
|
||||
(set!
|
||||
(-> obj ambient-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj ambient-volume))
|
||||
)
|
||||
(set! (-> obj ambient-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'dialog-volume)
|
||||
(let ((v1-35 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-35 'rel)
|
||||
(set!
|
||||
(-> obj dialog-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj dialog-volume))
|
||||
)
|
||||
(set! (-> obj dialog-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'sfx-volume-movie)
|
||||
(let ((v1-40 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-40 'rel)
|
||||
(set!
|
||||
(-> obj sfx-volume-movie)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume-movie))
|
||||
)
|
||||
(set! (-> obj sfx-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'music-volume-movie)
|
||||
(let ((v1-45 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-45 'rel)
|
||||
(set!
|
||||
(-> obj music-volume-movie)
|
||||
(*
|
||||
(* 0.01 (the-as float (-> conn param2)))
|
||||
(-> obj music-volume-movie)
|
||||
(('dialog-volume)
|
||||
(let ((v1-35 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-35 'rel)
|
||||
(set! (-> obj dialog-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj dialog-volume))
|
||||
)
|
||||
(set! (-> obj dialog-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> obj music-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'ambient-volume-movie)
|
||||
(let ((v1-50 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-50 'rel)
|
||||
(set!
|
||||
(-> obj ambient-volume-movie)
|
||||
(*
|
||||
(* 0.01 (the-as float (-> conn param2)))
|
||||
(-> obj ambient-volume-movie)
|
||||
(('sfx-volume-movie)
|
||||
(let ((v1-40 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-40 'rel)
|
||||
(set! (-> obj sfx-volume-movie)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume-movie))
|
||||
)
|
||||
(set! (-> obj sfx-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> obj ambient-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'dialog-volume-hint)
|
||||
(let ((v1-55 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-55 'rel)
|
||||
(set!
|
||||
(-> obj dialog-volume-hint)
|
||||
(*
|
||||
(* 0.01 (the-as float (-> conn param2)))
|
||||
(-> obj dialog-volume-hint)
|
||||
(('music-volume-movie)
|
||||
(let ((v1-45 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-45 'rel)
|
||||
(set! (-> obj music-volume-movie)
|
||||
(* (* 0.01 (the-as float (-> conn param2)))
|
||||
(-> obj music-volume-movie)
|
||||
)
|
||||
)
|
||||
(set! (-> obj music-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> obj dialog-volume-hint) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'sound-flava)
|
||||
(when (>= (the-as float (-> conn param2)) (-> obj sound-flava-priority))
|
||||
(set! (-> obj sound-flava) (the-as uint (the-as int (-> conn param3))))
|
||||
(set! (-> obj sound-flava-priority) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'bg-r)
|
||||
(set! (-> obj bg-r) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-g)
|
||||
(set! (-> obj bg-g) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-b)
|
||||
(set! (-> obj bg-b) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-a)
|
||||
(set! (-> obj bg-a) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-a-speed)
|
||||
(set! (-> obj bg-a-speed) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-a-force)
|
||||
(set! (-> obj bg-a-force) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'language)
|
||||
(set! (-> obj language) (the-as int (-> conn param3)))
|
||||
)
|
||||
((= v1-1 'vibration)
|
||||
(set! (-> obj vibration) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'auto-save)
|
||||
(set! (-> obj auto-save) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'allow-pause)
|
||||
(set! (-> obj allow-pause) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'allow-progress)
|
||||
(set! (-> obj allow-progress) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'play-hints)
|
||||
(set! (-> obj play-hints) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'movie)
|
||||
(set! (-> obj movie) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'talking)
|
||||
(set! (-> obj talking) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'spooling)
|
||||
(set! (-> obj spooling) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'hint)
|
||||
(set! (-> obj hint) (the-as (pointer process) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'ambient)
|
||||
(set! (-> obj ambient) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'common-page)
|
||||
(let ((v1-89 (-> conn param1)))
|
||||
(cond
|
||||
((= (the-as symbol v1-89) 'set)
|
||||
(set!
|
||||
(-> obj common-page)
|
||||
(logior (-> obj common-page) (the-as int (-> conn param3)))
|
||||
(('ambient-volume-movie)
|
||||
(let ((v1-50 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-50 'rel)
|
||||
(set! (-> obj ambient-volume-movie)
|
||||
(* (* 0.01 (the-as float (-> conn param2)))
|
||||
(-> obj ambient-volume-movie)
|
||||
)
|
||||
)
|
||||
(set! (-> obj ambient-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-89 'clear)
|
||||
(set!
|
||||
(-> obj common-page)
|
||||
(logand
|
||||
(-> obj common-page)
|
||||
(the-as int (the-as uint (lognot (the-as uint (-> conn param3)))))
|
||||
)
|
||||
(('dialog-volume-hint)
|
||||
(let ((v1-55 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-55 'rel)
|
||||
(set! (-> obj dialog-volume-hint)
|
||||
(* (* 0.01 (the-as float (-> conn param2)))
|
||||
(-> obj dialog-volume-hint)
|
||||
)
|
||||
)
|
||||
(set! (-> obj dialog-volume-hint) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(('sound-flava)
|
||||
(when (>= (the-as float (-> conn param2)) (-> obj sound-flava-priority))
|
||||
(set! (-> obj sound-flava) (the-as uint (the-as int (-> conn param3))))
|
||||
(set! (-> obj sound-flava-priority) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
(('bg-r)
|
||||
(set! (-> obj bg-r) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-g)
|
||||
(set! (-> obj bg-g) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-b)
|
||||
(set! (-> obj bg-b) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-a)
|
||||
(set! (-> obj bg-a) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-a-speed)
|
||||
(set! (-> obj bg-a-speed) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-a-force)
|
||||
(set! (-> obj bg-a-force) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('language)
|
||||
(set! (-> obj language) (the-as int (-> conn param3)))
|
||||
)
|
||||
(('vibration)
|
||||
(set! (-> obj vibration) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('auto-save)
|
||||
(set! (-> obj auto-save) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('allow-pause)
|
||||
(set! (-> obj allow-pause) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('allow-progress)
|
||||
(set! (-> obj allow-progress) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('play-hints)
|
||||
(set! (-> obj play-hints) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('movie)
|
||||
(set! (-> obj movie) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('talking)
|
||||
(set! (-> obj talking) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('spooling)
|
||||
(set! (-> obj spooling) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('hint)
|
||||
(set! (-> obj hint) (the-as (pointer process) (-> conn param1)))
|
||||
)
|
||||
(('ambient)
|
||||
(set! (-> obj ambient) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('common-page)
|
||||
(case (-> conn param1)
|
||||
(('set)
|
||||
(set! (-> obj common-page)
|
||||
(logior (-> obj common-page) (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
(('clear)
|
||||
(set! (-> obj common-page)
|
||||
(logand (-> obj common-page)
|
||||
(the-as int (the-as uint (lognot (the-as uint (-> conn param3)))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! conn (the-as connection s4-0))
|
||||
(set! s4-0 (-> (the-as connectable conn) prev0))
|
||||
)
|
||||
)
|
||||
(set! conn (the-as connection s4-0))
|
||||
(set! s4-0 (-> (the-as connectable conn) prev0))
|
||||
)
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
@ -360,10 +333,7 @@
|
||||
(set! (-> gp-0 dialog-volume-hint) (-> s5-0 dialog-volume-hint))
|
||||
(set! (-> gp-0 process-mask) (-> s5-0 process-mask))
|
||||
)
|
||||
(set!
|
||||
(-> *kernel-context* prevent-from-run)
|
||||
(the-as process-mask (-> gp-0 process-mask))
|
||||
)
|
||||
(set! (-> *kernel-context* prevent-from-run) (-> gp-0 process-mask))
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
@ -502,17 +472,16 @@
|
||||
(set! (-> *level* border?) (-> gp-0 border-mode))
|
||||
(set! (-> *texture-pool* common-page-mask) (-> gp-0 common-page))
|
||||
(set! (-> *cpad-list* cpads 0 buzz) (-> gp-0 vibration))
|
||||
(let ((v1-64 (-> gp-0 ocean-off)))
|
||||
(cond
|
||||
((= v1-64 #t)
|
||||
|
||||
(case (-> gp-0 ocean-off)
|
||||
((#t)
|
||||
(set! *ocean-off* #t)
|
||||
)
|
||||
((= v1-64 'mid)
|
||||
(set! *ocean-mid-off* #t)
|
||||
)
|
||||
((= v1-64 'near)
|
||||
(set! *ocean-near-off* #t)
|
||||
)
|
||||
(('mid)
|
||||
(set! *ocean-mid-off* #t)
|
||||
)
|
||||
(('near)
|
||||
(set! *ocean-near-off* #t)
|
||||
)
|
||||
)
|
||||
gp-0
|
||||
@ -563,7 +532,7 @@
|
||||
)
|
||||
)
|
||||
(set! (-> gp-0 language) (the-as int (scf-get-language)))
|
||||
(set! (-> gp-0 process-mask) (the-as uint 65))
|
||||
(set! (-> gp-0 process-mask) (process-mask execute sleep))
|
||||
(set! (-> gp-0 screenx) 0)
|
||||
(set! (-> gp-0 screeny) 0)
|
||||
(set! (-> gp-0 vibration) #t)
|
||||
|
@ -491,44 +491,38 @@
|
||||
;; TODO - defined in progress-static
|
||||
(define-extern *level-task-data-remap* (array int32))
|
||||
|
||||
;; definition for function update-task-hints
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
|
||||
(defun update-task-hints ()
|
||||
(when *target*
|
||||
(let ((a0-0 (+ (-> *target* current-level info index) -1))
|
||||
(v1-7 (-> *game-info* task-hint-control))
|
||||
)
|
||||
(when (and (>= a0-0 0) (< a0-0 (-> *level-task-data-remap* length)))
|
||||
(let ((a0-3 (-> *level-task-data-remap* a0-0)))
|
||||
(when (< a0-3 (-> v1-7 length))
|
||||
(let ((gp-0 (-> v1-7 a0-3 tasks)))
|
||||
(when (and (!= gp-0 0) (nonzero? (-> gp-0 length)))
|
||||
(let ((s5-0 (-> *game-info* in-level-time a0-3)))
|
||||
(dotimes (s4-0 (-> gp-0 length))
|
||||
(let
|
||||
((v1-17 (get-task-status (the-as game-task (-> gp-0 s4-0 task)))))
|
||||
(when
|
||||
(or
|
||||
(= v1-17 (task-status need-hint))
|
||||
(= v1-17 (task-status unknown))
|
||||
)
|
||||
(if (< (-> gp-0 s4-0 delay) s5-0)
|
||||
(close-specific-task!
|
||||
(the-as game-task (-> gp-0 s4-0 task))
|
||||
(task-status need-hint)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a0-0 (+ (-> *target* current-level info index) -1))
|
||||
(v1-7 (-> *game-info* task-hint-control))
|
||||
)
|
||||
(when (and (>= a0-0 0) (< a0-0 (-> *level-task-data-remap* length)))
|
||||
(let ((a0-3 (-> *level-task-data-remap* a0-0)))
|
||||
(when (< a0-3 (-> v1-7 length))
|
||||
(let ((gp-0 (-> v1-7 a0-3 tasks)))
|
||||
(when (and (!= gp-0 0) (nonzero? (-> gp-0 length)))
|
||||
(let ((s5-0 (-> *game-info* in-level-time a0-3)))
|
||||
(dotimes (s4-0 (-> gp-0 length))
|
||||
(case (get-task-status (the-as game-task (-> gp-0 s4-0 task)))
|
||||
(((task-status need-hint) (task-status unknown))
|
||||
(if (< (-> gp-0 s4-0 delay) s5-0)
|
||||
(close-specific-task!
|
||||
(the-as game-task (-> gp-0 s4-0 task))
|
||||
(task-status need-hint)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
@ -8,9 +8,8 @@
|
||||
;; definition for function set-video-mode
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun set-video-mode ((arg0 symbol))
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 'ntsc)
|
||||
(case arg0
|
||||
(('ntsc)
|
||||
(set! (-> *video-parms* screen-sy) 224)
|
||||
(set! (-> *setting-control* default screenx) 0)
|
||||
(set! (-> *setting-control* default screeny) 8)
|
||||
@ -22,7 +21,7 @@
|
||||
(set! (-> *math-camera* y-clip) 448.0)
|
||||
(set! (-> *shadow-data* texoffset y) 112.5)
|
||||
)
|
||||
((= v1-0 'pal)
|
||||
(('pal)
|
||||
(set! (-> *video-parms* screen-sy) 256)
|
||||
(set! (-> *setting-control* default screenx) 0)
|
||||
(set! (-> *setting-control* default screeny) 24)
|
||||
@ -35,7 +34,6 @@
|
||||
(set! (-> *shadow-data* texoffset y) 128.5)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set-time-ratios *display* (-> *display* time-ratio))
|
||||
(set! (-> *video-parms* reset-video-mode) #t)
|
||||
(set! (-> *video-parms* screen-hy) (/ (-> *video-parms* screen-sy) 2))
|
||||
@ -58,12 +56,16 @@
|
||||
(set! (-> *video-parms* relative-y-scale-reciprical) 1.0)
|
||||
(set! *profile-y* (+ (-> *video-parms* screen-miny) 8))
|
||||
(set! (-> *video-parms* set-video-mode) #t)
|
||||
(set-hud-aspect-ratio (get-aspect-ratio) arg0)
|
||||
|
||||
;; NOTE: added nonzero check
|
||||
(if (nonzero? set-hud-aspect-ratio)
|
||||
(set-hud-aspect-ratio (get-aspect-ratio) arg0)
|
||||
)
|
||||
(if *progress-process*
|
||||
(TODO-RENAME-23 (-> *progress-process* 0) (get-aspect-ratio) arg0)
|
||||
)
|
||||
(TODO-RENAME-23 (-> *progress-process* 0) (get-aspect-ratio) arg0)
|
||||
)
|
||||
(let ((v0-3 0))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
@ -75,28 +77,30 @@
|
||||
;; definition for function set-aspect-ratio
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun set-aspect-ratio ((arg0 symbol))
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 'aspect4x3)
|
||||
(case arg0
|
||||
(('aspect4x3)
|
||||
(set! (-> *video-parms* relative-x-scale) 1.0)
|
||||
(set! (-> *video-parms* relative-x-scale-reciprical) 1.0)
|
||||
)
|
||||
((= v1-0 'aspect16x9)
|
||||
(('aspect16x9)
|
||||
(set! (-> *video-parms* relative-x-scale) 0.75)
|
||||
(set! (-> *video-parms* relative-x-scale-reciprical) 1.3333334)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> *font-default-matrix* vector 0 x)
|
||||
(-> *video-parms* relative-x-scale)
|
||||
)
|
||||
(set-hud-aspect-ratio arg0 (get-video-mode))
|
||||
|
||||
;; NOTE: added.
|
||||
(if (nonzero? set-hud-aspect-ratio)
|
||||
(set-hud-aspect-ratio arg0 (get-video-mode))
|
||||
)
|
||||
(if *progress-process*
|
||||
(TODO-RENAME-23 (-> *progress-process* 0) arg0 (get-video-mode))
|
||||
)
|
||||
(TODO-RENAME-23 (-> *progress-process* 0) arg0 (get-video-mode))
|
||||
)
|
||||
(let ((v0-2 0))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
@ -5,6 +5,9 @@
|
||||
;; name in dgo: capture
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; Functions for taking a screenshot of VRAM.
|
||||
;; These are debug-only and leak memory.
|
||||
|
||||
;; vif/gif tags to do a transfer of data from VRAM to EE memory.
|
||||
(deftype gs-store-image-packet (structure)
|
||||
((vifcode vif-tag 4 :offset-assert 0)
|
||||
|
@ -5,6 +5,9 @@
|
||||
;; name in dgo: font-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; The font system draws all of the strings.
|
||||
;; The font textures live in the upper 8 bits of the 24-bit texture format depth buffer.
|
||||
|
||||
(deftype char-verts (structure)
|
||||
((pos vector 4 :inline :offset-assert 0)
|
||||
(color vector 4 :inline :offset-assert 64)
|
||||
|
@ -135,7 +135,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
s3-0
|
||||
(the bucket-id s3-0) ;; TODO, correct types here
|
||||
s2-0
|
||||
(the-as (pointer dma-tag) a3-0)
|
||||
)
|
||||
|
@ -33,23 +33,21 @@
|
||||
;; calculations from getting huge.
|
||||
(let ((ratio (fmin 4.0 slowdown)))
|
||||
(set! (-> obj time-ratio) ratio)
|
||||
(let ((v1-0 (get-video-mode)))
|
||||
(cond
|
||||
((= v1-0 'pal)
|
||||
(set! (-> obj time-adjust-ratio) (* 1.2 ratio))
|
||||
(set! (-> obj seconds-per-frame) (* 0.02 ratio))
|
||||
(set! (-> obj frames-per-second) (* 50.0 (/ 1.0 ratio)))
|
||||
;; 6 "ticks" per frame * 50 fps = 300 ticks per second.
|
||||
(set! (-> obj time-factor) 6.0)
|
||||
)
|
||||
(else
|
||||
(set! (-> obj time-adjust-ratio) ratio)
|
||||
(set! (-> obj seconds-per-frame) (* 0.016666668 ratio))
|
||||
(set! (-> obj frames-per-second) (* 60.0 (/ 1.0 ratio)))
|
||||
;; 5 "ticks" per frame * 60 fps = 300 ticks per second.
|
||||
(set! (-> obj time-factor) 5.0)
|
||||
)
|
||||
)
|
||||
(case (get-video-mode)
|
||||
(('pal)
|
||||
(set! (-> obj time-adjust-ratio) (* 1.2 ratio))
|
||||
(set! (-> obj seconds-per-frame) (* 0.02 ratio))
|
||||
(set! (-> obj frames-per-second) (* 50.0 (/ 1.0 ratio)))
|
||||
;; 6 "ticks" per frame * 50 fps = 300 ticks per second.
|
||||
(set! (-> obj time-factor) 6.0)
|
||||
)
|
||||
(else
|
||||
(set! (-> obj time-adjust-ratio) ratio)
|
||||
(set! (-> obj seconds-per-frame) (* 0.016666668 ratio))
|
||||
(set! (-> obj frames-per-second) (* 60.0 (/ 1.0 ratio)))
|
||||
;; 5 "ticks" per frame * 60 fps = 300 ticks per second.
|
||||
(set! (-> obj time-factor) 5.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> obj time-ratio)
|
||||
|
@ -86,26 +86,23 @@
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun psm->string ((arg0 gs-psm))
|
||||
"Get the name of a texture format."
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 (gs-psm mz16s)) "mz16s")
|
||||
((= v1-0 (gs-psm mz16)) "mz16")
|
||||
((= v1-0 (gs-psm mz24)) "mz24")
|
||||
((= v1-0 (gs-psm mz32)) "mz32")
|
||||
((= v1-0 (gs-psm mt4hh)) "mt4hh")
|
||||
((= v1-0 (gs-psm mt4hl)) "mt4hl")
|
||||
((= v1-0 (gs-psm mt8h)) "mt8h")
|
||||
((= v1-0 (gs-psm mt4)) "mt4")
|
||||
((= v1-0 (gs-psm mt8)) "mt8")
|
||||
((= v1-0 (gs-psm ct16s)) "ct16s")
|
||||
((= v1-0 (gs-psm ct16)) "ct16")
|
||||
((= v1-0 (gs-psm ct24)) "ct24")
|
||||
((zero? v1-0) "ct32")
|
||||
(else "*unknown*")
|
||||
)
|
||||
(case arg0
|
||||
(((gs-psm mz16s)) "mz16s")
|
||||
(((gs-psm mz16)) "mz16")
|
||||
(((gs-psm mz24)) "mz24")
|
||||
(((gs-psm mz32)) "mz32")
|
||||
(((gs-psm mt4hh)) "mt4hh")
|
||||
(((gs-psm mt4hl)) "mt4hl")
|
||||
(((gs-psm mt8h)) "mt8h")
|
||||
(((gs-psm mt4)) "mt4")
|
||||
(((gs-psm mt8)) "mt8")
|
||||
(((gs-psm ct16s)) "ct16s")
|
||||
(((gs-psm ct16)) "ct16")
|
||||
(((gs-psm ct24)) "ct24")
|
||||
(((gs-psm ct32)) "ct32")
|
||||
(else "*unknown*")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -5,6 +5,9 @@
|
||||
;; name in dgo: lights-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; It seems like some of these are unused.
|
||||
;; The commonly used lights are vu-lights and light-group.
|
||||
|
||||
(deftype vu-lights (structure)
|
||||
((direction vector 3 :inline :offset-assert 0)
|
||||
(color vector 3 :inline :offset-assert 48)
|
||||
|
@ -5,6 +5,9 @@
|
||||
;; name in dgo: ocean-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; The "ocean" renderer is used to render the infinite water.
|
||||
;; It doesn't draw the rivers in FJ or the water near the farmer.
|
||||
|
||||
(deftype ocean-corner (structure)
|
||||
((bsphere sphere :inline :offset-assert 0)
|
||||
(start-corner vector :inline :offset-assert 16)
|
||||
@ -62,6 +65,7 @@
|
||||
((mask uint8 8 :offset-assert 0)
|
||||
(dword uint64 :offset 0)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
@ -76,7 +80,7 @@
|
||||
)
|
||||
|
||||
(deftype ocean-mid-masks (basic)
|
||||
((data uint32 :offset-assert 4)
|
||||
((data (inline-array ocean-mid-mask) :offset-assert 4)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
@ -105,7 +109,7 @@
|
||||
)
|
||||
|
||||
(deftype ocean-trans-indices (basic)
|
||||
((data uint32 2304 :offset-assert 4)
|
||||
((data ocean-trans-index 2304 :inline :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2404
|
||||
@ -122,7 +126,7 @@
|
||||
|
||||
|
||||
(deftype ocean-near-indices (basic)
|
||||
((data uint32 :offset-assert 4)
|
||||
((data (inline-array ocean-near-index) :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,3 +7,6 @@
|
||||
|
||||
;; TODO - for video
|
||||
(define-extern *shadow-data* shadow-data)
|
||||
|
||||
;; todo
|
||||
(define *shadow-data* (new 'static 'shadow-data))
|
@ -104,7 +104,7 @@
|
||||
(dummy-18 () none 18)
|
||||
(dummy-19 () none 19)
|
||||
(unload! (_type_ texture-page) int 20)
|
||||
(upload-one-common! (_type_) symbol 21)
|
||||
(upload-one-common! (_type_ level) symbol 21)
|
||||
(lookup-boot-common-id (_type_ int) int 22)
|
||||
)
|
||||
)
|
||||
|
@ -810,7 +810,7 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun upload-vram-pages ((pool texture-pool) (segment texture-pool-segment) (page texture-page) (mode int) (bucket-idx int))
|
||||
(defun upload-vram-pages ((pool texture-pool) (segment texture-pool-segment) (page texture-page) (mode int) (bucket-idx bucket-id))
|
||||
"Add a dma chain to upload textures to the bucket. This will only upload chunks that aren't already there.
|
||||
This will automatically update the cache info in the pool for the upload.
|
||||
mode: -3 = don't want anything (this function does nothing)
|
||||
@ -1059,7 +1059,7 @@
|
||||
0
|
||||
)
|
||||
|
||||
(defun upload-vram-pages-pris ((pool texture-pool) (segment texture-pool-segment) (page texture-page) (bucket-idx int) (needed-mask int))
|
||||
(defun upload-vram-pages-pris ((pool texture-pool) (segment texture-pool-segment) (page texture-page) (bucket-idx bucket-id) (needed-mask int))
|
||||
"Upload the entire texture page. If the needed-mask is not set, it will not upload those chunks.
|
||||
Upload will be added to the given bucket for on-screen.
|
||||
The nth bit of the mask determines if the nth 16-kB chunk is needed in this upload.
|
||||
@ -1312,7 +1312,7 @@
|
||||
;; in the level data, there is always code, then TFRAG texture,
|
||||
;; so mark the code memory end as the start of this page.
|
||||
;; (note: this may be wrong on levels with the zoomer hud texture)
|
||||
(set! (-> *level* unknown-level-2 code-memory-end) (the pointer page))
|
||||
(set! (-> *level* loading-level code-memory-end) (the pointer page))
|
||||
page
|
||||
)
|
||||
|
||||
@ -1358,7 +1358,7 @@
|
||||
)
|
||||
)
|
||||
(set! (-> *texture-pool* allocate-func) texture-page-common-allocate)
|
||||
(set! (-> *level* unknown-level-2 code-memory-end) (the pointer page))
|
||||
(set! (-> *level* loading-level code-memory-end) (the pointer page))
|
||||
page
|
||||
)
|
||||
|
||||
@ -1373,7 +1373,7 @@
|
||||
(set! (-> pool common-page common-id) page)
|
||||
)
|
||||
(else
|
||||
(let ((level-idx (-> *level* unknown-level-2 index)))
|
||||
(let ((level-idx (-> *level* loading-level index)))
|
||||
;; these will handle TFRAG. These allocators will then switch the allocator
|
||||
;; to common for everything else.
|
||||
(cond
|
||||
@ -1579,7 +1579,7 @@
|
||||
(when (= tex-page-kind (tpage-kind tfrag)) ;; TFRAG (0)
|
||||
;; get the texture page, bucket to add to, and an effective distance from the closest thing.
|
||||
(let ((tfrag-page (-> level texture-page 0))
|
||||
(tfrag-bucket (if (zero? (-> level index)) 5 12))
|
||||
(tfrag-bucket (if (zero? (-> level index)) (bucket-id tfrag-tex0) (bucket-id tfrag-tex1)))
|
||||
;; not really sure how this is calculated, but it's a distance.
|
||||
(distance (fmin (fmin (-> level closest-object 0)
|
||||
(if (and (< 0.0 (-> level level-distance))
|
||||
@ -1633,7 +1633,7 @@
|
||||
(if (= tex-page-kind (tpage-kind pris)) ;; PRIS (1)
|
||||
(let ((pris-page (-> level texture-page 1)))
|
||||
(if (and pris-page (nonzero? pris-page))
|
||||
(let ((pris-bucket (if (zero? (-> level index)) 48 51)))
|
||||
(let ((pris-bucket (if (zero? (-> level index)) (bucket-id pris-tex0) (bucket-id pris-tex1))))
|
||||
;; just upload the whole thing always.
|
||||
;; use the cache mask as requested by the level.
|
||||
(set! (-> level upload-size 1)
|
||||
@ -1649,7 +1649,7 @@
|
||||
(shrub-closest (-> level closest-object 2)) ;; I guess this is the shrub closest.
|
||||
)
|
||||
(if (and shrub-page (nonzero? shrub-page))
|
||||
(let ((shrub-bucket (if (zero? (-> level index)) 19 25))
|
||||
(let ((shrub-bucket (if (zero? (-> level index)) (bucket-id shrub-tex0) (bucket-id shrub-tex1)))
|
||||
(shrub-mode (cond
|
||||
((= shrub-closest 4095995904.0)
|
||||
-3 ;; nothing
|
||||
@ -1679,7 +1679,7 @@
|
||||
(alpha-closest (-> level closest-object 3))
|
||||
)
|
||||
(if (and alpha-page (nonzero? alpha-page))
|
||||
(let ((alpha-bucket (if (zero? (-> level index)) 31 38))
|
||||
(let ((alpha-bucket (if (zero? (-> level index)) (bucket-id alpha-tex0) (bucket-id alpha-tex1)))
|
||||
(alpha-mode (cond
|
||||
((< 348160.0 alpha-closest)
|
||||
0 ;; segment 0
|
||||
@ -1712,7 +1712,7 @@
|
||||
(if (= tex-page-kind (tpage-kind water)) ;; WATER (4)
|
||||
(let ((water-page (-> level texture-page 4)))
|
||||
(if (and water-page (nonzero? water-page))
|
||||
(let ((water-bucket (if (zero? (-> level index)) 57 60)))
|
||||
(let ((water-bucket (if (zero? (-> level index)) (bucket-id water-tex0) (bucket-id water-tex1))))
|
||||
(set! (-> level upload-size 4)
|
||||
(upload-vram-pages-pris obj (-> obj segment-common) water-page water-bucket (the-as int (-> level texture-mask 8)))
|
||||
)
|
||||
@ -1724,7 +1724,7 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
(defmethod upload-one-common! texture-pool ((obj texture-pool))
|
||||
(defmethod upload-one-common! texture-pool ((obj texture-pool) (lev level))
|
||||
"Upload the first common texture page that's in in the common-page-mask."
|
||||
(dotimes (v1-0 32)
|
||||
(let ((a2-0 (-> obj common-page v1-0)))
|
||||
@ -1732,7 +1732,7 @@
|
||||
(nonzero? (logand (-> obj common-page-mask) (ash 1 v1-0))) ;; in the mask.
|
||||
)
|
||||
;; upload it!
|
||||
(upload-vram-pages obj (-> obj segment-common) a2-0 -2 65)
|
||||
(upload-vram-pages obj (-> obj segment-common) a2-0 -2 (bucket-id bucket-65))
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
@ -1774,7 +1774,7 @@
|
||||
;; add it
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
5
|
||||
(bucket-id tfrag-tex0)
|
||||
a2-0
|
||||
(the-as (pointer dma-tag) a3-3)
|
||||
)
|
||||
@ -1807,7 +1807,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
48
|
||||
(bucket-id pris-tex0)
|
||||
a2-1
|
||||
(the-as (pointer dma-tag) a3-7)
|
||||
)
|
||||
@ -1840,7 +1840,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
19
|
||||
(bucket-id shrub-tex0)
|
||||
a2-2
|
||||
(the-as (pointer dma-tag) a3-11)
|
||||
)
|
||||
@ -1873,7 +1873,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
31
|
||||
(bucket-id alpha-tex0)
|
||||
a2-3
|
||||
(the-as (pointer dma-tag) a3-15)
|
||||
)
|
||||
@ -1908,7 +1908,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
12
|
||||
(bucket-id tfrag-tex1)
|
||||
a2-4
|
||||
(the-as (pointer dma-tag) a3-19)
|
||||
)
|
||||
@ -1941,7 +1941,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
51
|
||||
(bucket-id pris-tex1)
|
||||
a2-5
|
||||
(the-as (pointer dma-tag) a3-23)
|
||||
)
|
||||
@ -1974,7 +1974,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
25
|
||||
(bucket-id shrub-tex1)
|
||||
a2-6
|
||||
(the-as (pointer dma-tag) a3-27)
|
||||
)
|
||||
@ -2007,7 +2007,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
38
|
||||
(bucket-id alpha-tex1)
|
||||
a2-7
|
||||
(the-as (pointer dma-tag) a3-31)
|
||||
)
|
||||
@ -2736,7 +2736,7 @@
|
||||
(set! obj (the-as texture-page #f))
|
||||
)
|
||||
((begin
|
||||
(let ((v1-2 (-> *level* unknown-level-2))) ;; loading/linking level
|
||||
(let ((v1-2 (-> *level* loading-level))) ;; loading/linking level
|
||||
(tex-dbg " tpage is with level ~A~%" v1-2)
|
||||
(when v1-2
|
||||
;; add us to the loading level's tpages
|
||||
|
@ -78,7 +78,7 @@
|
||||
)
|
||||
|
||||
(deftype drawable-tree-tfrag (drawable-tree)
|
||||
()
|
||||
((time-of-day-pal time-of-day-palette :offset 12))
|
||||
:method-count-assert 18
|
||||
:size-assert #x24
|
||||
:flag-assert #x1200000024
|
||||
|
@ -30,7 +30,7 @@
|
||||
(unk-data-0-len int32 :offset-assert 56)
|
||||
(unk-data-1 pointer :offset-assert 60)
|
||||
(unk-data-1-len int32 :offset-assert 64)
|
||||
(unk-zero-0 uint32 :offset-assert 68)
|
||||
(unk-zero-0 basic :offset-assert 68)
|
||||
(name symbol :offset-assert 72)
|
||||
(nickname symbol :offset-assert 76)
|
||||
(vis-info level-vis-info 8 :offset-assert 80)
|
||||
@ -54,7 +54,6 @@
|
||||
:flag-assert #x1400000190
|
||||
(:methods
|
||||
(relocate (_type_ kheap (pointer uint8)) none :replace 7)
|
||||
(dummy-17 () none 17)
|
||||
(dummy-18 (_type_) none 18)
|
||||
(dummy-19 (_type_) none 19)
|
||||
)
|
||||
|
@ -5,6 +5,7 @@
|
||||
;; name in dgo: level-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; The level system is responsible for loading and managning the two levels.
|
||||
|
||||
(defconstant LEVEL_COUNT 2) ;; there are two levels in memory!
|
||||
|
||||
@ -75,6 +76,8 @@
|
||||
:flag-assert #x900000074
|
||||
)
|
||||
|
||||
;; The levels are initialized (called "login") over multiple frames.
|
||||
;; The state of this process is stored in a login-state.
|
||||
(declare-type drawable basic)
|
||||
(deftype login-state (basic)
|
||||
((state int32 :offset-assert 4)
|
||||
@ -147,7 +150,7 @@
|
||||
(add-irq-to-tex-buckets! (_type_) none 11)
|
||||
(unload! (_type_) _type_ 12)
|
||||
(bsp-name (_type_) symbol 13)
|
||||
(dummy-14 (_type_ object) none 14)
|
||||
(dummy-14 (_type_ object) memory-usage-block 14)
|
||||
(dummy-15 (_type_ vector) symbol 15)
|
||||
(dummy-16 (_type_) none 16)
|
||||
(load-continue (_type_) _type_ 17)
|
||||
@ -174,8 +177,8 @@
|
||||
(declare-type entity-links structure)
|
||||
(deftype level-group (basic)
|
||||
((length int32 :offset-assert 4)
|
||||
(unknown-level-1 level :offset-assert 8)
|
||||
(unknown-level-2 level :offset-assert 12) ;; currently loading
|
||||
(log-in-level level :offset-assert 8) ;; level currently logging in
|
||||
(loading-level level :offset-assert 12) ;; currently loading
|
||||
(entity-link entity-links :offset-assert 16) ;; not sure what's going on here
|
||||
(border? basic :offset-assert 20)
|
||||
(vis? basic :offset-assert 24)
|
||||
@ -203,7 +206,7 @@
|
||||
(level-get-for-use (_type_ symbol symbol) level 11)
|
||||
(activate-levels! (_type_) int 12)
|
||||
(dummy-13 () none 13)
|
||||
(dummy-14 () none 14)
|
||||
(dummy-14 (_type_ object) none 14)
|
||||
(dummy-15 () none 15)
|
||||
(dummy-16 (_type_) int 16)
|
||||
(level-get-target-inside (_type_) level 17)
|
||||
@ -222,14 +225,15 @@
|
||||
|
||||
(defun-extern level-update-after-load level login-state level)
|
||||
|
||||
|
||||
;; Initialize the level structure. This assigns DMA buckets to each level.
|
||||
;; TODO: figure out exactly which buckets are used for what.
|
||||
(define-extern *level* level-group)
|
||||
(if (zero? *level*)
|
||||
(set! *level*
|
||||
(new 'static 'level-group
|
||||
:length 2
|
||||
:unknown-level-1 #f
|
||||
:unknown-level-2 #f
|
||||
:log-in-level #f
|
||||
:loading-level #f
|
||||
:entity-link #f
|
||||
:border? #f
|
||||
:want-level #f
|
||||
|
@ -94,7 +94,7 @@
|
||||
|
||||
;; relocate bsp-header
|
||||
(defmethod relocate bsp-header ((obj bsp-header) (dest-heap kheap) (name (pointer uint8)))
|
||||
(let ((s5-0 (-> *level* unknown-level-2)))
|
||||
(let ((s5-0 (-> *level* loading-level)))
|
||||
(if s5-0
|
||||
(cond
|
||||
(obj
|
||||
@ -455,8 +455,8 @@
|
||||
"Start loading the level. Uses 2 megabyte heaps for loading each non-bt object."
|
||||
|
||||
(set! loading-level (-> obj heap))
|
||||
(set! (-> *level* unknown-level-2) obj)
|
||||
(set! (-> *level* unknown-level-1) #f)
|
||||
(set! (-> *level* loading-level) obj)
|
||||
(set! (-> *level* log-in-level) #f)
|
||||
(set! (-> obj nickname) #f)
|
||||
(set! (-> obj bsp) #f)
|
||||
(set! (-> obj entity) #f)
|
||||
@ -487,7 +487,7 @@
|
||||
(set! (-> *texture-pool* allocate-func) texture-page-default-allocate)
|
||||
(cond
|
||||
((-> obj bsp)
|
||||
(set! (-> *level* unknown-level-1) (the-as level (-> obj bsp)))
|
||||
(set! (-> *level* log-in-level) (the-as level (-> obj bsp)))
|
||||
;; TODO
|
||||
;;(login-level-textures *texture-pool* obj (-> obj bsp unk-data-1-len) (the-as (pointer texture-id) (-> obj bsp unk-data-1)))
|
||||
(let ((bsp (-> obj bsp)))
|
||||
@ -507,7 +507,7 @@
|
||||
(else
|
||||
(level-status-set! obj 'inactive)
|
||||
(set! loading-level global)
|
||||
(set! (-> *level* unknown-level-2) (-> *level* level-default))
|
||||
(set! (-> *level* loading-level) (-> *level* level-default))
|
||||
)
|
||||
)
|
||||
obj
|
||||
@ -701,8 +701,8 @@
|
||||
(dummy-24 loaded-level)
|
||||
(set! (-> loaded-level status) 'loaded)
|
||||
(set! loading-level global)
|
||||
(set! (-> *level* unknown-level-2) (-> *level* level-default))
|
||||
(set! (-> *level* unknown-level-1) #f)
|
||||
(set! (-> *level* loading-level) (-> *level* level-default))
|
||||
(set! (-> *level* log-in-level) #f)
|
||||
0
|
||||
;;(.mfc0 v1-154 Count)
|
||||
;;(- v1-154 initial-timer)
|
||||
@ -716,12 +716,12 @@
|
||||
(case (-> obj status)
|
||||
(('loaded)
|
||||
(protect (loading-level
|
||||
(-> *level* unknown-level-2)
|
||||
(-> *level* unknown-level-1)
|
||||
(-> *level* loading-level)
|
||||
(-> *level* log-in-level)
|
||||
)
|
||||
(set! loading-level (-> obj heap))
|
||||
(set! (-> *level* unknown-level-1) (the-as level (-> obj bsp)))
|
||||
(set! (-> *level* unknown-level-2) obj)
|
||||
(set! (-> *level* log-in-level) (the-as level (-> obj bsp)))
|
||||
(set! (-> *level* loading-level) obj)
|
||||
;; (dummy-18 (-> obj bsp)) TODO
|
||||
(set! (-> obj status) 'alive)
|
||||
;; (dummy-15 *game-info*) TODO
|
||||
@ -767,8 +767,8 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (= (-> *level* unknown-level-1) (-> obj bsp))
|
||||
(set! (-> *level* unknown-level-1) #f)
|
||||
(if (= (-> *level* log-in-level) (-> obj bsp))
|
||||
(set! (-> *level* log-in-level) #f)
|
||||
)
|
||||
obj
|
||||
)
|
||||
@ -849,10 +849,10 @@
|
||||
)
|
||||
(set! (-> obj code-memory-start) (the pointer 0))
|
||||
(set! (-> obj code-memory-end) (the pointer 0))
|
||||
(when (= (-> *level* unknown-level-2) obj)
|
||||
(when (= (-> *level* loading-level) obj)
|
||||
(set! loading-level global)
|
||||
(set! (-> *level* unknown-level-2) (-> *level* level-default))
|
||||
(set! (-> *level* unknown-level-1) #f)
|
||||
(set! (-> *level* loading-level) (-> *level* level-default))
|
||||
(set! (-> *level* log-in-level) #f)
|
||||
)
|
||||
)
|
||||
obj
|
||||
@ -1206,7 +1206,7 @@
|
||||
;; temp
|
||||
(format #t "(play ~A ~A) has been called!~%" use-vis arg1)
|
||||
(format 0 "(play ~A ~A) has been called!~%" use-vis arg1)
|
||||
(kernel-shutdown)
|
||||
;;(kernel-shutdown)
|
||||
|
||||
(let ((startup-level (case *kernel-boot-message*
|
||||
(('play)
|
||||
@ -1589,7 +1589,7 @@
|
||||
(when (zero? (-> *level* level0 art-group))
|
||||
(let ((lev-group *level*))
|
||||
(set! (-> lev-group vis?) #f)
|
||||
(set! (-> lev-group unknown-level-2) (-> lev-group level-default))
|
||||
(set! (-> lev-group loading-level) (-> lev-group level-default))
|
||||
(set! (-> lev-group level0 art-group) (new 'global 'load-dir-art-group 50 (-> lev-group level0)))
|
||||
(set! (-> lev-group level0 foreground-draw-engine 0) (new 'global 'engine 'draw 280))
|
||||
(set! (-> lev-group level0 foreground-draw-engine 1) (new 'global 'engine 'draw 280))
|
||||
|
@ -161,54 +161,55 @@
|
||||
"Check if the version and kind in the info is valid. The version-override can specify a
|
||||
non-default version, or set to 0 for the default version"
|
||||
(let* ((expected-version
|
||||
(if (zero? version-override)
|
||||
(let ((v1-0 kind))
|
||||
(cond
|
||||
((or (= v1-0 (file-kind tpage)) (= v1-0 (file-kind dir-tpage)))
|
||||
TPAGE_FILE_VERSION
|
||||
)
|
||||
((= kind (file-kind level-bt))
|
||||
LEVEL_BT_FILE_VERSION
|
||||
)
|
||||
((= v1-0 (file-kind art-group))
|
||||
ART_GROUP_FILE_VERSION
|
||||
)
|
||||
)
|
||||
)
|
||||
version-override
|
||||
)
|
||||
)
|
||||
(v1-1 kind)
|
||||
(kind-name
|
||||
(cond
|
||||
((= v1-1 (file-kind tpage))
|
||||
"texture-page"
|
||||
((zero? version-override)
|
||||
(case kind
|
||||
(((file-kind tpage) (file-kind dir-tpage))
|
||||
7
|
||||
)
|
||||
(((file-kind level-bt))
|
||||
30
|
||||
)
|
||||
(((file-kind art-group))
|
||||
6
|
||||
)
|
||||
)
|
||||
)
|
||||
((= kind (file-kind level-bt))
|
||||
"bsp-header"
|
||||
)
|
||||
((= v1-1 (file-kind art-group))
|
||||
"art-group"
|
||||
(else
|
||||
version-override
|
||||
)
|
||||
)
|
||||
)
|
||||
(v1-1 kind)
|
||||
(kind-name (cond
|
||||
((= v1-1 (file-kind tpage))
|
||||
"texture-page"
|
||||
)
|
||||
((= v1-1 (file-kind level-bt))
|
||||
"bsp-header"
|
||||
)
|
||||
((= v1-1 (file-kind art-group))
|
||||
"art-group"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((not (name= (the-as basic (-> info file-type value)) kind-name))
|
||||
(format 0 "ERROR: file ~A is of type ~S but needs to be ~S.~%"
|
||||
(-> info file-name)
|
||||
(-> info file-type)
|
||||
kind-name
|
||||
)
|
||||
(-> info file-name)
|
||||
(-> info file-type)
|
||||
kind-name
|
||||
)
|
||||
#f
|
||||
)
|
||||
((!= expected-version (-> info major-version))
|
||||
(format 0 "ERROR: file ~A is version ~D.~D, but needs to be ~D.x~%"
|
||||
(-> info file-name)
|
||||
(-> info major-version)
|
||||
(-> info minor-version)
|
||||
expected-version
|
||||
)
|
||||
(-> info file-name)
|
||||
(-> info major-version)
|
||||
(-> info minor-version)
|
||||
expected-version
|
||||
)
|
||||
#f
|
||||
)
|
||||
(else
|
||||
|
@ -102,41 +102,39 @@
|
||||
(defmethod set-mode! joint-mod ((obj joint-mod) (handler-mode joint-mod-handler-mode))
|
||||
"Set up the joint-mod for the given mode. You can only pick one mode at a time."
|
||||
(set! (-> obj mode) handler-mode)
|
||||
(let ((joint (-> obj joint))
|
||||
(mode handler-mode)
|
||||
)
|
||||
(cond
|
||||
((= mode (joint-mod-handler-mode flex-blend))
|
||||
(let ((joint (-> obj joint)))
|
||||
(case handler-mode
|
||||
(((joint-mod-handler-mode flex-blend))
|
||||
(set! (-> joint param0) #f)
|
||||
(set! (-> joint param1) #f)
|
||||
(set! (-> joint param2) #f)
|
||||
(set! (-> obj blend) 0.0)
|
||||
(set! (-> obj flex-blend) 1.0)
|
||||
)
|
||||
((= mode (joint-mod-handler-mode reset))
|
||||
(((joint-mod-handler-mode reset))
|
||||
(set! (-> joint param0) #f)
|
||||
(set! (-> joint param1) #f)
|
||||
(set! (-> joint param2) #f)
|
||||
(set! (-> obj blend) 0.0)
|
||||
(set! (-> obj shutting-down?) #f)
|
||||
)
|
||||
((= mode (joint-mod-handler-mode look-at))
|
||||
(((joint-mod-handler-mode look-at))
|
||||
(set! (-> joint param0) joint-mod-look-at-handler)
|
||||
(set! (-> joint param1) obj)
|
||||
(set! (-> joint param2) #f)
|
||||
)
|
||||
((= mode (joint-mod-handler-mode world-look-at))
|
||||
(((joint-mod-handler-mode world-look-at))
|
||||
(set! (-> joint param0) joint-mod-world-look-at-handler)
|
||||
(set! (-> joint param1) obj)
|
||||
(set! (-> joint param2) #f)
|
||||
)
|
||||
((= mode (joint-mod-handler-mode rotate))
|
||||
(((joint-mod-handler-mode rotate))
|
||||
(set! (-> joint param0) joint-mod-rotate-handler)
|
||||
(set! (-> joint param1) obj)
|
||||
(set! (-> joint param2) #f)
|
||||
(set! (-> obj blend) 1.0)
|
||||
)
|
||||
((= mode (joint-mod-handler-mode joint-set))
|
||||
(((joint-mod-handler-mode joint-set))
|
||||
(set! (-> joint param0) joint-mod-joint-set-handler)
|
||||
(set! (-> joint param1) obj)
|
||||
(set! (-> joint param2) #f)
|
||||
@ -150,7 +148,7 @@
|
||||
)
|
||||
(set! (-> obj max-dist) (the-as float #f))
|
||||
)
|
||||
((= mode (joint-mod-handler-mode joint-set*))
|
||||
(((joint-mod-handler-mode joint-set*))
|
||||
(set! (-> joint param0) joint-mod-joint-set*-handler)
|
||||
(set! (-> joint param1) obj)
|
||||
(set! (-> joint param2) #f)
|
||||
|
@ -99,15 +99,13 @@
|
||||
(s3-0 (lookup-text! *common-text* (the-as game-text-id s2-0) #t))
|
||||
)
|
||||
(when (= s2-0 3841)
|
||||
(let ((v1-18 (scf-get-territory)))
|
||||
(cond
|
||||
((= v1-18 1)
|
||||
(set! s3-0 (lookup-text! *common-text* (game-text-id europe) #t))
|
||||
)
|
||||
((= v1-18 2)
|
||||
(set! s3-0 (lookup-text! *common-text* (game-text-id inc) #t))
|
||||
)
|
||||
)
|
||||
(case (scf-get-territory)
|
||||
((1)
|
||||
(set! s3-0 (lookup-text! *common-text* (game-text-id europe) #t))
|
||||
)
|
||||
((2)
|
||||
(set! s3-0 (lookup-text! *common-text* (game-text-id inc) #t))
|
||||
)
|
||||
)
|
||||
)
|
||||
(when s3-0
|
||||
|
@ -126,7 +126,7 @@
|
||||
(dummy-17 () none 17)
|
||||
(dummy-18 () none 18)
|
||||
(dummy-19 () none 19)
|
||||
(dummy-20 () none 20)
|
||||
(hidden? (_type_) symbol 20)
|
||||
(dummy-21 () none 21)
|
||||
(dummy-22 () none 22)
|
||||
(TODO-RENAME-23 (_type_ symbol symbol) none 23)
|
||||
@ -176,4 +176,6 @@
|
||||
(define-extern *level-task-data* (array level-tasks-info))
|
||||
(define-extern *level-task-data-remap* (array int32))
|
||||
(define-extern get-game-count (function int count-info))
|
||||
(define-extern activate-orb-all (function int int)) ;; maybe in hud?
|
||||
(define-extern activate-orb-all (function int int)) ;; maybe in hud?
|
||||
(define-extern progress-allowed? (function symbol))
|
||||
(define-extern pause-allowed? (function symbol))
|
||||
|
@ -8,4 +8,10 @@
|
||||
(defmethod relocate game-count-info ((this game-count-info) (offset int))
|
||||
"Load in the game-count-info. This is a bit of a hack."
|
||||
(set! *game-counts* this)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod hidden? progress ((obj progress))
|
||||
(or (not *progress-process*)
|
||||
(= (-> *progress-process* 0 in-out-position) 4096)
|
||||
)
|
||||
)
|
||||
|
@ -220,10 +220,10 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; todo, need support for array
|
||||
(define *text-group-names* (new 'static 'boxed-array :type string :length 1 "common"))
|
||||
|
||||
;; The heap for storing text
|
||||
(define *common-text-heap* (new 'global 'kheap))
|
||||
|
||||
;; definition for symbol *common-text*, type game-text-info
|
||||
;; will store the COMMON text when it is loaded.
|
||||
(define *common-text* (the-as game-text-info #f))
|
||||
|
@ -5,9 +5,9 @@
|
||||
;; name in dgo: text
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(define *game-text-word* (new 'global 'string 256 (the string '#f)))
|
||||
(define *game-text-word* (new 'global 'string 128 (the string '#f)))
|
||||
(define *game-text-line* (new 'global 'string 256 (the string '#f)))
|
||||
(define *level-text-file-load-flag* '#t)
|
||||
(define *level-text-file-load-flag* #t)
|
||||
|
||||
;; allocate the game text heap if it isn't already allocated.
|
||||
(when (= 0 (-> *common-text-heap* base))
|
||||
@ -42,8 +42,34 @@
|
||||
obj
|
||||
)
|
||||
|
||||
;; todo method 8
|
||||
;; todo method 9
|
||||
(defmethod mem-usage game-text-info ((obj game-text-info) (arg0 memory-usage-block) (arg1 int))
|
||||
"Get the memory usage."
|
||||
(set! (-> arg0 length) (max 81 (-> arg0 length)))
|
||||
(set! (-> arg0 data 80 name) "string")
|
||||
(set! (-> arg0 data 80 count) (+ (-> arg0 data 80 count) 1))
|
||||
|
||||
;; get the size of this structure
|
||||
(let ((v1-6 (asize-of obj)))
|
||||
(set! (-> arg0 data 80 used) (+ (-> arg0 data 80 used) v1-6))
|
||||
(set! (-> arg0 data 80 total)
|
||||
(+ (-> arg0 data 80 total) (logand -16 (+ v1-6 15)))
|
||||
)
|
||||
)
|
||||
|
||||
;; get the size of all the strings
|
||||
(dotimes (s4-0 (-> obj length))
|
||||
(set! (-> arg0 length) (max 81 (-> arg0 length)))
|
||||
(set! (-> arg0 data 80 name) "string")
|
||||
(set! (-> arg0 data 80 count) (+ (-> arg0 data 80 count) 1))
|
||||
(let ((v1-18 (asize-of (-> obj data s4-0 text))))
|
||||
(set! (-> arg0 data 80 used) (+ (-> arg0 data 80 used) v1-18))
|
||||
(set! (-> arg0 data 80 total)
|
||||
(+ (-> arg0 data 80 total) (logand -16 (+ v1-18 15)))
|
||||
)
|
||||
)
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
(defmethod lookup-text! game-text-info ((obj game-text-info) (arg0 game-text-id) (arg1 symbol))
|
||||
"Look up text by ID. Will return the string.
|
||||
@ -83,8 +109,103 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;; todo text-is-loading
|
||||
|
||||
(define text-is-loading #f)
|
||||
|
||||
;; todo load-game-text-info
|
||||
|
||||
(defun load-game-text-info ((txt-name string) (curr-text symbol) (heap kheap))
|
||||
"Load text, if needed."
|
||||
(local-vars
|
||||
(v0-2 int)
|
||||
(heap-sym-heap game-text-info)
|
||||
(lang int)
|
||||
(load-status int)
|
||||
(heap-free int)
|
||||
)
|
||||
(set! heap-sym-heap (the-as game-text-info (-> curr-text value)))
|
||||
(set! lang (-> *setting-control* current language))
|
||||
(set! load-status 0)
|
||||
(set! heap-free (&- (-> heap top) (the-as uint (-> heap base))))
|
||||
(if (and (= (scf-get-territory) 1) (zero? lang))
|
||||
(set! lang 6)
|
||||
)
|
||||
(when (or (= heap-sym-heap #f)
|
||||
(!= (-> heap-sym-heap language-id) lang)
|
||||
(not (string= (-> heap-sym-heap group-name) txt-name))
|
||||
)
|
||||
(let ((v1-16 heap))
|
||||
(set! (-> v1-16 current) (-> v1-16 base))
|
||||
)
|
||||
(b! #t cfg-14)
|
||||
(label cfg-13)
|
||||
(load-dbg "Strange error during text load.~%")
|
||||
(set! v0-2 0)
|
||||
(b! #t cfg-27)
|
||||
(label cfg-14)
|
||||
(let ((s3-0 str-load))
|
||||
(format (clear *temp-string*) "~D~S.TXT" lang txt-name)
|
||||
;; this branch is super weird.
|
||||
(b! (not (s3-0
|
||||
*temp-string*
|
||||
-1
|
||||
(logand -64 (&+ (-> heap current) 63))
|
||||
(&- (-> heap top) (the-as uint (-> heap current)))
|
||||
)
|
||||
)
|
||||
cfg-13
|
||||
)
|
||||
)
|
||||
(label cfg-16)
|
||||
(let ((v1-20 (str-load-status (the-as (pointer int32) (& load-status)))))
|
||||
(cond
|
||||
((= v1-20 'error)
|
||||
(format 0 "Error loading text~%")
|
||||
(return 0)
|
||||
)
|
||||
((>= load-status (+ heap-free -300))
|
||||
(format 0 "Game text heap overrun!~%")
|
||||
(return 0)
|
||||
)
|
||||
((= v1-20 'busy)
|
||||
(begin
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(goto cfg-16)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s2-1 (logand -64 (&+ (-> heap current) 63))))
|
||||
(flush-cache 0)
|
||||
(let ((s3-1 link))
|
||||
(format (clear *temp-string*) "~D~S.TXT" lang txt-name)
|
||||
(set!
|
||||
(-> curr-text value)
|
||||
(s3-1 s2-1 (-> *temp-string* data) load-status heap 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (<= (the-as int (-> curr-text value)) 0)
|
||||
(set! (-> curr-text value) (the-as object #f))
|
||||
)
|
||||
)
|
||||
(set! v0-2 0)
|
||||
(label cfg-27)
|
||||
v0-2
|
||||
)
|
||||
|
||||
(defun load-level-text-files ((arg0 int))
|
||||
(if (or *level-text-file-load-flag* (>= arg0 0))
|
||||
(load-game-text-info "common" '*common-text* *common-text-heap*)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
;; todo load-level-text-files
|
||||
;; todo draw-debug-text-box
|
||||
;; todo set-font-color-alpha
|
||||
|
@ -117,7 +117,7 @@
|
||||
|
||||
(define-extern *debug-segment* symbol)
|
||||
(define-extern *enable-method-set* int)
|
||||
;; *boot-video-mode* ?
|
||||
(define-extern *boot-video-mode* int)
|
||||
(define-extern *deci-count* int)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -135,6 +135,7 @@
|
||||
;;;; kmachine - InitMachineScheme
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;; put-display-env
|
||||
;; syncv
|
||||
(define-extern sync-path (function int int none))
|
||||
@ -159,13 +160,13 @@
|
||||
;; file-stream-seek
|
||||
(define-extern file-stream-read (function file-stream pointer int int))
|
||||
(define-extern file-stream-write (function file-stream pointer uint uint))
|
||||
;; scf-get-language
|
||||
(define-extern scf-get-language (function uint))
|
||||
;; scf-get-time
|
||||
;; scf-get-aspect
|
||||
;; scf-get-volume
|
||||
;; scf-get-territory
|
||||
;; scf-get-timeout
|
||||
;; scf-get-inactive-timeout
|
||||
(define-extern scf-get-aspect (function uint))
|
||||
(define-extern scf-get-volume (function int))
|
||||
(define-extern scf-get-territory (function int))
|
||||
(define-extern scf-get-timeout (function int))
|
||||
(define-extern scf-get-inactive-timeout (function int))
|
||||
;; dma-to-iop
|
||||
(define-extern kernel-shutdown (function none))
|
||||
;; aybabtu
|
||||
|
@ -2434,12 +2434,11 @@
|
||||
(set! pp obj)
|
||||
(let ((cur (-> pp stack-frame-top)))
|
||||
(while cur
|
||||
(when (or
|
||||
(= (-> cur type) protect-frame)
|
||||
(= (-> cur type) state)
|
||||
)
|
||||
;; we're a state or protect-frame, we can exit.
|
||||
((-> (the protect-frame cur) exit))
|
||||
(case (-> cur type)
|
||||
((protect-frame state)
|
||||
;; we're a state or protect-frame, we can exit.
|
||||
((-> (the-as protect-frame cur) exit))
|
||||
)
|
||||
)
|
||||
(set! cur (-> cur next))
|
||||
)
|
||||
|
@ -218,11 +218,10 @@ There are several ways to "go"
|
||||
;; loop through current stack frames
|
||||
(let ((frame (-> pp stack-frame-top)))
|
||||
(while frame
|
||||
(let ((typ (-> frame type)))
|
||||
(if (or (= typ protect-frame) (= typ state))
|
||||
;; if we got a protect-frame or a state, call exit handler
|
||||
((-> (the protect-frame frame) exit))
|
||||
)
|
||||
(case (-> frame type)
|
||||
((protect-frame state)
|
||||
((-> (the-as protect-frame frame) exit))
|
||||
)
|
||||
)
|
||||
(set! frame (-> frame next))
|
||||
)
|
||||
|
@ -281,10 +281,11 @@ class Compiler {
|
||||
StructureType* type,
|
||||
Env* env,
|
||||
RegVal* reg,
|
||||
const Field& f);
|
||||
Val* generate_inspector_for_structured_type(const goos::Object& form,
|
||||
Env* env,
|
||||
StructureType* type);
|
||||
const Field& f,
|
||||
int tab_count);
|
||||
Val* generate_inspector_for_structure_type(const goos::Object& form,
|
||||
Env* env,
|
||||
StructureType* structure_type);
|
||||
Val* generate_inspector_for_bitfield_type(const goos::Object& form, Env* env, BitFieldType* type);
|
||||
RegVal* compile_get_method_of_type(const goos::Object& form,
|
||||
const TypeSpec& compile_time_type,
|
||||
|
@ -230,6 +230,15 @@ void Compiler::compile_static_structure_inline(const goos::Object& form,
|
||||
typecheck(form, TypeSpec("float"), sr.typespec());
|
||||
u64 value = sr.constant_u64();
|
||||
memcpy(structure->data.data() + field_offset, &value, sizeof(float));
|
||||
} else if (field_info.type.base_type() == "inline-array") {
|
||||
auto sr = compile_static(field_value, env);
|
||||
if (!sr.is_reference()) {
|
||||
throw_compiler_error(form, "Invalid definition of field {}", field_info.field.name());
|
||||
}
|
||||
typecheck(form, field_info.type, sr.typespec());
|
||||
assert(sr.reference()->get_addr_offset() == 0);
|
||||
structure->add_pointer_record(field_offset, sr.reference(),
|
||||
sr.reference()->get_addr_offset());
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -137,58 +137,63 @@ void Compiler::generate_field_description(const goos::Object& form,
|
||||
StructureType* type,
|
||||
Env* env,
|
||||
RegVal* reg,
|
||||
const Field& f) {
|
||||
const Field& f,
|
||||
int tab_count) {
|
||||
std::string str_template;
|
||||
std::string tabs;
|
||||
for (int i = 0; i < tab_count; i++) {
|
||||
tabs += "~T";
|
||||
}
|
||||
std::vector<RegVal*> format_args = {};
|
||||
if (f.name() == "type" && f.offset() == 0) {
|
||||
// type
|
||||
return;
|
||||
} else if (f.is_array() && !f.is_dynamic()) {
|
||||
// Arrays
|
||||
str_template += fmt::format("~T{}[{}] @ #x~X~%", f.name(), f.array_size());
|
||||
str_template += fmt::format("{}{}[{}] @ #x~X~%", tabs, f.name(), f.array_size());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env));
|
||||
} else if (f.is_dynamic()) {
|
||||
// Dynamic Field
|
||||
str_template += fmt::format("~T{}[0] @ #x~X~%", f.name());
|
||||
str_template += fmt::format("{}{}[0] @ #x~X~%", tabs, f.name());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env));
|
||||
} else if (m_ts.tc(m_ts.make_typespec("basic"), f.type()) ||
|
||||
m_ts.tc(m_ts.make_typespec("binteger"), f.type()) ||
|
||||
m_ts.tc(m_ts.make_typespec("pair"), f.type())) {
|
||||
// basic, binteger, pair
|
||||
str_template += fmt::format("~T{}: ~A~%", f.name());
|
||||
str_template += fmt::format("{}{}: ~A~%", tabs, f.name());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env));
|
||||
} else if (m_ts.tc(m_ts.make_typespec("structure"), f.type())) {
|
||||
// Structure
|
||||
str_template += fmt::format("~T{}: #<{} @ #x~X>~%", f.name(), f.type().print());
|
||||
str_template += fmt::format("{}{}: #<{} @ #x~X>~%", tabs, f.name(), f.type().print());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env));
|
||||
} else if (m_ts.tc(m_ts.make_typespec("integer"), f.type())) {
|
||||
// Integer
|
||||
if (m_ts.lookup_type(f.type())->get_load_size() > 8) {
|
||||
str_template += fmt::format("~T{}: <cannot-print>~%", f.name());
|
||||
str_template += fmt::format("{}: <cannot-print>~%", tabs, f.name());
|
||||
} else {
|
||||
str_template += fmt::format("~T{}: ~D~%", f.name());
|
||||
str_template += fmt::format("{}{}: ~D~%", tabs, f.name());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env));
|
||||
}
|
||||
|
||||
} else if (m_ts.tc(m_ts.make_typespec("float"), f.type())) {
|
||||
// Float
|
||||
str_template += fmt::format("~T{}: ~f~%", f.name());
|
||||
str_template += fmt::format("{}{}: ~f~%", tabs, f.name());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env));
|
||||
} else if (m_ts.tc(m_ts.make_typespec("pointer"), f.type())) {
|
||||
// Pointers
|
||||
str_template += fmt::format("~T{}: #x~X~%", f.name());
|
||||
str_template += fmt::format("{}{}: #x~X~%", tabs, f.name());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env));
|
||||
} else {
|
||||
// Otherwise, we havn't implemented it!
|
||||
str_template += fmt::format("~T{}: Undefined!~%", f.name());
|
||||
str_template += fmt::format("{}{}: Undefined!~%", tabs, f.name());
|
||||
}
|
||||
|
||||
compile_format_string(form, env, str_template, format_args);
|
||||
}
|
||||
|
||||
Val* Compiler::generate_inspector_for_structured_type(const goos::Object& form,
|
||||
Env* env,
|
||||
StructureType* structure_type) {
|
||||
Val* Compiler::generate_inspector_for_structure_type(const goos::Object& form,
|
||||
Env* env,
|
||||
StructureType* structure_type) {
|
||||
// Create a function environment to hold the code for the inspect method. The name is just for
|
||||
// debugging.
|
||||
auto method_env = std::make_unique<FunctionEnv>(
|
||||
@ -207,18 +212,39 @@ Val* Compiler::generate_inspector_for_structured_type(const goos::Object& form,
|
||||
// Inform the compiler that `input`'s value will be written to `rdi` (first arg register)
|
||||
method_env->emit(std::make_unique<IR_ValueReset>(std::vector<RegVal*>{input}));
|
||||
|
||||
RegVal* type_name = nullptr;
|
||||
if (dynamic_cast<BasicType*>(structure_type)) {
|
||||
type_name = get_field_of_structure(structure_type, input, "type", method_env.get())
|
||||
->to_gpr(method_env.get());
|
||||
} else {
|
||||
type_name =
|
||||
compile_get_sym_obj(structure_type->get_name(), method_env.get())->to_gpr(method_env.get());
|
||||
}
|
||||
compile_format_string(form, method_env.get(), "[~8x] ~A~%", {input, type_name});
|
||||
// there's a special case for children of process.
|
||||
if (m_ts.fully_defined_type_exists("process") &&
|
||||
m_ts.tc(TypeSpec("process"), TypeSpec(structure_type->get_name()))) {
|
||||
// first, call the inspect method of our parent type.
|
||||
auto parent_type_name = structure_type->get_parent();
|
||||
auto parent_inspect =
|
||||
compile_get_method_of_type(form, TypeSpec(parent_type_name), "inspect", method_env.get());
|
||||
std::vector<RegVal*> args = {input};
|
||||
compile_real_function_call(form, parent_inspect, args, method_env.get(), parent_type_name);
|
||||
auto parent_type_info = dynamic_cast<StructureType*>(m_ts.lookup_type(parent_type_name));
|
||||
if (!parent_type_info) {
|
||||
throw_compiler_error(form, "Got an invalid parent type in process inspect method");
|
||||
}
|
||||
|
||||
for (const Field& f : structure_type->fields()) {
|
||||
generate_field_description(form, structure_type, method_env.get(), input, f);
|
||||
for (size_t i = parent_type_info->fields().size(); i < structure_type->fields().size(); i++) {
|
||||
generate_field_description(form, structure_type, method_env.get(), input,
|
||||
structure_type->fields().at(i), 2);
|
||||
}
|
||||
|
||||
} else {
|
||||
RegVal* type_name = nullptr;
|
||||
if (dynamic_cast<BasicType*>(structure_type)) {
|
||||
type_name = get_field_of_structure(structure_type, input, "type", method_env.get())
|
||||
->to_gpr(method_env.get());
|
||||
} else {
|
||||
type_name = compile_get_sym_obj(structure_type->get_name(), method_env.get())
|
||||
->to_gpr(method_env.get());
|
||||
}
|
||||
compile_format_string(form, method_env.get(), "[~8x] ~A~%", {input, type_name});
|
||||
|
||||
for (const Field& f : structure_type->fields()) {
|
||||
generate_field_description(form, structure_type, method_env.get(), input, f, 1);
|
||||
}
|
||||
}
|
||||
|
||||
method_env->emit_ir<IR_Return>(method_env->make_gpr(input->type()), input,
|
||||
@ -343,7 +369,7 @@ Val* Compiler::compile_deftype(const goos::Object& form, const goos::Object& res
|
||||
// Auto-generate (inspect) method
|
||||
auto as_structure_type = dynamic_cast<StructureType*>(result.type_info);
|
||||
if (as_structure_type) { // generate the inspect method
|
||||
generate_inspector_for_structured_type(form, env, as_structure_type);
|
||||
generate_inspector_for_structure_type(form, env, as_structure_type);
|
||||
} else {
|
||||
auto as_bitfield_type = dynamic_cast<BitFieldType*>(result.type_info);
|
||||
if (as_bitfield_type && as_bitfield_type->get_load_size() <= 8) { // Avoid 128-bit bitfields
|
||||
|
@ -69,7 +69,8 @@
|
||||
|
||||
;; definition of type skeleton
|
||||
(deftype skeleton (inline-array-class)
|
||||
()
|
||||
((bones bone :inline :dynamic :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
@ -80,7 +81,7 @@
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tlength: ~D~%" (-> obj length))
|
||||
(format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
|
||||
(format #t "~Tdata[0] @ #x~X~%" (-> obj _data))
|
||||
(format #t "~Tdata[0] @ #x~X~%" (-> obj bones))
|
||||
obj
|
||||
)
|
||||
|
||||
|
@ -726,9 +726,11 @@
|
||||
(set! (-> obj event-other) #f)
|
||||
(set! (-> obj riders) #f)
|
||||
(set! (-> obj root-prim) #f)
|
||||
(let ((v1-5 (-> proc type symbol)))
|
||||
(if (= v1-5 'camera)
|
||||
(set! (-> obj pat-ignore-mask) (the-as uint 2))
|
||||
(case (-> proc type symbol)
|
||||
(('camera)
|
||||
(set! (-> obj pat-ignore-mask) (the-as uint 2))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj pat-ignore-mask) (the-as uint 1))
|
||||
)
|
||||
)
|
||||
|
@ -264,7 +264,8 @@
|
||||
|
||||
;; definition of type art-mesh-anim
|
||||
(deftype art-mesh-anim (art-element)
|
||||
()
|
||||
((data basic :dynamic :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 13
|
||||
:size-assert #x20
|
||||
:flag-assert #xd00000020
|
||||
|
@ -762,14 +762,6 @@
|
||||
|
||||
;; WARN: Stack slot load mismatch: defined as size 4, got size 16
|
||||
|
||||
;; WARN: Stack slot load mismatch: defined as size 4, got size 16
|
||||
|
||||
;; WARN: Stack slot load mismatch: defined as size 4, got size 16
|
||||
|
||||
;; WARN: Stack slot load mismatch: defined as size 4, got size 16
|
||||
|
||||
;; WARN: Stack slot load mismatch: defined as size 4, got size 16
|
||||
|
||||
;; Used lq/sq
|
||||
(defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair))
|
||||
(local-vars
|
||||
@ -1084,7 +1076,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s4-0
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
@ -1149,7 +1141,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
@ -1204,7 +1196,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
@ -1321,7 +1313,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
s1-0
|
||||
(the-as (pointer dma-tag) a3-2)
|
||||
)
|
||||
@ -1361,7 +1353,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
68
|
||||
(bucket-id debug-draw1)
|
||||
sv-32
|
||||
(the-as (pointer dma-tag) a3-3)
|
||||
)
|
||||
|
@ -39,7 +39,11 @@
|
||||
;; definition for function dma-bucket-insert-tag
|
||||
(defun
|
||||
dma-bucket-insert-tag
|
||||
((base dma-bucket) (idx int) (tag-start pointer) (tag-end (pointer dma-tag)))
|
||||
((base dma-bucket)
|
||||
(idx bucket-id)
|
||||
(tag-start pointer)
|
||||
(tag-end (pointer dma-tag))
|
||||
)
|
||||
(let
|
||||
((bucket (the-as dma-bucket (+ (the-as uint base) (the-as uint (* idx 16)))))
|
||||
)
|
||||
|
@ -25,7 +25,15 @@
|
||||
obj
|
||||
)
|
||||
|
||||
;; type drawable-inline-array-node is defined here, but it is unknown to the decompiler
|
||||
;; definition of type drawable-inline-array-node
|
||||
(deftype drawable-inline-array-node (drawable-inline-array)
|
||||
((data draw-node 1 :inline :offset-assert 32)
|
||||
(pad uint32 :offset-assert 64)
|
||||
)
|
||||
:method-count-assert 18
|
||||
:size-assert #x44
|
||||
:flag-assert #x1200000044
|
||||
)
|
||||
|
||||
;; definition of type draw-node-dma
|
||||
(deftype draw-node-dma (structure)
|
||||
|
@ -97,8 +97,8 @@
|
||||
|
||||
;; definition of type ambient-list
|
||||
(deftype ambient-list (structure)
|
||||
((num-items int32 :offset-assert 0)
|
||||
(items uint32 2048 :offset-assert 4)
|
||||
((num-items int32 :offset-assert 0)
|
||||
(items drawable-ambient 2048 :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2004
|
||||
|
@ -18,7 +18,7 @@
|
||||
(dummy-14 () none 14)
|
||||
(dummy-15 (_type_) none 15)
|
||||
(dummy-16 (_type_ object object) object 16)
|
||||
(dummy-17 () none 17)
|
||||
(dummy-17 (_type_ sphere int ambient-list) none 17)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -68,41 +68,39 @@
|
||||
|
||||
;; definition for function pickup-type->string
|
||||
(defun pickup-type->string ((arg0 pickup-type))
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 (pickup-type eco-pill-random))
|
||||
(case arg0
|
||||
(((pickup-type eco-pill-random))
|
||||
"eco-pill-random"
|
||||
)
|
||||
((= v1-0 (pickup-type buzzer))
|
||||
"buzzer"
|
||||
)
|
||||
((= v1-0 (pickup-type eco-pill))
|
||||
"eco-pill"
|
||||
)
|
||||
((= v1-0 (pickup-type fuel-cell))
|
||||
"fuel-cell"
|
||||
)
|
||||
((= v1-0 (pickup-type money))
|
||||
"money"
|
||||
)
|
||||
((= v1-0 (pickup-type eco-green))
|
||||
"eco-green"
|
||||
)
|
||||
((= v1-0 (pickup-type eco-blue))
|
||||
"eco-blue"
|
||||
)
|
||||
((= v1-0 (pickup-type eco-red))
|
||||
"eco-red"
|
||||
)
|
||||
((= v1-0 (pickup-type eco-yellow))
|
||||
"eco-yellow"
|
||||
)
|
||||
((= v1-0 (pickup-type none))
|
||||
"none"
|
||||
)
|
||||
(else
|
||||
"*unknown*"
|
||||
)
|
||||
(((pickup-type buzzer))
|
||||
"buzzer"
|
||||
)
|
||||
(((pickup-type eco-pill))
|
||||
"eco-pill"
|
||||
)
|
||||
(((pickup-type fuel-cell))
|
||||
"fuel-cell"
|
||||
)
|
||||
(((pickup-type money))
|
||||
"money"
|
||||
)
|
||||
(((pickup-type eco-green))
|
||||
"eco-green"
|
||||
)
|
||||
(((pickup-type eco-blue))
|
||||
"eco-blue"
|
||||
)
|
||||
(((pickup-type eco-red))
|
||||
"eco-red"
|
||||
)
|
||||
(((pickup-type eco-yellow))
|
||||
"eco-yellow"
|
||||
)
|
||||
(((pickup-type none))
|
||||
"none"
|
||||
)
|
||||
(else
|
||||
"*unknown*"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -200,8 +200,8 @@
|
||||
(auto-save-status uint32 :offset-assert 280)
|
||||
(auto-save-card int32 :offset-assert 284)
|
||||
(auto-save-which int32 :offset-assert 288)
|
||||
(pov-camera-handle uint64 :offset-assert 296)
|
||||
(other-camera-handle uint64 :offset-assert 304)
|
||||
(pov-camera-handle handle :offset-assert 296)
|
||||
(other-camera-handle handle :offset-assert 304)
|
||||
(death-pos vector-array :offset-assert 312)
|
||||
(dummy basic :offset-assert 316)
|
||||
(auto-save-count int32 :offset-assert 320)
|
||||
|
@ -7,7 +7,7 @@
|
||||
(sfx-volume float :offset-assert 4)
|
||||
(music-volume float :offset-assert 8)
|
||||
(dialog-volume float :offset-assert 12)
|
||||
(process-mask uint32 :offset-assert 16)
|
||||
(process-mask process-mask :offset-assert 16)
|
||||
(common-page int32 :offset-assert 20)
|
||||
(language int64 :offset-assert 24)
|
||||
(screenx int32 :offset-assert 32)
|
||||
|
@ -7,126 +7,130 @@
|
||||
(s4-0 (-> arg0 alive-list-end prev0))
|
||||
)
|
||||
(while (!= (the-as connectable conn) (-> arg0 alive-list))
|
||||
(let ((v1-1 (-> conn param0)))
|
||||
(cond
|
||||
((= v1-1 'border-mode)
|
||||
(case (-> conn param0)
|
||||
(('border-mode)
|
||||
(set! (-> obj border-mode) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'allow-look-around)
|
||||
(set! (-> obj allow-look-around) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'ocean-off)
|
||||
(set! (-> obj ocean-off) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'music)
|
||||
(set! (-> obj music) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'process-mask)
|
||||
(let ((v1-6 (-> conn param1)))
|
||||
(cond
|
||||
((= (the-as symbol v1-6) 'set)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logior
|
||||
(-> obj process-mask)
|
||||
(the-as uint (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-6 'clear)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logand
|
||||
(-> obj process-mask)
|
||||
(the-as uint (lognot (the-as uint (-> conn param3))))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-6 'abs)
|
||||
(set!
|
||||
(('allow-look-around)
|
||||
(set! (-> obj allow-look-around) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('ocean-off)
|
||||
(set! (-> obj ocean-off) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('music)
|
||||
(set! (-> obj music) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('process-mask)
|
||||
(case (-> conn param1)
|
||||
(('set)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logior
|
||||
(-> obj process-mask)
|
||||
(the-as uint (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'sfx-volume)
|
||||
(when
|
||||
(or
|
||||
(zero?
|
||||
(logand
|
||||
(-> *kernel-context* prevent-from-run)
|
||||
(process-mask progress)
|
||||
)
|
||||
)
|
||||
(let ((v1-18 (get-process conn))
|
||||
(a0-22 *progress-process*)
|
||||
)
|
||||
(= v1-18 (if a0-22
|
||||
(-> a0-22 0 self)
|
||||
)
|
||||
)
|
||||
(('clear)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(logand
|
||||
(-> obj process-mask)
|
||||
(the-as uint (the-as uint (lognot (the-as uint (-> conn param3)))))
|
||||
)
|
||||
)
|
||||
(let ((v1-20 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-20 'rel)
|
||||
)
|
||||
(('abs)
|
||||
(set!
|
||||
(-> obj process-mask)
|
||||
(the-as process-mask (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(('sfx-volume)
|
||||
(when
|
||||
(or
|
||||
(zero?
|
||||
(logand (-> *kernel-context* prevent-from-run) (process-mask progress))
|
||||
)
|
||||
(let ((v1-18 (get-process conn))
|
||||
(a0-22 *progress-process*)
|
||||
)
|
||||
(= v1-18 (if a0-22
|
||||
(-> a0-22 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj sfx-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume))
|
||||
)
|
||||
(set! (-> obj sfx-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj sfx-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-1 'music-volume)
|
||||
(let ((v1-25 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-25 'rel)
|
||||
)
|
||||
(('music-volume)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj music-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj music-volume))
|
||||
)
|
||||
(set! (-> obj music-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj music-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'ambient-volume)
|
||||
(let ((v1-30 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-30 'rel)
|
||||
)
|
||||
(('ambient-volume)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj ambient-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj ambient-volume))
|
||||
)
|
||||
(set! (-> obj ambient-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj ambient-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'dialog-volume)
|
||||
(let ((v1-35 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-35 'rel)
|
||||
)
|
||||
(('dialog-volume)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj dialog-volume)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj dialog-volume))
|
||||
)
|
||||
(set! (-> obj dialog-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj dialog-volume) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'sfx-volume-movie)
|
||||
(let ((v1-40 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-40 'rel)
|
||||
)
|
||||
(('sfx-volume-movie)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj sfx-volume-movie)
|
||||
(* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume-movie))
|
||||
)
|
||||
(set! (-> obj sfx-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj sfx-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'music-volume-movie)
|
||||
(let ((v1-45 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-45 'rel)
|
||||
)
|
||||
(('music-volume-movie)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj music-volume-movie)
|
||||
(*
|
||||
@ -134,13 +138,15 @@
|
||||
(-> obj music-volume-movie)
|
||||
)
|
||||
)
|
||||
(set! (-> obj music-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj music-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'ambient-volume-movie)
|
||||
(let ((v1-50 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-50 'rel)
|
||||
)
|
||||
(('ambient-volume-movie)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj ambient-volume-movie)
|
||||
(*
|
||||
@ -148,13 +154,15 @@
|
||||
(-> obj ambient-volume-movie)
|
||||
)
|
||||
)
|
||||
(set! (-> obj ambient-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj ambient-volume-movie) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'dialog-volume-hint)
|
||||
(let ((v1-55 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-55 'rel)
|
||||
)
|
||||
(('dialog-volume-hint)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
(set!
|
||||
(-> obj dialog-volume-hint)
|
||||
(*
|
||||
@ -162,84 +170,83 @@
|
||||
(-> obj dialog-volume-hint)
|
||||
)
|
||||
)
|
||||
(set! (-> obj dialog-volume-hint) (the-as float (-> conn param2)))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj dialog-volume-hint) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
((= v1-1 'sound-flava)
|
||||
(when (>= (the-as float (-> conn param2)) (-> obj sound-flava-priority))
|
||||
(set! (-> obj sound-flava) (the-as uint (the-as int (-> conn param3))))
|
||||
(set! (-> obj sound-flava-priority) (the-as float (-> conn param2)))
|
||||
)
|
||||
)
|
||||
(('sound-flava)
|
||||
(when (>= (the-as float (-> conn param2)) (-> obj sound-flava-priority))
|
||||
(set! (-> obj sound-flava) (the-as uint (the-as int (-> conn param3))))
|
||||
(set! (-> obj sound-flava-priority) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-r)
|
||||
(set! (-> obj bg-r) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-g)
|
||||
(set! (-> obj bg-g) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-b)
|
||||
(set! (-> obj bg-b) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-a)
|
||||
(set! (-> obj bg-a) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-a-speed)
|
||||
(set! (-> obj bg-a-speed) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'bg-a-force)
|
||||
(set! (-> obj bg-a-force) (the-as float (-> conn param2)))
|
||||
)
|
||||
((= v1-1 'language)
|
||||
(set! (-> obj language) (the-as int (-> conn param3)))
|
||||
)
|
||||
((= v1-1 'vibration)
|
||||
(set! (-> obj vibration) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'auto-save)
|
||||
(set! (-> obj auto-save) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'allow-pause)
|
||||
(set! (-> obj allow-pause) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'allow-progress)
|
||||
(set! (-> obj allow-progress) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'play-hints)
|
||||
(set! (-> obj play-hints) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'movie)
|
||||
(set! (-> obj movie) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'talking)
|
||||
(set! (-> obj talking) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'spooling)
|
||||
(set! (-> obj spooling) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'hint)
|
||||
(set! (-> obj hint) (the-as (pointer process) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'ambient)
|
||||
(set! (-> obj ambient) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
((= v1-1 'common-page)
|
||||
(let ((v1-89 (-> conn param1)))
|
||||
(cond
|
||||
((= (the-as symbol v1-89) 'set)
|
||||
(set!
|
||||
(-> obj common-page)
|
||||
(logior (-> obj common-page) (the-as int (-> conn param3)))
|
||||
)
|
||||
)
|
||||
(('bg-r)
|
||||
(set! (-> obj bg-r) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-g)
|
||||
(set! (-> obj bg-g) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-b)
|
||||
(set! (-> obj bg-b) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-a)
|
||||
(set! (-> obj bg-a) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-a-speed)
|
||||
(set! (-> obj bg-a-speed) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('bg-a-force)
|
||||
(set! (-> obj bg-a-force) (the-as float (-> conn param2)))
|
||||
)
|
||||
(('language)
|
||||
(set! (-> obj language) (the-as int (-> conn param3)))
|
||||
)
|
||||
(('vibration)
|
||||
(set! (-> obj vibration) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('auto-save)
|
||||
(set! (-> obj auto-save) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('allow-pause)
|
||||
(set! (-> obj allow-pause) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('allow-progress)
|
||||
(set! (-> obj allow-progress) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('play-hints)
|
||||
(set! (-> obj play-hints) (the-as symbol (-> conn param1)))
|
||||
)
|
||||
(('movie)
|
||||
(set! (-> obj movie) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('talking)
|
||||
(set! (-> obj talking) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('spooling)
|
||||
(set! (-> obj spooling) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('hint)
|
||||
(set! (-> obj hint) (the-as (pointer process) (-> conn param1)))
|
||||
)
|
||||
(('ambient)
|
||||
(set! (-> obj ambient) (the-as (pointer progress) (-> conn param1)))
|
||||
)
|
||||
(('common-page)
|
||||
(case (-> conn param1)
|
||||
(('set)
|
||||
(set!
|
||||
(-> obj common-page)
|
||||
(logior (-> obj common-page) (the-as int (-> conn param3)))
|
||||
)
|
||||
((= v1-89 'clear)
|
||||
(set!
|
||||
(-> obj common-page)
|
||||
(logand
|
||||
(-> obj common-page)
|
||||
(the-as int (the-as uint (lognot (the-as uint (-> conn param3)))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(('clear)
|
||||
(set!
|
||||
(-> obj common-page)
|
||||
(logand
|
||||
(-> obj common-page)
|
||||
(the-as int (the-as uint (lognot (the-as uint (-> conn param3)))))
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -354,10 +361,7 @@
|
||||
(set! (-> gp-0 dialog-volume-hint) (-> s5-0 dialog-volume-hint))
|
||||
(set! (-> gp-0 process-mask) (-> s5-0 process-mask))
|
||||
)
|
||||
(set!
|
||||
(-> *kernel-context* prevent-from-run)
|
||||
(the-as process-mask (-> gp-0 process-mask))
|
||||
)
|
||||
(set! (-> *kernel-context* prevent-from-run) (-> gp-0 process-mask))
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
@ -496,17 +500,15 @@
|
||||
(set! (-> *level* border?) (-> gp-0 border-mode))
|
||||
(set! (-> *texture-pool* common-page-mask) (-> gp-0 common-page))
|
||||
(set! (-> *cpad-list* cpads 0 buzz) (-> gp-0 vibration))
|
||||
(let ((v1-64 (-> gp-0 ocean-off)))
|
||||
(cond
|
||||
((= v1-64 #t)
|
||||
(case (-> gp-0 ocean-off)
|
||||
((#t)
|
||||
(set! *ocean-off* #t)
|
||||
)
|
||||
((= v1-64 'mid)
|
||||
(set! *ocean-mid-off* #t)
|
||||
)
|
||||
((= v1-64 'near)
|
||||
(set! *ocean-near-off* #t)
|
||||
)
|
||||
(('mid)
|
||||
(set! *ocean-mid-off* #t)
|
||||
)
|
||||
(('near)
|
||||
(set! *ocean-near-off* #t)
|
||||
)
|
||||
)
|
||||
gp-0
|
||||
@ -557,7 +559,7 @@
|
||||
)
|
||||
)
|
||||
(set! (-> gp-0 language) (the-as int (scf-get-language)))
|
||||
(set! (-> gp-0 process-mask) (the-as uint 65))
|
||||
(set! (-> gp-0 process-mask) (process-mask execute sleep))
|
||||
(set! (-> gp-0 screenx) 0)
|
||||
(set! (-> gp-0 screeny) 0)
|
||||
(set! (-> gp-0 vibration) #t)
|
||||
@ -574,9 +576,11 @@
|
||||
(set! (-> gp-0 bg-a-speed) 8.0)
|
||||
(set! (-> gp-0 allow-pause) #t)
|
||||
(set! (-> gp-0 allow-progress) #t)
|
||||
(let ((v1-27 (scf-get-aspect)))
|
||||
(if (= v1-27 2)
|
||||
(set! (-> gp-0 aspect-ratio) 'aspect16x9)
|
||||
(case (scf-get-aspect)
|
||||
((2)
|
||||
(set! (-> gp-0 aspect-ratio) 'aspect16x9)
|
||||
)
|
||||
(else
|
||||
(set! (-> gp-0 aspect-ratio) 'aspect4x3)
|
||||
)
|
||||
)
|
||||
@ -603,7 +607,3 @@
|
||||
(set! (-> s5-0 ocean-off) (-> gp-0 ocean-off))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -496,20 +496,15 @@
|
||||
(when (and (!= gp-0 0) (nonzero? (-> gp-0 length)))
|
||||
(let ((s5-0 (-> *game-info* in-level-time a0-3)))
|
||||
(dotimes (s4-0 (-> gp-0 length))
|
||||
(let
|
||||
((v1-17 (get-task-status (the-as game-task (-> gp-0 s4-0 task)))))
|
||||
(when
|
||||
(or
|
||||
(= v1-17 (task-status need-hint))
|
||||
(= v1-17 (task-status unknown))
|
||||
)
|
||||
(if (< (-> gp-0 s4-0 delay) s5-0)
|
||||
(close-specific-task!
|
||||
(the-as game-task (-> gp-0 s4-0 task))
|
||||
(task-status need-hint)
|
||||
(case (get-task-status (the-as game-task (-> gp-0 s4-0 task)))
|
||||
(((task-status need-hint) (task-status unknown))
|
||||
(if (< (-> gp-0 s4-0 delay) s5-0)
|
||||
(close-specific-task!
|
||||
(the-as game-task (-> gp-0 s4-0 task))
|
||||
(task-status need-hint)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -3,35 +3,33 @@
|
||||
|
||||
;; definition (debug) for function task-status->string
|
||||
(defun-debug task-status->string ((arg0 task-status))
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 (task-status need-resolution))
|
||||
(case arg0
|
||||
(((task-status need-resolution))
|
||||
"need-resolution"
|
||||
)
|
||||
((= v1-0 (task-status need-reward-speech))
|
||||
"need-reward-speech"
|
||||
)
|
||||
((= v1-0 (task-status need-reminder))
|
||||
"need-reminder"
|
||||
)
|
||||
((= v1-0 (task-status need-reminder-a))
|
||||
"need-reminder-a"
|
||||
)
|
||||
((= v1-0 (task-status need-introduction))
|
||||
"need-introduction"
|
||||
)
|
||||
((= v1-0 (task-status need-hint))
|
||||
"need-hint"
|
||||
)
|
||||
((= v1-0 (task-status unknown))
|
||||
"unknown"
|
||||
)
|
||||
((= v1-0 (task-status invalid))
|
||||
"invalid"
|
||||
)
|
||||
(else
|
||||
"*unknown*"
|
||||
)
|
||||
(((task-status need-reward-speech))
|
||||
"need-reward-speech"
|
||||
)
|
||||
(((task-status need-reminder))
|
||||
"need-reminder"
|
||||
)
|
||||
(((task-status need-reminder-a))
|
||||
"need-reminder-a"
|
||||
)
|
||||
(((task-status need-introduction))
|
||||
"need-introduction"
|
||||
)
|
||||
(((task-status need-hint))
|
||||
"need-hint"
|
||||
)
|
||||
(((task-status unknown))
|
||||
"unknown"
|
||||
)
|
||||
(((task-status invalid))
|
||||
"invalid"
|
||||
)
|
||||
(else
|
||||
"*unknown*"
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -5490,17 +5488,17 @@
|
||||
|
||||
;; definition for function task-known?
|
||||
(defun task-known? ((arg0 game-task))
|
||||
(let ((v1-0 (get-task-status arg0)))
|
||||
(if
|
||||
(or
|
||||
(= v1-0 (task-status need-reward-speech))
|
||||
(= v1-0 (task-status need-introduction))
|
||||
(= v1-0 (task-status need-reminder))
|
||||
(= v1-0 (task-status need-reminder-a))
|
||||
(= v1-0 (task-status need-resolution))
|
||||
(= v1-0 (task-status invalid))
|
||||
(case (get-task-status arg0)
|
||||
(((task-status need-reward-speech)
|
||||
(task-status need-introduction)
|
||||
(task-status need-reminder)
|
||||
(task-status need-reminder-a)
|
||||
(task-status need-resolution)
|
||||
(task-status invalid)
|
||||
)
|
||||
#t
|
||||
)
|
||||
#t
|
||||
(else
|
||||
#f
|
||||
)
|
||||
)
|
||||
|
@ -4,9 +4,8 @@
|
||||
;; definition for function set-video-mode
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun set-video-mode ((arg0 symbol))
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 'ntsc)
|
||||
(case arg0
|
||||
(('ntsc)
|
||||
(set! (-> *video-parms* screen-sy) 224)
|
||||
(set! (-> *setting-control* default screenx) 0)
|
||||
(set! (-> *setting-control* default screeny) 8)
|
||||
@ -18,18 +17,17 @@
|
||||
(set! (-> *math-camera* y-clip) 448.0)
|
||||
(set! (-> *shadow-data* texoffset y) 112.5)
|
||||
)
|
||||
((= v1-0 'pal)
|
||||
(set! (-> *video-parms* screen-sy) 256)
|
||||
(set! (-> *setting-control* default screenx) 0)
|
||||
(set! (-> *setting-control* default screeny) 24)
|
||||
(set! (-> *video-parms* screen-pages-high) 8)
|
||||
(set! (-> *video-parms* relative-y-scale) 1.1428572)
|
||||
(set! *ticks-per-frame* #x2dc6)
|
||||
(set! (-> *math-camera* isometric vector 1 y) 0.4375)
|
||||
(set! (-> *math-camera* y-pix) 128.0)
|
||||
(set! (-> *math-camera* y-clip) 512.0)
|
||||
(set! (-> *shadow-data* texoffset y) 128.5)
|
||||
)
|
||||
(('pal)
|
||||
(set! (-> *video-parms* screen-sy) 256)
|
||||
(set! (-> *setting-control* default screenx) 0)
|
||||
(set! (-> *setting-control* default screeny) 24)
|
||||
(set! (-> *video-parms* screen-pages-high) 8)
|
||||
(set! (-> *video-parms* relative-y-scale) 1.1428572)
|
||||
(set! *ticks-per-frame* #x2dc6)
|
||||
(set! (-> *math-camera* isometric vector 1 y) 0.4375)
|
||||
(set! (-> *math-camera* y-pix) 128.0)
|
||||
(set! (-> *math-camera* y-clip) 512.0)
|
||||
(set! (-> *shadow-data* texoffset y) 128.5)
|
||||
)
|
||||
)
|
||||
(set-time-ratios *display* (-> *display* time-ratio))
|
||||
@ -70,16 +68,14 @@
|
||||
;; definition for function set-aspect-ratio
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun set-aspect-ratio ((arg0 symbol))
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 'aspect4x3)
|
||||
(case arg0
|
||||
(('aspect4x3)
|
||||
(set! (-> *video-parms* relative-x-scale) 1.0)
|
||||
(set! (-> *video-parms* relative-x-scale-reciprical) 1.0)
|
||||
)
|
||||
((= v1-0 'aspect16x9)
|
||||
(set! (-> *video-parms* relative-x-scale) 0.75)
|
||||
(set! (-> *video-parms* relative-x-scale-reciprical) 1.3333334)
|
||||
)
|
||||
(('aspect16x9)
|
||||
(set! (-> *video-parms* relative-x-scale) 0.75)
|
||||
(set! (-> *video-parms* relative-x-scale-reciprical) 1.3333334)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
|
@ -1407,10 +1407,6 @@
|
||||
;; definition for function curve-closest-point
|
||||
;; WARN: Stack slot offset 48 signed mismatch
|
||||
;; WARN: Stack slot offset 48 signed mismatch
|
||||
;; WARN: Stack slot offset 48 signed mismatch
|
||||
;; WARN: Stack slot offset 48 signed mismatch
|
||||
;; WARN: Stack slot offset 48 signed mismatch
|
||||
;; WARN: Stack slot offset 48 signed mismatch
|
||||
(defun
|
||||
curve-closest-point
|
||||
((arg0 curve) (arg1 vector) (arg2 float) (arg3 float) (arg4 int) (arg5 float))
|
||||
|
@ -128,7 +128,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
s3-0
|
||||
(the-as bucket-id s3-0)
|
||||
s2-0
|
||||
(the-as (pointer dma-tag) a3-0)
|
||||
)
|
||||
|
@ -15,20 +15,18 @@
|
||||
(defmethod set-time-ratios display ((obj display) (slowdown float))
|
||||
(let ((ratio (fmin 4.0 slowdown)))
|
||||
(set! (-> obj time-ratio) ratio)
|
||||
(let ((v1-0 (get-video-mode)))
|
||||
(cond
|
||||
((= v1-0 'pal)
|
||||
(case (get-video-mode)
|
||||
(('pal)
|
||||
(set! (-> obj time-adjust-ratio) (* 1.2 ratio))
|
||||
(set! (-> obj seconds-per-frame) (* 0.02 ratio))
|
||||
(set! (-> obj frames-per-second) (* 50.0 (/ 1.0 ratio)))
|
||||
(set! (-> obj time-factor) 6.0)
|
||||
)
|
||||
(else
|
||||
(set! (-> obj time-adjust-ratio) ratio)
|
||||
(set! (-> obj seconds-per-frame) (* 0.016666668 ratio))
|
||||
(set! (-> obj frames-per-second) (* 60.0 (/ 1.0 ratio)))
|
||||
(set! (-> obj time-factor) 5.0)
|
||||
)
|
||||
(else
|
||||
(set! (-> obj time-adjust-ratio) ratio)
|
||||
(set! (-> obj seconds-per-frame) (* 0.016666668 ratio))
|
||||
(set! (-> obj frames-per-second) (* 60.0 (/ 1.0 ratio)))
|
||||
(set! (-> obj time-factor) 5.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -77,50 +77,48 @@
|
||||
|
||||
;; definition for function psm->string
|
||||
(defun psm->string ((arg0 gs-psm))
|
||||
(let ((v1-0 arg0))
|
||||
(cond
|
||||
((= v1-0 (gs-psm mz16s))
|
||||
(case arg0
|
||||
(((gs-psm mz16s))
|
||||
"mz16s"
|
||||
)
|
||||
((= v1-0 (gs-psm mz16))
|
||||
"mz16"
|
||||
)
|
||||
((= v1-0 (gs-psm mz24))
|
||||
"mz24"
|
||||
)
|
||||
((= v1-0 (gs-psm mz32))
|
||||
"mz32"
|
||||
)
|
||||
((= v1-0 (gs-psm mt4hh))
|
||||
"mt4hh"
|
||||
)
|
||||
((= v1-0 (gs-psm mt4hl))
|
||||
"mt4hl"
|
||||
)
|
||||
((= v1-0 (gs-psm mt8h))
|
||||
"mt8h"
|
||||
)
|
||||
((= v1-0 (gs-psm mt4))
|
||||
"mt4"
|
||||
)
|
||||
((= v1-0 (gs-psm mt8))
|
||||
"mt8"
|
||||
)
|
||||
((= v1-0 (gs-psm ct16s))
|
||||
"ct16s"
|
||||
)
|
||||
((= v1-0 (gs-psm ct16))
|
||||
"ct16"
|
||||
)
|
||||
((= v1-0 (gs-psm ct24))
|
||||
"ct24"
|
||||
)
|
||||
((= v1-0 (gs-psm ct32))
|
||||
"ct32"
|
||||
)
|
||||
(else
|
||||
"*unknown*"
|
||||
)
|
||||
(((gs-psm mz16))
|
||||
"mz16"
|
||||
)
|
||||
(((gs-psm mz24))
|
||||
"mz24"
|
||||
)
|
||||
(((gs-psm mz32))
|
||||
"mz32"
|
||||
)
|
||||
(((gs-psm mt4hh))
|
||||
"mt4hh"
|
||||
)
|
||||
(((gs-psm mt4hl))
|
||||
"mt4hl"
|
||||
)
|
||||
(((gs-psm mt8h))
|
||||
"mt8h"
|
||||
)
|
||||
(((gs-psm mt4))
|
||||
"mt4"
|
||||
)
|
||||
(((gs-psm mt8))
|
||||
"mt8"
|
||||
)
|
||||
(((gs-psm ct16s))
|
||||
"ct16s"
|
||||
)
|
||||
(((gs-psm ct16))
|
||||
"ct16"
|
||||
)
|
||||
(((gs-psm ct24))
|
||||
"ct24"
|
||||
)
|
||||
(((gs-psm ct32))
|
||||
"ct32"
|
||||
)
|
||||
(else
|
||||
"*unknown*"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -112,6 +112,7 @@
|
||||
((mask uint8 8 :offset-assert 0)
|
||||
(dword uint64 :offset 0)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
@ -120,7 +121,7 @@
|
||||
;; definition for method 3 of type ocean-mid-mask
|
||||
(defmethod inspect ocean-mid-mask ((obj ocean-mid-mask))
|
||||
(format #t "[~8x] ~A~%" obj 'ocean-mid-mask)
|
||||
(format #t "~Tmask[8] @ #x~X~%" (-> obj mask))
|
||||
(format #t "~Tmask[8] @ #x~X~%" (&-> obj dword))
|
||||
(format #t "~Tdword: #x~X~%" (-> obj dword))
|
||||
obj
|
||||
)
|
||||
@ -143,7 +144,7 @@
|
||||
|
||||
;; definition of type ocean-mid-masks
|
||||
(deftype ocean-mid-masks (basic)
|
||||
((data uint32 :offset-assert 4)
|
||||
((data (inline-array ocean-mid-mask) :offset-assert 4)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
@ -198,7 +199,7 @@
|
||||
|
||||
;; definition of type ocean-trans-indices
|
||||
(deftype ocean-trans-indices (basic)
|
||||
((data uint32 2304 :offset-assert 4)
|
||||
((data ocean-trans-index 2304 :inline :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2404
|
||||
@ -230,7 +231,7 @@
|
||||
|
||||
;; definition of type ocean-near-indices
|
||||
(deftype ocean-near-indices (basic)
|
||||
((data uint32 :offset-assert 4)
|
||||
((data (inline-array ocean-near-index) :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user