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

Author Topic: How to calculate pointers properly  (Read 2779 times)

Almagest

  • Sr. Member
  • ****
  • Posts: 302
  • ファーストエイド
    • View Profile
    • Almagest's ROM Hacking Blog
How to calculate pointers properly
« on: October 02, 2013, 02:51:06 pm »
Hi. I'm trying to find a pointer in Final Fantasy VII located in the BATTLE.X file, and elongate the string by 1. I changed the word "Peerless" to "Invincible", but the game points to the "n" instead of the "I" (because that's where the string of the word "Peerless" starts), so it appears as "nvincible".

The string starts at the offset 00340596 (NOTE: I removed the first 8 bytes, so the file is decompressed). I tried to calculate it following the same example in Madhacker's tutorial (for NES games), so I guess it should be like this: 96 05 (correct me if I'm wrong). This should be the Pointer Value (I guess), but then I tried to change it to the new Pointer Value, but nothing happened when I tested the game. Should I include the 34 too? I suck when it comes to find/change pointers. :(

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: How to calculate pointers properly
« Reply #1 on: October 02, 2013, 04:03:42 pm »
There are no pointers for those strings, they are fixed length. Or at least, they are in the Japanese versions. If they were changed for western releases, they are more than likely hard coded into the code (i.e. lui register X>>16 : ori/addiu register, X&0xFFFF), or plain 32 bit RAM pointers.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.

Almagest

  • Sr. Member
  • ****
  • Posts: 302
  • ファーストエイド
    • View Profile
    • Almagest's ROM Hacking Blog
Re: How to calculate pointers properly
« Reply #2 on: October 02, 2013, 04:16:06 pm »
Oh noooo! What do I do now?!

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: How to calculate pointers properly
« Reply #3 on: October 02, 2013, 04:41:52 pm »
In the International build all strings are 12 byte long, so as long as you keep the new string under that limit it will work by simply replacing "Peerless" entirely and using padding to store the rest of it.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.

Almagest

  • Sr. Member
  • ****
  • Posts: 302
  • ファーストエイド
    • View Profile
    • Almagest's ROM Hacking Blog
Re: How to calculate pointers properly
« Reply #4 on: October 02, 2013, 05:19:23 pm »
I don't have the International version. :/

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: How to calculate pointers properly
« Reply #5 on: October 03, 2013, 04:34:40 am »
If they kept the same code as a base (which I'm kinda sure they did, some things are different in International compared to the Japanese original), it should be pretty much the same. Many structures inside SCENE.BIN reflect entirely the western code framework to allow US and European translations to fit, with most fixed length strings using double the room they used to have in the first iteration of the engine.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.