Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Define paths and filenames
- $pkgPath = ".\Game.pkg"
- $extractPath = ".\ExtractedFiles"
- $workingDir = ".\WorkingDirectory"
- $isoPath = ".\Base.iso"
- $repackedIsoPath = ".\Repacked.iso"
- $sevenZipUrl = "https://www.7-zip.org/a/7z2201-x64.exe"
- $mkisofsUrl = "https://downloads.sourceforge.net/project/cdrtools/cdrtools/3.02a09/cdrtools-3.02a09-win32-bin.zip"
- $signingScriptUrl = "https://example.com/signing-script.ps1" # Placeholder URL for signing script
- # Define tool paths
- $sevenZipPath = "C:\Program Files\7-Zip\7z.exe"
- $mkisofsPath = "C:\Program Files\mkisofs\mkisofs.exe"
- $signingScriptPath = "$env:TEMP\signing-script.ps1"
- $ps3InstallPath = "$env:ProgramFiles\PS3ModdingTool"
- $ps3ScriptPath = "$ps3InstallPath\ps3.ps1"
- $shortcutPath = "$env:Public\Desktop\PS3.lnk"
- # Function to download a file
- function Download-File {
- param (
- [string]$url,
- [string]$outputPath
- )
- try {
- Write-Host "Downloading $url..."
- Invoke-WebRequest -Uri $url -OutFile $outputPath -ErrorAction Stop
- } catch {
- Write-Error "Failed to download $url. $_"
- exit 1
- }
- }
- # Function to install 7-Zip
- function Install-SevenZip {
- Write-Host "Installing 7-Zip..."
- $zipInstaller = "$env:TEMP\7zInstaller.exe"
- Download-File -url $sevenZipUrl -outputPath $zipInstaller
- try {
- Start-Process -FilePath $zipInstaller -ArgumentList "/S" -Wait -ErrorAction Stop
- Remove-Item -Path $zipInstaller -ErrorAction Stop
- } catch {
- Write-Error "Failed to install 7-Zip. $_"
- exit 1
- }
- }
- # Function to install mkisofs
- function Install-Mkisofs {
- Write-Host "Installing mkisofs..."
- $zipInstaller = "$env:TEMP\cdrtools.zip"
- Download-File -url $mkisofsUrl -outputPath $zipInstaller
- try {
- Expand-Archive -Path $zipInstaller -DestinationPath "$env:ProgramFiles" -ErrorAction Stop
- Remove-Item -Path $zipInstaller -ErrorAction Stop
- } catch {
- Write-Error "Failed to install mkisofs. $_"
- exit 1
- }
- }
- # Function to install signing script
- function Install-SigningScript {
- Write-Host "Installing signing script..."
- Download-File -url $signingScriptUrl -outputPath $signingScriptPath
- }
- # Check and install necessary tools
- if (-not (Test-Path $sevenZipPath)) {
- Install-SevenZip
- }
- if (-not (Test-Path $mkisofsPath)) {
- Install-Mkisofs
- }
- if (-not (Test-Path $signingScriptPath)) {
- Install-SigningScript
- }
- # Ensure necessary directories exist
- if (-not (Test-Path $extractPath)) { New-Item -ItemType Directory -Path $extractPath -ErrorAction Stop }
- if (-not (Test-Path $workingDir)) { New-Item -ItemType Directory -Path $workingDir -ErrorAction Stop }
- # Extract PKG file
- Write-Host "Extracting PKG file..."
- try {
- & $sevenZipPath x $pkgPath -o$extractPath -y
- if ($LASTEXITCODE -ne 0) { throw "Extraction failed with exit code $LASTEXITCODE." }
- } catch {
- Write-Error "Extraction failed. $_"
- exit 1
- }
- # Allow user to modify files
- Write-Host "Please modify the files in $workingDir. Press Enter when done..."
- Read-Host
- # Re-sign files
- Write-Host "Re-signing files..."
- try {
- & powershell -ExecutionPolicy Bypass -File $signingScriptPath -Path $workingDir
- if ($LASTEXITCODE -ne 0) { throw "Re-signing failed with exit code $LASTEXITCODE." }
- } catch {
- Write-Error "Re-signing failed. $_"
- exit 1
- }
- # Repack the ISO
- Write-Host "Repacking ISO file..."
- try {
- & $mkisofsPath -o $repackedIsoPath -R -J -V "GameISO" "$workingDir"
- if ($LASTEXITCODE -ne 0) { throw "ISO repackaging failed with exit code $LASTEXITCODE." }
- } catch {
- Write-Error "ISO repackaging failed. $_"
- exit 1
- }
- # Calculate checksum
- Write-Host "Calculating checksum..."
- try {
- $hash = Get-FileHash -Path $repackedIsoPath -Algorithm SHA256
- Write-Host "Checksum: $($hash.Hash)"
- } catch {
- Write-Error "Checksum calculation failed. $_"
- exit 1
- }
- # Display completion message
- function Show-Message {
- Write-Host "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣷⣶⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀"
- Write-Host "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⠿⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀"
- Write-Host "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀"
- Write-Host "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀"
- Write-Host "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀"
- Write-Host "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⠈⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀"
- Write-Host "⠀⠀⠀⠀⠀⠀⠀⣀⣤⣴⣿⣿⣿⣿⡇⠀⢠⣶⣿⣿⣿⠿⠿⢿⣶⣦⣤⡀"
- Write-Host "⢰⣿⣿⣿⣿⠿⠛⠛⠉⠀⣿⣿⣿⣿⡇⠀⠘⠛⠛⠋⠉⠙⢛⠻⠿⠛⠋⠀"
- Write-Host "⠈⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀"
- Write-Host " Made By Taylor Christian Newsome"
- }
- Show-Message
- Write-Host "Process completed successfully."
- # Install PS3 command
- function Install-PS3Tool {
- if (-not (Test-Path $ps3InstallPath)) {
- New-Item -ItemType Directory -Path $ps3InstallPath -ErrorAction Stop
- }
- Copy-Item -Path $MyInvocation.MyCommand.Path -Destination $ps3ScriptPath -ErrorAction Stop
- # Create executable for easy access
- if (-not (Test-Path $shortcutPath)) {
- try {
- $WshShell = New-Object -ComObject WScript.Shell
- $Shortcut = $WshShell.CreateShortcut($shortcutPath)
- $Shortcut.TargetPath = "powershell.exe"
- $Shortcut.Arguments = "-ExecutionPolicy Bypass -File `"$ps3ScriptPath`""
- $Shortcut.WorkingDirectory = $ps3InstallPath
- $Shortcut.IconLocation = "powershell.exe,0"
- $Shortcut.Save()
- } catch {
- Write-Error "Failed to create desktop shortcut. $_"
- exit 1
- }
- }
- }
- Install-PS3Tool
- # Help function
- function Show-Help {
- Write-Host "PS3 Modding Tool - Command Line Options"
- Write-Host ""
- Write-Host "Usage:"
- Write-Host " ps3 : Start the PS3 Modding Tool"
- Write-Host " ps3 -h, --help : Show this help message"
- Write-Host ""
- Write-Host "Description:"
- Write-Host " This tool allows you to mod PS3 games by extracting, modifying, and repacking game files."
- Write-Host ""
- Write-Host "Installation:"
- Write-Host " The tool will install necessary components and create a desktop shortcut for easy access."
- Write-Host ""
- Write-Host "Examples:"
- Write-Host " ps3 : Run the tool"
- Write-Host " ps3 -h : Show this help message"
- }
- # Command-line arguments
- if ($args.Count -eq 0) {
- Show-Help
- } elseif ($args[0] -eq '-h' -or $args[0] -eq '--help') {
- Show-Help
- } else {
- Write-Host "Unknown argument: $($args[0])"
- Show-Help
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement