Buffing up DSi mode
It's no secret that melonDS's DSi mode needs some love, but there are just so many things to do with melonDS.

One of the recurring complaints is that, when running in DSi mode, touchscreen input is off, requiring the user to recalibrate the touchscreen, while this doesn't happen in DS mode.

Reason for that is that on the DS (and DSi), the touchscreen hardware doesn't return pixel coordinates, but raw digitizer readings. Calibration data is then used to convert these readings to pixel coordinates. Every touchscreen digitizer is going to have a slightly different range, which is why users have to calibrate their touchscreen.

melonDS makes up for that in a very simple fashion. It uses its own conversion, basically just multiplying the touchscreen pixel coordinates by 16 to make decent 'raw' coordinates. When booting, melonDS also patches the user's firmware data with its own adequate calibration data, so that no recalibration is required and the touchscreen Just Works(tm). Easy peasy.

However, in DSi mode, it's another story. The old DS firmware data still exists, but the DSi system instead uses user settings files stored in the NAND. Thing is, it's less easy to access the data there: the NAND is mostly a FAT volume with an encryption layer. Not exactly trivial to deal with.

I was shown fatfs, which is basically a lightweight FAT driver. It is meant to be used to access storage media such as SD cards on embedded devices, however it is trivial to make it work on a FAT volume contained within an image file. I wrote code to do that with the DSi NAND, taking care of encryption transparently, and bam, I had a viable base for NAND manipulation.

I then wrote code to access the user settings files inside the NAND, and patch the touchscreen calibration data there. After taking care of all the details like SHA-1 hashes and whatnot, the initial issue was covered: the DSi-mode touchscreen Just Worked(tm), with no recalibration needed, just like its DS-mode counterpart.

With this proof of concept being a success, I took it further:

This neat little toy allows installing DSiware to your NAND. It's also possible to delete titles you don't want anymore, and to import and export save data. However, a few notes about this:

* the title manager can only be used while emulation is not running, to avoid risks of NAND corruption
* only DSiware can be imported (ie, not cartridge ROMs)
* if you don't have a TMD file, it can be downloaded automatically from the NUS
* you have to provide your own DSiware files, we can't help you obtain them
* if you're running a stock DSi menu, only DSiware for your region will show up -- the current region-bypass hack only works for cart ROMs
* the importer requires a valid (augmented) dump of the DSi ARM7 BIOS

That's about it for now, but the inclusion of fatfs also opens other fun possibilities, like creating FAT images from given directories for things like DLDI or the DSi SD card.

Stay tuned!
cool person says:
Aug 24th 2021
epic and cool
solitonmedic says:
Aug 24th 2021
Damn, DSi emulation looking so good right now
Saizo7 says:
Aug 25th 2021
Nixel says:
Aug 25th 2021
It's pretty exciting that DSiWare will get a more convenient installation process!
egna says:
Aug 25th 2021
Wow, thank you very very much for your work and dedication. Much love!
DLDI? says:
Aug 26th 2021
What is DLDI?
Arisotura says:
Aug 26th 2021
standard used to allow DS homebrew to access files on your flashcart
crazynoob458 says:
Aug 26th 2021
this is legit amazing
Aug 26th 2021
Zaxd says:
Aug 29th 2021
When local multiplayer will be smooth. Why I can't play online multiplayer with WiFi.
AsPika2219 says:
Aug 30th 2021
Waiting for enjoy playing DSiWare and DSi execute games! 🥰️
WhoNeedsAUserName says:
Sep 1st 2021
^~^ says:
Sep 2nd 2021
Glad to see it working!
Btw, if melonDsi can download stuff from the NUS, wouldn't it be nice to have it download the DSi menu and other components of the firmware from there as well?
Post a comment