Utilizing DSi Mode

Post Reply
Charles MacDonald
Posts: 4
Joined: Tue Apr 23, 2019 4:16 am

Utilizing DSi Mode

Post by Charles MacDonald » Tue Apr 23, 2019 5:16 am

I've just started doing some development on a DSi LL, which has Martin Korth's nice Unlaunch V0.8 invoking dslink.nds after boot. I've been basing my experiments on the helpful examples that were provided with devkitPro, such as "hello_world".

I've noticed there are some DSi related functions (setCpuClock() and IsDSiMode()) in libnds. As expected when I use them, setCpuClock() does nothing and IsDSiMode() returns zero. So far so good, I know I must be running in the regular DS mode.

How would I modify a project such as "hello_world" to build a DSi-mode compatible NDS file? Or more generally, what's needed to enter DSi mode instead of the default DS mode?

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

Re: Utilizing DSi Mode

Post by WinterMute » Tue Apr 23, 2019 11:34 am

Charles MacDonald wrote:
Tue Apr 23, 2019 5:16 am
I've just started doing some development on a DSi LL, which has Martin Korth's nice Unlaunch V0.8 invoking dslink.nds after boot. I've been basing my experiments on the helpful examples that were provided with devkitPro, such as "hello_world".
The archive withFlipnote Lenny contains a recent build of hbmenu as boot.nds & a recent dslink. It's probably worth attempting to boot hbmenu then running dslink from there. I have no idea how well unlaunch boots libnds code or how it determines which mode to run in.
How would I modify a project such as "hello_world" to build a DSi-mode compatible NDS file? Or more generally, what's needed to enter DSi mode instead of the default DS mode?
You wouldn't. Provided you're using latest devkitARM and the nds support libs then all compiled code is hybrid & will run in either mode. All that's needed to enter DSi mode is a suitable DSi mode entry point.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

Charles MacDonald
Posts: 4
Joined: Tue Apr 23, 2019 4:16 am

Re: Utilizing DSi Mode

Post by Charles MacDonald » Tue Apr 23, 2019 10:33 pm

Thanks for pointing out hbmenu, it's such a great program.
After running some tests these are the combinations that result in a user application running in DS mode or DSi mode. I checked the DSi extended registers at 0x040040xx as well as isDSiMode() to verify.

Runs in DSi mode:
Unlaunch > User application
Unlaunch > hbmenu > User application

Runs in DS mode:
Unlaunch > dslink > User application
Unlaunch > hbmenu > dslink > User application

(Note: I'm not using Unlaunch's wifiboot as it doesn't work for me, but dslink works very well)

Based on these results could I assume the methods that hbmenu and dslink use to load a NDS file into memory might differ in some way?
I've looked at the source to both but as a newbie there's a lot to learn before I can understand it.

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

Re: Utilizing DSi Mode

Post by WinterMute » Sat Apr 27, 2019 12:03 am

Charles MacDonald wrote:
Tue Apr 23, 2019 10:33 pm
Runs in DSi mode:
Unlaunch > User application
Unlaunch > hbmenu > User application
If these two work in DSi mode then Unlaunch > hbmenu > dslink > User application should run in DSi mode too.

Unlaunch > dslink > User application is likely running in DS mode because dslink has an old style ds header & no DSi mode binaries which probably means Martin's launcher is switching to DS mode when it loads dslink directly.

Can you check the Unlaunch > hbmenu > dslink > User application option again & just check?

booting dslink in DSi mode via any of the exploits I have available works fine here but I'm struggling to get unlaunch to work unfortunately so I can't really test your scenario atm. I have a few things to try but it may take a while to get to.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

Charles MacDonald
Posts: 4
Joined: Tue Apr 23, 2019 4:16 am

Re: Utilizing DSi Mode

Post by Charles MacDonald » Sat Apr 27, 2019 8:22 pm

Can you check the Unlaunch > hbmenu > dslink > User application option again & just check?
Ah you're right, I made a mistake last time. That works. In fact I modified dslink to show a DSi specific register and the testing shows:

1. Unlaunch > User application -- Runs in DSi mode
2. Unlaunch > hbmenu > User application -- Runs in DSi mode
3. Unlaunch > dslink > User application -- dslink and user application are in DS mode
4. Unlaunch > hbmenu > dslink > User application -- dslink and user application are in DSi mode.

So it's definitely unlaunch booting dslink in DS mode.
I'm struggling to get unlaunch to work unfortunately so I can't really test your scenario atm. I have a few things to try but it may take a while to get to.
This is really my own weird use case so I don't want to take up your time. Thanks for the help, now I know where to start digging around!

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

Re: Utilizing DSi Mode

Post by WinterMute » Sat Apr 27, 2019 11:42 pm

Charles MacDonald wrote:
Sat Apr 27, 2019 8:22 pm
This is really my own weird use case so I don't want to take up your time. Thanks for the help, now I know where to start digging around!
Being honest I'd rather you didn't go digging around, I have some tweaks I want to make to dslink anyway that need some careful handling to preserve compatibility with various things.

FWIW I'd consider unlaunch switching to DS mode without the ability to turn that off a bug. It's probably also worth mentioning that exiting from homebrew launched via hbmenu will return to hbmenu while running via dslink directly or via unlaunch will power down the system instead. Martin is a bit of a law unto himself and not really a team player or a big picture thinker unfortunately.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

Charles MacDonald
Posts: 4
Joined: Tue Apr 23, 2019 4:16 am

Re: Utilizing DSi Mode

Post by Charles MacDonald » Sun Apr 28, 2019 12:32 am

Being honest I'd rather you didn't go digging around, I have some tweaks I want to make to dslink anyway that need some careful handling to preserve compatibility with various things.
Don't worry, clearly you've put enough time and effort into developing dslink that releasing any kind of modified version to the public would serve no purpose other than to cause you a headache. Rest assured that isn't the case here.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests