mirror of
https://github.com/Oibaf66/uae-wii.git
synced 2024-11-14 23:05:08 +01:00
Fixed TOD CIA hack (gettimeofday is buggy in libogc). Used with synchronized_clock=true
This commit is contained in:
parent
4d454cb4a3
commit
864f1b21ce
12
src/cia.c
12
src/cia.c
@ -37,6 +37,10 @@
|
||||
# include "arcadia.h"
|
||||
#endif
|
||||
|
||||
#ifdef GEKKO
|
||||
# include "ogc/lwp_watchdog.h"
|
||||
#endif
|
||||
|
||||
//#define CIA_DEBUG_R
|
||||
//#define CIA_DEBUG_W
|
||||
//#define DONGLE_DEBUG
|
||||
@ -408,8 +412,12 @@ static void tod_hack_reset (void)
|
||||
{
|
||||
struct timeval tv;
|
||||
uae_u32 rate = currprefs.ntscmode ? 60 : 50;
|
||||
#ifdef GEKKO //gettimeofday is buggy in libogc
|
||||
tod_hack = (uae_u32) ((ticks_to_microsecs(gettick())/(1000000 / rate)));
|
||||
#else
|
||||
gettimeofday (&tv, NULL);
|
||||
tod_hack = (uae_u32)(((uae_u64)tv.tv_sec) * rate + tv.tv_usec / (1000000 / rate));
|
||||
#endif
|
||||
tod_hack -= ciaatod;
|
||||
tod_hack_delay = 10 * 50;
|
||||
}
|
||||
@ -431,8 +439,12 @@ void CIA_vsync_handler ()
|
||||
}
|
||||
}
|
||||
if (tod_hack_delay == 0) {
|
||||
#ifdef GEKKO //gettimeofday is buggy in libogc
|
||||
t = (uae_u32) ((ticks_to_microsecs(gettick())/(1000000 / rate)));
|
||||
#else
|
||||
gettimeofday (&tv, NULL);
|
||||
t = (uae_u32)(((uae_u64)tv.tv_sec) * rate + tv.tv_usec / (1000000 / rate));
|
||||
#endif
|
||||
nt = t - tod_hack;
|
||||
if ((nt < ciaatod && ciaatod - nt < 10) || nt == ciaatod)
|
||||
return; /* try not to count backwards */
|
||||
|
Loading…
Reference in New Issue
Block a user