News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Is it possible to add functionality to an NDS game coded via DevKitPro?  (Read 444 times)

juribi

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
I've written a basic .nds file using DevKitPro which calls an external http API. I want to add this functionality to an existing .nds game (Pokemon White 2) so I can call the API whenever I catch a Pokemon.

Is there an established method of adding DevKitPro code to an existing .nds file? I've been unable to find anything specific...

I was going to compile my DevKitPro code from .c to .nds, then locate what I'd written in IDA by opening the arm9.bin file of my .nds file. Then, I was going to copy that code across to my Pokemon White 2 .nds file's arm9.bin and call its address whenever I wanted to make an API call. Am I over-complicating things?

I don't want someone to do it for me, I just want a push in the right direction.

Thanks, and apologies if this isn't the right section.

FAST6191

  • Hero Member
  • *****
  • Posts: 3178
    • View Profile
It is not an especially established route. You could probably compile for a target location in RAM that you confirmed as free (or converted to an overlay) but it would be an odd one.

The main example of anything that hackers code to would likely be the New Super Mario Brothers wave playback hack.
https://nsmbhd.net/thread/475-tutorial-nsmb-sound-and-music-hacking-guide/
https://github.com/Dirbaio/ASMPatchTemplate


But yeah most would probably just look at the game on a game by game basis and inject their own assembly code into it.

Possible alternative. Didn't the source code for this game and associated build tools get leaked a while back with the whole gigaleak thing? I remember seeing someone looking at some DS pokemon code but I don't know if it was B&W2 or an earlier effort.

Alternative 2. Many will instead of doing something like a fully fledged HTTP request will just do a basic packet of data and send it such that netcat on a PC will be able to interpret it.

juribi

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
The main example of anything that hackers code to would likely be the New Super Mario Brothers wave playback hack.
https://nsmbhd.net/thread/475-tutorial-nsmb-sound-and-music-hacking-guide/
https://github.com/Dirbaio/ASMPatchTemplate

Possible alternative. Didn't the source code for this game and associated build tools get leaked a while back with the whole gigaleak thing? I remember seeing someone looking at some DS pokemon code but I don't know if it was B&W2 or an earlier effort.

I took a look into the whole gigaleak thing - I'm impartial to which Pokemon DS game I make the modifications to. I managed to get the Pokemon Diamond source compiling in English on my machine, so I've been poking around trying to get it to play nice with DevKitPro... which has been a fruitless endeavour so far. Might have to look into how the existing code manages to establish a WiFi Connection, but I imagine it would be devastatingly messy from what I've witnessed so far.

Thank you for the resources! I'll use them send me in the right direction if my lazy DevKitPro endeavour continues to fail.

FAST6191

  • Hero Member
  • *****
  • Posts: 3178
    • View Profile
On the wifi thing then maybe look up pokemon teaches typing PC hack as it used network to fake a keyboard*.
https://gbatemp.net/threads/release-game-hacking-for-learn-with-pokemon-typing-adventure.480825/ being one such post.

*the cartridge itself had a bluetooth controller in it and a keyboard in the box. Flash carts obviously did not have this or a suitable alternative (other than DSserial, which is not a flash cart really, none really do anything like that) so this was how it was eventually sorted.

Equally I doubt you will get the commercial efforts compiling with devkitpro, at least not without a considerable amount of effort, and pretty much going to have to use the commercial tools that also dropped in one of the gigaleaks.

phonymike

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
I haven't used it, but Ghidra might decompile the game into readable C code. You should be able to find a vblank routine that gets executed every frame, and insert a jump to your code. You can try xkas or armips to not only compile your own code but insert it into an empty area in the game (near the end usually).