+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Pointers in NDS roms (size 32MB).
Pages: [1]
Author Topic: Pointers in NDS roms (size 32MB).  (Read 2 times)
RadioShadow
Guest
« on: August 14, 2008, 02:39:41 pm »

I've been looking at the Advance Wars Dual Strike Map Header Data: http://forums.warsworldnews.com/viewtopic.php?f=11&t=10496 and it just occured to me they won't work in the same way as GBA roms.


In Advance Wars 2, pointers are displayed as 00 00 00 08.  The 08 meant to load the data into the ROM Part of the RAM and rest is the offset where the data is stored in the GBA rom (in reverse). 

Repointering data in a 16MB rom is pretty simple providing it's placed anywhere between 000000 - FFFFFF.  To repointer, I find the new offset (say 6145A0), locate the pointer, reverse the new offset (so it would be A04561), add a 08 on the end (A0456108) and edit the pointer.  Pretty easy. 


Now Advance Wars Dual Strike uses a 32MB rom and the data can be placed anywhere between 00000000 - 01FFFFFF.  Now I'm trying to locate the map data for Jake's Trial.  The pointer in the header is DC 67 2C 02.  Me thinking it worked in a similar way to the GBA, I reversed the pointer which became 2C67DC and went to that offset in the NDS rom.  But of course, I don't think that is where the map data is stored. 

I know the 02 mean the data gets uncompressed (I think) and loaded into the EXRam but how does it determine where the data is from six hex bytes when the data could be located at two possibilities being 002C67DC and 012C67DC.  Wouldn't it have been better to use an 8 hex byte pointer?
KC
Guest
« Reply #1 on: August 14, 2008, 02:55:02 pm »

NDS games aren't one huge binary file like GBA games. They are more like a CD or DVD.
You can extract the rom's content with a program like ndstool ( http://wiki.pocketheaven.com/Ndstool ), or just write your own extractor, it's easy. You'll get code, overlay and data files. The code (arm9.bin and arm7.bin) is loaded into ram (2000000h for arm9, arm7 isn't of any interest) at startup, and overlays are loaded on demand (address varies).
Either you find the text in one of the code or overlay files, or it's in one of the "normal" files.

All data has to be loaded into ram to be used, but the pointers are probably relative to the file start.
RadioShadow
Guest
« Reply #2 on: August 14, 2008, 04:11:25 pm »

So those pointers don't lead to were the compressed map data is found.  Thanks for clearing that up. 

Well I unpacked the nds rom using NDSLazy and found the text used in the file 'overlay_0000.bin'.  I also found the 'Combat' map data (which was compressed using LS77) which was in the 'Data' folder.  Out of interest, would the address be stored in the same overlay file or in the arm9.bin file?. 

Just got to locate the other map data.  I guess they would be in the data file but AWDS doesn't like to name a lot of the files. Sad
« Last Edit: August 14, 2008, 04:40:47 pm by RadioShadow »
KC
Guest
« Reply #3 on: August 15, 2008, 04:01:32 am »

The address the overlay is loaded to is stored in a different file. I don't know what dslazy calls it by default, but probably something like y9.bin or overlay9.bin.

Quote
ARM9 and ARM7 Overlay Tables (OVT) (base/size defined in cart header)
Somehow related to Nintendo's compiler, allows to assign compiler Overlay IDs to filesystem File IDs, and to define additional information such like load addresses.

  Addr Size Expl.
  00h  4    Overlay ID
  04h  4    RAM Address ;Point at which to load
  08h  4    RAM Size    ;Amount to load
  0Ch  4    BSS Size    ;Size of BSS data region
  10h  4    Static initialiser start address
  14h  4    Static initialiser end address
  18h  4    File ID  (0000h..EFFFh)
  1Ch  4    Reserved (zero)

Repeated for every overlay.
Pages: [1]  


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