Binary Manipulation

Discussion in 'NDS - ROM Hacking and Translations' started by monp787, Dec 11, 2010.

Dec 11, 2010

Binary Manipulation by monp787 at 4:33 AM (594 Views / 0 Likes) 2 replies

  1. monp787

    Newcomer monp787 Newbie

    Dec 17, 2008
    United States
    Can someone help me to understand binary manipulation so I can write a text extracting and insertion tool. I have already found text in the bin files with windhex using a sjis table.
  2. Poryhack

    Member Poryhack GBAtemp Fan

    Oct 18, 2009
    United States
    Binary manipulation is a bit of a blanket term... Do you know a programming language? What specifically do you want to know?
  3. FAST6191

    Reporter FAST6191 Techromancer

    Nov 21, 2005
    United Kingdom
    Firstly when you say .bin files do you mean the arm9.bin or arm7.bin or overlay?????.bin files-> those are the games program and as such will probably need special measures taken compared to a normal file (it can be nasty but do not quit right away if so). If it is a more general .bin file somewhere in the rest of the data carry on as usual.

    Anyhow apologies if that was me- it is a term I am fond of abusing.

    As Poryhack says it is something of a blanket term, I tend to use it to try and stop people using specific languages with not much in the way of it (something like sql or COBOL or some of the scripting languages that lack serious purpose manipulation) or those without serious use hexadecimal abilities. Most programming languages can do this easily enough however although unless you are building it for a website I would advise against PHP and while far from mandatory people like it if you can give them a self contained program with no need for odd versions of .net/mono, java interpreters, dll files and so forth (if you are doing the one man hacking crew thing so be it but most of the time your testers/other team members are as technically minded as you).

    Assuming you do not mean the more general term- what is a shift, rotate, bitmask, logical operations (NAND, AND, OR, NOR, XOR) and so on for which you would probably be better off consulting a general programming/electronics textbook ( has lots if so) then what it comes down to is as follows

    Generally speaking text extraction/insertion requires two things
    1) The ability to read and use the pointer maps/table
    This means taking the pointers, accounting for whether they are straight up, offset, relative or otherwise and probably giving them a reference in the program to come.

    2) The ability to convert whatever the game might be using into a more common format- you are lucky if you have true shiftJIS though (remember some games have basic shiftJIS but will wind in game specific symbols-> arrows, "A buttons" and so on as well as possible text encoding niceties- new lines, press for yes/no, placeholders for values and the like)
    This means taking whatever the pointers might give you and locating (and if necessary decoding) the text.

    A nice bonus is when you incorporate the game font and width/length restrictions for your finishing crew to sort out (otherwise you are better off trying to get a more general program to work rather than making a new one)- pretty much aiming to have an "emulation" of what the game does in the program.
    Do note some games like to include flags for bold or coloured text in the text, some include it in the pointers, some include it in the binary, some have distinct/multiple encodings/fonts and there are several other methods to do such things.

    There is no real standard for pointers owing to their wildly varying nature but font/text encoding tables do have a few with .tbl being the most common although by no means only one in common usage.

    A text inserter just does the above in reverse, usually (not always though) pointers will be indicated in some form by a spacing character (it might not be exactly at the pointer but some known distance away) so you can rebuild an entire pointer table from scratch if you have to (try not to need such a thing).

Share This Page