Download program
http://sourceforge.net/projects/swis...wissfileknife/
and rename it sfk.exe and place in custom folder to get files MD5 checksum.
This SteamPipe-friendly incremental method is more likely to heavy users who have BIG project and VPK file (100MB or over)!
Let's say your mod size is 130MB and we chop it to 10MB size VPK files pieces (-c 10), just for that
players not need download whole 130MB VPK everytime when it is updated.
When in your project have a tiny change in just one file, MD5 checksum helps update your VPK's if file size not differs.
Then vpk.exe update just one of those VPK's files where your change have made.
Players now need only download 10MB update instead 130MB
To upload/update players VPKs files is whole different story, I don't know how to do that. Ask from Valve/Steam.
Batch create KV file list files inside mod folder and create new VPK when previous not exist.
And rename kv file after packing to
mod.kv.txt.bak file. <- Remember keep this file with same VPK file.
Next time you pack this same mod and you have previous build VPK file and BAK file.
It check and compare KV files and make updates if have to.
Batch throw old bak file inside OLDKVFILE folder with timestamp and rename new KV file to BAK which match now your current VPK file.
PHP Code:
@echo off
:: Do we have this program to get files MD5 checksum ??
::http://stahlworks.com/dev/index.php?tool=md5list
::http://sourceforge.net/projects/swissfileknife/files/1-swissfileknife/
set sfk=0
IF EXIST sfk.exe set sfk=1
:: KEYVALUES FILE <mod folder>.kv.txt
SET KVFILE="%~n1.kv.txt"
set timestamp=%date:~9%%date:~3,-4%-%time::=%
set timestamp=%timestamp:/=%
set timestamp=%timestamp:.=%
set timestamp=%timestamp:~,-3%
echo.//>>%KVFILE%
echo.// Keyvalues Control File = %KVFILE%>>%KVFILE%
echo.// made = %date%-%time%>>%KVFILE%
echo.//>>%KVFILE%
echo.>>%KVFILE%
:: LOOP
setlocal ENABLEDELAYEDEXPANSION
:: MATERIALS
set folder=materials
set file_extensions=*.vmt;*.vtf
echo.
echo.
echo. Creating Keyvalues File %KVFILE%...
IF %sfk%==1 echo. Also collected files MD5 checksum...
echo.
echo Please wait
:loop
<nul set /p =%folder%
FOR /R "%~n1\%folder%" %%i IN (%file_extensions%) do (
set /a N+=1
set "str=%%i"
set "str=!str:*%~n1\=%~n1\!"
echo "!str!">>%KVFILE%
echo {>>%KVFILE%
echo. "destpath" "!str:*%~n1\=!">>%KVFILE%
IF %sfk%==1 (
FOR /F %%i in ('sfk.exe md5 "!str!"') DO set checksum=%%i
echo. "MD5" "!checksum:~0,32!">>%KVFILE%
)
echo }>>%KVFILE%
IF !N!==100 (
set N=0
<nul set /p =.
)
)
echo.
:: MODELS
IF %folder%==materials (
set folder=models
set file_extensions=*.mdl;*.phy;*.ani;*.vtx;*.vvd
goto loop
)
:: SOUND
IF %folder%==models (
set folder=sound
set file_extensions=*.wav;*.mp3
goto loop
)
:: PARTICLES
IF %folder%==sound (
set folder=particles
set file_extensions=*.pcf;*.txt
goto loop
)
:: SCRIPTS
IF %folder%==particles (
set folder=scripts
set file_extensions=*.res;*.txt
goto loop
)
:: RESOURCE
IF %folder%==scripts (
set folder=resource
set file_extensions=*.res;*.txt
goto loop
)
:: CLASSES
IF %folder%==resource (
set folder=classes
set file_extensions=*.res
goto loop
)
:: SHADERS
IF %folder%==classes (
set folder=shaders
set file_extensions=*.vcs
goto loop
)
endlocal
echo. Keyvalues File %KVFILE% ready !!
echo.
:: VPK TOOL
set VPK_EXE=..\..\
pushd .
CD %VPK_EXE%
SET VPK_EXE=%CD%\bin\vpk.exe
popd
IF EXIST "%VPK_EXE%" GOTO :vpk_step
echo.
echo ERROR! ERROR! ERROR! ERROR!
echo.
SET BATCH=%~dp0
echo - Batch file is now located here
echo ...%BATCH:*common\=%
echo - The expected location of the vpk.exe
echo ...%VPK_EXE:*common\=%
echo.
echo.
echo Not such a file found
echo Exit the program...
echo.
echo ERROR! ERROR! ERROR! ERROR!
pause
goto eof
:vpk_step
echo.
echo ] Found VPK tool : ...%VPK_EXE:*common\=%
echo ] VPK tool in action!!!
:: Sign your files if both key files exists
IF NOT EXIST "my.privatekey.vdf" GOTO :skip_sign
IF NOT EXIST "my.publickey.vdf" GOTO :skip_sign
echo Sign VPK...
"%VPK_EXE%" -P -c 100 -K my.privatekey.vdf -k my.publickey.vdf k "%~n1" %KVFILE%
GOTO :skip_regular
:skip_sign
"%VPK_EXE%" -P -c 100 k "%~n1" %KVFILE%
:skip_regular
:: Found previous kv files ? Then rename and move them
IF EXIST "%KVFILE:"=%.bak" (
IF NOT EXIST "oldkvfiles\." mkdir oldkvfiles
move "%KVFILE:"=%.bak" "oldkvfiles\%timestamp%_%KVFILE:"=%.bak" >NUL
)
IF EXIST %KVFILE% move %KVFILE% "%KVFILE:"=%.bak" >NUL
del %KVFILE% 2>NUL
echo.
echo. ALL DONE
pause