Improve RTC support, implement RTC write command #205
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Joybus commands to read/write to RTC are based off of the UltraPIF implementation (thanks @jago85!)
The N64DD commands to read/write to RTC are based off of LuigiBlood's research (thanks @LuigiBlood)
Note that RTC writes are currently not persistent after the emulator quits and will always revert to system local time on the next launch.
Changes to
get_local_time
get_local_time
now supports an offset (in seconds) so that the RTC clock can be adjusted relative to local time.Note that the implementation of getting the operating system time has been unified using ISO C Time functions; I have made a best-effort to implement this for Windows but I do not run Windows so I have not tested it. I would greatly appreciate it if a Windows user could build this and run my test ROM.
Test ROM
rtctest.zip (For more information about this test ROM, please see DragonMinded/libdragon#152)
Note that the test ROM does not currently support the N64DD RTC, you can test reading/writing to the 64DD RTC using the DD IPL ROM (holding down A while booting).