News:

11 March 2016 - Forum Rules

Main Menu

Help with Atlas-written pointers (FF4)

Started by screamingtrees, December 07, 2019, 04:05:03 PM

Previous topic - Next topic

screamingtrees

I'm trying to rewrite some of the script in FF4, but before I even started I wanted to see if I could successfully dump/insert the script using Cartographer/Atlas without any changes first. I've gotten pretty far, and I'm pretty sure I've isolated the problem. I just don't know what the solution is. Here's my atlas commands file: 
#VAR(dialogue, TABLE)
#ADDTBL("ff4.tbl", dialogue)
#ACTIVETBL(dialogue)
#JMP($80400)

//POINTER #0 @ $80000 - STRING #0 @ $80400

#W16($80000)
Your inventory is full.<END>


The problem is, the original pointer table in FF4 doesn't include "04" as it's second byte, but Atlas's log file shows that it's trying to write it like that. Here's a snippet of the original pointer table showing $0000, $0018 as the first two pointers:
 
00080000 000018002400370041004a0052005C00
00080010 6D008000A700CA00DB00E800FF001701
 
 
And here's the log file from Atlas showing the first PointerValue as $0400: 

     2 ADDTBL    Added table 'ff4.tbl' as 'dialogue'
     3 ACTIVETBL Active table is now 'dialogue'
     4 JMP       ROM Position is now $80400
     8 W16       ScriptPos $80400 PointerPos $80000 PointerValue $0400
Your inventory is full.<END>
 
 
How can I adjust Atlas to write the pointers like the original?

Raeven0

If the text starts at $080400 but the corresponding entry in the table is $0000, then the table contains offsets, not pointers. Make a custom pointer type with a $400-byte offset and do your writes with that pointer. Exercise 2 in the manual is similar.

screamingtrees

Thanks! The same thought actually occurred to me right after I made this post and went to work so I couldn't try it right away.

abw

Quote from: Raeven0 on December 07, 2019, 06:19:13 PM
If the text starts at $080400 but the corresponding entry in the table is $0000, then the table contains offsets, not pointers. Make a custom pointer type with a $400-byte offset and do your writes with that pointer. Exercise 2 in the manual is similar.
If you don't feel like rewriting all the #W16(...) commands to use custom pointers, a simple #HDR($80400) should also do the trick.

screamingtrees

Damn didn't know about that one. It wasn't hard to replace them all with notepad++, though. And now my script is working!