Files
AnyPS5/core/libs/tests/GuestVideodec2Unimplemented.cpp
T

52 lines
3.0 KiB
C++

#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdio>
#include <functional>
#include <stdexcept>
#include <string>
extern "C" {
int APS5_VABI sceVideodec2TermLibrary();
int APS5_VABI sceVideodec2QueryLibraryInfo();
int APS5_VABI sceVideodec2QueryDecoderInfo();
int APS5_VABI sceVideodec2MapMemory();
int APS5_VABI sceVideodec2MapDirectMemory(void* decoder, const void* memory);
int APS5_VABI sceVideodec2PresetDecoderConfigInfo();
int APS5_VABI sceVideodec2PresetDecoderConfigInfoAvc();
int APS5_VABI sceVideodec2PresetDecoderConfigInfoHevc();
int APS5_VABI sceVideodec2PresetDecoderConfigInfoVp9();
int APS5_VABI sceVideodec2CreateDecoderBid();
int APS5_VABI sceVideodec2CreateHevcDecoder();
int APS5_VABI sceVideodec2QueryHevcDecoderMemoryInfo();
int APS5_VABI sceVideodec2GetHevcPictureInfo();
}
static bool ReportsNotImplemented(const std::string& name, const std::function<int()>& call) {
try {
call();
} catch (const std::runtime_error& error) {
if (error.what() == name + " not implemented") return true;
std::fprintf(stderr, "%s threw: %s\n", name.c_str(), error.what());
return false;
}
std::fprintf(stderr, "%s returned instead of reporting that it is not implemented\n", name.c_str());
return false;
}
int main() {
bool passed = ReportsNotImplemented("sceVideodec2TermLibrary", [] { return sceVideodec2TermLibrary(); });
passed = ReportsNotImplemented("sceVideodec2QueryLibraryInfo", [] { return sceVideodec2QueryLibraryInfo(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2QueryDecoderInfo", [] { return sceVideodec2QueryDecoderInfo(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2MapMemory", [] { return sceVideodec2MapMemory(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2MapDirectMemory", [] { return sceVideodec2MapDirectMemory(nullptr, nullptr); }) && passed;
passed = ReportsNotImplemented("sceVideodec2PresetDecoderConfigInfo", [] { return sceVideodec2PresetDecoderConfigInfo(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2PresetDecoderConfigInfoAvc", [] { return sceVideodec2PresetDecoderConfigInfoAvc(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2PresetDecoderConfigInfoHevc", [] { return sceVideodec2PresetDecoderConfigInfoHevc(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2PresetDecoderConfigInfoVp9", [] { return sceVideodec2PresetDecoderConfigInfoVp9(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2CreateDecoderBid", [] { return sceVideodec2CreateDecoderBid(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2CreateHevcDecoder", [] { return sceVideodec2CreateHevcDecoder(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2QueryHevcDecoderMemoryInfo", [] { return sceVideodec2QueryHevcDecoderMemoryInfo(); }) && passed;
passed = ReportsNotImplemented("sceVideodec2GetHevcPictureInfo", [] { return sceVideodec2GetHevcPictureInfo(); }) && passed;
return passed ? 0 : 1;
}