Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix #26

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions scripts/functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $progsToInstall = New-Object System.Collections.Generic.List[System.Object]
$dateNow = $((Get-Date).ToString('yyyy.MM.dd_hh.mm.ss'))
$logfileName = "logfile_$dateNow.log"
$powershellVersion = $host.Version.Major
$version = "1.5.18"
$version = "1.5.19"

# Paths
$logFolderPath = Join-Path $rootPath 'logs'
Expand Down Expand Up @@ -244,11 +244,7 @@ function installStandalonePython() {
if (!(fileExists (Join-Path $pythonPath "python.exe"))) {
try {
$question = "`n`tPython has not been detected on your system, do you want to download a standalone version? [y/n]"
askAndDownload
-question $question
-downloadURL $python
-fileName "python.zip"
-bypass ([System.Convert]::ToBoolean((getConfigProperty "bypassPrompts")))
askAndDownload -question $question -downloadURL $python -fileName "python.zip" -bypass ([System.Convert]::ToBoolean((getConfigProperty "bypassPrompts")))

if (fileExists $pythonZipPath) {
#Extract to folder
Expand All @@ -271,13 +267,16 @@ function installStandalonePython() {
function installMissing() {
Clear-Host

if ($progsToInstall.ToArray().Count -eq 0) {
$chocoOnlyDep = $progsToInstall.contains("chocolatey") -and $progsToInstall.ToArray().Count -eq 1

if ($progsToInstall.ToArray().Count -eq 0 -or $chocoOnlyDep) {
writeToConsole "`n`t`tNothing to install, returning to menu..." -logPath $LogPath
Start-Sleep 5
}
else {
# Install chocolatey as it's a dependency for the rest
if ($progsToInstall.contains("chocolatey")) {
# Unless it's the only dependency not installed (others installed externally)
if ($progsToInstall.contains("chocolatey") -and !$chocoOnlyDep) {
$progsToInstall.Remove("chocolatey")
installProg "chocolatey"

Expand Down Expand Up @@ -383,7 +382,7 @@ function moveSFSEFiles() {
# Find files in build folder and copy to user provided path
if (fileExists $sfseBuildPath) {
foreach ($file in $filesToCopy) {
Get-ChildItem -Path $sfseBuildPath -Filter $file -Recurse | Copy-Item -Destination $gamePath -Verbose *>&1 | Out-File -FilePath $LogPath -Append -Encoding UTF8
Get-ChildItem -Path $sfseBuildPath -Filter $file -Recurse | Copy-Item -Destination $gamePath -Verbose *>&1 | Out-File -FilePath $LogPath -Append -Encoding UTF8
}

# Check files exist
Expand Down Expand Up @@ -451,12 +450,12 @@ function patchFiles() {
if ($verifyPatch[-2].SubString(6, 18) -eq "All files matched!") {
writeToConsole "`n`t`tSuccessfully Patched SFSE" -logPath $LogPath
if (![System.Convert]::ToBoolean((getConfigProperty "bypassPrompts"))) {
pause
Pause
}
}
else {
writeToConsole "`n`t`tUnsuccessfully Patched SFSE, check log to see which files failed md5 comparison" -logPath $LogPath
pause
Pause
}
}
catch {
Expand Down Expand Up @@ -502,12 +501,12 @@ function checkForPStools() {
if (!(fileExists $psExecPath)) {
try {
$question = "`n`tIn order to move the secured game exe we need to use PSTools, download? [y/n]"
askAndDownload $question $pstools "pstools.zip" ([System.Convert]::ToBoolean((getConfigProperty "bypassPrompts")))
askAndDownload -question $question -downloadURL $pstools -fileName "pstools.zip" -bypass ([System.Convert]::ToBoolean((getConfigProperty "bypassPrompts")))

if (fileExists $psToolsZipPath) {
#Extract to folder
Expand-Archive -LiteralPath $psToolsZipPath -DestinationPath $psToolsPath

#Clean up zip
Remove-Item $psToolsZipPath
}
Expand Down