• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Other] How can I inject a .s ASM Routine in a NDS ROM?

Lunos

Random Uruguayan User
  • 3,176
    Posts
    16
    Years
    Hi. I've saw a certain French SoulSilver HackROM called "Mind Crystal" which runs at 60 FPS, or more like 30x2, whatever.
    The thing is, the creator of the ROM Hack shared some of the Hack's features in the form of .s files which I think that are actual ASM Routines. What I wanted to know was if someone here knows how to inject these into Clean ROMs.
    For example, this is the 60FPS's content:
    Spoiler:


    Welp, thanks in advance for reading, greetings from Uruguay <3
     
    IPS files are designed for making it possible to just click 'apply ips patch' button with a patching tool and then the tool goes through the ips patch file, finds generally data that just tells
    1) Where to write to followed by
    2) The data to write there.

    If these .s files work in a similar way except for the fact that you can't use any tool to automatically apply the changes into a rom file, you have to do the job yourself. By taking a look at that small piece of code you posted here, I assume you're simply supposed to write asm instructions "NOP; STR R0, [R4, #0x2C]; BX LR" in address 0x02000E26 (although I don't know what 'xrpl' stands for so I could be wrong).

    Anyway, is that piece of code you wrote here from some .s-file meaning those files are just pure text and cannot be inserted to rom just by copy pasting their contents in there? In case that is the case, you either want to find an asm editor of some sort (like this one for instance which is designed for writing routines into the rom in GB/C asm format: https://www.romhacking.net/utilities/282/), an assembler that can insert "scripted" routines into the rom, or some sort of instruction sheet that tells the hex values of each asm instruction and that way you can use that as a help for writing the routines with a hex editor for instance.
    If you're interested in learning, might as well start here https://nsmbhd.net/thread/243-the-arm-assembler-tutorial-tutorial/

    P.S
    Just noticed they say the CPU architecture of NDS matches that of GBA. This practically means you can "insert" routines the exact same way you could do for GBA. You might as well use that as a help in searching for the solution as well.
     
    IPS files are designed for making it possible to just click 'apply ips patch' button with a patching tool and then the tool goes through the ips patch file, finds generally data that just tells
    1) Where to write to followed by
    2) The data to write there.

    If these .s files work in a similar way except for the fact that you can't use any tool to automatically apply the changes into a rom file, you have to do the job yourself. By taking a look at that small piece of code you posted here, I assume you're simply supposed to write asm instructions "NOP; STR R0, [R4, #0x2C]; BX LR" in address 0x02000E26 (although I don't know what 'xrpl' stands for so I could be wrong).

    Anyway, is that piece of code you wrote here from some .s-file meaning those files are just pure text and cannot be inserted to rom just by copy pasting their contents in there? In case that is the case, you either want to find an asm editor of some sort (like this one for instance which is designed for writing routines into the rom in GB/C asm format: https://www.romhacking.net/utilities/282/), an assembler that can insert "scripted" routines into the rom, or some sort of instruction sheet that tells the hex values of each asm instruction and that way you can use that as a help for writing the routines with a hex editor for instance.
    If you're interested in learning, might as well start here https://nsmbhd.net/thread/243-the-arm-assembler-tutorial-tutorial/

    P.S
    Just noticed they say the CPU architecture of NDS matches that of GBA. This practically means you can "insert" routines the exact same way you could do for GBA. You might as well use that as a help in searching for the solution as well.

    But it's not, that the same ASM routines for GBA work for NDS roms? Or yes?
    NDS hacking has much more potential, to create long games with much content, but it isn't researched as much as GBA hacking and harder, to hack.
    Are there tutorials for NDS hacking?
     
    The same asm routines won't work in nds games since practically all routines somehow modify the state of ram memory. In NDS games, the data in ram is different from that in any gba pokemon game (= ram is practically the state of the game containing for example the graphics that are loaded on screen, the pokemon you have and their stats and moves, names of characters, and lots of other data that the game has used in the "early past").

    Anyway, what I meant there is that Nintendo DS and Gameboy Advance have the same CPU. CPU for these two devices executes ARM assembly which means that you can write asm routines for both NDS and GBA in the same way, using some tool that can write and insert asm routines for GBA games should also support inserting/writing routines into NDS games.

    I just linked you a tutorial into arm assembly hacking which is something that's good to know for hacking both GBA and NDS games.
     
    Download the latest NSMB editor:
    https://nsmbhd.net/file/d86fa4d5bfb663c65bde/nsmb-editor-380b.zip

    And follow the instructions in this tutorial (don't download the NSMB Editor revision linked in the tutorial below):
    https://nsmbhd.net/thread/1281-how-asm-hacks-are-setup-tutorial/

    I modified the ASM Patcher so that it could take into account all 5 Gen IV versions in all 7 languages.
    Bear in mind that the .s files you mentioned are specifically meant for SoulSilver (French), if you want to use those hacks in an other Gen IV game, chances are you'll need to tweak the offsets a bit.
     
    Back
    Top