Files
AnyPS5/core/libs/tests/GuestVideoOutResolutionStatus.cpp
T
john.maiaandClaude Opus 5.5 16824f2678 feat(videoout): implement sceVideoOutGetResolutionStatus
Three homebrew titles from #1578 import it and stop at start-up without
it: ps5-opengl (PPSA99005), EVO-PLAYER-PS5 (PPSA99039) and
ProsperoRadio (PPSA99001).

It reports the port's resolution as the full and pane size and the
refresh rate ID as sceVideoOutGetOutputStatus does. The 48-byte layout
follows the declarations in ps5-opengl and EVO-PLAYER-PS5, which agree;
the screen size is 0 and the flags are 0. An invalid handle or a null
status throws, as in the other status getters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:24:46 +01:00

54 lines
1.9 KiB
C++

#include "SceTypes.hpp"
#include "prx/libc/include/Shutdown.hpp"
#include <cstdlib>
#include <cstring>
#include <stdexcept>
extern "C" {
int APS5_VABI sceVideoOutOpen(int userId, int busType, int index, const void* param);
int APS5_VABI sceVideoOutClose(int handle);
int APS5_VABI sceVideoOutGetOutputStatus(int handle, VideoOutOutputStatus* status);
int APS5_VABI sceVideoOutGetResolutionStatus(int handle, VideoOutResolutionStatus* status);
}
static constexpr int SYSTEM_USER = 255;
static constexpr int MAIN_BUS = 0;
static constexpr int NEVER_OPENED_HANDLE = 2;
static void Require(bool value) { if (!value) std::abort(); }
static bool Rejects(int handle, VideoOutResolutionStatus* status) {
try {
sceVideoOutGetResolutionStatus(handle, status);
} catch (const std::runtime_error&) {
return true;
}
return false;
}
int main() {
const int handle = sceVideoOutOpen(SYSTEM_USER, MAIN_BUS, 0, nullptr);
Require(handle > 0);
VideoOutResolutionStatus status;
std::memset(&status, 0xff, sizeof(status));
Require(sceVideoOutGetResolutionStatus(handle, &status) == 0);
Require(status.fullWidth == 1920 && status.fullHeight == 1080);
Require(status.paneWidth == status.fullWidth && status.paneHeight == status.fullHeight);
Require(status.screenSizeInInch == 0.0f && status.flags == 0 && status.reserved0 == 0);
Require(status.reserved1[0] == 0 && status.reserved1[1] == 0 && status.reserved1[2] == 0);
VideoOutOutputStatus output{};
Require(sceVideoOutGetOutputStatus(handle, &output) == 0);
Require(status.refreshRate == output.refreshRate);
Require(Rejects(handle, nullptr));
Require(Rejects(0, &status));
Require(Rejects(-1, &status));
Require(Rejects(NEVER_OPENED_HANDLE, &status));
Require(sceVideoOutClose(handle) == 0);
Require(Rejects(handle, &status));
LibcRunShutdown_nid_postfix();
}