From b9e7d9e0a0f643ec0559a28f7edb91b0950e61ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 24 Sep 2026 11:22:18 -0600 Subject: [PATCH] Netconf: Report success, and don't get stuck without a way out - The result was only ever written on cancel, so a connection that worked gave the game back whatever was in the field, which some fill with -1. - Infrastructure mode drew a Cancel button that did nothing, so if the access point never gave an IP there was no way out. Cancelling now also disconnects the connect it started, so the game isn't left connected after being told the dialog was aborted. - An unknown netAction went down neither path and never finished. Co-Authored-By: Claude Opus 5.5 (1M context) --- Core/Dialog/PSPNetconfDialog.cpp | 19 +++++++++++++++++++ Core/HLE/sceNet.h | 1 + 2 files changed, 20 insertions(+) diff --git a/Core/Dialog/PSPNetconfDialog.cpp b/Core/Dialog/PSPNetconfDialog.cpp index 64426ce490..88762d3fbb 100644 --- a/Core/Dialog/PSPNetconfDialog.cpp +++ b/Core/Dialog/PSPNetconfDialog.cpp @@ -74,6 +74,8 @@ int PSPNetconfDialog::Init(u32 paramAddr) { jsonReady_ = false; // Kick off a request to the infra-dns.json since we'll need it later. StartInfraJsonDownload(); + // Connected, unless it's cancelled. + request.common.result = 0; ChangeStatusInit(NET_INIT_DELAY_US); @@ -201,6 +203,18 @@ int PSPNetconfDialog::Update(int animSpeed) { connResult = hleCall(sceNetApctl, int, sceNetApctlConnect, 1); } } + + // There's a Cancel button, so let it work if the connection doesn't come. + if (pendingStatus != SCE_UTILITY_STATUS_FINISHED && IsButtonPressed(cancelButtonFlag)) { + StartFade(false); + ChangeStatus(SCE_UTILITY_STATUS_FINISHED, NET_SHUTDOWN_DELAY_US); + request.common.result = SCE_UTILITY_DIALOG_RESULT_ABORT; + // Or the connect started above would carry on, and the game find itself connected. + if (connResult >= 0) { + hleCall(sceNetApctl, int, sceNetApctlDisconnect); + connResult = -1; + } + } } EndDraw(); @@ -342,6 +356,11 @@ int PSPNetconfDialog::Update(int animSpeed) { } EndDraw(); + } else if (pendingStatus != SCE_UTILITY_STATUS_FINISHED) { + // Nothing would ever finish it. + ERROR_LOG(Log::sceUtility, "Netconf: unknown action %d", request.netAction); + ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0); + request.common.result = SCE_UTILITY_DIALOG_RESULT_ABORT; } const bool finished = ReadStatus() == SCE_UTILITY_STATUS_FINISHED || pendingStatus == SCE_UTILITY_STATUS_FINISHED; diff --git a/Core/HLE/sceNet.h b/Core/HLE/sceNet.h index 818a6915db..2b5812afd8 100644 --- a/Core/HLE/sceNet.h +++ b/Core/HLE/sceNet.h @@ -117,6 +117,7 @@ int NetApctl_GetState(); bool __NetApctlConnected(); int sceNetApctlConnect(int connIndex); +int sceNetApctlDisconnect(); // Are we connected - for the purpose of disabling speed consoles and savestates etc. bool IsNetworkConnected();