Imported ME_Game_Toggler

This commit is contained in:
2019-03-05 22:57:30 +00:00
parent 2f4a9eb18e
commit af0e70bf78
@@ -0,0 +1,74 @@
#region Global Variables
$vanillaId = "_Vanilla_Game_Active"
$vanillaExt = ".vanilla"
$modId = "_Modded_Game_Active"
$modExt = ".mod"
$gamePath = "D:\Games\Origin\Mass Effect 3"
$configPath = $ENV:userprofile + "\Documents\Bioware\Mass Effect 3"
#endregion Global Variables
Write-Host "ME3 Modded/Vanilla game toggler - v1.0"
#Check whether Origin and ME3 are closed prior to attempting any operation
if (Get-Process -ProcessName "Origin" , "MassEffect3" -ErrorAction Ignore)
{
Write-Host "---------------------------------------------------------------------"
Write-Host "|WARNING: Please ensure ME3 and Origin are closed before continuing!|"
Write-Host "---------------------------------------------------------------------"
Read-Host "Press any key to exit"
Exit
}
if (Test-Path $PSScriptRoot\$vanillaId)
{
Write-Host "Vanilla game is currently active"
Rename-Item -Path $gamePath -NewName $gamePath$vanillaExt
Rename-Item -Path $gamePath$modExt -NewName $gamePath
Rename-Item -Path $configPath -NewName $configPath$vanillaExt
Rename-Item -Path $configPath$modExt -NewName $configPath
#Validation
if (-Not (Test-Path $gamePath$vanillaExt , $gamePath, $configPath$vanillaExt , $configPath))
{
Write-Host "WARNING: Verification failed!"
Read-Host "Press any key to exit"
Exit
}
New-Item $PSScriptRoot\$modId -ItemType file
Remove-Item $PSScriptRoot\$vanillaId
Write-Host "[Modded game is now active]"
Exit
}
elseif (Test-Path $PSScriptRoot\$modId)
{
Write-Host "Modded game is currently active"
Rename-Item -Path $gamePath -NewName $gamePath$modExt
Rename-Item -Path $gamePath$vanillaExt -NewName $gamePath
Rename-Item -Path $configPath -NewName $configPath$modExt
Rename-Item -Path $configPath$vanillaExt -NewName $configPath
#Validation
if (-Not (Test-Path $gamePath$modExt , $gamePath, $configPath$modExt , $configPath))
{
Write-Host "WARNING: Verification failed!"
Read-Host "Press any key to exit"
Exit
}
New-Item $PSScriptRoot\$vanillaId -ItemType file
Remove-Item $PSScriptRoot\$modId
Write-Host "[Vanilla game is now active]"
Exit
}
else
{
Write-Host "No previous ID detected, generating vanilla ID by default. If incorrect, please rename Vanilla to Modded."
Write-Host "Re-execute this script to toggle between modded and vanilla."
New-Item $PSScriptRoot\$vanillaId -ItemType file
}