From ca059bc9626e0dfd208305f3d5472545f0f0f30b Mon Sep 17 00:00:00 2001 From: ANR2ME Date: Wed, 2 Sep 2020 21:42:16 +0700 Subject: [PATCH] Making sure the 1st 2-bits on the 1st byte of MAC address' OUI are zero to prevent issue with some games (ie. Gran Turismo) --- Core/Config.cpp | 4 ++++ Core/HLE/proAdhoc.cpp | 3 +++ Core/HLE/sceNet.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Core/Config.cpp b/Core/Config.cpp index 1a8fc70027..3164c9af9b 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -378,6 +378,10 @@ std::string CreateRandMAC() { srand(time(nullptr)); for (int i = 0; i < 6; i++) { u32 value = rand() % 256; + if (i == 0) { + // Making sure the 1st 2-bits on the 1st byte of OUI are zero to prevent issue with some games (ie. Gran Turismo) + value &= 0xfc; + } if (value <= 15) randStream << '0' << std::hex << value; else diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 34f9c5510a..b5f3a76662 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -1668,10 +1668,13 @@ void getLocalMac(SceNetEtherAddr * addr){ uint8_t mac[ETHER_ADDR_LEN] = {0}; if (PPSSPP_ID > 1) { memset(&mac, PPSSPP_ID, sizeof(mac)); + // Making sure the 1st 2-bits on the 1st byte of OUI are zero to prevent issue with some games (ie. Gran Turismo) + mac[0] &= 0xfc; } else if (!ParseMacAddress(g_Config.sMACAddress.c_str(), mac)) { ERROR_LOG(SCENET, "Error parsing mac address %s", g_Config.sMACAddress.c_str()); + memset(&mac, 0, sizeof(mac)); } memcpy(addr, mac, ETHER_ADDR_LEN); } diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 0b4d7ffd29..42c70cecec 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -609,6 +609,8 @@ static u32 sceWlanGetEtherAddr(u32 addrAddr) { u8 *addr = Memory::GetPointer(addrAddr); if (PPSSPP_ID > 1) { Memory::Memset(addrAddr, PPSSPP_ID, 6); + // Making sure the 1st 2-bits on the 1st byte of OUI are zero to prevent issue with some games (ie. Gran Turismo) + addr[0] &= 0xfc; } else // Read MAC Address from config