mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-28 18:46:06 +00:00
Fix some network,npmanager issues (#1215)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / pre-release (push) Blocked by required conditions
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / pre-release (push) Blocked by required conditions
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
* improved np toolkit callbacks * added ExecuteGuest in callback * clang format
This commit is contained in:
parent
7209b7d786
commit
ed24632ceb
|
@ -1,6 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <common/singleton.h>
|
||||
#include <core/linker.h>
|
||||
#include "common/config.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
@ -874,19 +876,6 @@ int PS4_SYSV_ABI sceNpCheckCallback() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
struct NpStateCallbackForNpToolkit {
|
||||
OrbisNpStateCallbackForNpToolkit func;
|
||||
void* userdata;
|
||||
};
|
||||
|
||||
NpStateCallbackForNpToolkit NpStateCbForNp;
|
||||
|
||||
int PS4_SYSV_ABI sceNpCheckCallbackForLib() {
|
||||
// LOG_ERROR(Lib_NpManager, "(STUBBED) called");
|
||||
NpStateCbForNp.func(0, ORBIS_NP_STATE_SIGNED_OUT, NpStateCbForNp.userdata);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpCheckNpAvailability() {
|
||||
LOG_ERROR(Lib_NpManager, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
|
@ -983,9 +972,10 @@ int PS4_SYSV_ABI sceNpGetGamePresenceStatusA() {
|
|||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId userId, OrbisNpId* npId) {
|
||||
LOG_ERROR(Lib_NpManager, "(DUMMY) called");
|
||||
|
||||
LOG_INFO(Lib_NpManager, "userId {}", userId);
|
||||
std::string name = Config::getUserName();
|
||||
// Fill the unused stuffs to 0
|
||||
memset(npId, 0, sizeof(*npId));
|
||||
strcpy(npId->handle.data, name.c_str());
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -1010,8 +1000,9 @@ int PS4_SYSV_ABI sceNpGetParentalControlInfoA() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpGetState() {
|
||||
LOG_ERROR(Lib_NpManager, "(STUBBED) called");
|
||||
int PS4_SYSV_ABI sceNpGetState(s32 userId, OrbisNpState* state) {
|
||||
*state = ORBIS_NP_STATE_SIGNED_OUT;
|
||||
LOG_DEBUG(Lib_NpManager, "Signed out");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -2515,12 +2506,28 @@ int PS4_SYSV_ABI Func_FF966E4351E564D6() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
struct NpStateCallbackForNpToolkit {
|
||||
OrbisNpStateCallbackForNpToolkit func;
|
||||
void* userdata;
|
||||
};
|
||||
|
||||
NpStateCallbackForNpToolkit NpStateCbForNp;
|
||||
|
||||
int PS4_SYSV_ABI sceNpCheckCallbackForLib() {
|
||||
// LOG_ERROR(Lib_NpManager, "(STUBBED) called");
|
||||
const auto* linker = Common::Singleton<Core::Linker>::Instance();
|
||||
linker->ExecuteGuest(NpStateCbForNp.func, 1, ORBIS_NP_STATE_SIGNED_OUT,
|
||||
NpStateCbForNp.userdata);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpRegisterStateCallbackForToolkit(OrbisNpStateCallbackForNpToolkit callback,
|
||||
void* userdata) {
|
||||
static int id = 0;
|
||||
LOG_ERROR(Lib_NpManager, "(STUBBED) called");
|
||||
NpStateCbForNp.func = callback;
|
||||
NpStateCbForNp.userdata = userdata;
|
||||
return 1;
|
||||
return id;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpUnregisterStateCallbackForToolkit() {
|
||||
|
|
|
@ -11,6 +11,8 @@ class SymbolsResolver;
|
|||
|
||||
namespace Libraries::NpManager {
|
||||
|
||||
constexpr int ORBIS_NP_ERROR_SIGNED_OUT = 0x80550006;
|
||||
|
||||
enum OrbisNpState {
|
||||
ORBIS_NP_STATE_UNKNOWN = 0,
|
||||
ORBIS_NP_STATE_SIGNED_OUT,
|
||||
|
@ -234,7 +236,7 @@ int PS4_SYSV_ABI sceNpGetNpReachabilityState();
|
|||
int PS4_SYSV_ABI sceNpGetOnlineId();
|
||||
int PS4_SYSV_ABI sceNpGetParentalControlInfo();
|
||||
int PS4_SYSV_ABI sceNpGetParentalControlInfoA();
|
||||
int PS4_SYSV_ABI sceNpGetState();
|
||||
int PS4_SYSV_ABI sceNpGetState(s32 userId, OrbisNpState* state);
|
||||
int PS4_SYSV_ABI sceNpGetUserIdByAccountId();
|
||||
int PS4_SYSV_ABI sceNpGetUserIdByOnlineId();
|
||||
int PS4_SYSV_ABI sceNpHasSignedUp();
|
||||
|
|
Loading…
Reference in a new issue