From 5ffd9a2d72938802191d38a4d797ff7d88cf53b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 21 Jan 2025 17:41:53 +0100 Subject: [PATCH] Reset Np state on init, this was missing. --- Core/HLE/sceKernel.cpp | 2 ++ Core/HLE/sceNp.cpp | 13 +++++++++++-- Core/HLE/sceNp.h | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index b132a43f64..2c30e6c917 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -68,6 +68,7 @@ #include "sceMp3.h" #include "sceMpeg.h" #include "sceNet.h" +#include "sceNp.h" #include "sceNetAdhoc.h" #include "sceNetAdhocMatching.h" #include "scePower.h" @@ -160,6 +161,7 @@ void __KernelInit() __UsbMicInit(); __OpenPSIDInit(); __HttpInit(); + __NpInit(); SaveState::Init(); // Must be after IO, as it may create a directory Reporting::Init(); diff --git a/Core/HLE/sceNp.cpp b/Core/HLE/sceNp.cpp index f528828ed4..ffe899757c 100644 --- a/Core/HLE/sceNp.cpp +++ b/Core/HLE/sceNp.cpp @@ -56,6 +56,14 @@ std::recursive_mutex npAuthEvtMtx; std::deque npAuthEvents; std::map npAuthHandlers; +void __NpInit() { + npAuthInited = false; + npSigninState = NP_SIGNIN_STATUS_NONE; + npAuthMemStat = {}; + npSigninTimestamp = {}; + npTitleId = {}; +} + // Tickets data are in big-endian based on captured packets static int writeTicketParam(u8* buffer, const u16_be type, const char* data = nullptr, const u16_be size = 0) { if (buffer == nullptr) return 0; @@ -144,14 +152,15 @@ static int sceNpInit() } else { npOnlineId.clear(); } - // NOTE: Checking validity and returning -1 here doesn't seem to work. Instead, we will fail to generate a ticket. - return hleLogError(Log::sceNet, 0, "UNIMPL"); } static int sceNpTerm() { + // Reset sign in state. + npSigninState = NP_SIGNIN_STATUS_NONE; + // No parameters return hleLogError(Log::sceNet, 0, "UNIMPL"); } diff --git a/Core/HLE/sceNp.h b/Core/HLE/sceNp.h index 9e6ea43276..30ffc67ca4 100644 --- a/Core/HLE/sceNp.h +++ b/Core/HLE/sceNp.h @@ -434,6 +434,8 @@ extern std::recursive_mutex npAuthEvtMtx; // Used by sceNp2.cpp extern SceNpCommunicationId npTitleId; +void __NpInit(); + int NpGetNpId(SceNpId* npid); bool NpAuthProcessEvents();