From 28aad0a5dc67ab9e42ed21e8c454fde98fa13b4a Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Fri, 21 Jul 2023 08:03:36 +0300 Subject: [PATCH] Added sysv_abi , now parameters in sceVideoOutOpen is correct --- CMakeSettings.json | 61 +++++++++++++++++------------ src/Core/PS4/HLE/LibC.cpp | 4 +- src/Core/PS4/HLE/LibC.h | 4 +- src/Core/PS4/HLE/LibSceVideoOut.cpp | 2 +- src/Core/PS4/HLE/LibSceVideoOut.h | 2 +- src/Core/PS4/Linker.cpp | 8 ++-- src/types.h | 4 +- 7 files changed, 49 insertions(+), 36 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index 207648b5..2095ca9e 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -1,27 +1,38 @@ { - "configurations": [ - { - "name": "x64-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "inheritEnvironments": [ "msvc_x64_x64" ], - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "" - }, - { - "name": "x64-Release", - "generator": "Ninja", - "configurationType": "Release", - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "", - "inheritEnvironments": [ "msvc_x64_x64" ], - "variables": [] - } - ] + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ] + }, + { + "name": "x64-Clang-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "clang_cl_x64_x64" ], + "variables": [] + } + ] } \ No newline at end of file diff --git a/src/Core/PS4/HLE/LibC.cpp b/src/Core/PS4/HLE/LibC.cpp index e39dc278..d482a0ee 100644 --- a/src/Core/PS4/HLE/LibC.cpp +++ b/src/Core/PS4/HLE/LibC.cpp @@ -6,7 +6,7 @@ namespace HLE::Libs::LibC { static u32 g_need_sceLibc = 1; - static void init_env() //every game/demo should probably + static PS4_SYSV_ABI void init_env() // every game/demo should probably { //dummy no need atm } @@ -35,7 +35,7 @@ namespace HLE::Libs::LibC { { } - static int atexit(void (*func)()) + static PS4_SYSV_ABI int atexit(void (*func)()) { int rt = ::atexit(func); if (rt != 0) diff --git a/src/Core/PS4/HLE/LibC.h b/src/Core/PS4/HLE/LibC.h index 241a785c..bc0913a3 100644 --- a/src/Core/PS4/HLE/LibC.h +++ b/src/Core/PS4/HLE/LibC.h @@ -5,8 +5,8 @@ namespace HLE::Libs::LibC { void LibC_Register(SymbolsResolver* sym); //functions - static void init_env(); - static void exit(int code); + static PS4_SYSV_ABI void init_env(); + static PS4_SYSV_ABI void exit(int code); static void catchReturnFromMain(int status); int __cxa_guard_acquire(u64* guard_object); int memcmp(const void* s1, const void* s2, size_t n); diff --git a/src/Core/PS4/HLE/LibSceVideoOut.cpp b/src/Core/PS4/HLE/LibSceVideoOut.cpp index 419059db..f98426af 100644 --- a/src/Core/PS4/HLE/LibSceVideoOut.cpp +++ b/src/Core/PS4/HLE/LibSceVideoOut.cpp @@ -31,7 +31,7 @@ namespace HLE::Libs::LibSceVideoOut { } - int32_t sceVideoOutOpen(SceUserServiceUserId userId, int32_t busType, int32_t index, const void* param) + int32_t PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, int32_t busType, int32_t index, const void* param) { if (busType != 0) { diff --git a/src/Core/PS4/HLE/LibSceVideoOut.h b/src/Core/PS4/HLE/LibSceVideoOut.h index 672184ab..688c55ba 100644 --- a/src/Core/PS4/HLE/LibSceVideoOut.h +++ b/src/Core/PS4/HLE/LibSceVideoOut.h @@ -15,6 +15,6 @@ int32_t sceVideoOutSetFlipRate(int32_t handle, int32_t rate); void sceVideoOutSetBufferAttribute(/* SceVideoOutBufferAttribute* attribute,*/ uint32_t pixelFormat, uint32_t tilingMode, uint32_t aspectRatio, uint32_t width, uint32_t height, uint32_t pitchInPixel); int32_t sceVideoOutGetResolutionStatus(int32_t handle /*, SceVideoOutResolutionStatus* status*/); -int32_t sceVideoOutOpen(SceUserServiceUserId userId,int32_t busType, int32_t index, const void* param); +int32_t PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, int32_t busType, int32_t index, const void* param); int32_t sceVideoOutIsFlipPending(int32_t handle); }; // namespace HLE::Libs::LibSceVideoOut \ No newline at end of file diff --git a/src/Core/PS4/Linker.cpp b/src/Core/PS4/Linker.cpp index f9f27fff..8ed91844 100644 --- a/src/Core/PS4/Linker.cpp +++ b/src/Core/PS4/Linker.cpp @@ -631,15 +631,15 @@ void Linker::Resolve(const std::string& name, int Symtype, Module* m, SymbolReco } -using exit_func_t = void (*)(); -using entry_func_t = void (*)(EntryParams* params, exit_func_t atexit_func); +using exit_func_t = PS4_SYSV_ABI void (*)(); +using entry_func_t = PS4_SYSV_ABI void (*)(EntryParams* params, exit_func_t atexit_func); -static void ProgramExitFunc() { +static PS4_SYSV_ABI void ProgramExitFunc() { printf("exit function called\n"); } -static void run_main_entry(u64 addr, EntryParams* params, exit_func_t exit_func) { +static PS4_SYSV_ABI void run_main_entry(u64 addr, EntryParams* params, exit_func_t exit_func) { reinterpret_cast(addr)(params, exit_func); } diff --git a/src/types.h b/src/types.h index 64a05f85..d749b8f1 100644 --- a/src/types.h +++ b/src/types.h @@ -11,4 +11,6 @@ using u32 = unsigned int; using u64 = unsigned long long; using f32 = float; -using f64 = double; \ No newline at end of file +using f64 = double; + +#define PS4_SYSV_ABI __attribute__((sysv_abi)) \ No newline at end of file