From 0faa3fbbded8a5bba271f7dfc87c1d950eb6587a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 8 Nov 2013 01:54:46 +0100 Subject: [PATCH] (RARCH_CONSOLE) Compile in SRAM Autosave option in by default for RARCH_CONSOLE now --- frontend/menu/menu_common.c | 2 +- griffin/griffin.c | 2 -- retroarch.c | 14 +++++++------- thread.c | 11 +++++++++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 872617fd53..ee7ddec499 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -1893,7 +1893,7 @@ void menu_populate_entries(void *data, unsigned menu_type) rgui_list_push(rgui->selection_buf, "GPU Screenshots", RGUI_SETTINGS_GPU_SCREENSHOT, 0); #endif rgui_list_push(rgui->selection_buf, "Config Save On Exit", RGUI_SETTINGS_CONFIG_SAVE_ON_EXIT, 0); -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) rgui_list_push(rgui->selection_buf, "SRAM Autosave", RGUI_SETTINGS_SRAM_AUTOSAVE, 0); #endif rgui_list_push(rgui->selection_buf, "Show Framerate", RGUI_SETTINGS_DEBUG_TEXT, 0); diff --git a/griffin/griffin.c b/griffin/griffin.c index d11f77d8a5..5d7aa02dc9 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -498,10 +498,8 @@ THREAD #include "../thread.c" #include "../gfx/thread_wrapper.c" #include "../audio/thread_wrapper.c" -#ifndef RARCH_CONSOLE #include "../autosave.c" #endif -#endif /*============================================================ diff --git a/retroarch.c b/retroarch.c index dde3a5c29d..fbec3ac2b5 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1675,7 +1675,7 @@ static void init_libretro_cbs(void) #endif } -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) void rarch_init_autosave(void) { int ram_types[2] = {-1, -1}; @@ -2467,7 +2467,7 @@ void rarch_disk_control_append_image(const char *path) msg_queue_clear(g_extern.msg_queue); msg_queue_push(g_extern.msg_queue, msg, 0, 180); -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) rarch_deinit_autosave(); #endif @@ -2478,7 +2478,7 @@ void rarch_disk_control_append_image(const char *path) set_paths(path); fill_pathnames(); -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) rarch_init_autosave(); #endif @@ -3003,7 +3003,7 @@ int rarch_main_init(int argc, char *argv[]) if (!g_extern.use_sram) RARCH_LOG("SRAM will not be saved.\n"); -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) if (g_extern.use_sram) rarch_init_autosave(); #endif @@ -3127,7 +3127,7 @@ bool rarch_main_iterate(void) do_state_checks(); // Run libretro for one frame. -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) lock_autosave(); #endif @@ -3155,7 +3155,7 @@ bool rarch_main_iterate(void) netplay_post_frame(g_extern.netplay); #endif -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) unlock_autosave(); #endif @@ -3171,7 +3171,7 @@ void rarch_main_deinit(void) deinit_command(); #endif -#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) +#if defined(HAVE_THREADS) if (g_extern.use_sram) rarch_deinit_autosave(); #endif diff --git a/thread.c b/thread.c index 8e48fdf377..65e5b2f932 100644 --- a/thread.c +++ b/thread.c @@ -313,7 +313,6 @@ int scond_broadcast(scond_t *cond) return pthread_cond_broadcast(&cond->cond); } -#ifndef RARCH_CONSOLE bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us) { struct timespec now; @@ -326,20 +325,28 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us) mach_port_deallocate(mach_task_self(), cclock); now.tv_sec = mts.tv_sec; now.tv_nsec = mts.tv_nsec; +#elif defined(__CELLOS_LV2__) + sys_time_sec_t s; + sys_time_nsec_t n; + sys_time_get_current_time(&s, &n); #else clock_gettime(CLOCK_REALTIME, &now); #endif +#if defined(__CELLOS_LV2__) + now.tv_sec = s; + now.tv_nsec = n; +#else now.tv_sec += timeout_us / 1000000LL; now.tv_nsec += timeout_us * 1000LL; now.tv_sec += now.tv_nsec / 1000000000LL; now.tv_nsec = now.tv_nsec % 1000000000LL; +#endif int ret = pthread_cond_timedwait(&cond->cond, &lock->lock, &now); return ret == 0; } -#endif void scond_signal(scond_t *cond) {