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

Author Topic: Help with Atlas-written pointers (FF4)  (Read 1209 times)

screamingtrees

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Help with Atlas-written pointers (FF4)
« on: December 07, 2019, 04:05:03 pm »
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: 
Code: [Select]
#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:
 
Code: [Select]
00080000 000018002400370041004a0052005C00
00080010 6D008000A700CA00DB00E800FF001701
 
 
And here's the log file from Atlas showing the first PointerValue as $0400: 

Code: [Select]
     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

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Help with Atlas-written pointers (FF4)
« Reply #1 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.

screamingtrees

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: Help with Atlas-written pointers (FF4)
« Reply #2 on: December 08, 2019, 02:36:26 am »
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

  • Sr. Member
  • ****
  • Posts: 323
    • View Profile
Re: Help with Atlas-written pointers (FF4)
« Reply #3 on: December 08, 2019, 09:42:50 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

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: Help with Atlas-written pointers (FF4)
« Reply #4 on: December 09, 2019, 05:11:56 pm »
Damn didn't know about that one. It wasn't hard to replace them all with notepad++, though. And now my script is working!