Qhimm.com Forums
Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: DLPB_ on 2012-06-19 11:34:01
-
Today I and Luksy wanted to add a credit list to the start of VII for the Retranslation Project (which shows up only if a certain rare action is taken). Unfortunately, the text stalled half way through and the game would not progress any further.
On further investigation I discovered that the game had a limit of 256 bytes (which includes opcodes for text colour and formatting) for dialogue per page. Strangely... when I looked at a part of the translation at Chocobo Farm that I knew to be longer than 256, I was surprised to find that no stall occurred.
Luksy then suggested that the Window ID may be the reason behind it all... and he was right. Basically, 4 ID's are assigned to Windows, 0 through 3, because there can be 4 dialogue boxes on screen at 1 time. Each of these windows is supposed to have a space limit in memory of 256 bytes. However...
Due to lazy programming, ID0 actually ends up getting 256*4 because it can overflow into the areas allocated for ID1-3. The box I was testing with at the start of the game was ID3 in script.. this meant it was being allocated the last 256 byte area in memory (00CC0428 memory is the base address). The game will fail to write any more information after 00CC0428 + 1024 bytes and so the terminator and new page opcodes will not be written leaving the game dialogue stuck where it is.
Basically... due to sloppy programming, ID0 can have a limit of 1024 bytes (assuming there aren't other windows in operation or it will end up running into them). For the most part, since there is only 1 dialogue box on screen at 1 time, it is possible to have a limit of 1024 bytes for dialogue, as opposed to the intended 256. Of course, if you set to ID2, you'd get 512. and ID1 would get 768. Window ID can be set with Makou Reactor.
-
- Even if this bug weren't here, wouldn't it be just as possible to switch IDs once you run out of room in the current one? A small bit more effort, but nothing too difficult.
- Is it possible this behavior was intentional? Multiple windows isn't exactly the most common thing in the game, and I wouldn't be surprised if this was Squaresoft's way of allowing it, but prioritizing scenes with only one window.
-
1. Yup very easy to work around and that's what we'll be doing where necessary
2. Possibly, but there are only two places in the original where a single screen of text exceeds 256 (ff charmap) chars, both in niv_ti2:
335 chars
“As I was coming out of the reactor,
Shinra troops were just arriving.
I recall a scientist named Hojo was in charge.
He ordered the troops to gather up
everyone still alive for the experiment.
I didn't know what type of experiment
he was talking about,
but I wasn't about to let them have
my dearest student.”{NEW}
292 chars
“Periodic Report to Professor Hojo”
1 Clone Activity Report
Unfortunately, no 'CLONES' have left
this town this quarter.
As previously reported, the 'CLONES 'seem
to be sensing something.
But all they say is, 'Reunion' or 'Sephiroth'
and show no other signs of activity.{NEW}
The first one uses window 0, and the second window 1.
-
It is definitely possible, but I'd say more sloppy programming. In any case... I am happy to exploit it.