rename Platform LAN_xxxx to Net_xxxx as per the new naming. remove old cruft.

This commit is contained in:
Arisotura 2024-06-13 18:40:28 +02:00
parent dfd89fdef4
commit 88a91f5bc1
8 changed files with 15 additions and 78 deletions

View File

@ -1334,7 +1334,7 @@ void DSi_NWifi::WMI_SendPacket(u16 len)
} }
printf("\n");*/ 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) 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)) if (!Mailbox[8].CanFit(2048))
return; return;
int rxlen = Platform::LAN_RecvPacket(LANBuffer, DSi.UserData); int rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData);
while (rxlen > 0) while (rxlen > 0)
{ {
//printf("WMI packet recv %04X %04X %04X\n", *(u16*)&LANBuffer[0], *(u16*)&LANBuffer[2], *(u16*)&LANBuffer[4]); //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)) if (memcmp(&LANBuffer[0], &EEPROM[0x00A], 6))
{ {
rxlen = Platform::LAN_RecvPacket(LANBuffer, DSi.UserData); rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData);
continue; continue;
} }
} }
@ -1459,7 +1459,7 @@ void DSi_NWifi::CheckRX()
// check source MAC, in case we get a packet we just sent out // check source MAC, in case we get a packet we just sent out
if (!memcmp(&LANBuffer[6], &EEPROM[0x00A], 6)) if (!memcmp(&LANBuffer[6], &EEPROM[0x00A], 6))
{ {
rxlen = Platform::LAN_RecvPacket(LANBuffer, DSi.UserData); rxlen = Platform::Net_RecvPacket(LANBuffer, DSi.UserData);
continue; continue;
} }

View File

@ -287,8 +287,6 @@ void WriteDateTime(int year, int month, int day, int hour, int minute, int secon
// local multiplayer comm interface // local multiplayer comm interface
// packet type: DS-style TX header (12 bytes) + original 802.11 frame // 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_Begin(void* userdata);
void MP_End(void* userdata); void MP_End(void* userdata);
int MP_SendPacket(u8* data, int len, u64 timestamp, 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); u16 MP_RecvReplies(u8* data, u64 timestamp, u16 aidmask, void* userdata);
// LAN comm interface // network comm interface
// packet type: Ethernet (802.3) // packet type: Ethernet (802.3)
bool LAN_Init(void* userdata); int Net_SendPacket(u8* data, int len, void* userdata);
void LAN_DeInit(void* userdata); int Net_RecvPacket(u8* data, void* userdata);
int LAN_SendPacket(u8* data, int len, void* userdata);
int LAN_RecvPacket(u8* data, void* userdata);
// interface for camera emulation // interface for camera emulation

View File

@ -93,25 +93,11 @@ Wifi::Wifi(melonDS::NDS& nds) : NDS(nds)
{ {
NDS.RegisterEventFunc(Event_Wifi, 0, MemberEventFunc(Wifi, USTimer)); 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); WifiAP = new class WifiAP(this, NDS.UserData);
} }
Wifi::~Wifi() Wifi::~Wifi()
{ {
if (MPInited)
Platform::MP_DeInit(NDS.UserData);
if (LANInited)
Platform::LAN_DeInit(NDS.UserData);
delete WifiAP; WifiAP = nullptr; delete WifiAP; WifiAP = nullptr;
NDS.UnregisterEventFunc(Event_Wifi, 0); NDS.UnregisterEventFunc(Event_Wifi, 0);

View File

@ -241,9 +241,6 @@ private:
u16 MPLastSeqno; u16 MPLastSeqno;
bool MPInited;
bool LANInited;
int USUntilPowerOn; int USUntilPowerOn;
// MULTIPLAYER SYNC APPARATUS // MULTIPLAYER SYNC APPARATUS

View File

@ -301,7 +301,7 @@ int WifiAP::SendPacket(const u8* data, int len)
*(u16*)&LANBuffer[12] = *(u16*)&data[30]; // type *(u16*)&LANBuffer[12] = *(u16*)&data[30]; // type
memcpy(&LANBuffer[14], &data[32], lan_len - 14); memcpy(&LANBuffer[14], &data[32], lan_len - 14);
Platform::LAN_SendPacket(LANBuffer, lan_len, UserData); Platform::Net_SendPacket(LANBuffer, lan_len, UserData);
} }
} }
return len; return len;
@ -368,7 +368,7 @@ int WifiAP::RecvPacket(u8* data)
if (ClientStatus < 2) return 0; if (ClientStatus < 2) return 0;
int rxlen = Platform::LAN_RecvPacket(LANBuffer, UserData); int rxlen = Platform::Net_RecvPacket(LANBuffer, UserData);
while (rxlen > 0) while (rxlen > 0)
{ {
// check destination MAC // check destination MAC
@ -376,14 +376,14 @@ int WifiAP::RecvPacket(u8* data)
{ {
if (!MACEqual(&LANBuffer[0], Client->GetMAC())) if (!MACEqual(&LANBuffer[0], Client->GetMAC()))
{ {
rxlen = Platform::LAN_RecvPacket(LANBuffer, UserData); rxlen = Platform::Net_RecvPacket(LANBuffer, UserData);
continue; continue;
} }
} }
if (MACEqual(&LANBuffer[6], Client->GetMAC())) if (MACEqual(&LANBuffer[6], Client->GetMAC()))
{ {
rxlen = Platform::LAN_RecvPacket(LANBuffer, UserData); rxlen = Platform::Net_RecvPacket(LANBuffer, UserData);
continue; continue;
} }

View File

@ -362,7 +362,7 @@ int SendPacket(u8* data, int len)
if (len > 2048) 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; return 0;
} }

View File

@ -377,7 +377,7 @@ int SendPacket(u8* data, int len)
if (len > 2048) 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; return 0;
} }

View File

@ -444,14 +444,6 @@ void WriteDateTime(int year, int month, int day, int hour, int minute, int secon
Config::Save(); Config::Save();
} }
bool MP_Init(void* userdata)
{
return true;
}
void MP_DeInit(void* userdata)
{
}
void MP_Begin(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); 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; int Net_SendPacket(u8* data, int len, void* userdata)
}
void LAN_DeInit(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(); int inst = ((EmuInstance*)userdata)->getInstanceID();
Net::SendPacket(data, len, inst); Net::SendPacket(data, len, inst);
return 0; 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(); int inst = ((EmuInstance*)userdata)->getInstanceID();
return Net::RecvPacket(data, inst); return Net::RecvPacket(data, inst);
} }