summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/lib/osdlib_macosx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/lib/osdlib_macosx.c')
-rw-r--r--src/osd/modules/lib/osdlib_macosx.c160
1 files changed, 80 insertions, 80 deletions
diff --git a/src/osd/modules/lib/osdlib_macosx.c b/src/osd/modules/lib/osdlib_macosx.c
index 5d6233bce25..088cbd969df 100644
--- a/src/osd/modules/lib/osdlib_macosx.c
+++ b/src/osd/modules/lib/osdlib_macosx.c
@@ -34,7 +34,7 @@
const char *osd_getenv(const char *name)
{
- return getenv(name);
+ return getenv(name);
}
//============================================================
@@ -43,7 +43,7 @@ const char *osd_getenv(const char *name)
int osd_setenv(const char *name, const char *value, int overwrite)
{
- return setenv(name, value, overwrite);
+ return setenv(name, value, overwrite);
}
//============================================================
@@ -52,7 +52,7 @@ int osd_setenv(const char *name, const char *value, int overwrite)
void osd_process_kill(void)
{
- kill(getpid(), SIGKILL);
+ kill(getpid(), SIGKILL);
}
//============================================================
@@ -61,22 +61,22 @@ void osd_process_kill(void)
int osd_get_num_processors(void)
{
- int processors = 1;
-
- struct host_basic_info host_basic_info;
- unsigned int count;
- kern_return_t r;
- mach_port_t my_mach_host_self;
-
- count = HOST_BASIC_INFO_COUNT;
- my_mach_host_self = mach_host_self();
- if ( ( r = host_info(my_mach_host_self, HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count)) == KERN_SUCCESS )
- {
- processors = host_basic_info.avail_cpus;
- }
- mach_port_deallocate(mach_task_self(), my_mach_host_self);
-
- return processors;
+ int processors = 1;
+
+ struct host_basic_info host_basic_info;
+ unsigned int count;
+ kern_return_t r;
+ mach_port_t my_mach_host_self;
+
+ count = HOST_BASIC_INFO_COUNT;
+ my_mach_host_self = mach_host_self();
+ if ( ( r = host_info(my_mach_host_self, HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count)) == KERN_SUCCESS )
+ {
+ processors = host_basic_info.avail_cpus;
+ }
+ mach_port_deallocate(mach_task_self(), my_mach_host_self);
+
+ return processors;
}
//============================================================
@@ -86,7 +86,7 @@ int osd_get_num_processors(void)
void *osd_malloc(size_t size)
{
#ifndef MALLOC_DEBUG
- return malloc(size);
+ return malloc(size);
#else
#error "MALLOC_DEBUG not yet supported"
#endif
@@ -100,7 +100,7 @@ void *osd_malloc(size_t size)
void *osd_malloc_array(size_t size)
{
#ifndef MALLOC_DEBUG
- return malloc(size);
+ return malloc(size);
#else
#error "MALLOC_DEBUG not yet supported"
#endif
@@ -114,7 +114,7 @@ void *osd_malloc_array(size_t size)
void osd_free(void *ptr)
{
#ifndef MALLOC_DEBUG
- free(ptr);
+ free(ptr);
#else
#error "MALLOC_DEBUG not yet supported"
#endif
@@ -131,9 +131,9 @@ void osd_free(void *ptr)
void *osd_alloc_executable(size_t size)
{
#if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX)
- return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
+ return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
#elif defined(SDLMAME_UNIX)
- return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
+ return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
#endif
}
@@ -146,9 +146,9 @@ void *osd_alloc_executable(size_t size)
void osd_free_executable(void *ptr, size_t size)
{
#ifdef SDLMAME_SOLARIS
- munmap((char *)ptr, size);
+ munmap((char *)ptr, size);
#else
- munmap(ptr, size);
+ munmap(ptr, size);
#endif
}
@@ -158,13 +158,13 @@ void osd_free_executable(void *ptr, size_t size)
void osd_break_into_debugger(const char *message)
{
- #ifdef MAME_DEBUG
- printf("MAME exception: %s\n", message);
- printf("Attempting to fall into debugger\n");
- kill(getpid(), SIGTRAP);
- #else
- printf("Ignoring MAME exception: %s\n", message);
- #endif
+ #ifdef MAME_DEBUG
+ printf("MAME exception: %s\n", message);
+ printf("Attempting to fall into debugger\n");
+ kill(getpid(), SIGTRAP);
+ #else
+ printf("Ignoring MAME exception: %s\n", message);
+ #endif
}
@@ -191,36 +191,36 @@ static osd_ticks_t ticks_per_second;
static osd_ticks_t init_cycle_counter(void)
{
- osd_ticks_t start, end;
- osd_ticks_t a, b;
+ osd_ticks_t start, end;
+ osd_ticks_t a, b;
- cycle_counter = mach_cycle_counter;
- ticks_counter = mach_cycle_counter;
+ cycle_counter = mach_cycle_counter;
+ ticks_counter = mach_cycle_counter;
- // wait for an edge on the timeGetTime call
- a = SDL_GetTicks();
- do
- {
- b = SDL_GetTicks();
- } while (a == b);
+ // wait for an edge on the timeGetTime call
+ a = SDL_GetTicks();
+ do
+ {
+ b = SDL_GetTicks();
+ } while (a == b);
- // get the starting cycle count
- start = (*cycle_counter)();
+ // get the starting cycle count
+ start = (*cycle_counter)();
- // now wait for 1/4 second total
- do
- {
- a = SDL_GetTicks();
- } while (a - b < 250);
+ // now wait for 1/4 second total
+ do
+ {
+ a = SDL_GetTicks();
+ } while (a - b < 250);
- // get the ending cycle count
- end = (*cycle_counter)();
+ // get the ending cycle count
+ end = (*cycle_counter)();
- // compute ticks_per_sec
- ticks_per_second = (end - start) * 4;
+ // compute ticks_per_sec
+ ticks_per_second = (end - start) * 4;
- // return the current cycle count
- return (*cycle_counter)();
+ // return the current cycle count
+ return (*cycle_counter)();
}
//============================================================
@@ -232,7 +232,7 @@ static osd_ticks_t init_cycle_counter(void)
//============================================================
static osd_ticks_t mach_cycle_counter(void)
{
- return mach_absolute_time();
+ return mach_absolute_time();
}
//============================================================
@@ -241,7 +241,7 @@ static osd_ticks_t mach_cycle_counter(void)
osd_ticks_t osd_ticks(void)
{
- return (*cycle_counter)();
+ return (*cycle_counter)();
}
@@ -251,12 +251,12 @@ osd_ticks_t osd_ticks(void)
osd_ticks_t osd_ticks_per_second(void)
{
- if (ticks_per_second == 0)
- {
- // if we haven't computed the value yet, there's no time like the present
- init_cycle_counter();
- }
- return ticks_per_second;
+ if (ticks_per_second == 0)
+ {
+ // if we haven't computed the value yet, there's no time like the present
+ init_cycle_counter();
+ }
+ return ticks_per_second;
}
@@ -267,20 +267,20 @@ osd_ticks_t osd_ticks_per_second(void)
void osd_sleep(osd_ticks_t duration)
{
- UINT32 msec;
-
- // make sure we've computed ticks_per_second
- if (ticks_per_second == 0)
- (void)osd_ticks();
-
- // convert to milliseconds, rounding down
- msec = (UINT32)(duration * 1000 / ticks_per_second);
-
- // only sleep if at least 2 full milliseconds
- if (msec >= 2)
- {
- // take a couple of msecs off the top for good measure
- msec -= 2;
- usleep(msec*1000);
- }
+ UINT32 msec;
+
+ // make sure we've computed ticks_per_second
+ if (ticks_per_second == 0)
+ (void)osd_ticks();
+
+ // convert to milliseconds, rounding down
+ msec = (UINT32)(duration * 1000 / ticks_per_second);
+
+ // only sleep if at least 2 full milliseconds
+ if (msec >= 2)
+ {
+ // take a couple of msecs off the top for good measure
+ msec -= 2;
+ usleep(msec*1000);
+ }
}