implemented some dummy pad, system_service, user_service calls

This commit is contained in:
georgemoralis 2023-10-07 12:03:03 +03:00
parent 03f19c4d13
commit d96721e753
8 changed files with 154 additions and 3 deletions

View file

@ -32,9 +32,19 @@ set(USERSERVICE_SOURCES src/Emulator/HLE/Libraries/LibUserService/user_service.c
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
${LIBC_SOURCES}
${USERSERVICE_SOURCES}
${PAD_SOURCES}
${SYSTEMSERVICE_SOURCES}
src/main.cpp
src/types.h
src/Core/FsFile.cpp
@ -66,7 +76,7 @@ add_executable(shadps4
src/Core/PS4/HLE/Kernel/cpu_management.cpp
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/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)
target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools)

View file

@ -4,6 +4,9 @@
#include "LibKernel.h"
#include "LibSceGnmDriver.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 {
@ -12,5 +15,8 @@ void Init_HLE_Libs(SymbolsResolver *sym) {
LibKernel::LibKernel_Register(sym);
Graphics::VideoOut::videoOutRegisterLib(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

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

@ -1,5 +1,26 @@
#include "user_service.h"
#include <Core/PS4/HLE/ErrorCodes.h>
#include <Core/PS4/HLE/Libs.h>
namespace Emulator::HLE::Libraries::LibUserService {
void libUserService_Register(SymbolsResolver* sym) {}
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

@ -2,5 +2,17 @@
#include "Core/PS4/Loader/SymbolsResolver.h"
namespace Emulator::HLE::Libraries::LibUserService {
void libUserService_Register(SymbolsResolver* sym);
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