mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 07:21:15 +00:00
(WIIU) add timers, fix retro_sleep.
This commit is contained in:
parent
82d3629dac
commit
31edafde03
@ -262,7 +262,7 @@ int __entry_menu(int argc, char **argv)
|
||||
#if 0
|
||||
int argc_ = 2;
|
||||
// char* argv_[] = {"sd:/retroarch/retroarch.elf", "sd:/rom.nes", NULL};
|
||||
char* argv_[] = {"sd:/retroarch/retroarch.elf", "sd:/content/rom.sfc", NULL};
|
||||
char* argv_[] = {"sd:/retroarch/retroarch.elf", "sd:/rom.sfc", NULL};
|
||||
|
||||
rarch_main(argc_, argv_, NULL);
|
||||
#else
|
||||
@ -274,8 +274,8 @@ int __entry_menu(int argc, char **argv)
|
||||
unsigned sleep_ms = 0;
|
||||
int ret = runloop_iterate(&sleep_ms);
|
||||
|
||||
// if (ret == 1 && sleep_ms > 0)
|
||||
// retro_sleep(sleep_ms);
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
|
||||
if (ret == -1)
|
||||
break;
|
||||
|
@ -73,6 +73,11 @@
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIIU
|
||||
#include <coreinit/time.h>
|
||||
#include "wiiu/system/wiiu.h"
|
||||
#endif
|
||||
|
||||
#if defined(_3DS)
|
||||
#include <3ds/svc.h>
|
||||
#include <3ds/os.h>
|
||||
@ -169,7 +174,7 @@ retro_perf_tick_t cpu_features_get_perf_counter(void)
|
||||
#elif defined(_3DS)
|
||||
time_ticks = svcGetSystemTick();
|
||||
#elif defined(WIIU)
|
||||
time_ticks = 0;
|
||||
time_ticks = OSGetSystemTime();
|
||||
#elif defined(__mips__)
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv,NULL);
|
||||
@ -219,7 +224,7 @@ retro_time_t cpu_features_get_time_usec(void)
|
||||
#elif defined(VITA)
|
||||
return sceKernelGetProcessTimeWide();
|
||||
#elif defined(WIIU)
|
||||
return 0;
|
||||
return ticks_to_us(OSGetSystemTime());
|
||||
#else
|
||||
#error "Your platform does not have a timer function implemented in cpu_features_get_time_usec(). Cannot continue."
|
||||
#endif
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <unistd.h>
|
||||
#elif defined(WIIU)
|
||||
#include <coreinit/thread.h>
|
||||
#include "system/wiiu.h"
|
||||
#elif defined(PSP)
|
||||
#include <pspthreadman.h>
|
||||
#elif defined(VITA)
|
||||
@ -103,7 +104,7 @@ static INLINE void retro_sleep(unsigned msec)
|
||||
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
|
||||
usleep(1000 * msec);
|
||||
#elif defined(WIIU)
|
||||
OSSleepTicks(((uint64_t)msec * 248625000)/4000000);
|
||||
OSSleepTicks(ms_to_ticks(msec));
|
||||
#else
|
||||
struct timespec tv = {0};
|
||||
tv.tv_sec = msec / 1000;
|
||||
|
18
wiiu/system/wiiu.h
Normal file
18
wiiu/system/wiiu.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef WIIU_H
|
||||
#define WIIU_H
|
||||
|
||||
#define wiiu_bus_clock (17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2*2*2) // 248.625000 Mhz
|
||||
#define wiiu_cpu_clock (17 * 13 * 5*5*5 * 5*5*5 * 5 * 3*3 * 2*2*2) // 1243.125000 Mhz
|
||||
#define wiiu_timer_clock (17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2) // 62.156250 Mhz
|
||||
|
||||
#define sec_to_ticks(s) (((17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2) * (uint64_t)(s)))
|
||||
#define ms_to_ticks(ms) (((17 * 13 * 5*5*5 * 3*3) * (uint64_t)(ms)) / (2*2))
|
||||
#define us_to_ticks(us) (((17 * 13 * 3*3) * (uint64_t)(us)) / (2*2* 2*2*2))
|
||||
#define ns_to_ticks(ns) (((17 * 13 * 3*3) * (uint64_t)(ns)) / (2*2* 2*2*2* 2*2*2 *5*5*5))
|
||||
|
||||
#define ticks_to_sec(ticks) (((uint64_t)(ticks)) / (17 * 13 * 5*5*5 * 5*5*5 * 3*3 * 2))
|
||||
#define ticks_to_ms(ticks) (((uint64_t)(ticks) * (2*2)) / (17 * 13 * 5*5*5 * 3*3))
|
||||
#define ticks_to_us(ticks) (((uint64_t)(ticks) * (2*2 * 2*2*2)) / (17 * 13 * 3*3))
|
||||
#define ticks_to_ns(ticks) (((uint64_t)(ticks) * (2*2 * 2*2*2 * 2*2*2 * 5*5*5)) / (17 * 13 * 3*3))
|
||||
|
||||
#endif // WIIU_H
|
@ -16,6 +16,7 @@ extern "C" {
|
||||
#define DEBUG_LINE() do{printf("%s:%d.\n",__FUNCTION__, __LINE__);fflush(stdout);}while(0)
|
||||
#define DEBUG_STR(X) printf( "%s: %s\n", #X, (char*)(X))
|
||||
#define DEBUG_VAR(X) printf( "%-20s: 0x%08X\n", #X, (u32)(X))
|
||||
#define DEBUG_VAR2(X) printf( "%-20s: 0x%08X (%i)\n", #X, (u32)(X), (int)(X))
|
||||
#define DEBUG_INT(X) printf( "%-20s: %10i\n", #X, (s32)(X))
|
||||
#define DEBUG_FLOAT(X) printf( "%-20s: %10.3f\n", #X, (float)(X))
|
||||
#define DEBUG_VAR64(X) printf( #X"\r\t\t\t\t : 0x%016llX\n", (u64)(X))
|
||||
|
Loading…
x
Reference in New Issue
Block a user