How can I modify the text in the code.bin file?

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by aktkglfh, Aug 22, 2018.

  1. aktkglfh
    OP

    aktkglfh Newbie

    Newcomer
    1
    Jan 8, 2017
    Hello. I am now working on converting srw ux from Japanese to Korean. I found almost all of the Japanese text, but the text in exefs / code.bin is getting an error even if I increase only one character (2bytes). This code.bin contains very important text and I have to modify it. However, because I use Unicode, I can not use English to change it. (English needs a byte longer than Hangul.)

    Could you tell me how to modify this exefs / code.bin? Rather than just replacing hex data, some need to increase bytes.

    If anyone knows about this method, please let me know. Thanks!
     
  2. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    2
    Nov 14, 2014
    Switzerland
    Here's my idea:
    You should replace the text pointer at run time dynamically.

    All strings in code.bin are terminated with '\0' (2 zero bytes in UTF-16) and their offsets are fixed. For this reason, their lengths are NOT extendable inplace.
     
    aktkglfh likes this.
  3. aktkglfh
    OP

    aktkglfh Newbie

    Newcomer
    1
    Jan 8, 2017
    Thanks for the reply! I think your idea is good.
    If you want to run your idea, should I use the ntr plugin?
    I don't know the exact meaning of "run time dynamically".
     
  4. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    2
    Nov 14, 2014
    Switzerland
    Here's the basic step:
    1. Extract the orignal texts.
    2. Translate the texts.
    3. Calculate the hash of the orignal texts.
    4. Save the hash->translated-text pair to a file in your way.
    5. Hook the print string function of the game. There should be a string pointer parameter pointed to the orignal string in code.bin. You should do the following stuff in hooked function:
    1) Calculate hash of the string, which is passed by the string pointer.
    2) Find the match hash in your hash->translated-text pair entries.
    3) Replace the pointer with the translated text pointer and call the orignal print function.
     
  5. aktkglfh
    OP

    aktkglfh Newbie

    Newcomer
    1
    Jan 8, 2017
    Actually I was not a programmer, so I did not understand everything. But! I know your explanation is very beneficial! Thanks for taking the time to answer :)
     
Loading...