mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-22 16:30:23 +00:00
Merge pull request #93 from yksoft1/mingw.org-compatible
Making code MinGW.org and MSYS1 compatible
This commit is contained in:
commit
0c03280516
8 changed files with 43 additions and 6 deletions
|
@ -47,6 +47,7 @@ def remove_file(fname):
|
|||
def clean_assets(local_asset_file):
|
||||
assets = set(read_asset_map().keys())
|
||||
assets.update(read_local_asset_list(local_asset_file))
|
||||
local_asset_file.close()
|
||||
for fname in list(assets) + [".assets-local.txt"]:
|
||||
if fname.startswith("@"):
|
||||
continue
|
||||
|
|
|
@ -31,7 +31,12 @@ typedef double f64;
|
|||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#if defined(__MINGW32__)
|
||||
#include <_mingw.h>
|
||||
#if !defined(__MINGW64_VERSION_MAJOR)
|
||||
typedef long ssize_t;
|
||||
#else
|
||||
typedef ptrdiff_t ssize_t;
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _TYPES_H_
|
||||
#define _TYPES_H_
|
||||
#ifndef _SM64_TYPES_H_
|
||||
#define _SM64_TYPES_H_
|
||||
|
||||
// This file contains various data types used in Super Mario 64 that don't yet
|
||||
// have an appropriate header.
|
||||
|
|
|
@ -30,4 +30,13 @@
|
|||
#include <PR/libaudio.h>
|
||||
#include <PR/libultra.h>
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#include <_mingw.h>
|
||||
#if !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
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,8 +9,11 @@
|
|||
#include "include/text_strings.h"
|
||||
#include "engine/surface_collision.h"
|
||||
#include "pc/configfile.h"
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
//quick and dirty fix for some older MinGW.org mingwrt
|
||||
#else
|
||||
#include <stdio.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
#define __NO_MINGW_LFS //Mysterious error in MinGW.org stdio.h
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -155,7 +155,24 @@ static size_t buf_vbo_num_tris;
|
|||
static struct GfxWindowManagerAPI *gfx_wapi;
|
||||
static struct GfxRenderingAPI *gfx_rapi;
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#include <_mingw.h>
|
||||
#if !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
|
||||
#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