Files
dusklight/src/dusk/speedrun.h
T
Luke Street 0f5a248401 Time revamp (#2304)
* Don't Use OSCalendarTime for Speedrun Timing

- Shouldn't rely on OSTicksToCalendarTime since it will be changed to handle time zone conversion, and that doesn't make sense on elapsed time

* Use OSGetSystemTime Extension

- Fixes desyncing issues with save file time and a couple other odd instances, particularly on mobile platforms that suspend apps

* Time revamp

* Update aurora

* Split IGT/RTA calculations

* Shift-Turbo to slow down

---------

Co-authored-by: SuperDude88 <82904174+SuperDude88@users.noreply.github.com>
2026-08-14 00:07:54 -06:00

49 lines
1.1 KiB
C++

#pragma once
#include <aurora/aurora.h>
namespace dusk {
struct SpeedrunInfo {
void startRun() {
m_isRunStarted = true;
m_rtaStartTimestamp = OSGetNativeTime();
m_igtStartTimestamp = OSGetTime();
}
void stopRun() {
m_isRunStarted = false;
m_rtaTimer = OSGetNativeTime() - m_rtaStartTimestamp;
if (!m_isPauseIGT) {
m_igtTimer = OSGetTime() - m_igtStartTimestamp - m_totalLoadTime;
}
}
void reset() {
m_isRunStarted = false;
m_rtaStartTimestamp = 0;
m_rtaTimer = 0;
m_igtStartTimestamp = 0;
m_isPauseIGT = false;
m_loadStartTimestamp = 0;
m_totalLoadTime = 0;
m_igtTimer = 0;
}
bool m_isRunStarted = false;
OSTime m_rtaStartTimestamp = 0;
OSTime m_rtaTimer = 0;
OSTime m_igtStartTimestamp = 0;
bool m_isPauseIGT = false;
OSTime m_loadStartTimestamp = 0;
OSTime m_totalLoadTime = 0;
OSTime m_igtTimer = 0;
};
extern SpeedrunInfo m_speedrunInfo;
void resetForSpeedrunMode();
void restoreFromSpeedrunMode();
} // namespace dusk