News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: How to find DS pointers?  (Read 1877 times)

kcat

  • Newbie
  • *
  • Posts: 2
    • View Profile
How to find DS pointers?
« on: November 27, 2015, 07:01:53 pm »
I'm working on translating a DS game and I need to find the pointers so everything can be where it's supposed to but I don't know how to find them? I've looked at all of the "starting out" stuff on this website and I've looked through some of the documents as well and all I really found was a guide for NES pointers which I guess isn't relevant. Can anyone tell me how I do this? Sorry for being a total newbie.

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Re: How to find DS pointers?
« Reply #1 on: November 27, 2015, 07:18:07 pm »
Hello there, kcat!

Which game?
Have you already found text in it? Where?

FAST6191

  • Hero Member
  • *****
  • Posts: 3014
    • View Profile
Re: How to find DS pointers?
« Reply #2 on: November 27, 2015, 09:50:40 pm »
Yeah the game would help. In the meantime though I will go more theoretical

Anyway most prior systems would have pointers that deal with memory at some level -- the GBA would have things mapped to 08?????? as that is where the ROM would usually be found, the NES would account for mappers and do much the same and so on and so on. You can still see that on the DS but typically only if the text is located in the binary (arm9.bin) or an overlay. If it is then the pointers will likely be in the 02?????? range and they both come with their own fun and games to alter, not impossible even if you are new but I will skip that for now.

Anyway as it is not in memory it moves closer to maths than memory addresses. Three broad types

1) Standard
2) Relative
3) Offset

Standard is much like it sounds and will be values, probably byte flipped to account for endianness but I have seen things deviate here, will be the address from the start of the file.
Relative is well relative -- if you are at 0080 in the file and the value there decodes as 40 then you go to 0120h. As each relative pointer will be a given distance apart then you will usually find what you thing should be a pointer to be so far out from the last one, and then another (if you have pointers at 0,4,8,C.... then the values will be 0,4,8,C... "out" from what they "should" be if they were standard)
Offset is much like it sounds as well. Here it will look like standard pointers but they will all be out by a given value, typically this value will line up with the end of the header, the start of the text or something like that.

Theoretically you could have relative offset but I have not seen it in the wild and I do not actually expect to any time soon (all the above have their roots in something useful, this does not have any great benefits).

I have seen various pointers/size values obscured, usually by means of a shift. Likewise you can have complex formats where the text itself is almost a scripting engine and though I have not seen it for text (give or take the scripting stuff) there are things that would rely solely upon the length. Likewise some games will have markup (pointer, then something to say make this text bold sort of thing) in with the pointers.
Do not go looking for these oddities right away though -- go with the numbered things above. Typically you will find the pointers for the numbered things at the start of the file, at the start of the section, at the end of the file, at the end of the section or in a similarly named (but probably very small) file. Typically sections will end with something, even if the decode engine does not do anything about it, however this can still be useful as it will give you a rough idea of what the pointers will look like.

kcat

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to find DS pointers?
« Reply #3 on: November 29, 2015, 02:17:38 pm »
I'm embarrassed to say but I really didn't understand any of that  :-[. I guess this is just far beyond my level and I should leave this stuff to the people who know more. I'm sorry for the trouble and keep up the good work.

FAST6191

  • Hero Member
  • *****
  • Posts: 3014
    • View Profile
Re: How to find DS pointers?
« Reply #4 on: November 29, 2015, 03:43:32 pm »
It really would help if you shared the game name. If we can cover what is going on it is far nicer than some theoretical stuff.

Anyway DS pointers are pretty simple. Most of the time they are at the start of the file and are just a long list of numbers that detail the location of the data (in this case text sections) in question. If you alter the length of the text you have to change the pointers to match or the decoder gets into trouble.
On some systems they have to look to the memory and fiddle there but the DS is more file based and thus most of the time you are looking at the files and thus you only need to think in files.

The rest of the stuff mentioned can happen and I can give you a bunch of examples from the DS but not all will and many will be very simple. My usual analogy is think of a contents page in a book as it is pretty much like that.

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Re: How to find DS pointers?
« Reply #5 on: November 29, 2015, 04:41:06 pm »
I'm embarrassed to say but I really didn't understand any of that  :-[. I guess this is just far beyond my level and I should leave this stuff to the people who know more. I'm sorry for the trouble and keep up the good work.

I second Fast's comment: share something concrete and we can help better.
Things like these often start to make sense when you tackle them, one small step after the other.
It's not yet a matter of "level".