summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2009-06-09 21:27:45 +0000
committerhrydgard <hrydgard@gmail.com>2009-06-09 21:27:45 +0000
commit6f845b8bb0188ba59b5665aefa04dd247e9ecc80 (patch)
treea919fec5124e5b342e52513dbb3a9c17d31015ed /Source/Core
parentda30c24c5e85178091b8773f5edf9f0832ae8a32 (diff)
Patch in Iulius' framelimiter, since it has advantages over "Other Audio" in many games (more speed).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3397 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/ConfigManager.h2
-rw-r--r--Source/Core/Core/Src/Core.cpp30
-rw-r--r--Source/Core/Core/Src/HW/SystemTimers.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp28
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.h4
5 files changed, 61 insertions, 5 deletions
diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h
index fa9bd39854..fe1ab6df5b 100644
--- a/Source/Core/Core/Src/ConfigManager.h
+++ b/Source/Core/Core/Src/ConfigManager.h
@@ -65,6 +65,8 @@ struct SConfig
// interface language
INTERFACE_LANGUAGE m_InterfaceLanguage;
+ // framelimit choose
+ u32 m_InterfaceFramelimit;
// other interface settings
bool m_InterfaceToolbar;
bool m_InterfaceStatusbar;
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index 93a6fd4b0b..6b51f24be0 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -664,20 +664,42 @@ void Callback_VideoCopiedToXFB()
static u64 ticks = 0;
static u64 idleTicks = 0;
+
+ u32 targetfps = (SConfig::GetInstance().m_InterfaceFramelimit)*5;
+ static u64 old_frametime=0;
+ u64 new_frametime;
+ s16 wait_frametime;
+
frames++;
-
+
+ if (targetfps>0)
+ {
+ new_frametime=Timer.GetTimeDifference()-old_frametime;
+
+ old_frametime=Timer.GetTimeDifference();
+
+ wait_frametime=((1000/targetfps)-new_frametime);
+ if (targetfps<35)
+ wait_frametime--;
+ if (wait_frametime>0)
+ Common::SleepCurrentThread(wait_frametime*2);
+ }
+
if (Timer.GetTimeDifference() >= 1000)
{
+ old_frametime=0;
+
u64 newTicks = CoreTiming::GetTicks();
u64 newIdleTicks = CoreTiming::GetIdleTicks();
-
+
s64 diff = (newTicks - ticks) / 1000000;
s64 idleDiff = (newIdleTicks - idleTicks) / 1000000;
-
+
ticks = newTicks;
idleTicks = newIdleTicks;
float t = (float)(Timer.GetTimeDifference()) / 1000.f;
+
char temp[256];
sprintf(temp, "FPS:%8.2f - Core: %s | %s - Speed: %i MHz [Real: %i + IdleSkip: %i] / %i MHz",
(float)frames / t,
@@ -709,7 +731,7 @@ void Callback_VideoCopiedToXFB()
Timer.Update();
}
}
-
+
// __________________________________________________________________________________________________
// Callback_DSPLog
// WARNING - THIS MAY EXECUTED FROM DSP THREAD
diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp
index 4c83e0de40..8b5ec04c73 100644
--- a/Source/Core/Core/Src/HW/SystemTimers.cpp
+++ b/Source/Core/Core/Src/HW/SystemTimers.cpp
@@ -237,7 +237,7 @@ void FakeGPWatchdogCallback(u64 userdata, int cyclesLate)
void Init()
{
- FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / 15;
+ FAKE_GP_WATCHDOG_PERIOD = GetTicksPerSecond() / 60;
if (Core::GetStartupParameter().bWii)
{
CPU_CORE_CLOCK = 729000000u;
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index afbf970402..0361df6ba6 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -45,6 +45,7 @@ EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_LEDS, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_SPEAKERS, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged)
+EVT_CHOICE(ID_INTERFACE_FRAMELIMIT, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_ALLWAYS_HLEBIOS, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_USEDYNAREC, CConfigMain::CoreSettingsChanged)
@@ -172,6 +173,20 @@ void CConfigMain::CreateGUIControls()
arrayStringFor_WiiSystemLang.Add(wxT("Korean"));
// GUI
arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang;
+ // Framelimit
+ 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"));
+ arrayStringFor_Framelimit.Add(wxT("25"));
+ arrayStringFor_Framelimit.Add(wxT("30"));
+ arrayStringFor_Framelimit.Add(wxT("35"));
+ arrayStringFor_Framelimit.Add(wxT("40"));
+ arrayStringFor_Framelimit.Add(wxT("45"));
+ arrayStringFor_Framelimit.Add(wxT("50"));
+ arrayStringFor_Framelimit.Add(wxT("55"));
+ arrayStringFor_Framelimit.Add(wxT("60"));
// Create the notebook and pages
Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
@@ -241,6 +256,11 @@ void CConfigMain::CreateGUIControls()
// need redesign
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
+ // Choose Framelimit
+ wxStaticText *InterfaceFramelimitText = new wxStaticText(GeneralPage, ID_INTERFACE_FRAMELIMIT_TEXT, wxT("Framelimit (experimental):"), wxDefaultPosition, wxDefaultSize);
+ InterfaceFramelimit = new wxChoice(GeneralPage, ID_INTERFACE_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator);
+ InterfaceFramelimit->SetSelection(SConfig::GetInstance().m_InterfaceFramelimit);
+
// Themes
wxArrayString ThemeChoices;
ThemeChoices.Add(wxT("Boomy"));
@@ -311,6 +331,10 @@ 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 *sInterfaceFramelimit = new wxBoxSizer(wxHORIZONTAL);
+ sInterfaceFramelimit->Add(InterfaceFramelimitText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
+ sInterfaceFramelimit->Add(InterfaceFramelimit, 0, wxEXPAND | wxALL, 5);
+ sbInterface->Add(sInterfaceFramelimit, 0, wxEXPAND | wxALL, 5);
// Populate the entire page
sGeneralPage = new wxBoxSizer(wxVERTICAL);
@@ -631,6 +655,10 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
bRefreshList = true;
break;
+ case ID_INTERFACE_FRAMELIMIT:
+ SConfig::GetInstance().m_InterfaceFramelimit = (u32)InterfaceFramelimit->GetSelection();
+ bRefreshList = true;
+ break;
case ID_ALLWAYS_HLEBIOS: // Core
SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios = AlwaysUseHLEBIOS->IsChecked();
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h
index e9de7cd613..68fe8234e5 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.h
+++ b/Source/Core/DolphinWX/Src/ConfigMain.h
@@ -56,6 +56,9 @@ class CConfigMain
wxArrayString arrayStringFor_InterfaceLang;
wxChoice* InterfaceLang;
+ wxArrayString arrayStringFor_Framelimit;
+ wxChoice* InterfaceFramelimit;
+
wxRadioBox* Theme;
wxBoxSizer* sCore;
@@ -226,6 +229,7 @@ class CConfigMain
ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS,
ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
ID_INTERFACE_THEME,
+ ID_INTERFACE_FRAMELIMIT_TEXT, ID_INTERFACE_FRAMELIMIT,
ID_GC_SRAM_LNG_TEXT,
ID_GC_SRAM_LNG,