mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-22 17:19:15 +01:00
Remove frameTime, fix pause mode timer
This commit is contained in:
parent
b90784da90
commit
2592da2273
@ -950,12 +950,7 @@ CMenuManager::DisplayHelperText()
|
|||||||
m_nHelperTextAlpha -= 2;
|
m_nHelperTextAlpha -= 2;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static float fadeAlpha = 0.0f; // To keep it precisely
|
m_nHelperTextAlpha -= 2 * CTimer::GetLogicalFramesPassed();
|
||||||
if (m_nHelperTextAlpha >= 255 && fadeAlpha < 250) fadeAlpha = m_nHelperTextAlpha;
|
|
||||||
|
|
||||||
// -2 per every 33 ms (1000.f/30.f - original frame limiter fps)
|
|
||||||
fadeAlpha -= (frameTime / 33.0f) * 2.0f;
|
|
||||||
m_nHelperTextAlpha = fadeAlpha;
|
|
||||||
#endif
|
#endif
|
||||||
if (m_nHelperTextAlpha < 1)
|
if (m_nHelperTextAlpha < 1)
|
||||||
ResetHelperText();
|
ResetHelperText();
|
||||||
@ -2686,11 +2681,7 @@ CMenuManager::DrawFrontEndNormal()
|
|||||||
static float fadeAlpha = 0.0f;
|
static float fadeAlpha = 0.0f;
|
||||||
|
|
||||||
if (m_nMenuFadeAlpha < 255) {
|
if (m_nMenuFadeAlpha < 255) {
|
||||||
if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f;
|
m_nMenuFadeAlpha += 20 * CTimer::GetLogicalFramesPassed();
|
||||||
|
|
||||||
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
|
|
||||||
fadeAlpha += (frameTime) * 20.f / 33.f;
|
|
||||||
m_nMenuFadeAlpha = fadeAlpha;
|
|
||||||
} else {
|
} else {
|
||||||
// TODO: what is this? waiting mouse?
|
// TODO: what is this? waiting mouse?
|
||||||
if(field_518 == 4){
|
if(field_518 == 4){
|
||||||
@ -2950,12 +2941,7 @@ CMenuManager::DrawFrontEndNormal()
|
|||||||
|
|
||||||
// Famous transparent menu bug
|
// Famous transparent menu bug
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
static float fadeAlpha = 0.0f;
|
m_nMenuFadeAlpha += 20 * CTimer::GetLogicalFramesPassed();
|
||||||
if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f;
|
|
||||||
|
|
||||||
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
|
|
||||||
fadeAlpha += (frameTime) * 20.f / 33.f;
|
|
||||||
m_nMenuFadeAlpha = fadeAlpha;
|
|
||||||
#else
|
#else
|
||||||
static uint32 LastFade = 0;
|
static uint32 LastFade = 0;
|
||||||
|
|
||||||
|
@ -37,10 +37,6 @@ RsTimerType suspendPcTimer;
|
|||||||
|
|
||||||
uint32 suspendDepth;
|
uint32 suspendDepth;
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
double frameTime;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CTimer::Initialise(void)
|
void CTimer::Initialise(void)
|
||||||
{
|
{
|
||||||
debug("Initialising CTimer...\n");
|
debug("Initialising CTimer...\n");
|
||||||
@ -90,6 +86,12 @@ void CTimer::Shutdown(void)
|
|||||||
|
|
||||||
void CTimer::Update(void)
|
void CTimer::Update(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static double frameTimeLogical = 0.0;
|
||||||
|
static double frameTimeFraction = 0.0;
|
||||||
|
static double frameTimeFractionScaled = 0.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds;
|
m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -102,30 +104,29 @@ void CTimer::Update(void)
|
|||||||
|
|
||||||
_oldPerfCounter = pc;
|
_oldPerfCounter = pc;
|
||||||
|
|
||||||
|
// bugfix from VC
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
float updInCyclesScaled = GetIsPaused() ? updInCycles : updInCycles * ms_fTimeScale;
|
||||||
|
#else
|
||||||
float updInCyclesScaled = updInCycles * ms_fTimeScale;
|
float updInCyclesScaled = updInCycles * ms_fTimeScale;
|
||||||
|
|
||||||
// We need that real frame time to fix transparent menu bug.
|
|
||||||
#ifndef FIX_BUGS
|
|
||||||
double
|
|
||||||
#endif
|
#endif
|
||||||
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
|
||||||
|
double frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
|
// count frames as if we're running at 30 fps
|
||||||
m_LogicalFramesPassed = 0;
|
m_LogicalFramesPassed = 0;
|
||||||
static double frameTimeLogical = 0.0;
|
|
||||||
frameTimeLogical += ((double)updInCycles / (double)_nCyclesPerMS);
|
frameTimeLogical += ((double)updInCycles / (double)_nCyclesPerMS);
|
||||||
while (frameTimeLogical >= 1000.0 / 30.0) {
|
while (frameTimeLogical >= 1000.0 / 30.0) {
|
||||||
frameTimeLogical -= 1000.0 / 30.0;
|
frameTimeLogical -= 1000.0 / 30.0;
|
||||||
m_LogicalFramesPassed++;
|
m_LogicalFramesPassed++;
|
||||||
}
|
}
|
||||||
m_LogicalFrameCounter += m_LogicalFramesPassed;
|
m_LogicalFrameCounter += m_LogicalFramesPassed;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
frameTimeFraction += (double)updInCycles / (double)_nCyclesPerMS;
|
||||||
static double frameTimeDouble = 0.0;
|
frameTimeFractionScaled += frameTime;
|
||||||
frameTimeDouble += frameTime;
|
|
||||||
|
|
||||||
m_snTimeInMillisecondsPauseMode += uint32(frameTimeDouble);
|
m_snTimeInMillisecondsPauseMode += uint32(frameTimeFraction);
|
||||||
#else
|
#else
|
||||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||||
#endif
|
#endif
|
||||||
@ -135,8 +136,8 @@ void CTimer::Update(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
m_snTimeInMilliseconds += uint32(frameTimeDouble);
|
m_snTimeInMilliseconds += uint32(frameTimeFractionScaled);
|
||||||
m_snTimeInMillisecondsNonClipped += uint32(frameTimeDouble);
|
m_snTimeInMillisecondsNonClipped += uint32(frameTimeFractionScaled);
|
||||||
#else
|
#else
|
||||||
m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
|
m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
|
||||||
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
|
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
|
||||||
@ -144,7 +145,8 @@ void CTimer::Update(void)
|
|||||||
ms_fTimeStep = frameTime / 1000.0f * 50.0f;
|
ms_fTimeStep = frameTime / 1000.0f * 50.0f;
|
||||||
}
|
}
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
frameTimeDouble -= uint32(frameTimeDouble);
|
frameTimeFraction -= uint32(frameTimeFraction);
|
||||||
|
frameTimeFractionScaled -= uint32(frameTimeFractionScaled);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -154,30 +156,24 @@ void CTimer::Update(void)
|
|||||||
|
|
||||||
RsTimerType updInMs = timer - oldPcTimer;
|
RsTimerType updInMs = timer - oldPcTimer;
|
||||||
|
|
||||||
// We need that real frame time to fix transparent menu bug.
|
double frameTime = (double)updInMs * ms_fTimeScale;
|
||||||
#ifndef FIX_BUGS
|
|
||||||
double
|
oldPcTimer = timer;
|
||||||
#endif
|
|
||||||
frameTime = (double)updInMs * ms_fTimeScale;
|
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
|
// count frames as if we're running at 30 fps
|
||||||
m_LogicalFramesPassed = 0;
|
m_LogicalFramesPassed = 0;
|
||||||
static double frameTimeLogical = 0.0;
|
|
||||||
frameTimeLogical += (double)updInMs;
|
frameTimeLogical += (double)updInMs;
|
||||||
while(frameTimeLogical >= 1000.0 / 30.0) {
|
while(frameTimeLogical >= 1000.0 / 30.0) {
|
||||||
frameTimeLogical -= 1000.0 / 30.0;
|
frameTimeLogical -= 1000.0 / 30.0;
|
||||||
m_LogicalFramesPassed++;
|
m_LogicalFramesPassed++;
|
||||||
}
|
}
|
||||||
m_LogicalFrameCounter += m_LogicalFramesPassed;
|
m_LogicalFrameCounter += m_LogicalFramesPassed;
|
||||||
#endif
|
|
||||||
|
|
||||||
oldPcTimer = timer;
|
frameTimeFraction += (double)updInMs;
|
||||||
|
frameTimeFractionScaled += frameTime;
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
m_snTimeInMillisecondsPauseMode += uint32(frameTimeFraction);
|
||||||
static double frameTimeDouble = 0.0;
|
|
||||||
frameTimeDouble += frameTime;
|
|
||||||
|
|
||||||
m_snTimeInMillisecondsPauseMode += uint32(frameTimeDouble);
|
|
||||||
#else
|
#else
|
||||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||||
#endif
|
#endif
|
||||||
@ -187,8 +183,8 @@ void CTimer::Update(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
m_snTimeInMilliseconds += uint32(frameTimeDouble);
|
m_snTimeInMilliseconds += uint32(frameTimeFractionScaled);
|
||||||
m_snTimeInMillisecondsNonClipped += uint32(frameTimeDouble);
|
m_snTimeInMillisecondsNonClipped += uint32(frameTimeFractionScaled);
|
||||||
#else
|
#else
|
||||||
m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
|
m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
|
||||||
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
|
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
|
||||||
@ -196,7 +192,8 @@ void CTimer::Update(void)
|
|||||||
ms_fTimeStep = frameTime / 1000.0f * 50.0f;
|
ms_fTimeStep = frameTime / 1000.0f * 50.0f;
|
||||||
}
|
}
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
frameTimeDouble -= uint32(frameTimeDouble);
|
frameTimeFraction -= uint32(frameTimeFraction);
|
||||||
|
frameTimeFractionScaled -= uint32(frameTimeFractionScaled);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,3 @@ public:
|
|||||||
static uint32 GetLogicalFramesPassed(void) { return m_LogicalFramesPassed; }
|
static uint32 GetLogicalFramesPassed(void) { return m_LogicalFramesPassed; }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
extern double frameTime;
|
|
||||||
#endif
|
|
||||||
|
@ -1177,7 +1177,10 @@ DisplayGameDebugText()
|
|||||||
|
|
||||||
FrameSamples++;
|
FrameSamples++;
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
FramesPerSecondCounter += frameTime / 1000.f; // convert to seconds
|
// this is inaccurate with over 1000 fps
|
||||||
|
static uint32 PreviousTimeInMillisecondsPauseMode = 0;
|
||||||
|
FramesPerSecondCounter += (CTimer::GetTimeInMillisecondsPauseMode() - PreviousTimeInMillisecondsPauseMode) / 1000.0f; // convert to seconds
|
||||||
|
PreviousTimeInMillisecondsPauseMode = CTimer::GetTimeInMillisecondsPauseMode();
|
||||||
FramesPerSecond = FrameSamples / FramesPerSecondCounter;
|
FramesPerSecond = FrameSamples / FramesPerSecondCounter;
|
||||||
#else
|
#else
|
||||||
FramesPerSecondCounter += 1000.0f / CTimer::GetTimeStepNonClippedInMilliseconds();
|
FramesPerSecondCounter += 1000.0f / CTimer::GetTimeStepNonClippedInMilliseconds();
|
||||||
|
Loading…
Reference in New Issue
Block a user