Skip to content

Commit

Permalink
Try to fix build on platforms where naett doesn't run yet
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jul 20, 2023
1 parent 9ec6b34 commit dd31b3e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions Common/Net/HTTPNaettRequest.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef HTTPS_NOT_AVAILABLE

#include <cstring>

#include "Common/Net/HTTPRequest.h"
Expand Down Expand Up @@ -90,3 +92,5 @@ bool HTTPSDownload::Done() {
}

} // namespace

#endif // HTTPS_NOT_AVAILABLE
4 changes: 4 additions & 0 deletions Common/Net/HTTPNaettRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "ext/naett/naett.h"
#include <thread>

#ifndef HTTPS_NOT_AVAILABLE

namespace http {

// Really an asynchronous request.
Expand Down Expand Up @@ -66,3 +68,5 @@ class HTTPSDownload : public Download {
};

} // namespace http

#endif // HTTPS_NOT_AVAILABLE
12 changes: 12 additions & 0 deletions Common/Net/HTTPRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ bool RequestManager::IsHttpsUrl(const std::string &url) {
std::shared_ptr<Download> RequestManager::StartDownload(const std::string &url, const Path &outfile, ProgressBarMode mode, const char *acceptMime) {
std::shared_ptr<Download> dl;
if (IsHttpsUrl(url)) {
#ifndef HTTPS_NOT_AVAILABLE
dl.reset(new HTTPSDownload(RequestMethod::GET, url, "", "", outfile, mode));
#else
return std::shared_ptr<Download>();
#endif
} else {
dl.reset(new HTTPDownload(RequestMethod::GET, url, "", "", outfile, mode));
}
Expand All @@ -36,7 +40,11 @@ std::shared_ptr<Download> RequestManager::StartDownloadWithCallback(
const char *acceptMime) {
std::shared_ptr<Download> dl;
if (IsHttpsUrl(url)) {
#ifndef HTTPS_NOT_AVAILABLE
dl.reset(new HTTPSDownload(RequestMethod::GET, url, "", "", outfile, mode, name));
#else
return std::shared_ptr<Download>();
#endif
} else {
dl.reset(new HTTPDownload(RequestMethod::GET, url, "", "", outfile, mode, name));
}
Expand All @@ -59,7 +67,11 @@ std::shared_ptr<Download> RequestManager::AsyncPostWithCallback(
const std::string &name) {
std::shared_ptr<Download> 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<Download>();
#endif
} else {
dl.reset(new HTTPDownload(RequestMethod::POST, url, postData, postMime, Path(), mode, name));
}
Expand Down
4 changes: 4 additions & 0 deletions SDL/SDLMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions android/jni/app-android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion ios/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 2 additions & 3 deletions libretro/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dd31b3e

Please sign in to comment.