+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  How do I dump a DS script?
Pages: [1]
Author Topic: How do I dump a DS script?  (Read 1 times)
reyvgm
Guest
« on: January 06, 2011, 08:45:41 pm »

What's a beginner's way to dump a DS script?

Children of Mana is the game in question.

I downloaded Tahaxan to dump the game's script and Headsplitter to probably be able to read it or something.
However, when I ran Tahaxan, it said I was missing a bgd.dll file. I downloaded the file, placed it on the win/sys32 dir and then it said that "The procedure entry point _gdfree@4 could not be located in the dynamic link library bgd.dll".

I googled that problem and tried several of the solutions given, but none worked. It's probably due to the fact that I didn't even know what I was doing.

I also opened up the game with a hex editor and I could see the text, but it was just for the items and descriptions. The actual story dialogues were apparently compressed.

Anyway, is there another program that lets me dump the text from a DS game that doesn't need some extra dlls from virtual machines or net frameworks or whatchamacallits?

Ryusui
Guest
« Reply #1 on: January 06, 2011, 11:16:53 pm »

Use ndstool to rip the entire game archive into a directory structure. Here's a batch file that will help:

Quote
@echo off

mkdir .\\[your game here]\\data
mkdir .\\[your game here]\\overlay
ndstool.exe -v -x [your game here].nds -9 .\\[your game here]\\arm9.bin -7 .\\[your game here]\\arm7.bin -y9 .\\[your game here]\\y9.bin -y7 .\\[your game here]\\y7.bin -d .\\[your game here]\\data -y .\\[your game here]\\overlay -t .\\[your game here]\\banner.bin -h .\\[your game here]\\header.bin

And for packing it back:

Quote
@echo off

mkdir .\\[your game here]\\data
mkdir .\\[your game here]\\overlay
ndstool.exe -v -x [your game here].nds -9 .\\[your game here]\\arm9.bin -7 .\\[your game here]\\arm7.bin -y9 .\\[your game here]\\y9.bin -y7 .\\[your game here]\\y7.bin -d .\\[your game here]\\data -y .\\[your game here]\\overlay -t .\\[your game here]\\banner.bin -h .\\[your game here]\\header.bin

--Moderator edit--
Changed tags to hopefully prevent IE/Chrome table-breaking suckage.
« Last Edit: January 09, 2011, 06:14:38 pm by Lenophis »
reyvgm
Guest
« Reply #2 on: January 07, 2011, 12:18:19 am »

I'm a n00b, so bear with me now Smiley

So I assume I should change the "your game here" to the name of the rom file, copy all that to a txt file and then change it to .bat?

*Edit

Wow, I can't believe that worked Tongue

So now how do I see the script dump? I don't see that extension Headsplitter uses.
Ryusui
Guest
« Reply #3 on: January 07, 2011, 12:21:24 am »

You can skip the second step. Just bring up the save dialog in Notepad, select "All Files" and add ".bat" to the end of the filename.

And yeah, make sure the ROM and ndstool are in the same directory as the batch file, then fire away.
reyvgm
Guest
« Reply #4 on: January 07, 2011, 12:25:34 am »

Wow, I can't believe that worked. Thanks! Tongue

So now how do I see the script dump? I don't see that extension Headsplitter uses. Or do I have to check the files one by one until I stumble upon it?
« Last Edit: January 07, 2011, 12:37:59 am by reyvgm »
Ryusui
Guest
« Reply #5 on: January 07, 2011, 01:34:18 am »

Read the fine print. Headsplitter is for editing the script files for one specific DS Naruto game.

So yeah, you're gonna have to hunt. Shouldn't be too hard, though. Just look for likely directory names, filenames and (yes) extensions. You won't have to search through all the files, but you'll probably have to do some delving. Worst-case scenario, you'll have to do some ASM tracing in NO$GBA to figure out how the text is stored.
reyvgm
Guest
« Reply #6 on: January 07, 2011, 01:39:35 am »

Well, that's a bit more complicated. All I know how to do is open stuff with hex editors or make table files. I don't know how ASM works.

I did some searching and apparently the text is stored in .dpk files. But they just show gibberish. Does that mean that the text is compressed? What can I use to "decompress" them?

There is a directory called "eng" that has a bunch of files that do show normal ASCII text when you open them. But it's the same stuff I could see by opening the ROM with a hex editor. The story dialog is still missing in action.
Ryusui
Guest
« Reply #7 on: January 07, 2011, 02:03:40 am »

There's no way around decompression save for tracing the decompression routine in ASM and writing a decompressor of your own. The upside of this is that you don't have to actually be able to program in ASM; you just need to understand enough that you can watch what the program does and figure it out. However, you'll have to be able to program in some language in order to produce your decompressor - or document the format so thoroughly that someone else with experience can help you in this regard.

If you can identify the compressed script files, you can find the data in memory while the game's running - it helps that files in DS games are usually prefixed with a four-byte string indicating their type. Once you find the compressed data, you can set some read breakpoints, trace through, and figure out how the game decompresses it.
reyvgm
Guest
« Reply #8 on: January 07, 2011, 02:33:24 am »

Well, I guess this is as far as I go then. My no$gba doesn't even have debugging features either. Not that I would know what to do with it either.

Thanks for all the help though!
RadioShadow
Guest
« Reply #9 on: January 08, 2011, 03:29:09 pm »

Quote from: reyvgm on January 07, 2011, 01:39:35 am
Well, that's a bit more complicated. All I know how to do is open stuff with hex editors or make table files. I don't know how ASM works.

I did some searching and apparently the text is stored in .dpk files. But they just show gibberish. Does that mean that the text is compressed? What can I use to "decompress" them?

There is a directory called "eng" that has a bunch of files that do show normal ASCII text when you open them. But it's the same stuff I could see by opening the ROM with a hex editor. The story dialog is still missing in action.

Minus the "Rasparameter.dpk" and "Rasparameter.dpk" files, the rest if the .dpk files have uncompressed ASCII text in. 

http://i80.photobucket.com/albums/j161/RadioSonic/Screenshots/ChildrenofMana.png

The beginning of each .dpk file, it has pointers leading to the necessary text (4 bytes long and reversed).  In "Advance Wars: Days of Ruin", the pointers would lead straight to the text in that file.  It doesn't seem to be the case in "Children of Mana".  You will need to figure out how the pointers work in the files, in order to insert any length of text.

00000000 01 00 00 00 00 00 00 00 1C 00 00 00 05 00 00 00 ................
00000010 04 00 00 00 00 00 00 00 05 00 00 00 22 00 00 00 ............"...
00000020 40 00 00 00 5E 00 00 00 4E 4F 4E 45 00 48 6F 6C @...^...NONE.Hol
00000030 64 73 20 75 70 20 74 6F 20 38 20 6F 66 20 65 76 ds up to 8 of ev
00000040 65 72 79 20 69 74 65 6D 2E 00 48 6F 6C 64 73 20 ery item..Holds
00000050 75 70 20 74 6F 20 31 32 20 6F 66 20 65 76 65 72 up to 12 of ever
00000060 79 20 69 74 65 6D 2E 00 48 6F 6C 64 73 20 75 70 y item..Holds up
00000070 20 74 6F 20 31 38 20 6F 66 20 65 76 65 72 79 20  to 18 of every
00000080 69 74 65 6D 2E 00 48 6F 6C 64 73 20 75 70 20 74 item..Holds up t
00000090 6F 20 32 34 20 6F 66 20 65 76 65 72 79 20 69 74 o 24 of every it
000000A0 65 6D 2E 00                                     em..   
reyvgm
Guest
« Reply #10 on: January 08, 2011, 07:10:33 pm »

I was able to see all the status, items, description, etc. texts. But the story one is compressed since I couldn't locate it. Although, I didn't try making a table file and checking every single dpk file. Could I find it that way?

I use Font Searcher to search for text you can't normally see with a hex editor. It's the only one (for me) that always finds stuff, however, this DS game is way too big and the program always hangs.

I assume that I could use the hex values on your example, but aren't those values just for the text you normally see? Wouldn't the compressed text have different values?

Excuse me if I'm using wrong terminologies, but I'm not well versed in these matters.


Since you apparently decompressed the CoM rom, in the "event.rax" file found in the "eng" directory, I saw this (excerpt):

"event/npc_talk_f02.bss event/npc_talk_f03.bss event/npc_talk_f04.bss event/npc_talk_f05.bss event/npc_talk_f06.bss event/npc_talk_f07.bss event/stage01_00_01.bss event/stage01_00_02.bss event/stage01_00_03.bss event/stage01_00_04.bss event/stage01_01_00.bss event/stage01_01_01.bss event/tutorial_f02.bss event/tutorial_f03.bss event/tutorial_f04.bss event/tutorial_f05.bss event/tutorial_f07.bss event/tutorial_o01.bss "


Now THAT looks like where the story is stored, however, I couldn't find any files using those names or even files with the .bss extension.
« Last Edit: January 08, 2011, 07:37:59 pm by reyvgm »
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC