Merge pull request #170 from igor725/stubz

Stub some sceNp apis
This commit is contained in:
SysRay 2024-05-29 18:52:04 +02:00 committed by GitHub
commit 6533a98052
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 107 additions and 15 deletions

View File

@ -1,13 +1,15 @@
#pragma once
#include "utility/utility.h"
// clang-format off
using pthread_entry_func_t = SYSV_ABI void* (*)(void*);
using pthread_key_destructor_func_t = SYSV_ABI void (*)(void*);
using thread_dtors_func_t = SYSV_ABI void (*)();
using thread_clean_func_t = SYSV_ABI void (*)(void*);
using pthread_once_init = SYSV_ABI void (*)();
using thread_dtors_func_t = SYSV_ABI void (*)();
using thread_clean_func_t = SYSV_ABI void (*)(void*);
using pthread_once_init = SYSV_ABI void (*)();
// clang-format on
struct SceSchedParam {
int sched_priority;

View File

@ -24,12 +24,12 @@ void init() {
void initIntercepts() {
/*Usage
// functions has to be of SYSV_ABI!
accessRuntimeExport()->interceptAdd((uintptr_t)int_Malloc, "Y7aJ1uydPMo", "libc", "libc")
accessRuntimeLinker().interceptAdd((uintptr_t)int_Malloc, "Y7aJ1uydPMo", "libc", "libc")
// Calling original
auto const origFunction = accessRuntimeExport()->interceptGetAddr((uintptr_t)int_Malloc);
auto const origFunction = accessRuntimeLinker().interceptGetAddr((uintptr_t)int_Malloc);
typedef SYSV_ABI void* (*fcnPtr)(void*, size_t);
void* ret = ((fcnPtr)origFunction)(ptr, size);
*/
}
} // namespace intern
} // namespace intern

View File

@ -22,10 +22,14 @@
namespace {
LOG_DEFINE_MODULE(ELF64);
// clang-format off
using module_func_t = SYSV_ABI int (*)(size_t args, const void* argp);
using module_call_func_t = SYSV_ABI void (*)();
using module_ini_fini_func_t = SYSV_ABI int (*)(size_t args, const void* argp, module_func_t func);
// clang-format on
int jmpModule(uint64_t addr, size_t args, const void* argp, module_func_t func) {
return reinterpret_cast<module_ini_fini_func_t>(addr)(args, argp, func);
}

View File

@ -26,10 +26,14 @@
LOG_DEFINE_MODULE(RuntimeLinker);
namespace {
// clang-format off
using atexit_func_t = SYSV_ABI void (*)();
using entry_func_t = SYSV_ABI void (*)(EntryParams const* params, atexit_func_t atexit_func);
using module_func_t = SYSV_ABI int (*)(size_t args, const void* argp, atexit_func_t atexit_func);
// clang-format on
struct FrameS {
FrameS* next;
uintptr_t ret_addr;

View File

@ -3,6 +3,8 @@
#include "utility/utility.h"
typedef void* SceAvPlayerHandle;
// clang-format off
using SceAvPlayerLogCallback = SYSV_ABI int (*)(void* userData, const char* format, va_list args);
using SceAvPlayerAllocate = SYSV_ABI void* (*)(void* argP, uint32_t argAlignment, uint32_t argSize);
using SceAvPlayerDeallocate = SYSV_ABI void (*)(void* argP, void* argMemory);
@ -14,6 +16,8 @@ using SceAvPlayerReadOffsetFile = SYSV_ABI int (*)(void* argP, uint8_t* argBu
using SceAvPlayerEventCallback = SYSV_ABI void (*)(void* p, int32_t argEventId, int32_t argSourceId, void* argEventData);
using SceAvPlayerSizeFile = SYSV_ABI uint64_t (*)(void* argP);
// clang-format on
enum class SceAvPlayerVideoDecoderType { DEFAULT = 0, RESERVED1, RESERVED2, SOFTWARE2 };
enum class SceAvPlayerAudioDecoderType { DEFAULT = 0, RESERVED1, RESERVED2 };

View File

@ -29,7 +29,7 @@ EXPORT SYSV_ABI int32_t sceGameLiveStreamingPermitLiveStreaming() {
EXPORT SYSV_ABI int32_t sceGameLiveStreamingGetCurrentStatus(SceGameLiveStreamingStatus* glss) {
LOG_USE_MODULE(libSceGameLiveStreaming);
LOG_ERR(L"todo %S", __FUNCTION__);
LOG_TRACE(L"todo %S", __FUNCTION__);
glss->isOnAir = false;
glss->userId = 1;
return Ok;
@ -37,7 +37,7 @@ EXPORT SYSV_ABI int32_t sceGameLiveStreamingGetCurrentStatus(SceGameLiveStreamin
EXPORT SYSV_ABI int32_t sceGameLiveStreamingGetCurrentStatus2(SceGameLiveStreamingStatus2* glss2) {
LOG_USE_MODULE(libSceGameLiveStreaming);
LOG_ERR(L"todo %S", __FUNCTION__);
LOG_TRACE(L"todo %S", __FUNCTION__);
glss2->isOnAir = false;
glss2->userId = 1;
return Ok;
@ -69,7 +69,7 @@ EXPORT SYSV_ABI int32_t sceGameLiveStreamingSetCameraFrameSetting(const SceGameL
EXPORT SYSV_ABI int32_t sceGameLiveStreamingGetCurrentBroadcastScreenLayout(SceGameLiveStreamingBroadcastScreenLayout* layout) {
LOG_USE_MODULE(libSceGameLiveStreaming);
LOG_ERR(L"todo %S", __FUNCTION__);
LOG_TRACE(L"todo %S", __FUNCTION__);
return Ok;
}

View File

@ -7,10 +7,12 @@
LOG_DEFINE_MODULE(libSceNpManager);
namespace {
// clang-format off
using SceNpStateCallbackA = SYSV_ABI void (*)(int32_t userId, SceNpState state, void* userdata);
using SceNpReachabilityStateCallback = SYSV_ABI void (*)(int32_t userId, SceNpReachabilityState state, void* userdata);
using SceNpGamePresenceCallbackA = SYSV_ABI void (*)(int32_t userId, SceNpGamePresenceStatus status, void* userdata);
using SceNpPlusEventCallback = SYSV_ABI void (*)(int32_t userId, SceNpPlusEventType event, void* userdata);
// clang-format on
} // namespace
extern "C" {

View File

@ -397,4 +397,59 @@ EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_11UserProf
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::Matching::Room>::~Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_8Matching4RoomEED1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::RequestBase::getFunctionType() const
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZNK3sce7Toolkit2NP2V24Core11RequestBase15getFunctionTypeEv)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::UserProfile::NpProfiles>::~Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_11UserProfile10NpProfilesEED1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::TSS::TssData>::Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_3TSS7TssDataEEC1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
/**
* @brief sce::Toolkit::NP::V2::Core::Response<sce::Toolkit::NP::V2::TSS::TssData>::~Response()
*
*/
EXPORT SYSV_ABI int32_t __NID(_ZN3sce7Toolkit2NP2V24Core8ResponseINS2_3TSS7TssDataEED1Ev)() {
LOG_USE_MODULE(libSceNpToolkit2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
}

View File

@ -50,6 +50,14 @@ EXPORT SYSV_ABI int32_t sceNpWebApiCreateContextA(int32_t libCtxId, int32_t user
return Ok;
}
EXPORT SYSV_ABI int32_t sceNpWebApiCreatePushEventFilter() {
return Ok;
}
EXPORT SYSV_ABI int32_t sceNpWebApiCreateServicePushEventFilter() {
return Ok;
}
EXPORT SYSV_ABI int32_t sceNpWebApiDeleteContext(int32_t titleUserCtxId) {
return Ok;
}

View File

@ -63,6 +63,7 @@ EXPORT SYSV_ABI int32_t scePlayGoSetToDoList(ScePlayGoHandle handle, const ScePl
EXPORT SYSV_ABI int32_t scePlayGoGetToDoList(ScePlayGoHandle handle, ScePlayGoToDo* outTodoList, uint32_t numberOfEntries, uint32_t* outEntries) {
LOG_USE_MODULE(libScePlayGo);
LOG_ERR(L"TODO: %S", __FUNCTION__);
*outEntries = 0;
return Ok;
}
@ -75,6 +76,7 @@ EXPORT SYSV_ABI int32_t scePlayGoPrefetch(ScePlayGoHandle handle, const ScePlayG
EXPORT SYSV_ABI int32_t scePlayGoGetEta(ScePlayGoHandle handle, const ScePlayGoChunkId* chunkIds, uint32_t numberOfEntries, ScePlayGoEta* outEta) {
LOG_USE_MODULE(libScePlayGo);
LOG_ERR(L"TODO: %S", __FUNCTION__);
*outEta = 0;
return Ok;
}

View File

@ -43,7 +43,7 @@ EXPORT SYSV_ABI int sceRemoteplayProhibitStreaming(SceRemoteplayStreamingProhibi
EXPORT SYSV_ABI int sceRemoteplayGetConnectionStatus(SceUserServiceUserId userid, SceRemoteplayConnectionStatus* pStatus) {
*pStatus = SceRemoteplayConnectionStatus::Disconnect;
LOG_USE_MODULE(libSceRemoteplay);
LOG_ERR(L"todo %S", __FUNCTION__);
LOG_TRACE(L"todo %S", __FUNCTION__);
return Ok;
}
}
}

View File

@ -5,9 +5,13 @@
using SceKernelModule = int32_t;
// clang-format off
using get_thread_atexit_count_func_t = SYSV_ABI int (*)(SceKernelModule);
using thread_atexit_report_func_t = SYSV_ABI void (*)(SceKernelModule);
// clang-format on
typedef int SceKernelAioSubmitId;
typedef void* sigset_t;

View File

@ -8,9 +8,16 @@
#include <cassert>
#include <chrono>
#include <mutex>
#include <unordered_map>
// clang-format off
#include <p7/GTypes.h>
#include <p7/P7_Telemetry.h>
#include <p7/P7_Trace.h>
#include <unordered_map>
#include <p7/P7_Extensions.h>
// clang-format on
namespace __Log {
@ -124,12 +131,12 @@ void __log(eTrace_Level level, void* hmodule, unsigned short i_wLine, const char
if (static_cast<typename std::underlying_type<__Log::eTrace_Level>::type>(level) ==
static_cast<typename std::underlying_type<__Log::eTrace_Level>::type>(eTrace_Level::err)) {
printf("Error:");
printf("%s| Error:", ((sP7Trace_Module*)hmodule)->pName);
vwprintf(i_pFormat, args);
printf("\n");
} else if (static_cast<typename std::underlying_type<__Log::eTrace_Level>::type>(level) ==
static_cast<typename std::underlying_type<__Log::eTrace_Level>::type>(eTrace_Level::crit)) {
printf("Critical Error:");
printf("%s| Critical Error:", ((sP7Trace_Module*)hmodule)->pName);
vwprintf(i_pFormat, args);
printf("\nExiting\n");
}