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:
parent
8c36e85b34
commit
8b0bc273c5
|
@ -602,38 +602,33 @@ void Callback_VideoCopiedToXFB(bool video_update)
|
||||||
static Common::Timer Timer;
|
static Common::Timer Timer;
|
||||||
static u32 frames = 0;
|
static u32 frames = 0;
|
||||||
static u32 videoupd = 0;
|
static u32 videoupd = 0;
|
||||||
static u64 old_frametime=0;
|
|
||||||
|
|
||||||
if (video_update)
|
if (video_update)
|
||||||
videoupd++;
|
videoupd++;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
frames++;
|
frames++;
|
||||||
|
|
||||||
// Custom frame limiter
|
// Custom frame limiter
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
|
u32 targetfps = SConfig::GetInstance().m_Framelimit * 5;
|
||||||
|
|
||||||
u32 targetfps = (SConfig::GetInstance().m_Framelimit)*5;
|
if (targetfps > 5)
|
||||||
u64 new_frametime;
|
|
||||||
s16 wait_frametime;
|
|
||||||
|
|
||||||
if (targetfps > 0)
|
|
||||||
{
|
{
|
||||||
new_frametime = Timer.GetTimeDifference() - old_frametime;
|
double wait_frametime = (1000.0 / targetfps);
|
||||||
old_frametime = Timer.GetTimeDifference();
|
|
||||||
wait_frametime = (1000/targetfps) - (u16)new_frametime;
|
while (Timer.GetTimeDifference() < wait_frametime * frames)
|
||||||
if (targetfps < 35)
|
Common::SleepCurrentThread(1);
|
||||||
wait_frametime--;
|
|
||||||
if (wait_frametime > 0)
|
|
||||||
Common::SleepCurrentThread(wait_frametime*2);
|
|
||||||
}
|
}
|
||||||
|
else if (targetfps < 5)
|
||||||
|
{
|
||||||
|
double wait_frametime = (1000.0 / VideoInterface::TargetRefreshRate);
|
||||||
|
|
||||||
|
while (Timer.GetTimeDifference() < wait_frametime * videoupd)
|
||||||
|
Common::SleepCurrentThread(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Timer.GetTimeDifference() >= 1000)
|
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
|
// Time passed
|
||||||
float t = (float)(Timer.GetTimeDifference()) / 1000.f;
|
float t = (float)(Timer.GetTimeDifference()) / 1000.f;
|
||||||
|
|
||||||
|
@ -656,7 +651,8 @@ void Callback_VideoCopiedToXFB(bool video_update)
|
||||||
float FPS = (float)frames / t;
|
float FPS = (float)frames / t;
|
||||||
// for some reasons "VideoInterface::ActualRefreshRate" gives some odd results :(
|
// for some reasons "VideoInterface::ActualRefreshRate" gives some odd results :(
|
||||||
float VPS = (float)videoupd / t;
|
float VPS = (float)videoupd / t;
|
||||||
int TargetVPS = (int)VideoInterface::TargetRefreshRate;
|
|
||||||
|
int TargetVPS = (int)(VideoInterface::TargetRefreshRate + 0.5);
|
||||||
|
|
||||||
float Speed = (VPS / TargetVPS) * 100.0f;
|
float Speed = (VPS / TargetVPS) * 100.0f;
|
||||||
|
|
||||||
|
|
|
@ -174,8 +174,8 @@ void CConfigMain::CreateGUIControls()
|
||||||
// GUI
|
// GUI
|
||||||
arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang;
|
arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang;
|
||||||
// Framelimit
|
// Framelimit
|
||||||
|
arrayStringFor_Framelimit.Add(wxT("auto"));
|
||||||
arrayStringFor_Framelimit.Add(wxT("off"));
|
arrayStringFor_Framelimit.Add(wxT("off"));
|
||||||
arrayStringFor_Framelimit.Add(wxT("5"));
|
|
||||||
arrayStringFor_Framelimit.Add(wxT("10"));
|
arrayStringFor_Framelimit.Add(wxT("10"));
|
||||||
arrayStringFor_Framelimit.Add(wxT("15"));
|
arrayStringFor_Framelimit.Add(wxT("15"));
|
||||||
arrayStringFor_Framelimit.Add(wxT("20"));
|
arrayStringFor_Framelimit.Add(wxT("20"));
|
||||||
|
@ -213,6 +213,12 @@ void CConfigMain::CreateGUIControls()
|
||||||
SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
|
SkipIdle->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle);
|
||||||
EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
EnableCheats->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats);
|
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
|
// Core Settings - Advanced
|
||||||
AlwaysUseHLEBIOS = new wxCheckBox(GeneralPage, ID_ALLWAYS_HLEBIOS, wxT("HLE the BIOS all the time"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
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);
|
AlwaysUseHLEBIOS->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios);
|
||||||
|
@ -256,12 +262,7 @@ void CConfigMain::CreateGUIControls()
|
||||||
// need redesign
|
// need redesign
|
||||||
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
|
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
|
||||||
|
|
||||||
// Choose Framelimit
|
// Themes - this should really be a wxChoice...
|
||||||
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
|
|
||||||
wxArrayString ThemeChoices;
|
wxArrayString ThemeChoices;
|
||||||
ThemeChoices.Add(wxT("Boomy"));
|
ThemeChoices.Add(wxT("Boomy"));
|
||||||
ThemeChoices.Add(wxT("Vista"));
|
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")
|
InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
|
||||||
wxT("\nthe game list of PAL GC games."));
|
wxT("\nthe game list of PAL GC games."));
|
||||||
|
|
||||||
// Copyright notice
|
// Copyright notice
|
||||||
Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
|
Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
|
||||||
Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
|
Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
|
||||||
|
@ -302,6 +304,11 @@ void CConfigMain::CreateGUIControls()
|
||||||
sbBasic->Add(UseDualCore, 0, wxALL, 5);
|
sbBasic->Add(UseDualCore, 0, wxALL, 5);
|
||||||
sbBasic->Add(SkipIdle, 0, wxALL, 5);
|
sbBasic->Add(SkipIdle, 0, wxALL, 5);
|
||||||
sbBasic->Add(EnableCheats, 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 = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
|
||||||
sbAdvanced->Add(AlwaysUseHLEBIOS, 0, wxALL, 5);
|
sbAdvanced->Add(AlwaysUseHLEBIOS, 0, wxALL, 5);
|
||||||
sbAdvanced->Add(UseDynaRec, 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(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
sInterfaceLanguage->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
|
sInterfaceLanguage->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
|
||||||
sbInterface->Add(sInterfaceLanguage, 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
|
// Populate the entire page
|
||||||
sGeneralPage = new wxBoxSizer(wxVERTICAL);
|
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.
|
// 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);
|
GLuint read_texture = bFromZBuffer ? Renderer::ResolveAndGetDepthTarget(source_rect) : Renderer::ResolveAndGetRenderTarget(source_rect);
|
||||||
|
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
Loading…
Reference in New Issue