some sceVideoOut work (mostly dummy work)

This commit is contained in:
georgemoralis 2023-08-21 14:25:11 +03:00
parent 5c28ff9ee2
commit 59c2deb672
5 changed files with 115 additions and 75 deletions

View file

@ -13,13 +13,13 @@ constexpr bool log_file_videoout = true; // disable it to disable logging
std::string getPixelFormatString(s32 format) {
switch (format) {
case PIXEL_FORMAT_A8R8G8B8_SRGB: return "PIXEL_FORMAT_A8R8G8B8_SRGB";
case PIXEL_FORMAT_A8B8G8R8_SRGB: return "PIXEL_FORMAT_A8B8G8R8_SRGB";
case PIXEL_FORMAT_A2R10G10B10: return "PIXEL_FORMAT_A2R10G10B10";
case PIXEL_FORMAT_A2R10G10B10_SRGB: return "PIXEL_FORMAT_A2R10G10B10_SRGB";
case PIXEL_FORMAT_A2R10G10B10_BT2020_PQ: return "PIXEL_FORMAT_A2R10G10B10_BT2020_PQ";
case PIXEL_FORMAT_A16R16G16B16_FLOAT: return "PIXEL_FORMAT_A16R16G16B16_FLOAT";
case PIXEL_FORMAT_YCBCR420_BT709: return "PIXEL_FORMAT_YCBCR420_BT709";
case SCE_VIDEO_OUT_PIXEL_FORMAT_A8R8G8B8_SRGB: return "PIXEL_FORMAT_A8R8G8B8_SRGB";
case SCE_VIDEO_OUT_PIXEL_FORMAT_A8B8G8R8_SRGB: return "PIXEL_FORMAT_A8B8G8R8_SRGB";
case SCE_VIDEO_OUT_PIXEL_FORMAT_A2R10G10B10: return "PIXEL_FORMAT_A2R10G10B10";
case SCE_VIDEO_OUT_PIXEL_FORMAT_A2R10G10B10_SRGB: return "PIXEL_FORMAT_A2R10G10B10_SRGB";
case SCE_VIDEO_OUT_PIXEL_FORMAT_A2R10G10B10_BT2020_PQ: return "PIXEL_FORMAT_A2R10G10B10_BT2020_PQ";
case SCE_VIDEO_OUT_PIXEL_FORMAT_A16R16G16B16_FLOAT: return "PIXEL_FORMAT_A16R16G16B16_FLOAT";
case SCE_VIDEO_OUT_PIXEL_FORMAT_YCBCR420_BT709: return "PIXEL_FORMAT_YCBCR420_BT709";
default: return "Unknown pixel format";
}
}
@ -46,6 +46,45 @@ void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attr
attribute->width = width;
attribute->height = height;
attribute->pitchInPixel = pitchInPixel;
attribute->option = BUFFER_ATTRIBUTE_OPTION_NONE;
attribute->option = SCE_VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_NONE;
}
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(LibKernel::EventQueues::SceKernelEqueue eq, s32 handle, void* udata) {
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses, s32 bufferNum,
const SceVideoOutBufferAttribute* attribute) {
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
s32 PS4_SYSV_ABI sceVideoOutSetFlipRate(s32 handle, s32 rate) {
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
s32 PS4_SYSV_ABI sceVideoOutIsFlipPending(s32 handle) {
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode, s64 flipArg)
{
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, SceVideoOutFlipStatus* status) {
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
s32 PS4_SYSV_ABI sceVideoOutGetResolutionStatus(s32 handle, SceVideoOutResolutionStatus* status) {
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
} // namespace HLE::Libs::Graphics::VideoOut

View file

@ -1,10 +1,36 @@
#pragma once
#include <Core/PS4/HLE/Kernel/event_queues.h>
#include <types.h>
#include <string>
namespace HLE::Libs::Graphics::VideoOut {
// SceVideoOutRefreshRate
constexpr int SCE_VIDEO_OUT_REFRESH_RATE_UNKNOWN = 0;
constexpr int SCE_VIDEO_OUT_REFRESH_RATE_23_98HZ = 1;
constexpr int SCE_VIDEO_OUT_REFRESH_RATE_50HZ = 2;
constexpr int SCE_VIDEO_OUT_REFRESH_RATE_59_94HZ = 3;
constexpr int SCE_VIDEO_OUT_REFRESH_RATE_119_88HZ = 13;
constexpr int SCE_VIDEO_OUT_REFRESH_RATE_89_91HZ = 35;
constexpr s64 SCE_VIDEO_OUT_REFRESH_RATE_ANY = 0xFFFFFFFFFFFFFFFFUL;
constexpr int SCE_VIDEO_OUT_PIXEL_FORMAT_A8R8G8B8_SRGB = 0x80000000;
constexpr int SCE_VIDEO_OUT_PIXEL_FORMAT_A8B8G8R8_SRGB = 0x80002200;
constexpr int SCE_VIDEO_OUT_PIXEL_FORMAT_A2R10G10B10 = 0x88060000;
constexpr int SCE_VIDEO_OUT_PIXEL_FORMAT_A2R10G10B10_SRGB = 0x88000000;
constexpr int SCE_VIDEO_OUT_PIXEL_FORMAT_A2R10G10B10_BT2020_PQ = 0x88740000;
constexpr int SCE_VIDEO_OUT_PIXEL_FORMAT_A16R16G16B16_FLOAT = 0xC1060000;
constexpr int SCE_VIDEO_OUT_PIXEL_FORMAT_YCBCR420_BT709 = 0x08322200;
constexpr int SCE_VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_NONE = 0;
constexpr int SCE_VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_VR = 7;
constexpr int SCE_VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_STRICT_COLORIMETRY = 8;
enum SceVideoOutTilingMode : s32 { SCE_VIDEO_OUT_TILING_MODE_TILE = 0, SCE_VIDEO_OUT_TILING_MODE_LINEAR = 1 };
enum AspectRatioMode : s32 { SCE_VIDEO_OUT_ASPECT_RATIO_16_9 = 0 };
struct SceVideoOutBufferAttribute {
s32 pixelFormat;
s32 tilingMode;
@ -17,24 +43,41 @@ struct SceVideoOutBufferAttribute {
u64 reserved1;
};
constexpr int PIXEL_FORMAT_A8R8G8B8_SRGB = 0x80000000;
constexpr int PIXEL_FORMAT_A8B8G8R8_SRGB = 0x80002200;
constexpr int PIXEL_FORMAT_A2R10G10B10 = 0x88060000;
constexpr int PIXEL_FORMAT_A2R10G10B10_SRGB = 0x88000000;
constexpr int PIXEL_FORMAT_A2R10G10B10_BT2020_PQ = 0x88740000;
constexpr int PIXEL_FORMAT_A16R16G16B16_FLOAT = 0xC1060000;
constexpr int PIXEL_FORMAT_YCBCR420_BT709 = 0x08322200;
struct SceVideoOutFlipStatus {
u64 count = 0;
u64 processTime = 0;
u64 tsc = 0;
s64 flipArg = 0;
u64 submitTsc = 0;
u64 reserved0 = 0;
s32 gcQueueNum = 0;
s32 flipPendingNum = 0;
s32 currentBuffer = 0;
u32 reserved1 = 0;
};
constexpr int BUFFER_ATTRIBUTE_OPTION_NONE = 0;
constexpr int BUFFER_ATTRIBUTE_OPTION_VR = 7;
constexpr int BUFFER_ATTRIBUTE_OPTION_STRICT_COLORIMETRY = 8;
enum SceVideoOutTilingMode : s32 { TILING_MODE_TILE = 0, TILING_MODE_LINEAR = 1 };
enum AspectRatioMode : s32 { ASPECT_RATIO_16_9 = 0 };
struct SceVideoOutResolutionStatus {
s32 fullWidth = 1280;
s32 fullHeight = 720;
s32 paneWidth = 1280;
s32 paneHeight = 720;
u64 refreshRate = SCE_VIDEO_OUT_REFRESH_RATE_59_94HZ;
float screenSizeInInch = 50;
u16 flags = 0;
u16 reserved0 = 0;
u32 reserved1[3] = {0};
};
std::string getPixelFormatString(s32 format);
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attribute, u32 pixelFormat, u32 tilingMode, u32 aspectRatio, u32 width,
u32 height, u32 pitchInPixel);
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(LibKernel::EventQueues::SceKernelEqueue eq, s32 handle, void* udata);
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses, s32 bufferNum,
const SceVideoOutBufferAttribute* attribute);
s32 PS4_SYSV_ABI sceVideoOutSetFlipRate(s32 handle, s32 rate);
s32 PS4_SYSV_ABI sceVideoOutIsFlipPending(s32 handle);
s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode, s64 flipArg);
s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, SceVideoOutFlipStatus* status);
s32 PS4_SYSV_ABI sceVideoOutGetResolutionStatus(s32 handle, SceVideoOutResolutionStatus* status);
} // namespace HLE::Libs::Graphics::VideoOut

View file

@ -11,38 +11,6 @@
namespace HLE::Libs::LibSceVideoOut {
int32_t PS4_SYSV_ABI sceVideoOutGetFlipStatus(int32_t handle /*, SceVideoOutFlipStatus* status*/) {
//BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
int32_t PS4_SYSV_ABI sceVideoOutSubmitFlip(int32_t handle, int32_t bufferIndex, int32_t flipMode, int64_t flipArg) {
//BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
int32_t PS4_SYSV_ABI sceVideoOutRegisterBuffers(int32_t handle, int32_t startIndex, void* const* addresses, int32_t bufferNum /*,
const SceVideoOutBufferAttribute* attribute*/) {
//BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
int32_t PS4_SYSV_ABI sceVideoOutAddFlipEvent(/*SceKernelEqueue eq,*/ int32_t handle, void* udata) {
// BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
int32_t PS4_SYSV_ABI sceVideoOutSetFlipRate(int32_t handle, int32_t rate) {
//BREAKPOINT();
PRINT_DUMMY_FUNCTION_NAME();
return 0;
}
int32_t PS4_SYSV_ABI sceVideoOutGetResolutionStatus(int32_t handle /*, SceVideoOutResolutionStatus* status*/) {
BREAKPOINT();
return 0;
}
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index, const void* param) {
PRINT_DUMMY_FUNCTION_NAME();
if (userId != SCE_USER_SERVICE_USER_ID_SYSTEM) {
@ -59,20 +27,17 @@ s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 i
}
return 1; // dummy return TODO
}
int32_t PS4_SYSV_ABI sceVideoOutIsFlipPending(int32_t handle) {
BREAKPOINT();
return 0;
}
void LibSceVideoOut_Register(SymbolsResolver* sym) {
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetFlipStatus);
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSubmitFlip);
LIB_FUNCTION("w3BY+tAEiQY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutRegisterBuffers);
LIB_FUNCTION("HXzjK9yI30k", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutAddFlipEvent);
LIB_FUNCTION("CBiu4mCE1DA", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSetFlipRate);
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutGetFlipStatus);
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutSubmitFlip);
LIB_FUNCTION("w3BY+tAEiQY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutRegisterBuffers);
LIB_FUNCTION("HXzjK9yI30k", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutAddFlipEvent);
LIB_FUNCTION("CBiu4mCE1DA", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutSetFlipRate);
LIB_FUNCTION("i6-sR91Wt-4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutSetBufferAttribute);
LIB_FUNCTION("6kPnj51T62Y", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetResolutionStatus);
LIB_FUNCTION("6kPnj51T62Y", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutGetResolutionStatus);
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutOpen);
LIB_FUNCTION("zgXifHT9ErY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutIsFlipPending);
LIB_FUNCTION("zgXifHT9ErY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, HLE::Libs::Graphics::VideoOut::sceVideoOutIsFlipPending);
}
}; // namespace HLE::Libs::LibSceVideoOut

View file

@ -7,14 +7,5 @@ using SceUserServiceUserId = s32; //TODO move it to proper place
void LibSceVideoOut_Register(SymbolsResolver* sym);
//functions
int32_t PS4_SYSV_ABI sceVideoOutGetFlipStatus(int32_t handle /*, SceVideoOutFlipStatus* status*/);
int32_t PS4_SYSV_ABI sceVideoOutSubmitFlip(int32_t handle, int32_t bufferIndex, int32_t flipMode, int64_t flipArg);
int32_t PS4_SYSV_ABI sceVideoOutRegisterBuffers(int32_t handle, int32_t startIndex, void* const* addresses,
int32_t bufferNum /*,const SceVideoOutBufferAttribute* attribute*/);
int32_t PS4_SYSV_ABI sceVideoOutAddFlipEvent(/*SceKernelEqueue eq,*/ int32_t handle, void* udata);
int32_t PS4_SYSV_ABI sceVideoOutSetFlipRate(int32_t handle, int32_t rate);
int32_t PS4_SYSV_ABI sceVideoOutGetResolutionStatus(int32_t handle /*, SceVideoOutResolutionStatus* status*/);
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index, const void* param);
int32_t PS4_SYSV_ABI sceVideoOutIsFlipPending(int32_t handle);
}; // namespace HLE::Libs::LibSceVideoOut

View file

@ -11222,6 +11222,8 @@ namespace aerolib {
{"-QgqOT5u2Vk", "_Assert"},
//libkernel
{"Ou3iL1abvng", "__stack_chk_fail"},
{"f7uOxY9mM1U", "__stack_chk_guard"}
{"f7uOxY9mM1U", "__stack_chk_guard"},
{"6XG4B33N09g", "sched_yield"},
{"mkawd0NA9ts", "sysconf"}
};
};