From 14c71f39ff97684e6c6933cf18781e8d162d1be6 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 24 Jun 2021 13:47:10 +0300 Subject: High FPS Fixes --- src/core/Frontend.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/core/Frontend.cpp') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 798c1d8b..2160d8ce 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -181,7 +181,7 @@ const char* FrontendFilenames[][2] = { #ifdef XBOX_MESSAGE_SCREEN bool CMenuManager::m_bDialogOpen = false; uint32 CMenuManager::m_nDialogHideTimer = 0; -PauseModeTime CMenuManager::m_nDialogHideTimerPauseMode = 0; +uint32 CMenuManager::m_nDialogHideTimerPauseMode = 0; bool CMenuManager::m_bSaveWasSuccessful = false; wchar* CMenuManager::m_pDialogText = nil; #endif @@ -750,7 +750,7 @@ CMenuManager::DisplayHelperText(char *text) return; // there was a unused static bool - static PauseModeTime LastFlash = 0; + static uint32 LastFlash = 0; int32 alpha = 255; CFont::SetRightJustifyOn(); @@ -1425,7 +1425,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen) } } - static PauseModeTime lastBlendChange = 0; + static uint32 lastBlendChange = 0; if (m_nOptionHighlightTransitionBlend <= 255) { static uint32 blendChangeCounter = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastBlendChange > 20 @@ -1928,7 +1928,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::PrintString(nextX, nextY, seperator); nextX += CFont::GetStringWidth(seperator, true) + bindingMargin; } - static PauseModeTime lastWaitingTextFlash = 0; + static uint32 lastWaitingTextFlash = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastWaitingTextFlash > 150) { showWaitingText = !showWaitingText; lastWaitingTextFlash = CTimer::GetTimeInMillisecondsPauseMode(); @@ -1993,7 +1993,7 @@ CMenuManager::DrawControllerScreenExtraText(int yStart, int xStart, int lineHeig CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT")); nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX; } - static PauseModeTime lastStateChange = 0; + static uint32 lastStateChange = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastStateChange > 150) { waitingTextVisible = !waitingTextVisible; lastStateChange = CTimer::GetTimeInMillisecondsPauseMode(); @@ -2377,7 +2377,7 @@ CMenuManager::DrawBackground(bool transitionCall) m_nOptionHighlightTransitionBlend = 0; } - static PauseModeTime LastFade = 0; + static uint32 LastFade = 0; if (m_nMenuFadeAlpha < 255) { static uint8 forceFadeInCounter = 0; @@ -2448,7 +2448,7 @@ CMenuManager::DrawBackground(bool transitionCall) } if (m_ShowEmptyBindingError) { - static PauseModeTime lastBindingError = CTimer::GetTimeInMillisecondsPauseMode(); + static uint32 lastBindingError = CTimer::GetTimeInMillisecondsPauseMode(); static bool bindingErrorShown = false; if (bindingErrorShown) { lastBindingError = CTimer::GetTimeInMillisecondsPauseMode(); @@ -3332,7 +3332,7 @@ CMenuManager::PrintStats() else CFont::SetScale(MENU_X(0.37f), MENU_Y(0.75f)); - static PauseModeTime lastCheck = 0; + static uint32 lastCheck = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastCheck > 40) { @@ -3473,7 +3473,7 @@ CMenuManager::AdditionalOptionInput(bool &goBack) switch (m_nCurrScreen) { case MENUPAGE_MAP: { - static PauseModeTime lastMapTick = 0; + static uint32 lastMapTick = 0; // FIX: All those macros were hardcoded values originally. @@ -3802,7 +3802,7 @@ CMenuManager::ExportStats() void CMenuManager::PrintRadioSelector(void) { - static PauseModeTime lastRadioChange = 0; + static uint32 lastRadioChange = 0; CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(418.f), MENU_Y(MENURADIO_SELECTOR_START_Y + MENURADIO_SELECTOR_HEIGHT), MENU_X_LEFT_ALIGNED(228.f), MENU_Y(MENURADIO_SELECTOR_START_Y + MENURADIO_SELECTOR_HEIGHT), @@ -3925,7 +3925,7 @@ CMenuManager::PrintRadioSelector(void) #endif static bool radioChangeRequested = false; - static PauseModeTime lastScrollCheck = 0; + static uint32 lastScrollCheck = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastScrollCheck > 17) { if (m_ScrollRadioBy == 1) { if (m_LeftMostRadioX > MENU_X_LEFT_ALIGNED(MENURADIO_ICON_FIRST_X - MENURADIO_ICON_SIZE)) { @@ -4009,7 +4009,7 @@ CMenuManager::ProcessList(bool &optionSelected, bool &goBack) field_159 = false; } - static PauseModeTime lastTimeClickedScrollButton = 0; + static uint32 lastTimeClickedScrollButton = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastTimeClickedScrollButton >= 200) { m_bPressedPgUpOnList = false; @@ -4395,7 +4395,7 @@ CMenuManager::UserInput(void) int curAction = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) { - static PauseModeTime lastSliderDecrease = 0; + static uint32 lastSliderDecrease = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) { if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME || curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO || @@ -4406,7 +4406,7 @@ CMenuManager::UserInput(void) lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode(); } } else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) { - static PauseModeTime lastSliderIncrease = 0; + static uint32 lastSliderIncrease = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) { if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME || curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO || @@ -5396,7 +5396,7 @@ CMenuManager::ProcessFileActions() { #ifdef XBOX_MESSAGE_SCREEN if (m_bDialogOpen && DialogTextCmp("FESZ_WR")) { - PauseModeTime startTime = CTimer::GetTimeInMillisecondsPauseMode(); + uint32 startTime = CTimer::GetTimeInMillisecondsPauseMode(); int8 SaveSlot = PcSaveHelper.SaveSlot(m_nCurrSaveSlot); PcSaveHelper.PopulateSlotInfo(); @@ -5654,13 +5654,13 @@ CMenuManager::DrawQuitGameScreen(void) #endif #ifndef MUCH_SHORTER_OUTRO_SCREEN - static PauseModeTime lastTickIncrease = 0; + static uint32 lastTickIncrease = 0; if (alpha == 255 && CTimer::GetTimeInMillisecondsPauseMode() - lastTickIncrease > 10) { exitSignalTimer++; lastTickIncrease = CTimer::GetTimeInMillisecondsPauseMode(); } #else - static PauseModeTime firstTick = CTimer::GetTimeInMillisecondsPauseMode(); + static uint32 firstTick = CTimer::GetTimeInMillisecondsPauseMode(); if (alpha == 255 && CTimer::GetTimeInMillisecondsPauseMode() - firstTick > 750) { exitSignalTimer = 150; } -- cgit v1.2.3 From e5aa150557e44466158a680216102adf687e1f0b Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 24 Jun 2021 21:19:12 +0300 Subject: Frontend fix --- src/core/Frontend.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/core/Frontend.cpp') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 2160d8ce..190cdf32 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -1429,15 +1429,17 @@ CMenuManager::DrawStandardMenus(bool activeScreen) if (m_nOptionHighlightTransitionBlend <= 255) { static uint32 blendChangeCounter = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - lastBlendChange > 20 -#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND // Dirty dirty hack || blendChangeCounter > 20 -#endif ) { m_nOptionHighlightTransitionBlend += 50; lastBlendChange = CTimer::GetTimeInMillisecondsPauseMode(); blendChangeCounter = 0; } +#ifdef FIX_BUGS + blendChangeCounter += CTimer::GetLogicalFramesPassed(); +#else ++blendChangeCounter; +#endif } } @@ -2382,17 +2384,22 @@ CMenuManager::DrawBackground(bool transitionCall) if (m_nMenuFadeAlpha < 255) { static uint8 forceFadeInCounter = 0; if (CTimer::GetTimeInMillisecondsPauseMode() - LastFade > 30 -#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND // Dirty dirty hack || forceFadeInCounter > 30 -#endif ) { m_nMenuFadeAlpha += 20; if (m_firstStartCounter < 255) { m_firstStartCounter = Min(m_firstStartCounter + 20, 255); } LastFade = CTimer::GetTimeInMillisecondsPauseMode(); +#ifdef FIX_BUGS + forceFadeInCounter = 0; +#endif } +#ifdef FIX_BUGS + forceFadeInCounter += CTimer::GetLogicalFramesPassed(); +#else forceFadeInCounter++; +#endif } else if (m_nMenuFadeAlpha > 255) m_nMenuFadeAlpha = 255; -- cgit v1.2.3