mirror of
https://github.com/open-goal/jak-project
synced 2026-07-01 20:20:35 -04:00
989snd/overlord: implement PLUGIN_MESSAGE grain and STRV plugin system (#4319)
This implements the functionality for the `PLUGIN_MESSAGE` grain and the 989snd VAG plugin system, allowing sounds to queue up VAG streams. Closes #2582
This commit is contained in:
@@ -2346,7 +2346,10 @@
|
||||
[213, "s0", "continue-point"],
|
||||
[222, "s0", "continue-point"]
|
||||
],
|
||||
"master-choose-entity": [["_stack_", 96, "res-tag"], [162, "s0", "(pointer camera-slave)"]],
|
||||
"master-choose-entity": [
|
||||
["_stack_", 96, "res-tag"],
|
||||
[162, "s0", "(pointer camera-slave)"]
|
||||
],
|
||||
"bones-mtx-calc-execute": [
|
||||
[[126, 154], "a0", "pris-mtx"],
|
||||
[[126, 154], "a1", "pris-mtx"],
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
////////////////////////////
|
||||
// HACKS and ASM FUNCTIONS
|
||||
////////////////////////////
|
||||
"types_with_bad_inspect_methods": [
|
||||
"game-task-event",
|
||||
"game-task-control"
|
||||
],
|
||||
"types_with_bad_inspect_methods": ["game-task-event", "game-task-control"],
|
||||
"no_type_analysis_functions_by_name": [],
|
||||
// this limits the number of cases in a cond. The first argument is the name of the function.
|
||||
// the second argument is the name of the first condition in the cond. Use print_cfg to find it out.
|
||||
@@ -79,88 +76,24 @@
|
||||
"~338h~5d~388h~5d~448h~5,,2f": 3
|
||||
},
|
||||
"blocks_ending_in_asm_branch": {
|
||||
"(method 9 curve-color-fast)": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"evaluate-color-curve-fast": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"sqlpipe-query": [
|
||||
21
|
||||
],
|
||||
"(method 9 editable-region)": [
|
||||
63
|
||||
],
|
||||
"find-nearest-entity": [
|
||||
7,
|
||||
9
|
||||
],
|
||||
"(method 9 curve-color-fast)": [0, 1],
|
||||
"evaluate-color-curve-fast": [0, 1],
|
||||
"sqlpipe-query": [21],
|
||||
"(method 9 editable-region)": [63],
|
||||
"find-nearest-entity": [7, 9],
|
||||
// collide-shape
|
||||
"(method 42 collide-shape)": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
7
|
||||
],
|
||||
"(method 18 collide-shape-prim-mesh)": [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7
|
||||
],
|
||||
"(method 42 collide-shape)": [0, 1, 2, 3, 4, 7],
|
||||
"(method 18 collide-shape-prim-mesh)": [2, 3, 4, 5, 6, 7],
|
||||
"(method 12 collide-shape-prim-sphere)": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
10,
|
||||
11,
|
||||
13,
|
||||
14,
|
||||
15
|
||||
1, 2, 3, 4, 5, 8, 10, 11, 13, 14, 15
|
||||
],
|
||||
"(method 12 collide-shape-prim-mesh)": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
14,
|
||||
15,
|
||||
16
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16
|
||||
],
|
||||
// collide-mesh
|
||||
"(method 11 collide-mesh)": [
|
||||
2,
|
||||
4
|
||||
],
|
||||
"(method 12 collide-mesh-cache)": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"(method 10 collide-mesh)": [
|
||||
2
|
||||
]
|
||||
"(method 11 collide-mesh)": [2, 4],
|
||||
"(method 12 collide-mesh-cache)": [0, 1, 2, 3, 4, 5],
|
||||
"(method 10 collide-mesh)": [2]
|
||||
},
|
||||
// Sometimes the game might use format strings that are fetched dynamically,
|
||||
// for example using the game text lookup method
|
||||
@@ -214,4 +147,4 @@
|
||||
// assume they must be different files, such as the art group for orb-cache-top.
|
||||
// this just suppresses a message.
|
||||
"expected_merged_objs": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,201 +1,46 @@
|
||||
{
|
||||
"ambient-h": [
|
||||
[
|
||||
"L1",
|
||||
"(inline-array talker-speech-class)",
|
||||
233
|
||||
]
|
||||
],
|
||||
"pat-h": [
|
||||
[
|
||||
"L1",
|
||||
"(inline-array pat-mode-info)",
|
||||
4
|
||||
]
|
||||
],
|
||||
"foreground-h": [
|
||||
[
|
||||
"L4",
|
||||
"(pointer bucket-id-16)",
|
||||
462
|
||||
]
|
||||
],
|
||||
"texture-anim-h": [
|
||||
[
|
||||
"L1",
|
||||
"(pointer uint8)",
|
||||
256
|
||||
]
|
||||
],
|
||||
"process-nettable-h": [
|
||||
[
|
||||
"L13",
|
||||
"(pointer uint32)",
|
||||
95
|
||||
]
|
||||
],
|
||||
"ambient-h": [["L1", "(inline-array talker-speech-class)", 233]],
|
||||
"pat-h": [["L1", "(inline-array pat-mode-info)", 4]],
|
||||
"foreground-h": [["L4", "(pointer bucket-id-16)", 462]],
|
||||
"texture-anim-h": [["L1", "(pointer uint8)", 256]],
|
||||
"process-nettable-h": [["L13", "(pointer uint32)", 95]],
|
||||
"math": [
|
||||
[
|
||||
"L109",
|
||||
"(pointer float)",
|
||||
32
|
||||
],
|
||||
[
|
||||
"L108",
|
||||
"(pointer float)",
|
||||
32
|
||||
]
|
||||
],
|
||||
"timer-h": [
|
||||
[
|
||||
"L15",
|
||||
"(pointer uint32)",
|
||||
12
|
||||
]
|
||||
],
|
||||
"game-task-h": [
|
||||
[
|
||||
"L178",
|
||||
"(pointer text-id)",
|
||||
24
|
||||
]
|
||||
],
|
||||
"profile": [
|
||||
[
|
||||
"L3",
|
||||
"(inline-array profile-spec)",
|
||||
13
|
||||
]
|
||||
["L109", "(pointer float)", 32],
|
||||
["L108", "(pointer float)", 32]
|
||||
],
|
||||
"timer-h": [["L15", "(pointer uint32)", 12]],
|
||||
"game-task-h": [["L178", "(pointer text-id)", 24]],
|
||||
"profile": [["L3", "(inline-array profile-spec)", 13]],
|
||||
"task-control-h": [
|
||||
[
|
||||
"L971",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L973",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L977",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L979",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L978",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L972",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L974",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L975",
|
||||
"uint64",
|
||||
true
|
||||
],
|
||||
[
|
||||
"L976",
|
||||
"uint64",
|
||||
true
|
||||
]
|
||||
["L971", "uint64", true],
|
||||
["L973", "uint64", true],
|
||||
["L977", "uint64", true],
|
||||
["L979", "uint64", true],
|
||||
["L978", "uint64", true],
|
||||
["L972", "uint64", true],
|
||||
["L974", "uint64", true],
|
||||
["L975", "uint64", true],
|
||||
["L976", "uint64", true]
|
||||
],
|
||||
"font-data": [
|
||||
[
|
||||
"L1",
|
||||
"(inline-array vector)",
|
||||
250
|
||||
],
|
||||
[
|
||||
"L2",
|
||||
"(inline-array vector)",
|
||||
250
|
||||
]
|
||||
["L1", "(inline-array vector)", 250],
|
||||
["L2", "(inline-array vector)", 250]
|
||||
],
|
||||
"mem-buffer-h": [
|
||||
[
|
||||
"L71",
|
||||
"(pointer uint32)",
|
||||
256
|
||||
],
|
||||
[
|
||||
"L70",
|
||||
"(pointer uint32)",
|
||||
256
|
||||
],
|
||||
[
|
||||
"L69",
|
||||
"(pointer uint32)",
|
||||
256
|
||||
],
|
||||
[
|
||||
"L68",
|
||||
"(pointer uint32)",
|
||||
256
|
||||
],
|
||||
[
|
||||
"L72",
|
||||
"(pointer uint32)",
|
||||
12
|
||||
]
|
||||
],
|
||||
"sprite": [
|
||||
[
|
||||
"L52",
|
||||
"dma-packet"
|
||||
]
|
||||
["L71", "(pointer uint32)", 256],
|
||||
["L70", "(pointer uint32)", 256],
|
||||
["L69", "(pointer uint32)", 256],
|
||||
["L68", "(pointer uint32)", 256],
|
||||
["L72", "(pointer uint32)", 12]
|
||||
],
|
||||
"sprite": [["L52", "dma-packet"]],
|
||||
"headset-h": [
|
||||
[
|
||||
"L8",
|
||||
"(pointer uint8)",
|
||||
512
|
||||
],
|
||||
[
|
||||
"L7",
|
||||
"(pointer uint8)",
|
||||
512
|
||||
],
|
||||
[
|
||||
"L6",
|
||||
"(pointer uint8)",
|
||||
100
|
||||
],
|
||||
[
|
||||
"L5",
|
||||
"(pointer uint8)",
|
||||
160
|
||||
],
|
||||
[
|
||||
"L4",
|
||||
"(pointer uint8)",
|
||||
160
|
||||
],
|
||||
[
|
||||
"L3",
|
||||
"(pointer int8)",
|
||||
4
|
||||
]
|
||||
["L8", "(pointer uint8)", 512],
|
||||
["L7", "(pointer uint8)", 512],
|
||||
["L6", "(pointer uint8)", 100],
|
||||
["L5", "(pointer uint8)", 160],
|
||||
["L4", "(pointer uint8)", 160],
|
||||
["L3", "(pointer int8)", 4]
|
||||
],
|
||||
"kras-part": [
|
||||
[
|
||||
"L137",
|
||||
"(pointer rgba)",
|
||||
8
|
||||
]
|
||||
]
|
||||
}
|
||||
"kras-part": [["L137", "(pointer rgba)", 8]]
|
||||
}
|
||||
|
||||
@@ -1,360 +1,98 @@
|
||||
{
|
||||
"quaternion-smooth-seek!": [
|
||||
[
|
||||
16,
|
||||
[
|
||||
"inline-array",
|
||||
"quaternion",
|
||||
2
|
||||
]
|
||||
]
|
||||
],
|
||||
"rotate-vector-to-vector": [
|
||||
[
|
||||
16,
|
||||
"quaternion"
|
||||
]
|
||||
],
|
||||
"nearest-dist2-between-moving-points": [
|
||||
[
|
||||
16,
|
||||
[
|
||||
"inline-array",
|
||||
"vector",
|
||||
2
|
||||
]
|
||||
]
|
||||
],
|
||||
"vector-segment-xz-distance-point!": [
|
||||
[
|
||||
16,
|
||||
"matrix"
|
||||
]
|
||||
],
|
||||
"vector-interp-angle!": [
|
||||
[
|
||||
16,
|
||||
"quaternion"
|
||||
]
|
||||
],
|
||||
"vector-cap-rotation!": [
|
||||
[
|
||||
16,
|
||||
"quaternion"
|
||||
]
|
||||
],
|
||||
"vector-line-xz-distance-point!": [
|
||||
[
|
||||
16,
|
||||
"matrix"
|
||||
]
|
||||
],
|
||||
"quaternion-smooth-seek!": [[16, ["inline-array", "quaternion", 2]]],
|
||||
"rotate-vector-to-vector": [[16, "quaternion"]],
|
||||
"nearest-dist2-between-moving-points": [[16, ["inline-array", "vector", 2]]],
|
||||
"vector-segment-xz-distance-point!": [[16, "matrix"]],
|
||||
"vector-interp-angle!": [[16, "quaternion"]],
|
||||
"vector-cap-rotation!": [[16, "quaternion"]],
|
||||
"vector-line-xz-distance-point!": [[16, "matrix"]],
|
||||
"vector-circle-tangent-new": [
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
48,
|
||||
"vector"
|
||||
]
|
||||
[32, "vector"],
|
||||
[48, "vector"]
|
||||
],
|
||||
"v-slrp2!": [
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
64,
|
||||
"matrix"
|
||||
]
|
||||
],
|
||||
"v-slrp3!": [
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
]
|
||||
[32, "vector"],
|
||||
[64, "matrix"]
|
||||
],
|
||||
"v-slrp3!": [[32, "vector"]],
|
||||
"collide-list-fill-bg-using-box": [
|
||||
[
|
||||
32,
|
||||
"matrix"
|
||||
],
|
||||
[
|
||||
96,
|
||||
"collide-query"
|
||||
]
|
||||
[32, "matrix"],
|
||||
[96, "collide-query"]
|
||||
],
|
||||
"collide-list-fill-bg-using-line-sphere": [
|
||||
[
|
||||
32,
|
||||
"matrix"
|
||||
],
|
||||
[
|
||||
96,
|
||||
"collide-query"
|
||||
]
|
||||
],
|
||||
"(method 9 touching-list)": [
|
||||
[
|
||||
16,
|
||||
"add-prims-touching-work"
|
||||
]
|
||||
],
|
||||
"(method 9 curve-color-fast)": [
|
||||
[
|
||||
16,
|
||||
"rgbaf"
|
||||
]
|
||||
[32, "matrix"],
|
||||
[96, "collide-query"]
|
||||
],
|
||||
"(method 9 touching-list)": [[16, "add-prims-touching-work"]],
|
||||
"(method 9 curve-color-fast)": [[16, "rgbaf"]],
|
||||
"(method 9 curve2d-fast)": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
]
|
||||
],
|
||||
"evaluate-color-curve-fast": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
]
|
||||
[16, "vector"],
|
||||
[32, "vector"]
|
||||
],
|
||||
"evaluate-color-curve-fast": [[16, "vector"]],
|
||||
"evaluate-curve-fast": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
]
|
||||
[16, "vector"],
|
||||
[32, "vector"]
|
||||
],
|
||||
"add-debug-box-with-transform": [
|
||||
[
|
||||
16,
|
||||
[
|
||||
"inline-array",
|
||||
"vector",
|
||||
8
|
||||
]
|
||||
],
|
||||
[
|
||||
144,
|
||||
[
|
||||
"inline-array",
|
||||
"vector",
|
||||
2
|
||||
]
|
||||
],
|
||||
[
|
||||
176,
|
||||
"vector"
|
||||
]
|
||||
[16, ["inline-array", "vector", 8]],
|
||||
[144, ["inline-array", "vector", 2]],
|
||||
[176, "vector"]
|
||||
],
|
||||
"add-debug-curve": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
]
|
||||
[16, "vector"],
|
||||
[32, "vector"]
|
||||
],
|
||||
"add-debug-sphere-from-table": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
48,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
64,
|
||||
"vector"
|
||||
]
|
||||
[16, "vector"],
|
||||
[48, "vector"],
|
||||
[64, "vector"]
|
||||
],
|
||||
"make-debug-sphere-table": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
48,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
64,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
80,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
96,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
112,
|
||||
"vector"
|
||||
]
|
||||
],
|
||||
"eul->matrix": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
]
|
||||
[16, "vector"],
|
||||
[32, "vector"],
|
||||
[48, "vector"],
|
||||
[64, "vector"],
|
||||
[80, "vector"],
|
||||
[96, "vector"],
|
||||
[112, "vector"]
|
||||
],
|
||||
"eul->matrix": [[16, "vector"]],
|
||||
"joint-mod-joint-set-world-handler": [
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
48,
|
||||
"vector"
|
||||
]
|
||||
],
|
||||
"joint-mod-blend-world-callback": [
|
||||
[
|
||||
16,
|
||||
"joint-mod-blend-world-work"
|
||||
]
|
||||
],
|
||||
"(method 20 lightning-bolt)": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
]
|
||||
[32, "vector"],
|
||||
[48, "vector"]
|
||||
],
|
||||
"joint-mod-blend-world-callback": [[16, "joint-mod-blend-world-work"]],
|
||||
"(method 20 lightning-bolt)": [[16, "vector"]],
|
||||
"update-light-hash": [
|
||||
[
|
||||
16,
|
||||
"bounding-box"
|
||||
],
|
||||
[
|
||||
48,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
64,
|
||||
"vector"
|
||||
]
|
||||
],
|
||||
"(method 10 simple-sprite-system)": [
|
||||
[
|
||||
16,
|
||||
[
|
||||
"array",
|
||||
"texture-id",
|
||||
128
|
||||
]
|
||||
]
|
||||
],
|
||||
"(method 10 cubic-curve)": [
|
||||
[
|
||||
16,
|
||||
"trajectory"
|
||||
]
|
||||
],
|
||||
"(method 11 cubic-curve)": [
|
||||
[
|
||||
16,
|
||||
"trajectory"
|
||||
]
|
||||
],
|
||||
"(method 12 cubic-curve)": [
|
||||
[
|
||||
16,
|
||||
"trajectory"
|
||||
]
|
||||
],
|
||||
"matrix<-parented-transformq!": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
]
|
||||
[16, "bounding-box"],
|
||||
[48, "vector"],
|
||||
[64, "vector"]
|
||||
],
|
||||
"(method 10 simple-sprite-system)": [[16, ["array", "texture-id", 128]]],
|
||||
"(method 10 cubic-curve)": [[16, "trajectory"]],
|
||||
"(method 11 cubic-curve)": [[16, "trajectory"]],
|
||||
"(method 12 cubic-curve)": [[16, "trajectory"]],
|
||||
"matrix<-parented-transformq!": [[16, "vector"]],
|
||||
"draw-axis": [
|
||||
[
|
||||
32,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
48,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
64,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
112,
|
||||
"vector"
|
||||
]
|
||||
[32, "vector"],
|
||||
[48, "vector"],
|
||||
[64, "vector"],
|
||||
[112, "vector"]
|
||||
],
|
||||
"(method 10 manipulator)": [
|
||||
[
|
||||
112,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
128,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
160,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
192,
|
||||
"vector"
|
||||
]
|
||||
[112, "vector"],
|
||||
[128, "vector"],
|
||||
[160, "vector"],
|
||||
[192, "vector"]
|
||||
],
|
||||
"(method 11 manipulator)": [
|
||||
[
|
||||
64,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
96,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
144,
|
||||
"vector"
|
||||
],
|
||||
[
|
||||
192,
|
||||
"vector"
|
||||
]
|
||||
[64, "vector"],
|
||||
[96, "vector"],
|
||||
[144, "vector"],
|
||||
[192, "vector"]
|
||||
],
|
||||
"ptest": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
]
|
||||
],
|
||||
"check-drop-level-rain": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
]
|
||||
],
|
||||
"spt-func-rocket": [
|
||||
[
|
||||
16,
|
||||
"vector"
|
||||
]
|
||||
]
|
||||
}
|
||||
"ptest": [[16, "vector"]],
|
||||
"check-drop-level-rain": [[16, "vector"]],
|
||||
"spt-func-rocket": [[16, "vector"]]
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,8 @@ namespace decompiler {
|
||||
bool allowable_base_type_for_symbol_to_string(const TypeSpec& ts);
|
||||
|
||||
constexpr PerGameVersion<int> SYMBOL_TO_STRING_MEM_OFFSET_DECOMP = {
|
||||
8167 * 8, jak2::SYM_TO_STRING_OFFSET, -99999, -99999, // not supported this way!
|
||||
8167 * 8, jak2::SYM_TO_STRING_OFFSET, -99999,
|
||||
-99999, // not supported this way!
|
||||
};
|
||||
|
||||
constexpr PerGameVersion<int> OFFSET_OF_NEXT_STATE_STORE = {72, 64, 68, 76};
|
||||
|
||||
@@ -241,6 +241,7 @@ set(RUNTIME_SOURCE
|
||||
overlord/common/iso_api.cpp
|
||||
overlord/common/iso.cpp
|
||||
overlord/common/isocommon.cpp
|
||||
overlord/common/989_plugins/plugin_strv.cpp
|
||||
overlord/common/overlord.cpp
|
||||
overlord/common/sbank.cpp
|
||||
overlord/common/soundcommon.cpp
|
||||
@@ -265,6 +266,7 @@ set(RUNTIME_SOURCE
|
||||
overlord/jak2/list.cpp
|
||||
overlord/jak2/overlord.cpp
|
||||
overlord/jak2/pages.cpp
|
||||
overlord/jak2/989_plugins/plugin_strv.cpp
|
||||
overlord/jak2/spustreams.cpp
|
||||
overlord/jak2/srpc.cpp
|
||||
overlord/jak2/ssound.cpp
|
||||
@@ -295,6 +297,7 @@ set(RUNTIME_SOURCE
|
||||
overlord/jak3/sbank.cpp
|
||||
overlord/jak3/soundcommon.cpp
|
||||
overlord/jak3/streamlist.cpp
|
||||
overlord/jak3/989_plugins/plugin_strv.cpp
|
||||
overlord/jakx/overlord.cpp
|
||||
overlord/jakx/pagemanager.cpp
|
||||
overlord/jakx/iso_cd.cpp
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
#include "plugin_strv.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
#include "common/log/log.h"
|
||||
|
||||
#include "game/sce/iop.h"
|
||||
#include "game/sound/989snd/plugin.h"
|
||||
#include "game/sound/sndshim.h"
|
||||
|
||||
namespace plugin_strv {
|
||||
|
||||
namespace {
|
||||
|
||||
PluginStreamOps g_ops;
|
||||
|
||||
std::mutex g_req_mtx;
|
||||
std::queue<PluginStreamRequest> g_reqs;
|
||||
|
||||
void PushRequest(const PluginStreamRequest& req) {
|
||||
{
|
||||
std::scoped_lock lock(g_req_mtx);
|
||||
g_reqs.push(req);
|
||||
}
|
||||
if (g_ops.wakeup_thread != 0) {
|
||||
iop::iWakeupThread(g_ops.wakeup_thread);
|
||||
}
|
||||
}
|
||||
|
||||
s32 ResolveVol(const snd::VagStreamPluginData& msg, const s8* regs, s32 cur_vol) {
|
||||
s32 vol;
|
||||
if (msg.use_regs) {
|
||||
vol = (regs[0] << 10) / 127;
|
||||
} else {
|
||||
vol = ((s32)msg.vol << 10) / 127;
|
||||
}
|
||||
return (vol * cur_vol) >> 10;
|
||||
}
|
||||
|
||||
s32 ResolvePan(const snd::VagStreamPluginData& msg, const s8* regs) {
|
||||
if (msg.use_regs) {
|
||||
return 360 * regs[1] / 127;
|
||||
}
|
||||
return 360 * (s32)msg.pan / 127;
|
||||
}
|
||||
|
||||
s32 VagStreamPluginHandler(u32 id,
|
||||
u32 index,
|
||||
u32 owner,
|
||||
const u8* data,
|
||||
const s8* regs,
|
||||
s32 cur_vol) {
|
||||
if (id != snd::VAG_STREAM_PLUGIN_ID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
snd::VagStreamPluginData msg{};
|
||||
memcpy(&msg, data, sizeof(msg));
|
||||
|
||||
PluginStreamRequest req{};
|
||||
req.owner = owner;
|
||||
strncpy(req.name, msg.name, 8);
|
||||
|
||||
switch (index) {
|
||||
case 0: // QueueVagStream989
|
||||
req.op = PluginOp::Queue;
|
||||
req.prio = (msg.priority != 0 && msg.priority < 10) ? (s32)msg.priority : 4;
|
||||
req.vol = ResolveVol(msg, regs, cur_vol);
|
||||
req.pan = ResolvePan(msg, regs);
|
||||
PushRequest(req);
|
||||
break;
|
||||
case 3: // StopVagStream989
|
||||
req.op = PluginOp::Stop;
|
||||
PushRequest(req);
|
||||
break;
|
||||
case 5: // SetVagStreamVolume989
|
||||
req.op = PluginOp::SetVol;
|
||||
req.vol = ResolveVol(msg, regs, cur_vol);
|
||||
PushRequest(req);
|
||||
break;
|
||||
case 7: // StopEmAll989
|
||||
req.op = PluginOp::StopAll;
|
||||
PushRequest(req);
|
||||
break;
|
||||
default:
|
||||
lg::info("VagStreamPluginHandler: unhandled idx {}", index);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void Init(const PluginStreamOps& ops) {
|
||||
g_ops = ops;
|
||||
snd_RegisterPluginHandler(VagStreamPluginHandler);
|
||||
}
|
||||
|
||||
void HandleRequests() {
|
||||
while (true) {
|
||||
PluginStreamRequest req;
|
||||
{
|
||||
std::scoped_lock lock(g_req_mtx);
|
||||
if (g_reqs.empty()) {
|
||||
break;
|
||||
}
|
||||
req = g_reqs.front();
|
||||
g_reqs.pop();
|
||||
}
|
||||
|
||||
switch (req.op) {
|
||||
case PluginOp::Queue:
|
||||
if (g_ops.queue) {
|
||||
g_ops.queue(req);
|
||||
}
|
||||
break;
|
||||
case PluginOp::Stop:
|
||||
if (g_ops.stop) {
|
||||
g_ops.stop(req);
|
||||
}
|
||||
break;
|
||||
case PluginOp::SetVol:
|
||||
if (g_ops.set_vol) {
|
||||
g_ops.set_vol(req);
|
||||
}
|
||||
break;
|
||||
case PluginOp::StopAll:
|
||||
if (g_ops.stop_all) {
|
||||
g_ops.stop_all();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace plugin_strv
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace plugin_strv {
|
||||
|
||||
enum class PluginOp { Queue, Stop, SetVol, StopAll };
|
||||
|
||||
struct PluginStreamRequest {
|
||||
PluginOp op{};
|
||||
u32 owner{};
|
||||
char name[0x30]{};
|
||||
s32 prio{};
|
||||
s32 vol{};
|
||||
s32 pan{};
|
||||
};
|
||||
|
||||
struct PluginStreamOps {
|
||||
void (*queue)(const PluginStreamRequest&) = nullptr;
|
||||
void (*stop)(const PluginStreamRequest&) = nullptr;
|
||||
void (*set_vol)(const PluginStreamRequest&) = nullptr;
|
||||
void (*stop_all)() = nullptr;
|
||||
s32 wakeup_thread = 0;
|
||||
};
|
||||
|
||||
void Init(const PluginStreamOps& ops);
|
||||
void HandleRequests();
|
||||
|
||||
} // namespace plugin_strv
|
||||
@@ -0,0 +1,105 @@
|
||||
#include "plugin_strv.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "../../common/989_plugins/plugin_strv.h"
|
||||
#include "game/overlord/jak2/ssound.h"
|
||||
#include "game/overlord/jak2/streamlist.h"
|
||||
#include "game/overlord/jak2/vag.h"
|
||||
#include "game/sce/iop.h"
|
||||
|
||||
using namespace iop;
|
||||
using plugin_strv::PluginStreamRequest;
|
||||
|
||||
namespace jak2 {
|
||||
|
||||
namespace {
|
||||
|
||||
int g_PluginId = 0;
|
||||
|
||||
void DoQueue(const PluginStreamRequest& req) {
|
||||
VagStrListNode key{};
|
||||
strncpy(key.name, req.name, 0x30);
|
||||
key.id = req.owner;
|
||||
if (!++g_PluginId) {
|
||||
g_PluginId = 1;
|
||||
}
|
||||
key.unk_68 = g_PluginId;
|
||||
key.sound_handler = req.owner;
|
||||
key.prio = req.prio;
|
||||
key.vol_multiplier = req.vol;
|
||||
key.unk_100 = req.pan;
|
||||
|
||||
WaitSema(PluginStreamsList.sema);
|
||||
if (!FindVagStreamInList(&key, &PluginStreamsList) &&
|
||||
InsertVagStreamInList(&key, &PluginStreamsList)) {
|
||||
WaitSema(EEPlayList.sema);
|
||||
if (!FindVagStreamInList(&key, &EEPlayList)) {
|
||||
auto* node = InsertVagStreamInList(&key, &EEPlayList);
|
||||
if (node) {
|
||||
strncpy(node->name, req.name, 0x30);
|
||||
node->id = req.owner;
|
||||
node->unk_68 = g_PluginId;
|
||||
node->sound_handler = req.owner;
|
||||
node->unk_76 = 0;
|
||||
node->unk_80 = 0;
|
||||
node->prio = req.prio;
|
||||
node->unk_88 = 0;
|
||||
node->unk_92 = 0;
|
||||
node->vol_multiplier = req.vol;
|
||||
node->unk_100 = req.pan;
|
||||
}
|
||||
}
|
||||
SignalSema(EEPlayList.sema);
|
||||
}
|
||||
SignalSema(PluginStreamsList.sema);
|
||||
}
|
||||
|
||||
void DoStop(const PluginStreamRequest& req) {
|
||||
VagStrListNode key{};
|
||||
strncpy(key.name, req.name, 0x30);
|
||||
key.id = req.owner;
|
||||
WaitSema(PluginStreamsList.sema);
|
||||
RemoveVagStreamFromList(&key, &PluginStreamsList);
|
||||
SignalSema(PluginStreamsList.sema);
|
||||
}
|
||||
|
||||
void DoSetVol(const PluginStreamRequest& req) {
|
||||
VagCmd* cmd = FindThisVagStream(req.name, req.owner);
|
||||
if (cmd) {
|
||||
cmd->vol_multiplier = req.vol;
|
||||
SetVAGVol(cmd, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void DoStopAll() {
|
||||
for (auto& cmd : VagCmds) {
|
||||
if (cmd.id != 0) {
|
||||
VagStrListNode key{};
|
||||
strncpy(key.name, cmd.name, 0x30);
|
||||
key.id = cmd.id;
|
||||
WaitSema(PluginStreamsList.sema);
|
||||
RemoveVagStreamFromList(&key, &PluginStreamsList);
|
||||
SignalSema(PluginStreamsList.sema);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void Init989Plugins() {
|
||||
g_PluginId = 0;
|
||||
plugin_strv::PluginStreamOps ops;
|
||||
ops.queue = DoQueue;
|
||||
ops.stop = DoStop;
|
||||
ops.set_vol = DoSetVol;
|
||||
ops.stop_all = DoStopAll;
|
||||
ops.wakeup_thread = StreamThread;
|
||||
plugin_strv::Init(ops);
|
||||
}
|
||||
|
||||
void HandlePluginRequests() {
|
||||
plugin_strv::HandleRequests();
|
||||
}
|
||||
|
||||
} // namespace jak2
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace jak2 {
|
||||
|
||||
void Init989Plugins();
|
||||
void HandlePluginRequests();
|
||||
|
||||
} // namespace jak2
|
||||
@@ -82,7 +82,7 @@ void QueueVAGStream(VagStrListNode* param_1) {
|
||||
iVar2 = 0;
|
||||
pbVar4 = local_20;
|
||||
do {
|
||||
if (*pbVar4 - 0x61 < 0x1a) {
|
||||
if ((u8)(*pbVar4 - 0x61) < 0x1a) {
|
||||
*pbVar4 = *pbVar4 - 0x20;
|
||||
}
|
||||
iVar2 = iVar2 + 1;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/util/Assert.h"
|
||||
|
||||
#include "989_plugins/plugin_strv.h"
|
||||
#include "game/overlord/common/srpc.h"
|
||||
#include "game/overlord/common/ssound.h"
|
||||
#include "game/overlord/jak2/spustreams.h"
|
||||
@@ -80,7 +81,7 @@ void InitSound_overlord() {
|
||||
printf("IOP: ======================================================================\n");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
// Init989Plugins(); TODO
|
||||
Init989Plugins();
|
||||
// InitStreamLfoHandler(); TODO
|
||||
InitVagStreamList(&PluginStreamsList, 4, "plugin");
|
||||
InitVagStreamList(&EEStreamsList, 4, "ee");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "989_plugins/plugin_strv.h"
|
||||
#include "game/overlord/jak2/vag.h"
|
||||
#include "game/sce/iop.h"
|
||||
|
||||
@@ -295,6 +296,7 @@ u32 StreamListThread() {
|
||||
do {
|
||||
SleepThread();
|
||||
} while (RequestedStreamsList.unk2_init0 != 0);
|
||||
HandlePluginRequests();
|
||||
uVar8 = 0;
|
||||
WaitSema(RequestedStreamsList.sema);
|
||||
iVar1 = RequestedStreamsList.elt_count;
|
||||
|
||||
+16
-17
@@ -11,6 +11,7 @@
|
||||
#include "game/overlord/jak2/ssound.h"
|
||||
#include "game/overlord/jak2/streamlist.h"
|
||||
#include "game/sound/sdshim.h"
|
||||
#include "game/sound/sndshim.h"
|
||||
|
||||
namespace jak2 {
|
||||
VagCmd VagCmds[N_VAG_CMDS];
|
||||
@@ -406,21 +407,20 @@ void SetVAGVol(VagCmd* cmd, int /*param_2*/) {
|
||||
if (!cmd->sound_handler) {
|
||||
CalculateVAGVolumes(cmd, &lvol, &rvol);
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
// TODO vag 989snd plugin
|
||||
// SoundHandler* hnd = cmd->sound_handler;
|
||||
// u32 vol =
|
||||
// 0x3fff *
|
||||
// ((((cmd->vol_multiplier * MasterVolume[hnd->VolGroup]) >> 10) * hnd->Current_Vol) >> 10)
|
||||
// >> 10;
|
||||
// lvol = (vol * gPanTable[(cmd->unk_176 + 90) % 360].left) >> 10;
|
||||
// lvol = (vol * gPanTable[(cmd->unk_176 + 90) % 360].right) >> 10;
|
||||
// if (lvol >= 0x4000) {
|
||||
// lvol = 0x3fff;
|
||||
//}
|
||||
// if (rvol >= 0x4000) {
|
||||
// rvol = 0x3fff;
|
||||
//}
|
||||
s32 group = snd_GetSoundGroup(cmd->id) & 0x1f;
|
||||
u32 vol = 0x3fff * (u32)((cmd->vol_multiplier * MasterVolume[group]) >> 10);
|
||||
s32 angle = (cmd->unk_176 + 90) % 360;
|
||||
if (angle < 0) {
|
||||
angle += 360;
|
||||
}
|
||||
lvol = (gPanTable[angle].left * (vol >> 10)) >> 10;
|
||||
rvol = (gPanTable[angle].right * (vol >> 10)) >> 10;
|
||||
if (lvol >= 0x4000) {
|
||||
lvol = 0x3fff;
|
||||
}
|
||||
if (rvol >= 0x4000) {
|
||||
rvol = 0x3fff;
|
||||
}
|
||||
}
|
||||
|
||||
// Originally used ProcBatch, buts this is easier to read.
|
||||
@@ -764,8 +764,7 @@ void UnPauseVagStreams() {
|
||||
void SetAllVagsVol(int param_1) {
|
||||
if (param_1 >= 0) {
|
||||
for (auto& VagCmd : VagCmds) {
|
||||
if (VagCmd.sound_handler /* && VagCmd.sound_handler->VolGroup == param_1 */) {
|
||||
ASSERT_NOT_REACHED();
|
||||
if (VagCmd.sound_handler && snd_GetSoundGroup(VagCmd.id) == param_1) {
|
||||
SetVAGVol(&VagCmd, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#include "plugin_strv.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "../../common/989_plugins/plugin_strv.h"
|
||||
#include "game/overlord/jak3/streamlist.h"
|
||||
#include "game/overlord/jak3/vag.h"
|
||||
#include "game/sce/iop.h"
|
||||
|
||||
using namespace iop;
|
||||
using plugin_strv::PluginStreamRequest;
|
||||
|
||||
namespace jak3 {
|
||||
|
||||
namespace {
|
||||
|
||||
int g_PluginId = 0;
|
||||
|
||||
void DoQueue(const PluginStreamRequest& req) {
|
||||
VagStreamData key{};
|
||||
strncpy(key.name, req.name, 0x30);
|
||||
key.id = req.owner;
|
||||
if (!++g_PluginId) {
|
||||
g_PluginId = 1;
|
||||
}
|
||||
key.plugin_id = g_PluginId;
|
||||
key.sound_handler = req.owner;
|
||||
key.priority = req.prio;
|
||||
key.volume2 = req.vol;
|
||||
key.maybe_volume_3 = 0;
|
||||
key.group = 2;
|
||||
key.pan = req.pan;
|
||||
key.art_load = 0;
|
||||
key.movie_art_load = 0;
|
||||
|
||||
WaitSema(g_PluginStreamsList.sema);
|
||||
if (!FindVagStreamInList(&key, &g_PluginStreamsList) &&
|
||||
InsertVagStreamInList(&key, &g_PluginStreamsList)) {
|
||||
WaitSema(g_EEPlayList.sema);
|
||||
if (!FindVagStreamInList(&key, &g_EEPlayList)) {
|
||||
InsertVagStreamInList(&key, &g_EEPlayList);
|
||||
}
|
||||
SignalSema(g_EEPlayList.sema);
|
||||
}
|
||||
SignalSema(g_PluginStreamsList.sema);
|
||||
}
|
||||
|
||||
void DoStop(const PluginStreamRequest& req) {
|
||||
VagStreamData key{};
|
||||
strncpy(key.name, req.name, 0x30);
|
||||
key.id = req.owner;
|
||||
WaitSema(g_PluginStreamsList.sema);
|
||||
RemoveVagStreamFromList(&key, &g_PluginStreamsList);
|
||||
SignalSema(g_PluginStreamsList.sema);
|
||||
}
|
||||
|
||||
void DoSetVol(const PluginStreamRequest& req) {
|
||||
ISO_VAGCommand* cmd = FindThisVagStream(req.name, req.owner);
|
||||
if (cmd) {
|
||||
cmd->play_volume = req.vol;
|
||||
SetVAGVol(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void DoStopAll() {
|
||||
for (auto& cmd : g_aVagCmds) {
|
||||
if (cmd.id != 0) {
|
||||
VagStreamData key{};
|
||||
strncpy(key.name, cmd.name, 0x30);
|
||||
key.id = cmd.id;
|
||||
WaitSema(g_PluginStreamsList.sema);
|
||||
RemoveVagStreamFromList(&key, &g_PluginStreamsList);
|
||||
SignalSema(g_PluginStreamsList.sema);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void Init989Plugins() {
|
||||
g_PluginId = 0;
|
||||
plugin_strv::PluginStreamOps ops;
|
||||
ops.queue = DoQueue;
|
||||
ops.stop = DoStop;
|
||||
ops.set_vol = DoSetVol;
|
||||
ops.stop_all = DoStopAll;
|
||||
ops.wakeup_thread = 0;
|
||||
plugin_strv::Init(ops);
|
||||
}
|
||||
|
||||
void HandlePluginRequests() {
|
||||
plugin_strv::HandleRequests();
|
||||
}
|
||||
|
||||
} // namespace jak3
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace jak3 {
|
||||
|
||||
void Init989Plugins();
|
||||
void HandlePluginRequests();
|
||||
|
||||
} // namespace jak3
|
||||
@@ -166,11 +166,12 @@ void QueueVAGStream(VagStreamData* stream) {
|
||||
cmd.play_volume = 0x400;
|
||||
cmd.play_group = 2;
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
// PluginVagAndVagWad(&cmd,stream);
|
||||
// cmd.play_volume = stream->maybe_volume2;
|
||||
// cmd.oog = stream->maybe_volume_3;
|
||||
// cmd.play_group = stream->group;
|
||||
EEVagAndVagWad(&cmd, stream->name);
|
||||
cmd.play_volume = stream->volume2;
|
||||
cmd.oog = stream->maybe_volume_3;
|
||||
cmd.play_group = stream->group;
|
||||
cmd.dolby_pan_angle = stream->pan;
|
||||
}
|
||||
strncpy(cmd.name, stream->name, 0x30);
|
||||
cmd.id = stream->id;
|
||||
|
||||
@@ -922,7 +922,7 @@ void StopVagStream(ISO_VAGCommand* cmd) {
|
||||
PauseVAG(cmd);
|
||||
strncpy(vsd.name, cmd->name, 0x30);
|
||||
vsd.id = cmd->id;
|
||||
// RemoveVagStreamFromList(&vsd, &g_PluginStreamsList);
|
||||
RemoveVagStreamFromList(&vsd, &g_PluginStreamsList);
|
||||
RemoveVagStreamFromList(&vsd, &g_EEPlayList);
|
||||
// local_20 = cmd->plugin_id;
|
||||
// local_24 = cmd->id;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "common/util/Assert.h"
|
||||
|
||||
#include "989_plugins/plugin_strv.h"
|
||||
#include "game/overlord/jak3/iso.h"
|
||||
#include "game/overlord/jak3/overlord.h"
|
||||
#include "game/overlord/jak3/spustreams.h"
|
||||
@@ -236,9 +237,9 @@ void InitSound() {
|
||||
g_EarTransSema = CreateSema(¶m);
|
||||
ASSERT(g_EarTransSema >= 0);
|
||||
|
||||
// Init989Plugins();
|
||||
Init989Plugins();
|
||||
// InitStreamLfoHandler();
|
||||
// InitVagStreamList((List*)&g_PluginStreamsList, 4, s_plugin_00015918);
|
||||
InitVagStreamList(&g_PluginStreamsList, 4, "plugin");
|
||||
InitVagStreamList(&g_EEStreamsList, 4, "ee");
|
||||
InitVagStreamList(&g_EEPlayList, 8, "play");
|
||||
InitVagStreamList(&g_RequestedStreamsList, 8, "streams");
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
|
||||
#include "989_plugins/plugin_strv.h"
|
||||
#include "game/overlord/jak3/iso.h"
|
||||
#include "game/overlord/jak3/vag.h"
|
||||
#include "game/sce/iop.h"
|
||||
@@ -15,11 +16,13 @@ List g_RequestedStreamsList;
|
||||
List g_NewStreamsList;
|
||||
List g_EEStreamsList;
|
||||
List g_EEPlayList;
|
||||
List g_PluginStreamsList;
|
||||
void jak3_overlord_init_globals_streamlist() {
|
||||
g_RequestedStreamsList = {};
|
||||
g_NewStreamsList = {};
|
||||
g_EEStreamsList = {};
|
||||
g_EEPlayList = {};
|
||||
g_PluginStreamsList = {};
|
||||
}
|
||||
|
||||
void InitVagStreamList(List* list, int size, const char* name) {
|
||||
@@ -176,6 +179,7 @@ VagStreamData* InsertVagStreamInList(VagStreamData* user_stream, List* list) {
|
||||
free_elt->volume2 = user_stream->volume2;
|
||||
free_elt->maybe_volume_3 = user_stream->maybe_volume_3;
|
||||
free_elt->group = user_stream->group;
|
||||
free_elt->pan = user_stream->pan;
|
||||
free_elt->unk1 = 0;
|
||||
if (pVVar12 == (VagStreamData*)0x0) {
|
||||
if (free_elt == pVVar10) {
|
||||
@@ -316,13 +320,15 @@ code_r0x0000ffc4:
|
||||
}
|
||||
|
||||
void StreamListThread() {
|
||||
HandlePluginRequests();
|
||||
|
||||
if (g_RequestedStreamsList.pending_data == 0) {
|
||||
WaitSema(g_RequestedStreamsList.sema);
|
||||
EmptyVagStreamList(&g_RequestedStreamsList);
|
||||
g_RequestedStreamsList.unk_flag = 0;
|
||||
// WaitSema(DAT_00015dd0);
|
||||
// MergeVagStreamLists((List*)&g_PluginStreamsList, &g_RequestedStreamsList);
|
||||
// SignalSema(DAT_00015dd0);
|
||||
WaitSema(g_PluginStreamsList.sema);
|
||||
MergeVagStreamLists(&g_PluginStreamsList, &g_RequestedStreamsList);
|
||||
SignalSema(g_PluginStreamsList.sema);
|
||||
WaitSema(g_EEStreamsList.sema);
|
||||
MergeVagStreamLists(&g_EEStreamsList, &g_RequestedStreamsList);
|
||||
SignalSema(g_EEStreamsList.sema);
|
||||
|
||||
@@ -11,6 +11,7 @@ extern List g_RequestedStreamsList;
|
||||
extern List g_NewStreamsList;
|
||||
extern List g_EEStreamsList;
|
||||
extern List g_EEPlayList;
|
||||
extern List g_PluginStreamsList;
|
||||
|
||||
void QueueNewStreamsFromList(List* list);
|
||||
void RemoveVagStreamFromList(VagStreamData* entry, List* list);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "game/overlord/jak3/streamlist.h"
|
||||
#include "game/sce/iop.h"
|
||||
#include "game/sound/sdshim.h"
|
||||
#include "game/sound/sndshim.h"
|
||||
|
||||
#define VOICE_BIT(voice) (1 << ((voice) >> 1))
|
||||
|
||||
@@ -518,10 +519,9 @@ void TerminateVAG(ISO_VAGCommand* in_cmd) {
|
||||
}
|
||||
if (not_music) {
|
||||
if (in_cmd->maybe_sound_handler != 0) {
|
||||
RemoveVagStreamFromList(&vsd, &g_PluginStreamsList);
|
||||
// TODO LFO support
|
||||
// RemoveVagStreamFromList(&vsd, &g_PluginStreamsList);
|
||||
// RemoveLfoStreamFromList(auStack64, &g_LfoStreamsList);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
RemoveVagStreamFromList(&vsd, &g_EEPlayList);
|
||||
}
|
||||
@@ -845,7 +845,23 @@ void CalculateVAGVolumes(ISO_VAGCommand* cmd, int* lvol, int* rvol) {
|
||||
}
|
||||
uVar7 = uVar7 << 4 | uVar7 >> 6;
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
s32 group = snd_GetSoundGroup(cmd->id) & 0x1f;
|
||||
u32 vol = 0x3fff * (u32)((cmd->play_volume * g_anMasterVolume[group]) >> 10);
|
||||
s32 pan_angle = (cmd->dolby_pan_angle + 90) % 360;
|
||||
if (pan_angle < 0) {
|
||||
pan_angle += 360;
|
||||
}
|
||||
s32 l = (g_aPanTable[pan_angle].left * (s32)(vol >> 10)) >> 10;
|
||||
s32 r = (g_aPanTable[pan_angle].right * (s32)(vol >> 10)) >> 10;
|
||||
if (l >= 0x4000) {
|
||||
l = 0x3fff;
|
||||
}
|
||||
if (r >= 0x4000) {
|
||||
r = 0x3fff;
|
||||
}
|
||||
*lvol = l;
|
||||
*rvol = r;
|
||||
return;
|
||||
}
|
||||
|
||||
if (iVar9 == 1) {
|
||||
@@ -1024,9 +1040,7 @@ void SetAllVagsVol(int x) {
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (g_aVagCmds[i].maybe_sound_handler) {
|
||||
ASSERT_NOT_REACHED();
|
||||
// there's more check before this...
|
||||
if (g_aVagCmds[i].maybe_sound_handler && (snd_GetSoundGroup(g_aVagCmds[i].id) & 0x1f) == x) {
|
||||
SetVAGVol(&g_aVagCmds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ struct VagStreamData {
|
||||
int volume2;
|
||||
int maybe_volume_3;
|
||||
int group;
|
||||
int pan;
|
||||
};
|
||||
|
||||
extern ISO_VAGCommand g_aVagCmds[6];
|
||||
|
||||
@@ -17,7 +17,8 @@ BlockSoundHandler::BlockSoundHandler(SoundBank& bank,
|
||||
s32 sfx_pan,
|
||||
SndPlayParams& params,
|
||||
u32 sound_id,
|
||||
s32 start_tick)
|
||||
s32 start_tick,
|
||||
u32 owner)
|
||||
: m_group(sfx.VolGroup),
|
||||
m_sfx(&sfx),
|
||||
m_orig_sfx(&sfx),
|
||||
@@ -25,6 +26,8 @@ BlockSoundHandler::BlockSoundHandler(SoundBank& bank,
|
||||
m_bank(bank),
|
||||
m_sound_id(sound_id),
|
||||
m_start_tick(start_tick) {
|
||||
m_sound_handle = owner;
|
||||
|
||||
s32 vol, pan, pitch_mod, pitch_bend;
|
||||
if (sfx_vol == -1) {
|
||||
sfx_vol = sfx.Vol;
|
||||
|
||||
@@ -27,7 +27,8 @@ class BlockSoundHandler : public SoundHandler {
|
||||
s32 sfx_pan,
|
||||
SndPlayParams& params,
|
||||
u32 sound_id,
|
||||
s32 start_tick);
|
||||
s32 start_tick,
|
||||
u32 owner);
|
||||
|
||||
~BlockSoundHandler() override;
|
||||
bool Tick() override;
|
||||
|
||||
@@ -7,8 +7,14 @@
|
||||
|
||||
namespace snd {
|
||||
|
||||
std::optional<std::unique_ptr<SoundHandler>>
|
||||
MusicBank::MakeHandler(VoiceManager& vm, u32 sound_id, s32 vol, s32 pan, s32 pm, s32 pb, s32 tick) {
|
||||
std::optional<std::unique_ptr<SoundHandler>> MusicBank::MakeHandler(VoiceManager& vm,
|
||||
u32 sound_id,
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
s32 pm,
|
||||
s32 pb,
|
||||
s32 tick,
|
||||
u32 owner) {
|
||||
auto& sound = Sounds[sound_id];
|
||||
|
||||
// FIXME: global midi list
|
||||
@@ -39,7 +45,8 @@ std::optional<std::unique_ptr<SoundHandler>> MusicBank::MakeHandler(VoiceManager
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
SndPlayParams& params,
|
||||
s32 tick) {
|
||||
s32 tick,
|
||||
u32 owner) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,14 +66,21 @@ class MusicBank : public SoundBank {
|
||||
std::span<u8> samples,
|
||||
std::span<u8> midi_data);
|
||||
|
||||
std::optional<std::unique_ptr<SoundHandler>>
|
||||
MakeHandler(VoiceManager& vm, u32 sound_id, s32 vol, s32 pan, s32 pm, s32 pb, s32 tick) override;
|
||||
std::optional<std::unique_ptr<SoundHandler>> MakeHandler(VoiceManager& vm,
|
||||
u32 sound_id,
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
s32 pm,
|
||||
s32 pb,
|
||||
s32 tick,
|
||||
u32 owner) override;
|
||||
|
||||
std::optional<std::unique_ptr<SoundHandler>> MakeHandler(VoiceManager& vm,
|
||||
u32 sound_id,
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
SndPlayParams& params,
|
||||
s32 tick) override;
|
||||
s32 tick,
|
||||
u32 owner) override;
|
||||
};
|
||||
} // namespace snd
|
||||
|
||||
@@ -137,7 +137,8 @@ u32 Player::PlaySound(BankHandle bank_id, u32 sound_id, s32 vol, s32 pan, s32 pm
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto handler = bank->MakeHandler(mVmanager, sound_id, vol, pan, pm, pb, GetTick());
|
||||
u32 handle = mHandleAllocator.GetId();
|
||||
auto handler = bank->MakeHandler(mVmanager, sound_id, vol, pan, pm, pb, GetTick(), handle);
|
||||
if (!handler.has_value()) {
|
||||
return 0;
|
||||
}
|
||||
@@ -150,7 +151,7 @@ u32 Player::PlaySound(BankHandle bank_id, u32 sound_id, s32 vol, s32 pan, s32 pm
|
||||
}
|
||||
}
|
||||
|
||||
u32 handle = mHandleAllocator.GetId();
|
||||
handler.value()->m_sound_handle = handle;
|
||||
mHandlers.emplace(handle, std::move(handler.value()));
|
||||
// fmt::print("play_sound {}:{} - {}\n", bank_id, sound_id, handle);
|
||||
|
||||
@@ -230,6 +231,15 @@ void Player::SetSoundReg(u32 sound_id, u8 reg, u8 value) {
|
||||
handler->SetRegister(reg, value);
|
||||
}
|
||||
|
||||
u8 Player::GetSoundGroup(u32 sound_id) {
|
||||
std::scoped_lock lock(mTickLock);
|
||||
auto handler = mHandlers.find(sound_id);
|
||||
if (handler == mHandlers.end()) {
|
||||
return 0;
|
||||
}
|
||||
return handler->second->Group();
|
||||
}
|
||||
|
||||
bool Player::SoundStillActive(u32 sound_id) {
|
||||
std::scoped_lock lock(mTickLock);
|
||||
auto handler = mHandlers.find(sound_id);
|
||||
|
||||
@@ -44,6 +44,7 @@ class Player {
|
||||
s32 pb);
|
||||
void DebugPrintAllSoundsInBank(BankHandle bank);
|
||||
void SetSoundReg(u32 sound_id, u8 reg, u8 value);
|
||||
u8 GetSoundGroup(u32 sound_id);
|
||||
void SetGlobalExcite(u8 value) { GlobalExcite = value; };
|
||||
bool SoundStillActive(u32 sound_id);
|
||||
void SetMasterVolume(u32 group, s32 volume);
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "plugin.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "common/log/log.h"
|
||||
|
||||
namespace snd {
|
||||
|
||||
namespace {
|
||||
PluginHandler g_plugin_handler = nullptr;
|
||||
|
||||
s32 LogPluginMessage(u32 id,
|
||||
u32 index,
|
||||
u32 owner,
|
||||
const u8* data,
|
||||
const s8* /*regs*/,
|
||||
s32 /*cur_vol*/) {
|
||||
char id_str[4] = {static_cast<char>(id >> 24), static_cast<char>(id >> 16),
|
||||
static_cast<char>(id >> 8), static_cast<char>(id)};
|
||||
switch (id) {
|
||||
case VAG_STREAM_PLUGIN_ID: {
|
||||
// skip SetVagStreamVolume so it doesn't spam logs
|
||||
if (index == 5) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
VagStreamPluginData msg{};
|
||||
memcpy(&msg, data, sizeof(msg));
|
||||
char name[9] = {};
|
||||
memcpy(name, msg.name, 8);
|
||||
|
||||
lg::info("989snd plugin: {} index={} owner={} name='{}' prio={} vol={} pan={} use_regs={}",
|
||||
std::string_view(id_str, 4), index, owner, name, msg.priority, msg.vol, msg.pan,
|
||||
msg.use_regs);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
lg::info("989snd plugin: unhandled id={} ({:#x}) index={} owner={}",
|
||||
std::string_view(id_str, 4), id, index, owner);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void RegisterPluginHandler(PluginHandler handler) {
|
||||
g_plugin_handler = handler;
|
||||
}
|
||||
|
||||
s32 HandlePluginMessage(u32 id, u32 index, u32 owner, const u8* data, const s8* regs, s32 cur_vol) {
|
||||
if (g_plugin_handler) {
|
||||
// LogPluginMessage(id, index, owner, data, regs, cur_vol);
|
||||
return g_plugin_handler(id, index, owner, data, regs, cur_vol);
|
||||
}
|
||||
// default handler
|
||||
return LogPluginMessage(id, index, owner, data, regs, cur_vol);
|
||||
}
|
||||
|
||||
} // namespace snd
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace snd {
|
||||
using PluginHandler =
|
||||
s32 (*)(u32 id, u32 index, u32 owner, const u8* data, const s8* regs, s32 cur_vol);
|
||||
|
||||
constexpr u32 VAG_STREAM_PLUGIN_ID = 0x53545256; // 'STRV'
|
||||
|
||||
struct VagStreamPluginData {
|
||||
char name[8];
|
||||
u32 priority;
|
||||
u32 vol;
|
||||
u32 pan;
|
||||
u32 use_regs;
|
||||
};
|
||||
static_assert(sizeof(VagStreamPluginData) == 24);
|
||||
|
||||
void RegisterPluginHandler(PluginHandler handler);
|
||||
s32 HandlePluginMessage(u32 id, u32 index, u32 owner, const u8* data, const s8* regs, s32 cur_vol);
|
||||
|
||||
} // namespace snd
|
||||
@@ -14,15 +14,16 @@ std::optional<std::unique_ptr<SoundHandler>> SFXBlock::MakeHandler(VoiceManager&
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
SndPlayParams& params,
|
||||
s32 current_tick) {
|
||||
s32 current_tick,
|
||||
u32 owner) {
|
||||
auto& SFX = Sounds[sound_id];
|
||||
|
||||
if (SFX.Grains.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto handler =
|
||||
std::make_unique<BlockSoundHandler>(*this, SFX, vm, vol, pan, params, sound_id, current_tick);
|
||||
auto handler = std::make_unique<BlockSoundHandler>(*this, SFX, vm, vol, pan, params, sound_id,
|
||||
current_tick, owner);
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@ class SFXBlock : public SoundBank {
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
SndPlayParams& params,
|
||||
s32 current_tick) override;
|
||||
s32 current_tick,
|
||||
u32 owner) override;
|
||||
|
||||
std::optional<std::string_view> GetName() override { return Name; };
|
||||
std::optional<u32> GetSoundByName(const char* name) override;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "blocksound_handler.h"
|
||||
#include "lfo.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include "common/log/log.h"
|
||||
|
||||
@@ -158,8 +159,8 @@ s32 Grain::snd_SFX_GRAIN_TYPE_STARTCHILDSOUND(BlockSoundHandler& handler) {
|
||||
s32 index = psp.sound_id;
|
||||
|
||||
if (index >= 0) {
|
||||
auto child_handler =
|
||||
block.MakeHandler(handler.m_vm, index, vol, pan, params, handler.m_start_tick);
|
||||
auto child_handler = block.MakeHandler(handler.m_vm, index, vol, pan, params,
|
||||
handler.m_start_tick, handler.m_sound_handle);
|
||||
if (child_handler.has_value()) {
|
||||
handler.m_children.emplace_front(std::move(child_handler.value()));
|
||||
}
|
||||
@@ -195,9 +196,9 @@ s32 Grain::snd_SFX_GRAIN_TYPE_STOPCHILDSOUND(BlockSoundHandler& handler) {
|
||||
}
|
||||
|
||||
s32 Grain::snd_SFX_GRAIN_TYPE_PLUGIN_MESSAGE(BlockSoundHandler& handler) {
|
||||
// lg::warn("plugin message");
|
||||
// TODO probably used
|
||||
return 0;
|
||||
auto& pp = std::get<PluginParams>(data);
|
||||
return HandlePluginMessage(pp.id, pp.index, handler.m_sound_handle, pp.data,
|
||||
handler.m_registers.data(), handler.m_cur_volume);
|
||||
}
|
||||
|
||||
s32 Grain::snd_SFX_GRAIN_TYPE_BRANCH(BlockSoundHandler& handler) {
|
||||
|
||||
@@ -29,6 +29,8 @@ class SoundHandler {
|
||||
virtual void SetRegister(u8 /*reg*/, u8 /*value*/) {}
|
||||
virtual u32 SoundID() const { return -1; }
|
||||
|
||||
u32 m_sound_handle = 0;
|
||||
|
||||
// Check if this handler violates an instance limit. If so, return pointer to the sound that
|
||||
// should be removed.
|
||||
virtual SoundHandler* CheckInstanceLimit(
|
||||
|
||||
@@ -54,15 +54,21 @@ class SoundBank {
|
||||
u32 BankID;
|
||||
s8 BankNum;
|
||||
|
||||
virtual std::optional<std::unique_ptr<SoundHandler>>
|
||||
MakeHandler(VoiceManager& vm, u32 sound_id, s32 vol, s32 pan, s32 pm, s32 pb, s32 current_tick) {
|
||||
virtual std::optional<std::unique_ptr<SoundHandler>> MakeHandler(VoiceManager& vm,
|
||||
u32 sound_id,
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
s32 pm,
|
||||
s32 pb,
|
||||
s32 current_tick,
|
||||
u32 owner) {
|
||||
SndPlayParams params{};
|
||||
params.vol = vol;
|
||||
params.pan = pan;
|
||||
params.pitch_mod = pm;
|
||||
params.pitch_bend = pb;
|
||||
|
||||
return MakeHandler(vm, sound_id, -1, -1, params, current_tick);
|
||||
return MakeHandler(vm, sound_id, -1, -1, params, current_tick, owner);
|
||||
};
|
||||
|
||||
virtual std::optional<std::unique_ptr<SoundHandler>> MakeHandler(VoiceManager& vm,
|
||||
@@ -70,7 +76,8 @@ class SoundBank {
|
||||
s32 vol,
|
||||
s32 pan,
|
||||
SndPlayParams& params,
|
||||
s32 current_tick) = 0;
|
||||
s32 current_tick,
|
||||
u32 owner) = 0;
|
||||
|
||||
virtual std::optional<std::string_view> GetName() { return std::nullopt; };
|
||||
virtual std::optional<u32> GetSoundByName(const char* /*name*/) { return std::nullopt; };
|
||||
|
||||
@@ -6,6 +6,7 @@ set(SOUND_SOURCES
|
||||
989snd/musicbank.cpp
|
||||
989snd/sfxblock.cpp
|
||||
989snd/sfxgrain.cpp
|
||||
989snd/plugin.cpp
|
||||
989snd/loader.cpp
|
||||
989snd/vagvoice.cpp
|
||||
989snd/lfo.cpp
|
||||
|
||||
@@ -288,6 +288,17 @@ void snd_SetSoundReg(s32 sound_handle, s32 which, u8 val) {
|
||||
}
|
||||
}
|
||||
|
||||
s8 snd_GetSoundGroup(s32 sound_handle) {
|
||||
if (player) {
|
||||
return player->GetSoundGroup(sound_handle);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void snd_RegisterPluginHandler(snd::PluginHandler handler) {
|
||||
snd::RegisterPluginHandler(handler);
|
||||
}
|
||||
|
||||
void snd_SetGlobalExcite(u8 value) {
|
||||
if (player) {
|
||||
player->SetGlobalExcite(value);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#pragma once
|
||||
#include "common/common_types.h"
|
||||
|
||||
#include "game/sound/989snd/plugin.h"
|
||||
|
||||
constexpr int SND_CORE_0 = 1;
|
||||
constexpr int SND_CORE_1 = 2;
|
||||
constexpr int SD_REV_MODE_OFF = 0;
|
||||
@@ -86,3 +88,5 @@ s32 snd_GetSoundUserData(snd::BankHandle block_handle,
|
||||
char* sound_name,
|
||||
SFXUserData* dst);
|
||||
void snd_SetSoundReg(s32 sound_handle, s32 which, u8 val);
|
||||
s8 snd_GetSoundGroup(s32 sound_handle);
|
||||
void snd_RegisterPluginHandler(snd::PluginHandler handler);
|
||||
|
||||
Reference in New Issue
Block a user