aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl/ROMManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/qt_sdl/ROMManager.cpp')
-rw-r--r--src/frontend/qt_sdl/ROMManager.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/frontend/qt_sdl/ROMManager.cpp b/src/frontend/qt_sdl/ROMManager.cpp
index fda043a..b065ad1 100644
--- a/src/frontend/qt_sdl/ROMManager.cpp
+++ b/src/frontend/qt_sdl/ROMManager.cpp
@@ -1078,6 +1078,36 @@ pair<unique_ptr<Firmware>, string> GenerateDefaultFirmware()
return std::make_pair(std::move(firmware), std::move(wfcsettingspath));
}
+bool ParseMacAddress(void* data)
+{
+ const std::string& mac_in = Config::FirmwareMAC;
+ u8* mac_out = (u8*)data;
+
+ int o = 0;
+ u8 tmp = 0;
+ for (int i = 0; i < 18; i++)
+ {
+ char c = mac_in[i];
+ if (c == '\0') break;
+
+ int n;
+ if (c >= '0' && c <= '9') n = c - '0';
+ else if (c >= 'a' && c <= 'f') n = c - 'a' + 10;
+ else if (c >= 'A' && c <= 'F') n = c - 'A' + 10;
+ else continue;
+
+ if (!(o & 1))
+ tmp = n;
+ else
+ mac_out[o >> 1] = n | (tmp << 4);
+
+ o++;
+ if (o >= 12) return true;
+ }
+
+ return false;
+}
+
void CustomizeFirmware(Firmware& firmware) noexcept
{
auto& currentData = firmware.GetEffectiveUserData();
@@ -1136,7 +1166,7 @@ void CustomizeFirmware(Firmware& firmware) noexcept
MacAddress configuredMac;
- rep = Platform::GetConfigArray(Platform::Firm_MAC, &configuredMac);
+ rep = ParseMacAddress(&configuredMac);
rep &= (configuredMac != MacAddress());
if (rep)