From a9bf8e7b1823245772b17c79f2c60dd31603338f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 29 Aug 2017 22:41:50 +0200 Subject: [PATCH] More mingw patches pt. 2 --- Core/CwCheat.cpp | 2 +- Core/HLE/proAdhoc.cpp | 4 ++-- Core/HLE/proAdhoc.h | 4 ++-- Core/HLE/proAdhocServer.cpp | 4 ++-- Core/HLE/sceNetAdhoc.cpp | 2 +- Core/HLE/sceRtc.cpp | 8 ++++---- ext/native/thread/threadutil.cpp | 11 +++++++++++ 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index 677a1b53c6..0e5ba0cb5c 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -273,7 +273,7 @@ inline void trim2(std::string& str) { std::vector CWCheatEngine::GetCodesList() { //Reads the entire cheat list from the appropriate .ini. std::string line; std::vector codesList; // Read from INI here -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) std::ifstream list(ConvertUTF8ToWString(activeCheatFile)); #else std::ifstream list(activeCheatFile.c_str()); diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index a7e154348a..6299c1d2b8 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -163,7 +163,7 @@ SceNetAdhocctlPeerInfo * findFriend(SceNetEtherAddr * MAC) { void changeBlockingMode(int fd, int nonblocking) { unsigned long on = 1; unsigned long off = 0; -#ifdef _MSC_VER +#ifdef _WIN32 if (nonblocking){ // Change to Non-Blocking Mode ioctlsocket(fd, FIONBIO, &on); @@ -1284,7 +1284,7 @@ int getActivePeerCount(void) { } int getLocalIp(sockaddr_in * SocketAddress){ -#if defined(_MSC_VER) +#if defined(_WIN32) // Get local host name char szHostName[128] = ""; diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index 6573dd8920..cd28a52f07 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -37,7 +37,7 @@ class PointerWrap; // Net stuff -#if defined(_MSC_VER) +#if defined(_WIN32) #include #else #include @@ -50,7 +50,7 @@ class PointerWrap; #include #include #endif -#ifdef _MSC_VER +#ifdef _WIN32 #define PACK #undef errno #undef ECONNABORTED diff --git a/Core/HLE/proAdhocServer.cpp b/Core/HLE/proAdhocServer.cpp index 43f04c7dc2..e5e0940a71 100644 --- a/Core/HLE/proAdhocServer.cpp +++ b/Core/HLE/proAdhocServer.cpp @@ -32,7 +32,7 @@ #include // Net stuff -#if defined(_MSC_VER) +#if defined(_WIN32) #include #else #include @@ -1735,7 +1735,7 @@ void change_blocking_mode(int fd, int nonblocking) { unsigned long on = 1; unsigned long off = 0; -#ifdef _MSC_VER +#ifdef _WIN32 if (nonblocking){ // Change to Non-Blocking Mode ioctlsocket(fd, FIONBIO, &on); diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index a3fce16ab7..c88c888680 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -130,7 +130,7 @@ void __UpdateMatchingHandler(u64 ArgsPtr) { } static int getBlockingFlag(int id) { -#ifdef _MSC_VER +#ifdef _WIN32 return 0; #else int sockflag = fcntl(id, F_GETFL, O_NONBLOCK); diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index 093acc1d87..43cbdc5ee9 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -457,7 +457,7 @@ static int sceRtcConvertLocalTimeToUTC(u32 tickLocalPtr,u32 tickUTCPtr) { u64 srcTick = Memory::Read_U64(tickLocalPtr); // TODO : Let the user select his timezone / daylight saving instead of taking system param ? -#ifdef _MSC_VER +#ifdef _WIN32 long timezone_val; _get_timezone(&timezone_val); srcTick -= -timezone_val * 1000000ULL; @@ -482,7 +482,7 @@ static int sceRtcConvertUtcToLocalTime(u32 tickUTCPtr,u32 tickLocalPtr) { u64 srcTick = Memory::Read_U64(tickUTCPtr); // TODO : Let the user select his timezone / daylight saving instead of taking system param ? -#ifdef _MSC_VER +#ifdef _WIN32 long timezone_val; _get_timezone(&timezone_val); srcTick += -timezone_val * 1000000ULL; @@ -1017,7 +1017,7 @@ static int sceRtcFormatRFC2822LocalTime(u32 outPtr, u32 srcTickPtr) } int tz_seconds; -#ifdef _MSC_VER +#ifdef _WIN32 long timezone_val; _get_timezone(&timezone_val); tz_seconds = -timezone_val; @@ -1054,7 +1054,7 @@ static int sceRtcFormatRFC3339LocalTime(u32 outPtr, u32 srcTickPtr) } int tz_seconds; -#ifdef _MSC_VER +#ifdef _WIN32 long timezone_val; _get_timezone(&timezone_val); tz_seconds = -timezone_val; diff --git a/ext/native/thread/threadutil.cpp b/ext/native/thread/threadutil.cpp index 722f3a4124..87a22ffa14 100644 --- a/ext/native/thread/threadutil.cpp +++ b/ext/native/thread/threadutil.cpp @@ -1,5 +1,8 @@ #ifdef _WIN32 #include +#ifdef __MINGW32__ +#include +#endif #define TLS_SUPPORTED #elif defined(__ANDROID__) #define TLS_SUPPORTED @@ -35,11 +38,19 @@ void setCurrentThreadName(const char* threadName) { info.dwThreadID = -1; //dwThreadID; info.dwFlags = 0; +#ifdef __MINGW32__ + __try1 (ehandler) +#else __try +#endif { RaiseException(MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info); } +#ifdef __MINGW32__ + __except1 +#else __except(EXCEPTION_CONTINUE_EXECUTION) +#endif {} #else