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

Author Topic: How do I extend the displayed character amount in a text string?  (Read 524 times)

LightningSam

  • Jr. Member
  • **
  • Posts: 9
  • Proud Sega Genesis fan
    • View Profile
How do I extend the displayed character amount in a text string?
« on: September 17, 2019, 10:02:33 pm »
I am working on a romhack of Toejam and Earl that replaces them with their girlfriends. Using Ryan Fae Scotland's disassembly, I have managed to replace some text. However, if anything exceeds (or is less than) the original character limit, all further text will display as being empty or complete gibberish.

To start us out, I am replacing these lines:
Code: [Select]
'yo earl',0
'wha',$27,'sup',0

With:
Code: [Select]
'yo lewanda',0
'wha',$27,'sup',0

"Yo Lewanda" appears as it should, but then the next line appears as "da" instead.

How do I edit the code to extend or reduce the character amount for each string?
Currently working on Latisha & Lewanda, a romhack of Toejam & Earl.

Jorpho

  • Hero Member
  • *****
  • Posts: 4159
  • The cat screams with the voice of a man.
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #1 on: September 18, 2019, 09:14:08 am »
To be clear: are you editing data in the disassembly and then re-compiling, or are you editing data in the ROM directly?
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

LightningSam

  • Jr. Member
  • **
  • Posts: 9
  • Proud Sega Genesis fan
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #2 on: September 18, 2019, 01:17:09 pm »
I am editing the data in the disassembly and then compiling the rom.

I have tried editing text directly inside the rom with a hex editor, but every time I save a file, the rom will not work, only showing a black screen.
Currently working on Latisha & Lewanda, a romhack of Toejam & Earl.

Jorpho

  • Hero Member
  • *****
  • Posts: 4159
  • The cat screams with the voice of a man.
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #3 on: September 18, 2019, 11:48:43 pm »
I am editing the data in the disassembly and then compiling the rom.
As most games do not have disassemblies with editable data, this is a bit of a murky field.  But to take a shot in the dark: is there another place in the disassmbly that stores the length of each string?

Quote
I have tried editing text directly inside the rom with a hex editor, but every time I save a file, the rom will not work, only showing a black screen.
Does that happen even when you're replacing text with different text which is exactly the same length?  (I assume you're using an appropriate table file of some sort.)
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

LightningSam

  • Jr. Member
  • **
  • Posts: 9
  • Proud Sega Genesis fan
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #4 on: September 19, 2019, 12:34:46 am »
As most games do not have disassemblies with editable data, this is a bit of a murky field.  But to take a shot in the dark: is there another place in the disassmbly that stores the length of each string?
Not that I know of.

Quote
Does that happen even when you're replacing text with different text which is exactly the same length?  (I assume you're using an appropriate table file of some sort.)
I tried that out just now, and it seems to work. (Changed the line "My name is Toejam." to "My name is Latisha") I am not using a table file at all, just editing the text as it appears in the hex editor.
Currently working on Latisha & Lewanda, a romhack of Toejam & Earl.

Jorpho

  • Hero Member
  • *****
  • Posts: 4159
  • The cat screams with the voice of a man.
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #5 on: September 19, 2019, 12:53:02 am »
I tried that out just now, and it seems to work. (Changed the line "My name is Toejam." to "My name is Latisha")
That is as expected, at least.  If you insert a longer string or a shorter string directly into the ROM, then it changes the offset (i.e. position relative to the start of the ROM) of everything that comes afterwards, and as the program generally expects things to appear at certain offsets, that breaks everything.

I see the disassembly is at https://bitbucket.org/RyanFaeScotland/toejamandearldisassembly/ , but which file has the text strings you are trying to edit?  It doesn't seem to be in Source/Text/Data/Text.X68 .
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

LightningSam

  • Jr. Member
  • **
  • Posts: 9
  • Proud Sega Genesis fan
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #6 on: September 19, 2019, 01:09:17 am »
Actually, it is in the Text.X68 file. You should see it at the beginning of the the section marked 'Speech', you can't miss it. (The "Yo Earl" "Wha'sup" lines)
Currently working on Latisha & Lewanda, a romhack of Toejam & Earl.

Jorpho

  • Hero Member
  • *****
  • Posts: 4159
  • The cat screams with the voice of a man.
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #7 on: September 19, 2019, 09:21:24 am »
Whoops, so it is.

It seems distinctly possible that the length of the text strings is still part of the Unknown data.  The easiest solution wold be to wait and see if Mr. Scotland gets around to documenting that.  Otherwise, you will have to track down this data in the ROM yourself.  There should be generic documentation around this site somewhere on "pointer tables" – a section of the ROM that stores the offset (or sometimes a relative offset) of the start of each of the text strings.

Of course, if that is what it comes down to, then every time you make one text string longer, you'll have to make another one shorter – unless there just so happens to be empty space in the ROM following the text strings.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

LightningSam

  • Jr. Member
  • **
  • Posts: 9
  • Proud Sega Genesis fan
    • View Profile
Re: How do I extend the displayed character amount in a text string?
« Reply #8 on: September 19, 2019, 12:57:43 pm »
I'll keep waiting then. Thanks!
Currently working on Latisha & Lewanda, a romhack of Toejam & Earl.