From 94f0c7c5f744498602d075c6367e29a606b190a0 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 24 Jul 2023 23:20:12 +0300 Subject: [PATCH] try to fix win32 build HAVE_MMAP etc clashing with libretro-common --- Makefile | 8 ++++---- frontend/libretro.c | 4 ++-- frontend/libretro_core_options.h | 4 ++-- jni/Android.mk | 2 +- libpcsxcore/cdriso.c | 4 ++-- libpcsxcore/memmap.h | 2 +- libpcsxcore/psxmem.c | 4 ++-- plugins/dfsound/spu.c | 8 ++++---- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 14c67bef..77f6a2a6 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,9 @@ else CFLAGS += -O2 -DNDEBUG endif endif -CFLAGS += -DHAVE_MMAP=$(if $(NO_MMAP),0,1) \ - -DHAVE_PTHREAD=$(if $(NO_PTHREAD),0,1) \ - -DHAVE_POSIX_MEMALIGN=$(if $(NO_POSIX_MEMALIGN),0,1) +CFLAGS += -DP_HAVE_MMAP=$(if $(NO_MMAP),0,1) \ + -DP_HAVE_PTHREAD=$(if $(NO_PTHREAD),0,1) \ + -DP_HAVE_POSIX_MEMALIGN=$(if $(NO_POSIX_MEMALIGN),0,1) CXXFLAGS += $(CFLAGS) #DRC_DBG = 1 #PCNT = 1 @@ -326,7 +326,7 @@ ifeq "$(PLATFORM)" "libretro" ifeq "$(USE_LIBRETRO_VFS)" "1" OBJS += deps/libretro-common/compat/compat_posix_string.o OBJS += deps/libretro-common/compat/fopen_utf8.o -OBJS += deps/libretro-common/encodings/compat_strl.o +OBJS += deps/libretro-common/compat/compat_strl.o OBJS += deps/libretro-common/encodings/encoding_utf.o OBJS += deps/libretro-common/file/file_path.o OBJS += deps/libretro-common/streams/file_stream.o diff --git a/frontend/libretro.c b/frontend/libretro.c index 329c5bcc..d91b8079 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -2098,7 +2098,7 @@ static void update_variables(bool in_flight) spu_config.iUseThread = 0; } - if (HAVE_PTHREAD) { + if (P_HAVE_PTHREAD) { var.value = NULL; var.key = "pcsx_rearmed_async_cd"; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) @@ -3039,7 +3039,7 @@ void retro_init(void) #ifdef _3DS vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80); -#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && HAVE_POSIX_MEMALIGN +#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && P_HAVE_POSIX_MEMALIGN if (posix_memalign(&vout_buf, 16, VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2) != 0) vout_buf = (void *) 0; #else diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h index 6875b57d..389e9e68 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -750,7 +750,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "enabled", }, -#if HAVE_PTHREAD +#if P_HAVE_PTHREAD { "pcsx_rearmed_spu_thread", "Threaded SPU", @@ -765,7 +765,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "disabled", }, -#endif // HAVE_PTHREAD +#endif // P_HAVE_PTHREAD { "pcsx_rearmed_show_input_settings", "Show Input Settings", diff --git a/jni/Android.mk b/jni/Android.mk index 3cfe5225..856cb3a0 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -93,7 +93,7 @@ SOURCES_C += \ SOURCES_ASM := COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED -COREFLAGS += -DHAVE_MMAP=1 -DHAVE_PTHREAD=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_CHD -D_7ZIP_ST +COREFLAGS += -DP_HAVE_MMAP=1 -DP_HAVE_PTHREAD=1 -DP_HAVE_POSIX_MEMALIGN=1 -DHAVE_CHD -D_7ZIP_ST ifeq ($(USE_LIBRETRO_VFS),1) SOURCES_C += \ diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 232a979f..8e11f5a6 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -36,7 +36,7 @@ #include #include #define strcasecmp _stricmp -#elif HAVE_PTHREAD +#elif P_HAVE_PTHREAD #include #include #include @@ -45,7 +45,7 @@ // to enable the USE_READ_THREAD code, fix: // - https://github.com/notaz/pcsx_rearmed/issues/257 // - ISOgetBufferSub to not race with async code -#define USE_READ_THREAD 0 //HAVE_PTHREAD +#define USE_READ_THREAD 0 //P_HAVE_PTHREAD #ifdef USE_LIBRETRO_VFS #include diff --git a/libpcsxcore/memmap.h b/libpcsxcore/memmap.h index da1d0e11..d16dea0b 100644 --- a/libpcsxcore/memmap.h +++ b/libpcsxcore/memmap.h @@ -36,7 +36,7 @@ #endif //_WIN32 -#if defined(_WIN32) || !HAVE_MMAP +#if defined(_WIN32) || !P_HAVE_MMAP #include #ifdef __cplusplus diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 14e7a9e9..42755e52 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -44,7 +44,7 @@ static void * psxMapDefault(unsigned long addr, size_t size, int is_fixed, enum psxMapTag tag) { -#if !HAVE_MMAP +#if !P_HAVE_MMAP void *ptr; ptr = malloc(size); @@ -59,7 +59,7 @@ static void * psxMapDefault(unsigned long addr, size_t size, static void psxUnmapDefault(void *ptr, size_t size, enum psxMapTag tag) { -#if !HAVE_MMAP +#if !P_HAVE_MMAP free(ptr); #else munmap(ptr, size); diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index f5e8de50..f6730d64 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -829,7 +829,7 @@ static void do_samples_finish(int *SSumLR, int ns_to, // optional worker thread handling -#if HAVE_PTHREAD || defined(WANT_THREAD_CODE) +#if P_HAVE_PTHREAD || defined(WANT_THREAD_CODE) // worker thread state static struct spu_worker { @@ -1084,7 +1084,7 @@ static void sync_worker_thread(int force) {} static const void * const worker = NULL; -#endif // HAVE_PTHREAD || defined(WANT_THREAD_CODE) +#endif // P_HAVE_PTHREAD || defined(WANT_THREAD_CODE) //////////////////////////////////////////////////////////////////////// // MAIN SPU FUNCTION @@ -1365,7 +1365,7 @@ static void RemoveStreams(void) /* special code for TI C64x DSP */ #include "spu_c64x.c" -#elif HAVE_PTHREAD +#elif P_HAVE_PTHREAD #include #include @@ -1464,7 +1464,7 @@ static void exit_spu_thread(void) worker = NULL; } -#else // if !HAVE_PTHREAD +#else // if !P_HAVE_PTHREAD static void init_spu_thread(void) { -- 2.39.2