0% found this document useful (0 votes)
229 views2 pages

Cheats Installer (Source Code)

The document provides a PowerShell script that downloads a ZIP file containing cheat codes, unzips it, and searches for .txt files within a specified 'Cheats' folder. It prompts the user to select their emulator and determines the appropriate destination folder for the cheat files. The script then offers to copy the .txt files to the chosen location and cleans up temporary files afterward.

Uploaded by

ojtheidotmail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
229 views2 pages

Cheats Installer (Source Code)

The document provides a PowerShell script that downloads a ZIP file containing cheat codes, unzips it, and searches for .txt files within a specified 'Cheats' folder. It prompts the user to select their emulator and determines the appropriate destination folder for the cheat files. The script then offers to copy the .txt files to the chosen location and cleans up temporary files afterward.

Uploaded by

ojtheidotmail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

# Step 1 - Download and unzip the ZIP file into a temporary folder

$zipUrl = "https://github.com/iSharingan/CTRPF-AR-CHEAT-CODES/archive/refs/heads/
master.zip"
$tempFolder = [System.IO.Path]::Combine($env:TEMP, "CTRPF-AR-CHEAT-CODES")
$zipPath = [System.IO.Path]::Combine($tempFolder, "master.zip")

# Create temporary folder


if (-not (Test-Path $tempFolder)) {
New-Item -Path $tempFolder -ItemType Directory | Out-Null
}

# Download the ZIP file


Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath

# Unzip the file into the temporary folder


Expand-Archive -Path $zipPath -DestinationPath $tempFolder -Force

# Step 2 - Access the "Cheats" folder


$cheatsFolder = [System.IO.Path]::Combine($tempFolder, "CTRPF-AR-CHEAT-CODES-
master", "Cheats")
if (-not (Test-Path $cheatsFolder)) {
Write-Host "Error: Cheats folder not found." -ForegroundColor Red
Exit
}

# Step 3 - Search for .txt files in the "Cheats" folder and subfolders
$txtFiles = Get-ChildItem -Path $cheatsFolder -Recurse -Filter *.txt
if (-not $txtFiles) {
Write-Host "No .txt files were found in the Cheats folder." -ForegroundColor
Red
Exit
}

# Step 4 - Ask the user which emulator they use to select the destination folder
$emulator = Read-Host "Choose fork:Old Citra,Lime3DS or PabloMK7's Citra."
$destinationFolder = ""

switch ($emulator.ToLower()) {
"lime3ds" {
$destinationFolder = "$env:USERPROFILE\AppData\Roaming\Lime3DS\cheats"
}
"pablomk7's citra" {
$destinationFolder = "$env:USERPROFILE\AppData\Roaming\Citra\cheats"
}
"old citra" {
$destinationFolder = "$env:USERPROFILE\AppData\Roaming\Citra\cheats"
}
default {
Write-Host "Invalid emulator. Please choose 'Lime3DS' or 'PabloMK7's
Citra'" -ForegroundColor Red
Exit
}
}

# Check if the destination folder exists, and if not, create it


if (-not (Test-Path $destinationFolder)) {
New-Item -Path $destinationFolder -ItemType Directory | Out-Null
}
# Confirm with the user if they want to proceed with the copy
$continueCopy = Read-Host "Do you want to continue copying the files (YES/NO)?"
if ($continueCopy.ToUpper() -eq "YES") {
Write-Host "Start copying .txt files to the destination folder:
$destinationFolder" -ForegroundColor Yellow

# Start copying .txt files to the destination folder


foreach ($file in $txtFiles) {
Copy-Item -Path $file.FullName -Destination $destinationFolder -Force
}

# Delete the temporary folder after completing the copy


Remove-Item -Path $tempFolder -Recurse -Force

# Inform the user that the copy is complete


Write-Host "Copy completed. Press OK." -ForegroundColor Green
} else {
Write-Host "The copy was cancelled. Press OK" -ForegroundColor Red

# Delete the temporary folder even if the copy is canceled


Remove-Item -Path $tempFolder -Recurse -Force
}

You might also like