gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > A pre compiled .nds, how does one open it up?

#80678 - Scorpei - Mon Apr 24, 2006 8:21 pm

I was wondering, let's say I've got a precompiled (duh!) .nds file (no, no increption, it's homebrew), how can I open it up so I can see what it does (how can I see the code)?
Also, will it only come out as assembler, or as nice, yet strangely placed, C code?
Thanks!

*I coudn't find this via the search, sorry if I missed it.

#80683 - tepples - Mon Apr 24, 2006 8:27 pm

Disassembling a .nds file involves splitting it into arm9.bin and arm7.bin and then running objdump. The output is in assembly language, with no meaningful labels except those introduced by a postprocessor that recognizes addresses of hardware registers.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#81637 - Scorpei - Sun Apr 30, 2006 8:07 pm

Doesn't want to work.
I've gotten the binaries, but now I can't get the objdump to give me any output.

I try objdump -b binary -m arm7tdmi -D file_name
But I don't seem to have the right arm enviroment or something.
How can I get it? Because I have never worked with this tool.
Is it possible to use an alternative (something under windows, then I won't have to switch Os every time :s)?

#81649 - loading - Sun Apr 30, 2006 9:55 pm

yes there is NDSDIS from http://hp.vector.co.jp/authors/VA018359/ (only arm9 i think because it's original intent is to hack commercial games) and the pro alternative which will cost a lot of money: datarescues ida pro (wen using ida you might want the nds loader and flirt database from backtrace.de)

#81687 - chishm - Mon May 01, 2006 6:54 am

For ARM compiled files I use the command:
Code:
arm-elf-objdump -D -b binary -m arm infile.bin > outfile.s

and for THUMB compiled files I use:
Code:
arm-elf-objdump -D -b binary -m arm -M force-thumb infile.bin > outfile.s

_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#81693 - Scorpei - Mon May 01, 2006 12:12 pm

loading wrote:
yes there is NDSDIS from http://hp.vector.co.jp/authors/VA018359/ (only arm9 i think because it's original intent is to hack commercial games) and the pro alternative which will cost a lot of money: datarescues ida pro (wen using ida you might want the nds loader and flirt database from backtrace.de)


Okay got it to work (it also decompiles the arm7). Now off to looking at assembler :S.
I have no idea what all hardware adresses are and such, anyplace where I can read up on that (that will help me understand the assembler code)?

#81695 - tepples - Mon May 01, 2006 1:16 pm

Scorpei: Look at the Nintendo DS sections of GBATEK.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#81696 - Scorpei - Mon May 01, 2006 1:18 pm

Thank you :).

#81716 - D-loader - Mon May 01, 2006 5:44 pm

wouldn't ndstool be able to recompile it?

#81726 - Scorpei - Mon May 01, 2006 7:46 pm

to source? that would be cool :D.
Well, if it isn't encrypted and ndstool would undestand which libraries were used, then maybe?

#81788 - The 9th Sage - Tue May 02, 2006 4:13 am

D-loader wrote:
wouldn't ndstool be able to recompile it?


from a dissassemblage of the file? I don't think so.
_________________
Now with 20% More Old Man from Zelda 1 than ever before!

#81826 - Scorpei - Tue May 02, 2006 10:44 am

Well from the file itself, or the bins, not the assembler itself :).
If one would know exactely how the compiler did its job, it should be possible.
A well, I hate assembler :).

#81855 - tepples - Tue May 02, 2006 2:48 pm

But with an appropriate disassembler, it should be possible to do
nds file -> arm7/arm9 binaries -> assembly language -> arm7/arm9 binaries -> nds file.
Once you get that working, you can do any sort of postprocessing on the assembly language, such as determining where the constant pools are and assigning labels and the like.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#94534 - monkmar - Tue Jul 25, 2006 6:34 am

sorry to bring this one up, i also have a few questions, hope its possible to answer.

I've tried disassembling a arm9 file with ndsdis2, i was just curious as to if the disassembly with IDA pro (on the same file) would be any different from the output from ndsdis2?

also is there an existing disassembler that allows one to actually go from nds file -> arm7/arm9.bin -> asm -> arm7/arm9 ??

thanks in advance