Added compilation flag to disable timekeeping for frontends that handle fps keeping on their own
This commit is contained in:
parent
a50aa2486b
commit
7c0ad24175
@ -6,6 +6,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DISABLE_TIMEKEEPING
|
||||||
static int64_t get_nanoseconds(void)
|
static int64_t get_nanoseconds(void)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -19,7 +20,6 @@ static int64_t get_nanoseconds(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
static void nsleep(uint64_t nanoseconds)
|
static void nsleep(uint64_t nanoseconds)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -35,7 +35,6 @@ static void nsleep(uint64_t nanoseconds)
|
|||||||
CloseHandle(timer);
|
CloseHandle(timer);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool GB_timing_sync_turbo(GB_gameboy_t *gb)
|
bool GB_timing_sync_turbo(GB_gameboy_t *gb)
|
||||||
{
|
{
|
||||||
@ -61,9 +60,7 @@ void GB_timing_sync(GB_gameboy_t *gb)
|
|||||||
uint64_t target_nanoseconds = gb->cycles_since_last_sync * FRAME_LENGTH / LCDC_PERIOD;
|
uint64_t target_nanoseconds = gb->cycles_since_last_sync * FRAME_LENGTH / LCDC_PERIOD;
|
||||||
int64_t nanoseconds = get_nanoseconds();
|
int64_t nanoseconds = get_nanoseconds();
|
||||||
if (labs((signed long)(nanoseconds - gb->last_sync)) < target_nanoseconds ) {
|
if (labs((signed long)(nanoseconds - gb->last_sync)) < target_nanoseconds ) {
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
nsleep(target_nanoseconds + gb->last_sync - nanoseconds);
|
nsleep(target_nanoseconds + gb->last_sync - nanoseconds);
|
||||||
#endif
|
|
||||||
gb->last_sync += target_nanoseconds;
|
gb->last_sync += target_nanoseconds;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -72,7 +69,18 @@ void GB_timing_sync(GB_gameboy_t *gb)
|
|||||||
|
|
||||||
gb->cycles_since_last_sync = 0;
|
gb->cycles_since_last_sync = 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
bool GB_timing_sync_turbo(GB_gameboy_t *gb)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GB_timing_sync(GB_gameboy_t *gb)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
static void GB_ir_run(GB_gameboy_t *gb)
|
static void GB_ir_run(GB_gameboy_t *gb)
|
||||||
{
|
{
|
||||||
if (gb->ir_queue_length == 0) return;
|
if (gb->ir_queue_length == 0) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user