diff --git a/src/DSi_NWifi.cpp b/src/DSi_NWifi.cpp index 76cfe77d..0245053b 100644 --- a/src/DSi_NWifi.cpp +++ b/src/DSi_NWifi.cpp @@ -1334,7 +1334,7 @@ void DSi_NWifi::WMI_SendPacket(u16 len) } printf("\n");*/ - Platform::LAN_SendPacket(LANBuffer, lan_len, DSi.UserData); + Platform::Net_SendPacket(LANBuffer, lan_len, DSi.UserData); } void DSi_NWifi::SendWMIEvent(u8 ep, u16 id, u8* data, u32 len) @@ -1442,7 +1442,7 @@ void DSi_NWifi::CheckRX() if (!Mailbox[8].CanFit(2048)) return; - int rxlen = Platform::LAN_RecvPacket(LANBuffer, DSi.UserData); + int rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData); while (rxlen > 0) { //printf("WMI packet recv %04X %04X %04X\n", *(u16*)&LANBuffer[0], *(u16*)&LANBuffer[2], *(u16*)&LANBuffer[4]); @@ -1451,7 +1451,7 @@ void DSi_NWifi::CheckRX() { if (memcmp(&LANBuffer[0], &EEPROM[0x00A], 6)) { - rxlen = Platform::LAN_RecvPacket(LANBuffer, DSi.UserData); + rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData); continue; } } @@ -1459,7 +1459,7 @@ void DSi_NWifi::CheckRX() // check source MAC, in case we get a packet we just sent out if (!memcmp(&LANBuffer[6], &EEPROM[0x00A], 6)) { - rxlen = Platform::LAN_RecvPacket(LANBuffer, DSi.UserData); + rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData); continue; } diff --git a/src/Platform.h b/src/Platform.h index d385d873..563cceb7 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -287,8 +287,6 @@ void WriteDateTime(int year, int month, int day, int hour, int minute, int secon // local multiplayer comm interface // packet type: DS-style TX header (12 bytes) + original 802.11 frame -bool MP_Init(void* userdata); -void MP_DeInit(void* userdata); void MP_Begin(void* userdata); void MP_End(void* userdata); int MP_SendPacket(u8* data, int len, u64 timestamp, void* userdata); @@ -300,12 +298,10 @@ int MP_RecvHostPacket(u8* data, u64* timestamp, void* userdata); u16 MP_RecvReplies(u8* data, u64 timestamp, u16 aidmask, void* userdata); -// LAN comm interface +// network comm interface // packet type: Ethernet (802.3) -bool LAN_Init(void* userdata); -void LAN_DeInit(void* userdata); -int LAN_SendPacket(u8* data, int len, void* userdata); -int LAN_RecvPacket(u8* data, void* userdata); +int Net_SendPacket(u8* data, int len, void* userdata); +int Net_RecvPacket(u8* data, void* userdata); // interface for camera emulation diff --git a/src/Wifi.cpp b/src/Wifi.cpp index cccb02bc..ea33cebf 100644 --- a/src/Wifi.cpp +++ b/src/Wifi.cpp @@ -93,25 +93,11 @@ Wifi::Wifi(melonDS::NDS& nds) : NDS(nds) { NDS.RegisterEventFunc(Event_Wifi, 0, MemberEventFunc(Wifi, USTimer)); - //MPInited = false; - //LANInited = false; - - Platform::MP_Init(NDS.UserData); - MPInited = true; - - Platform::LAN_Init(NDS.UserData); - LANInited = true; - WifiAP = new class WifiAP(this, NDS.UserData); } Wifi::~Wifi() { - if (MPInited) - Platform::MP_DeInit(NDS.UserData); - if (LANInited) - Platform::LAN_DeInit(NDS.UserData); - delete WifiAP; WifiAP = nullptr; NDS.UnregisterEventFunc(Event_Wifi, 0); diff --git a/src/Wifi.h b/src/Wifi.h index 2e0465a6..724580c1 100644 --- a/src/Wifi.h +++ b/src/Wifi.h @@ -241,9 +241,6 @@ private: u16 MPLastSeqno; - bool MPInited; - bool LANInited; - int USUntilPowerOn; // MULTIPLAYER SYNC APPARATUS diff --git a/src/WifiAP.cpp b/src/WifiAP.cpp index a782b323..52359a3d 100644 --- a/src/WifiAP.cpp +++ b/src/WifiAP.cpp @@ -301,7 +301,7 @@ int WifiAP::SendPacket(const u8* data, int len) *(u16*)&LANBuffer[12] = *(u16*)&data[30]; // type memcpy(&LANBuffer[14], &data[32], lan_len - 14); - Platform::LAN_SendPacket(LANBuffer, lan_len, UserData); + Platform::Net_SendPacket(LANBuffer, lan_len, UserData); } } return len; @@ -368,7 +368,7 @@ int WifiAP::RecvPacket(u8* data) if (ClientStatus < 2) return 0; - int rxlen = Platform::LAN_RecvPacket(LANBuffer, UserData); + int rxlen = Platform::Net_RecvPacket(LANBuffer, UserData); while (rxlen > 0) { // check destination MAC @@ -376,14 +376,14 @@ int WifiAP::RecvPacket(u8* data) { if (!MACEqual(&LANBuffer[0], Client->GetMAC())) { - rxlen = Platform::LAN_RecvPacket(LANBuffer, UserData); + rxlen = Platform::Net_RecvPacket(LANBuffer, UserData); continue; } } if (MACEqual(&LANBuffer[6], Client->GetMAC())) { - rxlen = Platform::LAN_RecvPacket(LANBuffer, UserData); + rxlen = Platform::Net_RecvPacket(LANBuffer, UserData); continue; } diff --git a/src/frontend/qt_sdl/Net_PCap.cpp b/src/frontend/qt_sdl/Net_PCap.cpp index d8b3fe24..967ca700 100644 --- a/src/frontend/qt_sdl/Net_PCap.cpp +++ b/src/frontend/qt_sdl/Net_PCap.cpp @@ -362,7 +362,7 @@ int SendPacket(u8* data, int len) if (len > 2048) { - Log(LogLevel::Error, "LAN_SendPacket: error: packet too long (%d)\n", len); + Log(LogLevel::Error, "Net_SendPacket: error: packet too long (%d)\n", len); return 0; } diff --git a/src/frontend/qt_sdl/Net_Slirp.cpp b/src/frontend/qt_sdl/Net_Slirp.cpp index a3c44844..ab8725d1 100644 --- a/src/frontend/qt_sdl/Net_Slirp.cpp +++ b/src/frontend/qt_sdl/Net_Slirp.cpp @@ -377,7 +377,7 @@ int SendPacket(u8* data, int len) if (len > 2048) { - Log(LogLevel::Error, "LAN_SendPacket: error: packet too long (%d)\n", len); + Log(LogLevel::Error, "Net_SendPacket: error: packet too long (%d)\n", len); return 0; } diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp index 47ef60d6..5450a4f0 100644 --- a/src/frontend/qt_sdl/Platform.cpp +++ b/src/frontend/qt_sdl/Platform.cpp @@ -444,14 +444,6 @@ void WriteDateTime(int year, int month, int day, int hour, int minute, int secon Config::Save(); } -bool MP_Init(void* userdata) -{ - return true; -} - -void MP_DeInit(void* userdata) -{ -} void MP_Begin(void* userdata) { @@ -507,50 +499,16 @@ u16 MP_RecvReplies(u8* data, u64 timestamp, u16 aidmask, void* userdata) return LocalMP::RecvReplies(inst, data, timestamp, aidmask); } -bool LAN_Init(void* userdata) -{ - /*if (testinst->getGlobalConfig().GetBool("LAN.DirectMode")) - { - if (!LAN_PCap::Init(true)) - return false; - } - else - { - if (!LAN_Socket::Init()) - return false; - }*/ - return true; -} - -void LAN_DeInit(void* userdata) +int Net_SendPacket(u8* data, int len, void* userdata) { - // checkme. blarg - //if (Config::DirectLAN) - // LAN_PCap::DeInit(); - //else - // LAN_Socket::DeInit(); - /*LAN_PCap::DeInit(); - LAN_Socket::DeInit();*/ -} - -int LAN_SendPacket(u8* data, int len, void* userdata) -{ - /*if (testinst->getGlobalConfig().GetBool("LAN.DirectMode")) - return LAN_PCap::SendPacket(data, len); - else - return LAN_Socket::SendPacket(data, len);*/ int inst = ((EmuInstance*)userdata)->getInstanceID(); Net::SendPacket(data, len, inst); return 0; } -int LAN_RecvPacket(u8* data, void* userdata) +int Net_RecvPacket(u8* data, void* userdata) { - /*if (testinst->getGlobalConfig().GetBool("LAN.DirectMode")) - return LAN_PCap::RecvPacket(data); - else - return LAN_Socket::RecvPacket(data);*/ int inst = ((EmuInstance*)userdata)->getInstanceID(); return Net::RecvPacket(data, inst); }