PDA

View Full Version : Flyable Heart - extracting script


Ojamajo_LimePie
2010-05-11, 12:45
I'm trying to extract the script from Flyable Heart. I found a couple files which I think might contain the script of the game, but I was wondering how to extract them. I'll include them with this post.

http://www.mediafire.com/?z3yg20mtlm1

appztetra
2010-05-12, 03:42
How about Crass?

Hogan
2010-05-12, 04:54
The script, or part of it, is in text.dat:
If you open up text.dat in a hex editor (I'm using madEdit), you can see the script.

Dunno if the script.src is an archive file, or the command list, or anything else. Not my expertise unfortunately.

dsp2003
2010-05-12, 10:07
CRASS won't help. Quick glance at text.dat revealed the following structure:

Header:

12 bytes - header '$TEXT_LIST__'
8 bytes - count of text blocks

Text table:

? bytes - text block
0 byte - control byte, means that the block is terminated
4 bytes - number of text block

Yes, that's all. There's no string offsets nor sizes, which virtually makes it possible to translate the script via simple HEX editor. ^_^

script.src is obviously a bytecode, but I think you can skip it. Unfortunately, that's all I can tell without having a copy of this novel.

dsp2003
2010-05-12, 10:56
I wrote a small tool for decoding text.dat into an editable text script and re-encoding it back. Here it is, attached. Requires no .net components nor any runtimes, since it's a pure Object Pascal console application (uses SysUtils & Classes module).

How to convert:

dat -> txt : drag-n-drop the script file onto program's icon
txt -> dat : same as above. will create file with dat_new extension

How to edit & save:

1. Do NOT use MAC newline symbols, otherwise you'll screw up the converter
2. Do NOT add new lines, otherwise you'll screw it up

Enjoy.

P.S. Just checked the decode -> encode and compared CRC32 - 100% match. :3

Edit: the tool is defective. Removed. T_T

Unregistered
2010-05-12, 10:59
This was posted on /jp/ a while ago. Looks like they got it extracted already.

http://www.mediafire.com/?13gluijyj3d

Ojamajo_LimePie
2010-05-12, 17:29
Thanks a bunch!

dsp2003
2010-05-13, 01:33
This was posted on /jp/ a while ago. Looks like they got it extracted already.

http://www.mediafire.com/?13gluijyj3d
It's not "extracted", it's heavely damaged by trying to remove "bytecode" data with Notepad. Do not use it. -_-

Asceai
2010-05-13, 01:44
wwwwwww ä¹™/jp/

Ojamajo_LimePie
2010-05-13, 04:09
It's not "extracted", it's heavely damaged by trying to remove "bytecode" data with Notepad. Do not use it. -_-

Okay, I'll avoid that one.

Using Notepad to edit the file should be okay if I don't try and remove anything, though, right? That's what I usually edit in.

Unregistered
2010-05-13, 04:22
It's not "extracted", it's heavely damaged by trying to remove "bytecode" data with Notepad. Do not use it. -_-
No. It just has the line numbers replaced with 0x0D0A. Did you even look at it?

dsp2003
2010-05-13, 08:28
Did you even look at it?
Yeah. Unfortunately, you (or someone who's edited the script file) DID broke it, there's no false-accusations from my side. ^^' Here's why: you haven't transformed the header and number of lines into plain text (in order to avoid the damage of resaving with an text editor) and left zero byte at the end of file. Did you ever thought about how you'll put everything back?

Anonymous
2010-05-16, 19:17
Script extraction is complete, have fun translating:
http://flyabletrans.freewebhostx.com/transproj_ajax.PHP?proj=flyableheart

Unregistered
2010-05-19, 23:22
Anybody know how to unpack/repack files with the new .pac extension? Or do I have to wait for a hacked exe?

Unregistered
2010-05-20, 04:56
Anybody know how to unpack/repack files with the new .pac extension? Or do I have to wait for a hacked exe?

If you just want to test your edited script files in the game: some Anon posted tools for that on /jp/, somewhere in this thread: http://archive.easymodo.net/cgi-board.pl/jp/thread/5096685

He also said he'll take care of repacking, so you'd probably be best off following the FH threads on /jp/.

dsp2003
2010-05-20, 10:20
AnimED is capable of repacking SOFTPAL ADV SYSTEM archives since the v0.6.7.390 (2009.07.24), but it seems the Flyable Heart uses newer modification... never mind, implemented it in about 10 minutes. ^_^ For the archive creation, select SOFTPAL ADV SYSTEM PAC-32. The only difference between older PAC-16 is the length of filename field. :3

The DL link: http://wks.arai-kibou.ru/download/animed/core_2010_05_21.7z

P.S. Bad news: I was finally able to test my script reconverter with the VN itself, and unfortunately, the game crashes. It's not my fault though, it seems the first byte of text.dat is not the part of the header itself but rather an checksum(?), which is not possible to calculate without EXEcutable's reverse engineering.

Unregistered
2010-05-20, 11:55
it seems the first byte of text.dat is not the part of the header itself but rather an checksum

What makes you think so? If you check the other .dat files, it's the same for all of them.
Maybe you forgot to fix the offset values in the .src file?
Simply fixing them is easy and worked for me, but if you want to insert new lines instead of just changing the old ones you'll probably have to reverse most of the bytecode in script.src. The basic structure is very simple, but it's still quite some work.

dsp2003
2010-05-20, 12:16
Unregistered, I truly beg your pardon. Further debugging revealed that I didn't paid attention to script.src. More than that, I've found that text.dat itself is encrypted in the game (all this time I only had access to the zipped script file uploaded at the first post of this topic, which wasn't). Yeah-yeah, shame on me... -_-

The archive repacker works for non-modified files though, since the extraction and "compression" are utilising raw mode (i.e. with no encode\decode).

Unregistered
2010-05-20, 15:15
AnimED is capable of repacking SOFTPAL ADV SYSTEM archives since the v0.6.7.390 (2009.07.24), but it seems the Flyable Heart uses newer modification... never mind, implemented it in about 10 minutes. ^_^ For the archive creation, select SOFTPAL ADV SYSTEM PAC-32. The only difference between older PAC-16 is the length of filename field. :3

The DL link: http://wks.arai-kibou.ru/download/animed/core_2010_05_21.7z

P.S. Bad news: I was finally able to test my script reconverter with the VN itself, and unfortunately, the game crashes. It's not my fault though, it seems the first byte of text.dat is not the part of the header itself but rather an checksum(?), which is not possible to calculate without EXEcutable's reverse engineering.

Thank you. I think the repacker is quite enough. Good luck on debugging the text tool!

If you just want to test your edited script files in the game: some Anon posted tools for that on /jp/, somewhere in this thread: http://archive.easymodo.net/cgi-boar...thread/5096685

He also said he'll take care of repacking, so you'd probably be best off following the FH threads on /jp/.

That would be helpful if I wanted to translate the full game. I wanted to translate the trial though. [Less text, no apparent choices...]

Unregistered
2010-05-20, 15:26
Unregistered, I truly beg your pardon. Further debugging revealed that I didn't paid attention to script.src. More than that, I've found that text.dat itself is encrypted in the game (all this time I only had access to the zipped script file uploaded at the first post of this topic, which wasn't). Yeah-yeah, shame on me... -_-

Oops, found out too late...

Vivio
2010-05-20, 16:46
This is getting too confusing. I'm making an account.
More than that, I've found that text.dat itself is encrypted in the game (all this time I only had access to the zipped script file uploaded at the first post of this topic, which wasn't).

I checked out the encryption. It's a simple 4-byte XOR cipher with some initial rotations.

1) Take the first 4 byte block (after the 16 byte .dat header).
2) ROL the first byte of that block (x+3) times, where x is the block number. That means you ROL the first byte in the first block 4 times and the first byte in the second block 5 times, and so on. When you reach 255 ROLs, start at 0 again (0, not 4!).
3) XOR each block with 0x9D85D5F7.

That's all. All .dat's are encrypted that way.

EDIT: I made something to take care of that.

http://www.mediafire.com/?0emdymmw21j

Syntax: fhcrypt.exe input.dat output.dat
This script will automatically determine if decryption or encryption is needed. Source code is included.

ムム
2010-05-21, 17:27
I checked out the encryption. It's a simple 4-byte XOR cipher with some initial rotations.

1) Take the first 4 byte block (after the 16 byte .dat header).
2) ROL the first byte of that block (x+3) times, where x is the block number. That means you ROL the first byte in the first block 4 times and the first byte in the second block 5 times, and so on. When you reach 255 ROLs, start at 0 again (0, not 4!).
3) XOR each block with 0x9D85D5F7.

That's all. All .dat's are encrypted that way.

EDIT: I made something to take care of that.

http://www.mediafire.com/?0emdymmw21j

Syntax: fhcrypt.exe input.dat output.dat
This script will automatically determine if decryption or encryption is needed. Source code is included.

I'm not a genius at using this kind of programs, so would any spare their time to guide me on using this?

ムム
2010-05-22, 04:51
I'm not a genius at using this kind of programs, so would any spare their time to guide me on using this?

Nevermind, found out.

Though apparently editing the lines and testing them results in either messed up text or none at all, and/or crashing. Will tinker around with the files again~.