ROM Hack Importing BW2 arm9.bin back into ROM

ChaosHorn

New Member
OP
Newbie
Joined
Feb 9, 2020
Messages
2
Trophies
0
Age
27
XP
53
Country
United States
Hello, I am new here. So I have a question that I've been trying to solve for a whole week for now. How do I import my BW2 arm9.bin back into my ROM? I'll give the details below:

I'm playing Pokemon Blaze Black 2, a ROM hack. I wanted to increase the shiny odds by a lot so I could easily shiny hunt, as I like my team to be all shinies. So to do this, I installed CrystalTile2 and HxD. Using CrystalTile2, I loaded my ROM file and extracted the arm9.bin. Then I opened my arm9.bin in HxD, found the shiny offset, edited it to make the shiny odds approximately 1/257, and then I saved.
I also made a backup of my modified arm9.bin. Then I opened CrystalTile2, loaded my ROM, clicked the DS icon, and then right clicked on the arm9.bin and chose the "Import" option. It opened up my File Explorer, and I chose my edited arm9.bin. However, it didn't work; it said "file is too small! Enter a new location(V):
No data after the previous position. ROM makes new is recommended." I searched online again for answers, and one person said to choose the "Compress" option instead of the Import option, saying that the error would not occur if I did this. I tried it, and.... it happened again. So I browsed on the Internet again, and people said to use ndst and Tinke. I tried those two tools, but I didn't see any option for importing an arm9.bin. I'm totally clueless now, and I have no idea what to do. Please help!
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
General overview of things, including for others playing along at home.

In commercial DS games and most DS homebrew the ARM9 is the main processor of the DS (certainly faster with some more abilities) and accordingly runs the bulk of the code the game cares about. Indeed the ARM7 binary is generally so... unmodified by the commercial devs that you can swap it between ROMs of similar vintage with zero ill effort (and possibly some perks as far as dodging anti piracy if your flash cart or emulator is not up to snuff).
They can be compressed. Unlike most files on the DS the binaries and overlays (small sections of code that get swapped in and out of memory) use so called binary compression aka BLZ compression which works a bit differently to the common BIOS compressions/type 10/type 11 that we normally see on files. For specifics get the source code to cue's ds compression tools and have a look, it is also the program I would suggest for compressing them (naturally you will want the BLZ version). https://gbatemp.net/threads/nintendo-ds-gba-compressors.313278/
There is a flag in the header for the ROM to tell if the binary is compressed, some people do it as an additional compression in the ROM (indeed there are some ROM dumpers that took to doing it), but most hackers with them not being concerned about space savings could choose to disable compression and not have to worry about packing it back up after every edit.

Crystaltile2. A wonderful program for editing ROMs but not without its flaws.
Sometimes it falsely detects binaries as compressed (there will be a little icon saying LZ or something in the left hand side of the DS ROM structure popup window) and can cause fun here. I am also not sure it supports BLZ or can be relied upon to employ it.

Importing files into DS games then. There are two main approaches.
1) Matching file size.
2) Rebuild or redirect.

For 1) then DS games use a file system, which is to say a long list of locations of where things are found. This is in stark contrast to everything older than it that was not on floppy disc or optical media (and quite a bit of GBA homebrew too) but different discussion there. Redoing all these list of locations when you shuffle everything forward or backward can be done (see "2)" in a little bit for more on that) but is annoying to code so many simpler tools (things like ndsts being among the more notable here) will want things to be the same size going in as the file that is presently there. You can usually pad a file out to be the new size, though if you made it bigger then that is harder.

The redirect part of 2) is done by more advanced tools and while crystaltile2 is theoretically one of them nobody really relies on its file import options (maybe the ROM building ones if you have to). I don't know what we are suggesting for this sort of tool these days as an automatic option, probably tinke though. The ideal being if the file is smaller it will correct the size aspects, and if it is bigger it will find some empty space, create some empty space and shuffle everything else forward or backward, or add some more to the end of the ROM and stick it there.
For my purposes I usually just rebuild the entire ROM each time (still have a couple of batch files I made back when ROM ripping was still being a thing that I use), and by the time I come to making a final patch will manually insert and correct things if necessary (xdelta is a wonderful patch maker and can cover a lot of sins). If you need the binary to be compressed then make sure you do that to, also make sure you are working on a decompressed binary if you are making edits as compression might get messed up if you edit a compressed file (short version is LZ scans in a window from where it is at, your change might disturb something it references somewhere else. There are ways you can check but I will skip those today in favour of come back when you can tell me what they are.).

3) would probably be relinking but no DS tool offers this that I know of (the PSP tool umdgen has a nice simple option for this one) so any hacker that wants it usually does it themselves, and for the most part don't do it on DS ROMs as much as files within them (a lot of simpler music mods are this). I mainly mention it just to be thorough.

Short version in answer to OP's problem. Keep crystaltile2 around for other things but for this either find a tool that can handle file size adjustment (probably something like tinke), or just unpack the entire ROM and rebuild it; as crude as it is then unpacking everything with something like ndstool, overwriting the arm9 with a suitably modded one, and rebuilding the whole ROM with ndstool can help you dodge a lot of troubles.
 

ChaosHorn

New Member
OP
Newbie
Joined
Feb 9, 2020
Messages
2
Trophies
0
Age
27
XP
53
Country
United States
Hey! Thank you so much for replying! So uh I'm really new to all of this, and I simply don't know what to do even with the directions. Could you please give me step-by-step instructions for Method 1 and 2? I'd be really gratified if you did so. Anyways, thanks again!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: https://youtube.com/shorts/WOppJ92RgGU?si=KE79L6A_3jESsGQM