Rename rarch_sleep to retro_sleep
This commit is contained in:
parent
1e3202a95e
commit
5465da0139
|
@ -126,7 +126,7 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
||||||
{
|
{
|
||||||
do{
|
do{
|
||||||
/* todo: compute the correct sleep period */
|
/* todo: compute the correct sleep period */
|
||||||
rarch_sleep(1);
|
retro_sleep(1);
|
||||||
current_tick = svcGetSystemTick();
|
current_tick = svcGetSystemTick();
|
||||||
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||||
|
|
|
@ -166,7 +166,7 @@ static void dsound_thread(void *data)
|
||||||
* but it is not guaranteed to work, so use high
|
* but it is not guaranteed to work, so use high
|
||||||
* priority sleeping patterns.
|
* priority sleeping patterns.
|
||||||
*/
|
*/
|
||||||
rarch_sleep(1);
|
retro_sleep(1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ static bool al_get_buffer(al_t *al, ALuint *buffer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Must sleep as there is no proper blocking method. */
|
/* Must sleep as there is no proper blocking method. */
|
||||||
rarch_sleep(1);
|
retro_sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,6 @@ static int rsnd_send_info_query(rsound_t *rd);
|
||||||
static int rsnd_update_server_info(rsound_t *rd);
|
static int rsnd_update_server_info(rsound_t *rd);
|
||||||
|
|
||||||
static int rsnd_poll(struct pollfd *fd, int numfd, int timeout);
|
static int rsnd_poll(struct pollfd *fd, int numfd, int timeout);
|
||||||
static void rsnd_sleep(int msec);
|
|
||||||
|
|
||||||
static void rsnd_cb_thread(void *thread_data);
|
static void rsnd_cb_thread(void *thread_data);
|
||||||
static void rsnd_thread(void *thread_data);
|
static void rsnd_thread(void *thread_data);
|
||||||
|
@ -748,12 +747,6 @@ static int64_t rsnd_get_time_usec(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rsnd_sleep(int msec)
|
|
||||||
{
|
|
||||||
rarch_sleep(msec);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Calculates how many bytes there are in total in the virtual buffer. This is calculated client side.
|
/* Calculates how many bytes there are in total in the virtual buffer. This is calculated client side.
|
||||||
It should be accurate enough unless we have big problems with buffer underruns.
|
It should be accurate enough unless we have big problems with buffer underruns.
|
||||||
This function is called by rsd_delay() to determine the latency.
|
This function is called by rsd_delay() to determine the latency.
|
||||||
|
@ -1246,7 +1239,7 @@ static void rsnd_cb_thread(void *thread_data)
|
||||||
// The network might do things in large chunks, so it may request large amounts of data in short periods of time.
|
// The network might do things in large chunks, so it may request large amounts of data in short periods of time.
|
||||||
// This breaks when the caller cannot buffer up big buffers beforehand, so do short sleeps inbetween.
|
// This breaks when the caller cannot buffer up big buffers beforehand, so do short sleeps inbetween.
|
||||||
// This is somewhat dirty, but I cannot see a better solution
|
// This is somewhat dirty, but I cannot see a better solution
|
||||||
rsnd_sleep(1);
|
retro_sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1513,7 +1506,7 @@ void rsd_delay_wait(rsound_t *rd)
|
||||||
{
|
{
|
||||||
int64_t sleep_ms = latency_ms - rd->max_latency;
|
int64_t sleep_ms = latency_ms - rd->max_latency;
|
||||||
RSD_DEBUG("[RSound] Delay wait: %d ms.\n", (int)sleep_ms);
|
RSD_DEBUG("[RSound] Delay wait: %d ms.\n", (int)sleep_ms);
|
||||||
rsnd_sleep((int)sleep_ms);
|
retro_sleep((int)sleep_ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,9 +265,11 @@ void wait_for_input(void)
|
||||||
|
|
||||||
if (kDown & KEY_SELECT)
|
if (kDown & KEY_SELECT)
|
||||||
exit(0);
|
exit(0);
|
||||||
// select_pressed = true;
|
#if 0
|
||||||
|
select_pressed = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
rarch_sleep(1);
|
retro_sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ static void emscripten_mainloop(void)
|
||||||
unsigned sleep_ms = 0;
|
unsigned sleep_ms = 0;
|
||||||
int ret = rarch_main_iterate(&sleep_ms);
|
int ret = rarch_main_iterate(&sleep_ms);
|
||||||
if (ret == 1 && sleep_ms > 0)
|
if (ret == 1 && sleep_ms > 0)
|
||||||
rarch_sleep(sleep_ms);
|
retro_sleep(sleep_ms);
|
||||||
rarch_main_data_iterate();
|
rarch_main_data_iterate();
|
||||||
if (ret != -1)
|
if (ret != -1)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -696,7 +696,7 @@ static void android_app_entry(void *data)
|
||||||
ret = rarch_main_iterate(&sleep_ms);
|
ret = rarch_main_iterate(&sleep_ms);
|
||||||
|
|
||||||
if (ret == 1 && sleep_ms > 0)
|
if (ret == 1 && sleep_ms > 0)
|
||||||
rarch_sleep(sleep_ms);
|
retro_sleep(sleep_ms);
|
||||||
rarch_main_data_iterate();
|
rarch_main_data_iterate();
|
||||||
}while (ret != -1);
|
}while (ret != -1);
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ int rarch_main(int argc, char *argv[], void *data)
|
||||||
ret = rarch_main_iterate(&sleep_ms);
|
ret = rarch_main_iterate(&sleep_ms);
|
||||||
|
|
||||||
if (ret == 1 && sleep_ms > 0)
|
if (ret == 1 && sleep_ms > 0)
|
||||||
rarch_sleep(sleep_ms);
|
retro_sleep(sleep_ms);
|
||||||
rarch_main_data_iterate();
|
rarch_main_data_iterate();
|
||||||
}while(ret != -1);
|
}while(ret != -1);
|
||||||
|
|
||||||
|
|
|
@ -484,12 +484,12 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
|
||||||
* 0x00 to 0x(4)A400FB. (support clones) */
|
* 0x00 to 0x(4)A400FB. (support clones) */
|
||||||
buf = 0x55;
|
buf = 0x55;
|
||||||
wiimote_write_data(wm, 0x04A400F0, &buf, 1);
|
wiimote_write_data(wm, 0x04A400F0, &buf, 1);
|
||||||
rarch_sleep(100);
|
retro_sleep(100);
|
||||||
buf = 0x00;
|
buf = 0x00;
|
||||||
wiimote_write_data(wm, 0x04A400FB, &buf, 1);
|
wiimote_write_data(wm, 0x04A400FB, &buf, 1);
|
||||||
|
|
||||||
/* check extension type! */
|
/* check extension type! */
|
||||||
rarch_sleep(100);
|
retro_sleep(100);
|
||||||
wiimote_read_data(wm, WM_EXP_MEM_CALIBR + 220, 4);
|
wiimote_read_data(wm, WM_EXP_MEM_CALIBR + 220, 4);
|
||||||
#if 0
|
#if 0
|
||||||
wiimote_read_data(wm, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN);
|
wiimote_read_data(wm, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN);
|
||||||
|
@ -553,7 +553,7 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case IDENT_CC:
|
case IDENT_CC:
|
||||||
rarch_sleep(100);
|
retro_sleep(100);
|
||||||
/* pedimos datos de calibracion del JOY! */
|
/* pedimos datos de calibracion del JOY! */
|
||||||
wiimote_read_data(wm, WM_EXP_MEM_CALIBR, 16);
|
wiimote_read_data(wm, WM_EXP_MEM_CALIBR, 16);
|
||||||
wm->handshake_state = 5;
|
wm->handshake_state = 5;
|
||||||
|
|
|
@ -71,12 +71,12 @@
|
||||||
#define RARCH_SCALE_BASE 256
|
#define RARCH_SCALE_BASE 256
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rarch_sleep:
|
* retro_sleep:
|
||||||
* @msec : amount in milliseconds to sleep
|
* @msec : amount in milliseconds to sleep
|
||||||
*
|
*
|
||||||
* Sleeps for a specified amount of milliseconds (@msec).
|
* Sleeps for a specified amount of milliseconds (@msec).
|
||||||
**/
|
**/
|
||||||
static INLINE void rarch_sleep(unsigned msec)
|
static INLINE void retro_sleep(unsigned msec)
|
||||||
{
|
{
|
||||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||||
sys_timer_usleep(1000 * msec);
|
sys_timer_usleep(1000 * msec);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <retro_inline.h>
|
#include <retro_inline.h>
|
||||||
|
#include <retro_miscellaneous.h>
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(_MSC_VER)
|
#if defined(__cplusplus) && !defined(_MSC_VER)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -169,57 +170,6 @@ int scond_broadcast(scond_t *cond);
|
||||||
**/
|
**/
|
||||||
void scond_signal(scond_t *cond);
|
void scond_signal(scond_t *cond);
|
||||||
|
|
||||||
#ifndef RARCH_INTERNAL
|
|
||||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
|
||||||
#include <sys/timer.h>
|
|
||||||
#elif defined(XENON)
|
|
||||||
#include <time/time.h>
|
|
||||||
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
|
|
||||||
#include <unistd.h>
|
|
||||||
#elif defined(PSP)
|
|
||||||
#include <pspthreadman.h>
|
|
||||||
#include <psputils.h>
|
|
||||||
#elif defined(VITA)
|
|
||||||
#include <psp2/kernel/threadmgr.h>
|
|
||||||
#elif defined(_3DS)
|
|
||||||
#include <3ds.h>
|
|
||||||
#elif defined(_WIN32) && !defined(_XBOX)
|
|
||||||
#include <windows.h>
|
|
||||||
#elif defined(_XBOX)
|
|
||||||
#include <xtl.h>
|
|
||||||
#else
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* retro_sleep:
|
|
||||||
* @msec : amount in milliseconds to sleep
|
|
||||||
*
|
|
||||||
* Sleeps for a specified amount of milliseconds (@msec).
|
|
||||||
**/
|
|
||||||
static INLINE void retro_sleep(unsigned msec)
|
|
||||||
{
|
|
||||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
|
||||||
sys_timer_usleep(1000 * msec);
|
|
||||||
#elif defined(PSP) || defined(VITA)
|
|
||||||
sceKernelDelayThread(1000 * msec);
|
|
||||||
#elif defined(_3DS)
|
|
||||||
svcSleepThread(1000000 * (s64)msec);
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
Sleep(msec);
|
|
||||||
#elif defined(XENON)
|
|
||||||
udelay(1000 * msec);
|
|
||||||
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
|
|
||||||
usleep(1000 * msec);
|
|
||||||
#else
|
|
||||||
struct timespec tv = {0};
|
|
||||||
tv.tv_sec = msec / 1000;
|
|
||||||
tv.tv_nsec = (msec % 1000) * 1000000;
|
|
||||||
nanosleep(&tv, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(_MSC_VER)
|
#if defined(__cplusplus) && !defined(_MSC_VER)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -85,7 +85,7 @@ static int network_interface_up(struct sockaddr_in *target, int index,
|
||||||
if (state == CELL_NET_CTL_STATE_IPObtained)
|
if (state == CELL_NET_CTL_STATE_IPObtained)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rarch_sleep(500);
|
retro_sleep(500);
|
||||||
timeout_count--;
|
timeout_count--;
|
||||||
if (index && timeout_count < 0)
|
if (index && timeout_count < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1126,7 +1126,7 @@ int rarch_main_iterate(unsigned *sleep_ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings->video.frame_delay > 0) && !driver->nonblock_state)
|
if ((settings->video.frame_delay > 0) && !driver->nonblock_state)
|
||||||
rarch_sleep(settings->video.frame_delay);
|
retro_sleep(settings->video.frame_delay);
|
||||||
|
|
||||||
/* Run libretro for one frame. */
|
/* Run libretro for one frame. */
|
||||||
pretro_run();
|
pretro_run();
|
||||||
|
|
|
@ -216,7 +216,7 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf,
|
||||||
* Ideally use an event-based joypad scheme,
|
* Ideally use an event-based joypad scheme,
|
||||||
* but it adds far more complexity, so, meh.
|
* but it adds far more complexity, so, meh.
|
||||||
*/
|
*/
|
||||||
rarch_sleep(10);
|
retro_sleep(10);
|
||||||
|
|
||||||
if (timeout_ticks)
|
if (timeout_ticks)
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,7 +212,7 @@ static void poll_iteration(void)
|
||||||
poll_iteration();
|
poll_iteration();
|
||||||
ret = rarch_main_iterate(&sleep_ms);
|
ret = rarch_main_iterate(&sleep_ms);
|
||||||
if (ret == 1 && sleep_ms > 0)
|
if (ret == 1 && sleep_ms > 0)
|
||||||
rarch_sleep(sleep_ms);
|
retro_sleep(sleep_ms);
|
||||||
rarch_main_data_iterate();
|
rarch_main_data_iterate();
|
||||||
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource);
|
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ static void rarch_draw_observer(CFRunLoopObserverRef observer,
|
||||||
int ret = rarch_main_iterate(&sleep_ms);
|
int ret = rarch_main_iterate(&sleep_ms);
|
||||||
|
|
||||||
if (ret == 1 && !ui_companion_is_on_foreground() && sleep_ms > 0)
|
if (ret == 1 && !ui_companion_is_on_foreground() && sleep_ms > 0)
|
||||||
rarch_sleep(sleep_ms);
|
retro_sleep(sleep_ms);
|
||||||
rarch_main_data_iterate();
|
rarch_main_data_iterate();
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
|
|
Loading…
Reference in New Issue