diff --git a/core/build.h b/core/build.h index f97a63e54..4b0e7076e 100755 --- a/core/build.h +++ b/core/build.h @@ -211,6 +211,8 @@ #define HOST_64BIT_CPU #endif +#define USE_MINIUPNPC + // Compiler Related #ifndef _MSC_VER diff --git a/core/network/miniupnp.cpp b/core/network/miniupnp.cpp index e046a02c0..aa10b5762 100644 --- a/core/network/miniupnp.cpp +++ b/core/network/miniupnp.cpp @@ -16,6 +16,8 @@ You should have received a copy of the GNU General Public License along with Flycast. If not, see . */ +#include "build.h" +#ifdef USE_MINIUPNPC #include #include #include "types.h" @@ -79,3 +81,4 @@ bool MiniUPnP::AddPortMapping(int port, bool tcp) mappedPorts.emplace_back(portStr, tcp); return true; } +#endif diff --git a/core/network/miniupnp.h b/core/network/miniupnp.h index 2440666b0..b82281ce8 100644 --- a/core/network/miniupnp.h +++ b/core/network/miniupnp.h @@ -19,6 +19,7 @@ #pragma once #include #include +#ifdef USE_MINIUPNPC #include class MiniUPnP @@ -44,3 +45,16 @@ private: std::vector> mappedPorts; }; +#else + +class MiniUPnP +{ +public: + bool Init() { return true; } + void Term() {} + bool AddPortMapping(int port, bool tcp) { return true; } + const char *localAddress() const { return ""; } + const char *externalAddress() const { return ""; } +}; + +#endif diff --git a/core/network/picoppp.cpp b/core/network/picoppp.cpp index a412a3d26..294c4039b 100644 --- a/core/network/picoppp.cpp +++ b/core/network/picoppp.cpp @@ -616,7 +616,7 @@ static void read_native_sockets() } } - char buf[1500]; + static char buf[1500]; pico_msginfo msginfo; // Read UDP sockets