Skip to content

Commit

Permalink
Ooops wrong way to do random range
Browse files Browse the repository at this point in the history
  • Loading branch information
anr2me committed Apr 4, 2021
1 parent 41d6363 commit 544311a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Core/HLE/sceNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1236,8 +1236,7 @@ static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAdd
Memory::WriteStruct(resultAddr, &netApctlInfo.bssid);
else {
// Generate a BSSID/MAC address
char dummyMAC[ETHER_ADDR_LEN];
memset(&dummyMAC, entryId, sizeof(dummyMAC));
char dummyMAC[ETHER_ADDR_LEN]{ static_cast<char>(entryId) };
// Making sure the 1st 2-bits on the 1st byte of OUI are zero to prevent issue with some games (ie. Gran Turismo)
dummyMAC[0] &= 0xfc;
Memory::WriteStruct(resultAddr, &dummyMAC);
Expand All @@ -1261,7 +1260,7 @@ static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAdd
}
break;
case PSP_NET_APCTL_DESC_CHANNEL:
// FIXME: Return one 1 byte value or may be 32-bit if it this is not channel?
// FIXME: Return one 1 byte value or may be 32-bit if this is not a channel?
if (entryId == 0)
Memory::WriteStruct(resultAddr, &netApctlInfo.channel);
else {
Expand All @@ -1275,7 +1274,7 @@ static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAdd
Memory::WriteStruct(resultAddr, &netApctlInfo.strength);
else {
// Randomize signal strength between 1%~99% since games like MGS:PW are using signal strength to determine the strength of the recruit
Memory::Write_U8(rand()*99 + 1, resultAddr);
Memory::Write_U8((int)(((float)rand() / (float)RAND_MAX) * 99.0 + 1.0), resultAddr);
}
break;
case PSP_NET_APCTL_DESC_SECURITY:
Expand Down

0 comments on commit 544311a

Please sign in to comment.