diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index d845e6a9a7..a1cb4d0e98 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -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"], diff --git a/decompiler/config/jakx/ntsc_v1/hacks.jsonc b/decompiler/config/jakx/ntsc_v1/hacks.jsonc index edd527a918..af32442c39 100644 --- a/decompiler/config/jakx/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jakx/ntsc_v1/hacks.jsonc @@ -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": [] -} \ No newline at end of file +} diff --git a/decompiler/config/jakx/ntsc_v1/label_types.jsonc b/decompiler/config/jakx/ntsc_v1/label_types.jsonc index aedab6fa36..c07855ac0b 100644 --- a/decompiler/config/jakx/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jakx/ntsc_v1/label_types.jsonc @@ -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 - ] - ] -} \ No newline at end of file + "kras-part": [["L137", "(pointer rgba)", 8]] +} diff --git a/decompiler/config/jakx/ntsc_v1/stack_structures.jsonc b/decompiler/config/jakx/ntsc_v1/stack_structures.jsonc index 77ad0cd951..3331a04a39 100644 --- a/decompiler/config/jakx/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jakx/ntsc_v1/stack_structures.jsonc @@ -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" - ] - ] -} \ No newline at end of file + "ptest": [[16, "vector"]], + "check-drop-level-rain": [[16, "vector"]], + "spt-func-rocket": [[16, "vector"]] +} diff --git a/decompiler/config/jakx/ntsc_v1/type_casts.jsonc b/decompiler/config/jakx/ntsc_v1/type_casts.jsonc index 87501746c6..3c6579bb68 100644 --- a/decompiler/config/jakx/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jakx/ntsc_v1/type_casts.jsonc @@ -1,2388 +1,511 @@ { - "entity-actor-count": [ - [ - "_stack_", - 16, - "res-tag" - ] - ], - "entity-actor-lookup": [ - [ - "_stack_", - 16, - "res-tag" - ] - ], + "entity-actor-count": [["_stack_", 16, "res-tag"]], + "entity-actor-lookup": [["_stack_", 16, "res-tag"]], "build-masks": [ - [ - [ - 18, - 22 - ], - "a1", - "drawable-tree-tfrag" - ], - [ - 24, - "a2", - "drawable-inline-array-tfrag" - ], - [ - [ - 27, - 31 - ], - "a2", - "(inline-array tfragment)" - ], - [ - [ - 38, - 42 - ], - "a1", - "drawable-tree-tfrag-trans" - ], - [ - 44, - "a2", - "drawable-inline-array-tfrag" - ], - [ - [ - 47, - 51 - ], - "a2", - "(inline-array tfragment)" - ], - [ - [ - 58, - 62 - ], - "a1", - "drawable-tree-tfrag-water" - ], - [ - 64, - "a2", - "drawable-inline-array-tfrag" - ], - [ - [ - 67, - 71 - ], - "a2", - "(inline-array tfragment)" - ], - [ - [ - 78, - 79 - ], - "a1", - "drawable-tree-instance-tie" - ], - [ - 123, - "a1", - "drawable-tree-instance-shrub" - ], - [ - [ - 129, - 133 - ], - "a2", - "(inline-array prototype-bucket-shrub)" - ] + [[18, 22], "a1", "drawable-tree-tfrag"], + [24, "a2", "drawable-inline-array-tfrag"], + [[27, 31], "a2", "(inline-array tfragment)"], + [[38, 42], "a1", "drawable-tree-tfrag-trans"], + [44, "a2", "drawable-inline-array-tfrag"], + [[47, 51], "a2", "(inline-array tfragment)"], + [[58, 62], "a1", "drawable-tree-tfrag-water"], + [64, "a2", "drawable-inline-array-tfrag"], + [[67, 71], "a2", "(inline-array tfragment)"], + [[78, 79], "a1", "drawable-tree-instance-tie"], + [123, "a1", "drawable-tree-instance-shrub"], + [[129, 133], "a2", "(inline-array prototype-bucket-shrub)"] ], "cam-layout-function-call": [ - [ - 15, - "gp", - "(function string int basic object)" - ] - ], - "cam-layout-save-cam-rot": [ - [ - 13, - "v0", - "vector" - ] - ], - "cam-layout-save-campointsoffset": [ - [ - 12, - "v0", - "vector" - ] + [15, "gp", "(function string int basic object)"] ], + "cam-layout-save-cam-rot": [[13, "v0", "vector"]], + "cam-layout-save-campointsoffset": [[12, "v0", "vector"]], "cam-layout-save-splineoffset": [ - [ - 37, - "v0", - "vector" - ], - [ - 25, - "v0", - "vector" - ] - ], - "clmf-save-all": [ - [ - 18, - "v1", - "connection" - ] + [37, "v0", "vector"], + [25, "v0", "vector"] ], + "clmf-save-all": [[18, "v1", "connection"]], "execute-cam-post-hook-engine": [ - [ - 8, - "s5", - "connection" - ], - [ - [ - 14, - 17 - ], - "s5", - "connection" - ], - [ - 18, - "t9", - "(function object object object object object)" - ], - [ - 9, - "s5", - "connection" - ] + [8, "s5", "connection"], + [[14, 17], "s5", "connection"], + [18, "t9", "(function object object object object object)"], + [9, "s5", "connection"] ], "collide-list-fill-bg-using-box": [ - [ - 223, - "a0", - "collide-hash-scratch" - ], - [ - 255, - "a0", - "collide-hash-scratch" - ], - [ - 208, - "v1", - "collide-hash-scratch" - ], - [ - 210, - "v1", - "collide-hash-scratch" - ], - [ - 212, - "v1", - "collide-hash-scratch" - ], - [ - 241, - "v1", - "collide-hash-scratch" - ], - [ - 243, - "v1", - "collide-hash-scratch" - ], - [ - 246, - "v1", - "collide-hash-scratch" - ] + [223, "a0", "collide-hash-scratch"], + [255, "a0", "collide-hash-scratch"], + [208, "v1", "collide-hash-scratch"], + [210, "v1", "collide-hash-scratch"], + [212, "v1", "collide-hash-scratch"], + [241, "v1", "collide-hash-scratch"], + [243, "v1", "collide-hash-scratch"], + [246, "v1", "collide-hash-scratch"] ], "collide-list-fill-bg-using-line-sphere": [ - [ - 287, - "a0", - "collide-hash-scratch" - ], - [ - [ - 272, - 280 - ], - "v1", - "collide-hash-scratch" - ], - [ - [ - 239, - 246 - ], - "v1", - "collide-hash-scratch" - ], - [ - 255, - "a0", - "collide-hash-scratch" - ], - [ - 102, - "v1", - "float" - ] + [287, "a0", "collide-hash-scratch"], + [[272, 280], "v1", "collide-hash-scratch"], + [[239, 246], "v1", "collide-hash-scratch"], + [255, "a0", "collide-hash-scratch"], + [102, "v1", "float"] ], "(method 0 collide-shape-prim-group)": [ - [ - [ - 6, - 12 - ], - "v0", - "collide-shape-prim-group" - ] + [[6, 12], "v0", "collide-shape-prim-group"] ], "(method 0 collide-shape-prim-mesh)": [ - [ - [ - 6, - 11 - ], - "v0", - "collide-shape-prim-mesh" - ] + [[6, 11], "v0", "collide-shape-prim-mesh"] ], "(method 0 collide-shape-prim-sphere)": [ - [ - [ - 5, - 8 - ], - "v0", - "collide-shape-prim-sphere" - ] - ], - "(method 10 touching-list)": [ - [ - [ - 5, - 11 - ], - "s5", - "touching-shapes-entry" - ] + [[5, 8], "v0", "collide-shape-prim-sphere"] ], + "(method 10 touching-list)": [[[5, 11], "s5", "touching-shapes-entry"]], "(method 11 touching-list)": [ - [ - 8, - "s5", - "touching-shapes-entry" - ], - [ - 11, - "s5", - "touching-shapes-entry" - ], - [ - 13, - "s5", - "touching-shapes-entry" - ], - [ - 48, - "s5", - "touching-shapes-entry" - ], - [ - 52, - "s5", - "touching-shapes-entry" - ], - [ - 10, - "s5", - "touching-shapes-entry" - ], - [ - 33, - "s5", - "touching-shapes-entry" - ], - [ - 50, - "s5", - "touching-shapes-entry" - ] - ], - "(method 0 touching-list)": [ - [ - [ - 6, - 8 - ], - "v0", - "touching-list" - ] + [8, "s5", "touching-shapes-entry"], + [11, "s5", "touching-shapes-entry"], + [13, "s5", "touching-shapes-entry"], + [48, "s5", "touching-shapes-entry"], + [52, "s5", "touching-shapes-entry"], + [10, "s5", "touching-shapes-entry"], + [33, "s5", "touching-shapes-entry"], + [50, "s5", "touching-shapes-entry"] ], + "(method 0 touching-list)": [[[6, 8], "v0", "touching-list"]], "(method 11 touching-prims-entry-pool)": [ - [ - [ - 0, - 8 - ], - "v1", - "touching-prims-entry" - ], - [ - 8, - "v1", - "pointer" - ], - [ - [ - 9, - 11 - ], - "v1", - "touching-prims-entry" - ], - [ - [ - 1, - 20 - ], - "a1", - "touching-prims-entry" - ] + [[0, 8], "v1", "touching-prims-entry"], + [8, "v1", "pointer"], + [[9, 11], "v1", "touching-prims-entry"], + [[1, 20], "a1", "touching-prims-entry"] ], "(method 0 engine)": [ - [ - 44, - "v1", - "pointer" - ], - [ - 47, - "v1", - "pointer" - ], - [ - 53, - "v1", - "connectable" - ], - [ - 65, - "v1", - "connectable" - ] + [44, "v1", "pointer"], + [47, "v1", "pointer"], + [53, "v1", "connectable"], + [65, "v1", "connectable"] ], "(method 0 engine-pers)": [ - [ - 32, - "v1", - "pointer" - ], - [ - 23, - "v1", - "pointer" - ], - [ - 26, - "v1", - "pointer" - ], - [ - 24, - "v1", - "(pointer pointer)" - ] - ], - "(method 11 connection)": [ - [ - 5, - "a1", - "pointer" - ] + [32, "v1", "pointer"], + [23, "v1", "pointer"], + [26, "v1", "pointer"], + [24, "v1", "(pointer pointer)"] ], + "(method 11 connection)": [[5, "a1", "pointer"]], "(method 12 engine)": [ - [ - [ - 0, - 25 - ], - "s4", - "connection" - ], - [ - 13, - "t9", - "(function object object object object object)" - ] + [[0, 25], "s4", "connection"], + [13, "t9", "(function object object object object object)"] ], "(method 13 engine)": [ - [ - [ - 0, - 25 - ], - "s4", - "connection" - ], - [ - 13, - "t9", - "(function object object object object object)" - ] - ], - "(method 19 engine)": [ - [ - 8, - "a0", - "connection" - ] - ], - "(method 20 engine)": [ - [ - 8, - "a0", - "connection" - ] - ], - "(method 21 engine)": [ - [ - 8, - "a0", - "connection" - ] - ], - "(method 3 connection-pers)": [ - [ - 97, - "f0", - "float" - ] - ], - "(method 9 connection)": [ - [ - 8, - "a0", - "pointer" - ] - ], - "drawable-frag-count": [ - [ - [ - 14, - 20 - ], - "s5", - "drawable-group" - ] + [[0, 25], "s4", "connection"], + [13, "t9", "(function object object object object object)"] ], + "(method 19 engine)": [[8, "a0", "connection"]], + "(method 20 engine)": [[8, "a0", "connection"]], + "(method 21 engine)": [[8, "a0", "connection"]], + "(method 3 connection-pers)": [[97, "f0", "float"]], + "(method 9 connection)": [[8, "a0", "pointer"]], + "drawable-frag-count": [[[14, 20], "s5", "drawable-group"]], "add-debug-sphere-from-table": [ - [ - [ - 38, - 41 - ], - "v1", - "vector" - ], - [ - [ - 55, - 59 - ], - "s0", - "(inline-array vector)" - ] - ], - "unpack-comp-huf": [ - [ - [ - 21, - 23 - ], - "t3", - "(pointer uint16)" - ] - ], - "unpack-comp-rle": [ - [ - [ - 10, - 26 - ], - "a0", - "(pointer int8)" - ] + [[38, 41], "v1", "vector"], + [[55, 59], "s0", "(inline-array vector)"] ], + "unpack-comp-huf": [[[21, 23], "t3", "(pointer uint16)"]], + "unpack-comp-rle": [[[10, 26], "a0", "(pointer int8)"]], "dma-bucket-insert-tag": [ - [ - [ - 2, - 6 - ], - "v1", - "dma-bucket" - ], - [ - 3, - "a0", - "dma-bucket" - ] + [[2, 6], "v1", "dma-bucket"], + [3, "a0", "dma-bucket"] ], "dma-buffer-add-buckets": [ - [ - [ - 1, - 4 - ], - "v1", - "dma-bucket" - ], - [ - 5, - "v1", - "pointer" - ], - [ - [ - 9, - 11 - ], - "v1", - "dma-bucket" - ], - [ - 11, - "v1", - "pointer" - ] + [[1, 4], "v1", "dma-bucket"], + [5, "v1", "pointer"], + [[9, 11], "v1", "dma-bucket"], + [11, "v1", "pointer"] ], "dma-buffer-patch-buckets": [ - [ - [ - 3, - 34 - ], - "a0", - "dma-bucket" - ], - [ - [ - 34, - 38 - ], - "a0", - "dma-packet" - ] + [[3, 34], "a0", "dma-bucket"], + [[34, 38], "a0", "dma-packet"] ], "disasm-dma-list": [ - [ - 43, - "v1", - "dma-packet" - ], - [ - 266, - "v1", - "(pointer uint64)" - ], - [ - 272, - "v1", - "(pointer uint64)" - ], - [ - 133, - "v1", - "(pointer uint64)" - ], - [ - 152, - "v1", - "(pointer uint64)" - ], - [ - 167, - "v1", - "(pointer uint64)" - ], - [ - 176, - "v1", - "(pointer uint64)" - ], - [ - 198, - "v1", - "(pointer uint64)" - ], - [ - 207, - "v1", - "(pointer uint64)" - ], - [ - 238, - "v1", - "(pointer uint64)" - ], - [ - 247, - "v1", - "(pointer uint64)" - ], - [ - 282, - "v1", - "(pointer uint64)" - ], - [ - 291, - "v1", - "(pointer uint64)" - ], - [ - 324, - "v1", - "(pointer uint64)" - ], - [ - 334, - "v1", - "(pointer uint64)" - ], - [ - 141, - "v1", - "int" - ], - [ - 25, - "v1", - "dma-tag" - ], - [ - "_stack_", - 16, - "uint" - ], - [ - "_stack_", - 32, - "dma-packet" - ], - [ - "_stack_", - 64, - "dma-packet" - ], - [ - "_stack_", - 80, - "dma-packet" - ] - ], - "(method 16 drawable-inline-array-node)": [ - [ - [ - 1, - 7 - ], - "v1", - "draw-node" - ] + [43, "v1", "dma-packet"], + [266, "v1", "(pointer uint64)"], + [272, "v1", "(pointer uint64)"], + [133, "v1", "(pointer uint64)"], + [152, "v1", "(pointer uint64)"], + [167, "v1", "(pointer uint64)"], + [176, "v1", "(pointer uint64)"], + [198, "v1", "(pointer uint64)"], + [207, "v1", "(pointer uint64)"], + [238, "v1", "(pointer uint64)"], + [247, "v1", "(pointer uint64)"], + [282, "v1", "(pointer uint64)"], + [291, "v1", "(pointer uint64)"], + [324, "v1", "(pointer uint64)"], + [334, "v1", "(pointer uint64)"], + [141, "v1", "int"], + [25, "v1", "dma-tag"], + ["_stack_", 16, "uint"], + ["_stack_", 32, "dma-packet"], + ["_stack_", 64, "dma-packet"], + ["_stack_", 80, "dma-packet"] ], + "(method 16 drawable-inline-array-node)": [[[1, 7], "v1", "draw-node"]], "(method 15 drawable-tree)": [ - [ - [ - 1, - 4 - ], - "v1", - "drawable-inline-array-node" - ], - [ - [ - 29, - 34 - ], - "t0", - "drawable-inline-array-node" - ], - [ - [ - 28, - 32 - ], - "t2", - "drawable-inline-array-node" - ], - [ - [ - 42, - 46 - ], - "t2", - "(pointer int8)" - ] - ], - "glst-find-node-by-name": [ - [ - 6, - "s5", - "glst-named-node" - ] - ], - "glst-length-of-longest-name": [ - [ - 5, - "s5", - "glst-named-node" - ] - ], - "history-print": [ - [ - 20, - "a1", - "int" - ] + [[1, 4], "v1", "drawable-inline-array-node"], + [[29, 34], "t0", "drawable-inline-array-node"], + [[28, 32], "t2", "drawable-inline-array-node"], + [[42, 46], "t2", "(pointer int8)"] ], + "glst-find-node-by-name": [[6, "s5", "glst-named-node"]], + "glst-length-of-longest-name": [[5, "s5", "glst-named-node"]], + "history-print": [[20, "a1", "int"]], "joint-mod-foot-rot-handler": [ - [ - [ - 0, - 7 - ], - "s5", - "joint-mod" - ], - [ - [ - 35, - 152 - ], - "s5", - "joint-mod" - ] - ], - "joint-mod-joint-set-handler": [ - [ - [ - 2, - 23 - ], - "s4", - "joint-mod" - ] - ], - "joint-mod-joint-set-world-handler": [ - [ - [ - 6, - 197 - ], - "s5", - "joint-mod" - ] + [[0, 7], "s5", "joint-mod"], + [[35, 152], "s5", "joint-mod"] ], + "joint-mod-joint-set-handler": [[[2, 23], "s4", "joint-mod"]], + "joint-mod-joint-set-world-handler": [[[6, 197], "s5", "joint-mod"]], "joint-mod-polar-look-at-callback": [ - [ - [ - 0, - 363 - ], - "s5", - "joint-mod-polar-look-at" - ] - ], - "joint-mod-scale-handler": [ - [ - [ - 1, - 14 - ], - "s5", - "joint-mod" - ] + [[0, 363], "s5", "joint-mod-polar-look-at"] ], + "joint-mod-scale-handler": [[[1, 14], "s5", "joint-mod"]], "real-joint-mod-gun-look-at-handler": [ - [ - 1, - "v1", - "joint-mod" - ], - [ - 2, - "v1", - "joint-mod" - ] - ], - "joint-mod-blend-local-callback": [ - [ - [ - 1, - 28 - ], - "gp", - "joint-mod-blend-local" - ] - ], - "joint-mod-blend-world-callback": [ - [ - [ - 1, - 150 - ], - "gp", - "joint-mod-blend-world" - ] + [1, "v1", "joint-mod"], + [2, "v1", "joint-mod"] ], + "joint-mod-blend-local-callback": [[[1, 28], "gp", "joint-mod-blend-local"]], + "joint-mod-blend-world-callback": [[[1, 150], "gp", "joint-mod-blend-world"]], "joint-mod-rotate-world-callback": [ - [ - [ - 0, - 24 - ], - "s3", - "joint-mod-rotate-world" - ] - ], - "joint-mod-set-local-callback": [ - [ - [ - 1, - 24 - ], - "v1", - "joint-mod-set-local" - ] - ], - "joint-mod-set-world-callback": [ - [ - [ - 1, - 4 - ], - "v1", - "joint-mod-set-local" - ] + [[0, 24], "s3", "joint-mod-rotate-world"] ], + "joint-mod-set-local-callback": [[[1, 24], "v1", "joint-mod-set-local"]], + "joint-mod-set-world-callback": [[[1, 4], "v1", "joint-mod-set-local"]], "joint-mod-set-world-no-trans-callback": [ - [ - [ - 1, - 25 - ], - "s4", - "joint-mod-set-world-no-trans" - ] + [[1, 25], "s4", "joint-mod-set-world-no-trans"] ], "(method 15 lightning-bolt)": [ - [ - 47, - "v1", - "float" - ], - [ - 64, - "v1", - "float" - ] - ], - "(method 17 lightning-bolt)": [ - [ - 36, - "v1", - "float" - ] + [47, "v1", "float"], + [64, "v1", "float"] ], + "(method 17 lightning-bolt)": [[36, "v1", "float"]], "(method 20 lightning-bolt)": [ - [ - 15, - "v1", - "float" - ], - [ - 32, - "v1", - "float" - ] + [15, "v1", "float"], + [32, "v1", "float"] ], "(method 21 lightning-bolt)": [ - [ - 49, - "v1", - "float" - ], - [ - 77, - "v1", - "float" - ], - [ - "_stack_", - 32, - "float" - ] + [49, "v1", "float"], + [77, "v1", "float"], + ["_stack_", 32, "float"] ], "update-light-hash": [ - [ - [ - 234, - 239 - ], - "a1", - "light-hash-bucket" - ], - [ - [ - 207, - 211 - ], - "a0", - "light-hash-bucket" - ] - ], - "dgo-load-begin": [ - [ - [ - 19, - 43 - ], - "s1", - "load-dgo-msg" - ] - ], - "dgo-load-continue": [ - [ - [ - 5, - 23 - ], - "gp", - "load-dgo-msg" - ] - ], - "dgo-load-get-next": [ - [ - [ - 14, - 31 - ], - "v1", - "load-dgo-msg" - ] - ], - "str-ambient-play": [ - [ - [ - 7, - 20 - ], - "s5", - "play-chunk-msg" - ] - ], - "str-ambient-stop": [ - [ - [ - 7, - 20 - ], - "s5", - "play-chunk-msg" - ] - ], - "str-load": [ - [ - [ - 18, - 44 - ], - "s2", - "load-chunk-msg" - ] + [[234, 239], "a1", "light-hash-bucket"], + [[207, 211], "a0", "light-hash-bucket"] ], + "dgo-load-begin": [[[19, 43], "s1", "load-dgo-msg"]], + "dgo-load-continue": [[[5, 23], "gp", "load-dgo-msg"]], + "dgo-load-get-next": [[[14, 31], "v1", "load-dgo-msg"]], + "str-ambient-play": [[[7, 20], "s5", "play-chunk-msg"]], + "str-ambient-stop": [[[7, 20], "s5", "play-chunk-msg"]], + "str-load": [[[18, 44], "s2", "load-chunk-msg"]], "str-load-status": [ - [ - [ - 18, - 22 - ], - "v1", - "load-chunk-msg" - ], - [ - 26, - "v1", - "load-chunk-msg" - ] - ], - "str-play-async": [ - [ - [ - 7, - 40 - ], - "s2", - "play-chunk-msg" - ] - ], - "str-play-queue": [ - [ - [ - 7, - 98 - ], - "s4", - "play-chunk-msg" - ] - ], - "str-play-stop": [ - [ - [ - 7, - 36 - ], - "s4", - "play-chunk-msg" - ] + [[18, 22], "v1", "load-chunk-msg"], + [26, "v1", "load-chunk-msg"] ], + "str-play-async": [[[7, 40], "s2", "play-chunk-msg"]], + "str-play-queue": [[[7, 98], "s4", "play-chunk-msg"]], + "str-play-stop": [[[7, 36], "s4", "play-chunk-msg"]], "cube-root": [ - [ - 17, - "f0", - "float" - ], - [ - 17, - "f1", - "float" - ], - [ - 18, - "f0", - "float" - ], - [ - 18, - "f1", - "float" - ], - [ - [ - 23, - 32 - ], - "f0", - "float" - ] + [17, "f0", "float"], + [17, "f1", "float"], + [18, "f0", "float"], + [18, "f1", "float"], + [[23, 32], "f0", "float"] ], "log2f": [ - [ - 12, - "f0", - "float" - ], - [ - 12, - "f1", - "float" - ], - [ - 19, - "f0", - "float" - ], - [ - 19, - "f1", - "float" - ] + [12, "f0", "float"], + [12, "f1", "float"], + [19, "f0", "float"], + [19, "f1", "float"] ], "logf": [ - [ - 12, - "f0", - "float" - ], - [ - 12, - "f1", - "float" - ], - [ - 19, - "f0", - "float" - ], - [ - 19, - "f1", - "float" - ] + [12, "f0", "float"], + [12, "f1", "float"], + [19, "f0", "float"], + [19, "f1", "float"] ], "debug-menu-find-from-template": [ - [ - 9, - "s5", - "string" - ], - [ - 10, - "s4", - "debug-menu-item" - ], - [ - 18, - "s4", - "debug-menu-item-submenu" - ], - [ - 3, - "s5", - "debug-menu" - ] - ], - "debug-menu-func-decode": [ - [ - 18, - "a0", - "symbol" - ] + [9, "s5", "string"], + [10, "s4", "debug-menu-item"], + [18, "s4", "debug-menu-item-submenu"], + [3, "s5", "debug-menu"] ], + "debug-menu-func-decode": [[18, "a0", "symbol"]], "debug-menu-item-get-max-width": [ - [ - 5, - "a0", - "debug-menu-item-submenu" - ], - [ - 20, - "a0", - "debug-menu-item-var" - ] + [5, "a0", "debug-menu-item-submenu"], + [20, "a0", "debug-menu-item-var"] ], "debug-menu-item-var-joypad-handler": [ - [ - 206, - "a1", - "int" - ], - [ - 207, - "v1", - "int" - ] - ], - "debug-menu-item-var-make-float": [ - [ - 32, - "f0", - "int" - ] + [206, "a1", "int"], + [207, "v1", "int"] ], + "debug-menu-item-var-make-float": [[32, "f0", "int"]], "debug-menu-item-var-update-display-str": [ - [ - 48, - "v1", - "int" - ], - [ - 63, - "v1", - "int" - ], - [ - 68, - "v1", - "int" - ], - [ - 46, - "v1", - "int" - ], - [ - 45, - "v1", - "int" - ], - [ - 65, - "v1", - "int" - ], - [ - 66, - "v1", - "int" - ] - ], - "debug-menu-rebuild": [ - [ - 7, - "a0", - "debug-menu-item" - ] + [48, "v1", "int"], + [63, "v1", "int"], + [68, "v1", "int"], + [46, "v1", "int"], + [45, "v1", "int"], + [65, "v1", "int"], + [66, "v1", "int"] ], + "debug-menu-rebuild": [[7, "a0", "debug-menu-item"]], "debug-menu-send-msg": [ - [ - 17, - "s2", - "debug-menu-item-submenu" - ], - [ - 12, - "s2", - "debug-menu-item" - ] - ], - "(method 10 mysql-nav-node)": [ - [ - 4, - "v1", - "mysql-nav-edge" - ] + [17, "s2", "debug-menu-item-submenu"], + [12, "s2", "debug-menu-item"] ], + "(method 10 mysql-nav-node)": [[4, "v1", "mysql-nav-edge"]], "(method 19 mysql-nav-graph)": [ - [ - 42, - "a0", - "mysql-nav-edge" - ], - [ - 46, - "a0", - "mysql-nav-edge" - ], - [ - 60, - "a0", - "mysql-nav-edge" - ] + [42, "a0", "mysql-nav-edge"], + [46, "a0", "mysql-nav-edge"], + [60, "a0", "mysql-nav-edge"] ], "joint-channel-float-delete!": [ - [ - 7, - "a0", - "pointer" - ], - [ - 7, - "a1", - "pointer" - ] - ], - "num-func-chan": [ - [ - 7, - "v1", - "joint-control-channel" - ] - ], - "ramdisk-load": [ - [ - [ - 7, - 12 - ], - "v1", - "ramdisk-rpc-load" - ] - ], - "(method 15 res-lump)": [ - [ - 132, - "s5", - "res-tag-pair" - ] + [7, "a0", "pointer"], + [7, "a1", "pointer"] ], + "num-func-chan": [[7, "v1", "joint-control-channel"]], + "ramdisk-load": [[[7, 12], "v1", "ramdisk-rpc-load"]], + "(method 15 res-lump)": [[132, "s5", "res-tag-pair"]], "(method 16 res-lump)": [ - [ - 22, - "t1", - "(pointer uint64)" - ], - [ - 29, - "t2", - "(pointer uint64)" - ] - ], - "(method 17 res-lump)": [ - [ - 22, - "s4", - "(pointer pointer)" - ] - ], - "(method 18 res-lump)": [ - [ - "_stack_", - 16, - "object" - ] + [22, "t1", "(pointer uint64)"], + [29, "t2", "(pointer uint64)"] ], + "(method 17 res-lump)": [[22, "s4", "(pointer pointer)"]], + "(method 18 res-lump)": [["_stack_", 16, "object"]], "(method 19 res-lump)": [ - [ - 38, - "t2", - "int" - ], - [ - 38, - "a2", - "int" - ] - ], - "(method 20 res-lump)": [ - [ - 341, - "t0", - "(pointer uint128)" - ] + [38, "t2", "int"], + [38, "a2", "int"] ], + "(method 20 res-lump)": [[341, "t0", "(pointer uint128)"]], "(method 21 res-lump)": [ - [ - "_stack_", - 16, - "res-tag" - ], - [ - "_stack_", - 32, - "res-tag" - ] - ], - "(method 0 script-context)": [ - [ - [ - 8, - 17 - ], - "v0", - "script-context" - ] + ["_stack_", 16, "res-tag"], + ["_stack_", 32, "res-tag"] ], + "(method 0 script-context)": [[[8, 17], "v0", "script-context"]], "shadow-vu1-add-matrix": [ - [ - [ - 11, - 19 - ], - "a3", - "dma-packet" - ], - [ - [ - 26, - 30 - ], - "v1", - "matrix" - ] + [[11, 19], "a3", "dma-packet"], + [[26, 30], "v1", "matrix"] ], "shrubbery-login-post-texture": [ - [ - [ - 13, - 15 - ], - "a3", - "qword" - ], - [ - 16, - "a3", - "pointer" - ], - [ - 24, - "a3", - "pointer" - ], - [ - [ - 17, - 23 - ], - "a3", - "qword" - ], - [ - [ - 13, - 23 - ], - "a1", - "qword" - ], - [ - 14, - "a2", - "qword" - ], - [ - [ - 27, - 29 - ], - "a3", - "qword" - ], - [ - [ - 27, - 29 - ], - "a1", - "qword" - ], - [ - [ - 35, - 37 - ], - "a3", - "qword" - ], - [ - [ - 35, - 37 - ], - "a2", - "qword" - ] - ], - "(method 2 sparticle-cpuinfo)": [ - [ - 14, - "f0", - "float" - ] + [[13, 15], "a3", "qword"], + [16, "a3", "pointer"], + [24, "a3", "pointer"], + [[17, 23], "a3", "qword"], + [[13, 23], "a1", "qword"], + [14, "a2", "qword"], + [[27, 29], "a3", "qword"], + [[27, 29], "a1", "qword"], + [[35, 37], "a3", "qword"], + [[35, 37], "a2", "qword"] ], + "(method 2 sparticle-cpuinfo)": [[14, "f0", "float"]], "sprite-add-2d-chunk": [ - [ - [ - 7, - 21 - ], - "a0", - "dma-packet" - ], - [ - [ - 33, - 53 - ], - "a0", - "dma-packet" - ], - [ - [ - 57, - 77 - ], - "a0", - "dma-packet" - ], - [ - [ - 78, - 88 - ], - "v1", - "dma-packet" - ], - [ - 65, - "a3", - "int" - ] + [[7, 21], "a0", "dma-packet"], + [[33, 53], "a0", "dma-packet"], + [[57, 77], "a0", "dma-packet"], + [[78, 88], "v1", "dma-packet"], + [65, "a3", "int"] ], "sprite-add-3d-chunk": [ - [ - [ - 7, - 21 - ], - "a0", - "dma-packet" - ], - [ - [ - 33, - 53 - ], - "a0", - "dma-packet" - ], - [ - [ - 57, - 77 - ], - "a0", - "dma-packet" - ], - [ - [ - 78, - 88 - ], - "v1", - "dma-packet" - ], - [ - 65, - "a3", - "int" - ] - ], - "sprite-add-frame-data": [ - [ - [ - 3, - 17 - ], - "a0", - "dma-packet" - ] - ], - "add-shader-to-dma": [ - [ - [ - 6, - 8 - ], - "v1", - "(pointer uint32)" - ] + [[7, 21], "a0", "dma-packet"], + [[33, 53], "a0", "dma-packet"], + [[57, 77], "a0", "dma-packet"], + [[78, 88], "v1", "dma-packet"], + [65, "a3", "int"] ], + "sprite-add-frame-data": [[[3, 17], "a0", "dma-packet"]], + "add-shader-to-dma": [[[6, 8], "v1", "(pointer uint32)"]], "sprite-glow-add-simple-sprite": [ - [ - [ - 0, - 33 - ], - "v1", - "sprite-glow-ref-template" - ] - ], - "sprite-glow-add-sprite": [ - [ - [ - 0, - 33 - ], - "v1", - "sprite-glow-cnt-template" - ] + [[0, 33], "v1", "sprite-glow-ref-template"] ], + "sprite-glow-add-sprite": [[[0, 33], "v1", "sprite-glow-cnt-template"]], "(method 9 texture-anim-layer)": [ - [ - 5, - "v1", - "symbol" - ], - [ - 11, - "v1", - "symbol" - ] + [5, "v1", "symbol"], + [11, "v1", "symbol"] ], "add-tfrag-data": [ - [ - [ - 3, - 17 - ], - "a0", - "dma-packet" - ], - [ - [ - 24, - 31 - ], - "v1", - "dma-packet" - ] + [[3, 17], "a0", "dma-packet"], + [[24, 31], "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)" - ] - ], - "(method 9 clock)": [ - [ - 47, - "v1", - "float" - ] + [[21, 28], "a2", "dma-packet"], + [[31, 38], "a0", "(pointer vif-tag)"], + [[38, 42], "a0", "(pointer int32)"], + [[43, 49], "a0", "(pointer vif-tag)"] ], + "(method 9 clock)": [[47, "v1", "float"]], "vector4-array-add!": [ - [ - 11, - "s5", - "(inline-array vector4)" - ], - [ - 12, - "s4", - "(inline-array vector4)" - ], - [ - 13, - "gp", - "(inline-array vector4)" - ] + [11, "s5", "(inline-array vector4)"], + [12, "s4", "(inline-array vector4)"], + [13, "gp", "(inline-array vector4)"] ], "vector4-array-lerp!": [ - [ - 13, - "s5", - "(inline-array vector4)" - ], - [ - 14, - "s4", - "(inline-array vector4)" - ], - [ - 15, - "gp", - "(inline-array vector4)" - ] + [13, "s5", "(inline-array vector4)"], + [14, "s4", "(inline-array vector4)"], + [15, "gp", "(inline-array vector4)"] ], "vector4-array-madd!": [ - [ - 13, - "s5", - "(inline-array vector4)" - ], - [ - 14, - "s4", - "(inline-array vector4)" - ], - [ - 15, - "gp", - "(inline-array vector4)" - ] + [13, "s5", "(inline-array vector4)"], + [14, "s4", "(inline-array vector4)"], + [15, "gp", "(inline-array vector4)"] ], "vector4-array-msub!": [ - [ - 13, - "s5", - "(inline-array vector4)" - ], - [ - 14, - "s4", - "(inline-array vector4)" - ], - [ - 15, - "gp", - "(inline-array vector4)" - ] + [13, "s5", "(inline-array vector4)"], + [14, "s4", "(inline-array vector4)"], + [15, "gp", "(inline-array vector4)"] ], "vector4-array-mul!": [ - [ - 11, - "s5", - "(inline-array vector4)" - ], - [ - 12, - "s4", - "(inline-array vector4)" - ], - [ - 13, - "gp", - "(inline-array vector4)" - ] + [11, "s5", "(inline-array vector4)"], + [12, "s4", "(inline-array vector4)"], + [13, "gp", "(inline-array vector4)"] ], "vector4-array-scale!": [ - [ - 11, - "s5", - "(inline-array vector4)" - ], - [ - 12, - "gp", - "(inline-array vector4)" - ] + [11, "s5", "(inline-array vector4)"], + [12, "gp", "(inline-array vector4)"] ], "vector4-array-sub!": [ - [ - 11, - "s5", - "(inline-array vector4)" - ], - [ - 12, - "s4", - "(inline-array vector4)" - ], - [ - 13, - "gp", - "(inline-array vector4)" - ] + [11, "s5", "(inline-array vector4)"], + [12, "s4", "(inline-array vector4)"], + [13, "gp", "(inline-array vector4)"] ], "ellipsoid-random-point-on!": [ - [ - 19, - "v1", - "float" - ], - [ - 44, - "v1", - "float" - ] - ], - "(method 15 engine)": [ - [ - [ - 0, - 36 - ], - "v1", - "connection" - ] - ], - "(method 10 connection)": [ - [ - 8, - "a0", - "pointer" - ] + [19, "v1", "float"], + [44, "v1", "float"] ], + "(method 15 engine)": [[[0, 36], "v1", "connection"]], + "(method 10 connection)": [[8, "a0", "pointer"]], "(method 3 connection-minimap)": [ - [ - 97, - "a3", - "float" - ], - [ - [ - 97, - 99 - ], - "a3", - "float" - ], - [ - 97, - "f0", - "float" - ] + [97, "a3", "float"], + [[97, 99], "a3", "float"], + [97, "f0", "float"] ], "(method 0 prim-strip)": [ - [ - [ - 97, - 117 - ], - "a0", - "vector" - ], - [ - 94, - "a1", - "(inline-array prim-vertex)" - ] - ], - "(method 0 fact-info-target)": [ - [ - 3, - "v0", - "fact-info-target" - ] - ], - "(method 0 fact-info-crate)": [ - [ - 3, - "v0", - "fact-info-crate" - ] + [[97, 117], "a0", "vector"], + [94, "a1", "(inline-array prim-vertex)"] ], + "(method 0 fact-info-target)": [[3, "v0", "fact-info-target"]], + "(method 0 fact-info-crate)": [[3, "v0", "fact-info-crate"]], "(method 0 fact-info-enemy)": [ - [ - 7, - "v0", - "fact-info-enemy" - ], - [ - "_stack_", - 16, - "res-tag" - ], - [ - "_stack_", - 32, - "res-tag" - ] + [7, "v0", "fact-info-enemy"], + ["_stack_", 16, "res-tag"], + ["_stack_", 32, "res-tag"] ], "(method 0 fact-info)": [ - [ - 87, - "v1", - "(pointer int32)" - ], - [ - 11, - "v1", - "res-lump" - ] - ], - "(method 0 collide-shape-moving)": [ - [ - [ - 5, - 12 - ], - "v0", - "collide-shape-moving" - ] - ], - "joint-mod-spinner-callback": [ - [ - [ - 2, - 63 - ], - "gp", - "joint-mod-spinner" - ] - ], - "joint-mod-add-local-callback": [ - [ - [ - 1, - 37 - ], - "s4", - "joint-mod-add-local" - ] - ], - "(top-level-login eye-h)": [ - [ - 76, - "a3", - "eye-control" - ] + [87, "v1", "(pointer int32)"], + [11, "v1", "res-lump"] ], + "(method 0 collide-shape-moving)": [[[5, 12], "v0", "collide-shape-moving"]], + "joint-mod-spinner-callback": [[[2, 63], "gp", "joint-mod-spinner"]], + "joint-mod-add-local-callback": [[[1, 37], "s4", "joint-mod-add-local"]], + "(top-level-login eye-h)": [[76, "a3", "eye-control"]], "joint-mod-rotate-local-callback": [ - [ - [ - 2, - 16 - ], - "v1", - "joint-mod-rotate-local" - ] + [[2, 16], "v1", "joint-mod-rotate-local"] ], "joint-mod-trans-rot-local-callback": [ - [ - [ - 2, - 16 - ], - "v1", - "joint-mod-trans-rot-local" - ] + [[2, 16], "v1", "joint-mod-trans-rot-local"] ], "(method 8 res-lump)": [ - [ - 258, - "s0", - "array" - ], - [ - [ - 157, - 239 - ], - "s0", - "(array object)" - ] + [258, "s0", "array"], + [[157, 239], "s0", "(array object)"] ], "(method 2 array)": [ - [ - 23, - "gp", - "(array int32)" - ], - [ - 43, - "gp", - "(array uint32)" - ], - [ - 63, - "gp", - "(array int64)" - ], - [ - 83, - "gp", - "(array uint64)" - ], - [ - 102, - "gp", - "(array int8)" - ], - [ - 121, - "gp", - "(array uint8)" - ], - [ - 141, - "gp", - "(array int16)" - ], - [ - 161, - "gp", - "(array uint16)" - ], - [ - 186, - "gp", - "(array uint128)" - ], - [ - 204, - "gp", - "(array int32)" - ], - [ - 223, - "gp", - "(array float)" - ], - [ - 232, - "gp", - "(array float)" - ], - [ - 249, - "gp", - "(array basic)" - ], - [ - 258, - "gp", - "(array basic)" - ] + [23, "gp", "(array int32)"], + [43, "gp", "(array uint32)"], + [63, "gp", "(array int64)"], + [83, "gp", "(array uint64)"], + [102, "gp", "(array int8)"], + [121, "gp", "(array uint8)"], + [141, "gp", "(array int16)"], + [161, "gp", "(array uint16)"], + [186, "gp", "(array uint128)"], + [204, "gp", "(array int32)"], + [223, "gp", "(array float)"], + [232, "gp", "(array float)"], + [249, "gp", "(array basic)"], + [258, "gp", "(array basic)"] ], "(method 3 array)": [ - [ - 51, - "gp", - "(array int32)" - ], - [ - 69, - "gp", - "(array uint32)" - ], - [ - 87, - "gp", - "(array int64)" - ], - [ - 105, - "gp", - "(array uint64)" - ], - [ - 122, - "gp", - "(array int8)" - ], - [ - 139, - "gp", - "(array int8)" - ], - [ - 157, - "gp", - "(array int16)" - ], - [ - 175, - "gp", - "(array uint16)" - ], - [ - 198, - "gp", - "(array uint128)" - ], - [ - 214, - "gp", - "(array int32)" - ], - [ - 233, - "gp", - "(array float)" - ], - [ - 250, - "gp", - "(array basic)" - ] + [51, "gp", "(array int32)"], + [69, "gp", "(array uint32)"], + [87, "gp", "(array int64)"], + [105, "gp", "(array uint64)"], + [122, "gp", "(array int8)"], + [139, "gp", "(array int8)"], + [157, "gp", "(array int16)"], + [175, "gp", "(array uint16)"], + [198, "gp", "(array uint128)"], + [214, "gp", "(array int32)"], + [233, "gp", "(array float)"], + [250, "gp", "(array basic)"] ], "history-draw": [ - [ - 16, - "a1", - "int" - ], - [ - 151, - "a0", - "uint" - ], - [ - "_stack_", - 24, - "float" - ] - ], - "dgo-load-cancel": [ - [ - [ - 3, - 8 - ], - "v0", - "sound-rpc-cancel-dgo" - ] - ], - "desaturate-mood-colors": [ - [ - [ - 20, - 90 - ], - "a0", - "(inline-array mood-color)" - ] + [16, "a1", "int"], + [151, "a0", "uint"], + ["_stack_", 24, "float"] ], + "dgo-load-cancel": [[[3, 8], "v0", "sound-rpc-cancel-dgo"]], + "desaturate-mood-colors": [[[20, 90], "a0", "(inline-array mood-color)"]], "(method 9 bounding-box)": [ - [ - 13, - "a1", - "(inline-array sphere)" - ], - [ - 24, - "a1", - "(inline-array sphere)" - ], - [ - 31, - "a1", - "(inline-array sphere)" - ], - [ - 38, - "a1", - "(inline-array sphere)" - ] + [13, "a1", "(inline-array sphere)"], + [24, "a1", "(inline-array sphere)"], + [31, "a1", "(inline-array sphere)"], + [38, "a1", "(inline-array sphere)"] ], "generate-rand-vector-on-sphere": [ - [ - 12, - "v1", - "float" - ], - [ - 28, - "v1", - "float" - ] - ], - "vector-segment-distance-point!": [ - [ - [ - 21, - 30 - ], - "f1", - "float" - ] + [12, "v1", "float"], + [28, "v1", "float"] ], + "vector-segment-distance-point!": [[[21, 30], "f1", "float"]], "string-cat-to-last-char": [ - [ - 3, - "s5", - "(pointer uint8)" - ], - [ - 4, - "s5", - "string" - ] + [3, "s5", "(pointer uint8)"], + [4, "s5", "string"] ], "to-upper": [ - [ - 6, - "a0", - "(pointer uint8)" - ], - [ - 8, - "a0", - "string" - ] + [6, "a0", "(pointer uint8)"], + [8, "a0", "string"] ], "mem-copy!": [ - [ - [ - 18, - 69 - ], - "s5", - "(pointer uint128)" - ], - [ - [ - 18, - 69 - ], - "s4", - "(pointer uint128)" - ] + [[18, 69], "s5", "(pointer uint128)"], + [[18, 69], "s4", "(pointer uint128)"] ], "(method 0 ambient-sound)": [ - [ - 85, - "s3", - "sound-spec" - ], - [ - 62, - "v0", - "(pointer float)" - ] + [85, "s3", "sound-spec"], + [62, "v0", "(pointer float)"] ], "write-msg-map-rec": [ - [ - 12, - "t9", - "(function process-nettable net-process-class-info none)" - ], - [ - 27, - "t9", - "(function process-nettable net-process-class-info none)" - ], - [ - [ - 5, - 28 - ], - "s5", - "(function process-nettable net-process-class-info none)" - ] + [12, "t9", "(function process-nettable net-process-class-info none)"], + [27, "t9", "(function process-nettable net-process-class-info none)"], + [[5, 28], "s5", "(function process-nettable net-process-class-info none)"] ], "dgo-load-link": [ - [ - 12, - "s4", - "uint" - ], - [ - 22, - "s4", - "uint" - ], - [ - 60, - "s4", - "uint" - ], - [ - 65, - "s4", - "uint" - ], - [ - 32, - "s4", - "uint" - ], - [ - 42, - "s4", - "uint" - ] + [12, "s4", "uint"], + [22, "s4", "uint"], + [60, "s4", "uint"], + [65, "s4", "uint"], + [32, "s4", "uint"], + [42, "s4", "uint"] ], "(method 10 profile-array)": [ - [ - [ - 71, - 76 - ], - "a0", - "(pointer uint128)" - ], - [ - [ - 75, - 85 - ], - "a1", - "vector4w" - ], - [ - [ - 84, - 92 - ], - "a1", - "vector4w" - ], - [ - [ - 92, - 99 - ], - "a0", - "vector4w" - ], - [ - [ - 115, - 120 - ], - "a1", - "(pointer uint128)" - ], - [ - [ - 119, - 129 - ], - "a2", - "vector4w" - ], - [ - [ - 128, - 139 - ], - "a2", - "vector4w" - ], - [ - [ - 139, - 152 - ], - "a1", - "vector4w" - ], - [ - [ - 189, - 194 - ], - "t2", - "(pointer uint128)" - ], - [ - [ - 193, - 228 - ], - "t4", - "vector4w" - ], - [ - [ - 227, - 234 - ], - "a2", - "vector4w" - ], - [ - [ - 233, - 240 - ], - "a2", - "vector4w" - ] + [[71, 76], "a0", "(pointer uint128)"], + [[75, 85], "a1", "vector4w"], + [[84, 92], "a1", "vector4w"], + [[92, 99], "a0", "vector4w"], + [[115, 120], "a1", "(pointer uint128)"], + [[119, 129], "a2", "vector4w"], + [[128, 139], "a2", "vector4w"], + [[139, 152], "a1", "vector4w"], + [[189, 194], "t2", "(pointer uint128)"], + [[193, 228], "t4", "vector4w"], + [[227, 234], "a2", "vector4w"], + [[233, 240], "a2", "vector4w"] ], "(method 0 path-control)": [["_stack_", 16, "res-tag"]], "(method 0 curve-control)": [["_stack_", 16, "res-tag"]], - "(method 10 manipulator)": [ - [ - 53, - "v1", - "float" - ] - ] -} \ No newline at end of file + "(method 10 manipulator)": [[53, "v1", "float"]] +} diff --git a/decompiler/util/type_utils.h b/decompiler/util/type_utils.h index 6d634c3854..297bbf8e25 100644 --- a/decompiler/util/type_utils.h +++ b/decompiler/util/type_utils.h @@ -13,7 +13,8 @@ namespace decompiler { bool allowable_base_type_for_symbol_to_string(const TypeSpec& ts); constexpr PerGameVersion 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 OFFSET_OF_NEXT_STATE_STORE = {72, 64, 68, 76}; diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 17e82017a4..2a7b5c4002 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -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 diff --git a/game/overlord/common/989_plugins/plugin_strv.cpp b/game/overlord/common/989_plugins/plugin_strv.cpp new file mode 100644 index 0000000000..d3a60187d1 --- /dev/null +++ b/game/overlord/common/989_plugins/plugin_strv.cpp @@ -0,0 +1,139 @@ +#include "plugin_strv.h" + +#include +#include +#include + +#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 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 diff --git a/game/overlord/common/989_plugins/plugin_strv.h b/game/overlord/common/989_plugins/plugin_strv.h new file mode 100644 index 0000000000..74cfafcbf5 --- /dev/null +++ b/game/overlord/common/989_plugins/plugin_strv.h @@ -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 diff --git a/game/overlord/jak2/989_plugins/plugin_strv.cpp b/game/overlord/jak2/989_plugins/plugin_strv.cpp new file mode 100644 index 0000000000..5beb0d0a89 --- /dev/null +++ b/game/overlord/jak2/989_plugins/plugin_strv.cpp @@ -0,0 +1,105 @@ +#include "plugin_strv.h" + +#include + +#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 diff --git a/game/overlord/jak2/989_plugins/plugin_strv.h b/game/overlord/jak2/989_plugins/plugin_strv.h new file mode 100644 index 0000000000..74beb05b08 --- /dev/null +++ b/game/overlord/jak2/989_plugins/plugin_strv.h @@ -0,0 +1,8 @@ +#pragma once + +namespace jak2 { + +void Init989Plugins(); +void HandlePluginRequests(); + +} // namespace jak2 diff --git a/game/overlord/jak2/iso_api.cpp b/game/overlord/jak2/iso_api.cpp index 3f21363c69..b0d887e878 100644 --- a/game/overlord/jak2/iso_api.cpp +++ b/game/overlord/jak2/iso_api.cpp @@ -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; diff --git a/game/overlord/jak2/ssound.cpp b/game/overlord/jak2/ssound.cpp index 002a5f0ac1..50c63c8806 100644 --- a/game/overlord/jak2/ssound.cpp +++ b/game/overlord/jak2/ssound.cpp @@ -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"); diff --git a/game/overlord/jak2/streamlist.cpp b/game/overlord/jak2/streamlist.cpp index e74cba7fe9..5d2d724147 100644 --- a/game/overlord/jak2/streamlist.cpp +++ b/game/overlord/jak2/streamlist.cpp @@ -3,6 +3,7 @@ #include #include +#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; diff --git a/game/overlord/jak2/vag.cpp b/game/overlord/jak2/vag.cpp index 3aed62539b..b13c0c8c10 100644 --- a/game/overlord/jak2/vag.cpp +++ b/game/overlord/jak2/vag.cpp @@ -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); } } diff --git a/game/overlord/jak3/989_plugins/plugin_strv.cpp b/game/overlord/jak3/989_plugins/plugin_strv.cpp new file mode 100644 index 0000000000..5f4499041b --- /dev/null +++ b/game/overlord/jak3/989_plugins/plugin_strv.cpp @@ -0,0 +1,95 @@ +#include "plugin_strv.h" + +#include + +#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 diff --git a/game/overlord/jak3/989_plugins/plugin_strv.h b/game/overlord/jak3/989_plugins/plugin_strv.h new file mode 100644 index 0000000000..e4fef13aaf --- /dev/null +++ b/game/overlord/jak3/989_plugins/plugin_strv.h @@ -0,0 +1,8 @@ +#pragma once + +namespace jak3 { + +void Init989Plugins(); +void HandlePluginRequests(); + +} // namespace jak3 diff --git a/game/overlord/jak3/iso_api.cpp b/game/overlord/jak3/iso_api.cpp index 2c372e6a09..21c60c500f 100644 --- a/game/overlord/jak3/iso_api.cpp +++ b/game/overlord/jak3/iso_api.cpp @@ -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; diff --git a/game/overlord/jak3/spustreams.cpp b/game/overlord/jak3/spustreams.cpp index df518ccf83..bea4682ad4 100644 --- a/game/overlord/jak3/spustreams.cpp +++ b/game/overlord/jak3/spustreams.cpp @@ -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; diff --git a/game/overlord/jak3/ssound.cpp b/game/overlord/jak3/ssound.cpp index 8891c30e5d..8025a2f2d1 100644 --- a/game/overlord/jak3/ssound.cpp +++ b/game/overlord/jak3/ssound.cpp @@ -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"); diff --git a/game/overlord/jak3/streamlist.cpp b/game/overlord/jak3/streamlist.cpp index 156b4a6c43..67d5387c32 100644 --- a/game/overlord/jak3/streamlist.cpp +++ b/game/overlord/jak3/streamlist.cpp @@ -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); diff --git a/game/overlord/jak3/streamlist.h b/game/overlord/jak3/streamlist.h index 6acddb3b0c..5a2e33e8aa 100644 --- a/game/overlord/jak3/streamlist.h +++ b/game/overlord/jak3/streamlist.h @@ -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); diff --git a/game/overlord/jak3/vag.cpp b/game/overlord/jak3/vag.cpp index 4d5c8dcdf3..38a0086e91 100644 --- a/game/overlord/jak3/vag.cpp +++ b/game/overlord/jak3/vag.cpp @@ -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]); } } diff --git a/game/overlord/jak3/vag.h b/game/overlord/jak3/vag.h index 1ce2179cf5..43cccc9990 100644 --- a/game/overlord/jak3/vag.h +++ b/game/overlord/jak3/vag.h @@ -127,6 +127,7 @@ struct VagStreamData { int volume2; int maybe_volume_3; int group; + int pan; }; extern ISO_VAGCommand g_aVagCmds[6]; diff --git a/game/sound/989snd/blocksound_handler.cpp b/game/sound/989snd/blocksound_handler.cpp index 87234babc6..29d57a2089 100644 --- a/game/sound/989snd/blocksound_handler.cpp +++ b/game/sound/989snd/blocksound_handler.cpp @@ -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; diff --git a/game/sound/989snd/blocksound_handler.h b/game/sound/989snd/blocksound_handler.h index 76e64e832f..a4ef93a9b7 100644 --- a/game/sound/989snd/blocksound_handler.h +++ b/game/sound/989snd/blocksound_handler.h @@ -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; diff --git a/game/sound/989snd/musicbank.cpp b/game/sound/989snd/musicbank.cpp index 1abe67125c..e2b71b81f4 100644 --- a/game/sound/989snd/musicbank.cpp +++ b/game/sound/989snd/musicbank.cpp @@ -7,8 +7,14 @@ namespace snd { -std::optional> -MusicBank::MakeHandler(VoiceManager& vm, u32 sound_id, s32 vol, s32 pan, s32 pm, s32 pb, s32 tick) { +std::optional> 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> MusicBank::MakeHandler(VoiceManager s32 vol, s32 pan, SndPlayParams& params, - s32 tick) { + s32 tick, + u32 owner) { return std::nullopt; } diff --git a/game/sound/989snd/musicbank.h b/game/sound/989snd/musicbank.h index c23f8271e8..9339cbd35d 100644 --- a/game/sound/989snd/musicbank.h +++ b/game/sound/989snd/musicbank.h @@ -66,14 +66,21 @@ class MusicBank : public SoundBank { std::span samples, std::span midi_data); - std::optional> - MakeHandler(VoiceManager& vm, u32 sound_id, s32 vol, s32 pan, s32 pm, s32 pb, s32 tick) override; + std::optional> MakeHandler(VoiceManager& vm, + u32 sound_id, + s32 vol, + s32 pan, + s32 pm, + s32 pb, + s32 tick, + u32 owner) override; std::optional> MakeHandler(VoiceManager& vm, u32 sound_id, s32 vol, s32 pan, SndPlayParams& params, - s32 tick) override; + s32 tick, + u32 owner) override; }; } // namespace snd diff --git a/game/sound/989snd/player.cpp b/game/sound/989snd/player.cpp index b5adc12baa..75187366e9 100644 --- a/game/sound/989snd/player.cpp +++ b/game/sound/989snd/player.cpp @@ -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); diff --git a/game/sound/989snd/player.h b/game/sound/989snd/player.h index 41e6771790..97e003c1ee 100644 --- a/game/sound/989snd/player.h +++ b/game/sound/989snd/player.h @@ -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); diff --git a/game/sound/989snd/plugin.cpp b/game/sound/989snd/plugin.cpp new file mode 100644 index 0000000000..11bf66e0a7 --- /dev/null +++ b/game/sound/989snd/plugin.cpp @@ -0,0 +1,58 @@ +#include "plugin.h" + +#include + +#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(id >> 24), static_cast(id >> 16), + static_cast(id >> 8), static_cast(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 diff --git a/game/sound/989snd/plugin.h b/game/sound/989snd/plugin.h new file mode 100644 index 0000000000..672da6b633 --- /dev/null +++ b/game/sound/989snd/plugin.h @@ -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 diff --git a/game/sound/989snd/sfxblock.cpp b/game/sound/989snd/sfxblock.cpp index 07387c0f37..035e2a9c9d 100644 --- a/game/sound/989snd/sfxblock.cpp +++ b/game/sound/989snd/sfxblock.cpp @@ -14,15 +14,16 @@ std::optional> 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(*this, SFX, vm, vol, pan, params, sound_id, current_tick); + auto handler = std::make_unique(*this, SFX, vm, vol, pan, params, sound_id, + current_tick, owner); return handler; } diff --git a/game/sound/989snd/sfxblock.h b/game/sound/989snd/sfxblock.h index 4e779112e7..542b3f3e8e 100644 --- a/game/sound/989snd/sfxblock.h +++ b/game/sound/989snd/sfxblock.h @@ -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 GetName() override { return Name; }; std::optional GetSoundByName(const char* name) override; diff --git a/game/sound/989snd/sfxgrain.cpp b/game/sound/989snd/sfxgrain.cpp index 12c9716c42..918f4d1668 100644 --- a/game/sound/989snd/sfxgrain.cpp +++ b/game/sound/989snd/sfxgrain.cpp @@ -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(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) { diff --git a/game/sound/989snd/sound_handler.h b/game/sound/989snd/sound_handler.h index 9affd82913..63846d51c4 100644 --- a/game/sound/989snd/sound_handler.h +++ b/game/sound/989snd/sound_handler.h @@ -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( diff --git a/game/sound/989snd/soundbank.h b/game/sound/989snd/soundbank.h index dac216b934..f2a0832da3 100644 --- a/game/sound/989snd/soundbank.h +++ b/game/sound/989snd/soundbank.h @@ -54,15 +54,21 @@ class SoundBank { u32 BankID; s8 BankNum; - virtual std::optional> - MakeHandler(VoiceManager& vm, u32 sound_id, s32 vol, s32 pan, s32 pm, s32 pb, s32 current_tick) { + virtual std::optional> 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> 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 GetName() { return std::nullopt; }; virtual std::optional GetSoundByName(const char* /*name*/) { return std::nullopt; }; diff --git a/game/sound/CMakeLists.txt b/game/sound/CMakeLists.txt index f0f5adbf2f..0e159ad2a8 100644 --- a/game/sound/CMakeLists.txt +++ b/game/sound/CMakeLists.txt @@ -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 diff --git a/game/sound/sndshim.cpp b/game/sound/sndshim.cpp index 15185956a3..bf8d68d40b 100644 --- a/game/sound/sndshim.cpp +++ b/game/sound/sndshim.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); diff --git a/game/sound/sndshim.h b/game/sound/sndshim.h index 3de1eea2b1..49c285e720 100644 --- a/game/sound/sndshim.h +++ b/game/sound/sndshim.h @@ -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);