summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-12-31 05:54:02 +0100
committerbunnei <bunneidev@gmail.com>2014-12-31 05:54:02 +0100
commit29da5da9513c0faae0880d2fced18f80ef89923b (patch)
tree9a652fd606e57f322ca07e1468ea3ae83addf6a2
parentMerge pull request #372 from lioncash/warn (diff)
parentFix MSVC-related #defines and add CMakeLists comment (diff)
downloadyuzu-29da5da9513c0faae0880d2fced18f80ef89923b.tar
yuzu-29da5da9513c0faae0880d2fced18f80ef89923b.tar.gz
yuzu-29da5da9513c0faae0880d2fced18f80ef89923b.tar.bz2
yuzu-29da5da9513c0faae0880d2fced18f80ef89923b.tar.lz
yuzu-29da5da9513c0faae0880d2fced18f80ef89923b.tar.xz
yuzu-29da5da9513c0faae0880d2fced18f80ef89923b.tar.zst
yuzu-29da5da9513c0faae0880d2fced18f80ef89923b.zip
-rw-r--r--src/citra/CMakeLists.txt5
-rw-r--r--src/common/common.h4
-rw-r--r--src/common/common_funcs.h8
-rw-r--r--src/common/log.h12
-rw-r--r--src/common/msg_handler.h2
-rw-r--r--src/common/platform.h4
-rw-r--r--src/common/string_util.cpp6
-rw-r--r--src/common/thread.cpp23
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp8
9 files changed, 50 insertions, 22 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index b06259f5e..dc5e04bfc 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -14,7 +14,7 @@ create_directory_groups(${SRCS} ${HEADERS})
add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra core common video_core)
-target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih)
+target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
if (UNIX)
target_link_libraries(citra -pthread)
@@ -24,6 +24,9 @@ if (APPLE)
target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY})
elseif (WIN32)
target_link_libraries(citra winmm)
+ if (MINGW) # GCC does not support codecvt, so use iconv instead
+ target_link_libraries(citra iconv)
+ endif()
else() # Unix
target_link_libraries(citra rt)
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:
#elif defined _WIN32
// Check MSC ver
- #if !defined _MSC_VER || _MSC_VER <= 1000
+ #if defined _MSC_VER && _MSC_VER <= 1000
#error needs at least version 1000 of MSC
#endif
+ #ifndef NOMINMAX
#define NOMINMAX
+ #endif
// Memory leak checks
#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> {};
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#ifndef _WIN32
+#ifndef _MSC_VER
#include <errno.h>
#ifdef __linux__
@@ -75,7 +75,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
return (x >> n) | (x << (64 - n));
}
-#else // WIN32
+#else // _MSC_VER
#include <locale.h>
// Function Cross-Compatibility
@@ -140,7 +140,7 @@ extern "C" {
}
#define Crash() {DebugBreak();}
#endif // M_IX86
-#endif // WIN32 ndef
+#endif // _MSC_VER ndef
// Dolphin's min and max functions
#undef min
@@ -168,7 +168,7 @@ inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) |
#undef swap64
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
diff --git a/src/common/log.h b/src/common/log.h
index 96d97249f..667f2fbb9 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -8,7 +8,7 @@
#include "common/msg_handler.h"
#include "common/logging/log.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#ifndef __func__
#define __func__ __FUNCTION__
#endif
@@ -39,14 +39,18 @@
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
-#ifdef _WIN32
+#ifndef GEKKO
+#ifdef _MSC_VER
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
}
-#else // not win32
+#else // not msvc
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
}
-#endif // WIN32
+#endif // _WIN32
+#else // GEKKO
+#define _assert_msg_(_t_, _a_, _fmt_, ...)
+#endif \ No newline at end of file
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h
index 7bb216e98..5a483ddb4 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, ...)
void SetEnableAlert(bool enable);
#ifndef GEKKO
-#ifdef _WIN32
+#ifdef _MSC_VER
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
diff --git a/src/common/platform.h b/src/common/platform.h
index 53d98fe74..ce9cfd4a2 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -71,14 +71,18 @@
#include <time.h>
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
#define EMU_FASTCALL __fastcall
+#ifdef _MSC_VER
inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
if (localtime_s(result, clock) == 0)
return result;
return nullptr;
}
+#endif
#else
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index d919b7a4c..b3b772bd9 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -7,7 +7,7 @@
#include "common/common.h"
#include "common/string_util.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#include <Windows.h>
#include <codecvt>
#else
@@ -45,7 +45,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar
{
int writtenCount;
-#ifdef _WIN32
+#ifdef _MSC_VER
// You would think *printf are simple, right? Iterate on each character,
// if it's a format specifier handle it properly, etc.
//
@@ -410,7 +410,7 @@ std::string UriEncode(const std::string & sSrc)
return sResult;
}
-#ifdef _WIN32
+#ifdef _MSC_VER
std::string UTF16ToUTF8(const std::u16string& input)
{
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index 8c83d67b5..8bf005857 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -17,7 +17,7 @@ namespace Common
int CurrentThreadId()
{
-#ifdef _WIN32
+#ifdef _MSC_VER
return GetCurrentThreadId();
#elif defined __APPLE__
return mach_thread_self();
@@ -27,6 +27,14 @@ int CurrentThreadId()
}
#ifdef _WIN32
+// Supporting functions
+void SleepCurrentThread(int ms)
+{
+ Sleep(ms);
+}
+#endif
+
+#ifdef _MSC_VER
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
{
@@ -38,12 +46,6 @@ void SetCurrentThreadAffinity(u32 mask)
SetThreadAffinityMask(GetCurrentThread(), mask);
}
-// Supporting functions
-void SleepCurrentThread(int ms)
-{
- Sleep(ms);
-}
-
void SwitchCurrentThread()
{
SwitchToThread();
@@ -82,7 +84,7 @@ void SetCurrentThreadName(const char* szThreadName)
{}
}
-#else // !WIN32, so must be POSIX threads
+#else // !MSVC_VER, so must be POSIX threads
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
{
@@ -106,6 +108,7 @@ void SetCurrentThreadAffinity(u32 mask)
SetThreadAffinity(pthread_self(), mask);
}
+#ifndef _WIN32
void SleepCurrentThread(int ms)
{
usleep(1000 * ms);
@@ -115,7 +118,10 @@ void SwitchCurrentThread()
{
usleep(1000 * 1);
}
+#endif
+// MinGW with the POSIX threading model does not support pthread_setname_np
+#if !defined(_WIN32) || defined(_MSC_VER)
void SetCurrentThreadName(const char* szThreadName)
{
#ifdef __APPLE__
@@ -126,6 +132,7 @@ void SetCurrentThreadName(const char* szThreadName)
pthread_setname_np(pthread_self(), szThreadName);
#endif
}
+#endif
#endif
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index cecb81237..ce316ead6 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -13,6 +13,14 @@
using namespace std;
+// __WIN32__ was never defined on MSVC, but it is on MinGW,
+// so we need to remove it.
+// #ifdefs to __WIN32__ are dead code and will not even compile
+// anymore, due to bank_defs.h missing.
+#ifdef _WIN32
+#undef __WIN32__
+#endif
+
#include "core/arm/skyeye_common/armdefs.h"
#include "core/arm/skyeye_common/armmmu.h"
#include "arm_dyncom_thumb.h"