Skip to content

Commit

Permalink
Changed ppsspp download
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragkrishna committed Apr 9, 2024
1 parent 807d133 commit 3b6b9a1
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -225,36 +225,24 @@ Write-Host "####################################################################
$targetFolder = Join-Path (Get-Location) 'PPSSPP'

# Send a web request to the URL
$request = Invoke-WebRequest -Uri "https://buildbot.orphis.net/ppsspp/index.php"
$request = Invoke-WebRequest -Uri "https://www.ppsspp.org/download/"

# Extract the download link from the response
$downloadLink = $request.Links | Where-Object href -like '*windows-amd64' | Select-Object -First 1 | Select-Object -ExpandProperty href
$cleanedUrl = $downloadLink -replace "amp;", ""

# Define a regular expression to extract the revision string
$regex = 'rev=([^&]+)'

# Use Select-String to find matches in the URL
$version = $cleanedUrl | Select-String -Pattern $regex

# Extract the revision string from the match
$revision = $version.Matches.Groups[1].Value
$downloadLink = $request.Links | Where-Object href -like '*ppsspp_win.zip' | Select-Object -First 1 | Select-Object -ExpandProperty href
$urlParts = $downloadLink.Split('/')
$version = $urlParts[-2]

# Download the file using the extracted URL
$downloadUrl = "https://buildbot.orphis.net$cleanedUrl"
$filename = "ppsspp-$revision-windows-amd64.7z"
$filename = "ppsspp_win_$version.zip"

if (Test-Path downloads/$filename) {
Write-Host "You Have Latest PPSSPP Version $filename"
$PPSSPPdone = "`e[40mYou Already Have Latest $filename`e[0m"
$EmulatorsAlreadyLatest += 1
}
else {
Remove-Item downloads/ppsspp*windows-amd64.7z -Recurse -Force
Invoke-WebRequest -Uri "$downloadUrl" -OutFile downloads/"$filename" -Headers @{
"Referer" = "https://buildbot.orphis.net";
"User-Agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
}
Remove-Item downloads/ppsspp_win_*.zip -Recurse -Force
Invoke-WebRequest -Uri "$downloadUrl" -OutFile downloads/"$filename"
7z x downloads/$filename -o"temp" -y
if ($LASTEXITCODE -eq 0) {
Write-Host "Extraction successful."
Expand Down

0 comments on commit 3b6b9a1

Please sign in to comment.