melonDS aims at providing fast and accurate Nintendo DS emulation. While it is still a work in progress, it has a pretty solid set of features:

• Nearly complete core (CPU, video, audio, ...)
• OpenGL renderer, 3D upscaling
• RTC, microphone, lid close/open
• Joystick support
• Savestates
• Various display position/sizing/rotation modes
• (WIP) Wifi: local multiplayer, online connectivity
• and more are planned!









Download melonDS

If you're running into trouble: Howto/FAQ

If you're feeling generous: melonDS Patreon
Progress on the DSi front
The other front would be, you know, getting 0.8.3 good for a release. Which means, fixing the goddamn audio output system. Have been rather unsuccessful at that task for now.

So instead, I did what I typically do in these situations: procrastinate and work on something else.

In this case, the DSi front.

If you remember, this was at a point where it needed wifi initialization to be able to launch titles. I was stuck at a particular point of the init procedure, where it waited for something and I had trouble figuring out what. But, regardless, I set to work.

In the meantime, googling some of the strings present in the firmware's wifi code brought me to this Atheros driver codebase which is very close to what the firmware uses. This helped me a lot in figuring out how things work and what the firmware was expecting.

And, well...

melonDSi config melonDSi flipnote

It's possible to boot shit from the firmware now!

Couple issues with this though.

... read more
The JIT
Things have been slow lately, you may have noticed. Couple reasons to that.

I meant to fix a few of the issues we had lurking around, so we could release 0.8.3. I managed to fix some issues that caused random crashes on exit, then began trying to fix the framerate limiter. Thing is, it is directly related to the audio output code and the issues that has. So, yeah, I still haven't found a solution to that tricky problem.

I also need to struggle to keep some motivation at times. Looking at the patterns in how I work, it is likely that I have ADHD. I have yet to get diagnosed and all, but this wouldn't surprise me.

Anyway!

As you may have noticed, Github user RSDuck sent a pull request for the JIT recompiler. This is a bit of a tricky situation though. I don't want to have to deal with a situation where people make third-party JIT builds, but at the same time, the JIT isn't quite ready for general use, as we're still ironing out various issues with it.

However, the JIT is said to give a performance boost ranging from 30% to 100%, which is fairly nice, especially as there's room for improvement. RSDuck also said that porting the JIT to other architectures, like ARM, should be easy, so we might finally have Switch builds that run at acceptable speeds.

Or, also, Android builds. But, dunno. On one hand, this is a market I want to address, but on the other hand, history from Dolphin has shown that the Android userbase isn't exactly the nicest to deal with, so... yeah. And don't get me started on Android itself and the fun that coding for it is.


But first, let's focus on what we have in front of ourselves.


I'm going to try as hard as I can to fix the audio issues for 0.8.3 (and also add a vsync setting).

We will also be releasing beta builds of the JIT and the DSi branch, for those of you who want to mess around with things.
welp.
Slowly figuring out what makes the DSi menu tick. Aaaaand...

It will require some amount of wifi support to be able to launch titles. The amount required makes the 0.2 wifi stub look tiny in comparison. Basically the DSi menu tries to communicate with the wifi CPU thing and upload firmware to it.

We can either HLE it given sufficient documentation (and have to deal with ass-shitting high-level wifi concepts) or LLE the damn thing.

We'll see.
the heat
glarg

..

Let's just say it's a bit hard to be productive when your outside temperature is a scorching, capitalism-induced 43°C.

It's back to more reasonable temperatures now, but regardless, we don't do much besides bathing at the beach or at the nearby river.

I kind of need to take a break at this point though. Like, there are many things I want to do with melonDS, but I have too much ideas, and there's only so much I can do at once.

I will need to release a quick-fix 0.8.3 though. Atleast to fix the bug I introduced when adding support for 'Ctrl+M' type keys'. Basically you can't press any key while keeping R pressed if you keep the default mapping (right Shift).

I also want to try and fix the framerate limiter, which, askskfdksgsf.

On the DSi side, there will be some alpha builds of melonDSi once I finish the DSi dumper. Right now, the dumper is able to extract AES keys from the AES engine. The rest will be a breeze: dumping the BIOSes, the memory holding RSA/Blowfish keys, the NAND, the eMMC CID and console ID. It's mostly just matter of copying memory to a file, except the NAND is going to be a bit more involved, but nothing insurmontable.

I gave melonDSi a small pause, because I got stuck on AES-CCM (needs hardware tests) and also didn't want to let the master branch rot. Right now, it's not in a very interesting state -- all it does is boot the DSi menu, but it's still not getting further. And also because I keep fixating on the lack of full DSi bootroms. I'm even considering getting in touch with someone who is doing the hardware haxing required to dump them, or attempting to do it myself.

... read more
melonDS 0.8.2
melonDS 0.8.2 is out! This is not so revolutionary, but we're fixing a few issues.


Namely, there have been some fixes to the OpenGL renderer. If you were one of those for whom it did not work, we hope that now it will work. There are still issues with it, but we will eventually find them and fix them all.

I also undid a quick hack I did in 0.8.1 to try fixing texture alignment problems, that in the end caused more issues than it fixed. This problem will need a cleverer solution. It basically stems from the fact that the DS rasterizer works differently from OpenGL: it has no subpixel precision, and calculates color/texcoord for exact pixel positions, where OpenGL calculates them for a position that is +(0.5,0.5) inside the pixel.

I also hope to improve the GL renderer some more. In mind are: texture cache, texture upscaling/filtering, applying filtering to the 2D layer, doing something for dual-screen 3D...


We fixed a bug with the 'map joystick button and axis' feature of 0.8.1, where, if you mapped an axis control alone, it would also map 'button 1' alongside it.


melonDS now explicitly disables VSync when using OpenGL, atleast under Windows.


We also fixed a bunch of issues, potential crashes, etc...


... and changed kMaxIterationCycles from 16 to 64. That constant controls how many maximum cycles the ARM9 can run before control is given to the ARM7 and other system components. This change might affect accuracy negatively (it is worth noting that melonDS has several provisions for on-demand sync, bypassing kMaxIterationCycles) but has been found to give a small speed boost.


We're also using Github releases now. I'll add the builds to the Github page (and to the downloads page on this site) soon :)

... read more
melonDSi???
Well...

[DSi shito]

It doesn't get further than this though, but, considering the amount of work this required, between implementing the newfangled DSi hardware and fixing stupid bugs, this isn't a bad start. We can also thank Martin Korth and all the other comrades who have been paving the way and making this possible at all.

This is nowhere near ready for a release tho. It's an experimental branch in which I felt like playing around with things, attempting to boot a DSi firmware, and, well, this happened.

This also requires a bunch of data that have to be dumped from a DSi:

* NAND dump
* eMMC CID
* console ID
* RSA/Blowfish/AES keys

Those can be dumped from a DSi with unlaunch, but we will need a user-friendly way to do so.

--

There is also the issue that, well, this isn't completely clean and perfect.

... read more
melonDS 0.8.1
melonDS 0.8.1 is out, and that fixes some of the issues that were discovered in 0.8 (mostly stupid oversights, heh), but also adds a few other features and fixes. Let's see.

Edit- If fast forward doesn't work for you, it means one of two things: you're using OpenGL and your video driver is forcing vsync, or melonDS is just not running fast enough for fast-forward.




Input upgrade

The input code has been reworked to be more pleasant to deal with, especially with regards to adding hotkeys. In less nerdy terms, what does this mean?

It is now possible to map keys with modifiers, like Ctrl+Z or Shift+R or even combinations like Ctrl+Alt+Q. It is worth noting that during mapping, you should use left-hand Ctrl/Alt/Shift keys for these mappings. However, ingame, both sets of keys should work. This feature may not be too useful for DS input, but it should be more handy for hotkeys. It is also possible to delete a key mapping by pressing the Backspace key during the mapping process.

I have also been upgrading joystick support. You can now choose which joystick to use, and can map axes to buttons/hotkeys.

The twist to this is that I liked the old "axis maps to DS dpad" feature, and how it could be used alongside regular button/hat controls. I didn't want to lose the ability to use both, but I also wanted to make it, well, not a hardcoded mapping. So instead, you can map both a button/hat direction and an axis to each control. When mapping a joystick control, pressing a button/hat direction keeps the axis mapping intact, and vice-versa. You can delete both mappings by pressing Backspace during the mapping process.

The aforementioned axis support should also be able to support analog triggers, which are typically exposed as axis controls.

... read more
Defying all expectations
After a good while of working on the OpenGL renderer, fixing its issues for a 0.8.1 release, attempting to add some features, I figured I'd look at some of the old game issues. melonDS has reached a point where almost every known game bug is a timing issue, but not all of them are.

In particular, this issue: graphical glitches in iCarly - Groovy Foodie.

When it was posted, I didn't look much into it, thinking that was my topnotch software renderer acting up, and hastily giving it the '3D accuracy' label to put it on the backburner.

So I thought, hey, let's see if this is any different with the OpenGL renderer?

Which is where this bug started defying my expectations. Software or OpenGL, it didn't matter, the graphics looked the same. But, when I tested the game under DeSmuME and NO$GBA, they both exhibited the same bug.

Which is where I knew that we were in for an interesting ride. Typically, emulation bugs in melonDS are either specific to melonDS, meaning it's a flaw in my implementation, or they're shared with NO$GBA but not DeSmuME, which means that is some hardware behavior that was discovered by the DeSmuME team but did not yet make it into GBAtek. But with a bug that happens in every of these emulators, we know that we're stepping in uncharted territory.

So, as usual, we start by investigating how the game renders its graphics. The issue has nothing to do with 3D graphics at all, as it's not using the 3D engine. In particular, the glitched intro logo on the top screen is made of sprites, but looking at NO$GBA's sprite viewer shows there's something fishy behind this.



We only have a handful of the 16x16 sprites that make up the logo. Where's the rest?

... read more
Hotfix release
If you downloaded melonDS 0.8 before this post, please redownload it, we just pushed a hotfix release.

This should fix broken 3D rendering with OpenGL, namely for AMD/Intel GPU users.

Seems hotfix releases are a common theme with melonDS :P
melonDS 0.8
It's been awaited for so long, and finally, by popular request, here it is: melonDS 0.8, with OpenGL renderer and upscaling!



So, without further ado, let's discover all the details of this.


The OpenGL renderer

This renderer is an attempt at targeting a sweet spot of, say, 90% compatibility while being fast. If you have read the previous posts about the DS GPU and how quirky that thing is compared to your average GPU, you guess that perfect rendering with OpenGL isn't going to be possible, but we can do our best.

The current renderer supports most of the DS GPU features, but not all of them. There is room for improvement, but certain features will just not be implemented. For the games that happen to require those, we still have our old trusty, nearly pixel-perfect software renderer.

But, the OpenGL renderer opens the door to all sorts of graphical improvements. I have plans in mind for more features (namely, some form of texture filtering), but I will draw a line as to keep the codebase not too complex.


Upscaling

The OpenGL renderer is enabled by default, but you can go to the video settings dialog to configure it. Namely, this renderer supports increasing the internal resolution to up to 8x the native resolution.

... read more