From ab257e335f694a17890001b78dc12b3dd4a64663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 4 Jun 2024 21:35:14 +0200 Subject: [PATCH] Ugprade miniupnp submodule to latest Maybe will help #19246, but no idea really. Windows buildfix UWP buildfix miniupnpc path fixes libretro buildfix attempt, android.mk --- .gitmodules | 2 +- CMakeLists.txt | 37 ++--- Core/Util/PortManager.cpp | 2 +- Core/Util/PortManager.h | 12 +- UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj | 62 ++++---- .../miniupnpc_UWP.vcxproj.filters | 134 ++++++++---------- ext/miniupnp | 2 +- ext/miniupnp-build/Android.mk | 32 ++--- ext/miniupnpc.vcxproj | 70 ++++----- ext/miniupnpc.vcxproj.filters | 62 ++++---- libretro/Makefile.common | 32 ++--- 11 files changed, 216 insertions(+), 231 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6cca8cd8d8..64be2c658e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -30,7 +30,7 @@ url = https://github.com/hrydgard/ppsspp-freetype.git [submodule "ext/miniupnp"] path = ext/miniupnp - url = https://github.com/hrydgard/miniupnp.git + url = https://github.com/miniupnp/miniupnp.git [submodule "zstd"] path = ext/zstd url = https://github.com/facebook/zstd.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 021cf8b3e8..db1ee1534e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2460,8 +2460,8 @@ if(USE_MINIUPNPC) target_link_libraries(${CoreLibName} ${MINIUPNP_LIBRARY}) add_definitions(-DWITH_UPNP -DUSE_SYSTEM_MINIUPNPC) else() - set (MINIUPNPC_VERSION 2.1) # used by miniupnpcstrings.h.cmake - set (MINIUPNPC_API_VERSION 17) + set (MINIUPNPC_VERSION 2.2) # used by miniupnpcstrings.h.cmake + set (MINIUPNPC_API_VERSION 18) option(UPNPC_BUILD_STATIC "Build static library" TRUE) option(NO_GETADDRINFO "Define NO_GETADDRINFO" FALSE) mark_as_advanced(NO_GETADDRINFO) @@ -2485,25 +2485,28 @@ if(USE_MINIUPNPC) add_definitions(-DWITH_UPNP -DMINIUPNP_STATICLIB) set(MINIUPNP_DIR "ext/miniupnp/miniupnpc") include_directories(${CMAKE_CURRENT_BINARY_DIR}) + include_directories(ext/miniupnp/miniupnpc/src) + include_directories(ext/miniupnp/miniupnpc/include) configure_file(${MINIUPNP_DIR}/miniupnpcstrings.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/miniupnpcstrings.h) # by default miniupnp repo doesn't contains miniupnpcstrings.h and need to be generated set(MINIUPNPC_SOURCES # the needed bits of miniupnpc (no python module, no tests, no cli) - ${MINIUPNP_DIR}/addr_is_reserved.c - ${MINIUPNP_DIR}/connecthostport.c - ${MINIUPNP_DIR}/igd_desc_parse.c - ${MINIUPNP_DIR}/minisoap.c - ${MINIUPNP_DIR}/minissdpc.c - ${MINIUPNP_DIR}/miniupnpc.c - ${MINIUPNP_DIR}/miniwget.c - ${MINIUPNP_DIR}/minixml.c - ${MINIUPNP_DIR}/minixmlvalid.c - ${MINIUPNP_DIR}/portlistingparse.c - ${MINIUPNP_DIR}/receivedata.c + ${MINIUPNP_DIR}/src/addr_is_reserved.c + ${MINIUPNP_DIR}/src/connecthostport.c + ${MINIUPNP_DIR}/src/igd_desc_parse.c + ${MINIUPNP_DIR}/src/minisoap.c + ${MINIUPNP_DIR}/src/minissdpc.c + ${MINIUPNP_DIR}/src/miniupnpc.c + #${MINIUPNP_DIR}/miniupnpcmodule.c + ${MINIUPNP_DIR}/src/miniwget.c + ${MINIUPNP_DIR}/src/minixml.c + ${MINIUPNP_DIR}/src/minixmlvalid.c + ${MINIUPNP_DIR}/src/portlistingparse.c + ${MINIUPNP_DIR}/src/receivedata.c #${MINIUPNP_DIR}/upnpc.c # causing an error due to already existing _main() - ${MINIUPNP_DIR}/upnpcommands.c - ${MINIUPNP_DIR}/upnpdev.c - ${MINIUPNP_DIR}/upnperrors.c - ${MINIUPNP_DIR}/upnpreplyparse.c + ${MINIUPNP_DIR}/src/upnpcommands.c + ${MINIUPNP_DIR}/src/upnpdev.c + ${MINIUPNP_DIR}/src/upnperrors.c + ${MINIUPNP_DIR}/src/upnpreplyparse.c ${CMAKE_CURRENT_BINARY_DIR}/miniupnpcstrings.h ) if (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "AmigaOS") diff --git a/Core/Util/PortManager.cpp b/Core/Util/PortManager.cpp index cfb81e9dbd..4b023b6406 100644 --- a/Core/Util/PortManager.cpp +++ b/Core/Util/PortManager.cpp @@ -161,7 +161,7 @@ bool PortManager::Initialize(const unsigned int timeout) { // Get LAN IP address that connects to the router char lanaddr[64] = "unset"; - int status = UPNP_GetValidIGD(devlist, urls, datas, lanaddr, sizeof(lanaddr)); //possible "status" values, 0 = NO IGD found, 1 = A valid connected IGD has been found, 2 = A valid IGD has been found but it reported as not connected, 3 = an UPnP device has been found but was not recognized as an IGD + int status = UPNP_GetValidIGD(devlist, urls, datas, lanaddr, sizeof(lanaddr), nullptr, 0); //possible "status" values, 0 = NO IGD found, 1 = A valid connected IGD has been found, 2 = A valid IGD has been found but it reported as not connected, 3 = an UPnP device has been found but was not recognized as an IGD m_lanip = std::string(lanaddr); INFO_LOG(SCENET, "PortManager - Detected LAN IP: %s", m_lanip.c_str()); diff --git a/Core/Util/PortManager.h b/Core/Util/PortManager.h index e5d778283f..039d1ea52d 100644 --- a/Core/Util/PortManager.h +++ b/Core/Util/PortManager.h @@ -22,16 +22,16 @@ #pragma once #ifdef USE_SYSTEM_MINIUPNPC -#include -#include -#include +#include +#include +#include #else #ifndef MINIUPNP_STATICLIB #define MINIUPNP_STATICLIB #endif -#include "ext/miniupnp/miniupnpc/miniwget.h" -#include "ext/miniupnp/miniupnpc/miniupnpc.h" -#include "ext/miniupnp/miniupnpc/upnpcommands.h" +#include "ext/miniupnp/miniupnpc/include/miniwget.h" +#include "ext/miniupnp/miniupnpc/include/miniupnpc.h" +#include "ext/miniupnp/miniupnpc/include/upnpcommands.h" #endif #include diff --git a/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj b/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj index a2aec08ba8..d56b5db6a2 100644 --- a/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj +++ b/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj @@ -67,7 +67,7 @@ true pch.h _CRT_SECURE_NO_WARNINGS;NOMINMAX;MINIUPNP_STATICLIB;_WINSOCK_DEPRECATED_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../../ext/miniupnpc;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ext/miniupnp-build;../../ext/miniupnp/miniupnpc/include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) Console @@ -89,7 +89,7 @@ true pch.h _CRT_SECURE_NO_WARNINGS;NOMINMAX;MINIUPNP_STATICLIB;_WINSOCK_DEPRECATED_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) - ../../ext/miniupnpc;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ext/miniupnp-build;../../ext/miniupnp/miniupnpc/include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) Console @@ -111,7 +111,7 @@ true pch.h _CRT_SECURE_NO_WARNINGS;NOMINMAX;MINIUPNP_STATICLIB;_WINSOCK_DEPRECATED_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) - ../../ext/miniupnpc;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ext/miniupnp-build;../../ext/miniupnp/miniupnpc/include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) Console @@ -127,35 +127,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + Create @@ -163,6 +149,18 @@ + + + + + + + + + + + + diff --git a/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj.filters b/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj.filters index 929654b098..0c80d42138 100644 --- a/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj.filters +++ b/UWP/miniupnpc_UWP/miniupnpc_UWP.vcxproj.filters @@ -1,96 +1,52 @@  - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - + src - - - + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - - + + src - + @@ -105,4 +61,36 @@ scripts + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + \ No newline at end of file diff --git a/ext/miniupnp b/ext/miniupnp index 3a87be33e7..27d13ca9be 160000 --- a/ext/miniupnp +++ b/ext/miniupnp @@ -1 +1 @@ -Subproject commit 3a87be33e797ba947b2b2a5f8d087f6c3ff4d93e +Subproject commit 27d13ca9beeb5541f5fbf11959dced03dac39972 diff --git a/ext/miniupnp-build/Android.mk b/ext/miniupnp-build/Android.mk index de01487070..64e37da4b8 100644 --- a/ext/miniupnp-build/Android.mk +++ b/ext/miniupnp-build/Android.mk @@ -7,26 +7,26 @@ include $(CLEAR_VARS) LOCAL_MODULE := libminiupnp-build LOCAL_ARM_MODE := arm LOCAL_SRC_FILES := \ - ../miniupnp/miniupnpc/addr_is_reserved.c \ - ../miniupnp/miniupnpc/connecthostport.c \ - ../miniupnp/miniupnpc/igd_desc_parse.c \ - ../miniupnp/miniupnpc/minisoap.c \ - ../miniupnp/miniupnpc/minissdpc.c \ - ../miniupnp/miniupnpc/miniupnpc.c \ - ../miniupnp/miniupnpc/miniwget.c \ - ../miniupnp/miniupnpc/minixml.c \ - ../miniupnp/miniupnpc/minixmlvalid.c \ - ../miniupnp/miniupnpc/portlistingparse.c \ - ../miniupnp/miniupnpc/receivedata.c \ - ../miniupnp/miniupnpc/upnpcommands.c \ - ../miniupnp/miniupnpc/upnpdev.c \ - ../miniupnp/miniupnpc/upnperrors.c \ - ../miniupnp/miniupnpc/upnpreplyparse.c + ../miniupnp/miniupnpc/src/addr_is_reserved.c \ + ../miniupnp/miniupnpc/src/connecthostport.c \ + ../miniupnp/miniupnpc/src/igd_desc_parse.c \ + ../miniupnp/miniupnpc/src/minisoap.c \ + ../miniupnp/miniupnpc/src/minissdpc.c \ + ../miniupnp/miniupnpc/src/miniupnpc.c \ + ../miniupnp/miniupnpc/src/miniwget.c \ + ../miniupnp/miniupnpc/src/minixml.c \ + ../miniupnp/miniupnpc/src/minixmlvalid.c \ + ../miniupnp/miniupnpc/src/portlistingparse.c \ + ../miniupnp/miniupnpc/src/receivedata.c \ + ../miniupnp/miniupnpc/src/upnpcommands.c \ + ../miniupnp/miniupnpc/src/upnpdev.c \ + ../miniupnp/miniupnpc/src/upnperrors.c \ + ../miniupnp/miniupnpc/src/upnpreplyparse.c LOCAL_CFLAGS := -O3 -fsigned-char -fno-strict-aliasing -Wall -Wno-multichar -D__STDC_CONSTANT_MACROS LOCAL_CPPFLAGS := -fno-exceptions -std=gnu++11 -fno-rtti -Wno-reorder # Note: LOCAL_PATH is the directory this file is in. -LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. $(LOCAL_PATH)/../miniupnp .. +LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. $(LOCAL_PATH)/../miniupnp/miniupnpc/src $(LOCAL_PATH)/../miniupnp/miniupnpc/include .. ifeq ($(findstring armeabi-v7a,$(TARGET_ARCH_ABI)),armeabi-v7a) LOCAL_CFLAGS := $(LOCAL_CFLAGS) diff --git a/ext/miniupnpc.vcxproj b/ext/miniupnpc.vcxproj index f69e726242..f7a9e77562 100644 --- a/ext/miniupnpc.vcxproj +++ b/ext/miniupnpc.vcxproj @@ -35,44 +35,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true + + + + + + + + + + + + + + + + + + + + + + + + + + + + 16.0 {D8A71225-178B-424E-96C1-CC3BE2C1B047} @@ -228,6 +222,7 @@ ProgramDatabase true MultiThreadedDebug + miniupnp/miniupnpc/include;miniupnp-build Windows @@ -257,6 +252,7 @@ cd..\..\.. Default MultiThreadedDebug false + miniupnp/miniupnpc/include;miniupnp-build Windows @@ -288,6 +284,7 @@ cd..\..\.. false MultiThreaded StreamingSIMDExtensions2 + miniupnp/miniupnpc/include;miniupnp-build Windows @@ -322,6 +319,7 @@ cd..\..\.. false false false + miniupnp/miniupnpc/include;miniupnp-build Windows @@ -351,6 +349,7 @@ cd..\..\.. DEBUG;_DEBUG;WIN32;_LIB;MINIUPNP_STATICLIB;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) MultiThreadedDebug false + miniupnp/miniupnpc/include;miniupnp-build iphlpapi.lib @@ -369,6 +368,7 @@ cd..\..\.. DEBUG;_DEBUG;WIN32;_LIB;MINIUPNP_STATICLIB;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) MultiThreadedDebug false + miniupnp/miniupnpc/include;miniupnp-build iphlpapi.lib @@ -392,6 +392,7 @@ cd..\..\.. true false false + miniupnp/miniupnpc/include;miniupnp-build iphlpapi.lib @@ -415,6 +416,7 @@ cd..\..\.. false false true + miniupnp/miniupnpc/include;miniupnp-build iphlpapi.lib diff --git a/ext/miniupnpc.vcxproj.filters b/ext/miniupnpc.vcxproj.filters index 8ecbe2bfcf..b2ce7c117b 100644 --- a/ext/miniupnpc.vcxproj.filters +++ b/ext/miniupnpc.vcxproj.filters @@ -1,38 +1,5 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {c82edf03-bf88-478d-aaf5-2854df756cab} @@ -42,6 +9,33 @@ scripts - + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libretro/Makefile.common b/libretro/Makefile.common index cacd212a52..a2189ae9f2 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -893,23 +893,23 @@ SOURCES_C += $(EXTDIR)/udis86/decode.c \ $(EXTDIR)/udis86/syn.c \ $(EXTDIR)/udis86/udis86.c -INCFLAGS += -I$(EXTDIR)/miniupnp-build +INCFLAGS += -I$(EXTDIR)/miniupnp-build -I$(EXTDIR)/miniupnp/miniupnpc/include -I$(EXTDIR)/miniupnp/miniupnpc/src SOURCES_C += \ - $(EXTDIR)/miniupnp/miniupnpc/addr_is_reserved.c \ - $(EXTDIR)/miniupnp/miniupnpc/connecthostport.c \ - $(EXTDIR)/miniupnp/miniupnpc/igd_desc_parse.c \ - $(EXTDIR)/miniupnp/miniupnpc/minisoap.c \ - $(EXTDIR)/miniupnp/miniupnpc/minissdpc.c \ - $(EXTDIR)/miniupnp/miniupnpc/miniupnpc.c \ - $(EXTDIR)/miniupnp/miniupnpc/miniwget.c \ - $(EXTDIR)/miniupnp/miniupnpc/minixml.c \ - $(EXTDIR)/miniupnp/miniupnpc/minixmlvalid.c \ - $(EXTDIR)/miniupnp/miniupnpc/portlistingparse.c \ - $(EXTDIR)/miniupnp/miniupnpc/receivedata.c \ - $(EXTDIR)/miniupnp/miniupnpc/upnpcommands.c \ - $(EXTDIR)/miniupnp/miniupnpc/upnpdev.c \ - $(EXTDIR)/miniupnp/miniupnpc/upnperrors.c \ - $(EXTDIR)/miniupnp/miniupnpc/upnpreplyparse.c + $(EXTDIR)/miniupnp/miniupnpc/src/addr_is_reserved.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/connecthostport.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/igd_desc_parse.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/minisoap.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/minissdpc.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/miniupnpc.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/miniwget.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/minixml.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/minixmlvalid.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/portlistingparse.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/receivedata.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/upnpcommands.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/upnpdev.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/upnperrors.c \ + $(EXTDIR)/miniupnp/miniupnpc/src/upnpreplyparse.c SOURCES_CXX += \ $(GPUDIR)/Vulkan/DrawEngineVulkan.cpp \