mirror of https://github.com/sm64pc/sm64pc.git
Merge pull request #93 from yksoft1/mingw.org-compatible
Making code MinGW.org and MSYS1 compatible
This commit is contained in:
commit
0c03280516
|
@ -47,6 +47,7 @@ def remove_file(fname):
|
||||||
def clean_assets(local_asset_file):
|
def clean_assets(local_asset_file):
|
||||||
assets = set(read_asset_map().keys())
|
assets = set(read_asset_map().keys())
|
||||||
assets.update(read_local_asset_list(local_asset_file))
|
assets.update(read_local_asset_list(local_asset_file))
|
||||||
|
local_asset_file.close()
|
||||||
for fname in list(assets) + [".assets-local.txt"]:
|
for fname in list(assets) + [".assets-local.txt"]:
|
||||||
if fname.startswith("@"):
|
if fname.startswith("@"):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -31,7 +31,12 @@ typedef double f64;
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.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;
|
typedef ptrdiff_t ssize_t;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _TYPES_H_
|
#ifndef _SM64_TYPES_H_
|
||||||
#define _TYPES_H_
|
#define _SM64_TYPES_H_
|
||||||
|
|
||||||
// This file contains various data types used in Super Mario 64 that don't yet
|
// This file contains various data types used in Super Mario 64 that don't yet
|
||||||
// have an appropriate header.
|
// have an appropriate header.
|
||||||
|
|
|
@ -30,4 +30,13 @@
|
||||||
#include <PR/libaudio.h>
|
#include <PR/libaudio.h>
|
||||||
#include <PR/libultra.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
|
#endif
|
||||||
|
|
|
@ -9,8 +9,11 @@
|
||||||
#include "include/text_strings.h"
|
#include "include/text_strings.h"
|
||||||
#include "engine/surface_collision.h"
|
#include "engine/surface_collision.h"
|
||||||
#include "pc/configfile.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>
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#define __NO_MINGW_LFS //Mysterious error in MinGW.org stdio.h
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,24 @@ static size_t buf_vbo_num_tris;
|
||||||
static struct GfxWindowManagerAPI *gfx_wapi;
|
static struct GfxWindowManagerAPI *gfx_wapi;
|
||||||
static struct GfxRenderingAPI *gfx_rapi;
|
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>
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
static unsigned long get_time(void) {
|
static unsigned long get_time(void) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
|
|
||||||
// printing size_t varies by compiler
|
// printing size_t varies by compiler
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
|
#include <windows.h>
|
||||||
#define SIZE_T_FORMAT "%Iu"
|
#define SIZE_T_FORMAT "%Iu"
|
||||||
#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
|
#define realpath(N,R) _fullpath((R),(N),MAX_PATH)
|
||||||
#else
|
#else
|
||||||
#define SIZE_T_FORMAT "%zu"
|
#define SIZE_T_FORMAT "%zu"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue