Tuesday, April 7, 2020

Tile Shopping, now with 200% more pixels!

A few days ago i saw that a new Tile Editor is currently in developement, named "Tile Shop":

https://www.romhacking.net/forum/index.php?topic=30404.0

I was able to see my broken font files using some different settings:

The developer asked in his thread for files that are unusual, and so i asked him if he wants to take a look at the font files of Growlanser.
He said sure, and so i send him the files and lo and behold, this madman actually managed to display our beautiful font in the Tile Editor!:





Look at it and be in awe of the beautiful GL5 font!
Here is what he wrote me while checking out the font files:


Hi Risae,

So I've looked at the GL5 files (GL6 looks the same) and the verdict is: "No, but kind of" regarding what I think is accurate viewing. I'm not sure how I would test accurate editing.

Here's the result so far: https://i.imgur.com/VTrS8OJ.png

I'll go through the steps necessary to get to the result for "GL5 ENG 0000002e.fnt".

The offset at 0x8 of each font file contains the location of the palette (0x220). Scroll here and see that the palette is split between two sections. TileShop cannot support scattered palettes at the moment, so I copy/pasted the second half directly after the first half. The color format is RGBA32 and not BGR15 as I would have assumed. I also changed the alpha channel values from 0x80 to 0xFF. 0x80 is probably a game/format-specific transparency value that maps onto an alpha blend mode that is not 50% transparent.

I mostly setup the included project through hand-editing the XML project files. Copy/pasting from single layout images is currently far from ideal and I've found some bugs in the process.

If you try the project, make sure the project file (and included modified font) is in the root of the TileShop folder. I introduced a bug with directory-dependency of the schema validation in the current version.

 He is using an XML file to tell the program how to properly display the font files, but after a first attempt at doing it myself i couldn't really get anything to show, so he helped me out once more:


Hi Risae,

For the GL6 font provided, please know that getting the width correct is critically important. You cannot reuse the same width (and height) from other files. Luckily, the FNT file contains the width, height, palette offset, image data offset, etc as follows:

0x8 - Palette offset (probably 4-byte)
0xC - Image offset (probably 4-byte)
0x1A - Image width (2-bytes)
0x1C - Image height (2-bytes)

I have included a revision to the GL6 project which includes one arranger at an incorrect height (768) and the other at a correct height (192). Without header information, you would need to open the font file directly in TileShop, change codecs, adjust width/height/file offset until you figure out the correct settings.

For editing via TileShop:
Importing is currently not supported, but will be supported soon. Importing has worked for quite some time in ImageMagitekConsole, but I would like to have a nicer solution for merging multi-palette images before rolling it into TileShop. I may not hold back for that though.

There is a save button in the pixel editor's toolbar that saves changes directly to the file.

I would suggest holding your editing for now, at least if you plan on using TileShop. I have an undo/redo feature for the pixel editor locally, but probably won't release a new version for another 2-3 days. You may also want to wait for importing as hand-editing a font with transparency aliasing using a very basic pixel editor is not a fun task.

- Klarth


I really should have known better... looking at his information it now all makes sense.
Thanks to him we have a really good understanding of how the font files are build up.

Since the program supports exporting but not importing of files we can't really change the GL6 font right now.
If i can somehow find the variable width font code in GL5 we might be able to just copy and paste the GL5 font into GL6 and it will magically work without doing any tile editing.
I will create another thread on the Romhacking forum about finding "Text Routines" in the games assembly code.
Lately the Romhacking Forum has been such a great help in figuring out how this game and its files work, really cool community.

But now i know why in 2019 i could just copy and paste the GL5 font into GL6 without any artifacts or broken letters (aside from the width issue).
GL5 and 6 really are a carbon copy of each other. Makes things a lot easier!

Here are the GL 5 and 6 fonts in all its high resolution glory:

GL5 ENG 0000002a.fnt

GL5 ENG 0000002e.fnt




GL6 JPN 0000002a.fnt



GL6 JPN 0000002e.fnt


Those are not all the .fnt files, but we mainly have to focus on 2e.fnt, because that is the one that affects the font ingame.

Game Patching, now actually user friendly-er Vol. 2

Yesterday i made the switch from "Atlas" (script insert) & "Cartographer" (script dump) to a new program called "abcde":

https://www.romhacking.net/utilities/1392/

abcde is a program written in Perl that combines all the functions of Atlas and Cartographer and adds new on top.
I converted all the repository files over to abcde. And now thanks to switching we are able to:

- download the repository
- put the files in a folder for Atlas re-insert
- bulk insert all the script files into the games .flk files at once

And all of this in a matter of seconds!
Previously i had to manually copy and paste every single script file into a text file that was encoded in SHIFT-JIS, because the table file used was also encoding in that.
But now, thanks to abcde using UTF-8 tables and bitbucket only hosting files in that exact format, we are able to do this now.
Saves a lot of time inserting scripts and gives us more time on testing it ingame.

For anybody interested here is how you can install and use abcde:

1. Download Strawberry Perl Portable and extract it:


2. Add following folder paths to the PATH windows settings:

<PATH>\Strawberry Perl Portable\perl\site\bin
<PATH>\Strawberry Perl Portable\perl\bin
<PATH>\Strawberry Perl Portable\c\bin


3. Download abcde:


4. create bat files using the repository information:


(you can download the repository and just copy and paste them, probably)

5. Now you can create a new folder somewhere where you will merge the repository script with the games .flk files

5.1 Download the repository and copy the contents of the SCEN folder into that new folder

6. Copy all .FLK files from GL6 into the same folder

7. replace "PATH1" and "PATH2" in the "Atlas bulk import.bat" with the folder path of your new folder that has the repository files and the game files

8. Now it should automaticly insert all the repository files into the game files when you launch the .bat

9. Now you can create a quickbms .bat that automaticly takes the files in the created folder and inserts them into the games .DAT files:

#################

quickbms -w -r growlanser.bms "PATH\GL6_SCEN.DAT" "PATH\FOLDER CONTAINING MODIFIED .FLK FILES"

pause

#################

Don't delete the " ", its needed if you have spaces in the path to the folders.

Saturday, April 4, 2020

GL5 font has now been ported into GL6! (...sort of)

Heya, mako here!

Recently, Risae found a program called Tile Molester that lets us export the font table from the .fnt files into a regular .png image, which can then be edited using any image editing program and reimported back into the .fnt file. This allowed me to effectively replace the existing font in GL6 with a more GL5-esque font using paint.NET, a program I frequently use for my other HD font/texture replacement projects.

Here's what the original GL6 font looks like:



Here's what the GL5 font looks like:



GL5 pretty much uses the bolded font Book Antiqua. However, since GL6 only supports monospaced fonts, and Book Antiqua is a variable width font, I had to manually overwrite every single character with a Book Antiqua character, stretching and squishing each one to fit in the fixed width as needed. This didn't look very good for lower cased alphabets, as the lines would become too think. So I decided to use regular Book Antiqua as the base for lower case alphabets instead of the bolded font, but that cased the font to become too thin, making it look jaggy and overall wonky. To fix this, I manually turned up the saturation and contrast of said alphabets, which has given us the following result:





Note that GL6 still uses fixed width font, which means there will be gaps around narrow characters and wider characters will have to be horizontally squished. Unfortunately, this can only be solved by importing the variable width function and font directly from GL5 into GL6. Until then, I'm satisfied with the progress we've made so far in the past year.

I might have cried a little when I first saw the new font in GL6. Suffice to say, I'm very happy with how it turned out!


Game Patching, now actually user friendly-er

Recently i was working on automating most of the mundane stuff that i have to do to patch the game files and the ISO.
When we are working on the files we have to do the following:

1. Unpack the Growlanser 6 ISO using "Xpert" with the plugin "PS2 CdDvd5 |PSP UMD ISO Shrinker v1.05 *.ISO"
2. Use "quickbms" with the Growlanser script to unpack the .DAT files and its contents
3. Use "Cartographer" to dump the text and the text pointers
4. Use "Atlas" to re-insert the text and text pointers
5. Use "quickbms" to re-insert the modified files into the .DAT files
6. use "Xpert" to remake the ISO

These days i mostly have to use 3, 4, 5 and 6, since i dumped all of the files ISO files already.
The Problem with Xpert is that it takes quiet a while for the files to dump, and then to remake the ISO.
(And also the UI is pretty shitty)

Searching for an easier way to patch the game, and needing a better way for fans to patch their own game, i came across the program called "xdelta":

https://www.romhacking.net/utilities/704/

This program can check 2 Roms/ISOs for differences and create a really cool patch that you can use to patch your own game without needing to use the modified files and Xpert!
Sadly i came across a problem in which Xpert seems to modify some kind of files after remaking the ISO, which completely broke xdelta...
So, i was in search of a better way to modify the game ISO.
And after some searching i came across the program called "Apache 2":

https://www.psx-place.com/resources/apache.697/

(There also seems to be an Apache3, but i didn't try that out yet since 2 works like a charm:
https://www.romhacking.net/utilities/584/)



With this program its even easier to patch the ISO.
You can browse the ISO with Apache and then you can hot-swap the modified files in a matter of seconds.
This makes it a lot easier for me to patch an ISO to check the changes, and the xdelta patcher works now too!

If anybody is interested in trying out our current progress, which you can find on the repository, i created a patch with xdelta which patches your game:



https://bitbucket.org/Risae/growlanser-6-english-translation/downloads/GL6_0.3.rar

Beware that its super work in progress.