fix(Orbis): stop asserting when voicechat fails

This commit is contained in:
str1k3r committed 2026-07-22 17:36:58 -04:00
1 parent f992d40795
commit 4099ed477d
2 files changed
+27 -15

No files matched your search

@@ -35,20 +35,29 @@ int g_loadedPCMVoiceDataSizes[4];
int g_loadedPCMVoiceDataPos[4]; int g_loadedPCMVoiceDataPos[4];
char* g_loadedPCMVoiceData[4]; char* g_loadedPCMVoiceData[4];
static void CreatePort(uint32_t *portId, const SceVoicePortParam *pArg) static bool CreatePort(uint32_t *portId, const SceVoicePortParam *pArg)
{ {
C4JThread::PushAffinityAllCores(); // PS4 only C4JThread::PushAffinityAllCores();
int err = sceVoiceCreatePort( portId, pArg ); *portId = SCE_VOICE_INVALID_PORT_ID;
assert(err == SCE_OK);
assert(*portId != VOICE_INVALID_PORT_ID); int err = sceVoiceCreatePort(portId, pArg);
C4JThread::PopAffinity(); // PS4 only //assert(err == SCE_OK);
//assert(*portId != VOICE_INVALID_PORT_ID);
C4JThread::PopAffinity();
if (err != SCE_OK || *portId == SCE_VOICE_INVALID_PORT_ID)
{
return false;
}
return true;
} }
static void DeletePort(uint32_t& port) static void DeletePort(uint32_t& port)
{ {
int32_t result; int32_t result;
if (port != VOICE_INVALID_PORT_ID) if (port != SCE_VOICE_INVALID_PORT_ID)
{ {
result = sceVoiceDeletePort( port ); result = sceVoiceDeletePort( port );
if (result != SCE_OK) if (result != SCE_OK)
@@ -56,7 +65,7 @@ static void DeletePort(uint32_t& port)
app.DebugPrintf("sceVoiceDeletePort failed %0x\n", result); app.DebugPrintf("sceVoiceDeletePort failed %0x\n", result);
assert(0); assert(0);
} }
port = VOICE_INVALID_PORT_ID; port = SCE_VOICE_INVALID_PORT_ID;
} }
} }
@@ -122,7 +131,12 @@ void SonyVoiceChat_Orbis::init()
portArgs.volume = 1.0f; portArgs.volume = 1.0f;
portArgs.voice.bitrate = VOICE_ENCODED_FORMAT; portArgs.voice.bitrate = VOICE_ENCODED_FORMAT;
#endif #endif
CreatePort( &m_voiceOutPort, &portArgs ); //CreatePort( &m_voiceOutPort, &portArgs );
if (!CreatePort(&m_voiceOutPort, &portArgs))
{
return;
}
start(); start();
m_bInitialised = true; m_bInitialised = true;
@@ -8,8 +8,6 @@
static const int sc_maxVoiceDataSize = 2048; static const int sc_maxVoiceDataSize = 2048;
#define VOICE_INVALID_PORT_ID 0xff // str1k3r - use of SCE_VOICE_INVALID_PORT_ID causes a crash when loading / making worlds.
class VoicePacket class VoicePacket
{ {
static const int MAX_LOCAL_PLAYER_COUNT = 4; static const int MAX_LOCAL_PLAYER_COUNT = 4;
@@ -89,8 +87,8 @@ public:
public: public:
SQRLocalVoiceDevice() SQRLocalVoiceDevice()
: m_localUserID(SCE_USER_SERVICE_USER_ID_INVALID) : m_localUserID(SCE_USER_SERVICE_USER_ID_INVALID)
, m_headsetPort(VOICE_INVALID_PORT_ID) , m_headsetPort(SCE_VOICE_INVALID_PORT_ID)
, m_microphonePort(VOICE_INVALID_PORT_ID) , m_microphonePort(SCE_VOICE_INVALID_PORT_ID)
{ {
for(int i=0;i<4;i++) for(int i=0;i<4;i++)
m_localConnections[i] = 0; m_localConnections[i] = 0;