ROM Hack Pointer tables

azerty1

Well-Known Member
OP
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
I've started peeking through Dramatic Dungeon Sakura Taisen for fun, and realized after not too long that it was clearly not a game that had the string length in inside the text.
I was wondering if anyone could tell me exactly how to find the pointer table. None of the documents in zophar's doain or romhacking.net had anything on nds, and the ones for gameboy colour didn't help very much.
if you want to look at the rom for yourself, then the text files are in the overlay folder.

i asked darthnemesis about this a long time ago and he mentioned something about subtracting "0x02000000 (plus the offset from y9.bin, for overlays) to get the file offset. " but i don't really quite get what that's supposed to mean...
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
Pointers in arm9/overlay files are to memory locations, not to file offsets. The arm9 always starts at 0x02000000, while overlay files are configured in y9.bin:

Code:
OVERLAY# RAM_ADDR RAM_SIZE BSS_SIZE STAT_BEG STAT_END FILE_ID# RESERVED
00000000 80C32202 40000000 00000500 A4C32202 ACC32202 00000000 00000000
01000000 C0C32702 A0800000 00000000 1CFA2702 20FA2702 01000000 00000000
02000000 C0C32702 00460000 00000000 64E22702 68E22702 02000000 00000000
So overlay 0000 is located at 0x0222C380 in memory. That means you need to subtract 0x0222C380 from all of the pointers in that file to find the actual location of the text.
 

azerty1

Well-Known Member
OP
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
wait, i don't quite get where it says where it points to the location of the file? is it just RAM_ADDR reversed? and what exactly would an overlay pointer look like as opposed to a normal one?
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
Yes. If you're wondering about the reversal, read up on little-endian byte order.

For instance, say you're looking for the line "??????????????". You do a search with Crystaltile2 or AstroGrep and find it in overlay 1 at 0x36B8. For a normal text file you'd search for B8360000 to find the pointer, but since overlays point to the location of the line in memory rather than its location in the file, you have to add the RAM offset of the overlay to the pointer. 0x0227C3C0 + 0x36B8 = 0x0227FA78, so search overlay 1 for 78FA2702 and you'll find the pointer at 0x0364. If you move the line, you have to update that pointer accordingly.
 

Noitora

::
Member
Joined
Aug 9, 2007
Messages
3,760
Trophies
1
Age
32
Location
Athens
Website
www.noitora.eu.pn
XP
289
Country
Greece
DarthNemesis said:
Yes. If you're wondering about the reversal, read up on little-endian byte order.

For instance, say you're looking for the line "??????????????". You do a search with Crystaltile2 or AstroGrep and find it in overlay 1 at 0x36B8. For a normal text file you'd search for B8360000 to find the pointer, but since overlays point to the location of the line in memory rather than its location in the file, you have to add the RAM offset of the overlay to the pointer. 0x0227C3C0 + 0x36B8 = 0x0227FA78, so search overlay 1 for 78FA2702 and you'll find the pointer at 0x0364. If you move the line, you have to update that pointer accordingly.
Given I pad the overlay with a couple of null bytes and start repointing the text in the padded area, it wouldn't work, would it?
 

psycoblaster

Divine
Member
Joined
Jan 26, 2008
Messages
2,131
Trophies
0
Age
33
Location
Seoul.. (in Korea)
Website
Visit site
XP
211
Country
Noitora said:
DarthNemesis said:
Yes. If you're wondering about the reversal, read up on little-endian byte order.

For instance, say you're looking for the line "??????????????". You do a search with Crystaltile2 or AstroGrep and find it in overlay 1 at 0x36B8. For a normal text file you'd search for B8360000 to find the pointer, but since overlays point to the location of the line in memory rather than its location in the file, you have to add the RAM offset of the overlay to the pointer. 0x0227C3C0 + 0x36B8 = 0x0227FA78, so search overlay 1 for 78FA2702 and you'll find the pointer at 0x0364. If you move the line, you have to update that pointer accordingly.
Given I pad the overlay with a couple of null bytes and start repointing the text in the padded area, it wouldn't work, would it?
nope
 

Noitora

::
Member
Joined
Aug 9, 2007
Messages
3,760
Trophies
1
Age
32
Location
Athens
Website
www.noitora.eu.pn
XP
289
Country
Greece
psycoblaster said:
Noitora said:
DarthNemesis said:
Yes. If you're wondering about the reversal, read up on little-endian byte order.

For instance, say you're looking for the line "??????????????". You do a search with Crystaltile2 or AstroGrep and find it in overlay 1 at 0x36B8. For a normal text file you'd search for B8360000 to find the pointer, but since overlays point to the location of the line in memory rather than its location in the file, you have to add the RAM offset of the overlay to the pointer. 0x0227C3C0 + 0x36B8 = 0x0227FA78, so search overlay 1 for 78FA2702 and you'll find the pointer at 0x0364. If you move the line, you have to update that pointer accordingly.
Given I pad the overlay with a couple of null bytes and start repointing the text in the padded area, it wouldn't work, would it?
nope
Thought so
unsure.gif
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
The problem with overlays is if you make them longer, you're overwriting whatever comes after them in memory. Maybe you'll get lucky and there was some extra room, but more likely you've overwritten something important and the game will freeze.
 

azerty1

Well-Known Member
OP
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
so...when i'm writing the code to extract all the text, how do I find the pointer table? I can find it manually, but i can't seem to find anything consistent to allow me to get to the text in the first place...
 

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
okay so these are pointers then to overlay stuff
8000364 0227FA78 eoreq pc, r7, 78000h
8000368 0227FA98 eoreq pc, r7, 98000h
800036C 0227FAB8 eoreq pc, r7, B8000h
8000370 0227FAD0 eoreq pc, r7, D0000h
8000374 0227FAF0 eoreq pc, r7, F0000h
8000378 0227FB10 eoreq pc, r7, 4000h
800037C 0227FB30 eoreq pc, r7, C000h
8000380 0227FB50 eoreq pc, r7, 14000h
8000384 0227FB70 eoreq pc, r7, 1C000h
8000388 0227FB8C eoreq pc, r7, 23000h
EOR (Exclusive OR) performs a bitwise EOR of the values from two registers.
EOR updates the condition code flags, based on the result
EOR Exclusive or - so its checking pc or r7 for .... and then loading to offset right?
what then is this
0200087 C E 59 F10 B4 ldr r 1 , [pc, B 4 h] ;= 0x5000000 (83886080 ) ? ? ·??·??·?? *o ?+Tv ? ??v,T ·? ? ?? ? &?? ?? n? ? NH ? (? ·?
or this
0200088 C E 59 F10 A8 ldr r 1 , [pc, A 8 h] ;= 0x7000000 (117440512 ) ???·??·?? ·??* o?+ Tv? ?? v,T ·? ? ?? ? &? ? ? ? n ?? N H? (?·
I need to read more on asm
OY
Oh and how do you add bytes to an overlay file assuming you can find all of the pointers?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: @OctoAori20, Thank you. Hope you're in good spirits today like I am. :)