From b34f34ebde3d79c7d698ad27e96bd77b77966aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 7 Apr 2025 22:25:36 +0200 Subject: [PATCH] Move some more error codes to the big enum --- Core/HLE/ErrorCodes.h | 12 ++++++++++++ Core/HLE/NetInetConstants.h | 13 ------------- Core/HLE/sceKernel.cpp | 11 +++++++++++ Core/HLE/sceNet.cpp | 16 ++++++++-------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Core/HLE/ErrorCodes.h b/Core/HLE/ErrorCodes.h index beb00143af..007aeaf46a 100644 --- a/Core/HLE/ErrorCodes.h +++ b/Core/HLE/ErrorCodes.h @@ -538,4 +538,16 @@ enum PSPErrorCode : u32 { SCE_NET_RESOLVER_ERROR_RES_SERVER_REFUSED = 0x80410416, SCE_NET_RESOLVER_ERROR_INTERNAL = 0x80410417, + // pspnet_apctl + SCE_NET_APCTL_ERROR_ALREADY_INITIALIZED = 0x80410a01, + SCE_NET_APCTL_ERROR_INVALID_CODE = 0x80410a02, + SCE_NET_APCTL_ERROR_INVALID_IP = 0x80410a03, + SCE_NET_APCTL_ERROR_NOT_DISCONNECTED = 0x80410a04, + SCE_NET_APCTL_ERROR_NOT_IN_BSS = 0x80410a05, + SCE_NET_APCTL_ERROR_WLAN_SWITCH_OFF = 0x80410a06, + SCE_NET_APCTL_ERROR_WLAN_BEACON_LOST = 0x80410a07, + SCE_NET_APCTL_ERROR_WLAN_DISASSOCIATION = 0x80410a08, + SCE_NET_APCTL_ERROR_INVALID_ID = 0x80410a09, + SCE_NET_APCTL_ERROR_WLAN_SUSPENDED = 0x80410a0a, + SCE_NET_APCTL_ERROR_TIMEOUT = 0x80410a0b, }; diff --git a/Core/HLE/NetInetConstants.h b/Core/HLE/NetInetConstants.h index b7fc4ed2b1..595676d0f8 100644 --- a/Core/HLE/NetInetConstants.h +++ b/Core/HLE/NetInetConstants.h @@ -39,19 +39,6 @@ enum { ERROR_NET_DHCP_LEASE_TIME = 0x80410504, ERROR_NET_DHCP_GET_NAK = 0x80410505, - // pspnet_apctl - ERROR_NET_APCTL_ALREADY_INITIALIZED = 0x80410a01, - ERROR_NET_APCTL_INVALID_CODE = 0x80410a02, - ERROR_NET_APCTL_INVALID_IP = 0x80410a03, - ERROR_NET_APCTL_NOT_DISCONNECTED = 0x80410a04, - ERROR_NET_APCTL_NOT_IN_BSS = 0x80410a05, - ERROR_NET_APCTL_WLAN_SWITCH_OFF = 0x80410a06, - ERROR_NET_APCTL_WLAN_BEACON_LOST = 0x80410a07, - ERROR_NET_APCTL_WLAN_DISASSOCIATION = 0x80410a08, - ERROR_NET_APCTL_INVALID_ID = 0x80410a09, - ERROR_NET_APCTL_WLAN_SUSPENDED = 0x80410a0a, - ERROR_NET_APCTL_TIMEOUT = 0x80410a0b, - // wlan errors ERROR_NET_WLAN_ALREADY_JOINED = 0x80410d01, ERROR_NET_WLAN_TRY_JOIN = 0x80410d02, diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 85827d3be7..4b691d9631 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -1536,6 +1536,17 @@ const char *KernelErrorToString(u32 err) { case SCE_NET_RESOLVER_ERROR_RES_SERVER_REFUSED: return "SCE_NET_RESOLVER_ERROR_RES_SERVER_REFUSED"; case SCE_NET_RESOLVER_ERROR_INTERNAL: return "SCE_NET_RESOLVER_ERROR_INTERNAL"; + case SCE_NET_APCTL_ERROR_ALREADY_INITIALIZED: return "SCE_NET_APCTL_ERROR_ALREADY_INITIALIZED"; + case SCE_NET_APCTL_ERROR_INVALID_CODE: return "SCE_NET_APCTL_ERROR_INVALID_CODE"; + case SCE_NET_APCTL_ERROR_INVALID_IP: return "SCE_NET_APCTL_ERROR_INVALID_IP"; + case SCE_NET_APCTL_ERROR_NOT_DISCONNECTED: return "SCE_NET_APCTL_ERROR_NOT_DISCONNECTED"; + case SCE_NET_APCTL_ERROR_NOT_IN_BSS: return "SCE_NET_APCTL_ERROR_NOT_IN_BSS"; + case SCE_NET_APCTL_ERROR_WLAN_SWITCH_OFF: return "SCE_NET_APCTL_ERROR_WLAN_SWITCH_OFF"; + case SCE_NET_APCTL_ERROR_WLAN_BEACON_LOST: return "SCE_NET_APCTL_ERROR_WLAN_BEACON_LOST"; + case SCE_NET_APCTL_ERROR_WLAN_DISASSOCIATION: return "SCE_NET_APCTL_ERROR_WLAN_DISASSOCIATION"; + case SCE_NET_APCTL_ERROR_INVALID_ID: return "SCE_NET_APCTL_ERROR_INVALID_ID"; + case SCE_NET_APCTL_ERROR_WLAN_SUSPENDED: return "SCE_NET_APCTL_ERROR_WLAN_SUSPENDED"; + case SCE_NET_APCTL_ERROR_TIMEOUT: return "SCE_NET_APCTL_ERROR_TIMEOUT"; default: return nullptr; } diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 3b3b34273f..ccfccf1e65 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -1123,7 +1123,7 @@ void NetApctl_InitInfo(int confId) { static int sceNetApctlInit(int stackSize, int initPriority) { if (g_netApctlInited) { - return hleLogError(Log::sceNet, ERROR_NET_APCTL_ALREADY_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_ALREADY_INITIALIZED); } apctlEvents.clear(); @@ -1325,7 +1325,7 @@ static int sceNetApctlGetInfo(int code, u32 pInfoAddr) { NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo"); break; default: - return hleLogError(Log::sceNet, ERROR_NET_APCTL_INVALID_CODE, "apctl invalid code"); + return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_INVALID_CODE, "apctl invalid code"); } return hleLogDebug(Log::sceNet, 0); @@ -1392,10 +1392,10 @@ static int sceNetApctlDelHandler(u32 handlerID) { int sceNetApctlConnect(int confId) { if (!g_Config.bEnableWlan) - return hleLogError(Log::sceNet, ERROR_NET_APCTL_WLAN_SWITCH_OFF, "apctl wlan off"); + return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_WLAN_SWITCH_OFF); if (netApctlState != PSP_NET_APCTL_STATE_DISCONNECTED) - return hleLogError(Log::sceNet, ERROR_NET_APCTL_NOT_DISCONNECTED, "apctl not disconnected"); + return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_NOT_DISCONNECTED); // Is this confId is the index to the scanning's result data or sceNetApctlGetBSSDescIDListUser result? netApctlInfoId = confId; @@ -1439,7 +1439,7 @@ bool __NetApctlConnected() { } static int sceNetApctlGetState(u32 pStateAddr) { - //if (!netApctlInited) return hleLogError(Log::sceNet, ERROR_NET_APCTL_NOT_IN_BSS, "apctl not in bss"); + //if (!netApctlInited) return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_NOT_IN_BSS, "apctl not in bss"); // Valid Arguments if (Memory::IsValidAddress(pStateAddr)) { @@ -1455,11 +1455,11 @@ static int sceNetApctlGetState(u32 pStateAddr) { // This one logs like a syscall because it's called at the end of some. int NetApctl_ScanUser() { if (!g_Config.bEnableWlan) - return hleLogError(Log::sceNet, ERROR_NET_APCTL_WLAN_SWITCH_OFF, "apctl wlan off"); + return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_WLAN_SWITCH_OFF); // Scan probably only works when not in connected state, right? if (netApctlState != PSP_NET_APCTL_STATE_DISCONNECTED) - return hleLogError(Log::sceNet, ERROR_NET_APCTL_NOT_DISCONNECTED, "apctl not disconnected"); + return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_NOT_DISCONNECTED); __UpdateApctlHandlers(0, PSP_NET_APCTL_STATE_SCANNING, PSP_NET_APCTL_EVENT_SCAN_REQUEST, 0); return hleLogInfo(Log::sceNet, 0); @@ -1573,7 +1573,7 @@ int NetApctl_GetBSSDescEntryUser(int entryId, int infoId, u32 resultAddr) { Memory::Write_U32(netApctlInfo.securityType, resultAddr); break; default: - return hleLogError(Log::sceNet, ERROR_NET_APCTL_INVALID_CODE, "unknown info id"); + return hleLogError(Log::sceNet, SCE_NET_APCTL_ERROR_INVALID_CODE, "unknown info id"); } return 0;