Compare commits

...

3 Commits

Author SHA1 Message Date
SuperDude88 3eeb9a19a1 Fix for Mobile Testing 2026-07-07 19:04:14 -04:00
SuperDude88 060f0eb419 Use OSGetSystemTime Extension
- Fixes desyncing issues with save file time and a couple other odd instances, particularly on mobile platforms that suspend apps
2026-07-07 18:52:16 -04:00
SuperDude88 e491d254f8 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
2026-07-07 18:12:15 -04:00
8 changed files with 22 additions and 13 deletions
+1 -1
+1 -1
View File
@@ -118,7 +118,7 @@ static int dKyeff_Create(kankyo_class* i_this) {
if (strcmp(dComIfGp_getStartStageName(), "Name") == 0) {
camera_process_class* camera = dComIfGp_getCamera(0);
OSTime time = OSGetTime();
OSTime time = DUSK_IF_ELSE(OSGetSystemTime(), OSGetTime());
OSTicksToCalendarTime(time, &calendar);
g_env_light.global_wind_influence.vec.x = 1.0f;
+1 -1
View File
@@ -1823,7 +1823,7 @@ int dSv_info_c::memory_to_card(char* card_ptr, int dataNum) {
savedata->getPlayer().getPlayerInfo().setTotalTime(play_time);
}
savedata->getPlayer().getPlayerStatusB().setDateIpl(OSGetTime());
savedata->getPlayer().getPlayerStatusB().setDateIpl(DUSK_IF_ELSE(OSGetSystemTime(), OSGetTime()));
memcpy(card_ptr, savedata, sizeof(dSv_save_c));
card_ptr += 0x958;
+15 -6
View File
@@ -197,10 +197,19 @@ void remove_element(Rml::Element*& elem) noexcept {
} // namespace
static std::string FormatTime(OSTime ticks) {
OSCalendarTime t;
OSTicksToCalendarTime(ticks, &t);
return fmt::format("{0:02}:{1:02}:{2:02}.{3:03}", t.hour, t.min, t.sec, t.msec);
static std::string FormatElapsedTime(OSTime ticksElapsed) {
using namespace std::chrono;
milliseconds ms{OSTicksToMilliseconds(ticksElapsed)};
const hours hr = duration_cast<hours>(ms);
ms -= hr;
const minutes min = duration_cast<minutes>(ms);
ms -= min;
const seconds sec = duration_cast<seconds>(ms);
ms -= sec;
return fmt::format("{0:02}:{1:02}:{2:02}.{3:03}", hr.count(), min.count(), sec.count(), ms.count());
}
Overlay::Overlay() : Document(kDocumentSource, true) {
@@ -317,13 +326,13 @@ void Overlay::update() {
if (getSettings().game.showSpeedrunRTATimer) {
mSpeedrunRta->SetAttribute("open", "");
mSpeedrunRta->SetInnerRML(escape(fmt::format("RTA {}", FormatTime(elapsedTime))));
mSpeedrunRta->SetInnerRML(escape(fmt::format("RTA {}", FormatElapsedTime(elapsedTime))));
} else {
mSpeedrunRta->RemoveAttribute("open");
}
mSpeedrunIgt->SetInnerRML(
escape(fmt::format("IGT {}", FormatTime(m_speedrunInfo.m_igtTimer))));
escape(fmt::format("IGT {}", FormatElapsedTime(m_speedrunInfo.m_igtTimer))));
} else {
mSpeedrunTimer->RemoveAttribute("open");
}
+1 -1
View File
@@ -1052,7 +1052,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().game.touchTargeting.setValue(
static_cast<TouchTargeting>(i));
config::Save();
config::save();
});
}
pane.add_rml(fmt::format("<br/>Hybrid: {}<br/>Hold: {}<br/>Switch: {}",
+1 -1
View File
@@ -320,7 +320,7 @@ static void mDoMemCdRWm_BuildHeader(mDoMemCdRWm_HeaderData* header) {
#endif
OSCalendarTime time;
OSTicksToCalendarTime(OSGetTime(), &time);
OSTicksToCalendarTime(DUSK_IF_ELSE(OSGetSystemTime(), OSGetTime()), &time);
#if TARGET_PC
if (dusk::version::isRegionPal()) {
+1 -1
View File
@@ -527,7 +527,7 @@ void myExceptionCallback(u16, OSContext*, u32, u32) {
u32 btnHold;
u32 btnTrig;
mDoMain::sHungUpTime = OSGetTime();
mDoMain::sHungUpTime = DUSK_IF_ELSE(OSGetSystemTime(), OSGetTime());
OSReportEnable();
cAPICPad_recalibrate();
// "Vibration stopping & resetting to default\n"
+1 -1
View File
@@ -770,7 +770,7 @@ int game_main(int argc, char* argv[]) {
OSInit();
mDoMain::sPowerOnTime = OSGetTime();
mDoMain::sPowerOnTime = DUSK_IF_ELSE(OSGetSystemTime(), OSGetTime());
// Reset Data
static mDoRstData sResetData = {0};