Custom Save Blocks

After some research, I’ve figured out how to customize the save file header information for both AWL and AnWL.

Each game has a file named wlp1.rel, which is a relocatable module (similar to how .dll files function for Windows programs). This file has the information which dictates the header info when creating or overwriting a save file.

This information includes the chapter names, the save filename, the game / save title, and the banner / icon to be used.

By manipulating this file, I’ve changed the game / save title for each game to HM: APL (for the wlw mod) and HM: AnPL (for the mlm mod).

I’ve considered changing the filename (originally bokujyo4.dat or bokujyoA.dat, depending on the game), but changing this would invalidate any previous save files for users of earlier alpha/beta builds of the mod.

Save Block Textures

In addition to modifying names / variables in this file, we can also modify the textures used. While I had already modified banner_card.tpl, I decided to try my hand at modifying card_icon.tpl. This file is a bit trickier since it uses a texture format that utilizes pallettes.

The important thing to note hear is that all of the individual textues must utilize the same pallette for the textures to render properly when displayed by the console hardware.

It’s also important to note that the order the textures are displayed is in bouncing order. That is to say that they go in order of 1->2->3->2->1->2->3, as opposed to a normal GIF loop order of 1->2->3->1->2->3. This is most noticable when seeing how the dog mouth opens / closes on the otiginal save icon

Standard Loop
Bounce Loop

Creating a new Save Block Texture

I started by deciding what I wanted to make for the new save icon. After some internal debate, I decided on using the blue feather (the symbolic item for proposing to one of the romance options) with a LGBT flag background. I created a version with a standard 6-stripe rainbow flag (1979 6-stripe variant), as well as one with the lesbian flag (2018 5-stripe variant).

I also created versions with the Philadelphia pride flag (2017 8-stripe variant) and Progress flag (2018 variant). While these show up ok with increased internal resolutions (i.e. emulator), they appears blurry / pixelated on original interlaced resolutions (i.e. original hardware). For this reason, I have made them available as optional, which can be used to replace the card_icon.tpl texture file on the disc.

Blue Feather (from commonall.arc.clz\symbol.tpl\Texture5), 1979 Rainbow Flag, 2018 Lesbian Flag, 2017 Philadelphia Flag, 2018 Progress Flag
Progress and Philadelphia Pride Flag Mockups

Philadelphia Flag card_icon.tpl [DOWNLOAD]
Progress Flag card_icon.tpl [DOWNLOAD]


To ensure that all images used the same pallette, I saved each texture as a single-frame 256-colour .gif file. When saving the first texture, I saved the generated colour table as a Photoshop palette. Then, when I saved the second and third textures, I loaded the colour table from the previously saved palette file. This would ensure that all three saved .gif image files had the same embedded colour table / palette.

When loading a .gif with an embedded colour palette into BrawlBox, it will give the option to import the palette. By selecting this option when replacing each texture in the card_icon.tpl file, it ensures they’ll all match.

Once the game is loaded with the edited wlp1.rel, card_icon.tpl, and banner_card.tpl files, and the game diary is re-saved, the changes will take effect.

AWL/AnWL vs APL/AnPL

Tutorial: Extracting Raw Texture Data and Calculating Hash Values From TPL Files + Naming PNG Image Files As Per Dolphin Standards

I’ve been playing around with the “Dump Texture” feature in Dolphin recently.

When the emulator dumps textures, it creates a file name that includes a hash of the texture data. This hash uses the xxhash64 algorithm.

I’ve found that, using information about the TPL file format, I’m able to extract the raw image data from the TPL files.

Once I extracted this data (via manually copy/pasting in a hex editor), that I’m was able to feed it into the xxhash64 algorithm. I used QuickHashGUI for this.

To my surprise, this actually worked and the hashes matched!

Extracting the image data from the first image contained in the logo.tpl file (the Marvelous logo) and comparing hash values to the dumped Dolphin texture filename.

I’m going to try creating a QuickBMS script to extract raw image data from TPL files to somewhat automate the process.

Eventually this means that I should be able to generate hashed filenames for every texture on the game’s disc. This bypasses the need to typically play through and manually come across every texture in-game.


Update

I’ve created a QuickBMS script that can take any input TPL file, and output the extracted raw texture data.

endian big

idstring "\x00\x20\xAF\x30"

get filesize asize
get openedFile filename

get numberOfImages long
get imageTableOff long

if numberOfImages == 1
    goto imageTableOff
    get imageHeaderOff long
    goto imageHeaderOff
    get height short
    get width short
    get imageFormat long
    get imageAddress long
    
    set name string openedFile
    string name - ".tpl"
    string name + "_Texture0_"
    string name + width
    string name + "x"
    string name + height
    string name + "_"
    string name + imageFormat
    string name + ".bin"
    
    math filesize - imageAddress
    
    log name imageAddress filesize
else
    for i = 1 < numberOfImages
        goto imageTableOff
        get imageHeaderOff long
        get null long
        get nexImageHeaderOff long
        
        goto imageHeaderOff
        get height short
        get width short
        get imageFormat long
        get imageAddress long
        
        goto nexImageHeaderOff
        get null long
        get null long
        get nexImageAddress long
        
        set imageSize long nexImageAddress
        math imageSize - imageAddress
        
        set name string openedFile
        string name - ".tpl"
        string name + "_Texture"
        set texNum long i
        math texNum - 1
        string name + texNum
        string name + "_"
        string name + width
        string name + "x"
        string name + height
        string name + "_"
        string name + imageFormat
        string name + ".bin"
        
        log name imageAddress imageSize
        
        math imageTableOff + 0x08
    next i
    
    goto imageTableOff
    get imageHeaderOff long
    goto imageHeaderOff
    get height short
    get width short
    get imageFormat long
    get imageAddress long
    
    set name string openedFile
    string name - ".tpl"
    string name + "_Texture"
    math numberOfImages - 1
    string name + numberOfImages
    string name + "_"
    string name + width
    string name + "x"
    string name + height
    string name + "_"
    string name + imageFormat
    string name + ".bin"
    
    math filesize - imageAddress
    
    log name imageAddress filesize
endif

Once extracted, these files can be hashed with a tool (e.g. QuickHash GUI) using the xxHash64 algorithm.

Combining the data from the script with the hash will provide you with the full filename that Dolphin would normally generate.

Comparison of BMS-extracted texture data vs Dolphin-dumped files

Once you’ve determined the file hashes, you can extract the textures from your TPL as PNG files using a tool like BrawlBox or Wexos’s Toolbox.

The naming convention will be as follows:

  • Naming Type – denotes the texture naming scheme used by Dolphin, should always be “tex1”
  • width x height – dimensions of the original texture, can be found in the file output from the BMS script above
  • hash – xxHash64 of the raw original texture data (as output from the BMS script once fed through a tool such as QuickHash GUI)
  • format – original texture image format as named in output from the BMS script above
  • Output file extention – output image file, should always be “.png”

Here’s a visual demonstration of the file naming convention, and where the different parts can be found.

Extracting a texture to a png image using BrawlBox, using naming information provided by QuickBMS + QuickHash

Update #2

After going through every CLZ, ARC, and TPL file, I beleive I’ve been able to dump/rename (almost) every texture in the game.

There are a total of 4115 unique texture images from Harvest Moon: A Proud Life (lesbian version).

I’ve compiled all of these dumped textures into a Dolphin-compatible pack, which can be downloaded [here].

Player Model Swapping

Now that I’m able to access the contents of the previously inaccessible CLZ files, It’s time to experiment with model files.

My first test was to decompress the mainchapter archives (e.g. mainchapter0.arc.clz), then extract the boy archives from there (e.g. boy_0.arc).

Then, I went about swapping the GPL files (e.g. boy_0.gpl). Based on my previous research, these should contain all of the 3D model data needed.

My first test at importing the girl model into AWL was… less than successful.

All hail the nebulous genderless void!

But at least the game didn’t crash, so that’s a start.

After some further tests, I found that I needed to swap all of the girl/boy-associated model files (act, gpl, skn, tpl, and tam) with their boy/girl counterparts.

Time to replace some additional data!

After replacing the model files, replacing boy_0.arc and girl_0.arc in the corresponding mainchapter0.arc files with their updated versions, and repacking those into their corresponding mainchapter0.arc.clz formats, it was time to test them out.

To my surprise, the models worked with little to no issue.

We now have the female model in AWL and male character in AnWL!

Note the mirror (AnWL) or lack thereof (AWL)

The animations seem to rig fairly well to each character, with a few exceptions (e.g. standing still while holding an animal such as a dog or chicken as the girl in AWL will cause the ponytail to do weird things).

I’ll be doing some more testing regarding the animations, with the hopes of fixing any discrepancies (e.g. the above animal holding glitch, the wider/narrower stance difference between the characters, etc). I know James in the Discord has been very active in experimenting with the character animations lately.

Fun with Textures in Dolphin

I’ve recently tried playing with the texture dump and load tools in Dolphin (fan emulator).

I dumped the boy textures from A Wonderful Life and swapped them with the girl textures from Another Wonderful Life.

The results were… interesting.

It’s worth noting that this is just a temporary solution until I can find a way into the game’s CLZ file format to manually replace the texture image files on the disc.

It’ll mainly serve as a way to identify the main character during test playthroughs as a female/male via their face/clothing.

Also, I really need to find a better way of differentiating Dolphin (Gamecube Development Codename) and Dolphin (fan emulator). Maybe I should refer to the former as Nintendo Dolphin and the latter as Dolphin-emu.

Poll: Which version of the mod are you most excited for?

Thus far, I’ve been working on both A Proud Life and Another Proud Life fairly equally.

As I continue my work on the mod, and focus in on certain aspects (e.g. dialogue), I found it would be best if I work on one game at a time.

This doesn’t mean that I’m abandoning either game, it’s just that I’d like to polish off one of the mods, then polish off the other.

I’m currently leaning towards Another Proud Life for a couple reasons.

  1. Dialogue: It’s easier to replace text with shorter words (e.g. replacing “she” with “he” in any dialogue where the main character is referred to).
  2. Textures: I also am able to edit at least the outfit textures, since those aren’t hidden in a clz archive.

As always, any input is appreciated.

HM: A Proud Life – Face Textures

After looking through all of the files that I could find, I’ve been unable to locate the face textures for the main character in AnWL; I’ve only been able to locate the body/outfit textures.

The face texture files are easy enough to find in in AWL:

  • Young Character:  disc:\boy_0.arc (U8 Archive)
    • Eye Textures: boy_0.arc\boy_0_f0_e.tpl
    • Mouth Textures: boy_0.arc\boy_0_f0_m.tpl
  • Adult Character: disc:\boy_1.arc
    • Eye Textures: boy_1.arc\boy_0_f1_e.tpl
    • Mouth Textures: boy_1.arc\boy_0_f1_m.tpl
  • Senior Character:  disc:\boy_2.arc
    • Eye Textures: boy_2.arc\boy_0_f2_e.tpl
    • Mouth Textures: boy_2.arc\boy_0_f2_m.tpl

However, the structure seems to be different for AnWL. I’ve created a diff comparison for the disc filesystems to hopefully help with finding the newly located files.

I’ve run the game through dolphin and can see that the textures do exist somewhere, but I can’t seem to find the source that they’re being loaded from.

If anyone can give any insight, it would be much appreciated.

For now I’ll work on the swapping out the body/outfit textures.