From a8e1e65c36006f2860456aaee1315bcaa076b5cb Mon Sep 17 00:00:00 2001 From: Julien Loir <6706489+Namaneo@users.noreply.github.com> Date: Mon, 10 Apr 2023 01:13:34 +0200 Subject: [PATCH] Fix Emscripten build --- desmume/src/ROMReader.cpp | 2 +- desmume/src/wifi.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/desmume/src/ROMReader.cpp b/desmume/src/ROMReader.cpp index 941812f0..dffa904e 100644 --- a/desmume/src/ROMReader.cpp +++ b/desmume/src/ROMReader.cpp @@ -80,7 +80,7 @@ struct STDROMReaderData void* STDROMReaderInit(const char* filename) { -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__EMSCRIPTEN__) struct stat sb; if (stat(filename, &sb) == -1) return 0; diff --git a/desmume/src/wifi.cpp b/desmume/src/wifi.cpp index 3c712165..d8aa8e7f 100644 --- a/desmume/src/wifi.cpp +++ b/desmume/src/wifi.cpp @@ -69,7 +69,8 @@ #if defined(_WIN32) && defined(__LIBRETRO__) #include "frontend/windows/winpcap/pcap.h" -#elif defined(HAVE_LIBNX) || defined(__IOS__) || defined(ANDROID) || defined(GEKKO) || defined(_3DS) +#elif defined(HAVE_LIBNX) || defined(__IOS__) || defined(ANDROID) || defined(GEKKO) || defined(_3DS) || defined(__EMSCRIPTEN__) +#define NO_PCAP typedef void* pcap_pkthdr; #else #include @@ -3098,7 +3099,7 @@ static const u8 SoftAP_DeauthFrame[] = { static void SoftAP_RXPacketGet_Callback(u_char *userData, const pcap_pkthdr *pktHeader, const u_char *pktData) { -#if defined(HAVE_LIBNX) || defined(__IOS__) || defined(ANDROID) || defined(GEKKO) || defined(_3DS) +#if defined(NO_PCAP) return; #else const WIFI_IOREG_MAP &io = wifiHandler->GetWifiData().io; @@ -3558,7 +3559,7 @@ void* SoftAPCommInterface::_GetBridgeDeviceAtIndex(int deviceIndex, char *outErr void *deviceList = NULL; void *theDevice = NULL; -#if defined(HAVE_LIBNX) || defined(__IOS__) || defined(ANDROID) || defined(GEKKO) || defined(_3DS) +#if defined(NO_PCAP) return theDevice; #else int result = this->_pcap->findalldevs((void **)&deviceList, outErrorBuf); @@ -4499,7 +4500,7 @@ int WifiHandler::GetBridgeDeviceList(std::vector *deviceStringList) return result; } -#if defined(HAVE_LIBNX) || defined(__IOS__) || defined(ANDROID) || defined(GEKKO) || defined(_3DS) +#if defined(NO_PCAP) return result; #else char errbuf[PCAP_ERRBUF_SIZE];