Fixup build for OSX.

This commit is contained in:
Themaister 2011-10-06 20:49:00 +02:00
parent a58676c9e1
commit 33ecedb462
3 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#endif
// SDL 1.2 is portable, sure, but you still need some platform specific workarounds ;)

View File

@ -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);

View File

@ -26,6 +26,11 @@
#include <time.h>
#endif
#ifdef __MACH__
#include <mach/clock.h>
#include <mach/mach.h>
#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;