melonDS status, and plans for the future
I figured I would write this, to give you an idea of melonDS's current status, what has been done and what remains to do.

To reply to the comments on the previous post: melonDS is already open-source, and it has always been. You will find the source code on Github. You can do whatever you want with it, as long as you are respecting the GPL.

So, here's a quick list of how things are and what needs to be done, from the top of my head. Searching the codebase for TODO/FIXME/HACK will find all the items.


CPU

All the instructions supported by the ARM7 and ARM9 are implemented.

ARM9-only instructions are enforced, altough this may be incomplete. It's unclear how some of them behave on the ARM7: some throw undefined instruction exceptions, but some seem to do nothing or behave like another instruction.

Cycle counting is rather crude and likely to be wrong for the more complex ARM9. Speaking of, the MPU and cache still have to be implemented (hopefully without killing performance). The first would allow emulating some game/homebrew crashes that happen on hardware, the second would be a requirement for reasonably accurate timings.


System

All DMA types are implemented, with reasonably accurate timings and operation. Running DMA and ARM9 simultaneously (possible under specific conditions) isn't implemented.

Timers might need checking/rework?

Memory map is accurate, including things like overlapping VRAM banks.

ROM/SPI transfers are emulated with proper delays, and should function like their hardware counterparts, minus some uncovered details (see all-caps printf() calls).

ARM9-side div/sqrt are emulated with delays.


2D

All features are implemented. Even the rarely used 'main memory display FIFO'.

OBJ mosaic may be wrong, especially with rotated/scaled sprites.

DISPCNT latching is missing. Other registers may be latched, that hasn't been researched much yet.

VRAM access timings aren't implemented.


3D

Most features are implemented.

The geometry engine is emulated mostly accurately. Polygon/vertex limits are enforced. Culling and clipping haven't been researched closely and may produce results different from hardware.

GXFIFO overflow isn't implemented properly (should incur penalty for ARM9 and presumably ARM7).

Misc things like effects of invalid operations (incomplete polygons etc) may not be implemented.

The rendering engine is emulated with much more accuracy than needed for your average game. Much research went into figuring out how the rasterizer works. melonDS is not pixel-perfect but close. Pointless besides for passing aging cart tests.

Antialiasing over shadow pixels is glitched.

The scanline cache is not emulated (requires figuring out rasterizer timings, including VRAM access and all).


Sound

Capture addition and source selection are missing (have yet to find something that uses them).

Other than that, the mixer is complete and emulated with sample accuracy.

Memory access timing isn't emulated, however buffering mechanisms (FIFO) are implemented.


Wifi

Much of wifi still has to be researched.

The current implementation allows some form of local multiplayer (and connecting to the internet with proper support), but communication errors aren't properly reported, which results in bad things. So far my attempts at fixing that only made things worse.

Wifi is subpar compared to the rest of the emulator :P



With that in mind, where do we go next?


I'm not sure about attempting to continue the JIT. Considering I went for accuracy, preserving it at a reasonable level with a JIT is going to prove tricky, even moreso when you're emulating two simultaneous CPUs and a bunch of extra hardware. Make it too accurate and the synchronization overhead negates any speed benefits from the JIT, but going too far in the other direction will inevitably break games.


DSi emulation is another of the possible avenues. There's not a lot of DSiware to play, and even less cartridge games, but regardless, there are things to be done there.


Or I might go and emulate something entirely new for me? N64? Dreamcast? Xbox?


I wonder.
extherian says:
Jun 2nd 2018
It's up to you, but I think DSiware emulation would be a fascinating topic to explore if you're fed up of working on the Wi-Fi, especially since our knowledge of the DSi is so limited. It's the predecessor of the 3DS, and in my opinion its sophisticated operating system went unappreciated by gamers.

On another note, the Nintendo DS and its twin CPUs reminds me a little of the PS2. I don't think we end-users really understand just what a unique console it was.
Anonymousse says:
Jun 3rd 2018
Why bother with the JIT? People who don't care about accuracy have Desmume and Drastic. Now, DSi, that would be something no other emulator does—not properly at least.
Ammako says:
Jun 3rd 2018
Thanks for taking the time to write a clear and concise post about the current state of things and what's left to do. It should hopefully be helpful for anyone who may want to continue this from where you left off.

It's a shame, as I was really looking forward to this emulator getting completed in the near-ish future, but you do what you need to do. Having been (and still being) through similar things, I understand what it's like. Not that you owned anybody anything in the first place, anyway.

You've made significant contributions to the DS emulation scene with everything you've done. Everyone should be thanking you, and anybody who's upset at you over this can get stuffed tbh. You've given us with a very good foundation to build on for anybody who may be skilled enough to complete this (not me, because I'm bad, but I'm sure there are people out there with both the skill and the will to work on this.)

Until then, I can play games on my actual DS, and if I really want to record gameplay, I can always save up for a capture unit. I've had a really good time using 0.6 already, it's been more than worth my while and I can't complain.
Ammako says:
Jun 3rd 2018
Dammit, all that proofreading for nothing.

owned --> owed*
poudink says:
Jun 5th 2018
tbh I've rarely seen emulators get "completed". Most of the time there's always stuff to add :P
John Doe says:
Jun 6th 2018
emulate Nintendo64 please
poudink says:
Jun 7th 2018
oh yeah that would be nice. Xbox is also in need of a good emulator, even moreso than N64. Too bad the Xbox doesn't have an interesting library (very few exclusives and even fewer ones that are actually good). Dreamcast emulation seems to be in a pretty good state already so idk about that though.
jDr0id says:
Jun 10th 2018
amazing read! keep up the good work!
Thormented says:
Jun 16th 2018
Thanks for the status update~

Since I'm just an end user, a lot of this goes over my head, but I'm appreciative of the effort to keep the community up to date on what's happening. ^^;
Incinerate says:
Jun 18th 2018
So the emulator's being scrapped? If so, that's a massive bummer. I really wanted a multiplayer-capable DS emulator.

But I guess it happens. As long as your research ends up furthering someone's project into making something even more evolved and able to run DS games, I guess I'm sorta fine with your decision.

Meanwhile, good thing I still have a physical DS to play with.
Casgaro says:
Jul 2nd 2018
Thank you very much for this project MelonDS. Now I can make my exchanges so my pokemos will be legal. It works perfectly with fifth generation games, but could support it so that it can exchange pokemons from editions like Diamond, Pearl and Platinum. Thank you again for MelonDS. n_n
Post a comment
Name:
DO NOT TOUCH