Skip to content

Commit d4c21c7

Browse files
authored
decomp3: geometry, vector, timer-h, ocean table files and game-task related enums (#3329)
1 parent 01d5fc2 commit d4c21c7

34 files changed

+61581
-414
lines changed

common/type_system/TypeSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2113,7 +2113,7 @@ std::optional<std::string> find_best_field_in_structure(const TypeSystem& ts,
21132113
}
21142114
for (size_t i = start_field; i < (size_t)end_field; ++i) {
21152115
const auto& field = st->fields().at(i);
2116-
auto type = ts.lookup_type(field.type());
2116+
auto type = ts.lookup_type_allow_partial_def(field.type());
21172117
if (field.is_dynamic() || field.offset() > offset || field.user_placed() != want_fixed) {
21182118
continue;
21192119
}

decompiler/analysis/insert_lets.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ FormElement* rewrite_as_send_event(LetElement* in,
347347
Matcher::any_reg(1));
348348
break;
349349
case GameVersion::Jak2:
350+
case GameVersion::Jak3:
350351
// in jak 2, the event message block holds a ppointer instead.
351352
set_from_matcher = Matcher::set(
352353
Matcher::deref(Matcher::reg(block_var_reg), false, {DerefTokenMatcher::string("from")}),

decompiler/config/jak3/all-types.gc

Lines changed: 2572 additions & 400 deletions
Large diffs are not rendered by default.

decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"gkernel": [
2+
"gkernel": [
33
[17, "(function process symbol)"],
44
[24, "(function process symbol)"],
55
[26, "(function process symbol)"],

decompiler/config/jak3/ntsc_v1/label_types.jsonc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,37 @@
22
"math": [
33
["L108", "(pointer float)", 32],
44
["L109", "(pointer float)", 32]
5+
],
6+
"ocean-trans-tables": [
7+
["L1", "(inline-array vector)", 4],
8+
["L2", "(pointer float)", 160],
9+
["L3", "(pointer float)", 100],
10+
["L4", "(pointer float)", 72],
11+
["L5", "(pointer float)", 72],
12+
["L6", "(pointer float)", 72],
13+
["L7", "(pointer float)", 72],
14+
["L8", "(pointer float)", 44],
15+
["L9", "(pointer float)", 44],
16+
["L10", "(pointer float)", 44],
17+
["L11", "(pointer float)", 44],
18+
["L12", "(pointer float)", 40],
19+
["L13", "(pointer float)", 40],
20+
["L14", "(pointer float)", 40],
21+
["L15", "(pointer float)", 40],
22+
["L16", "(pointer float)", 28],
23+
["L17", "(pointer float)", 28],
24+
["L18", "(pointer float)", 28],
25+
["L19", "(pointer float)", 28]
26+
],
27+
"ocean-frames": [["L1", "(pointer uint32)", 16384]],
28+
"task-control-h": [
29+
["L1042", "uint64", true],
30+
["L1047", "uint64", true],
31+
["L1048", "uint64", true],
32+
["L1045", "uint64", true],
33+
["L1049", "uint64", true],
34+
["L1043", "uint64", true],
35+
["L1046", "uint64", true],
36+
["L1044", "uint64", true]
537
]
638
}
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
{
22
"quaternion-smooth-seek!": [[16, "quaternion"]],
3-
"eul->matrix": [[16, "vector"]]
3+
"eul->matrix": [[16, "vector"]],
4+
"segment-segment-find-intersection-xz": [[16, "vector"]],
5+
"vector-line-xz-distance-point!": [[16, "matrix"]],
6+
"vector-segment-xz-distance-point!": [[16, "matrix"]],
7+
"nearest-dist2-between-moving-points": [[16, ["inline-array", "vector", 2]]],
8+
"vector-circle-tangent-new": [
9+
[32, "vector"],
10+
[48, "vector"]
11+
],
12+
"rotate-vector-to-vector": [[16, "quaternion"]]
413
}

decompiler/config/jak3/ntsc_v1/type_casts.jsonc

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
[13, "a0", "pointer"],
4848
[25, "v1", "pointer"]
4949
],
50-
"(method 14 dead-pool)": [
51-
[[24, 25], "v1", "(pointer process)"],
52-
[[30, 39], "s4", "(pointer process)"]
53-
],
5450
"method-state": [[12, "a2", "state"]],
5551
"(method 0 protect-frame)": [
5652
[0, "a0", "int"],
@@ -86,5 +82,44 @@
8682
[18, "f0", "float"],
8783
[18, "f1", "float"],
8884
[[23, 32], "f0", "float"]
85+
],
86+
"generate-rand-vector-on-sphere": [
87+
[12, "v1", "float"],
88+
[28, "v1", "float"]
89+
],
90+
"vector-segment-distance-point!": [[[21, 30], "f1", "float"]],
91+
"vector4-array-add!": [
92+
[11, "s5", "(inline-array vector4)"],
93+
[12, "s4", "(inline-array vector4)"],
94+
[13, "gp", "(inline-array vector4)"]
95+
],
96+
"vector4-array-sub!": [
97+
[11, "s5", "(inline-array vector4)"],
98+
[12, "s4", "(inline-array vector4)"],
99+
[13, "gp", "(inline-array vector4)"]
100+
],
101+
"vector4-array-mul!": [
102+
[11, "s5", "(inline-array vector4)"],
103+
[12, "s4", "(inline-array vector4)"],
104+
[13, "gp", "(inline-array vector4)"]
105+
],
106+
"vector4-array-scale!": [
107+
[11, "s5", "(inline-array vector4)"],
108+
[12, "gp", "(inline-array vector4)"]
109+
],
110+
"vector4-array-madd!": [
111+
[13, "s5", "(inline-array vector4)"],
112+
[14, "s4", "(inline-array vector4)"],
113+
[15, "gp", "(inline-array vector4)"]
114+
],
115+
"vector4-array-msub!": [
116+
[13, "s5", "(inline-array vector4)"],
117+
[14, "s4", "(inline-array vector4)"],
118+
[15, "gp", "(inline-array vector4)"]
119+
],
120+
"vector4-array-lerp!": [
121+
[13, "s5", "(inline-array vector4)"],
122+
[14, "s4", "(inline-array vector4)"],
123+
[15, "gp", "(inline-array vector4)"]
89124
]
90125
}

decompiler/config/jak3/ntsc_v1/var_names.jsonc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@
170170
"(method 0 process-tree)": {
171171
"args": ["allocation", "type-to-make", "name"]
172172
},
173-
"(method 0 process)": {
174-
"args": ["allocation", "type-to-make", "name"]
175-
},
176173
"(method 9 process-tree)": {
177174
"args": ["this", "active-tree", "name", "stack-pointer"]
178175
},
@@ -333,7 +330,6 @@
333330
"change-to-last-brother": {
334331
"args": ["proc"]
335332
},
336-
337333
"matrix-transpose!": {
338334
"args": ["dst", "src"]
339335
},
@@ -414,5 +410,11 @@
414410
},
415411
"string>=?": {
416412
"args": ["a", "b"]
413+
},
414+
"game-task->string": {
415+
"args": ["task"],
416+
"vars": {
417+
"v1-0": "val"
418+
}
417419
}
418420
}

decompiler/util/data_decompile.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,12 @@ const std::unordered_map<
967967
{"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)},
968968
{"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)},
969969
{"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}},
970+
}},
971+
{GameVersion::Jak3,
972+
{
973+
{"ocean-near-indices",
974+
{{"data", ArrayFieldDecompMeta(TypeSpec("ocean-near-index"), 32)}}},
975+
{"ocean-mid-masks", {{"data", ArrayFieldDecompMeta(TypeSpec("ocean-mid-mask"), 8)}}},
970976
}}};
971977

972978
goos::Object decompile_structure(const TypeSpec& type,

0 commit comments

Comments
 (0)