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

Author Topic: abcde: Atlas + Cartographer + A Whole Lot More  (Read 16995 times)

Risae

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #40 on: October 03, 2020, 04:03:43 am »
Hi abw,

as always, thank you very much for this awesome tool.
I have been assisting someone with figuring out how the pointer table for the Growlanser 1 script works.
Didn't take long and i managed to figure out where its stored and make a Cartographer script to dump its contents.
But it seems like the end token \n issue still persists:

Spoiler:

Spoiler:

Spoiler:

Spoiler:

I am using the latest abcde version. Do you know what might cause this?

abw

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #41 on: October 07, 2020, 07:16:41 pm »
Can you remind me again what output you were expecting in this case? It looks like your table file says to add 1 newline after each [END-FF] and that's what you're getting; if you want 2 newlines instead, FFFF=[END-FF]\n\n should do the trick.

Risae

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #42 on: October 08, 2020, 02:24:45 am »
Hi abw, i apologize for the crappy table picture.
1 line is supported, multiple lines are not:

Spoiler:

Spoiler:

I hope this makes it more obvious.

Another thing:
Inside Growlanser 1 ELF we came across a very strange pointer table.
The table counts 2 bytes as 1, and we looked through the Cartographer and Atlas docs but couldn't find anything that might support these kind of pointers.
Our super MIPS hacker decided to hack this function into Atlas.pm and Cartographer.pm.
It seems to work so far and we would like to give you the code in case you want to implement it into abcde:

Code: [Select]
Cartographer:
#POINTER MULTIPLIER:        $XX

Atlas:
#MULTIPLIER($xx)
It gets added automatically with the new cartographer if #POINTER MULTIPLIER is provided

https://bitbucket.org/Risae/growlanser-6-english-translation/src/master/GL1/01-abcde%20scripts/Cartographer/MODIFIED%20FOR%20ELF%20Cartographer.pm
https://bitbucket.org/Risae/growlanser-6-english-translation/src/master/GL1/01-abcde%20scripts/Atlas/MODIFIED%20FOR%20ELF%20Atlas.pm

He doesn't have any Perl experience and apologizes if anything explodes :laugh:.
« Last Edit: October 08, 2020, 04:48:30 am by Risae »

abw

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #43 on: October 08, 2020, 07:38:33 pm »
Ah, I see what you mean now. Try adding "#TRIM TRAILING NEWLINES: No" (it defaults to Yes) to the Cartographer script and see if you like that any better; you should get something more like:
Quote
//POINTER #0 @ $1F24 - STRING #0 @ $20FA
#W16($1F24)
//[END-FF]
//
//
//
//
[END-FF]




//POINTER #1 @ $1F26 - STRING #1 @ $20FC

The table counts 2 bytes as 1, and we looked through the Cartographer and Atlas docs but couldn't find anything that might support these kind of pointers.
Huh, that is weird. I guess the game must expect all strings to start on an address that's a multiple of 2 since it wouldn't be able to store pointers to any odd addresses. For insertion, it's certainly wordier, but the new CALCVAR features should be able to handle this with e.g.
Code: [Select]
#VAR(addr, CALCVAR)
#CALC(addr, "!CURRENT_ADDRESS / 2")
#W16(addr, $1F2A)
For extraction, though, you're right that there wasn't any existing support for multiplying pointer values by 2, so I'm glad you were able to add it, hopefully without too much trouble!

Risae

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #44 on: October 09, 2020, 12:04:26 pm »
Hi abw,

thank you for your reply.

Quote
Ah, I see what you mean now. Try adding "#TRIM TRAILING NEWLINES: No" (it defaults to Yes) to the Cartographer script and see if you like that any better; you should get something more like:

Hm, that wouldn't really help in my case, since i only want those 4 spaces between each text block. Right now, using Comments: Both, it also does the spaces inside the commented lines.

Quote
Huh, that is weird. I guess the game must expect all strings to start on an address that's a multiple of 2 since it wouldn't be able to store pointers to any odd addresses. For insertion, it's certainly wordier, but the new CALCVAR features should be able to handle this with e.g.

Growlanser 1 uses a really shitty text encoding in which each character has to be 2 bytes.
It's similar to a shift-jis table that has all the ASCII/1 byte characters stripped out.
In the SCEN.DAT archive, which stores all the script files, the pointers count in 1 byte increments, but in the ELF its always 2 bytes. No idea why the devs decided to do that.

abw

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #45 on: October 10, 2020, 10:59:29 am »
Hm, that wouldn't really help in my case, since i only want those 4 spaces between each text block. Right now, using Comments: Both, it also does the spaces inside the commented lines.
Keep in mind that there's always the option of doing a little post-processing on your own; something like
Code: [Select]
sed -i 's/\(\/\/POINTER\)/\n\n\n\1/' Cartographer_G1_dumped_script*.txt
should get the job done nicely.

Everybody's got their own preferred formatting, and adding dozens of commands for separately controlling every place where whitespace is output is pretty annoying from a development perspective without providing much real benefit. I might look into adding some sort of customizable templating system for the Cartographer output, which could be much more flexible and could be used to address other formatting issues that take more than a single search-and-replace to resolve.

No idea why the devs decided to do that.
This is a common refrain throughout the ROM hacking community :D.

Risae

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #46 on: October 16, 2020, 10:02:07 am »
Hi abw,

thank you very much for your reply.

Keep in mind that there's always the option of doing a little post-processing on your own; something like
Code: [Select]
sed -i 's/\(\/\/POINTER\)/\n\n\n\1/' Cartographer_G1_dumped_script*.txt
should get the job done nicely.

Everybody's got their own preferred formatting, and adding dozens of commands for separately controlling every place where whitespace is output is pretty annoying from a development perspective without providing much real benefit. I might look into adding some sort of customizable templating system for the Cartographer output, which could be much more flexible and could be used to address other formatting issues that take more than a single search-and-replace to resolve.
This is a common refrain throughout the ROM hacking community :D.

Yup, i tried "\n\n\n\n//POINTER #" using Notepad++ and it perfectly does its job. But thank you for telling me about the option "#TRIM TRAILING NEWLINES: No", might come in Handy in the future

abw, i have another question regarding an issue that we came across.
Inside Growlanser 1 ELF there are textblocks stored. It is build up like this:

NOTHING
NOTHING
STUFF
STUFF
TEXTBLOCK 1
POINTERTABLE 1
TEXTBLOCK 2
POINTERTABLE 2
TEXTBLOCK 3
POINTERTABLE 3
TEXTBLOCK 4
POINTERTABLE 4
...
STUFF
STUFF
NOTHING
NOTHING

We have a size issue, because right after the end of the textblock 1/2/3... the pointer table starts.
So, i thought we can just move the textblock below the last STUFF and have an almost unlimited text space.
I found a spot that is close enough for 2 byte pointers that are devided by 2 to still reach (0xFFFF x 2).
Now here comes the problem that we came across.
When Atlas calculates the pointers, it cuts off everything after 0xFFFF, even though the pointers get divided by 2.

Spoiler:

0x13C610 - 0x12C4A4 = 0x1016C which would roll over to 0x016C
But 0x016C divided by two would be 0x00B6.

Do you know what we could do to make Atlas properly calculate the pointers?


Update:

our super MIPS Hacker and a buddy took a look at this issue in our Discord and suggested a modified part of the Atlas file:

https://bitbucket.org/Risae/growlanser-6-english-translation/commits/8fcbd02b7a51190ff583a7658ff4e330f55d1643

Seems to work like a charm now:

Spoiler:

Spoiler:
« Last Edit: October 16, 2020, 10:46:26 am by Risae »

abw

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: abcde: Atlas + Cartographer + A Whole Lot More
« Reply #47 on: October 16, 2020, 05:30:13 pm »
Do you know what we could do to make Atlas properly calculate the pointers?
The previous extension to add a #MULTIPLIER command applied the division *after* the pointer had been reduced to 16 bits, so if your original pointer value was $12340, that would get reduced to $2340 and then divided by 2, resulting in $11A0. It looks like the new version divides first and then reduces to 16 bits, so now if your original pointer value was $12340, that would get divided by 2 to become $091A0 and then reduced to 16 bits, resulting in $91A0, which sounds like it matches up with the game's logic a bit better.