Advertisement
OstermanA

Fallout 4 Texture Optimization Project Install

Jan 22nd, 2019
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.12 KB | None | 0 0
  1. from pathlib import Path, PurePath
  2. import subprocess, sys
  3.  
  4. ARCHIVE2=Path(PurePath("C:\Program Files (x86)\Steam\steamapps\Steam\Fallout 4\Tools\Archive2\Archive2.exe"))
  5. ALL_BA2=['DLCCoast - Main.ba2','DLCCoast - Textures.ba2','DLCCoast - Voices_en.ba2','DLCNukaWorld - Main.ba2','DLCNukaWorld - Textures.ba2','DLCNukaWorld - Voices_en.ba2','DLCRobot - Main.ba2','DLCRobot - Textures.ba2','DLCRobot - Voices_en.ba2','DLCUltraHighResolution - Textures01.ba2','DLCUltraHighResolution - Textures02.ba2','DLCUltraHighResolution - Textures03.ba2','DLCUltraHighResolution - Textures04.ba2','DLCUltraHighResolution - Textures05.ba2','DLCUltraHighResolution - Textures06.ba2','DLCUltraHighResolution - Textures07.ba2','DLCUltraHighResolution - Textures08.ba2','DLCUltraHighResolution - Textures09.ba2','DLCUltraHighResolution - Textures10.ba2','DLCUltraHighResolution - Textures11.ba2','DLCUltraHighResolution - Textures12.ba2','DLCUltraHighResolution - Textures13.ba2','DLCUltraHighResolution - Textures14.ba2','DLCUltraHighResolution - Textures15.ba2','DLCUltraHighResolution - Textures16.ba2','DLCworkshop01 - Main.ba2','DLCworkshop01 - Textures.ba2','DLCworkshop02 - Main.ba2','DLCworkshop02 - Textures.ba2','DLCworkshop03 - Main.ba2','DLCworkshop03 - Textures.ba2','DLCworkshop03 - Voices_en.ba2','Fallout4 - Animations.ba2','Fallout4 - Interface.ba2','Fallout4 - Materials.ba2','Fallout4 - Meshes.ba2','Fallout4 - MeshesExtra.ba2','Fallout4 - Misc.ba2','Fallout4 - Nvflex.ba2','Fallout4 - Shaders.ba2','Fallout4 - Sounds.ba2','Fallout4 - Startup.ba2','Fallout4 - Textures1.ba2','Fallout4 - Textures2.ba2','Fallout4 - Textures3.ba2','Fallout4 - Textures4.ba2','Fallout4 - Textures5.ba2','Fallout4 - Textures6.ba2','Fallout4 - Textures7.ba2','Fallout4 - Textures8.ba2','Fallout4 - Textures9.ba2','Fallout4 - Voices.ba2']
  6.  
  7. if (len(sys.argv) != 4):
  8.   print("Usage: {} SOURCE_DIR WORKING_DIR TOP_DIR".format(__file__))
  9.   sys.exit()
  10.  
  11. try:
  12.   source=Path(PurePath(sys.argv[1]))
  13.   tmp=Path(PurePath(sys.argv[2]))
  14.   top=Path(PurePath(sys.argv[3]))
  15.  
  16.   archive=Path(source, 'ba2_backup')
  17.  
  18.   print("INFO: source={}".format(source))
  19.   print("INFO: tmp={}".format(tmp))
  20.  
  21.   if not archive.is_dir():
  22.     archive.mkdir()
  23.  
  24.   for ba2 in source.iterdir():
  25.     if ba2.name not in ALL_BA2:
  26.       print("WARN: Skipping file {}".format(ba2))
  27.       continue
  28.    
  29.     print("INFO: Processing file {}".format(ba2))
  30.     working=Path(tmp, ba2.stem)
  31.    
  32.     if not working.is_dir():
  33.       print("INFO: Making directory {}".format(working))
  34.       working.mkdir()
  35.      
  36.     command=[str(ARCHIVE2), str(ba2), '-q', '-e={}'.format(working)]
  37.     print('INFO: Executing', command)
  38.     subprocess.call(command)
  39.    
  40.     print("INFO: Creating backup of {}".format(ba2))
  41.     ba2.replace(Path(archive, ba2.name))
  42.    
  43.     command=['robocopy', str(top), str(working), '/s', '/xl']
  44.     print('INFO: Executing', command)
  45.     subprocess.call(command)
  46.    
  47.     command=[str(ARCHIVE2), str(working), '-q', '-c={}'.format(ba2), '-r={}'.format(working), '-compression=None']
  48.     print('INFO: Executing', command)
  49.     subprocess.call(command)
  50.  
  51. except:
  52.   print("Unexpected error")
  53.   raise
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement