Skip to content

Commit 6bdd836

Browse files
Libs: libSceVoice stubs (shadps4-emu#3022)
* voice lib stubs Primarily for GTA V * Clang
1 parent b1af133 commit 6bdd836

File tree

6 files changed

+265
-0
lines changed

6 files changed

+265
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ set(AJM_LIB src/core/libraries/ajm/ajm.cpp
296296

297297
set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
298298
src/core/libraries/audio/audioin.h
299+
src/core/libraries/voice/voice.cpp
300+
src/core/libraries/voice/voice.h
299301
src/core/libraries/audio/audioout.cpp
300302
src/core/libraries/audio/audioout.h
301303
src/core/libraries/audio/audioout_backend.h

src/common/logging/filter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
141141
SUB(Lib, Camera) \
142142
SUB(Lib, CompanionHttpd) \
143143
SUB(Lib, CompanionUtil) \
144+
SUB(Lib, Voice) \
144145
CLS(Frontend) \
145146
CLS(Render) \
146147
SUB(Render, Vulkan) \

src/common/logging/types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ enum class Class : u8 {
9898
Lib_Fiber, ///< The LibSceFiber implementation.
9999
Lib_Vdec2, ///< The LibSceVideodec2 implementation.
100100
Lib_Videodec, ///< The LibSceVideodec implementation.
101+
Lib_Voice, ///< The LibSceVoice implementation.
101102
Lib_RazorCpu, ///< The LibRazorCpu implementation.
102103
Lib_Mouse, ///< The LibSceMouse implementation
103104
Lib_WebBrowserDialog, ///< The LibSceWebBrowserDialog implementation

src/core/libraries/libs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "core/libraries/videodec/videodec.h"
6161
#include "core/libraries/videodec/videodec2.h"
6262
#include "core/libraries/videoout/video_out.h"
63+
#include "core/libraries/voice/voice.h"
6364
#include "core/libraries/web_browser_dialog/webbrowserdialog.h"
6465
#include "core/libraries/zlib/zlib_sce.h"
6566
#include "fiber/fiber.h"
@@ -128,6 +129,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
128129
Libraries::Camera::RegisterlibSceCamera(sym);
129130
Libraries::CompanionHttpd::RegisterlibSceCompanionHttpd(sym);
130131
Libraries::CompanionUtil::RegisterlibSceCompanionUtil(sym);
132+
Libraries::Voice::RegisterlibSceVoice(sym);
131133
}
132134

133135
} // namespace Libraries

src/core/libraries/voice/voice.cpp

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#include "common/logging/log.h"
5+
#include "core/libraries/error_codes.h"
6+
#include "core/libraries/libs.h"
7+
#include "core/libraries/voice/voice.h"
8+
9+
namespace Libraries::Voice {
10+
11+
s32 PS4_SYSV_ABI sceVoiceConnectIPortToOPort() {
12+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
13+
return ORBIS_OK;
14+
}
15+
16+
s32 PS4_SYSV_ABI sceVoiceCreatePort() {
17+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
18+
return ORBIS_OK;
19+
}
20+
21+
s32 PS4_SYSV_ABI sceVoiceDeletePort() {
22+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
23+
return ORBIS_OK;
24+
}
25+
26+
s32 PS4_SYSV_ABI sceVoiceDisconnectIPortFromOPort() {
27+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
28+
return ORBIS_OK;
29+
}
30+
31+
s32 PS4_SYSV_ABI sceVoiceEnd() {
32+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
33+
return ORBIS_OK;
34+
}
35+
36+
s32 PS4_SYSV_ABI sceVoiceGetBitRate(u32 port_id, u32* bitrate) {
37+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
38+
*bitrate = 48000;
39+
return ORBIS_OK;
40+
}
41+
42+
s32 PS4_SYSV_ABI sceVoiceGetMuteFlag() {
43+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
44+
return ORBIS_OK;
45+
}
46+
47+
s32 PS4_SYSV_ABI sceVoiceGetPortAttr() {
48+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
49+
return ORBIS_OK;
50+
}
51+
52+
s32 PS4_SYSV_ABI sceVoiceGetPortInfo(u32 port_id, OrbisVoicePortInfo* info) {
53+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
54+
info->port_type = 0;
55+
info->state = 3;
56+
info->byte_count = 0;
57+
info->frame_size = 1;
58+
info->edge_count = 0;
59+
info->reserved = 0;
60+
61+
return ORBIS_OK;
62+
}
63+
64+
s32 PS4_SYSV_ABI sceVoiceGetResourceInfo() {
65+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
66+
return ORBIS_OK;
67+
}
68+
69+
s32 PS4_SYSV_ABI sceVoiceGetVolume() {
70+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
71+
return ORBIS_OK;
72+
}
73+
74+
s32 PS4_SYSV_ABI sceVoiceInit() {
75+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
76+
return ORBIS_OK;
77+
}
78+
79+
s32 PS4_SYSV_ABI sceVoiceInitHQ() {
80+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
81+
return ORBIS_OK;
82+
}
83+
84+
s32 PS4_SYSV_ABI sceVoicePausePort() {
85+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
86+
return ORBIS_OK;
87+
}
88+
89+
s32 PS4_SYSV_ABI sceVoicePausePortAll() {
90+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
91+
return ORBIS_OK;
92+
}
93+
94+
s32 PS4_SYSV_ABI sceVoiceReadFromOPort() {
95+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
96+
return ORBIS_OK;
97+
}
98+
99+
s32 PS4_SYSV_ABI sceVoiceResetPort() {
100+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
101+
return ORBIS_OK;
102+
}
103+
104+
s32 PS4_SYSV_ABI sceVoiceResumePort() {
105+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
106+
return ORBIS_OK;
107+
}
108+
109+
s32 PS4_SYSV_ABI sceVoiceResumePortAll() {
110+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
111+
return ORBIS_OK;
112+
}
113+
114+
s32 PS4_SYSV_ABI sceVoiceSetBitRate() {
115+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
116+
return ORBIS_OK;
117+
}
118+
119+
s32 PS4_SYSV_ABI sceVoiceSetMuteFlag() {
120+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
121+
return ORBIS_OK;
122+
}
123+
124+
s32 PS4_SYSV_ABI sceVoiceSetMuteFlagAll() {
125+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
126+
return ORBIS_OK;
127+
}
128+
129+
s32 PS4_SYSV_ABI sceVoiceSetThreadsParams() {
130+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
131+
return ORBIS_OK;
132+
}
133+
134+
s32 PS4_SYSV_ABI sceVoiceSetVolume() {
135+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
136+
return ORBIS_OK;
137+
}
138+
139+
s32 PS4_SYSV_ABI sceVoiceStart() {
140+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
141+
return ORBIS_OK;
142+
}
143+
144+
s32 PS4_SYSV_ABI sceVoiceStop() {
145+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
146+
return ORBIS_OK;
147+
}
148+
149+
s32 PS4_SYSV_ABI sceVoiceUpdatePort() {
150+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
151+
return ORBIS_OK;
152+
}
153+
154+
s32 PS4_SYSV_ABI sceVoiceVADAdjustment() {
155+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
156+
return ORBIS_OK;
157+
}
158+
159+
s32 PS4_SYSV_ABI sceVoiceVADSetVersion() {
160+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
161+
return ORBIS_OK;
162+
}
163+
164+
s32 PS4_SYSV_ABI sceVoiceWriteToIPort() {
165+
LOG_ERROR(Lib_Voice, "(STUBBED) called");
166+
return ORBIS_OK;
167+
}
168+
169+
void RegisterlibSceVoice(Core::Loader::SymbolsResolver* sym) {
170+
LIB_FUNCTION("oV9GAdJ23Gw", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceConnectIPortToOPort);
171+
LIB_FUNCTION("nXpje5yNpaE", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceCreatePort);
172+
LIB_FUNCTION("b7kJI+nx2hg", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceDeletePort);
173+
LIB_FUNCTION("ajVj3QG2um4", "libSceVoice", 1, "libSceVoice", 0, 0,
174+
sceVoiceDisconnectIPortFromOPort);
175+
LIB_FUNCTION("Oo0S5PH7FIQ", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceEnd);
176+
LIB_FUNCTION("cJLufzou6bc", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceGetBitRate);
177+
LIB_FUNCTION("Pc4z1QjForU", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceGetMuteFlag);
178+
LIB_FUNCTION("elcxZTEfHZM", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceGetPortAttr);
179+
LIB_FUNCTION("CrLqDwWLoXM", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceGetPortInfo);
180+
LIB_FUNCTION("Z6QV6j7igvE", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceGetResourceInfo);
181+
LIB_FUNCTION("jjkCjneOYSs", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceGetVolume);
182+
LIB_FUNCTION("9TrhuGzberQ", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceInit);
183+
LIB_FUNCTION("IPHvnM5+g04", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceInitHQ);
184+
LIB_FUNCTION("x0slGBQW+wY", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoicePausePort);
185+
LIB_FUNCTION("Dinob0yMRl8", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoicePausePortAll);
186+
LIB_FUNCTION("cQ6DGsQEjV4", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceReadFromOPort);
187+
LIB_FUNCTION("udAxvCePkUs", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceResetPort);
188+
LIB_FUNCTION("gAgN+HkiEzY", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceResumePort);
189+
LIB_FUNCTION("jbkJFmOZ9U0", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceResumePortAll);
190+
LIB_FUNCTION("TexwmOHQsDg", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceSetBitRate);
191+
LIB_FUNCTION("gwUynkEgNFY", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceSetMuteFlag);
192+
LIB_FUNCTION("oUha0S-Ij9Q", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceSetMuteFlagAll);
193+
LIB_FUNCTION("clyKUyi3RYU", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceSetThreadsParams);
194+
LIB_FUNCTION("QBFoAIjJoXQ", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceSetVolume);
195+
LIB_FUNCTION("54phPH2LZls", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceStart);
196+
LIB_FUNCTION("Ao2YNSA7-Qo", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceStop);
197+
LIB_FUNCTION("jSZNP7xJrcw", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceUpdatePort);
198+
LIB_FUNCTION("hg9T73LlRiU", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceVADAdjustment);
199+
LIB_FUNCTION("wFeAxEeEi-8", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceVADSetVersion);
200+
LIB_FUNCTION("YeJl6yDlhW0", "libSceVoice", 1, "libSceVoice", 0, 0, sceVoiceWriteToIPort);
201+
};
202+
203+
} // namespace Libraries::Voice

src/core/libraries/voice/voice.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#pragma once
5+
6+
#include "common/types.h"
7+
8+
namespace Core::Loader {
9+
class SymbolsResolver;
10+
}
11+
12+
namespace Libraries::Voice {
13+
14+
struct OrbisVoicePortInfo {
15+
s32 port_type;
16+
s32 state;
17+
u32* edge;
18+
u32 byte_count;
19+
u32 frame_size;
20+
u16 edge_count;
21+
u16 reserved;
22+
};
23+
24+
s32 PS4_SYSV_ABI sceVoiceConnectIPortToOPort();
25+
s32 PS4_SYSV_ABI sceVoiceCreatePort();
26+
s32 PS4_SYSV_ABI sceVoiceDeletePort();
27+
s32 PS4_SYSV_ABI sceVoiceDisconnectIPortFromOPort();
28+
s32 PS4_SYSV_ABI sceVoiceEnd();
29+
s32 PS4_SYSV_ABI sceVoiceGetBitRate(u32 port_id, u32* bitrate);
30+
s32 PS4_SYSV_ABI sceVoiceGetMuteFlag();
31+
s32 PS4_SYSV_ABI sceVoiceGetPortAttr();
32+
s32 PS4_SYSV_ABI sceVoiceGetPortInfo(u32 port_id, OrbisVoicePortInfo* info);
33+
s32 PS4_SYSV_ABI sceVoiceGetResourceInfo();
34+
s32 PS4_SYSV_ABI sceVoiceGetVolume();
35+
s32 PS4_SYSV_ABI sceVoiceInit();
36+
s32 PS4_SYSV_ABI sceVoiceInitHQ();
37+
s32 PS4_SYSV_ABI sceVoicePausePort();
38+
s32 PS4_SYSV_ABI sceVoicePausePortAll();
39+
s32 PS4_SYSV_ABI sceVoiceReadFromOPort();
40+
s32 PS4_SYSV_ABI sceVoiceResetPort();
41+
s32 PS4_SYSV_ABI sceVoiceResumePort();
42+
s32 PS4_SYSV_ABI sceVoiceResumePortAll();
43+
s32 PS4_SYSV_ABI sceVoiceSetBitRate();
44+
s32 PS4_SYSV_ABI sceVoiceSetMuteFlag();
45+
s32 PS4_SYSV_ABI sceVoiceSetMuteFlagAll();
46+
s32 PS4_SYSV_ABI sceVoiceSetThreadsParams();
47+
s32 PS4_SYSV_ABI sceVoiceSetVolume();
48+
s32 PS4_SYSV_ABI sceVoiceStart();
49+
s32 PS4_SYSV_ABI sceVoiceStop();
50+
s32 PS4_SYSV_ABI sceVoiceUpdatePort();
51+
s32 PS4_SYSV_ABI sceVoiceVADAdjustment();
52+
s32 PS4_SYSV_ABI sceVoiceVADSetVersion();
53+
s32 PS4_SYSV_ABI sceVoiceWriteToIPort();
54+
55+
void RegisterlibSceVoice(Core::Loader::SymbolsResolver* sym);
56+
} // namespace Libraries::Voice

0 commit comments

Comments
 (0)