NFSAddons Forums

Need For Speed Forums => General NFS => Topic started by: bfut on Dec 01, 2020, 3:59 PM

Title: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Dec 01, 2020, 3:59 PM
Download unvivtool.exe CLI for Windows:
https://github.com/bfut/unvivtool/releases

Python module & unvivtool CLI for Linux:
https://github.com/bfut/unvivtool

unvivtool extracts and creates VIV archives. It is available as a command-line interface, and as a Python module. Developed for Windows and Linux.

Features:

*    decodes an entire archive at once or retrieves a single file either by index or by filename
*    optionally lists archive contents without writing to disk
*    numerous format checks
*    low peak memory usage

Extensive documentation can be found in the GitHub repo.

(https://i.imgur.com/CubLo2a.png)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: MADMAN_nfs on Dec 02, 2020, 6:55 AM
Hey bfut,

welcome to the forum  :)
Nice utility that does what it says. Meant to be executed right at file location.
Do you intend further improving the utility?
I noticed, using full file-paths with spaces, special characters or vowel mutation in the command string, will result in error.
Functionality for execution by filetype (using "*.viv" for example) would be neat too, at the moment you always have to give the exact file name.

Greetings
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Dec 02, 2020, 1:58 PM
Quote from: MADMAN_nfs on Dec 02, 2020,  6:55 AM
Hey bfut,

welcome to the forum  :)
Nice utility that does what it says. Meant to be executed right at file location.
Do you intend further improving the utility?
I noticed, using full file-paths with spaces, special characters or vowel mutation in the command string, will result in error.
Functionality for execution by filetype (using "*.viv" for example) would be neat too, at the moment you always have to give the exact file name.

Greetings

Thanks for the feedback! Love to be here. :)

Hmm, I cannot reproduce your issue. Which OS are you on? Can you post steps to reproduce?

Paths with spaces have to be enclosed with double quotes (") on Windows, either single (') or double quotes in bash.
I will usually just drag files into the terminal window to get full paths already in quotes.

The program executes for one VIV archive at a time. For wildcards / batch execution, I recommend using batch scripts. Examples are provided in the batch folder in the repo.

When decoding (extracting an archive), unvivtool extracts into the the same directory by default. It is possible to specify a custom output path as argument. The UNIX standard "." shortcut for current working directory is accepted, too.

Any issues, questions or feedback, definitely keep it coming. :)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: MADMAN_nfs on Dec 03, 2020, 11:28 AM
Uh, yeah running Windows! Tested the tool on Win7 64bit.
So i cannot verify your Linux-scripts (.sh files).

Executing the tool inside the directory works perfectly fine.
unvivtool d car.viv
or
unvivtool d car.viv car


But that means you need to copy files from a to b everytime... or maybe my train of thoughts is wrong here?
Also paths without spaces work:
C:\unviv>unvivtool d -o C:\unviv\car.viv C:\unviv\car\
=======================================================================
unvivtool 1.0 - Copyright (C) 2020 Benjamin Futasz (GPLv3) - 2020-11-24

Archive: C:\unviv\car.viv
Extracting to: C:\unviv\car\
Decoder successful.


Using full paths (via .bat-file or cmd.exe) with single quotes (') or double quotes (") gives me an error, tho.
C:\unviv>unvivtool d -o C:\unviv\car.viv "C:\unviv\car\" #Just an example, these quotes aren't neccessary here
=======================================================================
unvivtool 1.0 - Copyright (C) 2020 Benjamin Futasz (GPLv3) - 2020-11-24

Archive: C:\unviv\car.viv
Extracting to: C:\unviv\car"
Not enough memory
Decoder failed.


Greetings
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Dec 03, 2020, 1:33 PM
Thanks! The tool is supposed to run from anywhere, as full input and output paths may be passed as arguments, though this is of course at the user's discretion. So, I can't test on Windows 7 myself, and Extended support fir most versions of Windows 7 ended on January 14, 2020 (https://en.wikipedia.org/wiki/Windows_7#Support_lifecycle).

That said, the error here is "Not enough memory.", which means memory allocation fails.

Can you run the working variant with the "-p -strict" options and post the output here? "-p" lists archive contents and additional info. "-strict" enforces the VIV format specs a bit more.

Afterwards, can you see if this still happens with today's version? This one fixes a potential crash.
https://github.com/bfut/unvivtool/releases


edit: Your feedback has already been very helpful.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Dec 05, 2020, 8:28 PM
New version is up. Added several new format checks, and stability improvements. New batch script example, too. Feedback appreciated. Enjoy.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: MADMAN_nfs on Dec 06, 2020, 5:05 PM
Hello,
i've ran a test with the new version (unvivtool10+dev201206-win32.zip) on Win10 64bit.
I noticed you restricted the output to a subdirectory of the input path, so output command can only be a folder name
(message "must only contain the following characters 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").

The application path now working fine with single quotes (') or double quotes (") and spaces.
C:\un viv>unvivtool d -o "C:\un viv\car.viv" "car extracted"
=================================================================================
unvivtool 1.0+dev201206 - Copyright (C) 2020 Benjamin Futasz (GPLv3) - 2020-12-06

Archive: C:\un viv\car.viv
Extracting to: car extracted
Archive Size (parsed) = 10530811
Directory Entries (header) = 24
Decoder successful.

Extraction works fast and flawless so far, tested different archives from NFS2 (cardata.viv), NFS3, NFS4 and NFS6. (https://nfsaddons.com/inc/images/emojis/thumbsup.png)

Just have to point out the issue with special characters and vowel mutation again, used in many regions, thus appearing in filepaths probably.
C:\ün viv>unvivtool d -o "C:\├╝n viv\car.viv" "car extracted"     #filepath with "ü" instead of "u" results in error
=================================================================================
unvivtool 1.0+dev201206 - Copyright (C) 2020 Benjamin Futasz (GPLv3) - 2020-12-06

Archive: C:\++n viv\car.viv
Extracting to: car extracted
File 'C:\++n viv\car.viv' not found
Decoder failed.

Maybe you can define/implement a different character set (Unicode, ANSI etc.) with the application (not to mention russian, arabic or chinese)?
Dunno how much of a hassle it is, to make the program "multilanguage"?  :)

Furthermore, the encoding side still seems a little cumbersome, again requiring to place unvivtool.exe inside execution-path... if i understand correctly.
Wouldn't it be more convenient to give a folder or path, packing all files inside into the viv-file?

Greetings
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Dec 07, 2020, 2:51 PM
Quote from: MADMAN_nfs on Dec 06, 2020,  5:05 PM
Furthermore, the encoding side still seems a little cumbersome, again requiring to place unvivtool.exe inside execution-path... if i understand correctly.
This is addressed in documentation.

Very strong words coming from an anonymous account. Can't win 'em all, I guess.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: MADMAN_nfs on Dec 07, 2020, 3:49 PM
Hey,
not sure what documentation you are referring to? The readme only adresses general "encoding syntax" and one example:
unvivtool e [<options>...] <output.viv> [<input_files>...]
EXAMPLE 4
      unvivtool e CAR.VIV car.fce car00.tga carp.txt fedata.fsh fedata.eng


How to create a viv-file, without having the unvivtool.exe in that directory? Could you give an example?

Quote from: bfut on Dec 07, 2020,  2:51 PM
[...] Very strong words coming from an anonymous account. Can't win 'em all, I guess.
I do not understand this, what are we talking about?

Greetings
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 23, 2021, 8:55 AM
Specific Unicode filepath support on the Windows platform has not been a project goal. Thank you for contributing.  :)

A new version is up. Now also available as a Python extension module. :)
That makes it easier to input multiple paths. ;)

Download unvivtool.exe for Windows: https://github.com/bfut/unvivtool/releases

Everything else: https://github.com/bfut/unvivtool
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Mar 02, 2021, 1:36 PM
New version is up. I implemented CI on the great Github Actions, and promptly found a few things to improve.

The Python version now comes with extensive documentation & walkthrough examples, including a ready-to-go example.py script. Enjoy. :D
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Mar 06, 2021, 3:12 PM
Quote from: MADMAN_nfs on Dec 06, 2020,  5:05 PM
Just have to point out the issue with special characters and vowel mutation again, used in many regions, thus appearing in filepaths probably.
C:\ün viv>unvivtool d -o "C:\├╝n viv\car.viv" "car extracted"     #filepath with "ü" instead of "u" results in error
...

Maybe you can define/implement a different character set (Unicode, ANSI etc.) with the application (not to mention russian, arabic or chinese)?
Dunno how much of a hassle it is, to make the program "multilanguage"?  :)

I looked at this and it turns out that Windows 10 actually supports UTF-8 encoded strings out of the box these days. On my Win 10 machine, I was able to open paths that contain e.g. CJK, and Cyrillic characters (and also random blanks), using unvivtool version 1.5, both CLI and Python module. Linux supports this anyway.

If this doesn't work on your Win10 system yet, some system properties may have to be set. Your feedback has been quite valuable, btw.

edit: also works with Python.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Jun 05, 2022, 5:16 AM
Guys, what am i doing wrong? I have Windows 7 64bit version
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Jun 22, 2022, 7:05 AM
Sorry for the late reply.

That output directory does not exist yet, presumably. Hence the program
ends on trying to change to a (not existing) directory. Alas, that error message
does not hint at that at all. Will be fixed, thx!

The easiest route is to extract to your current working directory
unvivtool d car.viv .


Or, first create an output directory, then run unvivtool.

mkdir mynewdirectory
unvivtool d car.viv mynewdirectory
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Aug 11, 2022, 2:58 AM
32-bit unvivtool.exe version 1.9 is now available from https://github.com/bfut/unvivtool

Changes:
* improved stability and usability
* documentation clarifies that paths must exist

If anyone is using unvivtool.exe on a system pre-Win 7, such as XP, 2k or even Win98, I'd love to hear your feedback. Legacy Windows systems are the main reason why this exists as an executable instead of a simple script. :)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Sep 10, 2022, 5:00 AM
Quote from: pete9516 on Sep 06, 2022,  5:43 AM
I was just trying to use example 2:
EXAMPLE 2
   unvivtool d car.viv .

      decodes and extracts all files from archive 'car.viv' to current working
      directory

But this doesn't work at all. All it does is this:

Your command is missing the path/to/existing_folder

Notice the dot at the end, which is a common shortcut for "current working directory" (cwd). :)

unvivtool d car.viv .
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Sep 10, 2022, 5:11 AM
Re-posted from another topic because the request clearly pertains to unvivtool.

Quote from: pete9516 on Sep 05, 2022,  1:53 AM
Quote from: bfut on Sep 02, 2022,  5:05 AM
Quote from: pete9516 on Aug 28, 2022,  2:47 AM
Quote from: bfut on Aug 27, 2022,  1:15 AM
News:
* improved stability: robust handling of manipulated / invalid FCE data
Just that you mentioned manipulated/invalid .fce data. There are quite many car.viv's that were hex edited back in the day. Can your unvivtool handle those kind of viv's? I couldn't try it out yet since the use of this program is very complicated to usual users.

1) Complicated in which sense? Are you on Windows? I'm constantly testing on Windows10, but Linux is recommended, because Python module installation is so much easier. Give WSL a try, if on a Windows machine.

2) Yes, that type of manipulation is one target. I specifically remember CPD manipulating his VIV archives (see unvivtool for that), and possibly even the FCEs. My go-to test file is CPD's Porsche 962. I'd be interested in any VIV or FCE that cannot be opened and/or fully parsed by either, unvivtool or fcecodec.

fcecodec is required to fully handle all valid FCE data. fcecodec (and unvivtool, for that matter) is designed in a way to recover as much information as possible until encountering faulty information within an invalid file. Nomenclatura: invalid = Need For Speed cannot handle it, valid = Need For Speed does handle the file. Those manipulated files of old were in fact valid in this sense, because they could be played in the games; but some tools of the day crashed. Contrary to that, crashes are not supposed to happen with my tools either way.

I have yet to encounter either FCE or VIV that cannot be opened by my tools, but would work in the games.

What information do you believe is missing from [...] documentation?
Do you have examples of manipulated files?
Well i think that those tools would be very simple in a way that where you drag'n'drop the car.viv onto the .exe file, it will get exported in the same folder. Maybe this kind of feature is too hard to code, but i know it's possible. For usual people like me it's a pain in the ass to open cmd.exe and type the whole stuff. And i know how to copy'n'paste paths in cmd.exe. But still it would be way more pleaserable to just drag & drop the car.viv onto the .exe. And yes there is one car.viv i have which i don't know any tool that can export the inner data out of it. And it's drivable in the game. Here's the link to it:
https://drive.google.com/file/d/1opmNuVo4sXjrs-pn8xdRh6bA0ifkSQhJ/view?usp=sharing

Quote from: pete9516 on Sep 06, 2022,  5:48 AM
And this is the error message when i do it the more complicated way, which finally works, but the car.viv is just too screwed.

Thanks! Fixing for next unvivtool update.

Both, VIV and FCE are indeed manipulated. fcecodec opens car.fce anyway. ;) Who is the author, if you don't mind me asking?
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Sep 10, 2022, 8:32 AM
Quote from: bfut on Sep 10, 2022,  5:00 AM
Quote from: pete9516 on Sep 06, 2022,  5:43 AM
I was just trying to use example 2:
EXAMPLE 2
   unvivtool d car.viv .

      decodes and extracts all files from archive 'car.viv' to current working
      directory

But this doesn't work at all. All it does is this:

Your command is missing the path/to/existing_folder

Notice the dot at the end, which is a common shortcut for "current working directory" (cwd). :)

unvivtool d car.viv .
Oh i'm sorry about this. I never knew this shortcut function. Thanks for the information
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Sep 10, 2022, 8:36 AM
Quote from: bfut on Sep 10, 2022,  5:11 AM
Re-posted from another topic because the request clearly pertains to unvivtool.

Quote from: pete9516 on Sep 05, 2022,  1:53 AM
Quote from: bfut on Sep 02, 2022,  5:05 AM
Quote from: pete9516 on Aug 28, 2022,  2:47 AM
Quote from: bfut on Aug 27, 2022,  1:15 AM
News:
* improved stability: robust handling of manipulated / invalid FCE data
Just that you mentioned manipulated/invalid .fce data. There are quite many car.viv's that were hex edited back in the day. Can your unvivtool handle those kind of viv's? I couldn't try it out yet since the use of this program is very complicated to usual users.

1) Complicated in which sense? Are you on Windows? I'm constantly testing on Windows10, but Linux is recommended, because Python module installation is so much easier. Give WSL a try, if on a Windows machine.

2) Yes, that type of manipulation is one target. I specifically remember CPD manipulating his VIV archives (see unvivtool for that), and possibly even the FCEs. My go-to test file is CPD's Porsche 962. I'd be interested in any VIV or FCE that cannot be opened and/or fully parsed by either, unvivtool or fcecodec.

fcecodec is required to fully handle all valid FCE data. fcecodec (and unvivtool, for that matter) is designed in a way to recover as much information as possible until encountering faulty information within an invalid file. Nomenclatura: invalid = Need For Speed cannot handle it, valid = Need For Speed does handle the file. Those manipulated files of old were in fact valid in this sense, because they could be played in the games; but some tools of the day crashed. Contrary to that, crashes are not supposed to happen with my tools either way.

I have yet to encounter either FCE or VIV that cannot be opened by my tools, but would work in the games.

What information do you believe is missing from [...] documentation?
Do you have examples of manipulated files?
Well i think that those tools would be very simple in a way that where you drag'n'drop the car.viv onto the .exe file, it will get exported in the same folder. Maybe this kind of feature is too hard to code, but i know it's possible. For usual people like me it's a pain in the ass to open cmd.exe and type the whole stuff. And i know how to copy'n'paste paths in cmd.exe. But still it would be way more pleaserable to just drag & drop the car.viv onto the .exe. And yes there is one car.viv i have which i don't know any tool that can export the inner data out of it. And it's drivable in the game. Here's the link to it:
https://drive.google.com/file/d/1opmNuVo4sXjrs-pn8xdRh6bA0ifkSQhJ/view?usp=sharing

Quote from: pete9516 on Sep 06, 2022,  5:48 AM
And this is the error message when i do it the more complicated way, which finally works, but the car.viv is just too screwed.

Thanks! Fixing for next unvivtool update.

Both, VIV and FCE are indeed manipulated. fcecodec opens car.fce anyway. ;) Who is the author, if you don't mind me asking?
Well, that's the big problem. I once saved this single car.viv in the tool folder for experimenting with it. I somewhere have it probably with a readme though in my car archive, but i'll need to search for it.
But how can your fcecodec handle car.fce's inside a locked car.viv? Were you able to extract the contents of the car.viv? If yes, please let me know! :d I want to change the class xD It should be in class B, not AA lol.
btw you can clearly see how selfish the author is when you drive the car with interior camera.. ^^ But i have to say the author has made a really good job on the model and the car performance
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Sep 11, 2022, 8:52 AM
unvivtool.exe version 1.11 is now available from https://github.com/bfut/unvivtool

Changes:
+    support UTF8-filenames in VIV archives (e.g., CJK)
+    improved decoder (better support for manipulated or "locked" archives)
+    improved usability: on Windows, drag-and-drop archives on executable for easy decoding
+    improved stability



edit: a disclaimer on the drag-and-drop feature. if it fails, you won't get statistics or possible error messages. in these instances, it's still worth to investigate using a terminal. the same holds true for every oldschool command-line tool ofc :)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Sep 15, 2022, 6:49 AM
Quote from: bfut on Sep 11, 2022,  8:52 AM
unvivtool.exe version 1.11 is now available from https://github.com/bfut/unvivtool

Changes:
+    support UTF8-filenames in VIV archives (e.g., CJK)
+    improved decoder (better support for manipulated or "locked" archives)
+    improved usability: on Windows, drag-and-drop archives on executable for easy decoding
+    improved stability



edit: a disclaimer on the drag-and-drop feature. if it fails, you won't get statistics or possible error messages. in these instances, it's still worth to investigate using a terminal. the same holds true for every oldschool command-line tool ofc :)
OMG :D This is now my number 1 tool for unpacking car.viv's. I'm glad you could find out how to debug that Civic's car.viv. I'm still searching for the author
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Paul Spain on Sep 15, 2022, 6:59 AM
So will this allow us to extract the models from NFS HotPursuit 2 and up? So many of Robin's stuff I'd like to see if I can convert to HighStakes and give Veg's Patch a good work out.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Sep 15, 2022, 7:08 AM
Quote from: Paul Spain on Sep 15, 2022,  6:59 AM
So will this allow us to extract the models from NFS HotPursuit 2 and up? So many of Robin's stuff I'd like to see if I can convert to HighStakes and give Veg's Patch a good work out.
I just tried out to export a HP2 car.viv (standard one) and it seems to work. Put me out 8 files:
car.fsh
car.o
carM.o
carRigid.o
carRigidM.o
damage.fsh
shadow.o
skeleton.o

But besides of that there's vivmagic for HP2 right?
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Sep 16, 2022, 11:37 AM
The VIV format, internally BIGF, is the same over a wide range of EA games: NFS2 and later, C&C games, some NBA games, etc. File extensions vary, usually .viv or .big
All of these games were modded and each scene created their own BIGF decoders/encoders, respectively. Unfortunately, most of them are closed-source, i.e., not portable and bugs unfixable, or have heavy dependencies on GUI frameworks.

Hence unvivtool as a lightweight, FOSS, portable option.

Thanks for the feedback.

Quote from: pete9516 on Sep 10, 2022,  8:36 AMBut how can your fcecodec handle car.fce's inside a locked car.viv?

unvivtool extracts and creates VIV archives. fcecodec decodes, encodes, and operates on FCE data, for NFS3, NFS4 and MCO, respectively. The tools work independently of each other. Frankly, it's all I use these days.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Jan 06, 2023, 4:28 AM
Quote from: bfut on Sep 16, 2022, 11:37 AM
The VIV format, internally BIGF, is the same over a wide range of EA games: NFS2 and later, C&C games, some NBA games, etc. File extensions vary, usually .viv or .big
All of these games were modded and each scene created their own BIGF decoders/encoders, respectively. Unfortunately, most of them are closed-source, i.e., not portable and bugs unfixable, or have heavy dependencies on GUI frameworks.

Hence unvivtool as a lightweight, FOSS, portable option.

Thanks for the feedback.

Quote from: pete9516 on Sep 10, 2022,  8:36 AMBut how can your fcecodec handle car.fce's inside a locked car.viv?

unvivtool extracts and creates VIV archives. fcecodec decodes, encodes, and operates on FCE data, for NFS3, NFS4 and MCO, respectively. The tools work independently of each other. Frankly, it's all I use these days.
Hey! Help open the game archive from NHL2004 PS2 FE_LOGOS.viv. Please!
Quote from: bfut on Feb 23, 2021,  8:55 AM
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Jan 12, 2023, 2:35 AM
I've taken a look at the file. I can't promise a time, but I'll try to get back to you. In the meantime, are there any online ressources on NHL 2004, website, modded files, etc.? I have zero modding knowledge outside of early NFS. ta
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Jan 12, 2023, 3:49 PM
Quote from: Meredich on Jan 06, 2023,  4:28 AMHey! Help open the game archive from NHL2004 PS2 FE_LOGOS.viv. Please!
The good news The posted file is an uncompressed BIGF (alias .big / .viv) file. At least the first couple contained files have format SHPS (i.e., FSH) but each file seems to have a prefix of 6 bytes in length.

The bad news The FE_LOGOS.VIV directory has a quirk: each listed filename has a prefix of 4 bytes in length. The prefix as a whole is in general not made up of printable characters.

The way my tool is designed, it looks for printable characters where the filename is expected in the VIV directory. If unprintable stuff is detected, parsing stops. Because the very first directory entry has unprintable bytes where unvivtool expects the filename, you get the output from above that 0 files are listed in the directory.

This quirk does not occurs in PC-versions of Need For Speed 3-5. I can amend unvivtool to handle this situation, but you would have to convince me that it's worth my time. :)

Specifically, I'd want answers to these: How many games/files have this BIGF-quirk? What type of information iscontained in this 4 byte prefix? Do you want to extract only or also modify/create this file?

Hope this helps. :)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Jan 13, 2023, 10:50 PM
Quote from: bfut on Jan 12, 2023,  3:49 PM
Quote from: Meredich on Jan 06, 2023,  4:28 AMHey! Help open the game archive from NHL2004 PS2 FE_LOGOS.viv. Please!
The good news The posted file is an uncompressed BIGF (alias .big / .viv) file. At least the first couple contained files have format SHPS (i.e., FSH) but each file seems to have a prefix of 6 bytes in length.

The bad news The FE_LOGOS.VIV directory has a quirk: each listed filename has a prefix of 4 bytes in length. The prefix as a whole is in general not made up of printable characters.

The way my tool is designed, it looks for printable characters where the filename is expected in the VIV directory. If unprintable stuff is detected, parsing stops. Because the very first directory entry has unprintable bytes where unvivtool expects the filename, you get the output from above that 0 files are listed in the directory.

This quirk does not occurs in PC-versions of Need For Speed 3-5. I can amend unvivtool to handle this situation, but you would have to convince me that it's worth my time. :)

Specifically, I'd want answers to these: How many games/files have this BIGF-quirk? What type of information iscontained in this 4 byte prefix? Do you want to extract only or also modify/create this file?

Hope this helps. :)
Good afternoon! This archive contains the icons of the NHL teams in the main menu of the game. At the moment, I have replaced all teams with new uniforms and icons in the match, since there are no such problems with them as with this archive.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Jan 13, 2023, 11:01 PM
Quote from: bfut on Jan 12, 2023,  3:49 PM
Specifically, I'd want answers to these: How many games/files have this BIGF-quirk? What type of information iscontained in this 4 byte prefix? Do you want to extract only or also modify/create this file?

Hope this helps. :)
This archive contains 170 team logos, because there are only 170 of them in the game in other places. I would like to not just unpack it, but then pack the changed files back. I select the palette in SSH through the HEX editor and Console Texture Explorer. Here is an example on a player photo.
A total of 7 game archives are collected in this way and cannot be opened. Here they are:
FE/BG.VIV
FE/BOOT_ART.VIV
FE/CT_ART.VIV
FE/FE_ART.VIV
FE/FE_LOGOS.VIV
FE/GM_PORT.VIV
FE/OV_ART.VIV
All the rest are opened with standard tools, such as BigGUI.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Jan 14, 2023, 2:05 PM
Gotcha, thanks. Next version will be able to decode and re-encode such files.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Jan 15, 2023, 3:24 PM
@meredich: Is NHL 2004 PS2 particular about the sequence the files are packed in VIV archives?
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Jan 15, 2023, 11:49 PM
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!
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Jan 15, 2023, 11:51 PM
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
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Jan 25, 2023, 11:10 PM
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?
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 01, 2023, 8:02 PM
You can add https://github.com/bfut/unvivtool to a GitHub watchlist. Any progress will show up there first. Thanks for your interest!
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Feb 02, 2023, 2:16 AM
Understood. Thank you! :)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Feb 02, 2023, 1:30 PM
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
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 05, 2023, 11:45 AM
@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
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Feb 07, 2023, 9:33 AM
Right? I will try to open the image
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: 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
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 08, 2023, 7:15 AM
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.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 08, 2023, 7:18 AM
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. :)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Feb 09, 2023, 12:27 AM
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.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 09, 2023, 10:01 AM
Thanks, can reproduce. Fixing in next version.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 11, 2023, 7:14 AM
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.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Feb 13, 2023, 8:02 AM
@meredich:

1. I decoded all of these special archives. I superficially checked and most if not all contained files seem to be in the SSH / SHPS format (which is similar to FSH / SHPI). But they are all compressed using RefPack. I googled for a minute and there are tools that can deal with that. Good luck. (In the attachment is a tool that can decompress Refpack, unrefpack)

2. Nevertheless, if you have the time, I'm really interested if a decoded and then re-encoded FE_ART.VIV is accepted by the game, using the step-by-step guide from my earlier post for unvivtool 1.16. If you can report on that, that would be helpful. Thanks in advance. :)
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: Meredich on Feb 13, 2023, 11:47 AM
Thank you. A little later I'll try to do everything according to the instructions
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Mar 31, 2024, 6:03 AM
unvivtool117_cli_win32.zip is now available from https://github.com/bfut/unvivtool/releases/tag/1.17

Changes:
+    CLI: Windows 98 compatibility
+    Decoder: improved utf8 support

Functional update. Even under Win98 it is now possible to extract VIV archives that contain files with CJK, Cyrillic, etc. characters.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Apr 03, 2024, 4:09 PM
Quote from: bfut on Mar 31, 2024,  6:03 AM
unvivtool117_cli_win32.zip is now available from https://github.com/bfut/unvivtool/releases/tag/1.17

Changes:
+    CLI: Windows 98 compatibility
+    Decoder: improved utf8 support

Functional update. Even under Win98 it is now possible to extract VIV archives that contain files with CJK, Cyrillic, etc. characters.
Nice update.
By the way, can you have a look at this car.viv? It seems your tool can't handle it
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Apr 05, 2024, 7:46 AM
Got it, thanks. Manipulated file.

Do you also use unvivtool to create archives? Since you requested the drag-and-drop mode, I wondered whether you'd like the drag-and-drop mode to automatically write the re-encode command to txt-file? At present this is only possible using the -we parameter, but it's an easy change. Appreciate the feedback, thx

unvivtool d -we <path/to/input.viv> <path/to/existing/output_directory>
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Apr 05, 2024, 6:52 PM
Quote from: bfut on Apr 05, 2024,  7:46 AM
Got it, thanks. Manipulated file.

Do you also use unvivtool to create archives? Since you requested the drag-and-drop mode, I wondered whether you'd like the drag-and-drop mode to automatically write the re-encode command to txt-file? At present this is only possible using the -we parameter, but it's an easy change. Appreciate the feedback, thx

unvivtool d -we <path/to/input.viv> <path/to/existing/output_directory>
WOW i wasn't aware of this handy feature. So just selecting the extracted files from car.viv and drag'n'drop them onto the unvivtool.exe creates a clean, new car.viv? That is pure awesomeness, it saves so much time, i gonna try out asap
EDIT: Firstly i didn't understand how to use this, i thought it would be like the drag'n'drop function, but unfortunately, it isn't. I took as least as long as i would open up an empty car.viv and put every extracted file into it with NFS Wizard manually, but i think if one gets used to your function, it might be faster than doing it the manual way
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Apr 06, 2024, 4:53 AM
Drag-and-drop encoding multiple files will be in the next version.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Apr 06, 2024, 11:35 AM
edit: get version 1.18 from https://github.com/bfut/unvivtool/releases/tag/1.18 /edit

Find unvivtool 1.18ReleaseCandidate for Windows in the attachment.

Changes:
* decoder now simply skips invalid files instead of erroring out
* handles vttt/car.viv (one of the contained files has a manipulated filesize)
* new drag-and-drop encoder: drop multiple files (that are not VIV archives) onto the executable to create an NFS-compatible archive

ofc win98-compatible
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Apr 06, 2024, 6:38 PM
Quote from: bfut on Apr 06, 2024, 11:35 AM
Find unvivtool 1.18ReleaseCandidate for Windows in the attachment.

Changes:
* decoder now simply skips invalid files instead of erroring out
* handles vttt/car.viv (one of the contained files has a manipulated filesize)
* new drag-and-drop encoder: drop multiple files (that are not VIV archives) onto the executable to create an NFS-compatible archive

ofc win98-compatible
Thanks so much
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: pete9516 on Apr 06, 2024, 9:19 PM
I don't want to spam you, but at the moment, i'm adding tons of cars to my HS Mixer archive and i've encountered another car.viv file which not even VIV Magic or VIV Edit can handle. It says it got an invalid headersize.
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Apr 07, 2024, 2:16 AM
Thanks for the heads-up. Minor regression in the RC, will be fixed in 1.18
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Apr 07, 2024, 4:30 AM
unvivtool118_cli_win32.zip is now available from https://github.com/bfut/unvivtool/releases/tag/1.18

Changes:
+    CLI: drag-and-drop multiple files onto the executable to encode them into a VIV archive
+    CLI: drag-and-drop a VIV/BIG archive onto the executable to decode it
+    Decoder: skips invalid files instead of erroring out
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Apr 19, 2024, 10:28 AM
unvivtool119_cli_win32.zip is now available from https://github.com/bfut/unvivtool/releases/tag/1.19

Changes:
+    De/Encoder: improved filesystem behavior, especially on ancient Windows
+    Decoder: add overwrite mode (auto rename existing files)
+    Decoder: create non-existing output directory
+    Decoder: never overwrite archive
+    CLI: passing an output directory to decoder is optional, and it need not exist
+    CLI: command-line options -dnl -i -f -fmt and their respective arguments are no longer separated by whitespace (breaking change)
+    Python: easy installation via python -m pip install unvivtool on Win, Linux, and macOS

Appendix:
1)    The optional overwrite mode is called with command-line argument -aot
+    the same filename may be present multiple times in an archive; as needed, existing on disk file.ext will be renamed to file_1.ext, file_2.ext, and so on
+    more: use it to avoid overwriting files on disk by accident
+    default decoder behavior is to still overwrite, but a warning is printed to console

2)    Always: the VIV archive itself can no longer be overwritten on decoding

3)    painless Python installation on all systems. Requires Python 3.9 or later:
python -m pip install unvivtool
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Jul 11, 2024, 11:25 PM
unvivtool202 is now available from https://github.com/bfut/unvivtool/releases/tag/2.2

Note: the latest unvivtool.exe for Windows can be found at: https://github.com/bfut/unvivtool/releases/tag/1.20

Changes:
+    Decoder: much faster, reduced memory consumption
+    Decoder: improved format analysis
+    Decoder: improved handling of format deviations
+    Python: new function get_info() returns dictionary of archive header data

Appendix:
+    painless Python installation on all systems. Requires Python 3.10 or later:
python -m pip install -U unvivtool
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Jul 15, 2024, 1:53 PM
unvivtool204 is now available from https://github.com/bfut/unvivtool/releases/tag/2.4

The 64-bit Windows executable is back. Enjoy.

Changes:
+    Decoder: improved performance
+    Decoder: improved format analysis
+    De/Encoder: more informative console output

Appendix:
+    painless Python installation on all systems. Requires Python 3.10 or later:
python -m pip install -U unvivtool
Title: Re: unvivtool - portable VIV decoder/encoder (NFS3-5)
Post by: bfut on Aug 07, 2024, 1:53 PM
unvivtool300 is now available from https://github.com/bfut/unvivtool/releases/tag/3.0

Includes 64-bit Windows executable which is however unchanged from version 204. Enjoy.

Changes:
+    Python: replace file in archive with update()

Appendix:
+    painless Python installation on all systems. Requires Python 3.10 or later:
python -m pip install -U unvivtool