process-spawn + pretty printer improvements (#1428)

* some jp support to fix some errors in the original game

* music fade toggle

* recognize `process-new` macros!!

* strip casts in this macro

* rename macro

* fix cast typecheck

* update source 1

* detect kernel stack case

* less boilerplate

* `manipy-spawn` special case

* pretty printer improvements

* revert dumb thing from earlier

* use shell detection on `send-event`

* fix some events

* remove unused argument

* detect `static-attack-info` and add `CondNoElse` to shell detect

* better `attack-info` detect

* support `process-spawn` in multi-lets

* detect `rand-float-gen` pt 1

* detect as return value

* detect in `countdown` and  `dotimes`

* oops this wasnt working

* fancier `send-event`s

* clang

* update source!!

* fix tests

* fine jeez

* uh okay

* fix some accidental regressions

* fix more regressions

* regression fixes

* fix big bug...

* extra safety!
This commit is contained in:
ManDude
2022-06-10 02:18:08 +01:00
committed by GitHub
parent ffd8ade4e1
commit 7ce58f709f
559 changed files with 35205 additions and 66104 deletions
+9 -18
View File
@@ -1368,14 +1368,15 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label,
int array_allocated_length = size_word_2.data;
auto content_type_info = ts.lookup_type(content_type);
auto params_obj = array_length == array_allocated_length
? pretty_print::to_symbol(fmt::format("new 'static 'boxed-array :type {}",
content_type.print()))
: pretty_print::to_symbol(fmt::format(
"new 'static 'boxed-array :type {} :length {} :allocated-length {}",
content_type.print(), array_length, array_allocated_length));
if (content_type_info->is_reference() || content_type == TypeSpec("object")) {
// easy, stride of 4.
std::vector<goos::Object> result = {
pretty_print::to_symbol("new"), pretty_print::to_symbol("'static"),
pretty_print::to_symbol("'boxed-array"),
pretty_print::to_symbol(fmt::format(":type {} :length {} :allocated-length {}",
content_type.print(), array_length,
array_allocated_length))};
std::vector<goos::Object> result = {params_obj};
for (int elt = 0; elt < array_length; elt++) {
auto& word = words.at(label.target_segment).at(first_elt_word_idx + elt);
@@ -1406,12 +1407,7 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label,
return pretty_print::build_list(result);
} else if (content_type.base_type() == "inline-array") {
std::vector<goos::Object> result = {
pretty_print::to_symbol("new"), pretty_print::to_symbol("'static"),
pretty_print::to_symbol("'boxed-array"),
pretty_print::to_symbol(fmt::format(":type {} :length {} :allocated-length {}",
content_type.print(), array_length,
array_allocated_length))};
std::vector<goos::Object> result = {params_obj};
for (int elt = 0; elt < array_length; elt++) {
auto& word = words.at(label.target_segment).at(first_elt_word_idx + elt);
@@ -1424,12 +1420,7 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label,
return pretty_print::build_list(result);
} else {
// value array
std::vector<goos::Object> result = {
pretty_print::to_symbol("new"), pretty_print::to_symbol("'static"),
pretty_print::to_symbol("'boxed-array"),
pretty_print::to_symbol(fmt::format(":type {} :length {} :allocated-length {}",
content_type.print(), array_length,
array_allocated_length))};
std::vector<goos::Object> result = {params_obj};
auto stride = content_type_info->get_size_in_memory();
for (int i = 0; i < array_length; i++) {