Use frame counter instead of real clock

This commit is contained in:
Vladimir Serbinenko
2020-04-20 13:29:59 +02:00
parent 2322284eda
commit 6b1dc161dc
3 changed files with 7 additions and 42 deletions
-41
View File
@@ -16,17 +16,6 @@ char DISKA_NAME[512]="\0";
char DISKB_NAME[512]="\0";
char TAPE_NAME[512]="\0";
//TIME
#ifdef __CELLOS_LV2__
#include "sys/sys_time.h"
#include "sys/timer.h"
#define usleep sys_timer_usleep
#else
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#endif
extern void Screen_SetFullUpdate(int scr);
long frame=0;
@@ -103,36 +92,6 @@ void retro_set_input_poll(retro_input_poll_t cb)
input_poll_cb = cb;
}
long GetTicks(void)
{ // in MSec
#ifndef _ANDROID_
#ifdef __CELLOS_LV2__
//#warning "GetTick PS3\n"
unsigned long ticks_micro;
uint64_t secs;
uint64_t nsecs;
sys_time_get_current_time(&secs, &nsecs);
ticks_micro = secs * 1000000UL + (nsecs / 1000);
return ticks_micro;///1000;
#else
struct timeval tv;
gettimeofday (&tv, NULL);
return (tv.tv_sec*1000000 + tv.tv_usec);///1000;
#endif
#else
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return (now.tv_sec*1000000 + now.tv_nsec/1000);///1000;
#endif
}
int slowdown=0;
#if defined(ANDROID) || defined(__ANDROID__)
+3
View File
@@ -31,6 +31,7 @@ int retrojoy_init=0,retro_ui_finalized=0;
int retro_sound_finalized=0;
float retro_fps=49.8607597;
long long retro_frame_counter;
extern int ToggleTV;
extern int CURRENT_TV;
@@ -621,6 +622,8 @@ void retro_run(void)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
update_variables();
retro_frame_counter++;
if(pauseg==0){
if (ToggleTV == 1)
+4 -1
View File
@@ -647,9 +647,12 @@ void PLATFORM_DisplayScreen(void)
retro_Render();
}
extern float retro_fps;
extern long long retro_frame_counter;
double PLATFORM_Time(void)
{
return GetTicks()/1000 ;//* 1e-3;
return retro_frame_counter * (1000.0 / retro_fps);
}
void PLATFORM_PaletteUpdate(void)