Python to Create a mtp.cfg of All the Maps You Have.

Apr 18, 2019
8
4
The mtp.cfg file is what is used to enable pyrovision for maps. This python file uses PowerShell to create a new mtp.cfg file in yer "tf/cfg" folder that will enable pyrovision for all the maps you currently have downloaded.

Create a new .py file in yer "steamapps/common/Team Fortress 2" folder and then copy and paste the following into it then save and close it.

Python:
import os

def main():
    bsp_list = []
    
    for root, dirs, files in os.walk("."):
        for file in files:
            if file.endswith(".bsp"):
                bsp_list.append(file)
                
    with open("tf/cfg/mtp.cfg", "w") as f:
        f.write('"VisionFilterShadersMapWhitelist"' + "\n" + "{" + "\n")
        for bsp in bsp_list:
            f.write("\t" + '"' + bsp + '" "1"' + "\n")
        f.write("}")

if __name__ == "__main__":
    main()

Then just run the .py and wait for it to finish.
 
Last edited:

The Noble Idiot

L1: Registered
May 10, 2024
1
0
For anyone looking to use this, it doesn't work in its current state. The current (as of writing) version only ends up creating a corrupted text file. I still have an older version that catalogs all of the maps you have downloaded but doesn't include the .bsp suffix for the map names, so you'll have to manually add it unless you know how to code.

dir *.bsp /s /a-d > "pyrovision_temp.txt"

powershell -command "(Get-Content pyrovision_temp.txt) -replace ',', '' | Out-File -encoding ASCII pyrovision_temp.txt"

powershell (Get-Content pyrovision_temp.txt) -replace '(.[PA]M.[0-9]* )', ' """' | Out-File -encoding ASCII pyrovision_temp.txt

findstr /b .*.bsp "pyrovision_temp.txt" >> "pyrovision_temp2.txt"

del /s /q pyrovision_temp.txt

powershell (Get-Content pyrovision_temp2.txt) -replace '.bsp', '""" """1"""' | Out-File -encoding ASCII pyrovision_temp2.txt

type nul > "tf/cfg/mtp.cfg"
echo "VisionFilterShadersMapWhitelist" > "tf/cfg/mtp.cfg"
echo { >> "tf/cfg/mtp.cfg"

type pyrovision_temp2.txt >> "tf/cfg/mtp.cfg"
echo }>> "tf/cfg/mtp.cfg"

del /s /q pyrovision_temp2.txt