Forcing resyncClock() on ARM7

Post Reply
Unt
Posts: 5
Joined: Sun Jun 03, 2018 3:30 pm

Forcing resyncClock() on ARM7

Post by Unt » Sat Jun 01, 2019 5:32 pm

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.

User avatar
fincs
( ͡° ͜ʖ ͡°)
Posts: 59
Joined: Mon Jul 12, 2010 9:45 pm
Location: Seville, Spain
Contact:

Re: Forcing resyncClock() on ARM7

Post by fincs » Sat Jun 01, 2019 6:12 pm

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.
Donate to devkitPro - help us stay alive!

Unt
Posts: 5
Joined: Sun Jun 03, 2018 3:30 pm

Re: Forcing resyncClock() on ARM7

Post by Unt » Sun Jun 02, 2019 12:13 am

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 :cry:

WinterMute
Site Admin
Posts: 1404
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Forcing resyncClock() on ARM7

Post by WinterMute » Sun Jun 02, 2019 9:57 am

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 :cry:
Obviously the best approach is to implement the RTC IRQ in DeSmuMe rather than adding inappropriate code to libnds.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

Unt
Posts: 5
Joined: Sun Jun 03, 2018 3:30 pm

Re: Forcing resyncClock() on ARM7

Post by Unt » Sun Jun 02, 2019 4:55 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests