Permalink
Browse files

Merge pull request #9941 from libretro-mirrors/master

More mingw patches
  • Loading branch information...
hrydgard committed Aug 30, 2017
2 parents 884aef6 + 7424e64 commit 0c0da1cfa3d71798c5daa133e4c0c13700bf086f
View
@@ -30,7 +30,7 @@ struct u24_be {
}
};
#ifdef _WIN32
#if defined(_MSC_VER)
typedef unsigned __int8 u8;
typedef unsigned __int16 u16;
View
@@ -93,7 +93,7 @@ FILE *OpenCFile(const std::string &filename, const char *mode)
bool OpenCPPFile(std::fstream & stream, const std::string &filename, std::ios::openmode mode)
{
#if defined(_WIN32) && defined(UNICODE)
#if defined(_WIN32) && defined(UNICODE) && !defined(__MINGW32__)
stream.open(ConvertUTF8ToWString(filename), mode);
#else
stream.open(filename.c_str(), mode);
View
@@ -280,7 +280,7 @@ void LogManager::RemoveListener(LogListener *listener) {
}
FileLogListener::FileLogListener(const char *filename) {
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
m_logfile.open(ConvertUTF8ToWString(filename).c_str(), std::ios::app);
#else
m_logfile.open(filename, std::ios::app);
View
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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;
@@ -7,8 +7,6 @@
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif
#define fseeko _fseeki64
#define ftello _ftelli64
#else
#include <dirent.h>
#include <unistd.h>
@@ -84,14 +82,24 @@ uint64_t GetSize(FILE *f)
return 0;
}
return size;
#else
#ifdef _WIN32
uint64_t pos = _ftelli64(f);
#else
uint64_t pos = ftello(f);
#endif
if (fseek(f, 0, SEEK_END) != 0) {
return 0;
}
#ifdef _WIN32
uint64_t size = _ftelli64(f);
// Reset the seek position to where it was when we started.
if (size != pos && _fseeki64(f, pos, SEEK_SET) != 0) {
#else
uint64_t size = ftello(f);
// Reset the seek position to where it was when we started.
if (size != pos && fseeko(f, pos, SEEK_SET) != 0) {
#endif
// Should error here.
return 0;
}
@@ -503,7 +503,7 @@ bool IniFile::Load(const char* filename)
// Open file
std::ifstream in;
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
in.open(ConvertUTF8ToWString(filename), std::ios::in);
#else
in.open(filename, std::ios::in);
@@ -581,7 +581,7 @@ bool IniFile::Load(std::istream &in) {
bool IniFile::Save(const char* filename)
{
std::ofstream out;
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
out.open(ConvertUTF8ToWString(filename), std::ios::out);
#else
out.open(filename, std::ios::out);
@@ -12,6 +12,7 @@
#define NOMINMAX
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -11,6 +11,9 @@
#ifdef _WIN32
#include <WinSock2.h>
#include <Ws2tcpip.h>
#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x0400
#endif
#undef min
#undef max
#else
@@ -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

0 comments on commit 0c0da1c

Please sign in to comment.