Commit 7de91c80 authored by bbbradsmith's avatar bbbradsmith
Browse files

remove hatari's internal wait/synchronization and let libretro control timing directly

parent d7c26374
......@@ -124,37 +124,15 @@ long GetTicks(void)
}
#ifdef WIIU
#include <features/features_cpu.h>
retro_time_t current_tus=0,last_tus=0;
#endif
int slowdown=0;
//NO SURE FIND BETTER WAY TO COME BACK IN MAIN THREAD IN HATARI GUI
void gui_poll_events(void)
{
#ifdef WIIU
current_tus=cpu_features_get_time_usec();
current_tus/=1000;
if(current_tus - last_tus >= 1000/50)
{
slowdown=0;
frame++;
last_tus = current_tus;
co_switch(mainThread);
}
#else
Ktime = GetTicks();
if(Ktime - LastFPSTime >= 1000/50)
{
slowdown=0;
frame++;
LastFPSTime = Ktime;
co_switch(mainThread);
}
#endif
slowdown=0;
frame++;
LastFPSTime = Ktime;
co_switch(mainThread);
}
//save bkg for screenshot
......
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (features_cpu.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_SDK_CPU_INFO_H
#define _LIBRETRO_SDK_CPU_INFO_H
#include <retro_common_api.h>
#include <stdint.h>
#include <libretro.h>
RETRO_BEGIN_DECLS
/**
* cpu_features_get_perf_counter:
*
* Gets performance counter.
*
* Returns: performance counter.
**/
retro_perf_tick_t cpu_features_get_perf_counter(void);
/**
* cpu_features_get_time_usec:
*
* Gets time in microseconds, from an undefined epoch.
* The epoch may change between computers or across reboots.
*
* Returns: time in microseconds
**/
retro_time_t cpu_features_get_time_usec(void);
/**
* cpu_features_get:
*
* Gets CPU features.
*
* Returns: bitmask of all CPU features available.
**/
uint64_t cpu_features_get(void);
/**
* cpu_features_get_core_amount:
*
* Gets the amount of available CPU cores.
*
* Returns: amount of CPU cores available.
**/
unsigned cpu_features_get_core_amount(void);
void cpu_features_get_model_name(char *name, int len);
RETRO_END_DECLS
#endif
......@@ -330,7 +330,13 @@ return;
// FrameDuration_micro = (Sint64) ( 1000000.0 / nScreenRefreshRate + 0.5 ); /* round to closest integer */
FrameDuration_micro = ClocksTimings_GetVBLDuration_micro ( ConfigureParams.System.nMachineType , nScreenRefreshRate );
FrameDuration_micro *= nVBLSlowdown;
#ifdef __LIBRETRO__
/* Libretro is responsible for synchronizing the timing, allowing it to drive fast-forward, etc. Every time this point
is reached, we must assume we're ready for exactly the next frame. */
CurrentTicks = DestTicks;
#else
CurrentTicks = Time_GetTicks();
#endif
if (DestTicks == 0) /* on first call, init DestTicks */
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment