Advertisement
Guest User

Cheats installer (source code)

a guest
Sep 15th, 2024
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Step 1 - Download and unzip the ZIP file into a temporary folder
  2. $zipUrl = "https://github.com/iSharingan/CTRPF-AR-CHEAT-CODES/archive/refs/heads/master.zip"
  3. $tempFolder = [System.IO.Path]::Combine($env:TEMP, "CTRPF-AR-CHEAT-CODES")
  4. $zipPath = [System.IO.Path]::Combine($tempFolder, "master.zip")
  5.  
  6. # Create temporary folder
  7. if (-not (Test-Path $tempFolder)) {
  8.     New-Item -Path $tempFolder -ItemType Directory | Out-Null
  9. }
  10.  
  11. # Download the ZIP file
  12. Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath
  13.  
  14. # Unzip the file into the temporary folder
  15. Expand-Archive -Path $zipPath -DestinationPath $tempFolder -Force
  16.  
  17. # Step 2 - Access the "Cheats" folder
  18. $cheatsFolder = [System.IO.Path]::Combine($tempFolder, "CTRPF-AR-CHEAT-CODES-master", "Cheats")
  19. if (-not (Test-Path $cheatsFolder)) {
  20.     Write-Host "Error: Cheats folder not found." -ForegroundColor Red
  21.     Exit
  22. }
  23.  
  24. # Step 3 - Search for .txt files in the "Cheats" folder and subfolders
  25. $txtFiles = Get-ChildItem -Path $cheatsFolder -Recurse -Filter *.txt
  26. if (-not $txtFiles) {
  27.     Write-Host "No .txt files were found in the Cheats folder." -ForegroundColor Red
  28.     Exit
  29. }
  30.  
  31. # Step 4 - Ask the user which emulator they use to select the destination folder
  32. $emulator = Read-Host "Choose fork:Old Citra,Lime3DS or PabloMK7's Citra."
  33. $destinationFolder = ""
  34.  
  35. switch ($emulator.ToLower()) {
  36.     "lime3ds" {
  37.         $destinationFolder = "$env:USERPROFILE\AppData\Roaming\Lime3DS\cheats"
  38.     }
  39.     "pablomk7's citra" {
  40.         $destinationFolder = "$env:USERPROFILE\AppData\Roaming\Citra\cheats"
  41.     }
  42.     "old citra" {
  43.         $destinationFolder = "$env:USERPROFILE\AppData\Roaming\Citra\cheats"
  44.     }
  45.     default {
  46.         Write-Host "Invalid emulator. Please choose 'Lime3DS' or 'PabloMK7's Citra'" -ForegroundColor Red
  47.         Exit
  48.     }
  49. }
  50.  
  51. # Check if the destination folder exists, and if not, create it
  52. if (-not (Test-Path $destinationFolder)) {
  53.     New-Item -Path $destinationFolder -ItemType Directory | Out-Null
  54. }
  55.  
  56. # Confirm with the user if they want to proceed with the copy
  57. $continueCopy = Read-Host "Do you want to continue copying the files (YES/NO)?"
  58. if ($continueCopy.ToUpper() -eq "YES") {
  59.     Write-Host "Start copying .txt files to the destination folder: $destinationFolder" -ForegroundColor Yellow
  60.    
  61.     # Start copying .txt files to the destination folder
  62.     foreach ($file in $txtFiles) {
  63.         Copy-Item -Path $file.FullName -Destination $destinationFolder -Force
  64.     }
  65.  
  66.     # Delete the temporary folder after completing the copy
  67.     Remove-Item -Path $tempFolder -Recurse -Force
  68.    
  69.     # Inform the user that the copy is complete
  70.     Write-Host "Copy completed. Press OK." -ForegroundColor Green
  71. } else {
  72.     Write-Host "The copy was cancelled. Press OK" -ForegroundColor Red
  73.  
  74.     # Delete the temporary folder even if the copy is canceled
  75.     Remove-Item -Path $tempFolder -Recurse -Force
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement