diff --git a/src/core/libraries/np_manager/np_manager.cpp b/src/core/libraries/np_manager/np_manager.cpp index 4fff59003..1d908f6da 100644 --- a/src/core/libraries/np_manager/np_manager.cpp +++ b/src/core/libraries/np_manager/np_manager.cpp @@ -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::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; diff --git a/src/core/libraries/np_manager/np_manager.h b/src/core/libraries/np_manager/np_manager.h index 7e906cdc8..a09c88a26 100644 --- a/src/core/libraries/np_manager/np_manager.h +++ b/src/core/libraries/np_manager/np_manager.h @@ -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();