39 lines
1.9 KiB
C++
39 lines
1.9 KiB
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
int APS5_VABI sceVoiceQoSInit(void*, std::uint32_t, std::int32_t);
|
|
int APS5_VABI sceVoiceQoSEnd();
|
|
}
|
|
|
|
static void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
int main(int argc, char** argv) {
|
|
Require(argc == 2);
|
|
constexpr int argumentInvalid = static_cast<int>(0x804E0902);
|
|
constexpr int initialized = static_cast<int>(0x804E0905);
|
|
constexpr int notInitialized = static_cast<int>(0x804E0901);
|
|
const auto appType = static_cast<std::int32_t>(std::strtoul(argv[1], nullptr, 16));
|
|
std::vector<std::uint8_t> memory(0x40000, 0xAA);
|
|
Require(sceVoiceQoSEnd() == notInitialized);
|
|
Require(sceVoiceQoSInit(nullptr, 0x40000, appType) == argumentInvalid);
|
|
Require(sceVoiceQoSInit(nullptr, 0, appType) == argumentInvalid);
|
|
for (std::uint32_t size : {0u, 1u, 0x100u, 0x3FFFFu, 0x40001u, 0x80000u, 0xFFFFFFFFu}) Require(sceVoiceQoSInit(memory.data(), size, appType) == argumentInvalid);
|
|
for (std::int32_t type : {0, 1, 0x08000000, 0x20000001, 0x30000000, 0x40000000, static_cast<std::int32_t>(0x80000000), -1}) {
|
|
Require(sceVoiceQoSInit(memory.data(), 0x40000, type) == argumentInvalid);
|
|
}
|
|
for (std::uint8_t byte : memory) Require(byte == 0xAA);
|
|
Require(sceVoiceQoSInit(memory.data(), 0x40000, appType) == 0);
|
|
Require(sceVoiceQoSInit(memory.data(), 0x40000, appType) == initialized);
|
|
Require(sceVoiceQoSInit(nullptr, 0, 0) == initialized);
|
|
Require(sceVoiceQoSEnd() == 0);
|
|
Require(sceVoiceQoSEnd() == notInitialized);
|
|
Require(sceVoiceQoSInit(nullptr, 0x40000, appType) == argumentInvalid);
|
|
Require(sceVoiceQoSInit(memory.data(), 0x40000, appType) == 0);
|
|
Require(sceVoiceQoSInit(memory.data(), 0x40000, appType) == initialized);
|
|
Require(sceVoiceQoSEnd() == 0);
|
|
Require(sceVoiceQoSEnd() == notInitialized);
|
|
}
|