diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index 559b7a2d..c857bbbc 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -164,9 +164,6 @@ target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../net") -target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../net/libslirp/src") -get_target_property(SLIRP_BINARY_DIR slirp BINARY_DIR) -target_include_directories(melonDS PUBLIC "${SLIRP_BINARY_DIR}") # for libslirp-version.h if (USE_QT6) target_include_directories(melonDS PUBLIC ${Qt6Gui_PRIVATE_INCLUDE_DIRS}) else() diff --git a/src/net/Net_Slirp.cpp b/src/net/Net_Slirp.cpp index fef4d19c..2200b074 100644 --- a/src/net/Net_Slirp.cpp +++ b/src/net/Net_Slirp.cpp @@ -23,12 +23,7 @@ #include "FIFO.h" #include "Platform.h" -#include - -// "register" is indirectly used by slirp.h but isn't allowed in C++17, this is a workaround -#define register -// Needed for Slirp's definition so we can adjust the opaque pointer in the move constructor -#include +#include #ifdef __WIN32__ #include @@ -163,63 +158,6 @@ Net_Slirp::Net_Slirp(const Platform::SendPacketCallback& callback) noexcept : Ca Ctx = slirp_new(&cfg, &cb, this); } - -Net_Slirp::Net_Slirp(Net_Slirp&& other) noexcept -{ - RXBuffer = other.RXBuffer; - IPv4ID = other.IPv4ID; - Ctx = other.Ctx; - PollListSize = other.PollListSize; - Callback = std::move(other.Callback); - memcpy(PollList, other.PollList, sizeof(PollList)); - - other.RXBuffer = {}; - other.IPv4ID = 0; - other.Ctx = nullptr; - other.PollListSize = 0; - other.Callback = nullptr; - memset(other.PollList, 0, sizeof(other.PollList)); - - if (Ctx) - { - Ctx->opaque = this; - // Gotta ensure that the context doesn't try to pass around a dead object - } -} - -Net_Slirp& Net_Slirp::operator=(Net_Slirp&& other) noexcept -{ - if (this != &other) - { - if (Ctx) - { - slirp_cleanup(Ctx); - } - - RXBuffer = other.RXBuffer; - IPv4ID = other.IPv4ID; - Ctx = other.Ctx; - PollListSize = other.PollListSize; - Callback = std::move(other.Callback); - memcpy(PollList, other.PollList, sizeof(PollList)); - - other.RXBuffer = {}; - other.IPv4ID = 0; - other.Ctx = nullptr; - other.PollListSize = 0; - other.Callback = nullptr; - memset(other.PollList, 0, sizeof(other.PollList)); - - if (Ctx) - { - Ctx->opaque = this; - // Gotta ensure that the context doesn't try to pass around a dead object - } - } - - return *this; -} - Net_Slirp::~Net_Slirp() noexcept { if (Ctx) @@ -229,7 +167,6 @@ Net_Slirp::~Net_Slirp() noexcept } } - void FinishUDPFrame(u8* data, int len) { u8* ipheader = &data[0xE]; diff --git a/src/net/Net_Slirp.h b/src/net/Net_Slirp.h index 5f9b6587..256b3058 100644 --- a/src/net/Net_Slirp.h +++ b/src/net/Net_Slirp.h @@ -24,7 +24,7 @@ #include "Platform.h" #include "NetDriver.h" -#include +#include #ifdef __WIN32__ #include