Skip to content

Commit f459999

Browse files
committed
Forgot to return on invalid address, and moving reusable code out of HLE to prevent generating confusing logs
1 parent eee32f8 commit f459999

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

Core/HLE/sceNet.cpp

+23-17
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ static int sceNetApctlGetState(u32 pStateAddr) {
11641164
return hleLogSuccessI(SCENET, 0);
11651165
}
11661166

1167-
return hleLogError(SCENET, -1, "apctl invalid arg");
1167+
return hleLogError(SCENET, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ?
11681168
}
11691169

11701170
int NetApctl_ScanUser() {
@@ -1181,14 +1181,12 @@ static int sceNetApctlScanUser() {
11811181
return NetApctl_ScanUser();
11821182
}
11831183

1184-
static int sceNetApctlGetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
1185-
WARN_LOG(SCENET, "UNTESTED %s(%08x, %08x)", __FUNCTION__, sizeAddr, bufAddr);
1186-
1184+
int NetApctl_GetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
11871185
const int userInfoSize = 8; // 8 bytes per entry (next address + entry id)
11881186
// Faking 4 entries, games like MGS:PW Recruit will need to have a different AP for each entry
11891187
int entries = 4;
1190-
if (!Memory::IsValidAddress(sizeAddr))
1191-
hleLogError(SCENET, -1, "apctl invalid arg");
1188+
if (!Memory::IsValidAddress(sizeAddr) || !Memory::IsValidAddress(bufAddr))
1189+
return hleLogError(SCENET, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ?
11921190

11931191
int size = Memory::Read_U32(sizeAddr);
11941192
// Return size required
@@ -1205,7 +1203,7 @@ static int sceNetApctlGetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
12051203
DEBUG_LOG(SCENET, "%s writing ID#%d to %08x", __FUNCTION__, i, bufAddr + offset);
12061204

12071205
// Pointer to next Network structure in list
1208-
Memory::Write_U32((i+1)*userInfoSize + bufAddr, bufAddr + offset);
1206+
Memory::Write_U32((i + 1) * userInfoSize + bufAddr, bufAddr + offset);
12091207
offset += 4;
12101208

12111209
// Entry ID
@@ -1217,14 +1215,17 @@ static int sceNetApctlGetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
12171215
Memory::Write_U32(0, bufAddr + offset - userInfoSize);
12181216
}
12191217

1220-
return hleLogWarning(SCENET, 0, "untested");
1218+
return 0;
12211219
}
12221220

1223-
static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAddr) {
1224-
WARN_LOG(SCENET, "UNTESTED %s(%i, %i, %08x)", __FUNCTION__, entryId, infoId, resultAddr);
1221+
static int sceNetApctlGetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
1222+
WARN_LOG(SCENET, "UNTESTED %s(%08x, %08x)", __FUNCTION__, sizeAddr, bufAddr);
1223+
return NetApctl_GetBSSDescIDListUser(sizeAddr, bufAddr);
1224+
}
12251225

1226+
int NetApctl_GetBSSDescEntryUser(int entryId, int infoId, u32 resultAddr) {
12261227
if (!Memory::IsValidAddress(resultAddr))
1227-
hleLogError(SCENET, -1, "apctl invalid arg");
1228+
return hleLogError(SCENET, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ?
12281229

12291230
// Generate an SSID name
12301231
char dummySSID[APCTL_SSID_MAXLEN] = "WifiAP0";
@@ -1286,11 +1287,16 @@ static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAdd
12861287
return hleLogError(SCENET, ERROR_NET_APCTL_INVALID_CODE, "unknown info id");
12871288
}
12881289

1289-
return hleLogWarning(SCENET, 0, "untested");
1290+
return 0;
1291+
}
1292+
1293+
static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAddr) {
1294+
WARN_LOG(SCENET, "UNTESTED %s(%i, %i, %08x)", __FUNCTION__, entryId, infoId, resultAddr);
1295+
return NetApctl_GetBSSDescEntryUser(entryId, infoId, resultAddr);
12901296
}
12911297

12921298
static int sceNetApctlScanSSID2() {
1293-
ERROR_LOG(SCENET, "UNIMPL %s() at %08x", __FUNCTION__, currentMIPS->pc);
1299+
WARN_LOG(SCENET, "UNTESTED %s() at %08x", __FUNCTION__, currentMIPS->pc);
12941300
return NetApctl_ScanUser();
12951301
}
12961302

@@ -1301,8 +1307,8 @@ static int sceNetApctlScanSSID2() {
13011307
* Arg4 = input flag? or output number of entries being filled? (initially 0/1 ?)
13021308
***************/
13031309
static int sceNetApctlGetBSSDescIDList2(u32 Arg1, u32 Arg2, u32 Arg3, u32 Arg4) {
1304-
ERROR_LOG(SCENET, "UNIMPL %s(%08x, %08x, %08x, %08x) at %08x", __FUNCTION__, Arg1, Arg2, Arg3, Arg4, currentMIPS->pc);
1305-
return hleLogError(SCENET, sceNetApctlGetBSSDescIDListUser(Arg1, Arg2), "unimplemented");
1310+
WARN_LOG(SCENET, "UNTESTED %s(%08x, %08x, %08x, %08x) at %08x", __FUNCTION__, Arg1, Arg2, Arg3, Arg4, currentMIPS->pc);
1311+
return NetApctl_GetBSSDescIDListUser(Arg1, Arg2);
13061312
}
13071313

13081314
/**************
@@ -1311,8 +1317,8 @@ static int sceNetApctlGetBSSDescIDList2(u32 Arg1, u32 Arg2, u32 Arg3, u32 Arg4)
13111317
* Arg3 = output buffer for retrieved entry data? (max size = 32 bytes? ie. APCTL_SSID_MAXLEN ? or similar to SceNetApctlInfoInternal union ?)
13121318
***************/
13131319
static int sceNetApctlGetBSSDescEntry2(int entryId, int infoId, u32 resultAddr) {
1314-
ERROR_LOG(SCENET, "UNIMPL %s(%08x, %08x, %08x) at %08x", __FUNCTION__, entryId, infoId, resultAddr, currentMIPS->pc);
1315-
return hleLogError(SCENET, sceNetApctlGetBSSDescEntryUser(entryId, infoId, resultAddr), "unimplemented");
1320+
WARN_LOG(SCENET, "UNTESTED %s(%i, %i, %08x) at %08x", __FUNCTION__, entryId, infoId, resultAddr, currentMIPS->pc);
1321+
return NetApctl_GetBSSDescEntryUser(entryId, infoId, resultAddr);
13161322
}
13171323

13181324
static int sceNetResolverInit()

0 commit comments

Comments
 (0)