PAC Format
About
An archive format. Everything except for the opening movies and mecha battle data and fonts are stored in these files. Seem to be PAC<00>, PACw and PACW(?) types. The normal pacs seem to use PACw while the update.pac uses PAC<00>.
PACw Header Format:
DWORD - 'PACw' DWORD - number of files in the pack DWORD - type of compression (0: uncompressed, 1:LZ32, 2:LZW/Huffy?, 3:zlib DEFLATE?)
This is followed by a table of file descriptors.
Each file descriptor (total 42 bytes each):
64*CHAR - Filename DWORD - Offset in .PAC file DWORD - Decompressed size DWORD - Compressed size
BIN Format
About
Script format. Consists of a header, followed by some sort of DWORD table and then the actual script
Header Format:
DWORD - Zero DWORD - Zero DWORD - Number of DWORD table entries DWORD - Number of bytes in the actual script file
Table Format: (maybe this is variable space, with initial values?)
N*DWORD - Often -1 or 0
Script Format:
opcodes seem to be 16bit
arguments tend to be 32bit
strings are null-terminated
Opcode List (sequential byte order (Big-endian)):
0200 - Has a DWORD argument of either 0 or -1, used to finish up a script
0500 - 1 DWORD argument, more arguments?
0600 - 1 DWORD argument, more arguments?
0800 - Has a DWORD argument of -1, used to finish up a function call
0B00 - Has 1 DWORD argument N, and pushes the following N bytes as a string onto the stack
0C00 - Has 1 DWORD argument to push value onto stack
0D00 - 1 DWORD argument, unknown argument?
0F00 - 1 DWORD argument, unknown, used before 0800 in function termination with -1
1F00 - 1 DWORD argument, more arguments?
xx04 - Function call, 1 DWORD argument containing number of arguments the function call has
Script Text Format:
Null terminated text
@rfurigana@kanji@ will raise the 'furigana' above the 'kanji'
@f1A0122 shows Tohru's face
@f1C0110 shows someone else's face
@v100153 plays a voice file 100153.wav from the pacs
Function Calls (arguments listed in reverse push order):
5304 - Display text (used in boxed text and narrative text)
STRING - The text to show
DWORD - The color for the text (0=Tohru, 2=Ayane, 19=Default)
DWORD - Unknown
Sample Function Call:
fn53('Tohru blah blah',2,0)
becomes
0C 00 00 00 00 00 0C 00 02 00 00 00 0B 00 10 00 00 00 T o h r u b l a h b l a h 00 53 04 03 00 00 00 08 00 FF FF FF FF