added sceVideoOutGetVblankStatus
This commit is contained in:
parent
598a6a88e0
commit
b0cd6e5178
|
@ -56,6 +56,18 @@ void VideoOutCtx::Close(s32 handle) {
|
||||||
m_video_out_ctx.buffers_registration_index = 0;
|
m_video_out_ctx.buffers_registration_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoOutCtx::Vblank() {
|
||||||
|
std::scoped_lock lock{m_mutex};
|
||||||
|
|
||||||
|
if (m_video_out_ctx.isOpened) {
|
||||||
|
m_video_out_ctx.m_mutex.lock();
|
||||||
|
m_video_out_ctx.m_vblank_status.count++;
|
||||||
|
m_video_out_ctx.m_vblank_status.processTime =
|
||||||
|
Core::Libraries::LibKernel::sceKernelGetProcessTime();
|
||||||
|
m_video_out_ctx.m_vblank_status.tsc = Core::Libraries::LibKernel::sceKernelReadTsc();
|
||||||
|
m_video_out_ctx.m_mutex.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
VideoConfigInternal* VideoOutCtx::getCtx(int handle) {
|
VideoConfigInternal* VideoOutCtx::getCtx(int handle) {
|
||||||
if (handle != 1) [[unlikely]] {
|
if (handle != 1) [[unlikely]] {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -78,6 +78,7 @@ public:
|
||||||
|
|
||||||
return m_graphic_ctx;
|
return m_graphic_ctx;
|
||||||
}
|
}
|
||||||
|
void Vblank();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
|
|
|
@ -32,6 +32,10 @@ bool videoOutFlip(u32 micros) {
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
return videoOut->getFlipQueue().flip(micros);
|
return videoOut->getFlipQueue().flip(micros);
|
||||||
}
|
}
|
||||||
|
void VideoOutVblank() {
|
||||||
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
|
return videoOut->Vblank();
|
||||||
|
}
|
||||||
|
|
||||||
std::string getPixelFormatString(s32 format) {
|
std::string getPixelFormatString(s32 format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
@ -127,8 +131,21 @@ s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Core::Kernel::SceKernelEqueue eq, s32 h
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
s32 PS4_SYSV_ABI sceVideoOutGetVblankStatus(int handle, SceVideoOutVblankStatus* status) {
|
||||||
s32 bufferNum,
|
if (status == nullptr) {
|
||||||
|
return SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
|
auto* ctx = videoOut->getCtx(handle);
|
||||||
|
|
||||||
|
ctx->m_mutex.lock();
|
||||||
|
*status = ctx->m_vblank_status;
|
||||||
|
ctx->m_mutex.unlock();
|
||||||
|
return SCE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses, s32 bufferNum,
|
||||||
const SceVideoOutBufferAttribute* attribute) {
|
const SceVideoOutBufferAttribute* attribute) {
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
auto* ctx = videoOut->getCtx(handle);
|
auto* ctx = videoOut->getCtx(handle);
|
||||||
|
@ -346,6 +363,8 @@ void videoOutRegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("N5KDtkIjjJ4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
LIB_FUNCTION("N5KDtkIjjJ4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
sceVideoOutUnregisterBuffers);
|
sceVideoOutUnregisterBuffers);
|
||||||
LIB_FUNCTION("uquVH4-Du78", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutClose);
|
LIB_FUNCTION("uquVH4-Du78", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutClose);
|
||||||
|
LIB_FUNCTION("1FZBKy8HeNU", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
|
sceVideoOutGetVblankStatus);
|
||||||
|
|
||||||
// openOrbis appears to have libSceVideoOut_v1 module libSceVideoOut_v1.1
|
// openOrbis appears to have libSceVideoOut_v1 module libSceVideoOut_v1.1
|
||||||
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 1, 1, sceVideoOutOpen);
|
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 1, 1, sceVideoOutOpen);
|
||||||
|
|
|
@ -110,6 +110,7 @@ void videoOutInit(u32 width, u32 height);
|
||||||
std::string getPixelFormatString(s32 format);
|
std::string getPixelFormatString(s32 format);
|
||||||
void videoOutRegisterLib(Core::Loader::SymbolsResolver* sym);
|
void videoOutRegisterLib(Core::Loader::SymbolsResolver* sym);
|
||||||
bool videoOutFlip(u32 micros);
|
bool videoOutFlip(u32 micros);
|
||||||
|
void VideoOutVblank();
|
||||||
|
|
||||||
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attribute,
|
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attribute,
|
||||||
u32 pixelFormat, u32 tilingMode, u32 aspectRatio,
|
u32 pixelFormat, u32 tilingMode, u32 aspectRatio,
|
||||||
|
|
|
@ -203,6 +203,7 @@ void emuRun() {
|
||||||
calculateFps(0); // TODO: Proper fps
|
calculateFps(0); // TODO: Proper fps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HLE::Libs::Graphics::VideoOut::VideoOutVblank();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue