Files
AnyPS5/core/libs/tests/GuestVoiceQoS.cpp
T
alfalfa-starandClaude Opus 5.5 d7f3b7c494 feat(voiceqos): implement sceVoiceQoSInit
A title passes a work memory block and app type 0x20000000, and turns
voice chat off when initialization fails. Initialization now records
the library as initialized and succeeds. A null or empty memory block,
another app type and a second initialization throw, as their error
codes are unknown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 20:09:25 +02:00

31 lines
1011 B
C++

#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdint>
#include <cstdlib>
#include <stdexcept>
#include <vector>
extern "C" {
int APS5_VABI sceVoiceQoSInit(void*, std::uint32_t, std::int32_t);
}
static void Require(bool value) { if (!value) std::abort(); }
template<typename TException, typename TFunction>
static bool Throws(TFunction function) {
try {
function();
} catch (const TException&) {
return true;
}
return false;
}
int main() {
std::vector<std::uint8_t> memory(0x40000);
Require(Throws<std::invalid_argument>([&] { sceVoiceQoSInit(nullptr, 0x40000, 0x20000000); }));
Require(Throws<std::invalid_argument>([&] { sceVoiceQoSInit(memory.data(), 0, 0x20000000); }));
Require(Throws<std::invalid_argument>([&] { sceVoiceQoSInit(memory.data(), 0x40000, 0); }));
Require(sceVoiceQoSInit(memory.data(), 0x40000, 0x20000000) == 0);
Require(Throws<std::runtime_error>([&] { sceVoiceQoSInit(memory.data(), 0x40000, 0x20000000); }));
}