Skip to content

Commit

Permalink
Decompile tfrag, tie, prim (#3429)
Browse files Browse the repository at this point in the history
These still need to be ported to PC.
  • Loading branch information
water111 authored Mar 17, 2024
1 parent f7bfc8c commit ea48203
Show file tree
Hide file tree
Showing 41 changed files with 10,474 additions and 713 deletions.
666 changes: 341 additions & 325 deletions decompiler/config/jak3/all-types.gc

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions decompiler/config/jak3/ntsc_v1/hacks.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@
"(method 16 level)": [0, 1, 5, 13, 14, 15],
"upload-vis-bits": [2, 6, 3, 0],
"set-background-regs!": [4, 3],
"draw-drawable-tree-instance-shrub": [5, 7, 9, 11]
"draw-drawable-tree-instance-shrub": [5, 7, 9, 11],
"draw-drawable-tree-instance-tie": [21, 23, 31, 33]
},

// Sometimes the game might use format strings that are fetched dynamically,
Expand Down Expand Up @@ -453,7 +454,8 @@
"generic-no-light-proc",
"(method 21 cloth-system)",
"debug-line-clip?",
"(method 9 font-work)"
"(method 9 font-work)",
"(method 9 prim-strip)"
],

"mips2c_jump_table_functions": {},
Expand Down
26 changes: 25 additions & 1 deletion decompiler/config/jak3/ntsc_v1/label_types.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,30 @@
["L151", "(pointer bucket-id)", 12],
["L150", "(pointer bucket-id)", 12],
["L153", "(pointer bucket-id)", 12]

],
"tfrag-methods": [
["L89", "(inline-array tfrag-init-data)", 10],
["L90", "(pointer bucket-id)", 12],
["L91", "(pointer bucket-id)", 12],
["L92", "(pointer bucket-id)", 12],
["L93", "(pointer bucket-id)", 12],
["L95", "(pointer bucket-id)", 10],
["L96", "(pointer bucket-id)", 10]
],
"tie-methods": [
["L268", "(inline-array tie-init-data)", 10],
["L284", "(pointer bucket-id)", 10],
["L282", "(pointer bucket-id)", 10],
["L280", "(pointer bucket-id)", 10],
["L279", "(pointer bucket-id)", 10],
["L278", "(pointer bucket-id)", 10],
["L277", "(pointer bucket-id)", 10],
["L276", "(pointer bucket-id)", 10],
["L275", "(pointer bucket-id)", 10],
["L274", "(pointer bucket-id)", 10],
["L273", "(pointer bucket-id)", 10],
["L272", "(pointer bucket-id)", 10],
["L271", "(pointer bucket-id)", 10],
["L270", "(pointer bucket-id)", 10]
]
}
115 changes: 114 additions & 1 deletion decompiler/config/jak3/ntsc_v1/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2603,7 +2603,120 @@
[115, "s3", "shrubbery"],
[161, "gp", "(inline-array prototype-bucket-shrub)"]
],
"draw-drawable-tree-instance-shrub": [[86, "a0", "drawable-group"]]
"draw-drawable-tree-instance-shrub": [[86, "a0", "drawable-group"]],
"(method 9 tfragment)": [
[27, "a3", "(pointer int32)"],
[32, "t0", "texture"]
],
"add-tfrag-mtx-0": [[[3, 17], "a0", "dma-packet"]],
"add-tfrag-mtx-1": [[[3, 17], "a0", "dma-packet"]],
"add-tfrag-data": [
[[3, 17], "a0", "dma-packet"],
[[24, 31], "v1", "dma-packet"]
],
"tfrag-init-buffer": [[[73, 81], "v1", "dma-packet"]],
"tfrag-end-buffer": [
[[21, 28], "a2", "dma-packet"],
[[31, 38], "a0", "(pointer vif-tag)"],
[[38, 42], "a0", "(pointer int32)"],
[[43, 49], "a0", "(pointer vif-tag)"]
],
"tfrag-vu1-init-buf": [
[[47, 55], "v1", "dma-packet"],
[[81, 86], "v1", "dma-packet"],
[89, "v1", "(pointer int32)"]
],
"draw-drawable-tree-tfrag-water": [
[18, "v1", "drawable-inline-array-node"],
[20, "a0", "drawable-inline-array-node"]
],
"draw-drawable-tree-tfrag-trans": [
[18, "v1", "drawable-inline-array-node"],
[20, "a0", "drawable-inline-array-node"]
],
"draw-drawable-tree-tfrag": [
[17, "v1", "drawable-inline-array-node"],
[19, "a0", "drawable-inline-array-node"]
],
"(method 9 tie-fragment)": [
[21, "a2", "(pointer int32)"],
[26, "a3", "(pointer int32)"],
[[1, 70], "s5", "adgif-shader"]
],
"tie-init-engine": [
[[37, 51], "a0", "dma-packet"],
[[63, 71], "a0", "dma-packet"],
[[73, 80], "a0", "dma-packet"],
[[81, 90], "v1", "vector"],
[[91, 98], "v1", "(pointer vif-tag)"]
],
"tie-end-buffer": [
[[47, 54], "a1", "dma-packet"],
[[58, 69], "a0", "(pointer vif-tag)"]
],
"tie-ints": [
[17, "v1", "(pointer uint32)"],
[21, "v1", "(pointer uint32)"]
],
"tie-floats": [[[3, 73], "gp", "(pointer uint32)"]],
"instance-tie-patch-buckets": [
[39, "a0", "(pointer uint64)"],
[137, "a0", "(pointer uint64)"],
[235, "a0", "(pointer uint64)"],
[333, "a0", "(pointer uint64)"],
[431, "a0", "(pointer uint64)"],
[530, "a0", "(pointer uint64)"],
[629, "a0", "(pointer uint64)"],
[728, "a0", "(pointer uint64)"],
[827, "a0", "(pointer uint64)"],
[926, "a0", "(pointer uint64)"],
[1025, "a0", "(pointer uint64)"],
[1124, "a0", "(pointer uint64)"],
[1223, "a0", "(pointer uint64)"]
],
"draw-drawable-tree-instance-tie": [
[[23, 37], "v1", "drawable-inline-array-node"],
[25, "a0", "drawable-inline-array-node"],
[120, "s2", "drawable-inline-array-instance-tie"],
[132, "v1", "int"],
[132, "a0", "int"]
],
"tie-init-buf": [
[[44, 51], "a0", "dma-packet"],
[[53, 60], "a0", "gs-gif-tag"],
[64, "a0", "(pointer gs-zbuf)"],
[66, "a0", "(pointer gs-reg64)"],
[[71, 79], "v1", "dma-packet"],
[[104, 110], "v1", "dma-packet"],
[112, "v1", "(pointer uint32)"]
],
"(method 13 drawable-tree-instance-tie)": [
[[51, 70], "t1", "tie-fragment"],
[[102, 120], "a3", "tie-fragment"],
[[160, 178], "t1", "tie-fragment"],
[[211, 229], "a3", "tie-fragment"],
[[266, 286], "t1", "tie-fragment"],
[[320, 340], "a1", "tie-fragment"],
[[381, 400], "t1", "tie-fragment"],
[[432, 450], "a3", "tie-fragment"],
[[487, 507], "t1", "tie-fragment"],
[[541, 561], "a1", "tie-fragment"],
[[598, 616], "t1", "tie-fragment"],
[[649, 667], "a3", "tie-fragment"],
[[703, 723], "t1", "tie-fragment"],
[[756, 776], "a1", "tie-fragment"]
],
"(method 9 prim-strip)": [
[224, "t2", "int"],
[224, "t0", "int"],
[226, "t1", "int"],
[226, "a3", "int"],
[[190, 231], "a1", "(inline-array prim-vertex)"]
],
"prim-engine-execute": [
[[15, 21], "v1", "connection"],
[[21, 25], "a0", "prim-strip"]
]


}
1 change: 1 addition & 0 deletions game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ set(RUNTIME_SOURCE
mips2c/jak3_functions/font.cpp
mips2c/jak3_functions/generic_effect.cpp
mips2c/jak3_functions/lights.cpp
mips2c/jak3_functions/prim.cpp
mips2c/jak3_functions/sky.cpp
mips2c/mips2c_table.cpp
overlord/common/dma.cpp
Expand Down
6 changes: 3 additions & 3 deletions game/mips2c/jak3_functions/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// u32 call_addr = 0;
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
c->sd(fp, 8, sp); // sd fp, 8(sp)
c->mov64(fp, t9); // or fp, t9, r0
Expand Down Expand Up @@ -171,7 +171,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// u32 call_addr = 0;
c->load_symbol2(v1, cache.math_camera); // lw v1, *math-camera*(s7)
c->lqc2(vf26, 812, v1); // lqc2 vf26, 812(v1)
c->lqc2(vf27, 812, v1); // lqc2 vf27, 812(v1)
Expand Down Expand Up @@ -2350,7 +2350,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// u32 call_addr = 0;
c->lqc2(vf23, 12, a1); // lqc2 vf23, 12(a1)
c->lqc2(vf24, 12, a1); // lqc2 vf24, 12(a1)
c->lw(v1, 64, a1); // lw v1, 64(a1)
Expand Down
Loading

0 comments on commit ea48203

Please sign in to comment.