forked from dolphin-emu/dolphin
Fix framelimiter's accuracy, thanks to sskkiipp !(issue 1237)
Also added an "auto" mode which automatically limits the framerate to fullspeed and move it from Interface settings to Basic setttings git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3934 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -602,38 +602,33 @@ 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
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Custom frame limiter
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
u32 targetfps = SConfig::GetInstance().m_Framelimit * 5;
|
||||
|
||||
u32 targetfps = (SConfig::GetInstance().m_Framelimit)*5;
|
||||
u64 new_frametime;
|
||||
s16 wait_frametime;
|
||||
if (targetfps > 5)
|
||||
{
|
||||
double wait_frametime = (1000.0 / targetfps);
|
||||
|
||||
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);
|
||||
}
|
||||
while (Timer.GetTimeDifference() < wait_frametime * frames)
|
||||
Common::SleepCurrentThread(1);
|
||||
}
|
||||
else if (targetfps < 5)
|
||||
{
|
||||
double wait_frametime = (1000.0 / VideoInterface::TargetRefreshRate);
|
||||
|
||||
while (Timer.GetTimeDifference() < wait_frametime * videoupd)
|
||||
Common::SleepCurrentThread(1);
|
||||
}
|
||||
|
||||
if (Timer.GetTimeDifference() >= 1000)
|
||||
{
|
||||
// reset timer for framelimiter, placed here so no additional check for 1000ms is required -> don't delete please :)
|
||||
old_frametime = 0;
|
||||
|
||||
// Time passed
|
||||
float t = (float)(Timer.GetTimeDifference()) / 1000.f;
|
||||
|
||||
@@ -656,7 +651,8 @@ void Callback_VideoCopiedToXFB(bool video_update)
|
||||
float FPS = (float)frames / t;
|
||||
// for some reasons "VideoInterface::ActualRefreshRate" gives some odd results :(
|
||||
float VPS = (float)videoupd / t;
|
||||
int TargetVPS = (int)VideoInterface::TargetRefreshRate;
|
||||
|
||||
int TargetVPS = (int)(VideoInterface::TargetRefreshRate + 0.5);
|
||||
|
||||
float Speed = (VPS / TargetVPS) * 100.0f;
|
||||
|
||||
|
@@ -174,8 +174,8 @@ void CConfigMain::CreateGUIControls()
|
||||
// GUI
|
||||
arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang;
|
||||
// Framelimit
|
||||
arrayStringFor_Framelimit.Add(wxT("auto"));
|
||||
arrayStringFor_Framelimit.Add(wxT("off"));
|
||||
arrayStringFor_Framelimit.Add(wxT("5"));
|
||||
arrayStringFor_Framelimit.Add(wxT("10"));
|
||||
arrayStringFor_Framelimit.Add(wxT("15"));
|
||||
arrayStringFor_Framelimit.Add(wxT("20"));
|
||||
@@ -213,6 +213,12 @@ void CConfigMain::CreateGUIControls()
|
||||
SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
|
||||
EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
EnableCheats->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats);
|
||||
|
||||
// Framelimit
|
||||
wxStaticText *FramelimitText = new wxStaticText(GeneralPage, ID_FRAMELIMIT_TEXT, wxT("Framelimit :"), wxDefaultPosition, wxDefaultSize);
|
||||
Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator);
|
||||
Framelimit->SetSelection(SConfig::GetInstance().m_Framelimit);
|
||||
|
||||
// Core Settings - Advanced
|
||||
AlwaysUseHLEBIOS = new wxCheckBox(GeneralPage, ID_ALLWAYS_HLEBIOS, wxT("HLE the BIOS all the time"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
AlwaysUseHLEBIOS->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios);
|
||||
@@ -256,12 +262,7 @@ void CConfigMain::CreateGUIControls()
|
||||
// need redesign
|
||||
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
|
||||
|
||||
// Choose Framelimit
|
||||
wxStaticText *FramelimitText = new wxStaticText(GeneralPage, ID_FRAMELIMIT_TEXT, wxT("Framelimit (experimental):"), wxDefaultPosition, wxDefaultSize);
|
||||
Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator);
|
||||
Framelimit->SetSelection(SConfig::GetInstance().m_Framelimit);
|
||||
|
||||
// Themes
|
||||
// Themes - this should really be a wxChoice...
|
||||
wxArrayString ThemeChoices;
|
||||
ThemeChoices.Add(wxT("Boomy"));
|
||||
ThemeChoices.Add(wxT("Vista"));
|
||||
@@ -290,6 +291,7 @@ void CConfigMain::CreateGUIControls()
|
||||
|
||||
InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
|
||||
wxT("\nthe game list of PAL GC games."));
|
||||
|
||||
// Copyright notice
|
||||
Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
|
||||
Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
|
||||
@@ -302,6 +304,11 @@ void CConfigMain::CreateGUIControls()
|
||||
sbBasic->Add(UseDualCore, 0, wxALL, 5);
|
||||
sbBasic->Add(SkipIdle, 0, wxALL, 5);
|
||||
sbBasic->Add(EnableCheats, 0, wxALL, 5);
|
||||
wxBoxSizer *sFramelimit = new wxBoxSizer(wxHORIZONTAL);
|
||||
sFramelimit->Add(FramelimitText, 0, wxALL | wxALIGN_CENTER, 1);
|
||||
sFramelimit->Add(Framelimit, 0, wxALL | wxEXPAND, 5);
|
||||
sbBasic->Add(sFramelimit, 0, wxALL | wxEXPAND, 5);
|
||||
|
||||
sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
|
||||
sbAdvanced->Add(AlwaysUseHLEBIOS, 0, wxALL, 5);
|
||||
sbAdvanced->Add(UseDynaRec, 0, wxALL, 5);
|
||||
@@ -330,10 +337,6 @@ void CConfigMain::CreateGUIControls()
|
||||
sInterfaceLanguage->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sInterfaceLanguage->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
|
||||
sbInterface->Add(sInterfaceLanguage, 0, wxEXPAND | wxALL, 5);
|
||||
wxBoxSizer *sFramelimit = new wxBoxSizer(wxHORIZONTAL);
|
||||
sFramelimit->Add(FramelimitText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sFramelimit->Add(Framelimit, 0, wxEXPAND | wxALL, 5);
|
||||
sbInterface->Add(sFramelimit, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
// Populate the entire page
|
||||
sGeneralPage = new wxBoxSizer(wxVERTICAL);
|
||||
|
@@ -681,7 +681,6 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
|
||||
}
|
||||
|
||||
// Make sure to resolve anything we need to read from.
|
||||
// TODO - it seems that it sometimes doesn't resolve the entire area we are interested in. See shadows in Burnout 2.
|
||||
GLuint read_texture = bFromZBuffer ? Renderer::ResolveAndGetDepthTarget(source_rect) : Renderer::ResolveAndGetRenderTarget(source_rect);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
Reference in New Issue
Block a user