The new wifi adventure
I'm doing this while waiting for my surgery, which will be in 3 days. So, a bit more about yesterday's screenshot.


Basically, it all started with a new branch called slirp. What's that, you ask, another of Arisotura's oddball noises?

Nah. If you followed the melonDS history, you know that a while back, support for internet connectivity was added. It was pretty similar to how DeSmuME did it back then: providing a basic emulated access point to connect to, then forwarding outgoing traffic via libpcap.

While it was straightforward, it had its lot of issues: it required installing libpcap (or any Windows equivalent), required admin/root privileges, and, more annoyingly, did not work over wifi connections, as explained here.

Eventually indirect mode (aka LANMAGIC) was developed to get around this. The basic idea was to emulate a local network and use simple BSD sockets to forward outgoing traffic to the host network. The idea was good, but the actual implementation was more or less a pile of hacks that never really worked right.

Enter the slirp branch. Basically, QEMU's libslirp does exactly what LANMAGIC clumsily tried to do.

So I reimplemented indirect mode using that. Took a while to figure out how to use libslirp, as it isn't really documented, but we got there, and it works beautifully.

More notably, this is how we like it. Unlike direct mode, it requires no setup, it Just Works™. Over any sort of connection, without any special privileges, ...


Then I got carried away and began implementing features of the DSi's new wifi device. From there, you can see how this ended.

The DSi uses this new wifi device when connecting to the internet (local-multiplayer type connections use the old DS wifi device).

Alas, due to being a few years late to the party, there isn't much to do anymore. You can try using the DSi browser, but it won't be able to load a lot of websites successfully due to how limited and outdated it is. This site works fine... somewhat.

I was also able to update my emulated DSi to the latest firmware version, 1.4.5E. It doesn't do much, but it's working without issues, so there's atleast that.

Connecting to the DSi Shop gave me some weird undocumented error code. The logs showed that it was trying to use AES-CCM encryption, which was unimplemented. As I had already taken care of CCM decryption and verification, I could implement encryption quickly. Then I was able to access the Shop, from which you can download the 3DS transfer utility, and, well, nothing else.

Atleast these features are emulated, in case this can help spark new initiatives in the field, akin to AltWFC. Although things like custom DSi Shop servers would pose obvious copyright problems, unless they only distributed homebrew...


Regarding the old libpcap-powered direct mode, I'm thinking of retiring it. Perhaps not for 0.9, but later for sure. It might stick around for debugging purposes, but it has little advantage for the average joe if libslirp works just as well and is more flexible and easier to setup.


Regarding directions to take now, I have several ideas.

An interface for editing firmware settings. We could atleast make it work for DS mode. It would also allow you to change the console's MAC address, mostly to make up for the fact we're removing MAC randomization.

We also need some FAT library that can access files inside a FAT image. One of the purposes would be accessing the config files inside the NAND (which, below the encryption layer, is mostly a FAT filesystem), so we could edit the DSi-mode firmware settings too. We could also patch the touchscreen calibration data, like we do for DS mode (might also make that feature optional?).

Being able to generate a FAT image from a given folder, and maybe reflect changes to the actual files, would be perfect for things like the DSi's SD card, or DLDI. Not sure what is possible there, but we'll see.

I also need to finish the cheats feature. Dammit, considering all these things you see are popping up because I'm procrastinating on that.


Either way, this has been a fun ride.
Oliver says:
Jun 21st 2020
That sounds great :) is the cheat feature comming in the next update or do we have to wait a bit longer.
Peduls says:
Jun 21st 2020
Hope everything goes well with your surgery. Thanks for the update and I'm looking forward to all these great features!
thatguy'sn64 says:
Jun 21st 2020
epic so wifi and local finally work correctly? it just keeps getting better and better! Good luck with your surgery!
Zinx says:
Jun 22nd 2020
I wonder if this means it would be easier to get online wi-fi to work on Android and other devices like the Switch.
KostaSaizo7 says:
Jun 22nd 2020
Good luck with your surgery
Comlud says:
Jun 22nd 2020
Ohh HYPE! 😄
Hope the surgery goes well!
Cool Beans says:
Jun 22nd 2020
Best of luck with your surgery! Take care and be safe!
Amnesia says:
Jun 22nd 2020
A question, I have tried to run the emulator in DSi mode, I dump all the files, but when running the firmware I get a black screen with an error code. The error appears to be from the dumped NAND. I searched the internet and found a NAND that was used for No$gba in DSI mode, I put it in MelonDS and it no longer shows the error code, but it does not start either, only the screen remains black. Does the DSi function work on MelonDS or is it WIP?
Amnesia says:
Jun 22nd 2020
I clarify that I have always been testing with the latest version compiled from the git. And I don't know if it's relevant, but I do it from a Linux PC
MelonMan says:
Jun 23rd 2020
What error code do you get?
Hakase says:
Jun 23rd 2020
Same problem as Amnesia.

Dumped my files from a DSi XL 1.4.5E with fwTool (under Unlaunch).
Added the necessary no$gba footer on the NAND file - at the end (console ID and CID).

Error: 1-2435-8325
MelonMan says:
Jun 23rd 2020
I get that error code too.
https://i.paste.pics/9DR9P.png
MelonMan says:
Jun 23rd 2020
Apparently it means "Invalid signature or partition type in MBR, invalid starting LBA."
https://dsibrew.org/wiki/Bootloader
Arisotura says:
Jun 23rd 2020
you need the NO$GBA BIOS files
MelonMan says:
Jun 23rd 2020
Thanks! I can finally boot up the DSi firmware! (I used the DSI-1.mmc file from no$gba.) However, i have issues with touch in DSi mode. It works fine in DS mode. (Video link below)
https://streamable.com/0adufb
Post a comment
Name:
DO NOT TOUCH