Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decomp3: more engine stuff, support boxed stack arrays in compiler #3424

Merged
merged 7 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions decompiler/IR2/FormExpressionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3863,8 +3863,12 @@ void FunctionCallElement::update_from_stack(const Env& env,
if (got_stack_new) {
std::vector<Form*> stack_new_args;
stack_new_args.push_back(pool.form<ConstantTokenElement>("'stack"));
stack_new_args.push_back(pool.form<ConstantTokenElement>(
fmt::format("'{}", type_source_form->to_string(env))));
if (type_source_form->to_string(env) == "array") {
stack_new_args.push_back(pool.form<ConstantTokenElement>("'boxed-array"));
} else {
stack_new_args.push_back(pool.form<ConstantTokenElement>(
fmt::format("'{}", type_source_form->to_string(env))));
}
for (size_t i = 2; i < arg_forms.size(); i++) {
stack_new_args.push_back(arg_forms.at(i));
}
Expand Down
633 changes: 311 additions & 322 deletions decompiler/config/jak3/all-types.gc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@
"collectables": [
[77, "(function part-tracker vector)"],
[78, "(function part-tracker vector)"]
]
],
"trajectory": [[15, "(function trajectory none)"]]
}
2 changes: 0 additions & 2 deletions decompiler/config/jak3/ntsc_v1/hacks.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
// checking boxed type is different now - these make the cfg stuff sad
"name=",
"(method 77 grenadier)",
// until loop without nop:
"target-history-print",
"display-list-control",
"anim-test-anim-list-handler",
"anim-test-sequence-list-handler",
Expand Down
31 changes: 30 additions & 1 deletion decompiler/config/jak3/ntsc_v1/label_types.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,34 @@
["L287", "(inline-array vector)", 3],
["L283", "(inline-array vector)", 32],
["L265", "(inline-array vector)", 4]
]
],
"cam-states": [
["L821", "uint64", true],
["L818", "uint64", true],
["L820", "uint64", true],
["L819", "uint64", true]
],
"cam-states-dbg": [
["L59", "vector"],
["L60", "vector"]
],
"cam-layout": [
["L893", "uint64", true],
["L899", "uint64", true],
["L897", "uint64", true],
["L892", "uint64", true],
["L895", "uint64", true],
["L894", "uint64", true],
["L898", "uint64", true],
["L896", "uint64", true],
["L889", "uint64", true],
["L785", "vector"],
["L802", "vector4w"],
["L800", "vector4w"],
["L798", "vector4w"],
["L796", "vector4w"],
["L794", "vector4w"],
["L792", "vector4w"]
],
"level": [["L1003", "uint64", true]]
}
65 changes: 64 additions & 1 deletion decompiler/config/jak3/ntsc_v1/stack_structures.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,68 @@
[32, "vector"]
],
"add-debug-points": [[16, "vector"]],
"add-debug-cursor": [[16, "vector"]]
"add-debug-cursor": [[16, "vector"]],
"(method 11 impact-control)": [[16, "touching-shapes-entry"]],
"(method 9 cubic-curve)": [[16, "trajectory"]],
"(method 10 cubic-curve)": [[16, "trajectory"]],
"(method 11 cubic-curve)": [[16, "trajectory"]],
"(method 12 cubic-curve)": [[16, "trajectory"]],
"(method 13 cubic-curve)": [[16, "trajectory"]],
"slave-set-rotation!": [
[96, "vector"],
[112, "matrix"],
[176, "vector"]
],
"v-slrp2!": [
[32, "vector"],
[64, "matrix"]
],
"v-slrp3!": [[32, "vector"]],
"(method 15 tracking-spline)": [
[16, "tracking-spline-sampler"],
[32, "vector"]
],
"(method 16 tracking-spline)": [
[16, "tracking-spline-sampler"],
[32, "tracking-spline-sampler"]
],
"(method 18 tracking-spline)": [[16, "tracking-spline-sampler"]],
"(code cam-eye)": [[112, "vector"]],
"(enter cam-circular)": [[32, "vector"]],
"cam-string-joystick": [
[32, "vector"],
[48, "vector"]
],
"cam-string-line-of-sight": [[192, "vector"]],
"cam-los-collide": [
[592, "vector"],
[608, "vector"]
],
"los-cw-ccw": [
[48, ["inline-array", "vector", 4]],
[16, "vector"],
[32, "vector"],
[112, "vector"]
],
"master-track-target": [[16, "vector"]],
"(code cam-point-watch)": [[16, "vector"]],
"cam-helper-temp": [[16, ["inline-array", "vector", 3]]],
"update-view-planes": [
[208, "vector"],
[224, "vector"]
],
"clmf-pos-rot": [[112, "matrix"]],
"cam-layout-entity-info": [[208, "vector"]],
"cam-layout-entity-volume-info-create": [
[80, "vector"],
[128, "vector"],
[32, "vector"],
[48, "vector"],
[64, "vector"],
[96, "vector"],
[144, "vector"],
[112, "vector"]
],
"(method 23 tracking-spline)": [[32, "vector"]],
"(method 21 tracking-spline)": [[16, "tracking-spline-sampler"]]
}
228 changes: 227 additions & 1 deletion decompiler/config/jak3/ntsc_v1/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2156,5 +2156,231 @@
//[85, "a0", "dma-packet"],
["_stack_", 16, "dma-packet"],
[91, "v1", "dma-packet"]
]
],
"target-history-print": [["_stack_", 32, "collide-status"]],
"(method 13 sync-linear)": [
["_stack_", 16, "res-tag"],
[27, "v0", "(pointer float)"]
],
"(method 13 sync-eased)": [
["_stack_", 16, "res-tag"],
[31, "v0", "(pointer float)"]
],
"(method 13 sync-paused)": [
["_stack_", 16, "res-tag"],
[29, "v0", "(pointer float)"]
],
"(method 11 impact-control)": [
[58, "v1", "collide-shape-prim"],
[66, "v1", "collide-shape-prim"]
],
"cam-slave-get-vector-with-offset": [
[59, "v0", "vector"],
[24, "v0", "vector"],
[69, "s3", "vector"]
],
"cam-slave-get-interp-time": [[29, "f0", "float"]],
"cam-standard-event-handler": [
[13, "gp", "(state camera-slave)"],
[19, "gp", "(state camera-slave)"],
[22, "gp", "(state camera-slave)"]
],
"cam-calc-follow!": [
["_stack_", 144, "float"],
["_stack_", 160, "float"]
],
"(method 15 tracking-spline)": [
[28, "a0", "int"],
[38, "a0", "int"]
],
"(code cam-pov)": [
[15, "a1", "process-drawable"],
[24, "a0", "process-drawable"]
],
"(code cam-pov180)": [
[15, "a1", "process-drawable"],
[23, "v1", "process-drawable"],
[45, "v1", "process-drawable"],
[58, "v1", "process-drawable"],
[80, "a1", "process-drawable"]
],
"(code cam-pov-track)": [
[19, "a1", "process-drawable"],
[30, "a0", "process-drawable"]
],
"(event cam-string)": [
[11, "v1", "vector"],
[44, "s5", "vector"],
[51, "s5", "vector"],
[53, "s5", "vector"],
[62, "s5", "vector"],
[69, "s5", "vector"],
[71, "s5", "vector"],
[80, "gp", "vector"],
[87, "gp", "vector"],
[89, "gp", "vector"],
[98, "gp", "vector"],
[105, "gp", "vector"],
[107, "gp", "vector"],
[141, "a0", "vector"],
[145, "a0", "vector"],
[174, "v1", "vector"],
[184, "v1", "float"],
[28, "v1", "float"],
[31, "v1", "float"]
],
"set-string-params": [[30, "v0", "entity-camera"]],
"cam-string-joystick": [[842, "v1", "process-drawable"]],
"cam-dist-analog-input": [[32, "f0", "float"]],
"cam-los-collide": [
[92, "s1", "(inline-array collide-cache-tri)"],
[205, "s1", "(inline-array collide-cache-tri)"],
[135, "s1", "(inline-array collide-cache-tri)"],
[140, "s1", "(inline-array collide-cache-tri)"],
[175, "s1", "(inline-array collide-cache-tri)"],
[375, "v1", "(inline-array tracking-spline)"]
],
"cam-los-spline-collide": [
[70, "s3", "(inline-array collide-cache-tri)"],
[88, "s3", "(inline-array collide-cache-tri)"]
],
"cam-draw-collide-cache": [
[[8, 14], "gp", "(inline-array collide-cache-tri)"]
],
"(method 16 camera-master)": [
[14, "a2", "process-focusable"],
[16, "v1", "int"]
],
"reset-follow": [
[14, "a0", "process-focusable"],
[17, "a0", "process-focusable"]
],
"(event cam-master-active)": [
[80, "gp", "matrix"],
[170, "s5", "vector"],
[275, "v1", "process"],
[330, "a0", "camera-slave"],
[448, "v1", "camera-slave"],
[512, "v1", "camera-slave"],
[542, "v1", "camera-slave"],
[611, "a0", "vector"],
[799, "v1", "float"],
[784, "v1", "vector"],
[589, "v1", "float"],
[593, "v1", "float"],
[602, "v1", "float"],
[606, "v1", "float"],
[796, "v1", "float"]
],
"master-track-target": [
[53, "gp", "process-focusable"],
[100, "gp", "process-focusable"],
[121, "gp", "process-focusable"],
[132, "gp", "process-focusable"],
[203, "gp", "process-focusable"],
[273, "gp", "process-focusable"],
[280, "gp", "process-focusable"],
[286, "gp", "process-focusable"],
[366, "gp", "process-focusable"],
[480, "gp", "process-focusable"],
[486, "gp", "process-focusable"],
[490, "gp", "process-focusable"],
[528, "gp", "process-focusable"],
[531, "gp", "process-focusable"],
[409, "gp", "process-focusable"],
[415, "gp", "process-focusable"],
[171, "gp", "process-focusable"],
[195, "gp", "process-focusable"]
],
"reset-target-tracking": [
[14, "gp", "process-focusable"],
[40, "gp", "process-focusable"],
[51, "gp", "process-focusable"],
[65, "gp", "process-focusable"],
[86, "gp", "process-focusable"],
[131, "gp", "process-focusable"]
],
"cam-free-floating-input": [
[179, "v1", "cpad-list"],
[191, "v1", "cpad-list"],
[203, "v1", "cpad-list"],
[215, "v1", "cpad-list"],
[229, "a0", "cpad-list"],
[237, "v1", "cpad-list"]
],
"(event cam-combiner-active)": [
[103, "gp", "camera-slave"],
[105, "gp", "camera-slave"],
[189, "gp", "camera-slave"],
[191, "gp", "camera-slave"],
[206, "gp", "camera-slave"],
[210, "gp", "camera-slave"],
[214, "gp", "camera-slave"],
[230, "gp", "camera-slave"],
[234, "gp", "camera-slave"]
],
"execute-cam-post-hook-engine": [
[8, "s5", "connection"],
[[14, 17], "s5", "connection"],
[18, "t9", "(function object object object object object)"],
[9, "s5", "connection"]
],
"cam-layout-init": [[10, "v1", "connection"]],
"cam-layout-function-call": [
[15, "gp", "(function string int basic object)"]
],
"cam-layout-do-action": [[99, "s5", "(function int symbol object)"]],
"cam-layout-do-menu": [
[[280, 363], "s4", "clm-list"],
[374, "v1", "clm-item"],
[[136, 182], "s3", "clm-list"],
[209, "a0", "clm-item"],
[219, "v1", "clm-item"],
[234, "s3", "clm-item"],
[239, "v1", "clm-item"],
[244, "s3", "clm-item"]
],
"clmf-save-all": [[18, "v1", "connection"]],
"cam-layout-save-campointsoffset": [[12, "v0", "vector"]],
"cam-layout-save-splineoffset": [
[37, "v0", "vector"],
[25, "v0", "vector"]
],
"cam-layout-save-interesting": [
[13, "v0", "vector"],
[38, "v0", "vector"]
],
"cam-layout-save-align": [
[38, "v0", "vector"],
[13, "v0", "vector"]
],
"cam-layout-save-pivot": [
[13, "v0", "vector"],
[38, "v0", "vector"]
],
"cam-layout-save-cam-trans": [
[29, "v0", "vector"],
[40, "v0", "vector"],
[93, "s5", "symbol"],
[95, "s2", "symbol"],
[94, "s2", "symbol"]
],
"cam-layout-save-cam-rot": [[13, "v0", "vector"]],
"clmf-next-entity": [[38, "a0", "connection"]],
"cam-layout-entity-info": [[202, "v1", "vector"]],
"cam-layout-entity-volume-info-create": [
["_stack_", 16, "res-tag"],
["_stack_", 164, "float"],
[16, "v0", "(inline-array vector)"]
],
"cam-layout-print": [[[22, 25], "v1", "dma-packet"]],
"(method 19 level-group)": [
[237, "s2", "continue-point"],
[191, "s0", "continue-point"],
[196, "s2", "continue-point"],
[207, "s0", "continue-point"],
[213, "s0", "continue-point"],
[222, "s0", "continue-point"]
],
"master-choose-entity": [[162, "s0", "(pointer camera-slave)"]]
}
Loading