dldi patching tutorial

I was chatting over at gnome’s gaming on the go blog when I remembered that how long it took me to get DLDI patching to get homebrew games and apps to work. It seemed like I read the DLDI wiki a couple of times and then some posts before I finally got it.

First thing that made it a little difficult to understand is when or why I needed to patch. The DS Homebrew PDF now clarifies that more simply and easily than what I found at the time. The short answer is that DLDI is a necessary means of reading and writing files on your homebrew hardware, be it a slot 1 DS cart or slot 2 GBA cart.

When I first started off, the DLDI support for the M3 Simply cart I had wasn’t readily available. I found that I needed to use the DLDI file for the R4 cart.

Second thing that made difficult is that the instructions were ambiguous. They have now greatly improved. I’m going to simplify a little and be a little more specific as to how I patch and the overall process. [I admit that I started this post before I checked the new DLDI wiki, but I think a couple of key steps for the novice are left out on the wiki.]

DLDI Auto-patching

Some devices, such as the DS-Xtreme, M3 Simply DS, and the R4, support DLDI automatic patching: You can just copy the .nds file to your cart, and it will work. Most of the time. :) However, if you run into problems, you may have to patch files manually. [For my M3 Simply DS, the auto-patching has worked on every game or app I've used since I updated to the 1.06 firmware.]

This feature often requires that you get the last software/firmware for your cart. Even if your cart doesn’t support auto-patching, you should update your cart’s firmware.

  1. Check the support site for your cart for the last firmware.
  2. Download and install onto your cart.

Patching game files

Assumptions:

  • You’re running Windows.
  • You have homebrew hardware, which you know how to connect to your PC.
  • You have a homebrew app or game that you want to patch. If you don’t, I recommend some games here. You can a nearly exhaustive list of homebrew games and apps for the DS here.

procedure:

  1. Identify your homebrew hardware:
    is it a slot 1 or slot 2?
    Who is the manufacturer, such as M3, G6, DS-Xtreme?
    What is the model, if any? Some may not have one.
  2. Find your homebrew cart hardware:
    Check the slot 1 devices
    Check the slot 2 devicesNOTE: If you do not see your device listed, check the Homebrew PDF. Your device might use the DLDI file for another device, as my M3 simply DS does. However, your device might not support DLDI. If it doesn’t, don’t give up hope because several devices didn’t initially support DLDI but later did. Check your product’s support page or support forum for more information.
  3. Download the DLDI file or driver. You do not need the source.
    1. Download the Win32 tool from the Downloads section.
    2. Create a folder for the DLDI files wherever you want to keep the program.
    3. Extract the zip file to that folder.
    4. TIP: Copy your downloaded the DLDI driver file for your device to this folder, too. It makes it easier to have things in one folder.
  4. Follow the DLDI GUI instructions to patch your homebrew file.
  5. Copy the patched file to your homebrew cart, and play!

10 comments ↓

#1 gnome on 07.19.07 at 1:06 pm

Excellent peace! I’ll blog it ASAP!

You are the master of homebrew, aren’t you?

#2 guttertalk on 07.19.07 at 2:46 pm

Thanks, but I’m just obsessive.

#3 Alex on 07.19.07 at 8:01 pm

What I really want to do is sit myself down and figure out how to get some existing games dldi compatible. Namely, dsCrawl and Puerto Rico. It’s gonna be funky memory management stuff and my c is really rusty but if I can just get up the gumption…

One day, maybe.

#4 guttertalk on 07.19.07 at 10:33 pm

I’ve gone through a part of the libfat tutorial but never got to the DLDI part. I assumed that not only do you have to add in the DLDI code but also use some of the functions in the libfat library. But since you’re only talking about the reading from and writing to the cart, maybe the rewrite wouldn’t be as extensive?

Am I right that basically it’s layered like this:

game data
/\
|
|
|
\/
DLDI patched driver
/\
|
|
|
\/
libfat functions
/\
|
|
|
\/
slot 1 disk

I’m a hacker at best, but I’m be curious to know what’s involved.

#5 guttertalk on 07.19.07 at 10:35 pm

Actually, aren’t you hitting the disk for sounds, bmps, data structures, etc. which would seem to mean extensive recoding?

#6 Alex on 07.20.07 at 12:54 am

Urgh I wish I knew enough to even answer your question. You are spurring me on to look at it. I will have some sort of answer by Monday night! This is my challenge!

My off-the-cuff answer is, I bet it’s extensive recoding because c is so low level with its memory management. OTOH there might be a way to organize the code such that all/most memory stuff is handled in one or two functions. I would expect you’re hitting the disk for pretty much everything, but maybe with crawl for example you can get away with preloading everything?

Did I mention my c was rusty?

#7 Alex on 07.20.07 at 1:32 am

Well I’ll be. Looks like someone else had the same idea with DS Crawl and has done the work:
http://errabes.org/pogo2/
Sounds like it’s not quite perfect since the version of source he got was in midstream, but it sounds very playable. Can’t wait to try it. Maybe this will get the word out a bit.

As for recompiling old code to work with dldi, one fellow claimed that it was as easy as dropping in new libraries in place of the old gba fat libraries.

#8 guttertalk on 07.20.07 at 7:46 am

Thanks, Alex, for responding. That’s really good info. I’ll have to check out that version of dscrawl.

Mmmmm. I wonder if the source code for both version of dscrawl are available, just to compare the two.

It’ll be a while before I can take a gander, plus it’s harry potter weekend. :)

#9 Peter on 12.22.08 at 8:26 am

Men you are bamm.

But than I am confused.

My aim is to patch the WHO WANTS TO BE A MILLIONAIRE GAME such that I can edit the game.

I already have the .exe softcopy of the game on my hard disk.

Can you be an help?

#10 .... on 07.17.09 at 11:31 am

Need help man, not good with this kinda stuff so your gonna need to gimme a dumb persons guide to it.
My situation is that i have fire red and leaf green on my ds card which is an m3 card…. its in the NDS folder and i cannot play the games and whenever i load it just says dldi compatible and i dont know how to get it to work pleaseeee help

Leave a Comment