mirror of
https://github.com/ares-emulator/ares.git
synced 2026-10-12 02:11:04 +00:00
n64: speed up first boot of games with RTC
There is no reason to advance ~1.7 billion times from the epoch. We can just initialize the RTC with the current time.
This commit is contained in:
committed by
Luke Usher
parent
5de16c334d
commit
e6130f66e7
@@ -10,7 +10,7 @@ auto Cartridge::RTC::load() -> void {
|
||||
present = 1;
|
||||
n64 timestamp = ram.read<Dual>(24);
|
||||
if(!~timestamp) {
|
||||
time_t t = (time_t)0;
|
||||
time_t t = time(0);
|
||||
struct tm tmm = *localtime(&t);
|
||||
ram.write<Byte>(16, BCD::encode(tmm.tm_sec));
|
||||
ram.write<Byte>(17, BCD::encode(tmm.tm_min));
|
||||
@@ -20,10 +20,10 @@ auto Cartridge::RTC::load() -> void {
|
||||
ram.write<Byte>(21, BCD::encode(tmm.tm_mon + 1));
|
||||
ram.write<Byte>(22, BCD::encode(tmm.tm_year % 100));
|
||||
ram.write<Byte>(23, BCD::encode(tmm.tm_year / 100));
|
||||
} else {
|
||||
timestamp = time(0) - timestamp;
|
||||
advance(timestamp);
|
||||
}
|
||||
|
||||
timestamp = time(0) - timestamp;
|
||||
advance(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user