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