From 4099ed477dfe686ac500ad0bfb0f8cf94eabe763 Mon Sep 17 00:00:00 2001 From: str1k3r <115313679+S1l3ntStr1ke87@users.noreply.github.com> Date: Wed, 22 Jul 2026 17:36:58 -0400 Subject: [PATCH] fix(Orbis): stop asserting when voicechat fails --- .../Orbis/Network/SonyVoiceChat_Orbis.cpp | 36 +++++++++++++------ .../Orbis/Network/SonyVoiceChat_Orbis.h | 6 ++-- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp index 9f00d2f7..a2556f16 100644 --- a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp @@ -35,20 +35,29 @@ int g_loadedPCMVoiceDataSizes[4]; int g_loadedPCMVoiceDataPos[4]; char* g_loadedPCMVoiceData[4]; -static void CreatePort(uint32_t *portId, const SceVoicePortParam *pArg) -{ - C4JThread::PushAffinityAllCores(); // PS4 only - - int err = sceVoiceCreatePort( portId, pArg ); - assert(err == SCE_OK); - assert(*portId != VOICE_INVALID_PORT_ID); - C4JThread::PopAffinity(); // PS4 only +static bool CreatePort(uint32_t *portId, const SceVoicePortParam *pArg) +{ + C4JThread::PushAffinityAllCores(); + + *portId = SCE_VOICE_INVALID_PORT_ID; + + int err = sceVoiceCreatePort(portId, pArg); + //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) { int32_t result; - if (port != VOICE_INVALID_PORT_ID) + if (port != SCE_VOICE_INVALID_PORT_ID) { result = sceVoiceDeletePort( port ); if (result != SCE_OK) @@ -56,7 +65,7 @@ static void DeletePort(uint32_t& port) app.DebugPrintf("sceVoiceDeletePort failed %0x\n", result); 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.voice.bitrate = VOICE_ENCODED_FORMAT; #endif - CreatePort( &m_voiceOutPort, &portArgs ); + //CreatePort( &m_voiceOutPort, &portArgs ); + + if (!CreatePort(&m_voiceOutPort, &portArgs)) + { + return; + } start(); m_bInitialised = true; diff --git a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.h b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.h index f1c430c9..38f0a434 100644 --- a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.h +++ b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.h @@ -8,8 +8,6 @@ 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 { static const int MAX_LOCAL_PLAYER_COUNT = 4; @@ -89,8 +87,8 @@ public: public: SQRLocalVoiceDevice() : m_localUserID(SCE_USER_SERVICE_USER_ID_INVALID) - , m_headsetPort(VOICE_INVALID_PORT_ID) - , m_microphonePort(VOICE_INVALID_PORT_ID) + , m_headsetPort(SCE_VOICE_INVALID_PORT_ID) + , m_microphonePort(SCE_VOICE_INVALID_PORT_ID) { for(int i=0;i<4;i++) m_localConnections[i] = 0;