More mingw patches pt. 2

This commit is contained in:
twinaphex 2017-08-29 22:41:50 +02:00
parent db404adb95
commit a9bf8e7b18
7 changed files with 23 additions and 12 deletions

View File

@ -273,7 +273,7 @@ inline void trim2(std::string& str) {
std::vector<std::string> CWCheatEngine::GetCodesList() { //Reads the entire cheat list from the appropriate .ini.
std::string line;
std::vector<std::string> codesList; // Read from INI here
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
std::ifstream list(ConvertUTF8ToWString(activeCheatFile));
#else
std::ifstream list(activeCheatFile.c_str());

View File

@ -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] = "";

View File

@ -37,7 +37,7 @@
class PointerWrap;
// Net stuff
#if defined(_MSC_VER)
#if defined(_WIN32)
#include <WS2tcpip.h>
#else
#include <unistd.h>
@ -50,7 +50,7 @@ class PointerWrap;
#include <fcntl.h>
#include <errno.h>
#endif
#ifdef _MSC_VER
#ifdef _WIN32
#define PACK
#undef errno
#undef ECONNABORTED

View File

@ -32,7 +32,7 @@
#include <sys/types.h>
// Net stuff
#if defined(_MSC_VER)
#if defined(_WIN32)
#include <WS2tcpip.h>
#else
#include <sys/socket.h>
@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -1,5 +1,8 @@
#ifdef _WIN32
#include <windows.h>
#ifdef __MINGW32__
#include <excpt.h>
#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