diff options
Diffstat (limited to 'src/Wifi.cpp')
-rw-r--r-- | src/Wifi.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Wifi.cpp b/src/Wifi.cpp index d454dd0..668af14 100644 --- a/src/Wifi.cpp +++ b/src/Wifi.cpp @@ -21,6 +21,7 @@ #include "NDS.h" #include "SPI.h" #include "Wifi.h" +#include "Platform.h" namespace Wifi @@ -47,6 +48,8 @@ u16 RFData1; u16 RFData2; u32 RFRegs[0x40]; +bool MPInited; + // multiplayer host TX sequence: // 1. preamble @@ -74,6 +77,19 @@ u32 RFRegs[0x40]; // * work out how power saving works, there are oddities +bool Init() +{ + MPInited = false; + + return true; +} + +void DeInit() +{ + if (MPInited) + Platform::MP_DeInit(); +} + void Reset() { memset(RAM, 0, 0x2000); @@ -448,9 +464,18 @@ void Write(u32 addr, u16 val) // schedule timer event when the clock is enabled // TODO: check whether this resets USCOUNT (and also which other events can reset it) if ((IOPORT(W_PowerUS) & 0x0001) && !(val & 0x0001)) + { NDS::ScheduleEvent(NDS::Event_Wifi, true, 33, USTimer, 0); + if (!MPInited) + { + Platform::MP_Init(); + MPInited = true; + } + } else if (!(IOPORT(W_PowerUS) & 0x0001) && (val & 0x0001)) + { NDS::CancelEvent(NDS::Event_Wifi); + } break; case W_USCountCnt: val &= 0x0001; break; |