mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-19 12:22:32 +00:00
mingw patches
This commit is contained in:
parent
7a7ccee5e1
commit
4855b2d6f1
@ -30,7 +30,7 @@
|
||||
#include "CPUDetect.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#define _interlockedbittestandset workaround_ms_header_bug_platform_sdk6_set
|
||||
|
@ -96,4 +96,4 @@
|
||||
# elif defined __SSE2__
|
||||
# define _M_SSE 0x200
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -70,9 +70,11 @@ inline u64 __rotr64(u64 x, unsigned int shift){
|
||||
#define __rotr64 _rotr64
|
||||
|
||||
// 64 bit offsets for windows
|
||||
#ifndef __MINGW32__
|
||||
#define fseeko _fseeki64
|
||||
#define ftello _ftelli64
|
||||
#define atoll _atoi64
|
||||
#endif
|
||||
#if _M_IX86
|
||||
#define Crash() {__asm int 3}
|
||||
#else
|
||||
|
@ -74,6 +74,22 @@ static u64 __RtcGetCurrentTick()
|
||||
return CoreTiming::GetGlobalTimeUs() + rtcBaseTicks;
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
errno_t _get_timezone(long *seconds)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
|
||||
struct tm *gm = gmtime(&now);
|
||||
time_t gmt = mktime(gm);
|
||||
|
||||
struct tm *loc = localtime(&now);
|
||||
time_t local = mktime(loc);
|
||||
|
||||
*seconds = local - gmt;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define FILETIME_FROM_UNIX_EPOCH_US (rtcMagicOffset - rtcFiletimeOffset)
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace MIPSComp {
|
||||
}
|
||||
|
||||
}
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
#if PPSSPP_PLATFORM(WINDOWS) && !defined(__LIBRETRO__)
|
||||
#define DISASM_ALL 1
|
||||
#endif
|
||||
|
||||
|
@ -650,7 +650,11 @@ void InitSysDirectories() {
|
||||
|
||||
// If installed.txt exists(and we can determine the Documents directory)
|
||||
if (installed && (result == S_OK)) {
|
||||
#if defined(_WIN32) && defined(__MINGW32__)
|
||||
std::ifstream inputFile(installedFile);
|
||||
#else
|
||||
std::ifstream inputFile(ConvertUTF8ToWString(installedFile));
|
||||
#endif
|
||||
|
||||
if (!inputFile.fail() && inputFile.is_open()) {
|
||||
std::string tempString;
|
||||
|
@ -71,14 +71,14 @@ bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) {
|
||||
SetGPU(new SoftGPU(ctx, draw));
|
||||
break;
|
||||
case GPUCORE_DIRECTX9:
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__LIBRETRO__)
|
||||
SetGPU(new DIRECTX9_GPU(ctx, draw));
|
||||
break;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case GPUCORE_DIRECTX11:
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__LIBRETRO__)
|
||||
SetGPU(new GPU_D3D11(ctx, draw));
|
||||
break;
|
||||
#else
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
typedef int pid_t;
|
||||
#define getpid rand
|
||||
#endif
|
||||
|
@ -264,6 +264,7 @@ void CheckGLExtensions() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
#ifdef WIN32
|
||||
const char *wglString = 0;
|
||||
if (wglGetExtensionsStringEXT)
|
||||
@ -277,6 +278,7 @@ void CheckGLExtensions() {
|
||||
#elif !defined(USING_GLES2)
|
||||
// const char *glXString = glXQueryExtensionString();
|
||||
// gl_extensions.EXT_swap_control_tear = strstr(glXString, "GLX_EXT_swap_control_tear") != 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Check the desktop extension instead of the OES one. They are very similar.
|
||||
|
@ -20,10 +20,52 @@
|
||||
static __THREAD const char *curThreadName;
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <pshpack8.h>
|
||||
typedef struct {
|
||||
DWORD dwType;
|
||||
LPCSTR szName;
|
||||
DWORD dwThreadID;
|
||||
DWORD dwFlags;
|
||||
} THREADNAME_INFO;
|
||||
#include <poppack.h>
|
||||
|
||||
static EXCEPTION_DISPOSITION NTAPI ignore_handler(EXCEPTION_RECORD *rec,
|
||||
void *frame, CONTEXT *ctx,
|
||||
void *disp)
|
||||
{
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
#endif
|
||||
|
||||
void setCurrentThreadName(const char* threadName) {
|
||||
#ifdef _WIN32
|
||||
// Set the debugger-visible threadname through an unholy magic hack
|
||||
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(__MINGW32__)
|
||||
// Thread information for VS compatible debugger. -1 sets current thread.
|
||||
THREADNAME_INFO ti;
|
||||
ti.dwType = 0x1000;
|
||||
ti.szName = threadName;
|
||||
ti.dwThreadID = -1;
|
||||
|
||||
// Push an exception handler to ignore all following exceptions
|
||||
NT_TIB *tib = ((NT_TIB*)NtCurrentTeb());
|
||||
EXCEPTION_REGISTRATION_RECORD rec;
|
||||
rec.Next = tib->ExceptionList;
|
||||
rec.Handler = ignore_handler;
|
||||
tib->ExceptionList = &rec;
|
||||
|
||||
// Visual Studio and compatible debuggers receive thread names from the
|
||||
// program through a specially crafted exception
|
||||
RaiseException(MS_VC_EXCEPTION, 0, sizeof(ti) / sizeof(ULONG_PTR),
|
||||
(ULONG_PTR*)&ti);
|
||||
|
||||
// Pop exception handler
|
||||
tib->ExceptionList = tib->ExceptionList->Next;
|
||||
#elif defined(_WIN32)
|
||||
#pragma pack(push,8)
|
||||
struct THREADNAME_INFO {
|
||||
DWORD dwType; // must be 0x1000
|
||||
|
Loading…
x
Reference in New Issue
Block a user