mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-22 16:30:23 +00:00
Make the code buildable on MinGW.org (not mingw-w64) and MSYS1.
This commit is contained in:
parent
d2cff2838f
commit
fa9af3227e
4 changed files with 26 additions and 1 deletions
|
@ -38,7 +38,11 @@ typedef s32 ptrdiff_t;
|
|||
#else
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
typedef long ssize_t;
|
||||
#else
|
||||
typedef ptrdiff_t ssize_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,4 +30,10 @@
|
|||
#include <PR/libaudio.h>
|
||||
#include <PR/libultra.h>
|
||||
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
#include <string.h>
|
||||
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
|
||||
#define bcopy(s1, s2, n) memmove((s2), (s1), (n))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -153,7 +153,21 @@ static size_t buf_vbo_num_tris;
|
|||
static struct GfxWindowManagerAPI *gfx_wapi;
|
||||
static struct GfxRenderingAPI *gfx_rapi;
|
||||
|
||||
#if defined(_WIN32) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
#include <windows.h>
|
||||
#define CLOCK_MONOTONIC 0
|
||||
//https://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows
|
||||
struct timespec { long tv_sec; long tv_nsec; }; //header part
|
||||
int clock_gettime(int arg, struct timespec *spec) //C-file part
|
||||
{ __int64 wintime; GetSystemTimeAsFileTime((FILETIME*)&wintime);
|
||||
wintime -=116444736000000000LL; //1jan1601 to 1jan1970
|
||||
spec->tv_sec =wintime / 10000000LL; //seconds
|
||||
spec->tv_nsec =wintime % 10000000LL*100; //nano-seconds
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
static unsigned long get_time(void) {
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
|
||||
// printing size_t varies by compiler
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#include <windows.h>
|
||||
#define SIZE_T_FORMAT "%Iu"
|
||||
#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
|
||||
#define realpath(N,R) _fullpath((R),(N),MAX_PATH)
|
||||
#else
|
||||
#define SIZE_T_FORMAT "%zu"
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue