start blit-displays decomp & renderer + improve decompilation of some DMA macros (#2616)

Adds sprite distort, fixes buggy sprite rendering in progress, adds
scissoring support (used in various scrolling menus) and a very basic
implementation of `blit-displays`. This is enough to make the fade
effect in the progress menu work, along with all the menus working
properly without needing to use the REPL. This does not make screen
flipping and the filter when failing a mission work.

Added support in the decompiler for detecting `dma-buffer-add-gs-set`
and `dma-buffer-add-gs-set-flusha` and updated all of the Jak 2 code to
use it. Readability improved!

Fixes decompiler issue with `with-dma-buffer-add-bucket` not inlining
forms which broke syntax. Fixes store error warnings showing up for
non-existent stores, there is now a dedicated pass for this at the end.

I started work on making `BITBLTBUF` stuff work in the DirectRenderer,
but stopped for now because it wasn't strictly necessary. It will still
assert like before.
This commit is contained in:
ManDude
2023-05-04 23:34:09 +01:00
committed by GitHub
parent ae3b76e465
commit 6884b0f73e
106 changed files with 3706 additions and 9246 deletions
@@ -175,6 +175,8 @@ void ObjectFileDB::ir2_do_segment_analysis_phase2(int seg,
ir2_rewrite_inline_asm_instructions(seg, data);
ir2_insert_lets(seg, data);
ir2_add_store_errors(seg, data);
}
void ObjectFileDB::ir2_setup_labels(const Config& config, ObjectFileData& data) {
@@ -717,6 +719,22 @@ void ObjectFileDB::ir2_insert_lets(int seg, ObjectFileData& data) {
});
}
void ObjectFileDB::ir2_add_store_errors(int seg, ObjectFileData& data) {
for_each_function_in_seg_in_obj(seg, data, [&](Function& func) {
if (func.ir2.expressions_succeeded && !func.warnings.has_errors()) {
// print warning about failed store, but only if decompilation passes without any major
// errors
func.ir2.top_form->apply([&](FormElement* f) {
auto as_store = dynamic_cast<StoreElement*>(f);
if (as_store) {
func.warnings.error("Failed store: {} at op {}", as_store->to_string(func.ir2.env),
as_store->op()->op_id());
}
});
}
});
}
void ObjectFileDB::ir2_rewrite_inline_asm_instructions(int seg, ObjectFileData& data) {
for_each_function_in_seg_in_obj(seg, data, [&](Function& func) {
(void)data;