diff options
Diffstat (limited to '')
| -rw-r--r-- | CMakeLists.txt | 26 | ||||
| -rw-r--r-- | externals/microprofile/microprofile.h | 8 | ||||
| -rw-r--r-- | externals/microprofile/microprofileui.h | 1 | ||||
| -rwxr-xr-x | hooks/pre-commit | 6 | ||||
| -rw-r--r-- | src/citra/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/common/file_util.cpp | 25 | ||||
| -rw-r--r-- | src/common/swap.h | 7 | ||||
| -rw-r--r-- | src/common/thread.cpp | 12 | ||||
| -rw-r--r-- | src/common/x64/cpu_detect.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/soc_u.cpp | 8 |
11 files changed, 68 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c7a24f04f..26dec8f86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -105,6 +105,15 @@ else() | |||
| 105 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) | 105 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) |
| 106 | endif() | 106 | endif() |
| 107 | 107 | ||
| 108 | # Set file offset size to 64 bits. | ||
| 109 | # | ||
| 110 | # On modern Unixes, this is typically already the case. The lone exception is | ||
| 111 | # glibc, which may default to 32 bits. glibc allows this to be configured | ||
| 112 | # by setting _FILE_OFFSET_BITS. | ||
| 113 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
| 114 | add_definitions(-D_FILE_OFFSET_BITS=64) | ||
| 115 | endif() | ||
| 116 | |||
| 108 | add_definitions(-DSINGLETHREADED) | 117 | add_definitions(-DSINGLETHREADED) |
| 109 | # CMake seems to only define _DEBUG on Windows | 118 | # CMake seems to only define _DEBUG on Windows |
| 110 | set_property(DIRECTORY APPEND PROPERTY | 119 | set_property(DIRECTORY APPEND PROPERTY |
| @@ -160,23 +169,30 @@ endif() | |||
| 160 | 169 | ||
| 161 | IF (APPLE) | 170 | IF (APPLE) |
| 162 | FIND_LIBRARY(COCOA_LIBRARY Cocoa) # Umbrella framework for everything GUI-related | 171 | FIND_LIBRARY(COCOA_LIBRARY Cocoa) # Umbrella framework for everything GUI-related |
| 163 | set(PLATFORM_LIBRARIES iconv ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) | 172 | set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) |
| 164 | 173 | ||
| 165 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | 174 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") |
| 166 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") | 175 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") |
| 167 | ELSEIF(MINGW) | 176 | ELSEIF(MINGW) |
| 168 | # GCC does not support codecvt, so use iconv instead | ||
| 169 | # PSAPI is the Process Status API | 177 | # PSAPI is the Process Status API |
| 170 | set(PLATFORM_LIBRARIES winmm ws2_32 psapi iconv) | 178 | set(PLATFORM_LIBRARIES winmm ws2_32 psapi) |
| 171 | 179 | ||
| 172 | # WSAPoll functionality doesn't exist before WinNT 6.x (Vista and up) | 180 | # WSAPoll functionality doesn't exist before WinNT 6.x (Vista and up) |
| 173 | add_definitions(-D_WIN32_WINNT=0x0600) | 181 | add_definitions(-D_WIN32_WINNT=0x0600) |
| 174 | ELSEIF(WIN32) | 182 | ELSEIF(WIN32) |
| 175 | set(PLATFORM_LIBRARIES winmm ws2_32) | 183 | set(PLATFORM_LIBRARIES winmm ws2_32) |
| 176 | ELSE() | 184 | ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$") |
| 177 | set(PLATFORM_LIBRARIES rt) | 185 | set(PLATFORM_LIBRARIES rt) |
| 178 | ENDIF (APPLE) | 186 | ENDIF (APPLE) |
| 179 | 187 | ||
| 188 | # MINGW: GCC does not support codecvt, so use iconv instead | ||
| 189 | if (UNIX OR MINGW) | ||
| 190 | find_library(ICONV_LIBRARY NAMES iconv) | ||
| 191 | if (ICONV_LIBRARY) | ||
| 192 | list(APPEND PLATFORM_LIBRARIES ${ICONV_LIBRARY}) | ||
| 193 | endif() | ||
| 194 | endif() | ||
| 195 | |||
| 180 | if (ENABLE_QT) | 196 | if (ENABLE_QT) |
| 181 | if (CITRA_USE_BUNDLED_QT) | 197 | if (CITRA_USE_BUNDLED_QT) |
| 182 | if (MSVC14 AND ARCHITECTURE_x86_64) | 198 | if (MSVC14 AND ARCHITECTURE_x86_64) |
| @@ -253,7 +269,7 @@ add_subdirectory(src) | |||
| 253 | # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html | 269 | # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html |
| 254 | # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html | 270 | # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html |
| 255 | # http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html | 271 | # http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html |
| 256 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | 272 | if(ENABLE_QT AND UNIX AND NOT APPLE) |
| 257 | install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.desktop" | 273 | install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.desktop" |
| 258 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") | 274 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") |
| 259 | install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.svg" | 275 | install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.svg" |
diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h index d1ae0c1c2..30613b3b0 100644 --- a/externals/microprofile/microprofile.h +++ b/externals/microprofile/microprofile.h | |||
| @@ -206,7 +206,7 @@ int64_t MicroProfileGetTick(); | |||
| 206 | #define MP_GETCURRENTTHREADID() GetCurrentThreadId() | 206 | #define MP_GETCURRENTTHREADID() GetCurrentThreadId() |
| 207 | typedef uint32_t ThreadIdType; | 207 | typedef uint32_t ThreadIdType; |
| 208 | 208 | ||
| 209 | #elif defined(__linux__) | 209 | #elif !defined(_WIN32) |
| 210 | #include <unistd.h> | 210 | #include <unistd.h> |
| 211 | #include <time.h> | 211 | #include <time.h> |
| 212 | inline int64_t MicroProfileTicksPerSecondCpu() | 212 | inline int64_t MicroProfileTicksPerSecondCpu() |
| @@ -510,7 +510,7 @@ typedef int MpSocket; | |||
| 510 | #endif | 510 | #endif |
| 511 | 511 | ||
| 512 | 512 | ||
| 513 | #if defined(__APPLE__) || defined(__linux__) | 513 | #ifndef _WIN32 |
| 514 | typedef pthread_t MicroProfileThread; | 514 | typedef pthread_t MicroProfileThread; |
| 515 | #elif defined(_WIN32) | 515 | #elif defined(_WIN32) |
| 516 | typedef HANDLE MicroProfileThread; | 516 | typedef HANDLE MicroProfileThread; |
| @@ -907,7 +907,7 @@ int64_t MicroProfileGetTick() | |||
| 907 | 907 | ||
| 908 | typedef void* (*MicroProfileThreadFunc)(void*); | 908 | typedef void* (*MicroProfileThreadFunc)(void*); |
| 909 | 909 | ||
| 910 | #if defined(__APPLE__) || defined(__linux__) | 910 | #ifndef _WIN32 |
| 911 | typedef pthread_t MicroProfileThread; | 911 | typedef pthread_t MicroProfileThread; |
| 912 | void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) | 912 | void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func) |
| 913 | { | 913 | { |
| @@ -959,7 +959,7 @@ inline void MicroProfileThreadJoin(MicroProfileThread* pThread) | |||
| 959 | #define MP_INVALID_SOCKET(f) (f == INVALID_SOCKET) | 959 | #define MP_INVALID_SOCKET(f) (f == INVALID_SOCKET) |
| 960 | #endif | 960 | #endif |
| 961 | 961 | ||
| 962 | #if defined(__APPLE__) | 962 | #ifndef _WIN32 |
| 963 | #include <sys/socket.h> | 963 | #include <sys/socket.h> |
| 964 | #include <netinet/in.h> | 964 | #include <netinet/in.h> |
| 965 | #include <fcntl.h> | 965 | #include <fcntl.h> |
diff --git a/externals/microprofile/microprofileui.h b/externals/microprofile/microprofileui.h index 45bec8af6..66a73abc5 100644 --- a/externals/microprofile/microprofileui.h +++ b/externals/microprofile/microprofileui.h | |||
| @@ -172,6 +172,7 @@ MICROPROFILEUI_API void MicroProfileCustomGroupAddTimer(const char* pCustomName, | |||
| 172 | #ifdef _WIN32 | 172 | #ifdef _WIN32 |
| 173 | #define snprintf _snprintf | 173 | #define snprintf _snprintf |
| 174 | #endif | 174 | #endif |
| 175 | #include <stdio.h> | ||
| 175 | #include <stdlib.h> | 176 | #include <stdlib.h> |
| 176 | #include <stdarg.h> | 177 | #include <stdarg.h> |
| 177 | #include <math.h> | 178 | #include <math.h> |
diff --git a/hooks/pre-commit b/hooks/pre-commit index ec2b5b77e..04fdaf8ec 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Enforce citra's whitespace policy | 3 | # Enforce citra's whitespace policy |
| 4 | git config --local core.whitespace tab-in-indent,trailing-space | 4 | git config --local core.whitespace tab-in-indent,trailing-space |
| @@ -32,7 +32,7 @@ for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do | |||
| 32 | if ! echo "$f" | egrep -q "^src/"; then | 32 | if ! echo "$f" | egrep -q "^src/"; then |
| 33 | continue | 33 | continue |
| 34 | fi | 34 | fi |
| 35 | d=$(diff -u "$f" <(clang-format "$f")) | 35 | d=$(clang-format "$f" | diff -u "$f" -) |
| 36 | if ! [ -z "$d" ]; then | 36 | if ! [ -z "$d" ]; then |
| 37 | echo "!!! $f not compliant to coding style, here is the fix:" | 37 | echo "!!! $f not compliant to coding style, here is the fix:" |
| 38 | echo "$d" | 38 | echo "$d" |
| @@ -40,4 +40,4 @@ for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do | |||
| 40 | fi | 40 | fi |
| 41 | done | 41 | done |
| 42 | 42 | ||
| 43 | exit "$fail" | 43 | exit "${fail-0}" |
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 43fa06b4e..f9c488a1a 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt | |||
| @@ -23,7 +23,7 @@ if (MSVC) | |||
| 23 | endif() | 23 | endif() |
| 24 | target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads) | 24 | target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads) |
| 25 | 25 | ||
| 26 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | 26 | if(UNIX AND NOT APPLE) |
| 27 | install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | 27 | install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |
| 28 | endif() | 28 | endif() |
| 29 | 29 | ||
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index b3c01ddd8..384875450 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -104,7 +104,7 @@ target_link_libraries(citra-qt core video_core audio_core common qhexedit) | |||
| 104 | target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) | 104 | target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) |
| 105 | target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads) | 105 | target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads) |
| 106 | 106 | ||
| 107 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | 107 | if(UNIX AND NOT APPLE) |
| 108 | install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | 108 | install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |
| 109 | endif() | 109 | endif() |
| 110 | 110 | ||
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 14cbcac6b..407ed047a 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -23,8 +23,8 @@ | |||
| 23 | #define fseeko _fseeki64 | 23 | #define fseeko _fseeki64 |
| 24 | #define ftello _ftelli64 | 24 | #define ftello _ftelli64 |
| 25 | #define atoll _atoi64 | 25 | #define atoll _atoi64 |
| 26 | #define stat64 _stat64 | 26 | #define stat _stat64 |
| 27 | #define fstat64 _fstat64 | 27 | #define fstat _fstat64 |
| 28 | #define fileno _fileno | 28 | #define fileno _fileno |
| 29 | #else | 29 | #else |
| 30 | #ifdef __APPLE__ | 30 | #ifdef __APPLE__ |
| @@ -52,11 +52,6 @@ | |||
| 52 | #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) | 52 | #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) |
| 53 | #endif | 53 | #endif |
| 54 | 54 | ||
| 55 | #ifdef BSD4_4 | ||
| 56 | #define stat64 stat | ||
| 57 | #define fstat64 fstat | ||
| 58 | #endif | ||
| 59 | |||
| 60 | // This namespace has various generic functions related to files and paths. | 55 | // This namespace has various generic functions related to files and paths. |
| 61 | // The code still needs a ton of cleanup. | 56 | // The code still needs a ton of cleanup. |
| 62 | // REMEMBER: strdup considered harmful! | 57 | // REMEMBER: strdup considered harmful! |
| @@ -76,7 +71,7 @@ static void StripTailDirSlashes(std::string& fname) { | |||
| 76 | 71 | ||
| 77 | // Returns true if file filename exists | 72 | // Returns true if file filename exists |
| 78 | bool Exists(const std::string& filename) { | 73 | bool Exists(const std::string& filename) { |
| 79 | struct stat64 file_info; | 74 | struct stat file_info; |
| 80 | 75 | ||
| 81 | std::string copy(filename); | 76 | std::string copy(filename); |
| 82 | StripTailDirSlashes(copy); | 77 | StripTailDirSlashes(copy); |
| @@ -88,7 +83,7 @@ bool Exists(const std::string& filename) { | |||
| 88 | 83 | ||
| 89 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); | 84 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); |
| 90 | #else | 85 | #else |
| 91 | int result = stat64(copy.c_str(), &file_info); | 86 | int result = stat(copy.c_str(), &file_info); |
| 92 | #endif | 87 | #endif |
| 93 | 88 | ||
| 94 | return (result == 0); | 89 | return (result == 0); |
| @@ -96,7 +91,7 @@ bool Exists(const std::string& filename) { | |||
| 96 | 91 | ||
| 97 | // Returns true if filename is a directory | 92 | // Returns true if filename is a directory |
| 98 | bool IsDirectory(const std::string& filename) { | 93 | bool IsDirectory(const std::string& filename) { |
| 99 | struct stat64 file_info; | 94 | struct stat file_info; |
| 100 | 95 | ||
| 101 | std::string copy(filename); | 96 | std::string copy(filename); |
| 102 | StripTailDirSlashes(copy); | 97 | StripTailDirSlashes(copy); |
| @@ -108,7 +103,7 @@ bool IsDirectory(const std::string& filename) { | |||
| 108 | 103 | ||
| 109 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); | 104 | int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info); |
| 110 | #else | 105 | #else |
| 111 | int result = stat64(copy.c_str(), &file_info); | 106 | int result = stat(copy.c_str(), &file_info); |
| 112 | #endif | 107 | #endif |
| 113 | 108 | ||
| 114 | if (result < 0) { | 109 | if (result < 0) { |
| @@ -339,11 +334,11 @@ u64 GetSize(const std::string& filename) { | |||
| 339 | return 0; | 334 | return 0; |
| 340 | } | 335 | } |
| 341 | 336 | ||
| 342 | struct stat64 buf; | 337 | struct stat buf; |
| 343 | #ifdef _WIN32 | 338 | #ifdef _WIN32 |
| 344 | if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0) | 339 | if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0) |
| 345 | #else | 340 | #else |
| 346 | if (stat64(filename.c_str(), &buf) == 0) | 341 | if (stat(filename.c_str(), &buf) == 0) |
| 347 | #endif | 342 | #endif |
| 348 | { | 343 | { |
| 349 | LOG_TRACE(Common_Filesystem, "%s: %lld", filename.c_str(), (long long)buf.st_size); | 344 | LOG_TRACE(Common_Filesystem, "%s: %lld", filename.c_str(), (long long)buf.st_size); |
| @@ -356,8 +351,8 @@ u64 GetSize(const std::string& filename) { | |||
| 356 | 351 | ||
| 357 | // Overloaded GetSize, accepts file descriptor | 352 | // Overloaded GetSize, accepts file descriptor |
| 358 | u64 GetSize(const int fd) { | 353 | u64 GetSize(const int fd) { |
| 359 | struct stat64 buf; | 354 | struct stat buf; |
| 360 | if (fstat64(fd, &buf) != 0) { | 355 | if (fstat(fd, &buf) != 0) { |
| 361 | LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s", fd, GetLastErrorMsg()); | 356 | LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s", fd, GetLastErrorMsg()); |
| 362 | return 0; | 357 | return 0; |
| 363 | } | 358 | } |
diff --git a/src/common/swap.h b/src/common/swap.h index e241c9f73..d94cbe6b2 100644 --- a/src/common/swap.h +++ b/src/common/swap.h | |||
| @@ -21,7 +21,8 @@ | |||
| 21 | #include <cstdlib> | 21 | #include <cstdlib> |
| 22 | #elif defined(__linux__) | 22 | #elif defined(__linux__) |
| 23 | #include <byteswap.h> | 23 | #include <byteswap.h> |
| 24 | #elif defined(__FreeBSD__) | 24 | #elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || \ |
| 25 | defined(__NetBSD__) || defined(__OpenBSD__) | ||
| 25 | #include <sys/endian.h> | 26 | #include <sys/endian.h> |
| 26 | #endif | 27 | #endif |
| 27 | #include <cstring> | 28 | #include <cstring> |
| @@ -101,7 +102,9 @@ inline __attribute__((always_inline)) u32 swap32(u32 _data) { | |||
| 101 | inline __attribute__((always_inline)) u64 swap64(u64 _data) { | 102 | inline __attribute__((always_inline)) u64 swap64(u64 _data) { |
| 102 | return __builtin_bswap64(_data); | 103 | return __builtin_bswap64(_data); |
| 103 | } | 104 | } |
| 104 | #elif __FreeBSD__ | 105 | #elif defined(__Bitrig__) || defined(__OpenBSD__) |
| 106 | // swap16, swap32, swap64 are left as is | ||
| 107 | #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) | ||
| 105 | inline u16 swap16(u16 _data) { | 108 | inline u16 swap16(u16 _data) { |
| 106 | return bswap16(_data); | 109 | return bswap16(_data); |
| 107 | } | 110 | } |
diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 6e7b39b9a..9bb2f4e1d 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #elif defined(_WIN32) | 8 | #elif defined(_WIN32) |
| 9 | #include <Windows.h> | 9 | #include <Windows.h> |
| 10 | #else | 10 | #else |
| 11 | #if defined(BSD4_4) || defined(__OpenBSD__) | 11 | #if defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
| 12 | #include <pthread_np.h> | 12 | #include <pthread_np.h> |
| 13 | #else | 13 | #else |
| 14 | #include <pthread.h> | 14 | #include <pthread.h> |
| @@ -19,6 +19,10 @@ | |||
| 19 | #include <unistd.h> | 19 | #include <unistd.h> |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | #ifdef __FreeBSD__ | ||
| 23 | #define cpu_set_t cpuset_t | ||
| 24 | #endif | ||
| 25 | |||
| 22 | namespace Common { | 26 | namespace Common { |
| 23 | 27 | ||
| 24 | int CurrentThreadId() { | 28 | int CurrentThreadId() { |
| @@ -86,7 +90,7 @@ void SetCurrentThreadName(const char* szThreadName) { | |||
| 86 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) { | 90 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) { |
| 87 | #ifdef __APPLE__ | 91 | #ifdef __APPLE__ |
| 88 | thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1); | 92 | thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1); |
| 89 | #elif (defined __linux__ || defined BSD4_4) && !(defined ANDROID) | 93 | #elif (defined __linux__ || defined __FreeBSD__) && !(defined ANDROID) |
| 90 | cpu_set_t cpu_set; | 94 | cpu_set_t cpu_set; |
| 91 | CPU_ZERO(&cpu_set); | 95 | CPU_ZERO(&cpu_set); |
| 92 | 96 | ||
| @@ -117,8 +121,10 @@ void SwitchCurrentThread() { | |||
| 117 | void SetCurrentThreadName(const char* szThreadName) { | 121 | void SetCurrentThreadName(const char* szThreadName) { |
| 118 | #ifdef __APPLE__ | 122 | #ifdef __APPLE__ |
| 119 | pthread_setname_np(szThreadName); | 123 | pthread_setname_np(szThreadName); |
| 120 | #elif defined(__OpenBSD__) | 124 | #elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
| 121 | pthread_set_name_np(pthread_self(), szThreadName); | 125 | pthread_set_name_np(pthread_self(), szThreadName); |
| 126 | #elif defined(__NetBSD__) | ||
| 127 | pthread_setname_np(pthread_self(), "%s", (void*)szThreadName); | ||
| 122 | #else | 128 | #else |
| 123 | pthread_setname_np(pthread_self(), szThreadName); | 129 | pthread_setname_np(pthread_self(), szThreadName); |
| 124 | #endif | 130 | #endif |
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp index 6ddf9b70c..370ae2c80 100644 --- a/src/common/x64/cpu_detect.cpp +++ b/src/common/x64/cpu_detect.cpp | |||
| @@ -12,13 +12,15 @@ namespace Common { | |||
| 12 | 12 | ||
| 13 | #ifndef _MSC_VER | 13 | #ifndef _MSC_VER |
| 14 | 14 | ||
| 15 | #ifdef __FreeBSD__ | 15 | #if defined(__DragonFly__) || defined(__FreeBSD__) |
| 16 | #include <machine/cpufunc.h> | 16 | // clang-format off |
| 17 | #include <sys/types.h> | 17 | #include <sys/types.h> |
| 18 | #include <machine/cpufunc.h> | ||
| 19 | // clang-format on | ||
| 18 | #endif | 20 | #endif |
| 19 | 21 | ||
| 20 | static inline void __cpuidex(int info[4], int function_id, int subfunction_id) { | 22 | static inline void __cpuidex(int info[4], int function_id, int subfunction_id) { |
| 21 | #ifdef __FreeBSD__ | 23 | #if defined(__DragonFly__) || defined(__FreeBSD__) |
| 22 | // Despite the name, this is just do_cpuid() with ECX as second input. | 24 | // Despite the name, this is just do_cpuid() with ECX as second input. |
| 23 | cpuid_count((u_int)function_id, (u_int)subfunction_id, (u_int*)info); | 25 | cpuid_count((u_int)function_id, (u_int)subfunction_id, (u_int*)info); |
| 24 | #else | 26 | #else |
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 4279b67fb..46b75db25 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp | |||
| @@ -104,7 +104,9 @@ static const std::unordered_map<int, int> error_map = {{ | |||
| 104 | {ERRNO(ENETUNREACH), 40}, | 104 | {ERRNO(ENETUNREACH), 40}, |
| 105 | {ENFILE, 41}, | 105 | {ENFILE, 41}, |
| 106 | {ERRNO(ENOBUFS), 42}, | 106 | {ERRNO(ENOBUFS), 42}, |
| 107 | #ifdef ENODATA | ||
| 107 | {ENODATA, 43}, | 108 | {ENODATA, 43}, |
| 109 | #endif | ||
| 108 | {ENODEV, 44}, | 110 | {ENODEV, 44}, |
| 109 | {ENOENT, 45}, | 111 | {ENOENT, 45}, |
| 110 | {ENOEXEC, 46}, | 112 | {ENOEXEC, 46}, |
| @@ -114,8 +116,12 @@ static const std::unordered_map<int, int> error_map = {{ | |||
| 114 | {ENOMSG, 50}, | 116 | {ENOMSG, 50}, |
| 115 | {ERRNO(ENOPROTOOPT), 51}, | 117 | {ERRNO(ENOPROTOOPT), 51}, |
| 116 | {ENOSPC, 52}, | 118 | {ENOSPC, 52}, |
| 119 | #ifdef ENOSR | ||
| 117 | {ENOSR, 53}, | 120 | {ENOSR, 53}, |
| 121 | #endif | ||
| 122 | #ifdef ENOSTR | ||
| 118 | {ENOSTR, 54}, | 123 | {ENOSTR, 54}, |
| 124 | #endif | ||
| 119 | {ENOSYS, 55}, | 125 | {ENOSYS, 55}, |
| 120 | {ERRNO(ENOTCONN), 56}, | 126 | {ERRNO(ENOTCONN), 56}, |
| 121 | {ENOTDIR, 57}, | 127 | {ENOTDIR, 57}, |
| @@ -136,7 +142,9 @@ static const std::unordered_map<int, int> error_map = {{ | |||
| 136 | {ESPIPE, 72}, | 142 | {ESPIPE, 72}, |
| 137 | {ESRCH, 73}, | 143 | {ESRCH, 73}, |
| 138 | {ERRNO(ESTALE), 74}, | 144 | {ERRNO(ESTALE), 74}, |
| 145 | #ifdef ETIME | ||
| 139 | {ETIME, 75}, | 146 | {ETIME, 75}, |
| 147 | #endif | ||
| 140 | {ERRNO(ETIMEDOUT), 76}, | 148 | {ERRNO(ETIMEDOUT), 76}, |
| 141 | }}; | 149 | }}; |
| 142 | 150 | ||