Siglus Hacking

Thanks @Kelebek! I was just about to post an update to the tools for v1.1: https://dl.dropboxusercontent.com/u/58805276/AngelBeats_1stBeat_Trial_Tools.zip

3 Likes

Have you tried doing anything with the scripts tanuki? I’ve been trying to decompile them, but I’m stuck in a few places. I don’t know what all the listed tables do in the scripts, and I’m also not sure what the two different function table lists in the scene.pck are for. I saw the second one get called with a 0x30 call (calls with 0x7e000000 or 0x7f000000 bits set are external?), but no idea on the first one. I’m also having trouble keeping the stack accurate, so I haven’t been able to decompile all the scripts yet, but I got one out at least: http://a.pomf.se/gjwyhm.txt

The way the script works is that the names are placed with the rest of the dialogue and choices. These strings are tagged with reference numbers at the start of the line (basically the same as they are in my RLDev guide.)
The ss files that contain all the code (that we can’t actually read right now) reference the numbers of the line with the text it wants. To present dialogue, it has to point to the line with the dialogue it wants. To show the name of a character, it has to point to a line of text with that character’s name or nickname. The same thing goes for decisions, and they also use it for sprites but in a very convoluted way.
This means that, for example, every time Iwasawa speaks, there will be “Iwasawa” and “Masami” on separate lines above it. The ss file will then say “If Otonashi is on a first name basis, use Masami. If he isn’t, use Iwasawa.”
They then use this for every nickname that gets handed out.

In earlier games like AIR, they would just put all of the names of characters at the top of a file, but for some reason they are doing this messy method of typing the list of alternative names every time that character speaks.

Woah, thanks.

So quick!

It looks so clean compared to the reallive ones, but it doesn’t look as fun to work with ^^;

1 Like

Oh wow. I would’ve thought that would be one for TK… Ha. xP

I just do find/replace in Notepad++ whenever I find an instance of it. I use a regular expression like the following:

Find: \n<([0-9]+)> ロリコン
Replace: \n<\1> Lolicon

(That ensures the original comment that’s meant to stay in Japanese isn’t also altered.)

They were so numerous I thought they were thrown in to throw off foreign translators… Like, they’re incredibly redundant. In the scene I’m translating each string occurs around 16~18 times, and there are numerous such strings.

I mean… It would’ve been simple to remove duplicate strings as a process from their development tools since it could end up saving quite a bit of space but I guess they didn’t.

Oh I ran across one of these too. Mass-produced Hinata, or something like that.

That’s what I’ve been doing too. N++ best ++

Gotta hunt for the actual story! Seems like, despite optimizing the g00 files so well, they just didn’t care about the file size of the .pck.

1 Like

It’s only a prelim, like I said, haven’t even gotten more than that script decompiled yet. I could remove like all the pushes and set all the args in the calls etc directly, that would cut a lot of the size down. But anyway, the compiled script obviously does many commands for a single original script line, there’s not that much you can do about that without heavy script pre-processing to combine every command properly. I’m not sure how RLDev does things though, but it also has all its functions named and mapped out doesn’t it? I can’t do that.

Yeah, Haeleth invested a lot of time in RLDev… and reallive was simpler than Siglus. Even then, it wasn’t really complete on this front.
Honestly, while it’d be fun to look around and mess with easily, that’s more of a luxury convenience than anything.

Maybe I can find out how the furigana text is presented through what you managed to decompile… It’s from the first day, which is what I’m TL checking right now, so it’ll be fun to look through it and see exactly what causes what.

Oh, hey. Would you be able to recompile this one script?

No, I didn’t write any compiler yet, there’s not really much point when I can’t get them to decompile yet. And like I said, there are tables in there that I don’t understand, so that could break things as I can’t create them. That’s why I was asking tanuki.

Okay, it took a couple hours, but every file (apart from 03_ユイ_00.txt which I’m working on) has been updated to the 1.1 version.

1 Like

Hey @Kelebek, what are the offsets to the function tables that you are referring to in scene.pck? To be quite honest, I have not tried digging deeper into the scripts, but I’ll take a look over the weekend.

Well honestly it’s a lot of them.

0x4: Script

0xc: String entries
0x14: Strings

0x1c: Sub locations, script jumps go to these places.
0x24: Not sure, but it looks like entry locations or something. At least, the first entry is always 0x5, and it’s read in before the game reads the script, and this is the location where the game starts reading the script from. I don’t know why the whole table is nulled in a lot of files. I don’t know how else it uses these after the original one set to 0x5, that’s why I’m unsure.

0x2c: Exported? functions. The first dword is read in by specific calls in the script, the numbers are the function number in Scene.pck’s (second only?) function table, which points to other files in Scene.pck with a location in their script. The first dword is the function number, the second dword is the location in the script, although it doesn’t seem to be read, it’s read from Scene.pck directly, but they match.

0x34: A value representing something. As in, it’s a data type. 0xa is int, signed/unsigned dunno, 0x15 is a string, and there are others. Tied to below table.
0x3c: String entries for some function calls.
0x44: The strings for above.

0x4c: Don’t know. Originally I guessed possibly script locations for local calls, as they at least look like script locations. Really don’t know though.
0x54: Function string entries for the above.
0x5c: The strings for above. They at least seem to be named after the file they’re in. Like the sc_fade file has all sc_fade strings here etc.

0x64: More function string entries. What are these? No idea.
0x6c: The strings for above.

0x74: All the name string entries. The entries in this point to strings, all of which are names for the characters used in the script, including the ones you choose to call yourself.

0x7c: No idea at all. Looks like more string numbers, but if you list all these, they’re entirely random, I can’t make any sense of what these are if they’re actually strings. They point to names, narration, voiced lines, all string types. The game doesn’t touch this table ever from the testing I’ve done.

So what I need help with most is these function tables. There’s 3 of them, the external one I’m alright on, I know it at least points to a function in the second table (still no idea what the first function table list is for in Scene.pck). Then there’s the 2x3 function tables, first one being some sort of value representing something, then the function string entries, then the function names. I don’t know how these are read or processed or accessed.

3 different types of functions. original I was thinking imports/exports but then why are there 3 tables. Is one really just local/private? What’s the point of the strings? They don’t even match anything in scene.pck. I also did a search in the scene files as well to try and match what could maybe be an import (in one of the day scripts) to an export (which I assume would be the sys files), but no hits for the strings. I haven’t seen it do any sort of string comparisons either to find it.

So besides those tables in the script files, for Scene.pck itself, I don’t know what the tables at 0x4, 0xc, 0x14 are for. Again the first table is a data type, then string entries/strings. Don’t know how/what they’re used for. The second group of 3 tables (0x1c, 0x24, 0x2c) is accessed as I said before, for the 0x2c tables in scripts.

Also, there’s a whole load of unaccessed data on the end of Scene.pck. I can’t see the game accessing it at all, but why the hell would there be like ~600Kb of unused data in there? I tried decrypting it anyway using the normal script decrypt, but doesn’t work.

EDIT: Actually after a bit of checking, I’ve confused myself with the 0x2c table. I looked at the function table in Scene.pck, and then compared the headers with the scripts. In Scene.pck, you can see there’s 9 entries for the 0x1e file (which is aa_macro, they’re listed numerically by file number as archived, this is at 0x850e in Scene.pck btw), and if you check the aa_macro header, the 0x2c table has 9 entries. So are they imports or exports? I thought I checked that table and it was the one which is used to get the right function from Scene.pck… so that would make it imports? But why would aa_macro list 9 functions, with their locations, which then appear in Scene.pck, which are then accessed by other scripts? That would make them exports, but it’s using the same table! It’s not both imports and exports, that makes no sense at all. I’m all confused.

EDIT2: Ok it makes more sense now. The first table is simply variables. That’s why it has a data type, the data type is the type of the variable. Calls with 0x7f000000 are reading the variables from this table. Calls with 0x7e000000 are to functions in Scene.pck. Given that’s how that table works, I’m now assuming the 0x34/3c/44 tables in scripts are used for variables too, and 0x4c/54/5c are used for imports/external calls, so 0x2c would be the exports. That just leaves the 0x64/6c tables. If you look in the “extra achievement” and “extra mode” files (can’t use underscores >:) they’re named $i, $j, $temp, $str etc. So now I see there’s no way these aren’t variables. These must be local variables, and the 0x34 tables global variables.

If all of that is now correct, the only remaining issue is the last table in the script files, the one at 0x7c. What the balls is this guy.

5 Likes

It seems the repacking file for v1.10 still gives error.

It still works for me. What error are you getting?

Are you using the old scripts by any chance? The new files are the ones that end in -str.txt.

Edit: Oh wait, is the problem after you have repacked it? Due to the way the new tools work, without adding in the replacement lines, all of the current scripts are essentially empty.

Yeah the problem is after I repack it. Here is the error I’ve got: http://a.pomf.se/atqrkq.png
If the replacement lines are the problem, then how can I fix that? I don’t have any knowledge about programming. I hope provide screenshots. Thanks.

Oh wow, that’s my mistake, I apologize. I’ve reupdated ssdump: https://dl.dropboxusercontent.com/u/58805276/AngelBeats_1stBeat_Trial_Tools.zip

Original the tool did spit out blank lines, but I made a modification to keep them in there. I seemed to have reverted those changes back when I uploaded the tools previously.

Got a different error this time http://a.pomf.se/osjwot.png

Ok, yeah I get the same error. I had a look at the tools and it was calculating bad offsets in the header. I’ve patched up the tools and reuploaded them, see my previous post for the Dropbox link. I’ve done some testing with it and it should work.

1 Like

Yeah I’m definitely not going to do any more on the scripts. Just took a solid hour to try and decompile day01, and then it still broke so it wasn’t at the end. That’s waaaaaaay too long for me to want to bother with at all. Someone will need to make a nice quick one in C++ or similar.

I want opinions/advice on the phrasing of Otonashi’s ridiculous names. Coming up with English words that would make sense to English-only speakers is the biggest problem. I’m also not really sure how long I can make them; I haven’t tested the translation because I’ll mess something up.

音無
Otonashi

クソ坊主
Punk
(Stolen from the anime)

代理人
Substitute

微妙すぎるイケメン
Uncanny Hunk

ロリコン
Lolicon

メガネ仲間
Glasses Comrade

暗算日本記録保持者
Japanese record holder in mental arithmetic
(Needs to be shorter)

通り魔
Phantom Slasher
(Refers to either a traveling demon that causes disasters and misfortune, or a person who attacks people on the streets for no reason. Most of the responses lean towards the demon interpretation.)

記憶ナシ男
Amnesiac

音速
Sonic speed

無限
Infinite
(This and the above one are puns on Otonashi’s real name, pretty much impossible to translate that joke)

エロ侍
Ero Samurai

エロエロ団ナンバー1
Eroero Squad Number 1

ただのエロ少年
Just an ero boy

ユリブサイク

(I think it’s ゆり + 不細工 which means “Yuri Ugly”)

ドピュッシー

(I have no idea about this one)

アメリカンエロドッグ
Horndog

ゼウス
Zeus

日向markⅡ
Hinata MKⅡ

糞虫
Dung beetle

量産型日向
Mass-production Hinata

??
??

2 Likes

For 微妙すぎるイケメン, maybe you can translate the “ikemen” part as “hunk” or “stud”. “Bishie” if you want to sound like weeb :smiley:

For 通り魔, I guess the most appropriate is “passing demon” (literal translation) or if you go to the “random attacker” interpretation, then it should be translated as “Phantom Slasher”

For 記憶ナシ男, how about “Amnesiac Guy”

ドピュッシー is probably “Debussy”, that classical music composer. Except that the ‘b’ is replaced by p. So… “Depussy”? (lol that sounds wrong)

1 Like