RTC revamp (#1867)

* get this started

* implement DSi RTC commands

* set up RTC clock timer. lay down basic idea of a clock.

* make the date/time registers writable

* move RTC state to its own structure, to make it easier to deal with

* more RTC work
lay base for date/time dialog

* get the bulk of the RTC functionality going

* much simpler design for RTC stuff

* aha, that is what it is

* start working on the RTC IRQ

* implement all types of RTC IRQ

* start refining sleep mode. code still kinda sucks.

* implement keypad IRQ

* refine it some more

* shut the fuck uuuuuupppppppppppppp
This commit is contained in:
Arisotura
2023-10-30 18:37:49 +01:00
committed by GitHub
parent 21590b0709
commit 9a450f5f28
21 changed files with 1470 additions and 214 deletions

View File

@ -28,6 +28,8 @@
#include <utility>
#include <fstream>
#include <QDateTime>
#include <zstd.h>
#ifdef ARCHIVE_SUPPORT_ENABLED
#include "ArchiveUtil.h"
@ -39,6 +41,7 @@
#include "NDS.h"
#include "DSi.h"
#include "SPI.h"
#include "RTC.h"
#include "DSi_I2C.h"
#include "FreeBIOS.h"
@ -589,6 +592,15 @@ void SetBatteryLevels()
}
}
void SetDateTime()
{
QDateTime hosttime = QDateTime::currentDateTime();
QDateTime time = hosttime.addSecs(Config::RTCOffset);
RTC::SetDateTime(time.date().year(), time.date().month(), time.date().day(),
time.time().hour(), time.time().minute(), time.time().second());
}
void Reset()
{
NDS::SetConsoleType(Config::ConsoleType);
@ -602,6 +614,7 @@ void Reset()
}
NDS::Reset();
SetBatteryLevels();
SetDateTime();
if ((CartType != -1) && NDSSave)
{
@ -678,6 +691,7 @@ bool LoadBIOS()
NDS::Reset();
SetBatteryLevels();
SetDateTime();
return true;
}
@ -1204,6 +1218,7 @@ bool LoadROM(QStringList filepath, bool reset)
NDS::Reset();
SetBatteryLevels();
SetDateTime();
}
u32 savelen = 0;