Page 1 of 1
Forcing resyncClock() on ARM7
Posted: Sat Jun 01, 2019 5:32 pm
by Unt
Well, as I understand, libnds on ARM7 calls resyncClock() at startup to get RTC time. Then, it uses syncRTC() attached to IRQ_NETWORK to update it periodically. However, some emulators (like Desmume) apparently don't emulate that IRQ, so the time is not updated. Is it currently possible to force the ARM7 to call syncRTC() from ARM9 code? If it isn't, how could I modify libnds to do this? I'm thinking of something like making __libnds_gtod() set *punixTime to 0 and polling it for a new value, while on the ARM7 side attaching to some supported interrupt a function that tests __transferRegion()->unixTime and calls resyncClock() if it's 0.
Re: Forcing resyncClock() on ARM7
Posted: Sat Jun 01, 2019 6:12 pm
by fincs
We don't add code to our toolchains and libraries to work around emulator bugs. You might want to use a better emulator such as no$gba or melonDS; or better yet, real hardware.
Re: Forcing resyncClock() on ARM7
Posted: Sun Jun 02, 2019 12:13 am
by Unt
Yeah, I know. You don't like Desmume not implementing the necessary IRQ like other emulators, and Desmume don't like your approach that is efficient on hardware but doesn't work in some emulator-specific situations. That's cool, and I respect your decisions. Your nds toolchain is absolutely wonderful. I just want to modify and recompile libnds for myself, because, you know, Desmume is available as a nice and portable Libretro core, and runs on mobile devices as well. I specifically need to run an utility DS program that uses RTC on a mobile device; I can test it on whatever platform, but due to the use cases for it (possibly outdoors), other people may only use it if they have a working Nintendo DS, which is common but not always true (and then there's the battery...), or the particular situation permits the use of a laptop or even desktop computer. So I will just change some lines of code, compile the thing, and get it running on the buggy platform. Any advice on how I should do it? Would be really helpful for me
Re: Forcing resyncClock() on ARM7
Posted: Sun Jun 02, 2019 9:57 am
by WinterMute
Unt wrote: ↑Sun Jun 02, 2019 12:13 am
Yeah, I know. You don't like Desmume not implementing the necessary IRQ like other emulators
No. We don't like implementing workarounds for emulators that don't behave the same way hardware does. End of story.
I specifically need to run an utility DS program that uses RTC on a mobile device
Why does it have to be a DS program? Ultimately it's going to be much easier & much more flexible to build a web app that'll run anywhere instead of relying on emulation. What is the app? What does it do?
Any advice on how I should do it? Would be really helpful for me
Obviously the best approach is to implement the RTC IRQ in DeSmuMe rather than adding inappropriate code to libnds.
Re: Forcing resyncClock() on ARM7
Posted: Sun Jun 02, 2019 4:55 pm
by Unt
Well, you're probably right... Libnds is a library for the Nintendo DS, not for stuff that behaves similarly to the DS, which is also not a general-purpose computing platform. If I'm honest, I made this "app" for myself and targeted the nds just because I hate using higher level languages and markup (and love low-level coding), but it has grown into a pretty large project... I should have foreseen it. Well I shouldn't rely on other people to fix my mistakes (or Desmume's btw). I'm sorry and thanks for your explanations.