Skip to content

Commit e36ecaa

Browse files
committed
On-Screen Timer - Only update if the previous frame time variable is set
This is a failsafe to make sure the value is updated properly. As of right now, it shouldn't be needed, but in the future it might.
1 parent c83de32 commit e36ecaa

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

ttyd-tools/rel/source/global.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace mod {
55

6-
const char *VersionNumber = "v3.0.41";
6+
const char *VersionNumber = "v3.0.42";
77

88
const char *RootLines[] =
99
{

ttyd-tools/rel/source/menufunctions.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ void lockFlagsMenuSetNewArea(uint32_t index)
358358

359359
if (Flag && tempMemory)
360360
{
361-
// Back up the LSWFs
361+
// Back up the standard flags
362362
uint32_t GlobalWorkPtrRaw = reinterpret_cast<uint32_t>(ttyd::mariost::globalWorkPointer);
363363
void *MemoryStart = reinterpret_cast<void *>(GlobalWorkPtrRaw + Region->Offset);
364364
memcpy(&tempMemory[0], MemoryStart, Region->Size);
@@ -4174,13 +4174,18 @@ void updateOnScreenTimerVars()
41744174

41754175
int64_t CurrentFrameTime = gc::OSTime::OSGetTime();
41764176

4177-
if (!OnScreenTimer.TimerPaused &&
4177+
// Make sure the previous frame time has a value set
4178+
int64_t PreviousFrameTime = OnScreenTimer.PreviousFrameTime;
4179+
if (PreviousFrameTime != 0)
4180+
{
4181+
if (!OnScreenTimer.TimerPaused &&
41784182
(!MenuVar.MenuIsDisplayed || MenuVar.HideMenu) &&
41794183
!SpawnItem.InAdjustableValueMenu &&
41804184
!MenuVar.ChangingCheatButtonCombo)
4181-
{
4182-
int64_t IncrementAmount = CurrentFrameTime - OnScreenTimer.PreviousFrameTime;
4183-
OnScreenTimer.MainTimer += IncrementAmount;
4185+
{
4186+
int64_t IncrementAmount = CurrentFrameTime - PreviousFrameTime;
4187+
OnScreenTimer.MainTimer += IncrementAmount;
4188+
}
41844189
}
41854190

41864191
OnScreenTimer.PreviousFrameTime = CurrentFrameTime;

0 commit comments

Comments
 (0)