Permalink
Browse files

WiFi: Significantly reduce the host-to-emulator latency of libpcap-so…

…urced packets in Infrastructure mode by running RX packet receives on a separate thread, just like how socket-sourced packets in Ad-hoc mode do it.

- Also, Infrastructure mode can no longer "partially function." Now, it either works completely or not at all, just like how Ad-hoc mode does it.
  • Loading branch information...
rogerman committed Nov 18, 2018
1 parent 71df3f4 commit 91526e632460151b3920f4093a7896fb235f37af
Showing with 305 additions and 235 deletions.
  1. +5 −0 desmume/src/frontend/windows/main.cpp
  2. +3 −0 desmume/src/frontend/windows/winpcap.h
  3. +270 −222 desmume/src/wifi.cpp
  4. +27 −13 desmume/src/wifi.h
@@ -506,6 +506,11 @@ class WinPCapInterface : public ClientPCapInterface
return _pcap_dispatch((pcap_t *)dev, num, (pcap_handler)callback, (u_char *)userdata);
}
virtual void breakloop(void *dev)
{
_pcap_breakloop((pcap_t *)dev);
}
};
GPUEventHandlerWindows *WinGPUEvent = NULL;
@@ -38,6 +38,7 @@ typedef void (__cdecl *T_pcap_close)(pcap_t* dev);
typedef int (__cdecl *T_pcap_setnonblock)(pcap_t* dev, int nonblock, char* errbuf);
typedef int (__cdecl *T_pcap_sendpacket)(pcap_t* dev, const u_char* data, int len);
typedef int (__cdecl *T_pcap_dispatch)(pcap_t* dev, int num, pcap_handler callback, u_char* userdata);
typedef int (__cdecl *T_pcap_breakloop)(pcap_t* dev);
T_pcap_findalldevs _pcap_findalldevs = NULL;
T_pcap_freealldevs _pcap_freealldevs = NULL;
@@ -46,6 +47,7 @@ T_pcap_close _pcap_close = NULL;
T_pcap_setnonblock _pcap_setnonblock = NULL;
T_pcap_sendpacket _pcap_sendpacket = NULL;
T_pcap_dispatch _pcap_dispatch = NULL;
T_pcap_breakloop _pcap_breakloop = NULL;
#define LOADSYMBOL(name) \
@@ -71,6 +73,7 @@ static void LoadWinPCap(bool &outResult)
LOADSYMBOL(pcap_setnonblock);
LOADSYMBOL(pcap_sendpacket);
LOADSYMBOL(pcap_dispatch);
LOADSYMBOL(pcap_breakloop);
result = true;
outResult = result;
Oops, something went wrong.

0 comments on commit 91526e6

Please sign in to comment.