diff options
Diffstat (limited to 'src')
| -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/nwm_uds.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/service/soc_u.cpp | 8 |
8 files changed, 50 insertions, 25 deletions
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/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index 27e829209..80081aae2 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp | |||
| @@ -97,10 +97,21 @@ static void Initialize(Service::Interface* self) { | |||
| 97 | u32 value = cmd_buff[13]; | 97 | u32 value = cmd_buff[13]; |
| 98 | u32 handle = cmd_buff[14]; | 98 | u32 handle = cmd_buff[14]; |
| 99 | 99 | ||
| 100 | // Because NWM service is not implemented at all, we stub the Initialize function with an error | ||
| 101 | // code instead of success to prevent games from using the service and from causing more issues. | ||
| 102 | // The error code is from a real 3DS with wifi off, thus believed to be "network disabled". | ||
| 103 | /* | ||
| 100 | cmd_buff[1] = RESULT_SUCCESS.raw; | 104 | cmd_buff[1] = RESULT_SUCCESS.raw; |
| 101 | cmd_buff[2] = 0; | 105 | cmd_buff[2] = 0; |
| 102 | cmd_buff[3] = Kernel::g_handle_table.Create(handle_event) | 106 | cmd_buff[3] = Kernel::g_handle_table.Create(handle_event) |
| 103 | .MoveFrom(); // TODO(purpasmart): Verify if this is a event handle | 107 | .MoveFrom(); // TODO(purpasmart): Verify if this is a event handle |
| 108 | */ | ||
| 109 | cmd_buff[0] = IPC::MakeHeader(0x1B, 1, 2); | ||
| 110 | cmd_buff[1] = ResultCode(static_cast<ErrorDescription>(2), ErrorModule::UDS, | ||
| 111 | ErrorSummary::StatusChanged, ErrorLevel::Status) | ||
| 112 | .raw; | ||
| 113 | cmd_buff[2] = 0; | ||
| 114 | cmd_buff[3] = 0; | ||
| 104 | 115 | ||
| 105 | LOG_WARNING(Service_NWM, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, value=%u, handle=0x%08X", | 116 | LOG_WARNING(Service_NWM, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, value=%u, handle=0x%08X", |
| 106 | unk1, unk2, value, handle); | 117 | unk1, unk2, value, handle); |
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 | ||