Merge pull request #51 from georgemoralis/pong_homebrew

Pong,tetris homebrew
This commit is contained in:
georgemoralis 2023-10-08 10:46:59 +03:00 committed by GitHub
commit b7c4bb7ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 244 additions and 45 deletions

View File

@ -23,7 +23,28 @@ add_subdirectory("third-party")
#=================== EXAMPLE =================== #=================== EXAMPLE ===================
include_directories(src) include_directories(src)
set(LIBC_SOURCES src/Emulator/HLE/Libraries/LibC/Libc.cpp
src/Emulator/HLE/Libraries/LibC/Libc.h
src/Emulator/HLE/Libraries/LibC/printf.h
src/Emulator/HLE/Libraries/LibC/va_ctx.h
)
set(USERSERVICE_SOURCES src/Emulator/HLE/Libraries/LibUserService/user_service.cpp
src/Emulator/HLE/Libraries/LibUserService/user_service.h
)
set(PAD_SOURCES src/Emulator/HLE/Libraries/LibPad/pad.cpp
src/Emulator/HLE/Libraries/LibPad/pad.h
)
set(SYSTEMSERVICE_SOURCES src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp
src/Emulator/HLE/Libraries/LibSystemService/system_service.h
)
add_executable(shadps4 add_executable(shadps4
${LIBC_SOURCES}
${USERSERVICE_SOURCES}
${PAD_SOURCES}
${SYSTEMSERVICE_SOURCES}
src/main.cpp src/main.cpp
src/types.h src/types.h
src/Core/FsFile.cpp src/Core/FsFile.cpp
@ -55,7 +76,7 @@ add_executable(shadps4
src/Core/PS4/HLE/Kernel/cpu_management.cpp src/Core/PS4/HLE/Kernel/cpu_management.cpp
src/Core/PS4/HLE/Kernel/cpu_management.h src/Core/PS4/HLE/Kernel/cpu_management.h
"src/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/Core/PS4/HLE/Kernel/memory_management.cpp" "src/Core/PS4/HLE/Kernel/memory_management.h" "src/Core/PS4/GPU/gpu_memory.cpp" "src/Core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/Core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/Core/PS4/GPU/video_out_buffer.cpp" "src/Core/PS4/GPU/video_out_buffer.h" "src/Core/PS4/HLE/Graphics/graphics_render.cpp" "src/Core/PS4/HLE/Graphics/graphics_render.h" "src/Core/PS4/GPU/tile_manager.cpp" "src/Core/PS4/GPU/tile_manager.h" "src/version.h" "src/Emulator/HLE/Libraries/LibC/printf.h" "src/Emulator/HLE/Libraries/LibC/va_ctx.h" "src/Emulator/HLE/Libraries/LibC/libc.cpp" "src/Emulator/HLE/Libraries/LibC/libc.h") "src/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/Core/PS4/HLE/Kernel/memory_management.cpp" "src/Core/PS4/HLE/Kernel/memory_management.h" "src/Core/PS4/GPU/gpu_memory.cpp" "src/Core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/Core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/Core/PS4/GPU/video_out_buffer.cpp" "src/Core/PS4/GPU/video_out_buffer.h" "src/Core/PS4/HLE/Graphics/graphics_render.cpp" "src/Core/PS4/HLE/Graphics/graphics_render.h" "src/Core/PS4/GPU/tile_manager.cpp" "src/Core/PS4/GPU/tile_manager.h" "src/version.h" "src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp" "src/Emulator/HLE/Libraries/LibSystemService/system_service.h")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools) target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools)

View File

@ -17,6 +17,7 @@
#include "emulator.h" #include "emulator.h"
#include <Core/PS4/GPU/gpu_memory.h> #include <Core/PS4/GPU/gpu_memory.h>
#include "graphics_render.h" #include "graphics_render.h"
#include <Core/PS4/HLE/LibSceGnmDriver.h>
namespace HLE::Libs::Graphics::VideoOut { namespace HLE::Libs::Graphics::VideoOut {
@ -167,7 +168,13 @@ s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* co
GPU::renderCreateCtx(); GPU::renderCreateCtx();
// try to calculate buffer size // try to calculate buffer size
u64 buffer_size = 1280 * 768 * 4; // TODO hardcoded value should be redone u64 buffer_size = 0;//still calculation is probably partial or wrong :D
if (attribute->tilingMode == 0)
{
buffer_size = 1920 * 1088 * 4;
} else {
buffer_size = 1920 * 1080 * 4;
}
u64 buffer_pitch = attribute->pitchInPixel; u64 buffer_pitch = attribute->pitchInPixel;
VideoOutBufferSetInternal buf{}; VideoOutBufferSetInternal buf{};
@ -215,9 +222,10 @@ s32 PS4_SYSV_ABI sceVideoOutSetFlipRate(s32 handle, s32 rate) {
return SCE_OK; return SCE_OK;
} }
s32 PS4_SYSV_ABI sceVideoOutIsFlipPending(s32 handle) { s32 PS4_SYSV_ABI sceVideoOutIsFlipPending(s32 handle) {
// BREAKPOINT(); PRINT_FUNCTION_NAME();
PRINT_DUMMY_FUNCTION_NAME(); auto* videoOut = Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
return 0; s32 pending = videoOut->getCtx(handle)->m_flip_status.flipPendingNum;
return pending;
} }
s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode, s64 flipArg) { s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode, s64 flipArg) {
PRINT_FUNCTION_NAME(); PRINT_FUNCTION_NAME();
@ -242,7 +250,7 @@ s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode
LOG_TRACE_IF(log_file_videoout, "sceVideoOutSubmitFlip flip queue is full\n"); LOG_TRACE_IF(log_file_videoout, "sceVideoOutSubmitFlip flip queue is full\n");
return SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL; return SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL;
} }
HLE::Libs::LibSceGnmDriver::sceGnmFlushGarlic();//hackish should be done that neccesary for niko's homebrew
return SCE_OK; return SCE_OK;
} }
s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, SceVideoOutFlipStatus* status) { s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, SceVideoOutFlipStatus* status) {
@ -292,6 +300,7 @@ s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 i
return handle; return handle;
} }
s32 PS4_SYSV_ABI sceVideoOutUnregisterBuffers(s32 handle, s32 attributeIndex) { BREAKPOINT(); }
void videoOutRegisterLib(SymbolsResolver* sym) { void videoOutRegisterLib(SymbolsResolver* sym) {
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetFlipStatus); LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetFlipStatus);
@ -303,5 +312,6 @@ void videoOutRegisterLib(SymbolsResolver* sym) {
LIB_FUNCTION("6kPnj51T62Y", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetResolutionStatus); LIB_FUNCTION("6kPnj51T62Y", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetResolutionStatus);
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutOpen); 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, sceVideoOutIsFlipPending);
LIB_FUNCTION("N5KDtkIjjJ4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutUnregisterBuffers);
} }
} // namespace HLE::Libs::Graphics::VideoOut } // namespace HLE::Libs::Graphics::VideoOut

View File

@ -2,12 +2,12 @@
#include <Core/PS4/GPU/gpu_memory.h> #include <Core/PS4/GPU/gpu_memory.h>
#include <Core/virtual_memory.h> #include <Core/virtual_memory.h>
#include <Util/log.h>
#include <debug.h> #include <debug.h>
#include <bit> #include <bit>
#include <magic_enum.hpp> #include <magic_enum.hpp>
#include <Util/log.h>
#include "../../../../Util/Singleton.h" #include "../../../../Util/Singleton.h"
#include "../ErrorCodes.h" #include "../ErrorCodes.h"
#include "../Libs.h" #include "../Libs.h"
@ -76,10 +76,10 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
return SCE_KERNEL_ERROR_EINVAL; return SCE_KERNEL_ERROR_EINVAL;
} }
if (alignment != 0) { if (alignment != 0) {
if ((!isPowerOfTwo(alignment) && !is16KBAligned(alignment))){ if ((!isPowerOfTwo(alignment) && !is16KBAligned(alignment))) {
LOG_TRACE_IF(log_file_memory, "sceKernelMapDirectMemory returned SCE_KERNEL_ERROR_EINVAL alignment invalid\n"); LOG_TRACE_IF(log_file_memory, "sceKernelMapDirectMemory returned SCE_KERNEL_ERROR_EINVAL alignment invalid\n");
return SCE_KERNEL_ERROR_EINVAL; return SCE_KERNEL_ERROR_EINVAL;
} }
} }
LOG_INFO_IF(log_file_memory, "len = {}\n", log_hex_full(len)); LOG_INFO_IF(log_file_memory, "len = {}\n", log_hex_full(len));
@ -92,6 +92,7 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
GPU::MemoryMode gpu_mode = GPU::MemoryMode::NoAccess; GPU::MemoryMode gpu_mode = GPU::MemoryMode::NoAccess;
switch (prot) { switch (prot) {
case 0x32:
case 0x33: // SCE_KERNEL_PROT_CPU_READ|SCE_KERNEL_PROT_CPU_WRITE|SCE_KERNEL_PROT_GPU_READ|SCE_KERNEL_PROT_GPU_ALL case 0x33: // SCE_KERNEL_PROT_CPU_READ|SCE_KERNEL_PROT_CPU_WRITE|SCE_KERNEL_PROT_GPU_READ|SCE_KERNEL_PROT_GPU_ALL
cpu_mode = VirtualMemory::MemoryMode::ReadWrite; cpu_mode = VirtualMemory::MemoryMode::ReadWrite;
gpu_mode = GPU::MemoryMode::ReadWrite; gpu_mode = GPU::MemoryMode::ReadWrite;

View File

@ -6,6 +6,7 @@
#include "../Loader/Elf.h" #include "../Loader/Elf.h"
#include "Libs.h" #include "Libs.h"
#include "Emulator/HLE/Libraries/LibC/libc.h" #include "Emulator/HLE/Libraries/LibC/libc.h"
#include "ErrorCodes.h"
namespace HLE::Libs::LibC { namespace HLE::Libs::LibC {
@ -79,18 +80,27 @@ static PS4_SYSV_ABI void catchReturnFromMain(int status) {
static PS4_SYSV_ABI void _Assert() { BREAKPOINT(); } static PS4_SYSV_ABI void _Assert() { BREAKPOINT(); }
PS4_SYSV_ABI int puts(const char* s) {
std::puts(s);
return SCE_OK;
}
PS4_SYSV_ABI int rand() { return std::rand(); }
void LibC_Register(SymbolsResolver* sym) { void LibC_Register(SymbolsResolver* sym) {
LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env); LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env);
LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1, __cxa_guard_acquire); LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1, __cxa_guard_acquire);
LIB_FUNCTION("9rAeANT2tyE", "libc", 1, "libc", 1, 1, __cxa_guard_release); LIB_FUNCTION("9rAeANT2tyE", "libc", 1, "libc", 1, 1, __cxa_guard_release);
LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memcmp); LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memcmp);
LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memcpy); LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memcpy);
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memset);
LIB_FUNCTION("XKRegsFpEpk", "libc", 1, "libc", 1, 1, catchReturnFromMain); LIB_FUNCTION("XKRegsFpEpk", "libc", 1, "libc", 1, 1, catchReturnFromMain);
LIB_FUNCTION("uMei1W9uyNo", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::exit); LIB_FUNCTION("uMei1W9uyNo", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::exit);
LIB_FUNCTION("8G2LB+A3rzg", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::atexit); LIB_FUNCTION("8G2LB+A3rzg", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::atexit);
LIB_FUNCTION("-QgqOT5u2Vk", "libc", 1, "libc", 1, 1, _Assert); LIB_FUNCTION("-QgqOT5u2Vk", "libc", 1, "libc", 1, 1, _Assert);
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::printf); LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::printf);
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, puts);
LIB_FUNCTION("cpCOXWMgha0", "libc", 1, "libc", 1, 1, rand);
LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &HLE::Libs::LibC::g_need_sceLibc); LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &HLE::Libs::LibC::g_need_sceLibc);
} }

View File

@ -1,47 +1,49 @@
#include "../Loader/Elf.h"
#include "LibKernel.h" #include "LibKernel.h"
#include "Libs.h"
#include <debug.h>
#include <Util/log.h> #include <Util/log.h>
#include "Kernel/memory_management.h" #include <debug.h>
#include "../../../Util/Singleton.h" #include "../../../Util/Singleton.h"
#include "../Loader/Elf.h"
#include "Kernel/Objects/physical_memory.h" #include "Kernel/Objects/physical_memory.h"
#include "Kernel/cpu_management.h" #include "Kernel/cpu_management.h"
#include "Kernel/event_queues.h" #include "Kernel/event_queues.h"
#include "Kernel/memory_management.h"
#include "Libs.h"
namespace HLE::Libs::LibKernel { namespace HLE::Libs::LibKernel {
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; //dummy return static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len) { int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len) {
BREAKPOINT(); BREAKPOINT();
return 0; return 0;
} }
static PS4_SYSV_ABI void stack_chk_fail() { BREAKPOINT(); }
u64 PS4_SYSV_ABI sceKernelReadTsc() {
LARGE_INTEGER c;
QueryPerformanceCounter(&c);
return c.QuadPart;
}
int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len) { BREAKPOINT(); }
void LibKernel_Register(SymbolsResolver* sym) {
// obj
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &HLE::Libs::LibKernel::g_stack_chk_guard);
// memory
LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelAllocateDirectMemory);
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelGetDirectMemorySize);
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelMapDirectMemory);
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
LIB_FUNCTION("cQke9UuBQOk", "libkernel", 1, "libkernel", 1, 1, sceKernelMunmap);
// equeue
LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelCreateEqueue);
LIB_FUNCTION("fzyMKs9kim0", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelWaitEqueue);
// misc
LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, CPUManagement::sceKernelIsNeoMode);
LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail);
// time
LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc);
}
static PS4_SYSV_ABI void stack_chk_fail() { BREAKPOINT(); }; // namespace HLE::Libs::LibKernel
}
u64 PS4_SYSV_ABI sceKernelReadTsc() {
LARGE_INTEGER c;
QueryPerformanceCounter(&c);
return c.QuadPart;
}
void LibKernel_Register(SymbolsResolver* sym) {
//obj
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &HLE::Libs::LibKernel::g_stack_chk_guard);
//memory
LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelAllocateDirectMemory);
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelGetDirectMemorySize);
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelMapDirectMemory);
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
//equeue
LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelCreateEqueue);
LIB_FUNCTION("fzyMKs9kim0", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelWaitEqueue);
//misc
LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, CPUManagement::sceKernelIsNeoMode);
LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail);
//time
LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc);
}
};

View File

@ -4,6 +4,9 @@
#include "LibKernel.h" #include "LibKernel.h"
#include "LibSceGnmDriver.h" #include "LibSceGnmDriver.h"
#include <Core/PS4/HLE/Graphics/video_out.h> #include <Core/PS4/HLE/Graphics/video_out.h>
#include "Emulator/HLE/Libraries/LibUserService/user_service.h"
#include "Emulator/HLE/Libraries/LibPad/pad.h"
#include <Emulator/HLE/Libraries/LibSystemService/system_service.h>
namespace HLE::Libs { namespace HLE::Libs {
@ -12,5 +15,8 @@ void Init_HLE_Libs(SymbolsResolver *sym) {
LibKernel::LibKernel_Register(sym); LibKernel::LibKernel_Register(sym);
Graphics::VideoOut::videoOutRegisterLib(sym); Graphics::VideoOut::videoOutRegisterLib(sym);
LibSceGnmDriver::LibSceGnmDriver_Register(sym); LibSceGnmDriver::LibSceGnmDriver_Register(sym);
Emulator::HLE::Libraries::LibUserService::libUserService_Register(sym);
Emulator::HLE::Libraries::LibPad::libPad_Register(sym);
Emulator::HLE::Libraries::LibSystemService::libSystemService_Register(sym);
} }
} // namespace HLE::Libs } // namespace HLE::Libs

View File

@ -26,4 +26,6 @@ int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n) { return std::
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n) { return std::memcpy(dest, src, n); } void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n) { return std::memcpy(dest, src, n); }
void* PS4_SYSV_ABI memset(void* s, int c, size_t n) { return std::memset(s, c, n); }
}; // namespace Emulator::HLE::Libraries::LibC }; // namespace Emulator::HLE::Libraries::LibC

View File

@ -12,4 +12,5 @@ PS4_SYSV_ABI void exit(int code);
PS4_SYSV_ABI int atexit(void (*func)()); PS4_SYSV_ABI int atexit(void (*func)());
int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n); int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n);
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n); void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n);
void* PS4_SYSV_ABI memset(void* s, int c, size_t n);
} // namespace Emulator::HLE::Libraries::LibC } // namespace Emulator::HLE::Libraries::LibC

View File

@ -0,0 +1,24 @@
#include "pad.h"
#include <Core/PS4/HLE/ErrorCodes.h>
#include <Core/PS4/HLE/Libs.h>
namespace Emulator::HLE::Libraries::LibPad {
int PS4_SYSV_ABI scePadInit() { return SCE_OK; }
int PS4_SYSV_ABI scePadOpen(/* SceUserServiceUserId userId, int32_t type, int32_t index, const ScePadOpenParam* pParam*/) {
return 1; // dummy
}
int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) {
pData->connected = true; // make it think it is connected
return SCE_OK;
}
void libPad_Register(SymbolsResolver* sym) {
LIB_FUNCTION("hv1luiJrqQM", "libScePad", 1, "libScePad", 1, 1, scePadInit);
LIB_FUNCTION("xk0AcarP3V4", "libScePad", 1, "libScePad", 1, 1, scePadOpen);
LIB_FUNCTION("YndgXqQVV7c", "libScePad", 1, "libScePad", 1, 1, scePadReadState);
}
} // namespace Emulator::HLE::Libraries::LibPad

View File

@ -0,0 +1,51 @@
#pragma once
#include "Core/PS4/Loader/SymbolsResolver.h"
namespace Emulator::HLE::Libraries::LibPad {
struct ScePadData {
u32 buttons;
u08 left_stick_x;
u08 left_stick_y;
u08 right_stick_x;
u08 right_stick_y;
u08 analog_buttons_l2;
u08 analog_buttons_r2;
u08 padding[2];
float orientation_x;
float orientation_y;
float orientation_z;
float orientation_w;
float acceleration_x;
float acceleration_y;
float acceleration_z;
float angular_velocity_x;
float angular_velocity_y;
float angular_velocity_z;
u08 touch_data_touch_num;
u08 touch_data_reserve[3];
u32 touch_data_reserve1;
u16 touch_data_touch0_x;
u16 touch_data_touch0_y;
u08 touch_data_touch0_id;
u08 touch_data_touch0_reserve[3];
u16 touch_data_touch1_x;
u16 touch_data_touch1_y;
u08 touch_data_touch1_id;
u08 touch_data_touch1_reserve[3];
bool connected;
u64 timestamp;
u32 extension_unit_data_extension_unit_id;
u08 extension_unit_data_reserve[1];
u08 extension_unit_data_data_length;
u08 extension_unit_data_data[10];
u08 connected_count;
u08 reserve[2];
u08 device_unique_data_len;
u08 device_unique_data[12];
};
// hle functions
int PS4_SYSV_ABI scePadInit();
void libPad_Register(SymbolsResolver* sym);
}; // namespace Emulator::HLE::Libraries::LibPad

View File

@ -0,0 +1,16 @@
#include <Core/PS4/HLE/ErrorCodes.h>
#include <Core/PS4/HLE/Libs.h>
#include "system_service.h"
namespace Emulator::HLE::Libraries::LibSystemService {
s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen() {
// dummy
return SCE_OK;
}
void libSystemService_Register(SymbolsResolver* sym) {
LIB_FUNCTION("Vo5V8KAwCmk", "libSceSystemService", 1, "libSceSystemService", 1, 1, sceSystemServiceHideSplashScreen);
}
}; // namespace Emulator::HLE::Libraries::LibUserService

View File

@ -0,0 +1,11 @@
#pragma once
#include "Core/PS4/Loader/SymbolsResolver.h"
namespace Emulator::HLE::Libraries::LibSystemService {
//HLE functions
s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen();
void libSystemService_Register(SymbolsResolver* sym);
}; // namespace Emulator::HLE::Libraries::LibUserService

View File

@ -0,0 +1,26 @@
#include "user_service.h"
#include <Core/PS4/HLE/ErrorCodes.h>
#include <Core/PS4/HLE/Libs.h>
namespace Emulator::HLE::Libraries::LibUserService {
s32 PS4_SYSV_ABI sceUserServiceInitialize(const SceUserServiceInitializeParams* initParams) {
// dummy
return SCE_OK;
}
s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList) {
// dummy
userIdList->user_id[0] = 1;
userIdList->user_id[1] = -1;
userIdList->user_id[2] = -1;
userIdList->user_id[3] = -1;
return SCE_OK;
}
void libUserService_Register(SymbolsResolver* sym) {
LIB_FUNCTION("j3YMu1MVNNo", "libSceUserService", 1, "libSceUserService", 1, 1, sceUserServiceInitialize);
LIB_FUNCTION("fPhymKNvK-A", "libSceUserService", 1, "libSceUserService", 1, 1, sceUserServiceGetLoginUserIdList);
}
}; // namespace Emulator::HLE::Libraries::LibUserService

View File

@ -0,0 +1,18 @@
#pragma once
#include "Core/PS4/Loader/SymbolsResolver.h"
namespace Emulator::HLE::Libraries::LibUserService {
struct SceUserServiceInitializeParams {
s32 priority;
};
struct SceUserServiceLoginUserIdList {
int user_id[4];
};
s32 PS4_SYSV_ABI sceUserServiceInitialize(const SceUserServiceInitializeParams* initParams);
s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList);
void libUserService_Register(SymbolsResolver* sym);
}; // namespace Emulator::HLE::Libraries::LibUserService