Skip to content

Commit

Permalink
Fixed gamepass version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanParadis authored Dec 5, 2024
1 parent 75d323e commit dd377bf
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions simple_mod_merger.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -155,29 +155,17 @@ function Resolve-Conflict-And-Merge {
New-Item -ItemType Directory -Path $mergedFolderPath | Out-Null
}

#if a there is already a merged pak, rename it to _previous
foreach ($mod in $conflictingMods) {
if ($mod.BaseName -eq $mergedFolderName) {
$renamedMod = $mergedFolderName+"_previous.pak"
#Rename-Item -Path $mod.FullName -NewName -Force
Rename-Item -Path $mod.FullName -NewName $renamedMod -Force
#get the pak file
$previousMergedPakPath = Join-Path -Path $modFolder -ChildPath $renamedMod
$previousMergedPak = Get-Item -Path $previousMergedPakPath
#replace the mod in the conflictingMods array
$conflictingMods[$conflictingMods.IndexOf($mod)] = $previousMergedPak
break
}
}

$unpackedDirs = @{}
foreach ($mod in $conflictingMods) {
$unpackDir = Join-Path -Path $modFolder -ChildPath $mod.BaseName
if (-not (Test-Path -Path $unpackDir)) {
# Unpack the mod `.pak` file into its own folder
Write-Host "Unpacking $($mod.Name)..."
& $RepackExe unpack $mod.FullName
#check if at the mod location there is a folder with the same name as the mod and delete it
$dirContainingModPath = Split-Path -Path $mod.FullName
$potentialUnpackedDir = Join-Path -Path $dirContainingModPath -ChildPath $mod.BaseName
if(Test-Path $potentialUnpackedDir) {
Remove-Item -Path $potentialUnpackedDir -Recurse -Force -Confirm:$false
}
# Unpack the mod `.pak` file into its own folder
Write-Host "Unpacking $($mod.Name)..."
& $RepackExe unpack $mod.FullName
# moved the unpacked pak into the mod folder
$unpackedFolder = $mod.FullName.Substring(0, $mod.FullName.Length - 4)
Move-Item -Path $unpackedFolder -Destination $modFolder -Force
Expand Down Expand Up @@ -378,9 +366,9 @@ if (Test-Path $gameSavedPath) {
}

$stalker2EXEPath = Join-Path -Path $installPath -ChildPath "Stalker2.exe"
if (-Not (Test-Path $stalker2EXEPath))
if (-Not (Test-Path $stalker2EXEPath) -or $true)
{
if (-Not (Test-LongPath -Path $GamePassPath))
if (-Not (Test-Path -Path $GamePassPath) -and $false)
{
Write-Host "Wrong folder selected. Select the folder with Stalker2.exe or gamelaunchhelper.exe (GamePass Version). Exiting script." -ForegroundColor Red
pause
Expand Down

0 comments on commit dd377bf

Please sign in to comment.