editing aoishiro script

I’d like to work on the the Aoishiro PC game, but compared to the demo, the real game has over 1000 script files and I can’t use the DAT files from the demo since they’ve changed so it’s like starting from scratch…
Maybe I can work on it after the current manga set since I haven’t found anything new that’s interesting to me and that no one is working on. :p

It seems some people are interested in working on Aoishiro so I’ll give more details on how I edited it.
This is a really crappy way of doing this.
It’d be better if there were an extract and re-insert script for the text, so if anyone is up to it… =)

So after you’ve installed the game, the directory that contains the data for the game is:
<INSTALL DIR>\Aoishiro\SCRIPT

All the script is in the file SCRIPT.AFS.

To extract the DAT files from the script, you can use
AFSExtract7. I was using version 1.3 Beta 5
Open up SCRIPT.AFS and then you can go to Command->Export Folder and export all the DAT files.

Now, open up a DAT file, say, a1_01_00.DAT in your favorite Hex Editor.
I was just using a free one xvi32

If you scroll down to E72, then you’ll see a block like: FA 00 74 16 7E 18 72 18
So FA 00 is the length of text allocated and 74 16 7E 18 72 18 stands for 語り手(katari te or “Orator”)
So the characters are encoded using two bytes. This is important because when you’re replacing text, you have to make sure you replace two bytes at a time (even if it’s just to make the second byte a null or a space).
In other words, if you just replace 74 instead of 74 16, you’ll probably encounter an error.
From E86 to F01 is the first line of text.
FD FF marks the end of the line.

To replace with english, you just have find the right encoding. You can use 00 00 to ignore the rest of the line.
‘a’ corresponds to 9F so if you replace the first two characters of the first line:
7F C0 with 9F 9F, then your line will say “a a” now.

After you’ve modified the DAT file, then use AFSExtract7 to re-insert it.
Click on a1_01_00.DAT, then go to Command->Import File and select the DAT file you edited.
Now, run the game and the first line of text should be replaced.



Here’s some info/scripts that might be useful.
Mapping of alphabet to hex and names to hex – Here

Script to translate a line of text into hex characters – Here
It will write the output to a file, out.txt. Ideally, it should write to the clipboard instead to make insertion easier…
Ex. ./convert.pl “Testing”
$ ./convert.pl “Testing”
Input: Testing
T = AC
e = 9B
s = 8D
t = 8C
i = 97
n = 92
g = 99
Total bytes: 7

$ cat out.txt
AC 9B 8D 8C 97 92 99

Script to replace names in a DAT file – Here – Incomplete
I only added “Orator” for now. The other names need to be added but that shouldn’t be too bad.

Caveats: I didn’t know how to increase the space allocated for a line so that’s why some of the translated text is not an exact match to the Japanese.
Also, that’s why Syouko is just Syou though Syouko would fit on the line.
Aoi is one character in Japanese but the space allocated for Aoi can take up 4 bytes which is why Aoi is not Ao.

This entry was posted in Games and tagged . Bookmark the permalink.

11 Responses to editing aoishiro script

  1. Winterbraid says:

    Geez, I`ve basically spent the last two weeks hex-editing Arcanum`s binary game files! Then I go to my favourite scanlation page to relax and what do I see? More binaries!!! >-< If I understand correctly, you need 1) something that would take the hexadecimal information from a .DAT and convert it into Japanese text, and then 2) something else that would put the translated English text into the .DAT?

  2. shijima says:

    Hehe, yah, 1) and 2) would be ideal, but don’t worry too much about it since it is possible to hex-edit it, just slow.

    Why were you hex-editing Arcanum? Not for localization, right?
    I’ve not played the game, but I used to really like Sierra, back when they made all those King’s Quest and Space Quest adventure games. =)

  3. Yi says:

    I’m really glad that you are going to do this. There are not enough yuri games out there, and even less translated.

  4. Winterbraid says:

    @Shijima: I`m working on a mini-mod; for some reason, one part of the game information (like the schematics for item creation) is stored in text files and the other part (like weapon parameters) is in binary files, called prototypes. Apparently they wanted to make the game easily moddable, but guess they didn`t expect someone to go as far as creating new weaponry (or new art, when we are at it; replacing the artwork in Arcanum is a *huge* pain >-< ). Every “object” in the game world (weapon, item, NPC, texture etc.) has its own separate prototype, so there`s 100s of them (namely 1423); each can also have AI routines attached which are in separate files, but I didn`t go into that.
    At one point I wanted to change the buying price of an entire class of items, and there were, like, 70 of them, and editing 70 files by hand isn`t really my style. ^-^ Fortunately, the offset for buying price is constant throughout the item prototypes. I wrote a quick and dirty bash script that did it for me; it made use mainly of the binary2ascii (and accompanying ascii2binary) executable, other than that it was a few logical loops and an entirely inelegant application of cat and sed. ^-^; Basically binary2ascii turns cat output into a column of hexadecimal representations so that it`s sedable, then sed does its work to make the actual modifications, and finally cat | ascii2binary turns the ASCII hexes back into binary data. All this was so that I could work on text rather than on binary data, which is more straightforward; the script refers to specific bytes as line numbers rather than offsets. A cleaner option would be to find a sed for binaries (which I`m sure has to exist somewhere) and eliminate the binary2ascii part. Sed is the slowest link in the chain anyway, but I`m not sure how fast binary2ascii is on bigger files.
    If I understand correctly, this is similar to what you`re planning to do, only the sed (modification) part would have to be adjusted so that it recognises parts of speech in the binary and extracts them, rather than working on the entire file (which also contains non-text information, right?); that would be grep, and it shouldn`t be a big problem if there`s some rule to the positioning of each portion of speech in the binary. Then the script would replace bytes with corresponding Japanese characters. I have no experience using sed with Japanese, but I don`t think it`d be a problem if your machine is configured properly. The GNU sed is supposed to support multi-byte characters, and I`m sure there`s a sed in BSD which supports Japanese. Compared to this, turning English text into bytes and putting it back in the binary should be piece of cake. Now I`m writing all of this because you mentioned that you use Cygwin; if I remember correctly, it`s a *nix shell for Winblows, so you do have grep and sed, right? And you could probably use binary2ascii as well.

  5. shijima says:

    @Yi
    Hehe, no promises that I’m going to do this since it’s so huge.
    But at least it’s possible for someone can translate it if they want. =)

    @Winterbraid
    Wow! Impressive to add such a game mod!
    Reverse engineering is definitely not my forte.
    Let me know what new weapons you’re making. Anything from the anime universe?
    Thx for the note about binary2ascii and vice versa. It would’ve been easier to use that than convert bytes one by one in perl…

    Yah, Cygwin is a *nix shell on Windows.
    The main problem with the DAT file is that I’m not sure where each block of text is.
    I can tell by looking but I guess I’d have to find some common patterns in order to write a script to extract it. Also, I’m not sure of the encoding of the Japanese text. I’m pretty sure it’s not Shift-JIS or EUC-JP.
    Ah well. =)

  6. Winterbraid says:

    Yeah, I checked it in the meanwhile on a kanji search and it`s different from any encoding I could find; I`m afraid the game might be using its own encoding. Does the game use a lot of kanji, or just the ones you put in the spreadsheet? Also, the links to your perl scripts give me a “500 Internal Server Error”.
    Heh, my mod isn`t really that complex; I`m not creating any new maps or AI, and 90% of time I move in charted territories (Arcanum has very strong fandom). I`m mainly fixing several things that annoyed me, editing some of the existing weapons and adding some weapons I felt were missing, as well as new character backgrounds (you choose one during your chara creation, they provide a backstory and affect starting stats; the default ones are, uh huh… not exactly perfect).The hardest thing, apart from writing cool descriptions, is finding good art. ^-^;; There aren`t really any anime weapons, although I used the art of Axel`s Fire Wheel chakram (not that I particularly like him, I simply wanted a thrown weapon and this was among the few which looked remotely cool). There are some Fallout-style weapons, three different crossbows (as hard to believe as it is, Arcanum didn`t have a crossbow), a chakram launcher, and also several gunblades (but they are not like Squall`s gunblade). There are a few enchanted guns, which can be considered anime weapons, I guess. ^-^ (Though they`re not really magical, as the Arcanum engine apparently doesn`t allow magical guns; but they do inflict extra elemental damage while using normal bullets and not fuel or batteries.) I`m also considering Fate`s Bardiche. ^-^ Some of the new backgrounds are pretty much anime-like, too. Arcanum itself feels a bit like anime. If there is any anime weapon (preferably retro style) that you particularly like, let me know and I`ll consider it. ^-^

  7. NivGol says:

    Looks like the encoding has all the characters in a reverse position since the hex value for each character (Z-a) is descending (A6-9F). Thus the encoding might be similar to JIS or any other japanese encoding, just backwards >.<. I wonder if there is a way to convert it to normal.

  8. shijima says:

    @Winterbraid
    Ah, sorry, fixed the links. It seems the Webserver doesn’t like perl files if they’re not in cgi-bin directory.
    Hehe, if you do look at it, just remember, I’m not a developer. :p

    Your mod sounds cool. I do like enchanted weapons. I remember Final Fantasy Tactics has elemental guns which were awesome. You can snipe so many people with them.
    Nah, I don’t have any recommendation for weapons, I was just curious. =)
    I do like Gilgamesh’s Ea from Fate/Stay Night cause it looks cool and of course, Rin’s Kaleidostick for its unique abilities :D

    @NivGol
    Ah, interesting observation.
    That might be a good area to investigate.
    I guess it’s the “brute-force” approach for now though. :p

  9. Winterbraid says:

    Kaleidostick – do you mean this? It basically looks like Sakura`s wand… Also, is Ea that red sword thingy Gilgamesh is wielding? I`m actually looking for something more technological, but not too much; preferably steampunk style. ^-^ I also need to work on the crossbows; two of them look too modern and one might look too low-tech. I also tampered with AI scripts a bit, to see if I can remove the gender requirement for the player character`s romance with a certain NPC; unfortunately I had little luck in this field. The dialogue itself is in text files, but the triggers and conditions seem to be in accompanying binary files which are *very* hermetic. >-<

  10. Nik says:

    >shijima
    I’m also translate Aoi Shiro ( 1) not to English 2) not personally, i’m in charge of tech. part ). And I’m already broke all game format’s:
    1) Script decode/encode (only main files for now. don’t have tool for “root” files (info for choices there) decode (exams, work, laziness…))
    2) Images – .cel files decoder/partial coder
    3) Fonts – format understanding only for now
    I can share this info. ^_^
    Contact me via email (i left it there). I think, it would be better, if you send there ICQ or Jabber ID (don’t like to “chatting” by email).

  11. shijima says:

    Thanks! I’ve sent an email.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>