diff --git a/dep/libcue/CMakeLists.txt b/dep/libcue/CMakeLists.txt index 16982e58b..c40f487f4 100644 --- a/dep/libcue/CMakeLists.txt +++ b/dep/libcue/CMakeLists.txt @@ -3,7 +3,7 @@ set(SRCS include/libcue/cdtext.h include/libcue/libcue.h include/libcue/rem.h - include/libcue/time.h + include/libcue/cuetime.h src/cd.c src/cdtext.c src/cue_parser.c diff --git a/dep/libcue/include/libcue/time.h b/dep/libcue/include/libcue/cuetime.h similarity index 89% rename from dep/libcue/include/libcue/time.h rename to dep/libcue/include/libcue/cuetime.h index 3c6bd5124..78b019fac 100644 --- a/dep/libcue/include/libcue/time.h +++ b/dep/libcue/include/libcue/cuetime.h @@ -5,8 +5,8 @@ * For license terms, see the file COPYING in this distribution. */ -#ifndef TIME_H -#define TIME_H +#ifndef CUETIME_H +#define CUETIME_H long time_msf_to_frame(int m, int s, int f); void time_frame_to_msf(long frame, int *m, int *s, int *f); diff --git a/dep/libcue/src/cue_parser.c b/dep/libcue/src/cue_parser.c index 2614d7678..8cc9b462f 100644 --- a/dep/libcue/src/cue_parser.c +++ b/dep/libcue/src/cue_parser.c @@ -88,7 +88,7 @@ #include #include "cd.h" -#include "time.h" +#include "cuetime.h" #ifdef CUEPARSER_BUF_SIZE #undef CUEPARSER_BUF_SIZE diff --git a/dep/libcue/src/cue_parser.y b/dep/libcue/src/cue_parser.y index c25fbe3c4..45de094f2 100644 --- a/dep/libcue/src/cue_parser.y +++ b/dep/libcue/src/cue_parser.y @@ -10,7 +10,7 @@ #include #include "cd.h" -#include "time.h" +#include "cuetime.h" #ifdef CUEPARSER_BUF_SIZE #undef CUEPARSER_BUF_SIZE diff --git a/dep/libcue/src/time.c b/dep/libcue/src/time.c index fb7437e3d..9ea2be0f2 100644 --- a/dep/libcue/src/time.c +++ b/dep/libcue/src/time.c @@ -5,7 +5,7 @@ * For license terms, see the file COPYING in this distribution. */ -#include "time.h" +#include "cuetime.h" #include #include diff --git a/src/common/event.cpp b/src/common/event.cpp index 3984e5161..d9615fb8d 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -4,7 +4,7 @@ #if defined(WIN32) #include #include "windows_headers.h" -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__) #include #include #include @@ -61,7 +61,7 @@ void Event::WaitForMultiple(Event** events, u32 num_events) WaitForMultipleObjects(num_events, event_handles, TRUE, INFINITE); } -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__) Event::Event(bool auto_reset /*= false*/) : m_auto_reset(auto_reset) { diff --git a/src/common/event.h b/src/common/event.h index e99e3aa5f..214b08b16 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -19,7 +19,7 @@ public: private: #ifdef WIN32 void* m_event_handle; -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__) int m_pipe_fds[2]; bool m_auto_reset; #else @@ -27,4 +27,4 @@ private: #endif }; -} // namespace Common \ No newline at end of file +} // namespace Common diff --git a/src/common/file_system.cpp b/src/common/file_system.cpp index ec98c814e..6db11ee1a 100644 --- a/src/common/file_system.cpp +++ b/src/common/file_system.cpp @@ -1216,7 +1216,14 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co FILESYSTEM_FIND_DATA outData; outData.Attributes = 0; +#ifdef __HAIKU__ + struct stat sDir; + + stat(pDirEnt->d_name, &sDir); + if (S_ISDIR(sDir.st_mode)) +#else if (pDirEnt->d_type == DT_DIR) +#endif { if (Flags & FILESYSTEM_FIND_RECURSIVE) { @@ -1309,8 +1316,13 @@ bool StatFile(const char* Path, FILESYSTEM_STAT_DATA* pStatData) return false; // stat file +#ifdef __HAIKU__ + struct stat sysStatData; + if (stat(Path, &sysStatData) < 0) +#else struct stat64 sysStatData; if (stat64(Path, &sysStatData) < 0) +#endif return false; // parse attributes @@ -1338,8 +1350,13 @@ bool FileExists(const char* Path) return false; // stat file +#ifdef __HAIKU__ + struct stat sysStatData; + if (stat(Path, &sysStatData) < 0) +#else struct stat64 sysStatData; if (stat64(Path, &sysStatData) < 0) +#endif return false; if (S_ISDIR(sysStatData.st_mode)) @@ -1355,8 +1372,13 @@ bool DirectoryExists(const char* Path) return false; // stat file - struct stat64 sysStatData; - if (stat64(Path, &sysStatData) < 0) +#ifdef __HAIKU__ + struct stat sysStatData; + if (stat(Path, &sysStatData) < 0) +#else + struct stat64 sysStatData; + if (stat64(Path, &sysStatData) < 0) +#endif return false; if (S_ISDIR(sysStatData.st_mode)) diff --git a/src/common/jit_code_buffer.cpp b/src/common/jit_code_buffer.cpp index 9dcc97e75..3866b1284 100644 --- a/src/common/jit_code_buffer.cpp +++ b/src/common/jit_code_buffer.cpp @@ -37,7 +37,7 @@ bool JitCodeBuffer::Allocate(u32 size /* = 64 * 1024 * 1024 */, u32 far_code_siz #if defined(WIN32) m_code_ptr = static_cast(VirtualAlloc(nullptr, m_total_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE)); -#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) m_code_ptr = static_cast( mmap(nullptr, m_total_size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); #else @@ -86,7 +86,7 @@ bool JitCodeBuffer::Initialize(void* buffer, u32 size, u32 far_code_size /* = 0 m_code_ptr = static_cast(buffer); m_old_protection = static_cast(old_protect); -#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) if (mprotect(buffer, size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) return false; @@ -128,7 +128,7 @@ void JitCodeBuffer::Destroy() { #if defined(WIN32) VirtualFree(m_code_ptr, 0, MEM_RELEASE); -#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) munmap(m_code_ptr, m_total_size); #endif } diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index eb21533f4..40aa4e207 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -20,9 +20,11 @@ constexpr bool USE_BLOCK_LINKING = true; #ifdef WITH_RECOMPILER static constexpr u32 RECOMPILER_CODE_CACHE_SIZE = 32 * 1024 * 1024; static constexpr u32 RECOMPILER_FAR_CODE_CACHE_SIZE = 32 * 1024 * 1024; +#ifndef __HAIKU__ static constexpr u32 RECOMPILER_GUARD_SIZE = 4096; alignas(Recompiler::CODE_STORAGE_ALIGNMENT) static u8 s_code_storage[RECOMPILER_CODE_CACHE_SIZE + RECOMPILER_FAR_CODE_CACHE_SIZE]; +#endif static JitCodeBuffer s_code_buffer; enum : u32 @@ -90,8 +92,12 @@ void Initialize(bool use_recompiler) #ifdef WITH_RECOMPILER s_use_recompiler = use_recompiler; +#ifndef __HAIKU__ if (!s_code_buffer.Initialize(s_code_storage, sizeof(s_code_storage), RECOMPILER_FAR_CODE_CACHE_SIZE, RECOMPILER_GUARD_SIZE)) +#else + if (!s_code_buffer.Allocate(RECOMPILER_CODE_CACHE_SIZE, RECOMPILER_FAR_CODE_CACHE_SIZE)) +#endif { Panic("Failed to initialize code space"); } diff --git a/src/core/cpu_recompiler_types.h b/src/core/cpu_recompiler_types.h index 5fefca46e..9bb224223 100644 --- a/src/core/cpu_recompiler_types.h +++ b/src/core/cpu_recompiler_types.h @@ -80,7 +80,7 @@ constexpr u32 CODE_STORAGE_ALIGNMENT = 4096; // ABI selection #if defined(WIN32) #define ABI_WIN64 1 -#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) #define ABI_SYSV 1 #else #error Unknown ABI.