sceNetAdhocMatching: Run the input and event loops from CoreTiming instead of host threads

Each started context had two host threads, polling every 10 ms of wall
time: one sent queued packets, received, and ran hellos, keepalives and
timeouts, and the other handed events to the callbacks. A single
CoreTiming event now does both for every running context, every 1 ms of
emulated time, and Stop does what the threads did on their way out.

Matching no longer depends on host scheduling or wall-clock delays, so an
accept's ESTABLISHED comes 1-10 ms after SelectTarget at any emulation
speed, as on a PSP (pspautotests net/adhoc/pair/matchingaccept).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-31 00:44:36 +01:00
1 parent 074b6bf547
commit acb2acf0b4
4 files changed
+188 -416

No files matched your search

+3 -1
View File
@@ -395,6 +395,7 @@ void discardMatchingEvents();
void DoNetAdhocMatchingInited(PointerWrap &p);
void DoNetAdhocMatchingThreads(PointerWrap &p);
void ZeroNetAdhocMatchingThreads();
void DoNetAdhocMatchingPollEvent(PointerWrap &p, bool saved);
bool __NetAdhocConnected() {
return netAdhocInited && netAdhocctlInited && (adhocctlState == ADHOCCTL_STATE_CONNECTED || adhocctlState == ADHOCCTL_STATE_GAMEMODE);
@@ -1352,7 +1353,7 @@ static void StopFriendFinder() {
}
void __NetAdhocDoState(PointerWrap &p) {
auto s = p.Section("sceNetAdhoc", 1, 12);
auto s = p.Section("sceNetAdhoc", 1, 13);
if (!s)
return;
@@ -1458,6 +1459,7 @@ void __NetAdhocDoState(PointerWrap &p) {
} else {
adhocctlRequestTimeUs = 0;
}
DoNetAdhocMatchingPollEvent(p, s >= 13);
if (p.mode == p.MODE_READ) {
// The login after a load starts outside any group.