This should fix the framelimiter, looks a bit inaccurate though (was it like that already ?)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3929 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s 2009-08-02 17:04:21 +00:00
parent a56a07056d
commit a9cf2e09d0

View File

@ -602,29 +602,31 @@ void Callback_VideoCopiedToXFB(bool video_update)
static Common::Timer Timer;
static u32 frames = 0;
static u32 videoupd = 0;
static u64 old_frametime=0;
if (video_update)
videoupd++;
else
{
frames++;
// Custom frame limiter
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
u32 targetfps = (SConfig::GetInstance().m_Framelimit)*5;
static u64 old_frametime=0;
u64 new_frametime;
s16 wait_frametime;
// Custom frame limiter
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
if (targetfps > 0)
{
new_frametime = Timer.GetTimeDifference() - old_frametime;
old_frametime = Timer.GetTimeDifference();
wait_frametime = (1000/targetfps) - (u16)new_frametime;
if (targetfps < 35)
wait_frametime--;
if (wait_frametime > 0)
Common::SleepCurrentThread(wait_frametime*2);
u32 targetfps = (SConfig::GetInstance().m_Framelimit)*5;
u64 new_frametime;
s16 wait_frametime;
if (targetfps > 0)
{
new_frametime = Timer.GetTimeDifference() - old_frametime;
old_frametime = Timer.GetTimeDifference();
wait_frametime = (1000/targetfps) - (u16)new_frametime;
if (targetfps < 35)
wait_frametime--;
if (wait_frametime > 0)
Common::SleepCurrentThread(wait_frametime*2);
}
}
if (Timer.GetTimeDifference() >= 1000)