User blog:RottenBlock/Problems Decompiling Mamanyonyo

If you didn't already know, Mamanyonyo is the original version of Widenyo, a game we actually have in English. Unfortunately, while Widenyo adds a few features, it's missing a lot of Mamanyonyo's features, including all of the original H-scenes.

Vicusdanielson partially translated the game by transposing the already-translated data from Widenyo (find here, or here). Unfortunately, he was only able to change images for technical reasons I'm going to go into below. This translates most of the gameplay, but leaves all raw text untouched.

So what's the problem?

Mamanyonyo is Old as Balls
Mamanyonyo is one if the first System 4 games Alicesoft ever released (Rance 5D, released four months earlier, still used System 3.9). Its AIN file is marked as Version 1, and they didn't stick around on Version 1 for long. Big Bang Age, released a mere ten months later, is Version 4. And that's precisely the problem: all the Alicesoft System 4 tools out there are designed to work with Big Bang Age at the oldest, and Mamanyonyo has been left out in the cold.

There are a lot of tools out there for extracting text, and maybe some of them might work on this project, but I haven't had any luck with the ones normally associated with AliceSoft (namely arc_conv) based solutions. Instead, I've been trying to use SomeLoliCatgirl's AINDecompiler, since it is open source.

AINDecompiler used to crash when trying to read Mamanyonyo's AIN file. I have improved the situation to "Throws an error and refuses to continue." This is not much of an improvement.

Stopping the Crash
First off, SomeLoliCatgirl hasn't been on the HongFire forums in over a year, and I don't know any other way to contact them. I'll contact them only if I run out of other ideas.

Going into the code myself, we see that AIN files divide common elements into their own sections, which occur in a predictable order marked by a four-character tag. The crash occurs during the FUNC tag, and long story short, it happens because Mamanyonyo's rusty-old AIN file doesn't have "isLabel" data nor what SomeLoliCatgirl calls "CRC" data (which they note doesn't seem to do anything to begin with). By updating AINDecompiler to skip these features when working with Version 1, the crash will be fixed. You'll want to do the same for the writing code or that'll be a problem down the road, too.

Basically, just go to AinTypes.cs, scroll down to line 2116, and change the Read and Write functions to look like this: public void Read(BinaryReader br, int version) {           Address = br.ReadInt32; Name = br.ReadStringNullTerminated; if (version > 1 && version < 7) {               IsLabel = br.ReadInt32; }           DataType = (DataType)br.ReadInt32; StructType = br.ReadInt32; ParameterCount = br.ReadInt32; int totalVariables = br.ReadInt32; if (version > 1) {               Crc = br.ReadInt32; }           if (totalVariables > 0) {               Parameters.AddRange(Util.Read(br, totalVariables)); }       }

public void Write(BinaryWriter bw, int version) {           bw.Write(Address); bw.WriteStringNullTerminated(Name); if (version > 1 && version < 7) {               bw.Write(IsLabel); }           bw.Write((int)DataType); bw.Write(StructType); bw.Write(ParameterCount); bw.Write(Parameters.Count); if (version > 1) {               bw.Write(Crc); }           Util.Write(bw, Parameters); }

The Mystery Box
After we fix the FUNC section, decompilation proceeds in an orderly fashion through the next few tags. We get all the way to GVER (don't worry about GVER), and the very next section is supposed to be STR0, the section that holds almost all the text. This is the section we're looking for!

Instead, another section called "SLBL" shows up.

SLBL is not used in other System 4 projects. The very first piece of data stored in it is the number 9. In most other sections, this is a length counter, and sure enough, it's followed by 9 (string, int32) pairs, where the string is Japanese text. Only then do we hit the STR0 section.

That's where I am now. Until I do something with the SLBL section, we can't proceed. Even just leaving it alone at this point isn't so simple, since I'd still have to save the data somewhere so that it could be replaced into the finished file. Moreover, I'm worried that it actually... you know... does something, and that try to localize the game with or without this section could cause problems in their own ways. Also, I can't guarentee there aren't more mystery boxes beyond STR0.

What's Next?
I'm going to try to get back to this in a few days, weeks, who knows, but in case I never do, I'm leaving this post behind for posterity. Once the problems are fixed, this game is probably going to be low-hanging fruit for localization, what with all the work carried over from Widenyo already complete!