NFSAddons Forums

Main Menu

unvivtool - portable VIV decoder/encoder (NFS3-5)

Started by bfut, Dec 01, 2020, 3:59 PM

bfut

@meredich: Is NHL 2004 PS2 particular about the sequence the files are packed in VIV archives?

Meredich

Quote from: bfut on Jan 14, 2023,  2:05 PM
Gotcha, thanks. Next version will be able to decode and re-encode such files.
Thank you!

Meredich

Quote from: bfut on Jan 15, 2023,  3:24 PM
@meredich: Is NHL 2004 PS2 particular about the sequence the files are packed in VIV archives?
Yes

Meredich

Quote from: bfut on Jan 15, 2023,  3:24 PM
@meredich: Is NHL 2004 PS2 particular about the sequence the files are packed in VIV archives?
Hello! Is there any progress?


Meredich


pete9516

Hey bfut, there's another format of car.viv encryption i've found thanks to Zalcus20. You can find the car.viv's here if you are interested. It's the second to last post.
https://www.nfsaddons.com/forums/index.php?topic=2482.new#new

bfut

@meredich: Find a development version of unvivtool in the attachment. Compiled for Windows, source code included if you want to compile yourself.

I was able to decode the following:

FE%2FBG.VIV
FE%2FBOOT_ART.VIV
FE%2FCT_ART.VIV
FE%2FFE_ART.VIV
FE%2FFE_LOGOS.VIV
FE%2FGM_PORT.VIV
FE%2FOV_ART.VIV


Use the following command in your favorite terminal for the above files only, replacing the input file name. Note the required dot '.' at the end for output path.

path/to/unvivtool.exe d -fh -dnl 80 -we -v 'path/to/input.viv' .

What it means:

Command:
d             Decode and extract files from VIV/BIG archive

Options:
-fh           New feature: decode/encode Filenames to/from Hexadecimal/Base16 representation (the go-to option for all non-printable filenames)
-dnl 80       New feature: set fixed Directory eNtry Length to 80 bytes (only necessary for all the flagged NHL 2004 PS2 files. *irrelevant for Need For Speed*. I used a hex editor to determine this parameter)
-we           New feature: Write re-Encode command to path/to/input.viv.uvt (keep files in order) (creates a new file that contains a ready-to-go command to re-encode the archive with all the extracted files in the original order. *Note:* you cannot yet meaningfully re-encode these particular archives)
-v            Verbose


This version adds decoding support only. Please test whether it works for you and if the output files can be used. Please post output logs if you encounter failures. ta

tl;dr Need For Speed modders should not need these new features

edit: unvivtool 1.15 can be downloaded from GitHub

Meredich

#38
Right? I will try to open the image

Meredich

Apparently, additional decryption of the extracted files is needed. I can't find a palette for these. For comparison, the standard logo from the game

bfut

unvivtool.exe version 1.15 is now available from https://github.com/bfut/unvivtool

Changes:
+    De/Encoder: fully support non-printable filenames in archive (represent as Base16)
+    De/Encoder: set fixed directory entry length
+    CLI: decoder optionally writes re-encode command to path/to/input.viv.txt
+    Format: support BIGH, and BIG4 (experimental)

NB: Need For Speed: Underground 2 uses the BIG4 format.

bfut

Quote from: Meredich on Feb 08, 2023,  1:15 AM
Apparently, additional decryption of the extracted files is needed. I can't find a palette for these. For comparison, the standard logo from the game
It's a compressed file. Try fshtool ( https://people.math.harvard.edu/~auroux/software/index.html , first link from below) edit: These archives contain RefPack-compressed SSH / SHPS files. After decompression you will have SSH. FSHTool cannot handle SSH.

Thanks for the feedback! 1.15 now correctly represents the filenames in hexadecimal and most importantly adds encoding support.

Can you try re-encoding one of the VIV archives and report back if it is accepted by the game. No changes to the archived files, just re-encoded. (Explanation: The original archive has some null-byte padding between the contained files that is currently not re-created by the unvivtool encoder.) You would have to decode the archive again using version 1.15 because the filenames were incorrectly decoded by 1.14 and the re-encoding command was also missing vital information which is no longer an issue. Let me know. :)

Meredich

I don’t know if I’m collecting the archive correctly, but it says that it’s empty
____________________________
C:\Users\user>C:\Users\user\Desktop\decoder\unvivtool.exe e -fh -dnl 80 -we -v C:\Users\user\Desktop\decoder\FE_LOGOS.VIV C:\Users\user\Desktop\decoder\000
unvivtool 1.15 - Copyright (C) 2020-2023 Benjamin Futasz (GPLv3+)

Setting fixed directory entry length: 80 (0x50) (clamped to >= 10)

Creating archive: C:\Users\user\Desktop\decoder\FE_LOGOS.VIV
Number of files to encode = 1
Cannot open file. Skipping 'C:\Users\user\Desktop\decoder\000'
Buffer = 4096
Header Size = 16 (0x10)
Directory Entries = 0
Archive Size = 16 (0x10)
File format = BIGF
Warning:CheckVivDir: empty archive (0 files listed, 0 files found)
Encoder successful.


bfut

unvivtool.exe version 1.16 is now available from https://github.com/bfut/unvivtool

Changes:
+ De/Encoder: fully support non-printable filenames in archive (represent as Base16/hexadecimal) (option -fh)
+ De/Encoder: set fixed directory entry length (option -dnl #)
+ CLI: decoder optionally writes re-encode command to path/to/input.viv.txt (option -we)
+ Format: support BIGH, and BIG4 (experimental) (option -fmt)
# Fix: reported issues from version 1.15

NB: option -fh retains leading and embedded null bytes in filenames, including strings of length 1 (relevant for FE/BG.VIV NHL 2004 PS2)
NB2: The BIG4 format can be observed in at least 1 Need For Speed: Underground 2 archive.


@AJ_Lethal: Thanks for the mention of unvivtool on your website!

@meredich: Below you'll find a step-by-step guide for testing. As a general note, the encoder command works in that the path to every file that is to be encoded must be included (as opposed to the decoder where an output directory is given.) The reason is that the encoder will then be guaranteed to encode the files in the given order. Admittedly, this could be cumbersome for some 346 input files. The new -we option for the decoder takes care of that, in that for path/to/input.viv a new file path/to/input.viv.txt will be created, containing the full command to re-encode the full archive. Make sure to back-up the original archive, tho.

Guide:
1) Copy FE_ART.VIV and unvivtool.exe to the same folder, open a terminal and cd to that folder.
2) Create a new output folder tmp here.
3) Run the following command:unvivtool.exe d -fh -dnl 80 -we -v FE_ART.VIV tmp
4) The tmp folder holds the 346 files from the archive
5) FE_ART.VIV.txt can then be found in the working folder alongside the original archive. It should look similar to what is in the attachment. Run the full command from this file to re-encode all contents. As mentioned earlier, the only difference should be missing null-byte padding between archive contents.