IDA Pro Relinking Guide?

Discussion in 'Wii - Hacking' started by _eyCaRambA_, Jun 10, 2009.

Jun 10, 2009

IDA Pro Relinking Guide? by _eyCaRambA_ at 12:05 PM (2,644 Views / 0 Likes) 22 replies

  1. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    Hi,
    I am trying to translate a game at the moment, but yeah, it is Japanese->German, so there is the char limitation.
    A nice guy over here, dsfgd, introduced me to IDA Pro and all, but I don't really get it.
    Is there a tutorial or could somebody write a VERY DETAILED one? For noobz~ [​IMG]
    It would really help me!
    kind regards
     


  2. kwirky

    Newcomer kwirky Advanced Member

    Joined:
    Mar 14, 2009
    Messages:
    69
    Country:
    United States
    There is a book called "The IDA pro book". Just google the name.
     
  3. gunslinger

    Newcomer gunslinger Advanced Member

    Joined:
    Apr 3, 2009
    Messages:
    53
    Country:
    United States
    this book has abs. nothing to do with it -.-
    i have ida pro adv. 5.2 here, and you? send me a pm ^^ i can speak german löl
     
  4. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,712
    Country:
    United Kingdom
    IDA is a disassembler and while such things are useful at some levels of hacking I am not sure you need it here.

    Also
    relinking generally deals with taking files and changing their apparent location and is usually done to make space in the game (for instance you would take all the videos and then change each of their addresses and sizes to that of the smallest video thus giving you more space to work with). You might have a bit of work but you should be able to do this with your wii iso manipulation tools.

    repointing is where you change the pointer table/pointer map to the new locations of files/text/pictures/data, you can think of it like a contents page in a book. You would want to change it if and when the location of the start of a sentence changed due to you adding or removing text from the previous lines.
    Here I suggest something more advanced when you actually start working but a plain hex editor should be good enough to test and figure out what and where the pointers are.
    Pointers are usually in the same file as the text or a similarly named one and they are relatively simple things.

    If however the text is in the binary then IDA will be useful, I would not say it is a technique you really want to be trying until you know something about ASM in general: http://webster.cs.ucr.edu/AoA/index.html and http://burks.brighton.ac.uk/burks/language...asmtut/asm1.htm and then the ASM used by the wii (this is a GC guide but it should be a good starting point: http://hitmen.c02.at/files/yagcd/index.html , wiibrew had some of the basics on the wii)
     
  5. WiiCrazy

    Member WiiCrazy Be water my friend!

    Joined:
    May 8, 2008
    Messages:
    2,391
    Location:
    Istanbul
    Country:
    Turkey
    Yeah much like FAST6191 said, there is not much point in using IDA for translation... Most possibly game has the language resources on disc on separate files and most possibly they are using a proprietary format...

    First you should reverse the format, if it's a complex or a semi complex one you need to write a software to create it... Then comes the translation and actual patching of the files... Then comes the problem of file size which is another problem of it's own.

    The simplest language resource I've seen is bmg files, even they come in varieties.. One that system menu uses for the menu language is simple whereas one that's used by Wiifit or other Nintendo titles are a little bit more complex..

    And sometimes I guess those files contain much more than simple text like scrolling, colour and maybe cursor positioning and much more stuff like that... Then the reversing is a little bit more hard since you can't just deduce the file format unless you disassemble and understand the code that it's used with or you make changes to the file and test repeatedly...

    My 2 cents...
     
  6. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    Ok, thank you.
    Well, the Text is in main.dol of the game, I also have Ida pro 5.2 with the corresponding Plugin to dissassemble dol files. I will write a more detailed Post as soon as I get home (writing with iTouch is pain...)
     
  7. gunslinger

    Newcomer gunslinger Advanced Member

    Joined:
    Apr 3, 2009
    Messages:
    53
    Country:
    United States
    @WiiCrazy: What do you mean with "reverse the format"? I know reverse engineerin only in the sence of cracking applications for Win32 f.e. - use them w/o limitations, doing illegal things. What does "Reverse Engineering" means? Are there any books? F.e. ZIP Files you can recognize in Win32 in hex, coz they have a special HEADER (like PE exe files the "MZ" Stub ^^)....
    but how to "exercise" data.bin files, save games, in ida? how to debug ARM Processor types? How to use ida useful in combination with my wii? i unterstand Win32 ASM nearly perfectly and started learning here PPC Asm [​IMG]
     
  8. Omgwtfisthat

    Member Omgwtfisthat GBAtemp Regular

    Joined:
    Jan 3, 2008
    Messages:
    166
    Country:
    Australia
    MONSTER HUNTER? Wouldn't translating that to english be better? Your english seems pretty solid. If it's not monster hunter though...... nvm.
     
  9. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    It is Monster Hunter [​IMG]
    Well, dsfgd is already translating MHG, I am going for the MH3 demo (or atleast mess around with it in order to prepare for MH3 Full).
     
  10. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    Well, as promised (har har), the detailed description of my prob (taken from a PM I sent gunslinger):
    [I already have IDA Pro 5.2 and the GeckoOS and DOL Plugins and I can successfully open the main.dol in IDA and let it work.
    Okay. I know how to find the text pointer. I find it and copy it to the clipboard.
    Now I edit the main.dol in my Hex Editor and I write the word in full length. Lets say it has two more chars than the original word.
    I search for the pointer and then I add 2 to the value. So far so good (I hope it is right till here?).
    I continue doing that stuff. Lets say I almost have finished that block of text and relink it successful. Still two or three words left.
    Now there are some (for me) random numbers and all. What to do now? Add some space between so I can complete that text block? But don't those numbers have offsets too? Because if I overwrite them, the game freezes at a special point.
    Sorry for being noobish, I hope I explained it so you can understand.]
     
  11. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    Sry for triple post but: anyone?!
     
  12. Yoshi Party

    Newcomer Yoshi Party Member

    Joined:
    Jul 27, 2008
    Messages:
    43
    Country:
    Germany
    I think learning japanese would even be easier then recalculating all the pointers [​IMG]

    or you just wait for the REAL pal translation

    trotzdem danke für die Mühe [​IMG]
     
    VegaRoXas likes this.
  13. delarin

    Newcomer delarin Newbie

    Joined:
    Mar 31, 2008
    Messages:
    7
    Country:
    Canada
    hey _eyCaRambA_ I am not all that experienced at this, most of what I know about assembly isn't from doing it myself hehe. Anywho, from what I understand (and this info is pretty much taken from my understanding of code creation) it goes this way. Since you are translating MHG I will give you an example from the main.dol

    At 0x625724 " 調合書G・錬金編" with proper spacing, "Alchemy Guide" does not fit here. The idea is to find white space, which is a string of 00's, to put the new text into, and then repoint to that address. For example there are quite a few around 0x627AA6 that AFAIK you can use.

    A) I hope I am right, I have never put this into practice it is simply what I have taken from observation.
    B) Let me know if it does, and BTW what kind of success are you having with loading MHG with a modified main.dol, I have as of yet been totally unable to do so.
     
  14. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    Thanks for responding delarin.
    Well yeah, but I wanted to know IF you are allowed to create whitespaces at the end of the file or sth...
    And yeah, I already burned a disc with german translation (not repointed) and it works fine.
     
  15. vki

    Newcomer vki Member

    Joined:
    Jul 8, 2009
    Messages:
    15
    Location:
    in your fridge
    Country:
    caramba,
    i dont mean to discourage you, but translating a game is a serious amount of work.
    even if the translation work can be done by a single person (having several is common)
    you're still going to need someone dedicated to the rom hacking. theres just no way to
    give you a quick guide to it. yes those numbers all have a meaning, and yes changing a single bit will break it [​IMG] so unless you really want to get into hacking and the actual game is your motivation, find someone to join you. (or come up with creative abbreviations and dont move anything)
     
  16. delarin

    Newcomer delarin Newbie

    Joined:
    Mar 31, 2008
    Messages:
    7
    Country:
    Canada
    caramba, its possible to create whitespace at the end, but all of the work needed to do so is beyond my comprehension, lets just say it's a lot...like rebuilding the genome lol.

    vki, I am actually coming up with creative abbreviations.. they kick ass. chances are for some of the LONGER names that are important to the game I will be using assembly.. for the most part I havent moved anything, and everything seems to work well. This is only to get a quick translation out to the masses, I DO intend to get into rom hacking bigtime, I used to do quite a bit of MMO hacking, trainer creation, etc. For now though I am starting slow since it has been almost a decade since I have done any of this stuff lol.

    My ultimate intention is even to get to the point of replacing japanese graphics in the game with graphics from an english version of the game.

    As far as playing my disc, I get a black screen after it asks me to plug in my classic controller, and I think I have found the fix I just havent gotten around to applying it
     
  17. vki

    Newcomer vki Member

    Joined:
    Jul 8, 2009
    Messages:
    15
    Location:
    in your fridge
    Country:
    personally i loved the abbreviations in BOF!

    the difficulty depends entirely on how much effort the developers spent on
    making it easy to localize. for a multi language title you like to be anal from the
    start, like not allow *any* string usage outside of a central string database. else
    it would be a real pain to supply an idiot proof localisation tool to the translators.

    if you're less lucky, strings might be spread over all kinds of data files, be runtime compressed,
    part of some checksummed data, or (sigh) hardcoded into the executable ^^

    if you need to enlarge strings in the executable, never bleed into the next data. Rather enlarge the last data section in the dol (the dol header is very simple) and just relocate the string there.

    you may want to try dolphin for testing, it also has a very basic debugger
     
  18. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    Hi,
    I also translated MHP2G (PSP) to German, so I am quite used to editing and stuff.
    vki, you seem to be very used to this, could you teach me how to enlarge the data sec using the header? Because this would clear my question haha
     
  19. vki

    Newcomer vki Member

    Joined:
    Jul 8, 2009
    Messages:
    15
    Location:
    in your fridge
    Country:
    http://wiibrew.org/wiki/Dol

    dol format is a very simple executable format.
    it starts with a fixed 0x100 bytes header declaring several text(code)
    and data sections, followed by the actual section data

    a section is defined by 3 values. (32 bit big endian)
    - file offset
    - lengh
    - memory address

    file offset includes the header, so the smallest valid offset is 0x100

    so for each section you defned it will read lengt bytes at
    file offset into ram at mem address..
    bss is a special data section that just gets filled with nulls,
    thus no file offset

    to append to the end of the file you look for the last data section
    and enlarge length in the header. then put your data at file offset + org size.
    if the dol is well built thats exactly the end of the file. you
    should calculate it nevertheless. so whats put there will
    be loaded to mem address + org size

    hexview some some dols and compare the header to the output
    of "doltool -l xxx.dol", that should make it very clear [​IMG]
     
  20. _eyCaRambA_
    OP

    Member _eyCaRambA_ GBAtemp Advanced Fan

    Joined:
    Apr 22, 2009
    Messages:
    521
    Location:
    Right around the corner™
    Country:
    United States
    Ok, the header is quite simple to understand.
    Thank you so much [​IMG]
    Oh ok, and ToolDol helped me to find the data section offsets =)
    So I insert as much text as I want before the next data section and then:
    1. Use ToolDool to find the offsets, sizes and address
    2. Recalculate the offsets & addresses as well as the size of the changed section
    3. Change those in the header
    4. Save & try

    But how about the pointers? Are they created using the section infos (e.g. I change the section before and the ones from the next section are automatically correct) or do I have to recalculate all?
     

Share This Page