From c4dafe28b025d796a09e0a605810d145a14f7532 Mon Sep 17 00:00:00 2001 From: Nemoumbra Date: Tue, 1 Jul 2025 23:57:30 +0300 Subject: [PATCH] g_adhocServerConnected moved to NetAdhocCommon --- Core/HLE/NetAdhocCommon.cpp | 6 +++++- Core/HLE/NetAdhocCommon.h | 5 +++++ Core/HLE/sceNetAdhoc.cpp | 1 - Core/HLE/sceNetAdhoc.h | 2 +- UI/ImDebugger/ImDebugger.cpp | 1 + UI/PauseScreen.cpp | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Core/HLE/NetAdhocCommon.cpp b/Core/HLE/NetAdhocCommon.cpp index 7ad6aed1e3..dfb1f83f1e 100644 --- a/Core/HLE/NetAdhocCommon.cpp +++ b/Core/HLE/NetAdhocCommon.cpp @@ -35,12 +35,14 @@ void netAdhocValidateLoopMemory() { } int netAdhocEnterGameModeTimeout = 15000000; // 15 sec as default timeout, to wait for all players to join -int adhocDefaultTimeout = 5000000; //2000000 usec // For some unknown reason, sometimes it tooks more than 2 seconds for Adhocctl Init to connect to AdhocServer on localhost (normally only 10 ms), and sometimes it tooks more than 1 seconds for built-in AdhocServer to be ready (normally only 1 ms) +// TODO: constify +int adhocDefaultTimeout = 5000000; //2000000 usec // For some unknown reason, sometimes it tooks more than 2 seconds for Adhocctl Init to connect to AdhocServer on localhost (normally only 10 ms), and sometimes it tooks more than 1 seconds for built-in AdhocServer to be ready (normally only 1 ms) int adhocDefaultDelay = 10000; //10000 int adhocExtraDelay = 20000; //20000 int adhocEventPollDelay = 100000; //100000; // Same timings with PSP_ADHOCCTL_RECV_TIMEOUT ? int adhocEventDelay = 2000000; //2000000 on real PSP ? + std::recursive_mutex adhocEvtMtx; int IsAdhocctlInCB = 0; @@ -48,3 +50,5 @@ int IsAdhocctlInCB = 0; u32 matchingThreadHackAddr = 0; u32_le matchingThreadCode[3]; + +bool g_adhocServerConnected = false; diff --git a/Core/HLE/NetAdhocCommon.h b/Core/HLE/NetAdhocCommon.h index 6a323877b7..91deac1d39 100644 --- a/Core/HLE/NetAdhocCommon.h +++ b/Core/HLE/NetAdhocCommon.h @@ -28,11 +28,14 @@ extern u32_le dummyThreadCode[3]; void netAdhocValidateLoopMemory(); extern int netAdhocEnterGameModeTimeout; + +// TODO: constify extern int adhocDefaultTimeout; //3000000 usec extern int adhocDefaultDelay; //10000 extern int adhocExtraDelay; //20000 extern int adhocEventPollDelay; //100000; // Seems to be the same with PSP_ADHOCCTL_RECV_TIMEOUT extern int adhocEventDelay; //1000000 + extern std::recursive_mutex adhocEvtMtx; // TODO: this one is broken, perhaps delete it entirely? @@ -41,3 +44,5 @@ extern int IsAdhocctlInCB; extern u32 matchingThreadHackAddr; extern u32_le matchingThreadCode[3]; + +extern bool g_adhocServerConnected; \ No newline at end of file diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 5ed2a322ec..69485c7144 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -63,7 +63,6 @@ // TODO: Make accessor functions instead, and throw all this state in a struct. bool netAdhocInited; bool netAdhocctlInited; -bool g_adhocServerConnected = false; #define DISCOVER_DURATION_US 2000000 // 2 seconds is probably the normal time it takes for PSP to connect to a group (ie. similar to NetconfigDialog time) u64 netAdhocDiscoverStartTime = 0; diff --git a/Core/HLE/sceNetAdhoc.h b/Core/HLE/sceNetAdhoc.h index 0ed7227ede..76793fe61c 100644 --- a/Core/HLE/sceNetAdhoc.h +++ b/Core/HLE/sceNetAdhoc.h @@ -137,7 +137,7 @@ int NetAdhoc_Term(); // May need to use these from sceNet.cpp extern bool netAdhocInited; // TODO: keep here extern bool netAdhocctlInited; // TODO: move to sceNetAdhocctl -extern bool g_adhocServerConnected; + extern bool netAdhocGameModeEntered; extern s32 netAdhocDiscoverStatus; // TODO: maybe move to sceNetAdhocDiscover? diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index a5459bbad9..62afba4405 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -36,6 +36,7 @@ #include "Core/HLE/sceNetAdhoc.h" #include "Core/HLE/proAdhoc.h" #include "Core/HLE/sceNetAdhocMatching.h" +#include "Core/HLE/NetAdhocCommon.h" #include "Common/System/Request.h" #include "Core/Util/AtracTrack.h" diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 7336981174..8068addbfb 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -47,6 +47,7 @@ #include "Core/HLE/sceNet.h" #include "Core/HLE/sceNetInet.h" #include "Core/HLE/sceNetAdhoc.h" +#include "Core/HLE/NetAdhocCommon.h" #include "GPU/GPUCommon.h" #include "GPU/GPUState.h"