AnyPS5/core/libs/prx/libSceVoiceQoS/Export.cpp
hugodearaujo 56e4ee3565 fix(voiceqos): return the console's sceVoiceQoSInit argument errors
Measured on a PS5 (firmware 13.60) through dlopen of
libSceVoiceQoS.sprx: a null block, any size other than exactly 0x40000,
and an app type other than 0x20000000 or 0x10000000 all return
0x804E0902 without touching the block, instead of throwing. A second
initialization returns 0x804E0905, as prosper reads from the module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 23:34:15 -03:00

90 lines
2.1 KiB
C++

#include <cstdint>
#include <cstddef>
#include <mutex>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
namespace {
constexpr std::int32_t VOICE_QOS_APP_TYPE_GAME = 0x20000000;
constexpr std::int32_t VOICE_QOS_APP_TYPE_10000000 = 0x10000000;
constexpr std::uint32_t VOICE_QOS_MEMORY_SIZE = 0x40000;
constexpr int SCE_VOICE_ERROR_LIBVOICEQOS_ARGUMENT_INVALID = static_cast<int>(0x804E0902);
constexpr int SCE_VOICE_ERROR_LIBVOICEQOS_INITIALIZED = static_cast<int>(0x804E0905);
std::mutex g_mutex;
bool g_initialized = false;
}
extern "C" {
int APS5_VABI sceVoiceQoSInit(void* mem_block, uint32_t mem_size, int32_t app_type) {
std::lock_guard lock(g_mutex);
if (g_initialized) return SCE_VOICE_ERROR_LIBVOICEQOS_INITIALIZED;
if (!mem_block || mem_size != VOICE_QOS_MEMORY_SIZE || (app_type != VOICE_QOS_APP_TYPE_GAME && app_type != VOICE_QOS_APP_TYPE_10000000)) return SCE_VOICE_ERROR_LIBVOICEQOS_ARGUMENT_INVALID;
g_initialized = true;
return 0;
}
int APS5_VABI sceVoiceQoSEnd() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSCreateLocalEndpoint() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSDeleteLocalEndpoint() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSCreateRemoteEndpoint() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSDeleteRemoteEndpoint() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSConnect() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSDisconnect() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSSetLocalEndpointAttribute() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSSetRemoteEndpointAttribute() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSReadPacket() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSWritePacket() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceVoiceQoSGetLocalEndpointAttribute() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
}