Merge pull request #109 from shadps4-emu/undertale-etc

undertale and other stuff
This commit is contained in:
georgemoralis 2024-04-09 11:25:52 +03:00 committed by GitHub
commit 3a7834b821
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 189 additions and 43 deletions

View File

@ -120,6 +120,8 @@ set(LIBRARIES src/core/libraries/library_common.h
src/core/libraries/libsceposix.h src/core/libraries/libsceposix.h
src/core/libraries/libscesavedata.cpp src/core/libraries/libscesavedata.cpp
src/core/libraries/libscesavedata.h src/core/libraries/libscesavedata.h
src/core/libraries/libscesavedatadialog.cpp
src/core/libraries/libscesavedatadialog.h
src/core/libraries/libscessl.cpp src/core/libraries/libscessl.cpp
src/core/libraries/libscessl.h src/core/libraries/libscessl.h
src/core/libraries/libscesysmodule.cpp src/core/libraries/libscesysmodule.cpp

View File

@ -92,6 +92,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Lib, Net) \ SUB(Lib, Net) \
SUB(Lib, NetCtl) \ SUB(Lib, NetCtl) \
SUB(Lib, SaveData) \ SUB(Lib, SaveData) \
SUB(Lib, SaveDataDialog) \
SUB(Lib, Http) \ SUB(Lib, Http) \
SUB(Lib, Ssl) \ SUB(Lib, Ssl) \
SUB(Lib, SysModule) \ SUB(Lib, SysModule) \

View File

@ -29,46 +29,47 @@ enum class Level : u8 {
* filter.cpp. * filter.cpp.
*/ */
enum class Class : u8 { enum class Class : u8 {
Log, ///< Messages about the log system itself Log, ///< Messages about the log system itself
Common, ///< Library routines Common, ///< Library routines
Common_Filesystem, ///< Filesystem interface library Common_Filesystem, ///< Filesystem interface library
Common_Memory, ///< Memory mapping and management functions Common_Memory, ///< Memory mapping and management functions
Core, ///< LLE emulation core Core, ///< LLE emulation core
Core_Linker, ///< The module linker Core_Linker, ///< The module linker
Config, ///< Emulator configuration (including commandline) Config, ///< Emulator configuration (including commandline)
Debug, ///< Debugging tools Debug, ///< Debugging tools
Kernel, ///< The HLE implementation of the PS4 kernel. Kernel, ///< The HLE implementation of the PS4 kernel.
Kernel_Pthread, ///< The pthread implementation of the kernel. Kernel_Pthread, ///< The pthread implementation of the kernel.
Kernel_Fs, ///< The filesystem implementation of the kernel. Kernel_Fs, ///< The filesystem implementation of the kernel.
Kernel_Vmm, ///< The virtual memory implementation of the kernel. Kernel_Vmm, ///< The virtual memory implementation of the kernel.
Kernel_Event, ///< The event management implementation of the kernel. Kernel_Event, ///< The event management implementation of the kernel.
Kernel_Sce, ///< The sony specific interfaces provided by the kernel. Kernel_Sce, ///< The sony specific interfaces provided by the kernel.
Lib, ///< HLE implementation of system library. Each major library Lib, ///< HLE implementation of system library. Each major library
///< should have its own subclass. ///< should have its own subclass.
Lib_LibC, ///< The LibC implementation. Lib_LibC, ///< The LibC implementation.
Lib_Kernel, ///< The LibKernel implementation. Lib_Kernel, ///< The LibKernel implementation.
Lib_Pad, ///< The LibScePad implementation. Lib_Pad, ///< The LibScePad implementation.
Lib_GnmDriver, ///< The LibSceGnmDriver implementation. Lib_GnmDriver, ///< The LibSceGnmDriver implementation.
Lib_SystemService, ///< The LibSceSystemService implementation. Lib_SystemService, ///< The LibSceSystemService implementation.
Lib_UserService, ///< The LibSceUserService implementation. Lib_UserService, ///< The LibSceUserService implementation.
Lib_VideoOut, ///< The LibSceVideoOut implementation. Lib_VideoOut, ///< The LibSceVideoOut implementation.
Lib_CommonDlg, ///< The LibSceCommonDialog implementation. Lib_CommonDlg, ///< The LibSceCommonDialog implementation.
Lib_MsgDlg, ///< The LibSceMsgDialog implementation. Lib_MsgDlg, ///< The LibSceMsgDialog implementation.
Lib_AudioOut, ///< The LibSceAudioOut implementation. Lib_AudioOut, ///< The LibSceAudioOut implementation.
Lib_AudioIn, ///< The LibSceAudioIn implementation. Lib_AudioIn, ///< The LibSceAudioIn implementation.
Lib_Net, ///< The LibSceNet implementation. Lib_Net, ///< The LibSceNet implementation.
Lib_NetCtl, ///< The LibSecNetCtl implementation. Lib_NetCtl, ///< The LibSecNetCtl implementation.
Lib_SaveData, ///< The LibSceSaveData implementation. Lib_SaveData, ///< The LibSceSaveData implementation.
Lib_Ssl, ///< The LibSceSsl implementation. Lib_SaveDataDialog, ///< The LibSceSaveDataDialog implementation.
Lib_Http, ///< The LibSceHttp implementation. Lib_Ssl, ///< The LibSceSsl implementation.
Lib_SysModule, ///< The LibSceSysModule implementation Lib_Http, ///< The LibSceHttp implementation.
Frontend, ///< Emulator UI Lib_SysModule, ///< The LibSceSysModule implementation
Render, ///< Video Core Frontend, ///< Emulator UI
Render_Vulkan, ///< Vulkan backend Render, ///< Video Core
Loader, ///< ROM loader Render_Vulkan, ///< Vulkan backend
Input, ///< Input emulation Loader, ///< ROM loader
Tty, ///< Debug output from emu Input, ///< Input emulation
Count ///< Total number of logging classes Tty, ///< Debug output from emu
Count ///< Total number of logging classes
}; };
} // namespace Common::Log } // namespace Common::Log

View File

@ -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;

View File

@ -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;

View File

@ -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,9 +131,22 @@ 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) {
const SceVideoOutBufferAttribute* attribute) { 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) {
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);

View File

@ -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,

View File

@ -18,6 +18,7 @@
#include "src/core/libraries/libscenetctl.h" #include "src/core/libraries/libscenetctl.h"
#include "src/core/libraries/libsceposix.h" #include "src/core/libraries/libsceposix.h"
#include "src/core/libraries/libscesavedata.h" #include "src/core/libraries/libscesavedata.h"
#include "src/core/libraries/libscesavedatadialog.h"
#include "src/core/libraries/libscessl.h" #include "src/core/libraries/libscessl.h"
#include "src/core/libraries/libscesysmodule.h" #include "src/core/libraries/libscesysmodule.h"
#include "src/core/libraries/libscesystemservice.h" #include "src/core/libraries/libscesystemservice.h"
@ -49,6 +50,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
Libraries::Kernel::Registerlibkernel(sym); Libraries::Kernel::Registerlibkernel(sym);
Libraries::Posix::Registerlibsceposix(sym); Libraries::Posix::Registerlibsceposix(sym);
Libraries::AudioIn::RegisterlibSceAudioIn(sym); Libraries::AudioIn::RegisterlibSceAudioIn(sym);
Libraries::SaveDataDialog::RegisterlibSceSaveDataDialog(sym);
} }
} // namespace OldLibraries } // namespace OldLibraries

View File

@ -0,0 +1,84 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h"
#include "error_codes.h"
#include "libscesavedatadialog.h"
namespace Libraries::SaveDataDialog {
int PS4_SYSV_ABI sceSaveDataDialogClose() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogGetResult() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogGetStatus() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogInitialize() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogIsReadyToDisplay() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogOpen() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogProgressBarInc() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogProgressBarSetValue() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogTerminate() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceSaveDataDialogUpdateStatus() {
LOG_ERROR(Lib_SaveDataDialog, "(STUBBED) called");
return ORBIS_OK;
}
void RegisterlibSceSaveDataDialog(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("fH46Lag88XY", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogClose);
LIB_FUNCTION("yEiJ-qqr6Cg", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogGetResult);
LIB_FUNCTION("ERKzksauAJA", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogGetStatus);
LIB_FUNCTION("s9e3+YpRnzw", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogInitialize);
LIB_FUNCTION("en7gNVnh878", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogIsReadyToDisplay);
LIB_FUNCTION("4tPhsP6FpDI", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogOpen);
LIB_FUNCTION("V-uEeFKARJU", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogProgressBarInc);
LIB_FUNCTION("hay1CfTmLyA", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogProgressBarSetValue);
LIB_FUNCTION("YuH2FA7azqQ", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogTerminate);
LIB_FUNCTION("KK3Bdg1RWK0", "libSceSaveDataDialog", 1, "libSceSaveDataDialog", 1, 1,
sceSaveDataDialogUpdateStatus);
};
} // namespace Libraries::SaveDataDialog

View File

@ -0,0 +1,22 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "library_common.h"
namespace Libraries::SaveDataDialog {
int PS4_SYSV_ABI sceSaveDataDialogClose();
int PS4_SYSV_ABI sceSaveDataDialogGetResult();
int PS4_SYSV_ABI sceSaveDataDialogGetStatus();
int PS4_SYSV_ABI sceSaveDataDialogInitialize();
int PS4_SYSV_ABI sceSaveDataDialogIsReadyToDisplay();
int PS4_SYSV_ABI sceSaveDataDialogOpen();
int PS4_SYSV_ABI sceSaveDataDialogProgressBarInc();
int PS4_SYSV_ABI sceSaveDataDialogProgressBarSetValue();
int PS4_SYSV_ABI sceSaveDataDialogTerminate();
int PS4_SYSV_ABI sceSaveDataDialogUpdateStatus();
void RegisterlibSceSaveDataDialog(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::SaveDataDialog

View File

@ -203,6 +203,7 @@ void emuRun() {
calculateFps(0); // TODO: Proper fps calculateFps(0); // TODO: Proper fps
} }
} }
HLE::Libs::Graphics::VideoOut::VideoOutVblank();
} }
} }
} }