Add WIFI MAC to ConfigMem and stub reads

This commit is contained in:
Caleb Yates 2023-07-11 14:38:19 -05:00
parent 27cf8d75ca
commit 7f4746139d
2 changed files with 11 additions and 11 deletions

View file

@ -11,20 +11,16 @@ namespace ConfigMem {
AppMemAlloc = 0x1FF80040,
HardwareType = 0x1FF81004,
Datetime0 = 0x1FF81020,
WifiMac = 0x1FF81060,
NetworkState = 0x1FF81067,
LedState3D = 0x1FF81084,
BatteryState = 0x1FF81085,
Unknown1086 = 0x1FF81086,
HeadphonesConnectedMaybe = 0x1FF810C0 // TODO: What is actually stored here?
HeadphonesConnectedMaybe = 0x1FF810C0 // TODO: What is actually stored here?
};
// Shows what type of hardware we're running on
namespace HardwareCodes {
enum : u8 {
Product = 1,
Devboard = 2,
Debugger = 3,
Capture = 4
};
enum : u8 { Product = 1, Devboard = 2, Debugger = 3, Capture = 4 };
}
}
} // namespace ConfigMem

View file

@ -104,7 +104,10 @@ u16 Memory::read16(u32 vaddr) {
if (pointer != 0) [[likely]] {
return *(u16*)(pointer + offset);
} else {
Helpers::panic("Unimplemented 16-bit read, addr: %08X", vaddr);
switch (vaddr) {
case ConfigMem::WifiMac + 4: return 0xEEFF; // Wifi MAC: Last 2 bytes of MAC Address
default: Helpers::panic("Unimplemented 16-bit read, addr: %08X", vaddr);
}
}
}
@ -130,7 +133,8 @@ u32 Memory::read32(u32 vaddr) {
case ConfigMem::AppMemAlloc: return appResourceLimits.maxCommit;
case ConfigMem::SyscoreVer: return 2;
case 0x1FF81000: return 0; // TODO: Figure out what this config mem address does
case 0x1FF81000: return 0; // TODO: Figure out what this config mem address does
case ConfigMem::WifiMac: return 0xFF07F440; // Wifi MAC: First 4 bytes of MAC Address
default:
if (vaddr >= VirtualAddrs::VramStart && vaddr < VirtualAddrs::VramStart + VirtualAddrs::VramSize) {
Helpers::warn("VRAM read!\n");
@ -454,4 +458,4 @@ u64 Memory::timeSince3DSEpoch() {
constexpr u64 offset = 2208988800ull;
milliseconds ms = duration_cast<milliseconds>(seconds(rawTime + timezoneDifference + offset));
return ms.count();
}
}