[sparticle] 2d hud particles (#849)

* wip, taking a break to work on asm stuff first

* the goal code for sparticle

* mips2c the first sparticle asm function

* temp

* particle processing no longer crashing

* temp

* working texture cache for vi1 and hud textures

* sprites

* cleanup 1

* temp

* temp

* add zstd library

* temp

* working

* tests

* include fix

* uncomment

* better decomp of sparticle stuff, part 1

* update references
This commit is contained in:
water111
2021-09-26 11:41:58 -04:00
committed by GitHub
parent d777337095
commit f0ceea8b2e
158 changed files with 19773 additions and 44989 deletions
+34 -1
View File
@@ -59,6 +59,18 @@ void CfgVtx::replace_succ_and_check(CfgVtx* old_succ, CfgVtx* new_succ) {
assert(replaced);
}
void CfgVtx::remove_pred(CfgVtx* to_remove) {
bool found = false;
for (auto it = pred.begin(); it != pred.end(); it++) {
if (*it == to_remove) {
pred.erase(it);
found = true;
break;
}
}
assert(found);
}
/*!
* Replace references to old_preds with a single new_pred.
* Doesn't insert duplicates.
@@ -477,7 +489,15 @@ bool ControlFlowGraph::is_while_loop(CfgVtx* b0, CfgVtx* b1, CfgVtx* b2) {
if (!b0 || !b1 || !b2)
return false;
bool debug = b0->to_string() == "Seq CONDNE104 ... Block 18100";
if (debug) {
fmt::print("try while: {} | {} | {}\n", b0->to_string(), b1->to_string(), b2->to_string());
}
if (b0->end_branch.asm_branch || b1->end_branch.asm_branch) {
if (debug)
fmt::print("reject 1 {} {}\n", b0->end_branch.asm_branch, b1->end_branch.asm_branch);
return false;
}
@@ -1101,10 +1121,19 @@ bool ControlFlowGraph::clean_up_asm_branches() {
return true;
}
if (!b0->end_branch.asm_branch) {
if (!b0->end_branch.asm_branch || !b0->end_branch.has_branch) {
return true;
}
if (b1->succ_branch == b1) {
// asm branch to yourself. just remove it.
b1->succ_branch = nullptr;
b1->end_branch.has_branch = false;
b1->remove_pred(b1);
replaced = true;
return false;
}
// don't want to combine two with an incoming edge in between.
if (b1->pred.size() > 1) {
return true;
@@ -2094,6 +2123,10 @@ bool ControlFlowGraph::find_cond_n_else() {
return true;
}
if (prev_condition->end_branch.asm_branch) {
return true;
}
// prev_body should fall through to end todo - this was wrong?
if (prev_body->succ_ft != end_block) {
printf("reject 7\n");