DLDI

From Bibliotheca Anonoma

DLDI stands for dynamically linked device interface and is a method by which developers can make programs for carts with mutually incompatible drivers whereas before there would have been several builds required, the basic theory is that the code is compiled with a blank space and then the user patches this blank space for use with their cart. The EZ4 and EZ5 both have DLDI patches and their use is wholly supported by sosuke.com in place of individual libraries.

For a basic tutorial, see DLDI#DLDI Tutorial.

History[edit]

Originally when DS homebrew first appeared people continued to use file systems and similar techiniques created to contain stuff for GBA (many of you will have heard of GBFS or moonshells imfs).

Eventually it was found that you could read data right off the card (and perhaps more interestingly write data to the card) making things like music and video players as well as text viewers, emulators and the like potentially far easier to update from the users point of view as well as include interesting features (there exists FTP applications for the DS for example), naturally every card was different and did not work with others access routines (worse still some interfered with others).

As card access is fairly low level programming libraries were made so as to delegate cart reading to the libraries, the eponymous gba_nds_fat by Chism (now superseded by libfat) probably being the most renowned of the lot (there are other libraries and the DSlinux project uses their own, DLDI is starting to enter however). Naturally not every card had access routines and sources necessary and well as the ability to play nice with other cards meaning they were not supported in the libraries and consequently homebrew that uses it.

This caused a lot of headaches on the card owners end, card reviewers end, forum viewers end, programmers end (see all the versions of DSOrganise around) as things would have to be recompiled with new libraries (something end users are loathe to do) and it was all a mess.

Now Moonshell uses the method of having a windows installer which the user makes into a useable file for their flashcart and very recently chism added similar functionality to his libraries (a new version of gba_nds_fat was also made despite being an discontinued project) meaning that any application made using the new libraries has some blank space added will merely have to be patched on the users end to support their cart. There are already versions of moonshell, DSdoom and a couple of other apps using DLDI going around and many of the newly compiled programs also possess DLDI support. Patchers (all three major OS') and libraries required Chism's DLDI page

Here is a thread with a bunch of older programs that have now had DLDI support added if their creator had not added support, most applications compiled recently have dldi support added (check various forums and news sites for betas and check): gbadev thread


General usage[edit]

There is all manner of appplications ranging from right click to full blown GUI based applications, the command line method is detailed here: DLDI is simple enough to use visit the site download the dldi file for your cart download the patcher (the command line one is detailed here as it simple enough to use) The syntax is:

dlditool <dldi> <app>

That is to say if you were to patch a file called a.nds for the EZ4 you would first make sure a.nds was in the same directory as ezsd.dldi and the patcher called dlditool.exe, then type

dlditool ezsd.dldi a.nds

Hit enter and a few seconds later a patched application would appear, copy this to your card and do whatever else is needed for the app (copy films, roms, isos, music, pictures....)

FCSR - older carts see here[edit]

Older flashcards such as the EZ1/2 as well as those without DLDI support at present can make use of FCSR for read only purposes.

EZ5 issues[edit]

The EZ5 kernel currently does not launch homebrew unless the gamecode is set to PASS, see this post for a tool to resolve this. Other tools also exist to correct this.

Developers[edit]

There exist versions of GBA_NDS_FAT and libfat with DLDI support, libfat is the newer version that is updated with gba_nds_fat the old version that is now effectively discontinued.

Libfat:

GBADev thread

gba_nds_fat:

backported interface


See also developers_page on this wiki.

DLDI Tutorial[edit]

NOTE:This FAQ is slightly antiquated by the release of kernel 1.7, which DLDI patches for the user. Auto-DLDI patching is not perfect, some users may use kernels older than 1.7, and some users may not use the EZ-Flash V as their flash cart. This FAQ exists for that purpose.

This tutorial will teach you about DLDI patching. While all of the terminology may seem confusing at first, it isn't really that hard. This will teach users how to correctly DLDI patch. While the steps will vary for users of other operating systems, DLDI patching consists of the following:

-Obtaining a DLDI patcher.

-Obtaining DLDI compatible homebrew.

-Patching the file with the DLDI tool of choice.

-Copying the file to your SD card.

Questions and Answers[edit]

What the heck is DLDI?!?!?

A great explanation is on the DLDI article. In a nutshell, many homebrew apps and emulators require access to your memory card to run properly. However, since each flash cart writes to the memory card differently, the program has to be modified to work with a specific cart. DLDI patching inserts this necessary code inside the app/emu so it can work with whatever flash cart.

Why does this FAQ matter? I put (homebrew name) on my cart and it worked just fine! There are a couple of reasons for this.

First, not all homebrew requires DLDI. These programs do not require patching.

The second is that this FAQ was written before EZ-Flash V kernel 1.7, which added auto-DLDI patching by the card.

If Auto-DLDI is now a feature of the EZ-Flash V, why does this article exist? There are a few reasons.

Firstly, not every EZ-Flash V user will want or bother to upgrade to the latest and greatest kernel, for whatever reason. This FAQ can help them.

Secondly, Auto-DLDI is not always perfect. Some programs may have issues and require on-computer patching, possibly with an alternate DLDI patch. This is rare, but it can happen with certain homebrew.

Thirdly, some users may be EZ-Flash users, but also want to know how to patch for flash carts that lack this relatively new feature. This FAQ can still help them.

Why can't the program author/hosting site/Mommy do it for me?

There are several reasons.

First, program authors and hosting sites do a lot of work as it is; making homebrew and hosting it requires a lot of effort.

The primary reason is the wide variety of flash carts. By putting one, ready to be patched file online, users can use the program on whatever card they want with a little effort.

Finally, some flash carts get updated DLDI files for compatibility. By putting an unpatched file for download the user can use the latest availible DLDI file for their flash cart.

Should I DLDI patch every ROM?

NO!. You should only patch files that specifically ask for DLDI patching. Patching a file that does not require DLDI will likely corrupt it.

I tried patching (insert app name here) and it didn't work, now what?

First of all, try the authors readme; many programs require accompanying files, and must be put on the flash cart in a particular way.

Rarely, it is a problem with the DLDI driver or the app itself; you can contact the author to see if it is such.

Sometimes, an app will come with Appname.nds and Appname.sc.nds; you should patch the nds file, NOT the sc.nds file, unless you are using a SuperCard flash cart. If you patch the .sc.nds file and you aren't using a SuperCard, it won't work.

Hey, a new DLDI driver is out for my card, should I repatch everything?

Generally, no.

The exceptions to this are when you have a program that would not work correctly with a previous DLDI driver, in which case you can attempt it with the new one, or for any apps from that point forward; updates are to fix compatibility, and it makes sense to use the newest possible driver.

How to[edit]

Step 1: Get a tool[edit]

Your tool will depend on your operating system. For Windows users, many are availible, but the best (in the authors opinion, especially for the EZ Flash V) is DLDIrc (DLDI right click) by PsychoWood. It is extremely easy to install (to the point where it will let you know if the installer is out of date), and once installed, it is extremely easy to patch homebrew.

Also, using a fix by Cory1492, homebrew gamecodes will automatically be changed to "PASS" for EZ Flash V users. This is required for homebrew to run correctly, and using DLDIrc will save you time (you won't have to run another tool). This is no longer relevant in kernel 1.5 and above, which will take the standard homebrew gamecode of "####".

A changelist between versions can be found at the DrunkenCoders wiki here. You can download the latest version here.

Other DLDI patchers may be used, but they may require additional steps to work.

Installation is not difficult; follow the prompts, select your flashcart, and go.

Mac users can use DLDI Drop, and Linux users may use DLDIGui.

Step 2: Find some homebrew[edit]

This is probably the easiest step, and this is probably why you're reading this wiki! There are many sites that host homebrew for the DS, and any that mentions "DLDI" is a candidate for patching. You should always read the readme, however, so you patch the right thing (usually, it is AppName.nds that needs patching).

Step 3: DLDI patch[edit]

After finding the homebrew, you should right click it and select "DLDIrc SD card name Patch".

A window will appear; directions on screen are simple: close the window to cancel, or press any key to patch.

Some offsets (technical information) will appear onscreen; if the ROM is patched successfully, it will say so explicitly. If not, it will also say so explicitly.

Step 4: Put the file on your flash cart[edit]

Copy the file to your flash cart like any other game/app.