Unable to compress arm9.bin for Tales of Hearts DS Anime Edition

TheCopulator

New Member
OP
Newbie
Joined
Dec 18, 2023
Messages
4
Trophies
0
Age
35
XP
36
Country
Canada
Rom: Tales of Hearts DS Anime Edition

Hi,

I'm still very new to romhacking. I am currently working on Tales of Hearts DS to translate in English.
Most of the menu text is in arm9.bin. I first used CrystalTile2 to do the following steps
1) Open Crystaltile2, decompress Arm9.bin
2) Translate a string
3) Open Crystaltile2, replace arm9.bin with the compression option

These steps works most of the time. (Sometimes, I do get the infamus, file is too small blabla when compressing arm9.bin), but I had a lot of success with this method.
I was able to translate most of the main menu.

The thing is this method is relatively manual and I would like to have a one click batch file to create a new NDS rom with my arm9.bin translated to test it in Desmume.

I read a lot of different romhacking sites and found out that the arm9.bin file used some kind of BLZ compression than be compress/decompressed using CUE's tool.
So what I did is

1) Unpack the original nds rom using ndstool in a folder
2) Decompress arm9.bin using Cue's tool
blz -d arm9.bin
3)Translate a string
4) Recompress using cue's tool
blz -en9 arm9.bin
5) Create the new rom using ndstool

When I do these steps, the game stays on a black screen when I open it. I'm not even able to see the Namcobandai title.

- Decompresing arm9.bin using Cue's tool works perfectly.
- I already did some test and I'm able to use desmume to open the memory view, find my string and hex edit and this works
- When I say translate a string in my steps, I'm basically hex editing the file with hxd, not updating any pointers and padding with 00s

What I also tried:

1) Take arm9.bin from Tinke
2) Decompress arm9.bin using Cue's tool
blz -d arm9.bin
3)Translate a string
4) Recompress using cue's tool
blz -en9 arm9.bin
5) Replace the file in Tinke and save the rom

Using Tinke will work when I just hex edit a simple string. If I try to update the pointers and update more strings, I'll still get a black screen and the game won't load.

Is it that I'm not using properly cue's tool to recompress the arm9.bin?
Maybe there are some steps required?

Thank you for all your help!
Post automatically merged:

To add more information, The command I uses with ndstool are the following. They have been taken from DSLazy batch files.

- Unpack the rom
ndstool -x TOH_Original.nds -9 NDS_UNPACK/arm9.bin -7 NDS_UNPACK/arm7.bin -y9 NDS_UNPACK/y9.bin -y7 NDS_UNPACK/y7.bin -d NDS_UNPACK/data -y NDS_UNPACK/overlay -t NDS_UNPACK/banner.bin -h NDS_UNPACK/header.bin

- Pack the rom
ndstool -c new.nds -9 NDS_UNPACK/arm9.bin -7 NDS_UNPACK/arm7.bin -y9 NDS_UNPACK/y9.bin -y7 NDS_UNPACK/y7.bin -d NDS_UNPACK/data -y NDS_UNPACK/overlay -t NDS_UNPACK/banner.bin -h NDS_UNPACK/header.bin


Also, I'm not sure if this is the expected behavior but the new size of the rom is lower than the original.
Original: 262144Kb
New: 242 524Kb

Thank you!
 
Last edited by TheCopulator,

mn1712trungson

Member
Newcomer
Joined
Oct 15, 2022
Messages
14
Trophies
0
Age
30
XP
271
Country
Vietnam
Read history.txt inside Cue's GBADS compressors folder.
You need update ARM9 size after compressed with Cue's tools (usually smaller than OG).
ndstool often trims data, making the output file smaller, but usually does not affect the structure.
You can use Tinke (legacy) to resave the file to its original size.
You need the NDS ROM to update the ARM9 size in the ARM9 file:
- get the ARM9 load address (offset 0x0028)
- get the ARM9 autoload (offset 0x0070)
- the offset is the previous dword value @ autoload
- change the sizes in the 1st/2nd/6rd dwords pointed by the offset:
+ 1st: ARM9 decompressed size - 0x18
+ 2nd: ARM9 decompressed size
+ 6rd: ARM9 compressed size (0 if ARM9 is uncompressed)
(do not forget update all values with the load address)

load = *(int *)ROM[0x0028];
auto = *(int *)ROM[0x0070];
offset = *(int *)ARM9[auto - 1*4] - load;
*(int *)ARM9[offset+0*4] = load + ARM9_decompressedsize - 0x18
*(int *)ARM9[offset+1*4] = load + ARM9_decompressedsize
*(int *)ARM9[offset+5*4] = load + ARM9_compressed_size (0 if decompressed)
1703730558780.png

 
Last edited by mn1712trungson,

plasturion

temporary hermit
Member
Joined
Aug 17, 2012
Messages
1,236
Trophies
2
Location
Tree
XP
3,532
Country
Poland
When you get screen freeze after updating pointers (if it's the main reason after file update), probably you didn't calculated new address correctly. Do you add segment of arm9.bin ram location to put absolute value of pointer? commonly it's the fourth byte speaking of low-endian contianing 02h (common location for most games where the arm9.bin begins in ram - 2000000h ), you need that value. However I'm not sure, I'm just guessing, try also revision of your pointers updating method and compare with original ones on your uncompressed output file.
 

TheCopulator

New Member
OP
Newbie
Joined
Dec 18, 2023
Messages
4
Trophies
0
Age
35
XP
36
Country
Canada
Hi @mn1712trungson, thanks a lot for all this information!! I'm sure I didn't update any of the information that you mentioned so I assume you're pointing me in the right direction to fix the issue! I'll be working on that today or tomorrow. Thanks again :)

@plasturio, thanks for your comment. I think I'm updating the pointers correctly because I was able to recompress Arm9.bin with Crystaletile2 at some point and I had updated like 40 different entries in the files and they all worked.

I'll get back to you with what I've found.
 

TheCopulator

New Member
OP
Newbie
Joined
Dec 18, 2023
Messages
4
Trophies
0
Age
35
XP
36
Country
Canada
Hi @mn1712trungson,

Thanks to your advice, I was able to fix the issue. I'm now able to open my patched rom easily and very happy now :D.

For those that are interested, I made a small python function to update the arm9 values based on the instructions.
It is not rocket science but it may help someone

game_iso_path: path to the original iso to read the load and auto value
compressed_arm9_path: path to your arm9 compressed file
decompressed_arm9_path: path to the decompressed version of the arm9 file

And now, I'll be working on some overlays and have some fun.

Thanks again everyone
 

Attachments

  • update_arm9.zip
    519 bytes · Views: 17

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • BigOnYa @ BigOnYa:
    Biomutant looks cool tho, may have to try that
  • Quincy @ Quincy:
    Usually when such a big title leaks the Temp will be the first to report about it (going off of historical reports here, Pokemon SV being the latest one I can recall seeing pop up here)
  • K3Nv2 @ K3Nv2:
    I still like how a freaking mp3 file hacks webos all that security defeated by text yet again
  • BigOnYa @ BigOnYa:
    They have simulators for everything nowdays, cray cray. How about a sim that shows you playing the Switch.
  • K3Nv2 @ K3Nv2:
    That's called yuzu
    +1
  • BigOnYa @ BigOnYa:
    I want a 120hz 4k tv but crazy how more expensive the 120hz over the 60hz are. Or even more crazy is the price of 8k's.
  • K3Nv2 @ K3Nv2:
    No real point since movies are 30fps
  • BigOnYa @ BigOnYa:
    Not a big movie buff, more of a gamer tbh. And Series X is 120hz 8k ready, but yea only 120hz 4k games out right now, but thinking of in the future.
  • K3Nv2 @ K3Nv2:
    Mostly why you never see TV manufacturers going post 60hz
  • BigOnYa @ BigOnYa:
    I only watch tv when i goto bed, it puts me to sleep, and I have a nas drive filled w my fav shows so i can watch them in order, commercial free. I usually watch Married w Children, or South Park
  • K3Nv2 @ K3Nv2:
    Stremio ruined my need for nas
  • BigOnYa @ BigOnYa:
    I stream from Nas to firestick, one on every tv, and use Kodi. I'm happy w it, plays everything. (I pirate/torrent shows/movies on pc, and put on nas)
  • K3Nv2 @ K3Nv2:
    Kodi repost are still pretty popular
  • BigOnYa @ BigOnYa:
    What the hell is Kodi reposts? what do you mean, or "Wut?" -xdqwerty
  • K3Nv2 @ K3Nv2:
    Google them basically web crawlers to movie sites
  • BigOnYa @ BigOnYa:
    oh you mean the 3rd party apps on Kodi, yea i know what you mean, yea there are still a few cool ones, in fact watched the new planet of the apes movie other night w wifey thru one, was good pic surprisingly, not a cam
  • BigOnYa @ BigOnYa:
    Damn, only $2.06 and free shipping. Gotta cost more for them to ship than $2.06
  • BigOnYa @ BigOnYa:
    I got my Dad a firestick for Xmas and showed him those 3rd party sites on Kodi, he loves it, all he watches anymore. He said he has got 3 letters from AT&T already about pirating, but he says f them, let them shut my internet off (He wants out of his AT&T contract anyways)
  • K3Nv2 @ K3Nv2:
    That's where stremio comes to play never got a letter about it
  • BigOnYa @ BigOnYa:
    I just use a VPN, even give him my login and password so can use it also, and he refuses, he's funny.
  • BigOnYa @ BigOnYa:
    I had to find and get him an old style flip phone even without text, cause thats what he wanted. No text, no internet, only phone calls. Old, old school.
    K3Nv2 @ K3Nv2: @BigOnYa...