implemented np manager state callback
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / windows-qt (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / macos-qt (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-qt (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled

This commit is contained in:
georgemoralis 2024-11-03 10:43:55 +02:00
parent 15cee3da75
commit 55b6a6a6a7
2 changed files with 26 additions and 11 deletions

View file

@ -871,11 +871,6 @@ int PS4_SYSV_ABI sceNpAsmTerminate() {
return ORBIS_OK;
}
int PS4_SYSV_ABI sceNpCheckCallback() {
LOG_TRACE(Lib_NpManager, "(STUBBED) called");
return ORBIS_OK;
}
int PS4_SYSV_ABI sceNpCheckNpAvailability() {
LOG_ERROR(Lib_NpManager, "(STUBBED) called");
return ORBIS_OK;
@ -1941,9 +1936,19 @@ int PS4_SYSV_ABI sceNpRegisterPlusEventCallback() {
return ORBIS_OK;
}
int PS4_SYSV_ABI sceNpRegisterStateCallback() {
struct NpStateCallback {
OrbisNpStateCallback func;
void* userdata;
};
NpStateCallback NpStateCb;
int PS4_SYSV_ABI sceNpRegisterStateCallback(OrbisNpStateCallback callback, void* userdata) {
static int id = 0;
LOG_ERROR(Lib_NpManager, "(STUBBED) called");
return ORBIS_OK;
NpStateCb.func = callback;
NpStateCb.userdata = userdata;
return id;
}
int PS4_SYSV_ABI sceNpRegisterStateCallbackA() {
@ -1951,6 +1956,13 @@ int PS4_SYSV_ABI sceNpRegisterStateCallbackA() {
return ORBIS_OK;
}
int PS4_SYSV_ABI sceNpCheckCallback() {
LOG_TRACE(Lib_NpManager, "(STUBBED) called");
const auto* linker = Common::Singleton<Core::Linker>::Instance();
linker->ExecuteGuest(NpStateCb.func, 1, ORBIS_NP_STATE_SIGNED_OUT, nullptr, NpStateCb.userdata);
return ORBIS_OK;
}
int PS4_SYSV_ABI sceNpServiceClientInit() {
LOG_ERROR(Lib_NpManager, "(STUBBED) called");
return ORBIS_OK;

View file

@ -19,9 +19,6 @@ enum OrbisNpState {
ORBIS_NP_STATE_SIGNED_IN
};
using OrbisNpStateCallbackForNpToolkit = PS4_SYSV_ABI void (*)(s32 userId, OrbisNpState state,
void* userdata);
constexpr int ORBIS_NP_ONLINEID_MAX_LENGTH = 16;
typedef int OrbisUserServiceUserId;
@ -38,6 +35,12 @@ struct OrbisNpId {
u8 reserved[8];
};
using OrbisNpStateCallbackForNpToolkit = PS4_SYSV_ABI void (*)(s32 userId, OrbisNpState state,
void* userdata);
using OrbisNpStateCallback = PS4_SYSV_ABI void (*)(s32 userId, OrbisNpState state, OrbisNpId* npId,
void* userdata);
int PS4_SYSV_ABI Func_EF4378573542A508();
int PS4_SYSV_ABI _sceNpIpcCreateMemoryFromKernel();
int PS4_SYSV_ABI _sceNpIpcCreateMemoryFromPool();
@ -423,7 +426,7 @@ int PS4_SYSV_ABI sceNpRegisterGamePresenceCallback();
int PS4_SYSV_ABI sceNpRegisterGamePresenceCallbackA();
int PS4_SYSV_ABI sceNpRegisterNpReachabilityStateCallback();
int PS4_SYSV_ABI sceNpRegisterPlusEventCallback();
int PS4_SYSV_ABI sceNpRegisterStateCallback();
int PS4_SYSV_ABI sceNpRegisterStateCallback(OrbisNpStateCallback callback, void* userdata);
int PS4_SYSV_ABI sceNpRegisterStateCallbackA();
int PS4_SYSV_ABI sceNpServiceClientInit();
int PS4_SYSV_ABI sceNpServiceClientTerm();