Page 1 of 1

A New Beginning VIS/VC???/VS???

Posted: Fri Nov 26, 2010 9:55 pm
by Deniz Oezmen
Until the Wiki is up and running again, I thought I'd share some bits of information for A New Beginning here.


I. General information

A New Beginning is an adventure game based on the Visionaire engine. Luigi Auriemma already has a BMS to handle the basic format, as can be seen in this thread. However, there is still some interesting information to be retrieved by taking a closer look.


II. Relevant files

The interesting game files, which all share the same VIS format (despite their extensions) are these:
  • data.vis (the main archive)
  • characters\character.vc???
  • scenes\scene.vs???
Additionally, there are cutscene videos in videos\video.vv???, but these are just renamed OGV files.


III. File naming

The directory of the VIS archive format does not support storing the names of the files contained within the archive. However, the main archive data.vis contains exactly one file in XML format (type identifier 3), which servers as an entry point for the Visionaire engine. Beside other information, it contains the actual names of the files found in the VIS archives. The file names are always followed by a plaintext indicator telling the engine in which archive the file is located:

Code: Select all

path\filename.ext#x#nnn#kkkkk#
In this pattern, "x" is a single character that identifies the logical archive type. It is usually also found in the extension of the archive: "c" stands for "characters\character.vc???", "s" for "scenes\scene.vs???". The number "nnn" identifies the actual archive number ("???" in the previous examples), "kkkkk" is the running number within the archive structure.

Example:

Code: Select all

speech\de\standards\bent\Strd_Bent_22.ogg#c#068#00020#
The file "speech\de\standards\bent\Strd_Bent_22.ogg" is the 20th entry in the archive "characters\character.vc068".

There is one exception: The logical archive type "m" does not refer to an archive, but to one of the renamed videos:

Code: Select all

cutscenes\01-05\cutscene_01-05_02-02.ogv#m#026#00000#
The video "cutscenes\01-05\cutscene_01-05_02-02.ogv" can be found under the name "videos\video.vv026".


IV. Encryption

Aside from the encryption of the directory information in the VIS archives, an additional encryption is applied to the content of PNG files: The width and height information (8 successive bytes) in the IHDR structure are XOR-encrypted using a lower-case hexadecimal character string. The key is derived from the MD5 hash of the file name (without path and extension) in UTF-16 format.

Example: The image dimensions of the file "Chars\tuersteher\5004_Ohr_Knopf\Ohr_09.png" have been encrypted. The key are the first 8 characters of MD5(UTF-16("Ohr_09")) = 1a7d8961481e341504f3efB6e7f6231d, i.e. 1a7d8961.

(The correctness of the key can be verified by checking the CRC32 of the IHDR chunk after decryption. If everything else fails, it can also be brute-forced via the CRC in reasonable time using some sensible assumptions.)


V. Tools

A proof-of-concept unpacker/extractor for the VIS archives as found in A New Beginning (possibly also other games built with the Visionaire engine?), which considers the above points is my VISExt command-line application.


Best wishes,
Deniz

Re: A New Beginning VIS/VC???/VS???

Posted: Sat Nov 27, 2010 8:25 am
by bacter
Nice work, Deniz!
I especially liked your brilliant, png brute-force cracking idea!

Re: A New Beginning VIS/VC???/VS???

Posted: Sat Nov 27, 2010 7:19 pm
by Deniz Oezmen
Thanks, bacter. However, most of the credit goes to Luigi, since he had already published most of the VIS format description including the basic encryption algorithm. I just filled in the details mentioned above.

The brute-force method was originally necessary when I didn't yet know how the key for each file was generated. It should hopefully be obsolete by now. I wonder if the engine makers decided to implement this small "mangling" in order to thwart usage of generalized ripper programs ...

Re: A New Beginning VIS/VC???/VS???

Posted: Sun Nov 28, 2010 3:45 am
by stevenx
Can i ask a question? How to rip the subtitle files from the game?
And is there anyway to repack it back?

Re: A New Beginning VIS/VC???/VS???

Posted: Sun Nov 28, 2010 5:45 am
by bacter
The game texts are also stored inside that one huuuuuuge XML file inside the data.vis file.
The .XML reinserting to the .VIS is easy, but the tricky way is to edit that big (50 megabyte or so) file.

Re: A New Beginning VIS/VC???/VS???

Posted: Sun Nov 28, 2010 12:07 pm
by Deniz Oezmen
I was told that you could run the game from the extracted XML file as well, so repacking might not even be necessary. Try and edit config.ini in the game installation directory and have the "FILE" parameter point to your edited XML file instead of "data.vis".

I haven't tried this myself, so I'm not sure whether all the other resources have to be unpacked as well. If yes, you might have to edit the XML file to remove the archive designators (i.e. that "#x#nnn#kkkkk#" stuff).

Unfortunately for us, all identifiers in the XML file have been replaced by generic names (e.g. "T700", "T15", ...) during the compilation process, such that the Visionaire Editor will not load the file. Otherwise, one could use the Editor to modify the game. ;)

Re: A New Beginning VIS/VC???/VS???

Posted: Sun Nov 28, 2010 2:38 pm
by stevenx
I have another question.

For example:

in the xml the file name is
T257="speech\de\scenes\ch3\3012\3012_03_20_01.ogg#s#035#00016#"

The file extracted by VISExt.exe is:
\speech\de\scenes\ch3\3012\3012_03_20_01#s#035#00016#.ogg

if i want to run the game from the extracted XML file,
what i need to do is

1.edit the config.ini as you said.
2.edit the T257="speech\de\scenes\ch3\3012\3012_03_20_01.ogg#s#035#00016#"
to T257="speech\de\scenes\ch3\3012\3012_03_20_01.ogg"
3.rename the file \speech\de\scenes\ch3\3012\3012_03_20_01#s#035#00016#.ogg
to \speech\de\scenes\ch3\3012\3012_03_20_01.ogg

That's right?

Re: A New Beginning VIS/VC???/VS???

Posted: Sun Nov 28, 2010 8:24 pm
by Deniz Oezmen
In theory, yes. As I said, I didn't test it yet, but got this information from somebody else.

Note: I changed the VISExt application a bit, so that it extracts the files without the identifier by default, i.e. "speech\de\scenes\ch3\3012\3012_03_20_01.ogg" in the example above. If you want to recreate the old behaviour, use the switch "/unique".

Re: A New Beginning VIS/VC???/VS???

Posted: Mon Nov 29, 2010 12:54 am
by stevenx
Deniz Oezmen wrote:In theory, yes. As I said, I didn't test it yet, but got this information from somebody else.

Note: I changed the VISExt application a bit, so that it extracts the files without the identifier by default, i.e. "speech\de\scenes\ch3\3012\3012_03_20_01.ogg" in the example above. If you want to recreate the old behaviour, use the switch "/unique".
OK, thank you very much, i will take a try.

Re: A New Beginning VIS/VC???/VS???

Posted: Wed Jan 26, 2011 10:47 am
by matingsm
hi friends
One is the process for me to fully explain
thanks.very very thanks

Re: A New Beginning VIS/VC???/VS???

Posted: Tue Jun 12, 2012 8:09 pm
by strizek
Hello friends,

Have you a deal with font ? I need to replace some characters, but i find only some font characters in XML file (when i change them, then game has error)

Thanks

Re: A New Beginning VIS/VC???/VS???

Posted: Tue Jun 12, 2012 8:43 pm
by strizek
in data.vis in xls file are theese parts:

<T141 T12="Kaffeesatz" T13="8" T14="0" T249="!"#$%&&apos;()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€µÜÄÖüäöߊŽšž©™°ÀÁÂÆÇÈÉÊËÎÏÔŒÙÛŸàáâæçèéêëîïôœùûÿÌÍÒÓÚÑìíòóúñ«»¡¿юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪёЁĄĆĘŁŃÓŚŹŻąćęłńóśźż" T540="0" T250="-3" T634="T" T623="10" T635="500">
<T248 T12="" T32="-1" T7="Interface\fonts\interface.png#v#-01#02027#" T50="2">

From czech special characters working only ŠŽšž as seen in second line.... When i try to change it, game not working...

i look on bottom line: Interface\fonts\interface.png#v#-01#02027#" then file will be in DATA.VIS and will be 00002027.PNG ????

When i try to calc MD5 utf-16 checksum (word is interface) - then C9AF27F7 is on start. BUT PNG not working, after putting theese characters after IHDR word... Where i have problem ?

Thank you

Filip

Re: A New Beginning VIS/VC???/VS???

Posted: Fri Jul 13, 2012 11:57 pm
by Deniz Oezmen
I haven't done modifications to the game myself, so I probably can't help you there.

Regarding the encryption, however: You got the MD5 for this particular PNG file correctly. Now convert it to lower-case, i.e. to "c9af27f7". This is the key to encrypt or decrypt the 8 bytes after the IHDR marker. So you don't put it there all by itself, but you apply an XOR between each character of the key and the corresponding byte in the PNG header structure.

During unpacking, VISExt does the decryption for you. When unpacked, I would assume that it is not necessary to apply the encryption scheme to your modified PNG files, but I could be wrong there.