[decompiler] fix missing casts issue (#573)

* fix casts issue

* fix bug

* one last small fix
This commit is contained in:
water111
2021-06-09 21:35:13 -04:00
committed by GitHub
parent 12d72c7897
commit 92afd62e2c
102 changed files with 340 additions and 528 deletions
+5 -6
View File
@@ -1515,9 +1515,9 @@ RegisterAccess CallOp::get_set_destination() const {
void CallOp::update_register_info() {
// throw std::runtime_error("CallOp::update_register_info cannot be done until types are known");
m_read_regs.push_back(Register(Reg::GPR, Reg::T9));
// if the type analysis succeeds, it will remove this if the function doesn't return a value.
// but, in the case we want to keep running without type information, we may need a
// renamed variable here, so we add this.
// previously, if the type analysis succeeds, it would remove this if the function doesn't return
// a value. however, this turned out to be not quite right because GOAL internally thinks that all
// functions return a value.
m_write_regs.push_back(Register(Reg::GPR, Reg::V0));
clobber_temps();
}
@@ -1528,9 +1528,8 @@ void CallOp::collect_vars(RegAccessSet& vars) const {
vars.insert(e);
}
if (m_call_type_set && m_call_type.last_arg() != TypeSpec("none")) {
vars.insert(m_return_var);
}
// even if we don't actually return a value, GOAL pretends like we do.
vars.insert(m_return_var);
}
/////////////////////////////
+21 -23
View File
@@ -858,27 +858,25 @@ TP_Type LoadVarOp::get_src_type(const TypeState& input,
// of method 0.
return TP_Type::make_from_ts(TypeSpec("function"));
}
// Assume we're accessing a field of an object.
FieldReverseLookupInput rd_in;
DerefKind dk;
dk.is_store = false;
dk.reg_kind = get_reg_kind(ro.reg);
dk.sign_extend = m_kind == Kind::SIGNED;
dk.size = m_size;
rd_in.deref = dk;
rd_in.base_type = input_type.typespec();
rd_in.stride = 0;
rd_in.offset = ro.offset;
auto rd = dts.ts.reverse_field_lookup(rd_in);
if (rd.success) {
// load_path_set = true;
// load_path_addr_of = rd.addr_of;
// load_path_base = ro.reg_ir;
// for (auto& x : rd.tokens) {
// load_path.push_back(x.print());
// }
return TP_Type::make_from_ts(coerce_to_reg_type(rd.result_type));
// Assume we're accessing a field of an object.
// if we are a pair with sloppy typing, don't use this and instead use the case down below.
if (input_type.typespec() != TypeSpec("pair") || !env.allow_sloppy_pair_typing()) {
FieldReverseLookupInput rd_in;
DerefKind dk;
dk.is_store = false;
dk.reg_kind = get_reg_kind(ro.reg);
dk.sign_extend = m_kind == Kind::SIGNED;
dk.size = m_size;
rd_in.deref = dk;
rd_in.base_type = input_type.typespec();
rd_in.stride = 0;
rd_in.offset = ro.offset;
auto rd = dts.ts.reverse_field_lookup(rd_in);
if (rd.success) {
return TP_Type::make_from_ts(coerce_to_reg_type(rd.result_type));
}
}
if (input_type.typespec() == TypeSpec("pointer") ||
@@ -1087,10 +1085,10 @@ TypeState CallOp::propagate_types_internal(const TypeState& input,
m_arg_vars.push_back(RegisterAccess(AccessMode::READ, m_read_regs.back(), m_my_idx));
}
// _always_ write the v0 register, even if the function returns none.
// GOAL seems to insert coloring moves even on functions returning none.
m_write_regs.clear();
if (in_type.last_arg() != TypeSpec("none")) {
m_write_regs.emplace_back(Reg::GPR, Reg::V0);
}
m_write_regs.emplace_back(Reg::GPR, Reg::V0);
return end_types;
}
+9
View File
@@ -1645,6 +1645,12 @@ CastElement::CastElement(TypeSpec type, Form* source, bool numeric)
}
goos::Object CastElement::to_form_internal(const Env& env) const {
auto atom = form_as_atom(m_source);
if (atom && atom->is_var()) {
return pretty_print::build_list(
m_numeric ? "the" : "the-as", m_type.print(),
atom->var().to_form(env, RegisterAccess::Print::AS_VARIABLE_NO_CAST));
}
return pretty_print::build_list(m_numeric ? "the" : "the-as", m_type.print(),
m_source->to_form(env));
}
@@ -2173,6 +2179,9 @@ void LetElement::apply_form(const std::function<void(Form*)>& f) {
void LetElement::collect_vars(RegAccessSet& vars, bool recursive) const {
for (auto& entry : m_entries) {
vars.insert(entry.dest);
if (recursive) {
entry.src->collect_vars(vars, recursive);
}
}
m_body->collect_vars(vars, recursive);
}
+3 -1
View File
@@ -3131,8 +3131,9 @@ void push_asm_pextuw_to_stack(const AsmOp* op,
}
}
/*
void push_asm_madds_to_stack(const AsmOp* op,
FormElement* /*form_elt*/,
FormElement* form_elt,
const Env& env,
FormPool& pool,
FormStack& stack) {
@@ -3153,6 +3154,7 @@ void push_asm_madds_to_stack(const AsmOp* op,
nullptr, GenericOperator::make_fixed(FixedOperatorKind::ASM_MADDS), vars),
true, env.get_variable_type(*dst, true));
}
*/
void push_asm_to_stack(const AsmOp* op,
FormElement* form_elt,
+43 -2
View File
@@ -590,18 +590,56 @@ void update_var_info(VariableNames::VarInfo* info,
const TypeState& ts,
int var_id,
const DecompilerTypeSystem& dts) {
auto& type = ts.get(reg);
if (info->initialized) {
assert(info->reg_id.id == var_id);
assert(info->reg_id.reg == reg);
bool changed;
info->type = dts.tp_lca(info->type, ts.get(reg), &changed);
info->type = dts.tp_lca(info->type, type, &changed);
} else {
info->reg_id.id = var_id;
info->reg_id.reg = reg;
info->type = ts.get(reg);
info->type = type;
info->initialized = true;
}
}
bool merge_infos(VariableNames::VarInfo* info1,
VariableNames::VarInfo* info2,
const DecompilerTypeSystem& dts) {
if (info1->initialized && info2->initialized) {
bool changed;
auto new_type = dts.tp_lca(info1->type, info2->type, &changed);
if (changed) {
// fmt::print("changed new to {} from {} {} ({} {})\n", new_type.print(),
// info1->type.print(),
// info2->type.print(), info1->reg_id.print(), info2->reg_id.print());
info1->type = new_type;
info2->type = new_type;
return true;
}
}
return false;
}
void merge_infos(
std::unordered_map<Register, std::vector<VariableNames::VarInfo>, Register::hash>& info1,
std::unordered_map<Register, std::vector<VariableNames::VarInfo>, Register::hash>& info2,
const DecompilerTypeSystem& dts) {
for (auto& [reg, infos] : info1) {
auto other = info2.find(reg);
if (other != info2.end()) {
for (size_t i = 0; i < std::min(other->second.size(), infos.size()); i++) {
merge_infos(&infos.at(i), &other->second.at(i), dts);
}
}
}
}
} // namespace
/*!
@@ -613,6 +651,7 @@ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) {
const TypeState* init_types = &function.ir2.env.get_types_at_block_entry(block_id);
for (auto& instr : block.ins) {
auto op_id = instr.op_id;
const TypeState* end_types = &function.ir2.env.get_types_after_op(op_id);
if (instr.dst.has_value()) {
@@ -645,6 +684,8 @@ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) {
}
}
merge_infos(program_write_vars, program_read_vars, dts);
// copy types from input argument coloring moves:
for (auto& instr : blocks.at(0).ins) {
if (instr.is_arg_coloring_move) {
+1 -1
View File
@@ -836,7 +836,7 @@
(define-extern *listener-function* (function object))
(define-extern reset-and-call (function thread function object))
(define-extern execute-process-tree (function process-tree (function object object) kernel-context object))
(define-extern search-process-tree (function process-tree (function process-tree object) process))
(define-extern search-process-tree (function process-tree (function process-tree object) process-tree))
(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object))
(define-extern process-not-name (function object process-tree process))
(define-extern process-by-name (function object process-tree process))
+4 -4
View File
@@ -1476,7 +1476,7 @@
(define *global-search-name* (the basic #f))
(define *global-search-count* 0)
(define-extern search-process-tree (function process-tree (function process-tree object) process))
(define-extern search-process-tree (function process-tree (function process-tree object) process-tree))
(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object))
(define-extern execute-process-tree (function process-tree (function object object) kernel-context object))
@@ -1617,7 +1617,7 @@
(unless (process-mask? (-> obj mask) process-tree)
;; is this a match?
(when (func obj)
(return-from #f (the process obj))
(return-from #f obj)
)
)
@@ -1627,14 +1627,14 @@
(let ((temp (-> (-> brother) brother)))
(let ((ret (search-process-tree (-> brother) func)))
(when ret
(return-from #f (the process ret))
(return-from #f ret)
)
)
(set! brother temp)
)
)
)
(the process #f)
(the process-tree #f)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -226,9 +226,5 @@
)
;; failed to figure out what this is:
(let ((v0-9 0))
(let ((v0-18 0))
)
@@ -192,5 +192,5 @@
)
;; failed to figure out what this is:
(let ((v0-5 0))
(let ((v0-10 0))
)
@@ -153,5 +153,5 @@
)
;; failed to figure out what this is:
(let ((v0-6 0))
(let ((v0-13 0))
)
@@ -842,5 +842,5 @@
)
;; failed to figure out what this is:
(let ((v0-11 0))
(let ((v0-28 0))
)
@@ -191,6 +191,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-6 0))
)
@@ -145,8 +145,7 @@
)
)
(fog-corrector-setup *math-camera-fog-correction* math-cam)
(let ((v0-1 (matrix-identity! (-> math-cam camera-rot))))
)
(matrix-identity! (-> math-cam camera-rot))
(let ((fog-constant-1 100.0)
(fog-constant-2 16760631.0)
)
@@ -47,9 +47,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -104,9 +104,5 @@
)
;; failed to figure out what this is:
(let ((v0-5 0))
(let ((v0-9 0))
)
@@ -617,7 +617,7 @@
)
(set! (-> obj pat) (the-as uint 16))
(set! (-> obj prim-core prim-type) -1)
(the-as collide-shape-prim-sphere (the-as collide-shape-prim obj))
(the-as collide-shape-prim-sphere obj)
)
)
@@ -650,7 +650,7 @@
(set! (-> obj mesh-id) (the-as int mesh-id))
(set! (-> obj mesh-cache-id) (the-as uint 0))
(set! (-> obj prim-core prim-type) 1)
(the-as collide-shape-prim-mesh (the-as collide-shape-prim obj))
(the-as collide-shape-prim-mesh obj)
)
)
@@ -687,7 +687,7 @@
(set! (-> obj prim elt-count) (the-as uint #f))
(nop!)
)
(the-as collide-shape-prim-group (the-as collide-shape-prim obj))
(the-as collide-shape-prim-group obj)
)
)
@@ -853,7 +853,3 @@
:mesh #f
)
)
@@ -504,5 +504,5 @@
)
;; failed to figure out what this is:
(let ((v0-21 0))
(let ((v0-37 0))
)
@@ -63,7 +63,5 @@
(define *res-key-string* (new 'global 'string 64 (the-as string #f)))
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-4 0))
)
@@ -66,9 +66,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-6 0))
)
@@ -734,16 +734,16 @@
(set! qwc (the-as int (-> current-tag qwc)))
(when mode-2
(let
((v0-9
((v0-10
(disasm-vif-tag (&-> data-2 vif0) 2 stream-2 (= mode-2 'details))
)
)
(disasm-vif-tag
(the-as
(pointer vif-tag)
(+ (the-as uint addr) (the-as uint v0-9))
(+ (the-as uint addr) (the-as uint v0-10))
)
(the-as int (- (* qwc 4) (the-as uint (/ v0-9 4))))
(the-as int (- (* qwc 4) (the-as uint (/ v0-10 4))))
stream-2
(= mode-2 'details)
)
@@ -878,7 +878,7 @@
(set! addr (&-> (the-as (pointer uint64) data-2) 2))
(set! qwc (the-as int (-> current-tag qwc)))
(set! end-condition #t)
(let ((v0-16 (if mode-2
(let ((v0-17 (if mode-2
(disasm-vif-tag
(the-as
(pointer vif-tag)
@@ -50,7 +50,7 @@
(.sync.l)
(set! (-> arg0 chcr) (new 'static 'dma-chcr :str #x1))
(.sync.l)
(let ((v0-1 0))
(let ((v0-2 0))
)
(none)
)
@@ -82,7 +82,7 @@
(new 'static 'dma-chcr :dir #x1 :mod #x1 :tte #x1 :str #x1)
)
(.sync.l)
(let ((v0-1 0))
(let ((v0-2 0))
)
(none)
)
@@ -111,7 +111,7 @@
(.sync.l)
(set! (-> arg0 chcr) (new 'static 'dma-chcr :dir #x1 :mod #x1 :str #x1))
(.sync.l)
(let ((v0-1 0))
(let ((v0-2 0))
)
(none)
)
@@ -167,7 +167,7 @@
(dma-sync (the-as pointer s5-0) 0 0)
)
)
(let ((v0-2 0))
(let ((v0-3 0))
)
(none)
)
@@ -218,7 +218,7 @@
(dma-sync (the-as pointer s5-0) 0 0)
)
)
(let ((v0-2 0))
(let ((v0-3 0))
)
(none)
)
@@ -351,7 +351,7 @@
(reset-path)
(reset-graph 1 1 *video-reset-parm* 1)
(format 0 "gkernel: vif1 path reset!~%")
(let ((v0-3 0))
(let ((v0-5 0))
)
(none)
)
@@ -397,7 +397,7 @@
)
)
)
(let ((v0-4 0))
(let ((v0-5 0))
)
(none)
)
@@ -46,9 +46,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-5 0))
)
@@ -111,5 +111,5 @@
)
;; failed to figure out what this is:
(let ((v0-5 0))
(let ((v0-10 0))
)
@@ -49,5 +49,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -20,7 +20,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -114,11 +114,10 @@
;; definition for function num-func-blend-in!
(defun num-func-blend-in! ((arg0 joint-control-channel) (arg1 float))
(let*
((v0-0
(let
((f30-0
(seek (-> arg0 frame-interp) 1.0 (* arg1 (-> *display* time-adjust-ratio)))
)
(f30-0 (the-as float v0-0))
)
(set! (-> arg0 frame-interp) f30-0)
(set! (-> arg0 frame-interp) f30-0)
@@ -158,7 +157,3 @@
;; failed to figure out what this is:
(let ((v0-0 0))
)
@@ -164,10 +164,16 @@
((allocation symbol) (type-to-make type) (name basic) (length int))
(let
((obj
(object-new
allocation
type-to-make
(the-as int (+ (-> type-to-make size) (the-as uint (* (+ length -1) 32))))
(the-as
object
(object-new
allocation
type-to-make
(the-as
int
(+ (-> type-to-make size) (the-as uint (* (+ length -1) 32)))
)
)
)
)
)
@@ -310,5 +310,5 @@
)
;; failed to figure out what this is:
(let ((v0-12 0))
(let ((v0-20 0))
)
@@ -81,9 +81,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-4 0))
)
@@ -189,5 +189,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-8 0))
)
@@ -348,9 +348,5 @@
)
;; failed to figure out what this is:
(let ((v0-9 0))
(let ((v0-18 0))
)
@@ -326,5 +326,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -116,9 +116,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-6 0))
)
@@ -218,9 +218,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-7 0))
)
@@ -74,6 +74,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-6 0))
)
@@ -190,9 +190,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-8 0))
)
@@ -65,6 +65,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-6 0))
)
@@ -54,7 +54,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -80,9 +80,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -24,9 +24,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -64,9 +64,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -107,5 +107,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-8 0))
)
@@ -774,5 +774,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-20 0))
)
@@ -80,9 +80,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-6 0))
)
@@ -185,9 +185,5 @@
(define *generic-debug* (new 'global 'generic-debug))
;; failed to figure out what this is:
(let ((v0-9 0))
(let ((v0-17 0))
)
@@ -345,9 +345,5 @@
(define *post-draw-hook* nothing)
;; failed to figure out what this is:
(let ((v0-5 0))
(let ((v0-12 0))
)
@@ -571,11 +571,7 @@
)
(set! (-> a2-4 base) (&+ gif-buf 32))
)
(let
((total-qwc
(/ (&+ (- -16 (the-as int (the-as pointer end-dma))) (-> buf base)) 16)
)
)
(let ((total-qwc (/ (&+ (- -16 (the-as int end-dma)) (-> buf base)) 16)))
(cond
((nonzero? total-qwc)
(set!
@@ -73,5 +73,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -110,6 +110,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-8 0))
)
@@ -206,5 +206,5 @@
)
;; failed to figure out what this is:
(let ((v0-9 0))
(let ((v0-19 0))
)
@@ -281,9 +281,5 @@
)
;; failed to figure out what this is:
(let ((v0-9 0))
(let ((v0-18 0))
)
@@ -718,5 +718,5 @@
)
;; failed to figure out what this is:
(let ((v0-23 0))
(let ((v0-47 0))
)
@@ -258,9 +258,5 @@
)
;; failed to figure out what this is:
(let ((v0-7 0))
(let ((v0-15 0))
)
@@ -818,6 +818,5 @@
)
;; failed to figure out what this is:
(let ((v0-32 0))
(let ((v0-64 0))
)
@@ -126,7 +126,7 @@
)
)
(set! (-> *ripple-globals* count) 0)
(let ((v0-3 0))
(let ((v0-4 0))
)
)
(none)
@@ -60,9 +60,5 @@
(define *fake-shadow-buffer* *fake-shadow-buffer-1*)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-6 0))
)
@@ -465,9 +465,5 @@
)
;; failed to figure out what this is:
(let ((v0-14 0))
(let ((v0-23 0))
)
@@ -309,5 +309,5 @@
(define *cloud-drawn* #f)
;; failed to figure out what this is:
(let ((v0-15 0))
(let ((v0-27 0))
)
@@ -152,9 +152,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-7 0))
)
@@ -215,9 +215,5 @@
(set! (-> sparticle-launch-control heap-base) (the-as uint 32))
;; failed to figure out what this is:
(let ((v0-6 0))
(let ((v0-12 0))
)
@@ -158,9 +158,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-8 0))
)
@@ -403,5 +403,5 @@
(define *ocean-base-page* 0)
;; failed to figure out what this is:
(let ((v0-14 0))
(let ((v0-25 0))
)
@@ -397,9 +397,5 @@
(define *collide-stats* (new 'global 'collide-stats))
;; failed to figure out what this is:
(let ((v0-17 0))
(let ((v0-33 0))
)
@@ -476,9 +476,5 @@
)
;; failed to figure out what this is:
(let ((v0-19 0))
(let ((v0-30 0))
)
@@ -464,9 +464,5 @@
)
;; failed to figure out what this is:
(let ((v0-15 0))
(let ((v0-30 0))
)
@@ -264,9 +264,5 @@
)
;; failed to figure out what this is:
(let ((v0-8 0))
(let ((v0-16 0))
)
@@ -423,9 +423,5 @@
(define *instance-tie-work-copy* (the-as basic #f))
;; failed to figure out what this is:
(let ((v0-10 0))
(let ((v0-18 0))
)
@@ -218,9 +218,5 @@
(define *time-of-day-context* (new 'static 'time-of-day-context))
;; failed to figure out what this is:
(let ((v0-7 0))
(let ((v0-13 0))
)
@@ -139,13 +139,12 @@
)
(else
(format #t "_#x~X________________~%" arg1)
(let ((v0-1 (the-as object (inspect arg1)))
(s4-0 *print-column*)
)
(inspect arg1)
(let ((s4-0 *print-column*))
(set! *print-column* (+ *print-column* (the-as uint 64)))
(if (> (-> arg1 front) 0)
(inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 front)))
(set! v0-1 (format #t "_#x~X________________~%" arg1))
(format #t "_#x~X________________~%" arg1)
)
(if (> (-> arg1 back) 0)
(inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 back)))
@@ -239,9 +238,5 @@
)
;; failed to figure out what this is:
(let ((v0-6 0))
(let ((v0-12 0))
)
@@ -178,9 +178,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-7 0))
)
@@ -288,7 +288,7 @@
)
)
)
(the-as pointer (the-as uint load-location))
(the-as pointer load-location)
)
)
@@ -417,7 +417,3 @@
)
(none)
)
@@ -272,9 +272,5 @@
)
;; failed to figure out what this is:
(let ((v0-5 0))
(let ((v0-12 0))
)
@@ -101,9 +101,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-7 0))
)
@@ -39,5 +39,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -222,5 +222,5 @@
;; ERROR: function was not converted to expressions. Cannot decompile.
;; failed to figure out what this is:
(let ((v0-6 0))
(let ((v0-7 0))
)
@@ -35,6 +35,5 @@
(define *unity-quaternion* (new 'static 'quaternion :w 1.0))
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -45,6 +45,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -147,9 +147,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-8 0))
)
@@ -64,9 +64,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -33,9 +33,5 @@
)
;; failed to figure out what this is:
(let ((v0-1 0))
(let ((v0-2 0))
)
@@ -72,7 +72,7 @@
(let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(TODO-RENAME-11 obj arg0 arg1 f0-1 arg3)
)
(let ((v0-1 0))
(let ((v0-2 0))
)
(none)
)
@@ -150,15 +150,11 @@
(draw-string-xy *temp-string* dma-buf 32 (+ (* 12 slot-idx) 8) 3 1)
)
)
(let ((v0-12 0))
(let ((v0-13 0))
)
(none)
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-5 0))
)
@@ -358,11 +358,11 @@
(defun buzz-stop! ((idx int))
(cpad-set-buzz! (-> *cpad-list* cpads idx) 0 0 0)
(cpad-set-buzz! (-> *cpad-list* cpads idx) 1 0 0)
(let ((v0-0 0))
(let ((v0-2 0))
)
(none)
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-9 0))
)
@@ -241,9 +241,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-12 0))
)
@@ -165,5 +165,5 @@
)
;; failed to figure out what this is:
(let ((v0-7 0))
(let ((v0-14 0))
)
@@ -119,7 +119,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-6 0))
)
@@ -785,11 +785,5 @@
(define *sound-bank-2* #f)
;; failed to figure out what this is:
(let ((v0-34 0))
(let ((v0-65 0))
)
@@ -67,7 +67,7 @@
;; INFO: Return type mismatch int vs none.
(defun-debug joint-mod-debug-draw ((mod joint-mod))
(add-debug-matrix #t (bucket-id debug-draw) (-> mod joint bone transform))
(let ((v0-0 0))
(let ((v0-1 0))
)
(none)
)
@@ -379,13 +379,7 @@
;; WARN: Unsupported inline assembly instruction kind - [madd.s f1, f3, f6]
;; Used lq/sq
(defun joint-mod-look-at-handler ((csp cspace) (xform transformq))
(local-vars
(v0-20 quaternion)
(f1-12 float)
(sv-48 vector)
(sv-52 vector)
(sv-56 vector)
)
(local-vars (f1-12 float) (sv-48 vector) (sv-52 vector) (sv-56 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
@@ -520,33 +514,24 @@
(let ((v1-27 (-> gp-0 ear)))
(cond
((zero? v1-27)
(set!
v0-20
(quaternion-rotate-x!
(the-as quaternion (-> xform rot))
(the-as quaternion (-> xform rot))
(-> gp-0 twist x)
)
(quaternion-rotate-x!
(the-as quaternion (-> xform rot))
(the-as quaternion (-> xform rot))
(-> gp-0 twist x)
)
)
((= v1-27 1)
(set!
v0-20
(quaternion-rotate-local-y!
(the-as quaternion (-> xform rot))
(the-as quaternion (-> xform rot))
(-> gp-0 twist x)
)
(quaternion-rotate-local-y!
(the-as quaternion (-> xform rot))
(the-as quaternion (-> xform rot))
(-> gp-0 twist x)
)
)
(else
(set!
v0-20
(quaternion-rotate-z!
(the-as quaternion (-> xform rot))
(the-as quaternion (-> xform rot))
(-> gp-0 twist x)
)
(quaternion-rotate-z!
(the-as quaternion (-> xform rot))
(the-as quaternion (-> xform rot))
(-> gp-0 twist x)
)
)
)
@@ -563,7 +548,7 @@
)
)
)
(let ((v0-21 0))
(let ((v0-26 0))
)
(none)
)
@@ -683,39 +668,33 @@
(if (< f1-14 0.1)
(set! f0-20 0.0)
)
(let
((v0-17
(the-as
object
(deg-seek
(-> gp-0 twist x)
f0-20
(fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))
)
)
)
(set!
(-> gp-0 twist x)
(deg-seek
(-> gp-0 twist x)
f0-20
(fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))
)
(set! (-> gp-0 twist x) (the-as float v0-17))
(when (!= (-> gp-0 twist x) 0.0)
(let* ((v1-20 (-> gp-0 ear))
(a1-17 ((cond
((zero? v1-20)
matrix-rotate-x!
)
((= v1-20 1)
matrix-rotate-y!
)
(else
matrix-rotate-z!
)
)
(new 'stack-no-clear 'matrix) (-> gp-0 twist x)
)
)
(when (!= (-> gp-0 twist x) 0.0)
(let* ((v1-20 (-> gp-0 ear))
(a1-17 ((cond
((zero? v1-20)
matrix-rotate-x!
)
)
)
(set! v0-17 (matrix*! s5-0 a1-17 s5-0))
)
)
((= v1-20 1)
matrix-rotate-y!
)
(else
matrix-rotate-z!
)
)
(new 'stack-no-clear 'matrix) (-> gp-0 twist x)
)
)
)
(matrix*! s5-0 a1-17 s5-0)
)
)
)
@@ -730,7 +709,7 @@
)
)
)
(let ((v0-19 0))
(let ((v0-22 0))
)
(none)
)
@@ -807,7 +786,7 @@
)
)
(cspace<-parented-transformq-joint! arg0 arg1)
(let ((v0-9 0))
(let ((v0-10 0))
)
(none)
)
@@ -822,7 +801,7 @@
(set! (-> arg1 scale quad) (-> s4-0 scale quad))
)
(cspace<-parented-transformq-joint! arg0 arg1)
(let ((v0-1 0))
(let ((v0-2 0))
)
(none)
)
@@ -866,7 +845,7 @@
)
)
)
(let ((v0-3 0))
(let ((v0-4 0))
)
(none)
)
@@ -223,9 +223,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -1400,9 +1400,5 @@
(define *swim-surface* *stone-surface*)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-6 0))
)
@@ -101,5 +101,5 @@
(define-perm *sidekick* sidekick #f)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -183,9 +183,5 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
(let ((v0-8 0))
)
@@ -65,5 +65,5 @@
(define *common-text* (the-as game-text-info #f))
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-5 0))
)
@@ -231,9 +231,5 @@
)
;; failed to figure out what this is:
(let ((v0-8 0))
(let ((v0-16 0))
)
@@ -42,6 +42,5 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
(let ((v0-4 0))
)
@@ -1229,5 +1229,5 @@
)
;; failed to figure out what this is:
(let ((v0-3 0))
(let ((v0-19 0))
)
@@ -373,5 +373,5 @@
)
;; failed to figure out what this is:
(let ((v0-11 0))
(let ((v0-23 0))
)
+90 -103
View File
@@ -188,7 +188,7 @@
(set! (-> obj suspend-hook) (method-of-object obj thread-suspend))
(set! (-> obj resume-hook) (method-of-object obj thread-resume))
(set! (-> obj stack-size) arg2)
(the-as cpu-thread (the-as pointer obj))
(the-as cpu-thread obj)
)
)
@@ -590,7 +590,7 @@
"WARNING: ~A ~A had to be allocated from the debug pool, because ~A was empty.~%"
)
(a2-1 arg0)
(v1-6 (the-as process s4-0))
(v1-6 (the-as object s4-0))
)
(t9-1 a0-2 a1-2 a2-1 (if (the-as process v1-6)
(-> (the-as (pointer process) v1-6) 0 self)
@@ -1139,20 +1139,28 @@
(define *global-search-count* 0)
;; definition for function process-by-name
;; INFO: Return type mismatch process-tree vs process.
(defun process-by-name ((arg0 object) (arg1 process-tree))
(set! *global-search-name* (the-as basic arg0))
(search-process-tree
arg1
(lambda ((a0-0 process)) (name= (-> a0-0 name) *global-search-name*))
(the-as
process
(search-process-tree
arg1
(lambda ((a0-0 process)) (name= (-> a0-0 name) *global-search-name*))
)
)
)
;; definition for function process-not-name
;; INFO: Return type mismatch process-tree vs process.
(defun process-not-name ((arg0 object) (arg1 process-tree))
(set! *global-search-name* (the-as basic arg0))
(search-process-tree
arg1
(lambda ((a0-0 process)) (not (name= (-> a0-0 name) *global-search-name*)))
(the-as
process
(search-process-tree
arg1
(lambda ((a0-0 process)) (not (name= (-> a0-0 name) *global-search-name*)))
)
)
)
@@ -1175,9 +1183,7 @@
(defun kill-by-name ((arg0 object) (arg1 process-tree))
(local-vars (a0-1 process))
(while (begin
(let ((v0-0 (process-by-name arg0 arg1)))
(set! a0-1 (the-as process v0-0))
)
(set! a0-1 (process-by-name arg0 arg1))
a0-1
)
(deactivate a0-1)
@@ -1187,18 +1193,15 @@
;; definition for function kill-by-type
(defun kill-by-type ((arg0 object) (arg1 process-tree))
(local-vars (a0-1 process))
(local-vars (a0-1 process-tree))
(set! *global-search-name* (the-as basic arg0))
(while (begin
(let
((v0-0
(search-process-tree
arg1
(lambda ((a0-0 process)) (= (-> a0-0 type) *global-search-name*))
)
)
(set!
a0-1
(search-process-tree
arg1
(lambda ((a0-0 process)) (= (-> a0-0 type) *global-search-name*))
)
(set! a0-1 (the-as process v0-0))
)
a0-1
)
@@ -1211,9 +1214,7 @@
(defun kill-not-name ((arg0 object) (arg1 process-tree))
(local-vars (a0-1 process))
(while (begin
(let ((v0-0 (process-not-name arg0 arg1)))
(set! a0-1 (the-as process v0-0))
)
(set! a0-1 (process-not-name arg0 arg1))
a0-1
)
(deactivate a0-1)
@@ -1223,18 +1224,15 @@
;; definition for function kill-not-type
(defun kill-not-type ((arg0 object) (arg1 process-tree))
(local-vars (a0-1 process))
(local-vars (a0-1 process-tree))
(set! *global-search-name* (the-as basic arg0))
(while (begin
(let
((v0-0
(search-process-tree
arg1
(lambda ((a0-0 process)) (!= (-> a0-0 type) *global-search-name*))
)
)
(set!
a0-1
(search-process-tree
arg1
(lambda ((a0-0 process)) (!= (-> a0-0 type) *global-search-name*))
)
(set! a0-1 (the-as process v0-0))
)
a0-1
)
@@ -1315,7 +1313,6 @@
)
;; definition for function search-process-tree
;; INFO: Return type mismatch process-tree vs process.
(defun
search-process-tree
((arg0 process-tree) (arg1 (function process-tree object)))
@@ -1336,7 +1333,7 @@
)
)
)
(the-as process (the-as process-tree #f))
(the-as process-tree #f)
)
;; definition for function kernel-dispatcher
@@ -1388,12 +1385,7 @@
)
)
)
(let
((v0-1
(reset-and-call s4-0 (-> a0-0 trans-hook))
)
)
)
(reset-and-call s4-0 (-> a0-0 trans-hook))
(delete s4-0)
)
(if (= (-> a0-0 status) 'dead)
@@ -1524,13 +1516,13 @@
protect-frame
((allocation symbol) (type-to-make type) (arg0 (function object)))
(local-vars (pp process))
(let ((v0-0 (the-as protect-frame (+ (the-as int allocation) 4))))
(let ((v0-0 (the-as object (+ (the-as int allocation) 4))))
(set! (-> (the-as protect-frame v0-0) type) type-to-make)
(set! (-> (the-as protect-frame v0-0) name) 'protect-frame)
(set! (-> (the-as protect-frame v0-0) exit) arg0)
(set! (-> (the-as protect-frame v0-0) next) (-> pp stack-frame-top))
(set! (-> pp stack-frame-top) (the-as protect-frame v0-0))
(the-as protect-frame (the-as int v0-0))
(the-as protect-frame v0-0)
)
)
@@ -1822,70 +1814,65 @@
;; WARN: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
;; WARN: Unsupported inline assembly instruction kind - [jr ra]
(defmethod deactivate process ((obj process))
(let ((v0-0 (when (!= (-> obj status) 'dead)
(set! (-> obj next-state) dead-state)
(if (-> obj entity)
(entity-deactivate-handler obj (-> obj entity))
)
(let ((s5-0 pp))
(let ((s4-0 (-> obj stack-frame-top)))
(while (the-as protect-frame s4-0)
(let ((v1-5 (-> s4-0 type)))
(if (or (= v1-5 protect-frame) (= v1-5 state))
((-> (the-as protect-frame s4-0) exit))
)
)
(set!
(the-as protect-frame s4-0)
(-> (the-as protect-frame s4-0) next)
)
)
)
(let ((s6-2 s5-0))
)
)
(let ((v0-2 (process-disconnect obj)))
)
(let ((v1-11 (-> obj child)))
(while v1-11
(let ((s5-1 (-> v1-11 0 brother)))
(deactivate (-> v1-11 0))
(set! v1-11 s5-1)
)
)
)
(return-process (-> obj pool) obj)
(set! (-> obj state) #f)
(set! (-> obj next-state) #f)
(set! (-> obj entity) #f)
(set! (-> obj pid) 0)
(cond
((= (-> *kernel-context* current-process) obj)
(set! (-> obj status) 'dead)
(.lw ra-0 return-from-thread s7-0)
(.jr ra-0)
(nop!)
(let ((v1-21 0))
)
)
((= (-> obj status) 'initialize)
(set! (-> obj status) 'dead)
(throw 'initialize #f)
)
)
(set! (-> obj status) 'dead)
0
)
)
(local-vars (pp process) (s7-0 none) (ra-0 int))
(when (!= (-> obj status) 'dead)
(set! (-> obj next-state) dead-state)
(if (-> obj entity)
(entity-deactivate-handler obj (-> obj entity))
)
(let ((s5-0 pp))
(let ((s4-0 (-> obj stack-frame-top)))
(while (the-as protect-frame s4-0)
(let ((v1-5 (-> s4-0 type)))
(if (or (= v1-5 protect-frame) (= v1-5 state))
((-> (the-as protect-frame s4-0) exit))
)
)
(set! (the-as protect-frame s4-0) (-> (the-as protect-frame s4-0) next))
)
)
(let ((s6-2 s5-0))
)
)
(process-disconnect obj)
(let ((v1-11 (-> obj child)))
(while v1-11
(let ((s5-1 (-> v1-11 0 brother)))
(deactivate (-> v1-11 0))
(set! v1-11 s5-1)
)
)
)
(return-process (-> obj pool) obj)
(set! (-> obj state) #f)
(set! (-> obj next-state) #f)
(set! (-> obj entity) #f)
(set! (-> obj pid) 0)
(cond
((= (-> *kernel-context* current-process) obj)
(set! (-> obj status) 'dead)
(.lw ra-0 return-from-thread s7-0)
(.jr ra-0)
(nop!)
(let ((v1-21 0))
)
)
((= (-> obj status) 'initialize)
(set! (-> obj status) 'dead)
(throw 'initialize #f)
)
)
(set! (-> obj status) 'dead)
(let ((v0-7 0))
)
)
(none)
)
;; failed to figure out what this is:
(let ((v0-1 (new 'global 'process 'listener 2048)))
(set! *listener-process* v0-1)
(let ((gp-0 v0-1))
(let ((v0-40 (new 'global 'process 'listener 2048)))
(set! *listener-process* v0-40)
(let ((gp-0 v0-40))
(set! (-> gp-0 status) 'ready)
(set! (-> gp-0 pid) 1)
(set!
@@ -1952,10 +1939,10 @@
;; failed to figure out what this is:
(let ((gp-1 change-parent)
(v0-13 (new 'global 'process-tree 'display-pool))
(v0-52 (new 'global 'process-tree 'display-pool))
)
(set! *display-pool* v0-13)
(gp-1 v0-13 *active-pool*)
(set! *display-pool* v0-52)
(gp-1 v0-52 *active-pool*)
)
;; failed to figure out what this is:
@@ -147,6 +147,7 @@
;; definition for function send-event-function
(defun send-event-function ((arg0 process) (arg1 event-message-block))
(local-vars (pp process))
(when (and arg0 (!= (-> arg0 type) process-tree) (-> arg0 event-hook))
(let ((gp-0 pp))
(let ((s6-1 arg0))
@@ -939,7 +939,7 @@ TEST_F(FormRegressionTest, DmaBufferAddVuFunction) {
" (while (> a3-0 0)\n"
" (let ((t0-1 (min 127 a3-0)))\n"
" (let* ((t1-1 arg0)\n"
" (t2-0 (the-as dma-packet (-> t1-1 base)))\n"
" (t2-0 (the-as object (-> t1-1 base)))\n"
" )\n"
" (set!\n"
" (-> (the-as dma-packet t2-0) dma)\n"

Some files were not shown because too many files have changed in this diff Show More