Explaination on why it isn't possible to install DS games as cia

Well, technically it IS possible to install a DS application as a cia, and it will run, but let me explain...

(based on my researches) here's how the original DS boots a game (ignoring validity checks):
  1. reads the header of the ROM to see where are the ARM9 and ARM7 binaries stored in the ROM
  2. loads the binaries into the RAM to the addresses specified in the ROM header
  3. jumps to specific offsets in RAM, also specified in the header
  4. from there on the game takes over the system (DS games run on bare metal)
  5. the game loads stuff from the cartridge, then you can play the game
Now, here comes the problem: since the 3DS (and the DSi) don't emulate the DS, but run it on the actual hardware, it would be impossible(?) to "just patch the TWL_FIRM to read from *insert storage device here, like NAND, SDCard, etc.*", because as I mentioned above, that's now how it works, because it's running on bare metal hardware. Also, the original system didn't had a NAND to store the games on, nor an SDCard slot (SDCards in flashcarts are handled by the flashcarts' internal processor, the DS itself never interacts with that SDCard slot), so it would be hard to tell the games where to load the assets from.

How did I research this? I was testing games on my flashcart to see if a game does something noticable before loading any assets, and when I was trying "Osu! Tatakae! Ouendan!", I noticed that the screen turns black on booting the game ASAP, so I thought that "I should test my theory, if TWL_FIRM jumps to garbage, or just the game crashes", so I converted the game to cia, installed it, ran, then the white screen turned to black, as it did on my flashcart, then it froze. This explains why the games crash: they try to read their assets from the (non-existing/non-matching) cartridge (remember? bare metal!), failing, thus resulting in a crash. This also explains why you're able to boot a flashcart by installing its firmware on the 3DS (I'm not taking credits, Apache Thunder discovered it WAY before I did :P).

But in theory it would be "easy" as writing a DSi homebrew application to begin the load sequence of game booting, PATCH the game code to ask the loader homebrew to load the assets from *insert storage device name here* instead of the game cart, then continue game booting normally, but it's not that easy. Not easy at all. Very hard, almost impossible.

Q'n'A
  • CAN I HAZ DS GAEMZ AS CIA???!!1
    - No (not yet)
  • Can I play ROMhacks installed as cia?
    - If the ROMhack patches a file in the filesystem (levels, textures, music, this kind of stuff), then no, since the files are loaded from the cartridge, but if it only patches the code (trainers, cheats, Wiimmfi), then yes
  • Can I cheat?
    - If you have the original game cart, technically yes, since the CODE is loaded from the cia (read above for explaination), so if you use a code patcher on the ROM, then convert it to a cia, install it, insert your gamecard, then run the cia, then BOOM, you're cheating without a flashcart/cheat device
  • This means I can play online games with Wiimmfi?
    - In theory, yes. If you patch the ROM with the Wiimmfi patcher, then install it as a cia, insert your cartridge, then run the cia, then you should be able to play Wiimmfi
Note: I haven't tested the stuff in the above QnA, because DSATM always crashes for me, but based on the researches it should be valid information.

TL;DR: you can't play DS ROMs as a cia unless you have the original cartridge inserted
TL;DR: shorter explaination here: https://gbatemp.net/threads/389106/page-6#post-6533728
  • Like
Reactions: 7 people

Comments

Wow impressive! But, can't you just load the resources via the System Memory, just like DSi applications on the 3DS do?
 
As I said in the blog post (did you read it, or you don't remember?), it would require patching the GAME to be able to do that, and it would require a DSi-mode game loader, so it's not really possible.
 
Impressive :)
Thank you for the explanation. I knew some of this already, but this taught me a lot. This will be tremendously helpful to the noobs in explaining why it's not so simple. You should post this in the Tutorial/FAQ section.
So, TWL FIRM is just basically placeholder code to let the game take over the console? I didn't know that, wow. That's really cool!
 
  • Like
Reactions: 1 person
@Swiftloke ye, kinda :P I haven't RE'd TWL_FIRM (yet?), but in my understanding it kinda just acts as a loader, the games run on the processor without interacting with it at all.
 
Nice post! everything you said is true.

But it is a little bit incomplete. It is even harder than you explains to make a game "patcher" :
- The TWL_FIRM contains 2 distinct modes : ds and dsi that are chosen according to the header (0x12). The ds mode have no access to the internal sd at all, only the dsi mode. The 2 mode expose also different bios because the dsi and ds bios are incompatible : the dsi bios do break most of the usual nds games. This means it would be even harder to patch a game because you would need not only to patch game card access code but also bios calls. There is also other differences (touch screen, gamecard communication, cpu speed, ram,...) between ds and dsi mode but they can be deactivated via the 0x1B8 header.
- The sd card access is also done only from ARM7 in dsi mode whereas the gamecard can be accessed from both ARM7/ARM9 and is usually accessed from ARM9. This means you need to implement some intercpu communication and implements this into the patcher. Without breaking the usual ARM7/ARM9 communication of the game of course :-)

But like you said it is not impossible, just extremely hard.
 
  • Like
Reactions: 1 person
@ahezard wow, I really like your explaination :lol:
I can't say anything... just thanks for telling me :):bow: nowdays it's hard to find a human who is ahold of this kind of 'NALIDGE :teach:
 
  • Like
Reactions: 1 person

Blog entry information

Author
Sono
Views
178
Comments
18
Last update

More entries in Personal Blogs

  • 4: Reddit
    Finally, number 4! Never thought this day would come, did you? Uhh...
  • books
    1. I am cool as hell, have one million dollars 2. I am banned from...
  • Syncthing is fun!
    Having been kinda active in an Android forum I quickly got sick about...
  • Feeling at home here
    Not much to say this time. I'm depressed. Like almost always. Trying to...
  • I'll start, rate mine 1-10
    It's a very mixed bag, some rock, some rap, some video game music, a...

More entries from Sono

Share this entry

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.hueyandweprin.com/wp-content/uploads/2020/05/iStock-1073669440.jpg +1