From bef473d5453c1d347b1499fb89d540cc384af423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 20 Jul 2023 20:22:59 +0200 Subject: [PATCH] Try to fix build on platforms where naett doesn't run yet --- CMakeLists.txt | 10 ++++++++++ Common/Net/HTTPNaettRequest.cpp | 4 ++++ Common/Net/HTTPNaettRequest.h | 4 ++++ Common/Net/HTTPRequest.cpp | 12 ++++++++++++ SDL/SDLMain.cpp | 4 ++++ android/jni/app-android.cpp | 4 ++++ ios/main.mm | 5 ++++- libretro/Makefile.common | 5 ++--- 8 files changed, 44 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc5d33f33a81..2d9e03a75570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,6 +219,16 @@ else() set(CoreLinkType STATIC) endif() +if(NOT ANDROID OR NOT WIN32 OR NOT APPLE) + set(HTTPS_NOT_AVAILABLE ON) +endif() + +# Made this flag negative because it's hopefully quite temporary and didn't +# want to have to update all build systems. +if(HTTPS_NOT_AVAILABLE) + add_definitions(-DHTTPS_NOT_AVAILABLE) +endif() + # Work around for some misfeature of the current glslang build system include_directories(ext/glslang) diff --git a/Common/Net/HTTPNaettRequest.cpp b/Common/Net/HTTPNaettRequest.cpp index dd0539cc3993..aa5aa2f76333 100644 --- a/Common/Net/HTTPNaettRequest.cpp +++ b/Common/Net/HTTPNaettRequest.cpp @@ -1,3 +1,5 @@ +#ifndef HTTPS_NOT_AVAILABLE + #include #include "Common/Net/HTTPRequest.h" @@ -90,3 +92,5 @@ bool HTTPSDownload::Done() { } } // namespace + +#endif // HTTPS_NOT_AVAILABLE diff --git a/Common/Net/HTTPNaettRequest.h b/Common/Net/HTTPNaettRequest.h index 3dd557086eda..8fd85cbe52b8 100644 --- a/Common/Net/HTTPNaettRequest.h +++ b/Common/Net/HTTPNaettRequest.h @@ -4,6 +4,8 @@ #include "ext/naett/naett.h" #include +#ifndef HTTPS_NOT_AVAILABLE + namespace http { // Really an asynchronous request. @@ -66,3 +68,5 @@ class HTTPSDownload : public Download { }; } // namespace http + +#endif // HTTPS_NOT_AVAILABLE diff --git a/Common/Net/HTTPRequest.cpp b/Common/Net/HTTPRequest.cpp index 988f81b19010..318470a09dc5 100644 --- a/Common/Net/HTTPRequest.cpp +++ b/Common/Net/HTTPRequest.cpp @@ -13,7 +13,11 @@ bool RequestManager::IsHttpsUrl(const std::string &url) { std::shared_ptr RequestManager::StartDownload(const std::string &url, const Path &outfile, ProgressBarMode mode, const char *acceptMime) { std::shared_ptr dl; if (IsHttpsUrl(url)) { +#ifndef HTTPS_NOT_AVAILABLE dl.reset(new HTTPSDownload(RequestMethod::GET, url, "", "", outfile, mode)); +#else + return std::shared_ptr(); +#endif } else { dl.reset(new HTTPDownload(RequestMethod::GET, url, "", "", outfile, mode)); } @@ -36,7 +40,11 @@ std::shared_ptr RequestManager::StartDownloadWithCallback( const char *acceptMime) { std::shared_ptr dl; if (IsHttpsUrl(url)) { +#ifndef HTTPS_NOT_AVAILABLE dl.reset(new HTTPSDownload(RequestMethod::GET, url, "", "", outfile, mode, name)); +#else + return std::shared_ptr(); +#endif } else { dl.reset(new HTTPDownload(RequestMethod::GET, url, "", "", outfile, mode, name)); } @@ -59,7 +67,11 @@ std::shared_ptr RequestManager::AsyncPostWithCallback( const std::string &name) { std::shared_ptr dl; if (IsHttpsUrl(url)) { +#ifndef HTTPS_NOT_AVAILABLE dl.reset(new HTTPSDownload(RequestMethod::POST, url, postData, postMime, Path(), mode, name)); +#else + return std::shared_ptr(); +#endif } else { dl.reset(new HTTPDownload(RequestMethod::POST, url, postData, postMime, Path(), mode, name)); } diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index f46af287ad02..955592a492c8 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -529,6 +529,10 @@ bool System_GetPropertyBool(SystemProperty prop) { return true; case SYSPROP_SUPPORTS_OPEN_FILE_IN_EDITOR: return true; // FileUtil.cpp: OpenFileInEditor +#ifndef HTTPS_NOT_AVAILABLE + case SYSPROP_SUPPORTS_HTTPS: + return true; +#endif #if PPSSPP_PLATFORM(MAC) case SYSPROP_HAS_FOLDER_BROWSER: case SYSPROP_HAS_FILE_BROWSER: diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 22a23e33b85b..61c737396c9a 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -535,6 +535,10 @@ bool System_GetPropertyBool(SystemProperty prop) { } case SYSPROP_HAS_KEYBOARD: return deviceType != DEVICE_TYPE_VR; +#ifndef HTTPS_NOT_AVAILABLE + case SYSPROP_SUPPORTS_HTTPS: + return true; +#endif default: return false; } diff --git a/ios/main.mm b/ios/main.mm index 18d23f851775..4ca2f041ddbd 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -168,7 +168,10 @@ bool System_GetPropertyBool(SystemProperty prop) { #endif case SYSPROP_CAN_JIT: return get_debugged(); - +#ifndef HTTPS_NOT_AVAILABLE + case SYSPROP_SUPPORTS_HTTPS: + return true; +#endif default: return false; } diff --git a/libretro/Makefile.common b/libretro/Makefile.common index f6bba72d5e64..8c6a90ca0608 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -223,10 +223,9 @@ SOURCES_C += \ $(EXTDIR)/rcheevos/src/rhash/hash.c \ $(EXTDIR)/rcheevos/src/rhash/md5.c -SOURCES_C += - $(EXTDIR)/naett/naett.c - COREFLAGS += -DSTACK_LINE_READER_BUFFER_SIZE=1024 +COREFLAGS += -DHTTPS_NOT_AVAILABLE + ifeq ($(PLATFORM_EXT), android) COREFLAGS += -DHAVE_DLFCN_H else ifneq ($(PLATFORM_EXT), win32)