This should fix Issue 1960

Also makes VPS visible as sl1nk3 suggested, so that it won't confuse people with a wrong percentage of speed.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4791 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2010-01-08 11:25:51 +00:00
parent 9cbd508181
commit 9ed2d1957a
4 changed files with 38 additions and 44 deletions

View File

@ -125,10 +125,7 @@ void SConfig::SaveSettings()
// Plugins
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
ini.Set("Core", "Pad1Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[0]);
ini.Set("Core", "Pad2Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[1]);
ini.Set("Core", "Pad3Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[2]);
ini.Set("Core", "Pad4Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[3]);
ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin[0]);
ini.Set("Core", "WiiMote1Plugin",m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
}
@ -239,11 +236,7 @@ void SConfig::LoadSettings()
// Plugins
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
for (int i = 0; i < MAXPADS; i++)
{
std::string TmpName = StringFromFormat("Pad%iPlugin", (i + 1));
ini.Get("Core", TmpName.c_str(), &m_LocalCoreStartupParameter.m_strPadPlugin[i], m_DefaultPADPlugin.c_str());
}
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin[0], m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMote1Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str());
}

View File

@ -68,6 +68,7 @@ namespace Core
// Declarations and definitions
Common::Timer Timer;
volatile u32 DrawnFrame = 0;
u32 DrawnVideo = 0;
// Function forwarding
//void Callback_VideoRequestWindowSize(int _iWidth, int _iHeight, BOOL _bFullscreen);
@ -589,17 +590,16 @@ void ScreenShot()
// Apply Frame Limit and Display FPS info
// This should only be called from VI
void FrameThrottle()
void VideoThrottle()
{
u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1) ? SConfig::GetInstance().m_Framelimit * 5
u32 TargetVPS = (SConfig::GetInstance().m_Framelimit > 1) ? SConfig::GetInstance().m_Framelimit * 5
: VideoInterface::TargetRefreshRate;
u32 frames = Common::AtomicLoad(DrawnFrame);
// When frame limit is NOT off
if (frames && SConfig::GetInstance().m_Framelimit != 1)
if (SConfig::GetInstance().m_Framelimit != 1)
{
u32 frametime = frames * 1000 / TargetFPS;
while (Timer.GetTimeDifference() < frametime)
u32 frametime = DrawnVideo * 2 * 1000 / TargetVPS;
while ((u32)Timer.GetTimeDifference() < frametime)
//Common::YieldCPU();
Common::SleepCurrentThread(1);
}
@ -608,30 +608,14 @@ void FrameThrottle()
u32 ElapseTime = (u32)Timer.GetTimeDifference();
if (ElapseTime >= 1000)
{
SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
// Use extended or summary information. The summary information does not print the ticks data,
// that's more of a debugging interest, it can always be optional of course if someone is interested.
//#define EXTENDED_INFO
#ifdef EXTENDED_INFO
u64 newTicks = CoreTiming::GetTicks();
u64 newIdleTicks = CoreTiming::GetIdleTicks();
u64 diff = (newTicks - ticks) / 1000000;
u64 idleDiff = (newIdleTicks - idleTicks) / 1000000;
ticks = newTicks;
idleTicks = newIdleTicks;
float TicksPercentage = (float)diff / (float)(SystemTimers::GetTicksPerSecond() / 1000000) * 100;
#endif
u32 FPS = frames * 1000 / ElapseTime;
float Speed = (float)FPS / (float)TargetFPS * 100.0f;
u32 FPS = Common::AtomicLoad(DrawnFrame) * 1000 / ElapseTime;
u32 VPS = DrawnVideo * 2 * 1000 / ElapseTime;
u32 Speed = VPS * 100 / TargetVPS;
// Settings are shown the same for both extended and summary info
std::string SSettings = StringFromFormat(" | Core: %s %s",
std::string SSettings = StringFromFormat("Core: %s %s",
#if defined(JITTEST) && JITTEST
#ifdef _M_IX86
_CoreParameter.bUseJIT ? "JIT32IL" : "Int32",
@ -647,8 +631,22 @@ void FrameThrottle()
#endif
_CoreParameter.bCPUThread ? "DC" : "SC");
// Use extended or summary information. The summary information does not print the ticks data,
// that's more of a debugging interest, it can always be optional of course if someone is interested.
//#define EXTENDED_INFO
#ifdef EXTENDED_INFO
std::string SFPS = StringFromFormat("FPS: %i/%i (%3.0f%%)", FPS, TargetFPS, Speed);
u64 newTicks = CoreTiming::GetTicks();
u64 newIdleTicks = CoreTiming::GetIdleTicks();
u64 diff = (newTicks - ticks) / 1000000;
u64 idleDiff = (newIdleTicks - idleTicks) / 1000000;
ticks = newTicks;
idleTicks = newIdleTicks;
float TicksPercentage = (float)diff / (float)(SystemTimers::GetTicksPerSecond() / 1000000) * 100;
std::string SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed);
SFPS += StringFromFormat(" | CPU: %s%i MHz [Real: %i + IdleSkip: %i] / %i MHz (%s%3.0f%%)",
_CoreParameter.bSkipIdle ? "~" : "",
(int)(diff),
@ -659,11 +657,11 @@ void FrameThrottle()
TicksPercentage);
#else // Summary information
std::string SFPS = StringFromFormat("FPS: %i/%i (%3.0f%%)", FPS, TargetFPS, Speed);
std::string SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed);
#endif
// This is our final "frame counter" string
std::string SMessage = StringFromFormat("%s%s", SFPS.c_str(), SSettings.c_str());
std::string SMessage = StringFromFormat(" %s | %s", SSettings.c_str(), SFPS.c_str());
// Show message
if (g_pUpdateFPSDisplay != NULL)
@ -671,10 +669,13 @@ void FrameThrottle()
Host_UpdateStatusBar(SMessage.c_str());
// Reset frame counter
// Reset counter
Timer.Update();
Common::AtomicStore(DrawnFrame, 0);
DrawnVideo = 0;
}
DrawnVideo++;
}
// Executed from GPU thread

View File

@ -74,7 +74,7 @@ namespace Core
void StopTrace();
bool report_slow(int skipped);
void FrameThrottle();
void VideoThrottle();
// -----------------------------------------
#ifdef RERECORDING

View File

@ -1056,7 +1056,7 @@ static void EndField()
// Purpose: Send VI interrupt when triggered
// Run when: When every line is scaned
// Run when: When a line is scaned
void Update()
{
@ -1070,8 +1070,8 @@ void Update()
if (++m_VBeamPos > s_lineCount)
{
m_VBeamPos = 1;
// Apply frame throttle wheneven a full screen scan finishes
Core::FrameThrottle();
// Apply video throttle whenever a full screen scan finishes
Core::VideoThrottle();
}
for (int i = 0; i < 4; ++i)