Reset Np state on init, this was missing.

This commit is contained in:
Henrik Rydgård 2025-01-21 17:41:53 +01:00
parent 5abb1be440
commit 5ffd9a2d72
3 changed files with 15 additions and 2 deletions

View file

@ -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();

View file

@ -56,6 +56,14 @@ std::recursive_mutex npAuthEvtMtx;
std::deque<NpAuthArgs> npAuthEvents;
std::map<int, NpAuthHandler> 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");
}

View file

@ -434,6 +434,8 @@ extern std::recursive_mutex npAuthEvtMtx;
// Used by sceNp2.cpp
extern SceNpCommunicationId npTitleId;
void __NpInit();
int NpGetNpId(SceNpId* npid);
bool NpAuthProcessEvents();