Users browsing this thread: 1 Guest(s)
FF3usME dialogue editor broken?
10-14-2020, 03:52 AM
(This post was last modified: 10-16-2020, 03:42 PM by Imzogelmo.
Edit Reason: I'm a perfectionist
)
I know it's an old thread but I think I know what is going on. It's not a bug in ff3usme, but just a result of lazy hardcoding in the game.
The dialogue in the game spans 2 banks (although a quick optimize took me from ~400 to ~9000 free bytes). To select from all those pointers, a 24 bit address would be needed. But that's not what they did. Instead, they have a hard-coded check for the specific indexes that will wrap, and increment the bank.
Of course if you hack the game, and the text now wraps on a different message, or worse, you consume more banks than they did, it will not work unless you go to C0 $CCE600 and edit with your new bank-wrapping index. It's a hack, not really fixing it properly, but the upside is that you save a function rewrite, one pointer-byte per message, and it's actually an easy function to write.
Note that I told Lord J about this years ago, but it doesn't come up too often as most people use less text than vanilla due to optimization .
Edit: This would put any dialogue editor program in a rather tough place: Do I add a little hack to accommodate a situation where the text expands, at the cost of forcing the new hack code somewhere to be immovable (by default bank C0)?How many banks do I let this hack expand text into? The program needs to know all that because asm doesn't care about the bounds. Yes the code limits the number of messages (is it 4096 or 8192, I think the latter? EDIT-8192), but the messages themselves are unlimited in length each, and the DTE is decent. Someone could put the whole KJV in there if they wanted and could map to ExHiROM. There is no way a programmer could anticipate it though.
Edit2: Here's the function in question. It's trivial to edit to allow a 3rd bank (or however many) but of course you'll have to put it somewhere.
Note CCE600/1 is the index to wrap bank on. If you have a 3rd bank, you'll need another such check, and you'll have to know which index in advance, or else rewrite this code better.
The dialogue in the game spans 2 banks (although a quick optimize took me from ~400 to ~9000 free bytes). To select from all those pointers, a 24 bit address would be needed. But that's not what they did. Instead, they have a hard-coded check for the specific indexes that will wrap, and increment the bank.
Of course if you hack the game, and the text now wraps on a different message, or worse, you consume more banks than they did, it will not work unless you go to C0 $CCE600 and edit with your new bank-wrapping index. It's a hack, not really fixing it properly, but the upside is that you save a function rewrite, one pointer-byte per message, and it's actually an easy function to write.
Note that I told Lord J about this years ago, but it doesn't come up too often as most people use less text than vanilla due to optimization .
Edit: This would put any dialogue editor program in a rather tough place: Do I add a little hack to accommodate a situation where the text expands, at the cost of forcing the new hack code somewhere to be immovable (by default bank C0)?How many banks do I let this hack expand text into? The program needs to know all that because asm doesn't care about the bounds. Yes the code limits the number of messages (is it 4096 or 8192, I think the latter? EDIT-8192), but the messages themselves are unlimited in length each, and the DTE is decent. Someone could put the whole KJV in there if they wanted and could map to ExHiROM. There is no way a programmer could anticipate it though.
Edit2: Here's the function in question. It's trivial to edit to allow a 3rd bank (or however many) but of course you'll have to put it somewhere.
Code:
Dialogue Loading function:
C0/7FBF: A9CD LDA #$CD (Initial bank is CD)
C0/7FC1: 85CB STA $CB (This is kept in location $CB)
C0/7FC3: C220 REP #$20 (16 bit accum./memory)
C0/7FC5: A5D0 LDA $D0 (get memory D0)
C0/7FC7: 0A ASL A (times 2 since pointers are 2 bytes)
C0/7FC8: AA TAX (this gives us the index X)
C0/7FC9: BF02E6CC LDA $CCE602,X (Loads pointer to dialogue X)
C0/7FCD: 85C9 STA $C9 (The pointer goes in $C9)
C0/7FCF: A5D0 LDA $D0 (Which dialogue is this?)
C0/7FD1: CF00E6CC CMP $CCE600 (Checks to see whether bank byte needs is right or needs to be CE)
C0/7FD5: 9005 BCC $7FDC (Branch if less to the pointer above)
C0/7FD7: 7B TDC (bank byte needs to be incremented, and this is pointless...)
C0/7FD8: E220 SEP #$20 (8 bit accum./memory)
C0/7FDA: E6CB INC $CB (Since it wasn't less, we increment the bank byte)
C0/7FDC: 7B TDC (Either way it is correct now, so clear the accumulator)
C0/7FDD: E220 SEP #$20 (8 bit accum./memory)
C0/7FDF: A901 LDA #$01 (Put a 1 in the accumulator)
C0/7FE1: 8D6805 STA $0568 (Store 1 into $0568)
C0/7FE4: 60 RTS
I appreciate the prayers and good wishes. Those who don't know, I was diagnosed with stage 4 melanoma in 2019, and I have done well with the treatment, but eventually treatments stop working and you change. I recently had a seizure at work, now I am healing but not able to work or really do much at all. The focus is just to get better. Again, thanks for the support and if I can help you I will. I've forgotten more about this game than most people should ever learn, lol.
« Next Oldest | Next Newest »
|
||||
Users browsing this thread: 1 Guest(s)