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) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-25 12:50:41 -06:00
1 parent 1d07fdba86
commit b9e7d9e0a0
2 files changed
+20

No files matched your search

+19
View File
@@ -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;