From 5a8b4e81f911d42fe6bfc9956e00c64ed3b72756 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Sat, 16 Mar 2024 01:28:26 +0100 Subject: [PATCH] decomp3: more engine stuff, support boxed stack arrays in compiler (#3424) - `sync-info` - `trajectory` - `camera` - `cam-update` - `cam-states` - `cam-states-dbg` - `cam-master` - `cam-layout` - `cam-interface` - `cam-combiner` Closes #2016 --- decompiler/IR2/FormExpressionAnalysis.cpp | 8 +- decompiler/config/jak3/all-types.gc | 633 ++- .../ntsc_v1/anonymous_function_types.jsonc | 3 +- decompiler/config/jak3/ntsc_v1/hacks.jsonc | 2 - .../config/jak3/ntsc_v1/label_types.jsonc | 31 +- .../jak3/ntsc_v1/stack_structures.jsonc | 65 +- .../config/jak3/ntsc_v1/type_casts.jsonc | 228 +- .../config/jak3/ntsc_v1/var_names.jsonc | 219 +- goal_src/jak3/engine/camera/cam-combiner.gc | 438 ++ goal_src/jak3/engine/camera/cam-interface.gc | 101 + goal_src/jak3/engine/camera/cam-layout.gc | 3482 +++++++++++++++ goal_src/jak3/engine/camera/cam-master.gc | 1072 +++++ goal_src/jak3/engine/camera/cam-states-dbg.gc | 413 ++ goal_src/jak3/engine/camera/cam-states.gc | 3780 ++++++++++++++++ goal_src/jak3/engine/camera/cam-update-h.gc | 4 +- goal_src/jak3/engine/camera/cam-update.gc | 692 +++ goal_src/jak3/engine/camera/camera-h.gc | 80 +- goal_src/jak3/engine/camera/camera.gc | 1978 ++++++++ .../jak3/engine/collide/find-nearest-h.gc | 2 + .../jak3/engine/common-obs/collectables.gc | 35 +- .../jak3/engine/common-obs/generic-obs.gc | 6 +- .../engine/gfx/background/tie/tie-work.gc | 2 + goal_src/jak3/engine/gfx/shrub/shrub-work.gc | 2 + goal_src/jak3/engine/gfx/shrub/shrubbery-h.gc | 2 + goal_src/jak3/engine/level/bsp-h.gc | 2 + goal_src/jak3/engine/level/level-h.gc | 4 +- goal_src/jak3/engine/nav/nav-control-h.gc | 2 +- goal_src/jak3/engine/physics/trajectory-h.gc | 33 +- goal_src/jak3/engine/physics/trajectory.gc | 508 +++ goal_src/jak3/engine/target/logic-target.gc | 164 +- goal_src/jak3/engine/util/sync-info-h.gc | 42 +- goal_src/jak3/engine/util/sync-info.gc | 576 +++ goalc/compiler/compilation/Type.cpp | 50 +- .../jak1/engine/gfx/mood/time-of-day_REF.gc | 2 +- .../jak2/engine/load/load-state_REF.gc | 2 +- .../jak2/engine/target/target-part_REF.gc | 2 +- .../levels/city/traffic/traffic-engine_REF.gc | 4 +- .../jak3/engine/camera/cam-combiner_REF.gc | 451 ++ .../jak3/engine/camera/cam-interface_REF.gc | 124 + .../jak3/engine/camera/cam-layout_REF.gc | 3727 ++++++++++++++++ .../jak3/engine/camera/cam-master_REF.gc | 1097 +++++ .../jak3/engine/camera/cam-states-dbg_REF.gc | 468 ++ .../jak3/engine/camera/cam-states_REF.gc | 3970 +++++++++++++++++ .../jak3/engine/camera/cam-update-h_REF.gc | 12 +- .../jak3/engine/camera/cam-update_REF.gc | 720 +++ .../jak3/engine/camera/camera-h_REF.gc | 42 +- .../jak3/engine/camera/camera_REF.gc | 2073 +++++++++ .../engine/common-obs/collectables_REF.gc | 35 +- .../jak3/engine/common-obs/generic-obs_REF.gc | 6 +- .../reference/jak3/engine/level/bsp-h_REF.gc | 2 + .../jak3/engine/level/level-h_REF.gc | 4 +- .../jak3/engine/nav/nav-control-h_REF.gc | 6 +- .../jak3/engine/physics/trajectory-h_REF.gc | 35 +- .../jak3/engine/physics/trajectory_REF.gc | 554 +++ .../jak3/engine/target/logic-target_REF.gc | 164 +- .../jak3/engine/util/sync-info-h_REF.gc | 42 +- .../jak3/engine/util/sync-info_REF.gc | 620 +++ .../variables/stack-boxed-array.gc | 26 + test/goalc/test_variables.cpp | 4 + test/offline/config/jak3/config.jsonc | 13 +- 60 files changed, 28132 insertions(+), 732 deletions(-) create mode 100644 test/decompiler/reference/jak3/engine/camera/cam-combiner_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/camera/cam-interface_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/camera/cam-layout_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/camera/cam-master_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/camera/cam-states-dbg_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/camera/cam-states_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/camera/cam-update_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/camera/camera_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/util/sync-info_REF.gc create mode 100644 test/goalc/source_templates/variables/stack-boxed-array.gc diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index be4549fba1f..d8457c4fb3d 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -3863,8 +3863,12 @@ void FunctionCallElement::update_from_stack(const Env& env, if (got_stack_new) { std::vector