@echo off
cls
echo.

If not exist addons\VTE_air.pbo echo ERROR VTE_air.pbo not found in <vtedir>/addons/
If not exist addons\VTE_air.pbo goto end

If not exist addons\VTE_aw.pbo echo ERROR VTE_aw.pbo not found in <vtedir>/addons/
If not exist addons\VTE_aw.pbo goto end

If not exist addons\VTE_config.pbo echo ERROR VTE_config.pbo not found in <vtedir>/addons/
If not exist addons\VTE_config.pbo goto end

If not exist addons\VTE_events.pbo echo ERROR VTE_events.pbo not found in <vtedir>/addons/
If not exist addons\VTE_events.pbo goto end

If not exist addons\VTE_isles.pbo echo ERROR VTE_isles.pbo not found in <vtedir>/addons/
If not exist addons\VTE_isles.pbo goto end

If not exist addons\VTE_land.pbo echo ERROR VTE_land.pbo not found in <vtedir>/addons/
If not exist addons\VTE_land.pbo goto end

If not exist addons\VTE_men.pbo echo ERROR VTE_men.pbo not found in <vtedir>/addons/
If not exist addons\VTE_men.pbo goto end

If not exist addons\VTE_objects.pbo echo ERROR VTE_objects.pbo not found in <vtedir>/addons/
If not exist addons\VTE_objects.pbo goto end

If not exist addons\VTE_sea.pbo echo ERROR VTE_sea.pbo not found in <vtedir>/addons/
If not exist addons\VTE_sea.pbo goto end

If not exist addons\VTE_sounds.pbo echo ERROR VTE_sounds.pbo not found in <vtedir>/addons/
If not exist addons\VTE_sounds.pbo goto end

If not exist addons\VTE_weapons.pbo echo ERROR VTE_weapons.pbo not found in <vtedir>/addons/
If not exist addons\VTE_weapons.pbo goto end

If not exist dta\anims.pbo echo ERROR anims.pbo not found in <vtedir>/dta/
If not exist dta\anims.pbo goto end

If not exist campaigns\PMC_NAM_SEAL.pbo echo ERROR PMC_NAM_SEAL.pbo not found in <vtedir>/campaigns/
If not exist campaigns\PMC_NAM_SEAL.pbo goto end

If not exist ..\Missions\VTE_missions\ammocache.vte_meekong.pbo echo ERROR ammocache.vte_meekong.pbo not found in <ofpdir>/Missions/VTE_missions/
If not exist ..\Missions\VTE_missions\ammocache.vte_meekong.pbo goto end

rem the program itself!
if not exist DePbo.dll echo ERROR DePbo.dll not found in the root dir
if not exist DePbo.dll goto end

if not exist PatchPbo.exe echo ERROR PatchPbo.exe not found in the root dir
if not exist PatchPbo.exe goto end

rem the VTE upgrade files
if not exist x_data1.pbo echo ERROR x_data1.pbo not found in the root dir
if not exist x_data1.pbo goto end

if not exist x_data2.pbo echo ERROR x_data2.pbo not found in the root dir
if not exist x_data2.pbo goto end

if not exist x_data3.pbo echo ERROR x_data3.pbo not found in the root dir
if not exist x_data3.pbo goto end

if not exist x_data4.pbo echo ERROR x_data4.pbo not found in the root dir
if not exist x_data4.pbo goto end

if not exist x_data5.pbo echo ERROR x_data5.pbo not found in the root dir
if not exist x_data5.pbo goto end

if not exist x_data6.pbo echo ERROR x_data6.pbo not found in the root dir
if not exist x_data6.pbo goto end

if not exist x_data7.pbo echo ERROR x_data7.pbo not found in the root dir
if not exist x_data7.pbo goto end

if not exist x_data8.pbo echo ERROR x_data8.pbo not found in the root dir
if not exist x_data8.pbo goto end

if not exist x_data9.pbo echo ERROR x_data9.pbo not found in the root dir
if not exist x_data9.pbo goto end

if not exist x_dataa.pbo echo ERROR x_dataa.pbo not found in the root dir
if not exist x_dataa.pbo goto end

if not exist x_datab.pbo echo ERROR x_datab.pbo not found in the root dir
if not exist x_datab.pbo goto end

if not exist x_datac.pbo echo ERROR x_datac.pbo not found in the root dir
if not exist x_datac.pbo goto end

if not exist x_datae.pbo echo ERROR x_datae.pbo not found in the root dir
if not exist x_datae.pbo goto end

if not exist x_dataf.pbo echo ERROR x_dataf.pbo not found in the root dir
if not exist x_dataf.pbo goto end

echo This will patch VTE pbo files to version 0.2, November 22nd, 2005.
echo None of the original OFP files will be modified.
echo.
echo Before proceeding, better make sure that you have 
echo at least 700mb free disk space on this drive.
echo.
echo.

echo Press any key to continue or CTRL-C to abort.
pause >NUL

cls
echo Processing dta\anims.pbo - please wait...
PatchPbo x_data1.pbo dta\anims.pbo >nul
cd dta
del anims.pbo
ren anims.pbo.patched.pbo anims.pbo
cd ..

echo Processing addons\VTE_air.pbo - please wait...
PatchPbo x_data2.pbo addons\VTE_air.pbo >nul
cd addons
del VTE_air.pbo
ren VTE_air.pbo.patched.pbo VTE_air.pbo
cd ..

echo Processing addons\VTE_aw.pbo - please wait...
PatchPbo x_data3.pbo addons\VTE_aw.pbo >nul
cd addons
del VTE_aw.pbo
ren VTE_aw.pbo.patched.pbo VTE_aw.pbo
cd ..

echo Processing addons\VTE_config.pbo - please wait...
PatchPbo x_data4.pbo addons\VTE_config.pbo >nul
cd addons
del VTE_config.pbo
ren VTE_config.pbo.patched.pbo VTE_config.pbo
cd ..

echo Processing addons\VTE_events.pbo - please wait...
PatchPbo x_data5.pbo addons\VTE_events.pbo >nul
cd addons
del VTE_events.pbo
ren VTE_events.pbo.patched.pbo VTE_events.pbo
cd ..

echo Processing addons\VTE_isles.pbo - please wait...
PatchPbo x_data6.pbo addons\VTE_isles.pbo >nul
cd addons
del VTE_isles.pbo
ren VTE_isles.pbo.patched.pbo VTE_isles.pbo
cd ..

echo Processing addons\VTE_land.pbo - please wait...
PatchPbo x_data7.pbo addons\VTE_land.pbo >nul
cd addons
del VTE_land.pbo
ren VTE_land.pbo.patched.pbo VTE_land.pbo
cd ..

echo Processing addons\VTE_men.pbo - please wait...
PatchPbo x_data8.pbo addons\VTE_men.pbo >nul
cd addons
del VTE_men.pbo
ren VTE_men.pbo.patched.pbo VTE_men.pbo
cd ..

echo Processing addons\VTE_objects.pbo - please wait...
PatchPbo x_data9.pbo addons\VTE_objects.pbo >nul
cd addons
del VTE_objects.pbo
ren VTE_objects.pbo.patched.pbo VTE_objects.pbo
cd ..

echo Processing addons\VTE_sea.pbo - please wait...
PatchPbo x_dataa.pbo addons\VTE_sea.pbo >nul
cd addons
del VTE_sea.pbo
ren VTE_sea.pbo.patched.pbo VTE_sea.pbo
cd ..

echo Processing addons\VTE_sounds.pbo - please wait...
PatchPbo x_datab.pbo addons\VTE_sounds.pbo >nul
cd addons
del VTE_sounds.pbo
ren VTE_sounds.pbo.patched.pbo VTE_sounds.pbo
cd ..

echo Processing addons\VTE_weapons.pbo - please wait...
PatchPbo x_datac.pbo addons\VTE_weapons.pbo >nul
cd addons
del VTE_weapons.pbo
ren VTE_weapons.pbo.patched.pbo VTE_weapons.pbo
cd ..

echo Processing campaigns\PMC_NAM_SEAL.pbo - please wait...
PatchPbo x_datae.pbo campaigns\PMC_NAM_SEAL.pbo >nul
cd campaigns
del PMC_NAM_SEAL.pbo
ren PMC_NAM_SEAL.pbo.patched.pbo PMC_NAM_SEAL.pbo
cd ..

echo Processing Missions\VTE_missions\ammocache.vte_meekong.pbo - please wait...
PatchPbo x_dataf.pbo ..\Missions\VTE_missions\ammocache.vte_meekong.pbo >nul
cd ..\Missions\VTE_missions\
del ammocache.vte_meekong.pbo
ren ammocache.vte_meekong.pbo.patched.pbo ammocache.vte_meekong.pbo
cd ..\..\x_vte\

cls
echo.
echo all done.
echo You can now run OFP and VTE has been installed to v0.2

:end
pause
