Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::: ____ ____ _____ _____ ______ _______ _____
- ::: | | | |___|\ \ ___|\ \ | \/ \ ___|\ \
- ::: | | | | |\ \ / /\ \ / /\ \| |\ \
- ::: | | | | | | | | | | / /\ / /\ | | | | v14.731
- ::: | | | | |/____/| |__| |/ /\ \_/ / / /| |/____/
- ::: | | | | |\ \| .--. | | \|_|/ / / | |\ \ gavwhittaker
- ::: |\ \ / /| | | | | | | | | | | | | |
- ::: | \ ___\/___ / |____| |____|____| |____|\____\ |____| |____| |____| April 2025
- ::: \ | || | /| | | | | | | | | | | /| | | |
- ::: \|___||___|/ |____| |____|____| |____|\|____| |____|/ |____| |____|
- :::
- :: Changelog - Nexus Published
- :: ---------------------------
- :: v14.731 - Tweaks and fix for post drive selection crash. Thanks to SnippyStockins for help testing this. It's a nightmare when you can't recreate an error yet need to fix it!
- :: v14.73 - Bugfixes Optimise.py division by zero, Folder Selection crash, Storage Calc miscalc and added --altgpu parameter
- :: v14.72 - Initial Python Implementation in a Batch Wrapper (StorageCalc, ExtractBSA, LooseCopy, Exclusions, Analyse, Filter, Optimise
- :: Dv13.41 - Unicode fixes. Improvements/bugfixes for Copying Files, Renaming Output Folder and Calculating Storage Requirements
- :: Dv13.4 - Key components re-coded to Python, SQLite and Powershell leveraging multi-threading, parallel processing and memory mapping ++
- :: - Now a 2 part process to cut loose from MO2's Virtual File System restrictions
- :: - Optimisation auto-resume should VRAMr be interrupted by user, crash or powercut
- :: - Fixed cause of the wrong textures winning occasionally
- :: - Auto-detection of PBR textures folder to determine if to optimise or skip
- :: - Improved Skyrim EXE detection by reading Windows Registry (kudos Jilvane)
- :: - GPU auto-detection and benchmarking for optimum BC7 encoding
- :: - Intellgient aspect ratio resizing
- :: - Advanced deduplication to reduce VRAMr Output size of unnecessary files
- :: - Improved RGB file processing
- :: - Summary.log to itemise VRAMr process, errors and outcomes by format and texture type
- :: - Additional fixes and code improvements
- :: v12 - Even more VRAM savings from truth table enhancements for possible faster/smaller output.
- :: - PBR support. CPM / Extended Materials script bugfix (thx guildofone).
- :: - Exclusions for DrJ grass mods, 4th Unknown creature textures and ice walls. Improved Logging during optimisation.
- :: - Transitioned to Compressonator for full DDS format support including SRGB for PBR.
- :: v11.1 - Alternative GPU capability and Vortex updates to the User Guide
- :: v11 - CPM support. TexConvx64. ImageMagick truth tables. Exclusions update. Logfile timestamps. Reverted to OpenFolderBox
- :: v10 - BC4 1K for HQ preset as plentiful for parallax. Delete parallax LODs as not used and frees up more VRAM
- :: v9.841 - Fine tuned exclusions for LotDB file causing CTD. Continued thanks to Phostwood and The Nolvus Discord
- :: v9.84 - With thanks to Phostwood, updated exclusions to include LotDB file 'gorehowl_01' causing CTD with Nolvus
- :: v9.83 - Balanced multi-threading. Optimisation counters increment. OpenFolderBox.exe and prevent sleep now via Powershell
- :: v9.78 - Robocopy multi-threading. Optimisation monitor improved to cater for HUGE WJ modlists. Small yet very important bugfixes
- :: v9.77 - Fixed negative counters. Parallelised copy/optimisations saving ~1/3rd time. Other bug fixes and improvements
- :: v9.4 - Removed all ZIP steps to rely on drag and drag of VRAMr'd Textures folder into Mod Manager
- :: v9.36 - Balanced power at exit. Some complex grass exclusions. Cancel option for GameDir. MT'd BSA extract. 7z & TexConv updated
- :: v9.3 - Fixed more artifacts. EXE GameDir check. ZIPr.BAT. Window title improvements. Removed Dummy files no longer needed
- :: v9.2 - Removed cause of AV alert. Fixed Normal Map artifacts. Optimised De-dupe and Exclusions. Improved zipping process
- :: v9.1 - Re-implemented HQ and Performance presets. Added Manual Zipper.bat and manual override of detected !GameDir!
- :: v9.0 - 1-step automated. Updated texconv and 7z DLL. Removed HQ/Perf presets and quick updating. Audio cues
- :: v8.6 - Removed EXE detection and added manual MO2 locator
- :: v8.53 - BSA bugfix and other tweaks
- :: v8.52 - MO2 layered extract, removed shine on rocks/mountains, dummy.dds bugfix, admin checks
- :: v8.21 - Fixed delayedexpansion, re-instated logfile, disk space reqs, BSA de-dupe, preset add/remove INI lock, User Guide update
- :: v8.2 - Visual cues, power profile, add HQ preset, optimised exclusions for more VRAM gain, 7z to Step 3, User Guide update
- :: v7.1 - AIO (DiffusR, ParallaxR integrated), add performance preset, 1st release of User Guide
- :: v7.0 - GPU and CPU optimisation, updated exclusions, large parts of code re-written
- :: v6.8 - ParallaxR BC4 implemented
- :: v6.7 - Further user exclusions (LotDB)
- :: v6.6 - User exclusion submissions to prevent CTD (Scoped Bows)
- :: v6.5 - ParallaxR integrated, user contributed exclusions integration
- :: v6.0 - auto CPU core allocation, ParallaxR and DiffuseR adopt main VRAMr code improvements
- :: v5.0 - DiffuseR added, forced root folder to reduce UAC and username, forced write cache flushes, improve logfile, TexA tweaks
- :: v4.0 - BSA extract added, MO2 and Vortex combined, 7z portable,
- :: v3.0 - Option to optimise interiors and clutter. 7z process optimised
- :: v2.0 - Removed Resource Pack, Large objects (dragons, giants and mountains not processed)
- :: v1.1 - ParallaxR added seperate to normal map optimisation
- :: v1.0 - Initial Release with seperate Resource Pack download
- :: Thanks and Credit
- :: -----------------
- :: Mayhem, PogIsDog, MrAnonymous, HOSE and the rest of the testing team!
- :: AlexxEG for BSA Browser
- :: the_XtR0 for MO2 layered extract idea, code contribution and testing
- :: Draconian69 for parallelised testing and code optimisation
- :: MSFT for TexConv
- :: Compressonator Github Contributors (see License.zip)
- :: Rob van der Woude for OpenFolderBox at https://www.robvanderwoude.com/
- :: ChatGPT
- ::----------------------------------------------------------------------------------------------------------------------------------------
- ::Initialise Environment
- @echo off
- setlocal EnableDelayedExpansion
- chcp 65001 >nul
- mode CON: COLS=115 LINES=48
- set "ScriptDir=%~dp0"
- cd ..
- set "GameDir=%CD%"
- color 0F
- cls
- for /f "delims=: tokens=*" %%a in ('findstr /b ::: "%~f0"') do @echo(%%a
- taskkill /f /im powershell.exe >NUL 2>&1
- :: start "VRAMr User Guide" "%ScriptDir%\tools\UserGuide" -u on -o on "%ScriptDir%\tools\User Guide\"
- del "%TEMP%\StorageCalc.tmp" >NUL 2>&1
- del "%TEMP%\Unpack-Order.tmp" >NUL 2>&1
- del "%TEMP%\MO2Profile.tmp" >NUL 2>&1
- del "%TEMP%\VRAMrTEMP.tmp" >NUL 2>&1
- del "%TEMP%\GameDir.tmp" >NUL 2>&1
- set "ModMgr=MO2"
- set "PBRExists=NotDefined"
- set "GPU2Use=0"
- set "GameDir=Z:\home\ben\data\games\wabbajack\modlists\whatever\Stock Game\data"
- set "VRAMrTEMP=Z:\home\ben\data\games\VRAMROutput"
- set "MO2Profile=Z:\home\ben\data\games\wabbajack\modlists\whatever\profiles\Whatever Profile"
- cd /d "%GameDir%"
- if exist ".\VRAMrOutput.tmp" (
- color 4F
- echo.
- echo ERROR - Existing VRAMr Output Enabled in your Mod Manager. Disable and Restart VRAMr
- goto Terminate
- )
- if exist "%VRAMrTEMP%" (
- color 60
- echo WARNING - %FoundFolder% Exists from a Previous Session
- echo.
- echo You Must Delete or Rename the Folder Before VRAMr can Continue
- echo.
- goto Terminate
- )
- :: ...........................................................................................................
- :: : Preset : Diffuse : Normal : Parallax : Material : RGB/PBR : Description :
- :: :..............:.........:........:..........:..........:.............:....................................
- :: : High Quality : 2K : 2K : 1K : 1K : : 4K Heavy Modlist Downscaled to 2K :
- :: : Quality : 2K : 1K : 1K : 1K : : Balance of Quality / VRAM Savings :
- :: : Optimum : 2K : 1K : 512 : 512 : Downscale : Good Starting Preset if Unsure :
- :: : Performance : 2K : 512 : 512 : 512 : Only : Big Gains Lower Close Up Quality :
- :: : Vanilla : 512 : 512 : 512 : 512 : : I Just Want my PC to Play Skyrim :
- :: :..............:.........:........:..........:..........:.............:....................................
- :: CHANGE TO ChoseHQ/ChoseQuality/ChoseOptimum/ChosePerf/ChoseVanilla
- goto ChosePerf
- :ChoseHQ
- set /a Diffuse=2048
- set /a Normal=2048
- set /a Parallax=1024
- set /a Material=1024
- set "Preset=HQ"
- goto CalcDiskSpace
- :ChoseQuality
- set /a Diffuse=2048
- set /a Normal=1024
- set /a Parallax=1024
- set /a Material=1024
- set "Preset=Quality"
- goto CalcDiskSpace
- :ChoseOptimum
- set /a Diffuse=2048
- set /a Normal=1024
- set /a Parallax=512
- set /a Material=512
- set "Preset=Optimum"
- goto CalcDiskSpace
- :ChosePerf
- set /a Diffuse=2048
- set /a Normal=512
- set /a Parallax=512
- set /a Material=512
- set "Preset=Performance"
- goto CalcDiskSpace
- :ChoseVanilla
- set /a Diffuse=512
- set /a Normal=512
- set /a Parallax=512
- set /a Material=512
- set "Preset=Vanilla"
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :CalcDiskSpace
- echo.
- cd /d "%GameDir%"
- echo Calculating Approximate Initial Temporary Storage Requirement....Please Wait
- robocopy .\ c:\dummy /L /E *.dds | find "Bytes" >%TEMP%\StorageCalc.tmp
- set /p StorageCalc=<%TEMP%\StorageCalc.tmp
- echo %StorageCalc:~11,3% >%TEMP%\StorageCalc.tmp
- set /p StorageCalc=<%TEMP%\StorageCalc.tmp
- echo Select a Drive Root with atleast%StorageCalc%GB Space - ie. D: creates D:\VRAMr. Avoid C: due to Windows Security
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :DefineVRAMrFolder
- mkdir "%VRAMrTEMP%.\Logfiles"
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :DetectPBR
- call :ProgressBar 20
- cd /d "%GameDir%\textures"
- if exist ".\pbr\" (
- set "PBRExists=1"
- ) else (
- set "PBRExists=0"
- )
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :BuildVRAMrFolder
- call :ProgressBar 23
- echo.
- (
- echo VRAMr Started : %DATE% %TIME%
- echo VRAMr Output folder : "%VRAMrTEMP%"
- echo ScriptDir : "%ScriptDir%"
- echo GameDir : "%GameDir%"
- echo Optimisation Preset : "%Preset%"
- echo Initial Storage Req : ~"%StorageCalc%GB"
- if "%ModMgr%"=="MO2" (
- echo Mod Manager : Mod Organizer 2 Detected - Layered BSA Extract Available
- ) else (
- echo Mod Manager : Vortex Compatibility Mode
- )
- if "%PBRExists%"=="1" (
- echo PBR Textures : Detected
- ) else (
- echo PBR Textures : Not Detected
- )
- if "%GPU2Use%"=="1" (
- echo Alternative GPU : True
- )
- ) > "%VRAMrTEMP%\Logfiles\VRAMr.log"
- echo. >> "%VRAMrTEMP%\Logfiles\VRAMr.log"
- echo VRAMr Started : %DATE% %TIME%
- echo VRAMr Output folder : "%VRAMrTEMP%"
- echo ScriptDir : "%ScriptDir%"
- echo GameDir : "%GameDir%"
- if "%ModMgr%"=="MO2" (
- echo Mod Manager : Mod Organizer 2 Detected - Layered BSA Extract Available
- ) else (
- echo Mod Manager : Vortex Compatibility Mode
- )
- if "%PBRExists%"=="1" (
- echo PBR Textures : Detected
- ) else (
- echo PBR Textures : Not Detected
- )
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :ExtractBSAPrimer
- call :ProgressBar 25
- cd /d "%GameDir%"
- echo.
- "%ScriptDir%\tools\MakeUnpack.exe" --profile "%MO2Profile%" --GameDir .\
- color 1F
- echo %DATE% %TIME% Extracting BSA Archives... >> "%VRAMrTEMP%\logfiles\VRAMr.log"
- "%ScriptDir%\tools\ExtractBSA.exe" --source .\*.bsa --dest "%VRAMrTEMP%\Output" --logfile "%VRAMrTEMP%\Logfiles" --layered %TEMP% --filter *.dds
- "%ScriptDir%\tools\ExtractBSA.exe" --source "%GameDir%\..\..\mods\*\*.bsa" --dest "%VRAMrTEMP%\Output" --logfile "%VRAMrTEMP%\Logfiles" --layered %TEMP% --filter *.dds
- call :Flush
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :LooseFilesCopy
- call :ProgressBar 40
- color 5F
- echo %DATE% %TIME% Copying Loose Diffuse Textures... >> "%VRAMrTEMP%\logfiles\VRAMr.log"
- for %%A in ("%GameDir%\..\..\mods") do set "modFolder=%%~fA"
- for /D %%f in (%modFolder%\*) do (
- echo %%f
- "%ScriptDir%\tools\LooseCopy.exe" --source "%%f\textures" --dest "%VRAMrTEMP%\Output\textures" --logfile "%VRAMrTEMP%\Logfiles" --verbose
- )
- call :Flush
- ::----------------------------------------------------------------------------------------------------------------------------------------
- color CF
- call :ProgressBar 55
- echo %DATE% %TIME% Processing Exclusions... >> "%VRAMrTEMP%\logfiles\VRAMr.log"
- "%ScriptDir%\tools\Exclusions.exe" --Exclude "%ScriptDir%\tools\Exclusions.mod" --Dest "%VRAMrTEMP%\Output" --Logfile "%VRAMrTEMP%\Logfiles"
- call :Flush
- ::----------------------------------------------------------------------------------------------------------------------------------------
- color F0
- call :ProgressBar 60
- "%ScriptDir%\tools\Analyse.exe" --Source "%VRAMrTEMP%\Output" --Logfile "%VRAMrTEMP%\Logfiles" --Tool "%ScriptDir%\tools\CLI"
- call :Flush
- ::----------------------------------------------------------------------------------------------------------------------------------------
- color 9F
- call :ProgressBar 69
- "%ScriptDir%\tools\SQLiteFilter.exe" --dnpm %diffuse% %normal% %parallax% %material% --Filter "%ScriptDir%\tools\Filters.VRAMr" --Source "%VRAMrTEMP%\Output\VRAMr.db" --Logfiles "%VRAMrTEMP%\Logfiles"
- call :Flush
- ::----------------------------------------------------------------------------------------------------------------------------------------
- color DF
- call :ProgressBar 74
- if "%PBRExists%"=="1" (
- "%ScriptDir%\tools\Optimise.exe" --dnpm %diffuse% %normal% %parallax% %material% --Source "%VRAMrTEMP%\Output\VRAMr.db" --Logfiles "%VRAMrTEMP%\Logfiles" --GPU %GPU2Use% --PBR 1 --Tool "%ScriptDir%\tools\texconv.exe"
- ) else (
- "%ScriptDir%\tools\Optimise.exe" --dnpm %diffuse% %normal% %parallax% %material% --Source "%VRAMrTEMP%\Output\VRAMr.db" --Logfiles "%VRAMrTEMP%\Logfiles" --GPU %GPU2Use% --PBR 0 --Tool "%ScriptDir%\tools\texconv.exe"
- )
- call :Flush
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :TidyUp
- color 0F
- call :ProgressBar 93
- cd /d "%VRAMrTEMP%"
- attrib -R -A -S -H -P *.* /s /d
- call :ProgressBar 97
- cd Output
- for /f "usebackq delims=" %%d in ('dir /s /b /ad ^| sort /r') do rd "%%d" >NUL 2>&1
- call :Flush
- xcopy "%ScriptDir%\tools\VRAMrOutput.tmp" "%VRAMrTEMP%\Output" /v /q /y >NUL 2>&1
- echo %DATE% %TIME% Copying VRAMr Output Marker... >>%VRAMrTEMP%\logfiles\VRAMr.log
- call :Flush
- del *.db >NUL 2>&1
- call :Flush
- cd ..
- ren "Output" "DragNDropThisFolderIntoModManager"
- echo %DATE% %TIME% Renaming Your VRAMr Output Folder... >>%VRAMrTEMP%\logfiles\VRAMr.log
- echo %DATE% %TIME% VRAMr Output Ready... >>%VRAMrTEMP%\logfiles\VRAMr.log
- call :ProgressBar 99
- ::----------------------------------------------------------------------------------------------------------------------------------------
- color 2F
- echo.
- echo VRAMr has finished
- echo Put 'DragNDropThisFolderIntoModManager' in %VRAMrTEMP% into your Mod Manager
- echo %DATE% %TIME% The VRAMr Process is Complete... >>%VRAMrTEMP%\logfiles\VRAMr.log
- call :ProgressBar 100
- goto Terminate
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :ProgressBar
- set "ProgressPercent=%1"
- title VRAMr - Progress: %ProgressPercent%%%
- exit /B
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :Flush
- timeout /t 3 >NUL 2>&1
- powershell -NoProfile -ExecutionPolicy Bypass -Command "$TempFile = [System.IO.Path]::GetTempFileName(); 'Triggering cache flush' | Set-Content -Path $TempFile; Remove-Item -Path $TempFile -Force"
- powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-Process | ForEach-Object { try { [System.Diagnostics.Process]::GetProcessById($_.Id).MinWorkingSet = 0 } catch { } }"
- exit /B
- ::----------------------------------------------------------------------------------------------------------------------------------------
- :Terminate
- taskkill /f /im Powershell.exe >NUL 2>&1
- taskkill /f /im UserGuide.exe >NUL 2>&1
- taskkill /f /im texconv.exe >NUL 2>&1
- taskkill /f /im Compressonator.exe >NUL 2>&1
- powershell -NoProfile -ExecutionPolicy Bypass -Command "$TempFile = [System.IO.Path]::GetTempFileName(); 'Triggering cache flush' | Set-Content -Path $TempFile; Remove-Item -Path $TempFile -Force"
- powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-Process | ForEach-Object { try { [System.Diagnostics.Process]::GetProcessById($_.Id).MinWorkingSet = 0 } catch { } }"
- echo.
- pause
- exit
Advertisement
Add Comment
Please, Sign In to add comment