From 33ecedb462804924dfe14de0c1a674d6ac39fcab Mon Sep 17 00:00:00 2001 From: Themaister Date: Thu, 6 Oct 2011 20:49:00 +0200 Subject: [PATCH] Fixup build for OSX. --- gfx/sdlwrap.c | 1 + libsnes.hpp | 2 ++ thread.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/gfx/sdlwrap.c b/gfx/sdlwrap.c index 5397a136ab..dc732cd5f8 100644 --- a/gfx/sdlwrap.c +++ b/gfx/sdlwrap.c @@ -22,6 +22,7 @@ #ifdef __APPLE__ #include +#include #endif // SDL 1.2 is portable, sure, but you still need some platform specific workarounds ;) diff --git a/libsnes.hpp b/libsnes.hpp index 82fe8e93ef..f191ec6b60 100755 --- a/libsnes.hpp +++ b/libsnes.hpp @@ -74,6 +74,8 @@ typedef int16_t (*snes_input_state_t)(bool port, unsigned device, unsigned index unsigned snes_library_revision_major(void); unsigned snes_library_revision_minor(void); +const char *snes_library_id(void); + void snes_set_video_refresh(snes_video_refresh_t); void snes_set_audio_sample(snes_audio_sample_t); void snes_set_input_poll(snes_input_poll_t); diff --git a/thread.c b/thread.c index 5c17419af5..078f647d3d 100644 --- a/thread.c +++ b/thread.c @@ -26,6 +26,11 @@ #include #endif +#ifdef __MACH__ +#include +#include +#endif + #ifdef _WIN32 struct slock @@ -166,7 +171,18 @@ void scond_wait(scond_t *cond, slock_t *lock) bool scond_wait_timeout(scond_t *cond, slock_t *lock, unsigned timeout_ms) { struct timespec now; + +#ifdef __MACH__ // OSX doesn't have clock_gettime ... :( + clock_serv_t cclock; + mach_timespec_t mts; + host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); + clock_get_time(cclock, &mts); + mach_port_deallocate(mach_task_self(), cclock); + now.tv_sec = mts.tv_sec; + now.tv_nsec = mts.tv_nsec; +#else clock_gettime(CLOCK_REALTIME, &now); +#endif now.tv_sec += timeout_ms / 1000; now.tv_nsec += timeout_ms * 1000000L;