void getLocalMac(SceNetEtherAddr * addr){ // Read MAC Address from config uint8_t mac[ETHER_ADDR_LEN] = {0}; if (!ParseMacAddress(g_Config.localMacAddress.c_str(), mac)) { ERROR_LOG(SCENET, "Error parsing mac address %s", g_Config.localMacAddress.c_str()); } memcpy(addr, mac, ETHER_ADDR_LEN); }
u32 sceWlanGetEtherAddr(u32 addrAddr) { // Read MAC Address from config uint8_t mac[6] = {0}; if (!ParseMacAddress(g_Config.localMacAddress.c_str(), mac)) { ERROR_LOG(SCENET, "Error parsing mac address %s", g_Config.localMacAddress.c_str()); } DEBUG_LOG(SCENET, "sceWlanGetEtherAddr(%08x)", addrAddr); for (int i = 0; i < 6; i++) Memory::Write_U8(mac[i], addrAddr + i); return 0; }
bool TestParsers() { const char *macstr = "01:02:03:ff:fe:fd"; uint8_t mac[6]; ParseMacAddress(macstr, mac); EXPECT_TRUE(mac[0] == 1); EXPECT_TRUE(mac[1] == 2); EXPECT_TRUE(mac[2] == 3); EXPECT_TRUE(mac[3] == 255); EXPECT_TRUE(mac[4] == 254); EXPECT_TRUE(mac[5] == 253); return true; }