diff options
| -rw-r--r-- | src/citra/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/common/common.h | 4 | ||||
| -rw-r--r-- | src/common/common_funcs.h | 8 | ||||
| -rw-r--r-- | src/common/log.h | 10 | ||||
| -rw-r--r-- | src/common/msg_handler.h | 2 | ||||
| -rw-r--r-- | src/common/platform.h | 4 | ||||
| -rw-r--r-- | src/common/string_util.cpp | 6 | ||||
| -rw-r--r-- | src/common/thread.cpp | 23 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 8 |
9 files changed, 49 insertions, 21 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index b06259f5e..0e03212d7 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt | |||
| @@ -14,7 +14,7 @@ create_directory_groups(${SRCS} ${HEADERS}) | |||
| 14 | 14 | ||
| 15 | add_executable(citra ${SRCS} ${HEADERS}) | 15 | add_executable(citra ${SRCS} ${HEADERS}) |
| 16 | target_link_libraries(citra core common video_core) | 16 | target_link_libraries(citra core common video_core) |
| 17 | target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih) | 17 | target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih) |
| 18 | 18 | ||
| 19 | if (UNIX) | 19 | if (UNIX) |
| 20 | target_link_libraries(citra -pthread) | 20 | target_link_libraries(citra -pthread) |
| @@ -24,6 +24,9 @@ if (APPLE) | |||
| 24 | target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY}) | 24 | target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY}) |
| 25 | elseif (WIN32) | 25 | elseif (WIN32) |
| 26 | target_link_libraries(citra winmm) | 26 | target_link_libraries(citra winmm) |
| 27 | if (MINGW) | ||
| 28 | target_link_libraries(citra iconv) | ||
| 29 | endif() | ||
| 27 | else() # Unix | 30 | else() # Unix |
| 28 | target_link_libraries(citra rt) | 31 | target_link_libraries(citra rt) |
| 29 | endif() | 32 | endif() |
diff --git a/src/common/common.h b/src/common/common.h index 66f0ccd0c..ba33373ae 100644 --- a/src/common/common.h +++ b/src/common/common.h | |||
| @@ -50,11 +50,13 @@ private: | |||
| 50 | #elif defined _WIN32 | 50 | #elif defined _WIN32 |
| 51 | 51 | ||
| 52 | // Check MSC ver | 52 | // Check MSC ver |
| 53 | #if !defined _MSC_VER || _MSC_VER <= 1000 | 53 | #if defined _MSC_VER && _MSC_VER <= 1000 |
| 54 | #error needs at least version 1000 of MSC | 54 | #error needs at least version 1000 of MSC |
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | #ifndef NOMINMAX | ||
| 57 | #define NOMINMAX | 58 | #define NOMINMAX |
| 59 | #endif | ||
| 58 | 60 | ||
| 59 | // Memory leak checks | 61 | // Memory leak checks |
| 60 | #define CHECK_HEAP_INTEGRITY() | 62 | #define CHECK_HEAP_INTEGRITY() |
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index ca7abbea6..c2750a63c 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -31,7 +31,7 @@ template<> struct CompileTimeAssert<true> {}; | |||
| 31 | 31 | ||
| 32 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) | 32 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) |
| 33 | 33 | ||
| 34 | #ifndef _WIN32 | 34 | #ifndef _MSC_VER |
| 35 | 35 | ||
| 36 | #include <errno.h> | 36 | #include <errno.h> |
| 37 | #ifdef __linux__ | 37 | #ifdef __linux__ |
| @@ -75,7 +75,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){ | |||
| 75 | return (x >> n) | (x << (64 - n)); | 75 | return (x >> n) | (x << (64 - n)); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | #else // WIN32 | 78 | #else // _MSC_VER |
| 79 | #include <locale.h> | 79 | #include <locale.h> |
| 80 | 80 | ||
| 81 | // Function Cross-Compatibility | 81 | // Function Cross-Compatibility |
| @@ -140,7 +140,7 @@ extern "C" { | |||
| 140 | } | 140 | } |
| 141 | #define Crash() {DebugBreak();} | 141 | #define Crash() {DebugBreak();} |
| 142 | #endif // M_IX86 | 142 | #endif // M_IX86 |
| 143 | #endif // WIN32 ndef | 143 | #endif // _MSC_VER ndef |
| 144 | 144 | ||
| 145 | // Dolphin's min and max functions | 145 | // Dolphin's min and max functions |
| 146 | #undef min | 146 | #undef min |
| @@ -168,7 +168,7 @@ inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) | | |||
| 168 | #undef swap64 | 168 | #undef swap64 |
| 169 | #endif | 169 | #endif |
| 170 | 170 | ||
| 171 | #ifdef _WIN32 | 171 | #ifdef _MSC_VER |
| 172 | inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);} | 172 | inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);} |
| 173 | inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} | 173 | inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} |
| 174 | inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} | 174 | inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} |
diff --git a/src/common/log.h b/src/common/log.h index 96d97249f..c6a023552 100644 --- a/src/common/log.h +++ b/src/common/log.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "common/msg_handler.h" | 8 | #include "common/msg_handler.h" |
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | 10 | ||
| 11 | #ifdef _WIN32 | 11 | #ifdef MSVC_VER |
| 12 | #ifndef __func__ | 12 | #ifndef __func__ |
| 13 | #define __func__ __FUNCTION__ | 13 | #define __func__ __FUNCTION__ |
| 14 | #endif | 14 | #endif |
| @@ -39,14 +39,18 @@ | |||
| 39 | 39 | ||
| 40 | #define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) | 40 | #define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) |
| 41 | 41 | ||
| 42 | #ifndef GEKKO | ||
| 42 | #ifdef _WIN32 | 43 | #ifdef _WIN32 |
| 43 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ | 44 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ |
| 44 | if (!(_a_)) {\ | 45 | if (!(_a_)) {\ |
| 45 | if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \ | 46 | if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \ |
| 46 | } | 47 | } |
| 47 | #else // not win32 | 48 | #else // not msvc |
| 48 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ | 49 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ |
| 49 | if (!(_a_)) {\ | 50 | if (!(_a_)) {\ |
| 50 | if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \ | 51 | if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \ |
| 51 | } | 52 | } |
| 52 | #endif // WIN32 | 53 | #endif // _WIN32 |
| 54 | #else // GEKKO | ||
| 55 | #define _assert_msg_(_t_, _a_, _fmt_, ...) | ||
| 56 | #endif \ No newline at end of file | ||
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h index 7bb216e98..b4f380782 100644 --- a/src/common/msg_handler.h +++ b/src/common/msg_handler.h | |||
| @@ -30,7 +30,7 @@ extern bool MsgAlert(bool yes_no, int Style, const char* format, ...) | |||
| 30 | void SetEnableAlert(bool enable); | 30 | void SetEnableAlert(bool enable); |
| 31 | 31 | ||
| 32 | #ifndef GEKKO | 32 | #ifndef GEKKO |
| 33 | #ifdef _WIN32 | 33 | #ifdef MSVC_VER |
| 34 | #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) | 34 | #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) |
| 35 | #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) | 35 | #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) |
| 36 | #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) | 36 | #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) |
diff --git a/src/common/platform.h b/src/common/platform.h index 53d98fe74..ce5550520 100644 --- a/src/common/platform.h +++ b/src/common/platform.h | |||
| @@ -71,14 +71,18 @@ | |||
| 71 | 71 | ||
| 72 | #include <time.h> | 72 | #include <time.h> |
| 73 | 73 | ||
| 74 | #ifndef NOMINMAX | ||
| 74 | #define NOMINMAX | 75 | #define NOMINMAX |
| 76 | #endif | ||
| 75 | #define EMU_FASTCALL __fastcall | 77 | #define EMU_FASTCALL __fastcall |
| 76 | 78 | ||
| 79 | #ifdef _MSVC_VER | ||
| 77 | inline struct tm* localtime_r(const time_t *clock, struct tm *result) { | 80 | inline struct tm* localtime_r(const time_t *clock, struct tm *result) { |
| 78 | if (localtime_s(result, clock) == 0) | 81 | if (localtime_s(result, clock) == 0) |
| 79 | return result; | 82 | return result; |
| 80 | return nullptr; | 83 | return nullptr; |
| 81 | } | 84 | } |
| 85 | #endif | ||
| 82 | 86 | ||
| 83 | #else | 87 | #else |
| 84 | 88 | ||
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index d919b7a4c..0dd2d2349 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "common/common.h" | 7 | #include "common/common.h" |
| 8 | #include "common/string_util.h" | 8 | #include "common/string_util.h" |
| 9 | 9 | ||
| 10 | #ifdef _WIN32 | 10 | #ifdef MSVC_VER |
| 11 | #include <Windows.h> | 11 | #include <Windows.h> |
| 12 | #include <codecvt> | 12 | #include <codecvt> |
| 13 | #else | 13 | #else |
| @@ -45,7 +45,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar | |||
| 45 | { | 45 | { |
| 46 | int writtenCount; | 46 | int writtenCount; |
| 47 | 47 | ||
| 48 | #ifdef _WIN32 | 48 | #ifdef MSVC_VER |
| 49 | // You would think *printf are simple, right? Iterate on each character, | 49 | // You would think *printf are simple, right? Iterate on each character, |
| 50 | // if it's a format specifier handle it properly, etc. | 50 | // if it's a format specifier handle it properly, etc. |
| 51 | // | 51 | // |
| @@ -410,7 +410,7 @@ std::string UriEncode(const std::string & sSrc) | |||
| 410 | return sResult; | 410 | return sResult; |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | #ifdef _WIN32 | 413 | #ifdef MSVC_VER |
| 414 | 414 | ||
| 415 | std::string UTF16ToUTF8(const std::u16string& input) | 415 | std::string UTF16ToUTF8(const std::u16string& input) |
| 416 | { | 416 | { |
diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 8c83d67b5..04e33101b 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp | |||
| @@ -17,7 +17,7 @@ namespace Common | |||
| 17 | 17 | ||
| 18 | int CurrentThreadId() | 18 | int CurrentThreadId() |
| 19 | { | 19 | { |
| 20 | #ifdef _WIN32 | 20 | #ifdef MSVC_VER |
| 21 | return GetCurrentThreadId(); | 21 | return GetCurrentThreadId(); |
| 22 | #elif defined __APPLE__ | 22 | #elif defined __APPLE__ |
| 23 | return mach_thread_self(); | 23 | return mach_thread_self(); |
| @@ -27,6 +27,14 @@ int CurrentThreadId() | |||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | #ifdef _WIN32 | 29 | #ifdef _WIN32 |
| 30 | // Supporting functions | ||
| 31 | void SleepCurrentThread(int ms) | ||
| 32 | { | ||
| 33 | Sleep(ms); | ||
| 34 | } | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #ifdef MSVC_VER | ||
| 30 | 38 | ||
| 31 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) | 39 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) |
| 32 | { | 40 | { |
| @@ -38,12 +46,6 @@ void SetCurrentThreadAffinity(u32 mask) | |||
| 38 | SetThreadAffinityMask(GetCurrentThread(), mask); | 46 | SetThreadAffinityMask(GetCurrentThread(), mask); |
| 39 | } | 47 | } |
| 40 | 48 | ||
| 41 | // Supporting functions | ||
| 42 | void SleepCurrentThread(int ms) | ||
| 43 | { | ||
| 44 | Sleep(ms); | ||
| 45 | } | ||
| 46 | |||
| 47 | void SwitchCurrentThread() | 49 | void SwitchCurrentThread() |
| 48 | { | 50 | { |
| 49 | SwitchToThread(); | 51 | SwitchToThread(); |
| @@ -82,7 +84,7 @@ void SetCurrentThreadName(const char* szThreadName) | |||
| 82 | {} | 84 | {} |
| 83 | } | 85 | } |
| 84 | 86 | ||
| 85 | #else // !WIN32, so must be POSIX threads | 87 | #else // !MSVC_VER, so must be POSIX threads |
| 86 | 88 | ||
| 87 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) | 89 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) |
| 88 | { | 90 | { |
| @@ -106,6 +108,7 @@ void SetCurrentThreadAffinity(u32 mask) | |||
| 106 | SetThreadAffinity(pthread_self(), mask); | 108 | SetThreadAffinity(pthread_self(), mask); |
| 107 | } | 109 | } |
| 108 | 110 | ||
| 111 | #ifndef _WIN32 | ||
| 109 | void SleepCurrentThread(int ms) | 112 | void SleepCurrentThread(int ms) |
| 110 | { | 113 | { |
| 111 | usleep(1000 * ms); | 114 | usleep(1000 * ms); |
| @@ -115,7 +118,10 @@ void SwitchCurrentThread() | |||
| 115 | { | 118 | { |
| 116 | usleep(1000 * 1); | 119 | usleep(1000 * 1); |
| 117 | } | 120 | } |
| 121 | #endif | ||
| 118 | 122 | ||
| 123 | // MinGW with the POSIX threading model does not support pthread_setname_np | ||
| 124 | #if !defined(_WIN32) || defined(MSVC_VER) | ||
| 119 | void SetCurrentThreadName(const char* szThreadName) | 125 | void SetCurrentThreadName(const char* szThreadName) |
| 120 | { | 126 | { |
| 121 | #ifdef __APPLE__ | 127 | #ifdef __APPLE__ |
| @@ -126,6 +132,7 @@ void SetCurrentThreadName(const char* szThreadName) | |||
| 126 | pthread_setname_np(pthread_self(), szThreadName); | 132 | pthread_setname_np(pthread_self(), szThreadName); |
| 127 | #endif | 133 | #endif |
| 128 | } | 134 | } |
| 135 | #endif | ||
| 129 | 136 | ||
| 130 | #endif | 137 | #endif |
| 131 | 138 | ||
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index a66560af2..53da7ca9c 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -13,6 +13,14 @@ | |||
| 13 | 13 | ||
| 14 | using namespace std; | 14 | using namespace std; |
| 15 | 15 | ||
| 16 | // __WIN32__ was never defined on MSVC, but it is on MinGW, | ||
| 17 | // so we need to remove it. | ||
| 18 | // #ifdefs to __WIN32__ are dead code and will not even compile | ||
| 19 | // anymore, due to bank_defs.h missing. | ||
| 20 | #ifdef _WIN32 | ||
| 21 | #undef __WIN32__ | ||
| 22 | #endif | ||
| 23 | |||
| 16 | #include "core/arm/skyeye_common/armdefs.h" | 24 | #include "core/arm/skyeye_common/armdefs.h" |
| 17 | #include "core/arm/skyeye_common/armmmu.h" | 25 | #include "core/arm/skyeye_common/armmmu.h" |
| 18 | #include "arm_dyncom_thumb.h" | 26 | #include "arm_dyncom_thumb.h" |