redox/recipes/emulators/flycast/redox.patch
2026-06-07 03:32:02 +07:00

151 lines
5.3 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8340288..589d4b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -466,7 +466,7 @@ if(NOT LIBRETRO)
endif()
if(NOT ANDROID AND NOT IOS)
- if (NOT NINTENDO_SWITCH)
+ if (NOT NINTENDO_SWITCH AND NOT REDOX)
# DreamLink enabled for non-mobile Linux, MacOS, and Windows
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_DREAMLINK_DEVICES=1)
set(USE_DREAMLINK_DEVICES ON) # Must be set before adding core/sdl
@@ -493,7 +493,7 @@ if(NOT LIBRETRO)
endif()
if(USE_HOST_SDL)
- find_package(SDL2 2.0.9)
+ find_package(SDL2 REQUIRED)
endif()
if(NOT SDL2_FOUND)
set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
@@ -691,11 +691,11 @@ target_sources(${PROJECT_NAME} PRIVATE
core/deps/chdpsr/cdipsr.cpp
core/deps/chdpsr/cdipsr.h)
-add_subdirectory(core/deps/nowide EXCLUDE_FROM_ALL)
+add_subdirectory(core/deps/nowide)
target_link_libraries(${PROJECT_NAME} PRIVATE nowide::nowide)
if(NOT MINIUPNP_FOUND)
- if(NINTENDO_SWITCH)
+ if(NINTENDO_SWITCH OR REDOX)
target_compile_definitions(${PROJECT_NAME} PRIVATE FEAT_NO_MINIUPNPC)
else()
option(UPNPC_BUILD_SHARED "Build shared library" OFF)
Submodule core/deps/asio contains modified content
diff --git a/core/deps/asio/asio/include/asio/detail/config.hpp b/core/deps/asio/asio/include/asio/detail/config.hpp
index 61ee752..4b140b9 100644
--- a/core/deps/asio/asio/include/asio/detail/config.hpp
+++ b/core/deps/asio/asio/include/asio/detail/config.hpp
@@ -828,6 +828,7 @@
|| defined(__NetBSD__) \
|| defined(__OpenBSD__) \
|| defined(__linux__) \
+ || defined(__redox__) \
|| defined(__HAIKU__)
# define ASIO_HAS_UNISTD_H 1
# endif
@@ -1093,7 +1094,6 @@
# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
# endif // !defined(ASIO_DISABLE_THREADS)
#endif // !defined(ASIO_HAS_THREADS)
-
// POSIX threads.
#if !defined(ASIO_HAS_PTHREADS)
# if defined(ASIO_HAS_THREADS)
diff --git a/core/hw/sh4/modules/serial.cpp b/core/hw/sh4/modules/serial.cpp
index aca43a0..11991e9 100644
--- a/core/hw/sh4/modules/serial.cpp
+++ b/core/hw/sh4/modules/serial.cpp
@@ -475,7 +475,7 @@ struct PTYPipe : public SerialPort::Pipe
void init()
{
-#if defined(__unix__) || defined(__APPLE__)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(__redox__)
if (config::SerialConsole && config::SerialPTY && tty == 1)
{
tty = open("/dev/ptmx", O_RDWR | O_NDELAY | O_NOCTTY | O_NONBLOCK);
diff --git a/core/linux/context.cpp b/core/linux/context.cpp
index 7ab2d8e..8a2bb2c 100644
--- a/core/linux/context.cpp
+++ b/core/linux/context.cpp
@@ -8,11 +8,11 @@
#define __USE_GNU 1
#endif
- #if !defined(__OpenBSD__)
+ #if !defined(__OpenBSD__) && !defined(__redox__)
#include <ucontext.h>
#endif
- #if defined(__OpenBSD__)
+ #if defined(__OpenBSD__) || defined(__redox__)
#include <signal.h>
#endif
@@ -112,6 +112,11 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx)
bicopy<ToSegfault>(hostctx->rsp, MCTX(.__gregs[_REG_RSP]));
bicopy<ToSegfault>(hostctx->r9, MCTX(.__gregs[_REG_R9]));
bicopy<ToSegfault>(hostctx->rdi, MCTX(.__gregs[_REG_RDI]));
+ #elif defined(__redox__)
+ bicopy<ToSegfault>(hostctx->pc, MCTX(.rip));
+ bicopy<ToSegfault>(hostctx->rsp, MCTX(.rsp));
+ bicopy<ToSegfault>(hostctx->r9, MCTX(.r9));
+ bicopy<ToSegfault>(hostctx->rdi, MCTX(.rdi));
#elif defined(__unix__)
bicopy<ToSegfault>(hostctx->pc, MCTX(.gregs[REG_RIP]));
bicopy<ToSegfault>(hostctx->rsp, MCTX(.gregs[REG_RSP]));
diff --git a/core/network/dns.cpp b/core/network/dns.cpp
index 4d45c4a..96752ef 100644
--- a/core/network/dns.cpp
+++ b/core/network/dns.cpp
@@ -153,7 +153,7 @@ pico_ip4 parseDnsResponsePacket(const void *buf, size_t len)
return { ~0u };
}
-#if !defined(_WIN32) && !defined(__SWITCH__)
+#if !defined(_WIN32) && !defined(__SWITCH__) && !defined(__redox__)
#include <ifaddrs.h>
#include <net/if.h>
#endif
@@ -200,7 +200,7 @@ bool is_local_address(u32 addr)
}
closesocket(sd);
-#elif defined(__SWITCH__)
+#elif defined(__SWITCH__) || defined(__redox__)
// TODO
#else // !_WIN32 && !__SWITCH__
diff --git a/core/network/net_platform.h b/core/network/net_platform.h
index 8b5ea48..1a20e0b 100644
--- a/core/network/net_platform.h
+++ b/core/network/net_platform.h
@@ -91,7 +91,7 @@ static inline void set_tcp_nodelay(sock_t fd)
#if defined(_WIN32)
struct protoent *tcp_proto = getprotobyname("TCP");
setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, (const char *)&optval, optlen);
-#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
+#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__redox__)
setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&optval, optlen);
#else
struct protoent *tcp_proto = getprotobyname("TCP");
diff --git a/core/rend/TexCache.cpp b/core/rend/TexCache.cpp
index 35b41b7..2782d5e 100644
--- a/core/rend/TexCache.cpp
+++ b/core/rend/TexCache.cpp
@@ -670,7 +670,10 @@ bool BaseTextureCacheData::Update()
mipmapped = false;
}
//lock the texture to detect changes in it
+// TODO: No SIGSEGV handler on redox
+#if !defined(__redox__)
protectVRam();
+#endif
UploadToGPU(upscaled_w, upscaled_h, (const u8 *)temp_tex_buffer, IsMipmapped(), mipmapped);
if (config::DumpTextures)