Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/VGMPlay/ChipMapper.c b/VGMPlay/ChipMapper.c
- index 0c27432..a16d238 100644
- --- a/VGMPlay/ChipMapper.c
- +++ b/VGMPlay/ChipMapper.c
- @@ -17,11 +17,21 @@
- #else
- #ifndef DISABLE_HW_SUPPORT
- #include <unistd.h>
- +#ifdef __APPLE__
- +#include <architecture/i386/io.h>
- +#else
- #include <sys/io.h>
- +#endif /* __APPLE__ */
- #endif
- #include <time.h>
- #endif
- +#ifdef __APPLE__
- +#define ioperm(x,y,z) 0
- +#define outb(x,y) 0
- +#define inb(x) 0
- +#endif
- +
- #include "chips/mamedef.h"
- #include "chips/ChipIncl.h"
- diff --git a/VGMPlay/Makefile b/VGMPlay/Makefile
- index 0de15b5..b3099a1 100644
- --- a/VGMPlay/Makefile
- +++ b/VGMPlay/Makefile
- @@ -8,11 +8,18 @@
- # TODO: Make this look less horrible.
- # TODO: Make it not include pt_ioctl.c when DISABLE_HW_SUPPORT is active.
- +# Uncomment if you build on Mac OSX
- +MACOSX = 1
- +
- # Uncomment if you build on Windows using MinGW.
- #WINDOWS = 1
- # Uncomment if you want to use libao instead of OSS for sound streaming under Linux
- USE_LIBAO = 1
- +# Mac requires libAO
- +ifdef MACOSX
- +USE_LIBAO = 1
- +endif
- CC = gcc
- PREFIX = /usr/local
- @@ -43,6 +50,11 @@ LDFLAGS := -lm -lz $(LDFLAGS)
- ifdef WINDOWS
- # for Windows, add kernel32 and winmm (Multimedia APIs)
- LDFLAGS += -lkernel32 -lwinmm
- +else MACOSX
- +CFLAGS += -I/usr/include/malloc
- +MAINFLAGS += -pthread -DSHARE_PREFIX=\"$(PREFIX)\"
- +# Mac requires libAO
- +LDFLAGS += -lao
- else
- # for Linux, add librt (clock stuff) and libpthread (threads)
- LDFLAGS += -lrt -lpthread -pthread
- diff --git a/VGMPlay/Stream.c b/VGMPlay/Stream.c
- index b24cac2..2bb58ae 100644
- --- a/VGMPlay/Stream.c
- +++ b/VGMPlay/Stream.c
- @@ -16,6 +16,8 @@
- #include <fcntl.h>
- #ifdef __NetBSD__
- #include <sys/audioio.h>
- +#elif defined(__APPLE__)
- +// nothing
- #else
- #include <linux/soundcard.h>
- #endif
- diff --git a/VGMPlay/VGMPlay.c b/VGMPlay/VGMPlay.c
- index c24e8ae..93e1d95 100644
- --- a/VGMPlay/VGMPlay.c
- +++ b/VGMPlay/VGMPlay.c
- @@ -44,7 +44,27 @@
- #else //ifdef UNIX
- #include <limits.h> // for PATH_MAX
- #include <pthread.h> // for pthread functions
- +
- +// (suitable?) Apple substitute for clock_gettime()
- +#ifdef __MACH__
- +#include <mach/mach_time.h>
- +#define CLOCK_REALTIME 0
- +#define CLOCK_MONOTONIC 0
- +int clock_gettime(int clk_id, struct timespec *t){
- + mach_timebase_info_data_t timebase;
- + mach_timebase_info(&timebase);
- + uint64_t time;
- + time = mach_absolute_time();
- + double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom);
- + double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9);
- + t->tv_sec = seconds;
- + t->tv_nsec = nseconds;
- + return 0;
- +}
- +#else
- #include <time.h> // for clock_gettime()
- +#endif
- +
- #include <unistd.h> // for usleep()
- #define MAX_PATH PATH_MAX
Advertisement
Add Comment
Please, Sign In to add comment