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 | 8 | ||||
| -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 | 4 |
9 files changed, 42 insertions, 22 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index f2add394f..c4cbf9fea 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt | |||
| @@ -19,12 +19,15 @@ endif() | |||
| 19 | 19 | ||
| 20 | add_executable(citra ${SRCS} ${HEADERS}) | 20 | add_executable(citra ${SRCS} ${HEADERS}) |
| 21 | target_link_libraries(citra core common video_core) | 21 | target_link_libraries(citra core common video_core) |
| 22 | target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih) | 22 | target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih) |
| 23 | 23 | ||
| 24 | if (APPLE) | 24 | if (APPLE) |
| 25 | target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY}) | 25 | target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY}) |
| 26 | elseif (WIN32) | 26 | elseif (WIN32) |
| 27 | target_link_libraries(citra winmm) | 27 | target_link_libraries(citra winmm) |
| 28 | if (MINGW) | ||
| 29 | target_link_libraries(citra iconv) | ||
| 30 | endif() | ||
| 28 | else() # Unix | 31 | else() # Unix |
| 29 | target_link_libraries(citra pthread rt) | 32 | target_link_libraries(citra pthread rt) |
| 30 | target_link_libraries(citra ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB}) | 33 | target_link_libraries(citra ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB}) |
diff --git a/src/common/common.h b/src/common/common.h index 9f3016d34..0d7934622 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 d84ec4c42..ddf3958cc 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -28,7 +28,7 @@ template<> struct CompileTimeAssert<true> {}; | |||
| 28 | 28 | ||
| 29 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) | 29 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) |
| 30 | 30 | ||
| 31 | #ifndef _WIN32 | 31 | #ifndef _MSC_VER |
| 32 | 32 | ||
| 33 | #include <errno.h> | 33 | #include <errno.h> |
| 34 | #ifdef __linux__ | 34 | #ifdef __linux__ |
| @@ -72,7 +72,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){ | |||
| 72 | return (x >> n) | (x << (64 - n)); | 72 | return (x >> n) | (x << (64 - n)); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | #else // WIN32 | 75 | #else // _MSC_VER |
| 76 | // Function Cross-Compatibility | 76 | // Function Cross-Compatibility |
| 77 | #define strcasecmp _stricmp | 77 | #define strcasecmp _stricmp |
| 78 | #define strncasecmp _strnicmp | 78 | #define strncasecmp _strnicmp |
| @@ -135,7 +135,7 @@ extern "C" { | |||
| 135 | } | 135 | } |
| 136 | #define Crash() {DebugBreak();} | 136 | #define Crash() {DebugBreak();} |
| 137 | #endif // M_IX86 | 137 | #endif // M_IX86 |
| 138 | #endif // WIN32 ndef | 138 | #endif // _MSC_VER ndef |
| 139 | 139 | ||
| 140 | // Dolphin's min and max functions | 140 | // Dolphin's min and max functions |
| 141 | #undef min | 141 | #undef min |
| @@ -163,7 +163,7 @@ inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) | | |||
| 163 | #undef swap64 | 163 | #undef swap64 |
| 164 | #endif | 164 | #endif |
| 165 | 165 | ||
| 166 | #ifdef _WIN32 | 166 | #ifdef _MSC_VER |
| 167 | inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);} | 167 | inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);} |
| 168 | inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} | 168 | inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} |
| 169 | inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} | 169 | inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} |
diff --git a/src/common/log.h b/src/common/log.h index 14ad98c08..4c96ef0a6 100644 --- a/src/common/log.h +++ b/src/common/log.h | |||
| @@ -104,7 +104,7 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int | |||
| 104 | #endif // loglevel | 104 | #endif // loglevel |
| 105 | #endif // logging | 105 | #endif // logging |
| 106 | 106 | ||
| 107 | #ifdef _WIN32 | 107 | #ifdef MSVC_VER |
| 108 | #ifndef __func__ | 108 | #ifndef __func__ |
| 109 | #define __func__ __FUNCTION__ | 109 | #define __func__ __FUNCTION__ |
| 110 | #endif | 110 | #endif |
| @@ -149,17 +149,17 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int | |||
| 149 | #define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) | 149 | #define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) |
| 150 | 150 | ||
| 151 | #ifndef GEKKO | 151 | #ifndef GEKKO |
| 152 | #ifdef _WIN32 | 152 | #ifdef MSVC_VER |
| 153 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ | 153 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ |
| 154 | if (!(_a_)) {\ | 154 | if (!(_a_)) {\ |
| 155 | if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \ | 155 | if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \ |
| 156 | } | 156 | } |
| 157 | #else // not win32 | 157 | #else // not msvc |
| 158 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ | 158 | #define _assert_msg_(_t_, _a_, _fmt_, ...) \ |
| 159 | if (!(_a_)) {\ | 159 | if (!(_a_)) {\ |
| 160 | if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \ | 160 | if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \ |
| 161 | } | 161 | } |
| 162 | #endif // WIN32 | 162 | #endif // MSVC_VER |
| 163 | #else // GEKKO | 163 | #else // GEKKO |
| 164 | #define _assert_msg_(_t_, _a_, _fmt_, ...) | 164 | #define _assert_msg_(_t_, _a_, _fmt_, ...) |
| 165 | #endif | 165 | #endif |
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h index 9bfdf950e..a1db89aa3 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 d9f095433..7d123caa0 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 NULL; | 83 | return NULL; |
| 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 dcec9275f..1ca2dfb39 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 dc153ba71..6eeda0828 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 f899e2e8a..0a5c7ee6e 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -34,6 +34,10 @@ | |||
| 34 | 34 | ||
| 35 | using namespace std; | 35 | using namespace std; |
| 36 | 36 | ||
| 37 | #ifdef _WIN32 | ||
| 38 | #undef __WIN32__ | ||
| 39 | #endif | ||
| 40 | |||
| 37 | #include "core/arm/skyeye_common/armdefs.h" | 41 | #include "core/arm/skyeye_common/armdefs.h" |
| 38 | #include "core/arm/skyeye_common/armmmu.h" | 42 | #include "core/arm/skyeye_common/armmmu.h" |
| 39 | #include "arm_dyncom_thumb.h" | 43 | #include "arm_dyncom_thumb.h" |