diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 1f2bb9a..47d330e 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -1,10 +1,12 @@ -name: 'Build' +name: 'Run Script' on: push: - branches: [master, dev, test] - # schedule: - # - cron: "0 0 */2 * *" + branches: + - master + - dev + schedule: + - cron: "0 0 */2 * *" jobs: @@ -12,9 +14,20 @@ jobs: build: runs-on: windows-latest + + if: | + github.event_name == 'push' || + (github.event_name == 'schedule' && github.ref == 'refs/heads/master') + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + - name: Install Dependencies + run: .\prepare.ps1 -installDependencies + + - name: Acquire Files + run: .\prepare.ps1 -acquireFiles - - name: Powershell script runner - run: .\prepare.ps1 + - name: Setup ROMs + run: .\prepare.ps1 -setupRoms diff --git a/README.md b/README.md index e4b80d9..e6f93c1 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ EmulationStation configured for Windows An auto-installer to set up Emulation Station correctly on a 64-bit version of Windows 10/11 +TO-DO: Test this once merged to master +``` +if (-Not (Test-Path C:\temp\es-setup)) { mkdir C:\temp\es-setup }; Set-Location C:\temp\es-setup\;Set-ExecutionPolicy Bypass -Scope Process -Force;[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;Invoke-WebRequest "https://github.com/Francommit/win10_emulation_station/archive/master.zip" -OutFile "emulationStation.zip";Expand-Archive .\emulationStation.zip;cd .\emulationStation; cd .\win*;.\prepare.ps1 +``` + Features ------ - Uses an up to date version of Emulation Station from the Raspberry Pi branch diff --git a/icon.png b/icon.png index 938ba60..dabddd7 100644 Binary files a/icon.png and b/icon.png differ diff --git a/prepare.ps1 b/prepare.ps1 index 3c8f8d7..6827e41 100644 --- a/prepare.ps1 +++ b/prepare.ps1 @@ -1,14 +1,27 @@ +# Set vars +$global:scriptDir = $null +$global:citraInstallDir = $null +$global:ppssppInstallDir = $null +$global:yuzuInstallDir = $null +$global:rpcs3InstallDir = $null +$global:requirementsFolder = "$PSScriptRoot\requirements" +$global:retroArchPath = "$env:userprofile\.emulationstation\systems\retroarch\" +$global:retroarchExecutable = "$global:retroArchPath\retroarch.exe" +$global:retroarchConfigPath = "$global:retroArchPath\retroarch.cfg" +$global:coresPath = "$global:retroArchPath\cores" +$global:retroArchBinary = "$global:requirementsFolder\RetroArch.7z" +$global:romPath = "$env:userprofile\.emulationstation\roms" + function DownloadFiles { param ([String]$jsonDownloadOption) - Write-Host "Starting downloading of $jsonDownloadOption" - - Get-Content "$scriptDir\download_list.json" | ConvertFrom-Json | Select-Object -expand $jsonDownloadOption | ForEach-Object { + Write-Output "INFO:Starting downloading of $jsonDownloadOption" + Get-Content "$global:scriptDir\download_list.json" | ConvertFrom-Json | Select-Object -expand $jsonDownloadOption | ForEach-Object { $url = $_.url $file = $_.file - $output = "$requirementsFolder\$file" + $output = "$global:requirementsFolder\$file" if(![System.IO.File]::Exists($output)){ @@ -48,7 +61,7 @@ function DownloadFiles { function GithubReleaseFiles { - Get-Content "$scriptDir\download_list.json" | ConvertFrom-Json | Select-Object -expand releases | ForEach-Object { + Get-Content "$global:scriptDir\download_list.json" | ConvertFrom-Json | Select-Object -expand releases | ForEach-Object { $repo = $_.repo $file = $_.file @@ -56,7 +69,7 @@ function GithubReleaseFiles { $tag = (Invoke-WebRequest $releases -usebasicparsing| ConvertFrom-Json)[0].tag_name $url = "https://github.com/$repo/releases/download/$tag/$file" - $output = "$requirementsFolder\$file" + $output = "$global:requirementsFolder\$file" if(![System.IO.File]::Exists($output)) { @@ -77,558 +90,557 @@ function GithubReleaseFiles { function Expand-Archive([string]$Path, [string]$Destination, [bool]$VerboseLogging = $false) { $7z_Application = "C:\Program Files\7-Zip\7z.exe" $7z_Arguments = @( - 'x', # eXtract files with full paths - '-y', # assume Yes on all queries - "`"-o$($Destination)`"", # set Output directory - "`"$($Path)`"" # + 'x', # eXtract files with full paths + '-y', # assume Yes on all queries + "-o$($Destination)", # set Output directory + "$Path" # ) - Write-Output "Extracting file: $Path to destination: $Destination" - - if ($VerboseLogging) { - & $7z_Application $7z_Arguments - if ($LASTEXITCODE -ne 0) { - throw "7-Zip exited with code $LASTEXITCODE" - } + Write-Output "INFO: Extracting file: $Path to destination: $Destination" + + if (-not (Test-Path -Path $Destination -PathType Container)) { + Write-Output "INFO: Destination path does not exist, creating: $Destination" + New-Item -ItemType Directory -Path $Destination -Force } else { - & $7z_Application $7z_Arguments | Out-Null + Write-Output "INFO: Destination path already exists" } -} -# Get script path -$scriptPath = $MyInvocation.MyCommand.Path -$scriptDir = Split-Path $scriptPath -Write-Host "INFO: Script directory is: $scriptDir" - -Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - -choco install git -y | Out-Null + & $7z_Application $7z_Arguments + if ($LASTEXITCODE -ne 0) { + throw "7-Zip exited with code $LASTEXITCODE" + } -# Install and setup scoop -if($env:path -match "scoop"){ - Write-Host "INFO: Scoop appears to be installed, skipping installation" -} else { - Write-Host "INFO: Scoop not detected, installing scoop" - iwr -useb get.scoop.sh -outfile 'installScoop.ps1' - .\installScoop.ps1 -RunAsAdmin } -Write-Host "INFO: Running Scoop Bucket Workaround" -# https://github.com/ScoopInstaller/Scoop/issues/4917#issuecomment-1125400640 -scoop bucket rm main -scoop bucket add main - -Write-Host "INFO: Adding scoop bucket" -scoop bucket add emulators https://github.com/borger/scoop-emulators.git -Write-Host "INFO: Installing Citra" -scoop install citra -scoop install ppsspp-dev -scoop install yuzu -scoop install rpcs3 - -$citraInstallDir = "$env:userprofile\scoop\apps\citra\current" -$ppssppInstallDir = "$env:userprofile\scoop\apps\ppsspp\current" -$yuzuInstallDir = "$env:userprofile\scoop\apps\yuzu\current" -$rpcs3InstallDir = "$env:userprofile\scoop\apps\rpcs3\current" - -choco install 7zip --no-progress -y | Out-Null -choco install dolphin --pre --no-progress -y | Out-Null -choco install cemu --no-progress -y | Out-Null - -# Acquire files -$requirementsFolder = "$PSScriptRoot\requirements" -New-Item -ItemType Directory -Force -Path $requirementsFolder -DownloadFiles("downloads") -DownloadFiles("other_downloads") -GithubReleaseFiles - -# Install Emulation Station -Write-Host "INFO: Starting Emulation station to generate config" -Start-Process "$requirementsFolder\emulationstation_win32_latest.exe" -ArgumentList "/S" -Wait - -# Generate Emulation Station config file -& "${env:ProgramFiles(x86)}\EmulationStation\emulationstation.exe" -while (!(Test-Path "$env:userprofile\.emulationstation\es_systems.cfg")) { - Write-Host "INFO: Checking for config file..." - Start-Sleep 10 +function Get-ScriptPath { + param ( + [string]$ScriptPath + ) + $global:scriptDir = Split-Path $ScriptPath + Write-Host "INFO: Script directory is: $global:scriptDir" } -Write-Host "INFO: Config file generated" -Stop-Process -Name "emulationstation" - -##### -# Retroarch -##### -# Prepare Retroarch -$retroArchPath = "$env:userprofile\.emulationstation\systems\retroarch\" -$coresPath = "$retroArchPath\cores" -$retroArchBinary = "$requirementsFolder\RetroArch.7z" -if(Test-Path $retroArchBinary){ - New-Item -ItemType Directory -Force -Path $retroArchPath - Expand-Archive -Path $retroArchBinary -Destination $requirementsFolder -VerboseLogging $true - # TO-DO - add an Out-Null when this has been tested - Copy-Item -Path RetroArch-Win64\* -Destination $retroArchPath -recurse -Force - # New path - $retroArchPath\RetroArch-Win64 - -} else { - Write-Host "ERROR: $retroArchBinary not found." - exit -1 + +function Install-Chocolatey { + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + choco install git -y | Out-Null } +function InstallScoop { + if($env:path -match "scoop"){ + Write-Host "INFO: Scoop appears to be installed, skipping installation" + } else { + Write-Host "INFO: Scoop not detected, installing scoop" + Invoke-WebRequest -useb get.scoop.sh -outfile 'installScoop.ps1' + .\installScoop.ps1 -RunAsAdmin + } -# NES Setup -$nesCore = "$requirementsFolder\fceumm_libretro.dll.zip" -if(Test-Path $nesCore){ - Expand-Archive -Path $nesCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $nesCore not found." - exit -1 } -# N64 Setup -$n64Core = "$requirementsFolder\parallel_n64_libretro.dll.zip" -if(Test-Path $n64Core){ - Expand-Archive -Path $n64Core -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $n64Core not found." - exit -1 -} +function ConfigureScoop { + Write-Host "INFO: Running Scoop Bucket Workaround" + # https://github.com/ScoopInstaller/Scoop/issues/4917#issuecomment-1125400640 + scoop bucket rm main + scoop bucket add main -# FBA Setup -$fbaCore = "$requirementsFolder\fbalpha2012_libretro.dll.zip" -if(Test-Path $fbaCore){ - Expand-Archive -Path $fbaCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $fbaCore not found." - exit -1 -} + Write-Host "INFO: Adding scoop bucket" + scoop bucket add emulators https://github.com/borger/scoop-emulators.git + + # TO-DO: Find alternative 3DS emu + # scoop install citra-canary + # if ($LASTEXITCODE -ne 0) { + # throw "Scoop install failed." + # } + + scoop install ppsspp + if ($LASTEXITCODE -ne 0) { + throw "Scoop install failed." + } -# GBA Setup -$gbaCore = "$requirementsFolder\vba_next_libretro.dll.zip" -if(Test-Path $gbaCore){ - Expand-Archive -Path $gbaCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $gbaCore not found." - exit -1 -} + scoop install rpcs3 + if ($LASTEXITCODE -ne 0) { + throw "Scoop install failed." + } -# SNES Setup -$snesCore = "$requirementsFolder\snes9x_libretro.dll.zip" -if(Test-Path $snesCore){ - Expand-Archive -Path $snesCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $snesCore not found." - exit -1 -} + scoop install ryujinx + if ($LASTEXITCODE -ne 0) { + throw "Scoop install failed." + } -# Genesis GX Setup -$mdCore = "$requirementsFolder\genesis_plus_gx_libretro.dll.zip" -if(Test-Path $mdCore){ - Expand-Archive -Path $mdCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $mdCore not found." - exit -1 } -# Game boy Colour Setup -$gbcCore = "$requirementsFolder\gambatte_libretro.dll.zip" -if(Test-Path $gbcCore){ - Expand-Archive -Path $gbcCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $gbcCore not found." - exit -1 +function Install-AdditionalSoftware { + choco install 7zip --no-progress -y | Out-Null + choco install dolphin --pre --no-progress -y | Out-Null + choco install cemu --no-progress -y | Out-Null } -# Atari2600 Setup -$atari2600Core = "$requirementsFolder\stella_libretro.dll.zip" -if(Test-Path $atari2600Core){ - Expand-Archive -Path $atari2600Core -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $atari2600Core not found." - exit -1 +function AcquireFiles { + New-Item -ItemType Directory -Force -Path $global:requirementsFolder + DownloadFiles("downloads") + DownloadFiles("other_downloads") + GithubReleaseFiles } -# MAME Setup -$mameCore = "$requirementsFolder\mame2010_libretro.dll.zip" -if(Test-Path $mameCore){ - Expand-Archive -Path $mameCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $mameCore not found." - exit -1 -} +function Install-EmulationStation { + Write-Host "INFO: Starting Emulation station to generate config" + Start-Process "$global:requirementsFolder\emulationstation_win32_latest.exe" -ArgumentList "/S" -Wait + + # Generate Emulation Station config file + & "${env:ProgramFiles(x86)}\EmulationStation\emulationstation.exe" + while (!(Test-Path "$env:userprofile\.emulationstation\es_systems.cfg")) { + Write-Host "INFO: Checking for config file..." + Start-Sleep 10 + } + Write-Host "INFO: Config file generated" + Stop-Process -Name "emulationstation" -# PSX Setup -$psxEmulator = "$requirementsFolder\ePSXe205.zip" -if(Test-Path $psxEmulator){ - $psxEmulatorPath = "$env:userprofile\.emulationstation\systems\epsxe\" - $psxBiosPath = $psxEmulatorPath + "bios\" - New-Item -ItemType Directory -Force -Path $psxEmulatorPath | Out-Null - Expand-Archive -Path $psxEmulator -Destination $psxEmulatorPath | Out-Null -} else { - Write-Host "ERROR: $psxEmulator not found." - exit -1 } -# PS2 Setup -$ps2EmulatorMsi = "$requirementsFolder\pcsx2-1.6.0-setup.exe" -if(Test-Path $ps2EmulatorMsi){ - $ps2EmulatorPath = "$env:userprofile\.emulationstation\systems\pcsx2\" - $ps2Binary = "$ps2EmulatorPath\`$TEMP\PCSX2 1.6.0\pcsx2.exe" - $ps2BiosPath = "$ps2EmulatorPath\bios\" - Expand-Archive -Path $ps2EmulatorMsi -Destination $ps2EmulatorPath | Out-Null - New-Item -ItemType Directory -Force -Path $ps2BiosPath | Out-Null -} else { - Write-Host "ERROR: $ps2EmulatorMsi not found." - exit -1 +function Setup-EmulatorCores { + # Retroarch Setup + + + if(Test-Path $global:retroArchBinary){ + New-Item -ItemType Directory -Force -Path $global:retroArchPath + Expand-Archive -Path $global:retroArchBinary -Destination $global:requirementsFolder -VerboseLogging $true + Copy-Item -Path $global:requirementsFolder\RetroArch-Win64\* -Destination $global:retroArchPath -recurse -Force + } else { + Write-Host "ERROR: $global:retroArchBinary not found." + exit -1 + } + + # NES Setup + Setup-EmulatorCore "fceumm_libretro.dll.zip" "fceumm_libretro.dll.zip" + + # N64 Setup + Setup-EmulatorCore "parallel_n64_libretro.dll.zip" "parallel_n64_libretro.dll.zip" + + # FBA Setup + Setup-EmulatorCore "fbalpha2012_libretro.dll.zip" "fbalpha2012_libretro.dll.zip" + + # GBA Setup + Setup-EmulatorCore "vba_next_libretro.dll.zip" "vba_next_libretro.dll.zip" + + # SNES Setup + Setup-EmulatorCore "snes9x_libretro.dll.zip" "snes9x_libretro.dll.zip" + + # Genesis GX Setup + Setup-EmulatorCore "genesis_plus_gx_libretro.dll.zip" "genesis_plus_gx_libretro.dll.zip" + + # Game boy Colour Setup + Setup-EmulatorCore "gambatte_libretro.dll.zip" "gambatte_libretro.dll.zip" + + # Atari2600 Setup + Setup-EmulatorCore "stella_libretro.dll.zip" "stella_libretro.dll.zip" + + # MAME Setup + Setup-EmulatorCore "mame2010_libretro.dll.zip" "mame2010_libretro.dll.zip" + + # NeoGeo Pocket Setup + Setup-EmulatorCore "race_libretro.dll.zip" "race_libretro.dll.zip" + + # PSX Setup + $psxEmulator = "$global:requirementsFolder\ePSXe205.zip" + if(Test-Path $psxEmulator){ + $psxEmulatorPath = "$env:userprofile\.emulationstation\systems\epsxe\" + $psxBiosPath = $psxEmulatorPath + "bios\" + New-Item -ItemType Directory -Force -Path $psxEmulatorPath | Out-Null + Expand-Archive -Path $psxEmulator -Destination $psxEmulatorPath | Out-Null + } else { + Write-Host "ERROR: $psxEmulator not found." + exit -1 + } + + # PS2 Setup + $ps2EmulatorMsi = "$global:requirementsFolder\pcsx2-1.6.0-setup.exe" + if(Test-Path $ps2EmulatorMsi){ + $ps2EmulatorPath = "$env:userprofile\.emulationstation\systems\pcsx2\" + $ps2Binary = "$ps2EmulatorPath\`$TEMP\PCSX2 1.6.0\pcsx2.exe" + $ps2BiosPath = "$ps2EmulatorPath\bios\" + Expand-Archive -Path $ps2EmulatorMsi -Destination $ps2EmulatorPath | Out-Null + New-Item -ItemType Directory -Force -Path $ps2BiosPath | Out-Null + } else { + Write-Host "ERROR: $ps2EmulatorMsi not found." + exit -1 + } } -# NeoGeo Pocket Setup -$ngpCore = "$requirementsFolder\race_libretro.dll.zip" -if(Test-Path $ngpCore){ - Expand-Archive -Path $ngpCore -Destination $coresPath | Out-Null -} else { - Write-Host "ERROR: $ngpCore not found." - exit -1 +function Setup-EmulatorCore([string]$coreName, [string]$zipFileName) { + $corePath = "$global:requirementsFolder\$zipFileName" + if(Test-Path $corePath){ + Expand-Archive -Path $corePath -Destination $global:coresPath | Out-Null + } else { + Write-Host "ERROR: $corePath not found." + exit -1 + } } -# Start Retroarch and generate a config. -$retroarchExecutable = "$retroArchPath\retroarch.exe" -$retroarchConfigPath = "$retroArchPath\retroarch.cfg" +function Start-RetroarchAndGenerateConfig { + # Start Retroarch and generate a config. -if (Test-Path $retroarchExecutable) { - - Write-Host "INFO: Retroarch executable found, launching" - Start-Process $retroarchExecutable - - while (!(Test-Path $retroarchConfigPath)) { - Write-Host "INFO: Checking for retroarch config file" - Start-Sleep 5 - } + if (Test-Path $global:retroarchExecutable) { - $retroarchProcess = Get-Process retroarch.exe -ErrorAction SilentlyContinue - if ($retroarchProcess) { - $retroarchProcess.CloseMainWindow() - Start-sleep 5 - if (!$retroarchProcess.HasExited) { - $retroarchProcess | Stop-Process -Force + Write-Host "INFO: Retroarch executable found, launching" + Start-Process $global:retroarchExecutable + + while (!(Test-Path $global:retroarchConfigPath)) { + Write-Host "INFO: Checking for retroarch config file" + Start-Sleep 5 } + + $retroarchProcess = Get-Process retroarch.exe -ErrorAction SilentlyContinue + if ($retroarchProcess) { + $retroarchProcess.CloseMainWindow() + Start-sleep 5 + if (!$retroarchProcess.HasExited) { + $retroarchProcess | Stop-Process -Force + } + } + Stop-Process -Name "retroarch" -ErrorAction SilentlyContinue + + } + else { + Write-Host "ERROR: Could not find retroarch.exe" + exit -1 } - Stop-Process -Name "retroarch" -ErrorAction SilentlyContinue -} else { - Write-Host "ERROR: Could not find retroarch.exe" - exit -1 -} + # Tweak retroarch config! + Write-Host "INFO: Replacing retroarch config" + $settingToFind = 'video_fullscreen = "false"' + $settingToSet = 'video_fullscreen = "true"' + (Get-Content $global:retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $global:retroarchConfigPath + $settingToFind = 'savestate_auto_load = "false"' + $settingToSet = 'savestate_auto_load = "true"' + (Get-Content $global:retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $global:retroarchConfigPath -# Tweak retroarch config! -Write-Host "INFO: Replacing retroarch config" -$settingToFind = 'video_fullscreen = "false"' -$settingToSet = 'video_fullscreen = "true"' -(Get-Content $retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $retroarchConfigPath - -$settingToFind = 'savestate_auto_load = "false"' -$settingToSet = 'savestate_auto_load = "true"' -(Get-Content $retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $retroarchConfigPath - -$settingToFind = 'input_player1_analog_dpad_mode = "0"' -$settingToSet = 'input_player1_analog_dpad_mode = "1"' -(Get-Content $retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $retroarchConfigPath - -$settingToFind = 'input_player2_analog_dpad_mode = "0"' -$settingToSet = 'input_player2_analog_dpad_mode = "1"' -(Get-Content $retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $retroarchConfigPath - -# Add roms -$romPath = "$env:userprofile\.emulationstation\roms" -New-Item -ItemType Directory -Force -Path $romPath | Out-Null - -# Path creation + Open-Source / Freeware Rom population -Write-Host "INFO: Setup NES" -$nesPath = "$romPath\nes" -$nesRom = "$requirementsFolder\assimilate_full.zip" -if(Test-Path $nesRom){ - New-Item -ItemType Directory -Force -Path $nesPath | Out-Null - Expand-Archive -Path $nesRom -Destination $nesPath | Out-Null -} else { - Write-Host "ERROR: $nesRom not found." - exit -1 -} + $settingToFind = 'input_player1_analog_dpad_mode = "0"' + $settingToSet = 'input_player1_analog_dpad_mode = "1"' + (Get-Content $global:retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $global:retroarchConfigPath -Write-Host "INFO: Setup N64" -$n64Path = "$romPath\n64" -$n64Rom = "$requirementsFolder\pom-twin.zip" -if(Test-Path $n64Rom){ - New-Item -ItemType Directory -Force -Path $n64Path | Out-Null - Expand-Archive -Path $n64Rom -Destination $n64Path | Out-Null -} else { - Write-Host "ERROR: $n64Rom not found." - exit -1 + $settingToFind = 'input_player2_analog_dpad_mode = "0"' + $settingToSet = 'input_player2_analog_dpad_mode = "1"' + (Get-Content $global:retroarchConfigPath) -replace $settingToFind, $settingToSet | Set-Content $global:retroarchConfigPath } -Write-Host "INFO: Setup psp" -$pspPath = "$romPath\psp" -$pspRom = "$requirementsFolder\cube.elf" -if (Test-Path $pspRom) { - New-Item -ItemType Directory -Force -Path $pspPath | Out-Null - Move-Item -Path $pspRom -Destination $pspPath -Force | Out-Null -} -else { - Write-Host "ERROR: $pspRom not found." - exit -1 -} +function Setup-Roms { + # Add roms + + New-Item -ItemType Directory -Force -Path $global:romPath | Out-Null + + # Path creation + Open-Source / Freeware Rom population + Write-Host "INFO: Setup NES" + $nesPath = "$global:romPath\nes" + $nesRom = "$global:requirementsFolder\assimilate_full.zip" + if (Test-Path $nesRom) { + New-Item -ItemType Directory -Force -Path $nesPath | Out-Null + Expand-Archive -Path $nesRom -Destination $nesPath | Out-Null + } + else { + Write-Host "ERROR: $nesRom not found." + exit -1 + } -Write-Host "INFO: Setup Nintendo Switch" -$switchPath = "$romPath\switch" -$switchRom = "$requirementsFolder\tetriswitch.nro" -if (Test-Path $switchRom) { - New-Item -ItemType Directory -Force -Path $switchPath | Out-Null - Move-Item -Path $switchRom -Destination $switchPath -Force | Out-Null -} -else { - Write-Host "ERROR: $switchRom not found." - exit -1 -} + Write-Host "INFO: Setup N64" + $n64Path = "$global:romPath\n64" + $n64Rom = "$global:requirementsFolder\pom-twin.zip" + if (Test-Path $n64Rom) { + New-Item -ItemType Directory -Force -Path $n64Path | Out-Null + Expand-Archive -Path $n64Rom -Destination $n64Path | Out-Null + } + else { + Write-Host "ERROR: $n64Rom not found." + exit -1 + } -Write-Host "INFO: Setup PS3" -$ps3Path = "$romPath\ps3" -$ps3Rom = "$requirementsFolder\Avoidance_v1.3.pkg" -if (Test-Path $ps3Rom) { - New-Item -ItemType Directory -Force -Path $ps3Path | Out-Null - Move-Item -Path $ps3Rom -Destination $ps3Path | Out-Null -} -else { - Write-Host "ERROR: $ps3Rom not found." - exit -1 -} + Write-Host "INFO: Setup psp" + $pspPath = "$global:romPath\psp" + $pspRom = "$global:requirementsFolder\cube.elf" + if (Test-Path $pspRom) { + New-Item -ItemType Directory -Force -Path $pspPath | Out-Null + Move-Item -Path $pspRom -Destination $pspPath -Force | Out-Null + } + else { + Write-Host "ERROR: $pspRom not found." + exit -1 + } -Write-Host "INFO: Setup PS Vita" -$vitaPath = "$romPath\vita" -$vitaRom = "$requirementsFolder\C4.vpk" -if (Test-Path $vitaRom) { - New-Item -ItemType Directory -Force -Path $vitaPath | Out-Null - Move-Item -Path $vitaRom -Destination $vitaPath -Force | Out-Null -} -else { - Write-Host "ERROR: $vitaRom not found." - exit -1 -} + Write-Host "INFO: Setup Nintendo Switch" + $switchPath = "$global:romPath\switch" + $switchRom = "$global:requirementsFolder\tetriswitch.nro" + if (Test-Path $switchRom) { + New-Item -ItemType Directory -Force -Path $switchPath | Out-Null + Move-Item -Path $switchRom -Destination $switchPath -Force | Out-Null + } + else { + Write-Host "ERROR: $switchRom not found." + exit -1 + } -Write-Host "INFO: Setup Vita3k" -$vita3kInstallFolder = "${env:ProgramFiles}\Vita3k" -if(-not(Test-Path $vita3kInstallFolder)){ - New-Item -ItemType Directory -Force -Path $vita3kInstallFolder | Out-Null -} + Write-Host "INFO: Setup PS3" + $ps3Path = "$global:romPath\ps3" + $ps3Rom = "$global:requirementsFolder\Avoidance_v1.3.pkg" + if (Test-Path $ps3Rom) { + New-Item -ItemType Directory -Force -Path $ps3Path | Out-Null + Move-Item -Path $ps3Rom -Destination $ps3Path | Out-Null + } + else { + Write-Host "ERROR: $ps3Rom not found." + exit -1 + } -$vita3kLatestBuild = "$requirementsFolder\windows-latest.zip" -if(Test-Path $vita3kLatestBuild){ - Expand-Archive -Path $vita3kLatestBuild -Destination $vita3kInstallFolder -force | Out-Null -} else { - Write-Host "ERROR: $vita3kLatestBuild not found." - exit -1 -} + Write-Host "INFO: Setup PS Vita" + $vitaPath = "$global:romPath\vita" + $vitaRom = "$global:requirementsFolder\C4.vpk" + if (Test-Path $vitaRom) { + New-Item -ItemType Directory -Force -Path $vitaPath | Out-Null + Move-Item -Path $vitaRom -Destination $vitaPath -Force | Out-Null + } + else { + Write-Host "ERROR: $vitaRom not found." + exit -1 + } -Write-Host "INFO: Setup 3DS" -$3dsPath = "$romPath\3ds" -$3dsRom = "$requirementsFolder\ccleste.3dsx" -if (Test-Path $3dsRom) { - New-Item -ItemType Directory -Force -Path $3dsPath | Out-Null - Move-Item -Path $3dsRom -Destination $3dsPath -Force | Out-Null -} -else { - Write-Host "ERROR: $3dsRom not found." - exit -1 -} + Write-Host "INFO: Setup Vita3k" + $vita3kInstallFolder = "${env:ProgramFiles}\Vita3k" + if (-not(Test-Path $vita3kInstallFolder)) { + New-Item -ItemType Directory -Force -Path $vita3kInstallFolder | Out-Null + } -Write-Host "INFO: Setup GBA" -$gbaPath = "$romPath\gba" -$gbaRom = "$requirementsFolder\uranus0ev_fix.gba" -if(Test-Path $gbaRom){ - New-Item -ItemType Directory -Force -Path $gbaPath | Out-Null - Copy-Item -Path $gbaRom -Destination $gbaPath | Out-Null -} else { - Write-Host "ERROR: $gbaRom not found." - exit -1 -} + $vita3kLatestBuild = "$global:requirementsFolder\windows-latest.zip" + if (Test-Path $vita3kLatestBuild) { + Expand-Archive -Path $vita3kLatestBuild -Destination $vita3kInstallFolder -force | Out-Null + } + else { + Write-Host "ERROR: $vita3kLatestBuild not found." + exit -1 + } -Write-Host "INFO: Setup Megadrive" -$mdPath = "$romPath\megadrive" -$mdRom = "$requirementsFolder\rickdangerous.gen" -if(Test-Path $mdRom){ - New-Item -ItemType Directory -Force -Path $mdPath | Out-Null - Copy-Item -Path $mdRom -Destination $mdPath | Out-Null -} else { - Write-Host "ERROR: $mdRom not found." - exit -1 -} + Write-Host "INFO: Setup 3DS" + $3dsPath = "$global:romPath\3ds" + $3dsRom = "$global:requirementsFolder\ccleste.3dsx" + if (Test-Path $3dsRom) { + New-Item -ItemType Directory -Force -Path $3dsPath | Out-Null + Move-Item -Path $3dsRom -Destination $3dsPath -Force | Out-Null + } + else { + Write-Host "ERROR: $3dsRom not found." + exit -1 + } -Write-Host "INFO: Setup SNES" -$snesPath = "$romPath\snes" -$snesRom = "$requirementsFolder\N-Warp Daisakusen V1.1.smc" -if(Test-Path $snesRom){ - New-Item -ItemType Directory -Force -Path $snesPath | Out-Null - Copy-Item -Path $snesRom -Destination $snesPath | Out-Null -} else { - Write-Host "ERROR: $snesRom not found." - exit -1 -} + Write-Host "INFO: Setup GBA" + $gbaPath = "$global:romPath\gba" + $gbaRom = "$global:requirementsFolder\uranus0ev_fix.gba" + if (Test-Path $gbaRom) { + New-Item -ItemType Directory -Force -Path $gbaPath | Out-Null + Copy-Item -Path $gbaRom -Destination $gbaPath | Out-Null + } + else { + Write-Host "ERROR: $gbaRom not found." + exit -1 + } -Write-Host "INFO: Setup PSX" -$psxPath = "$romPath\psx" -$psxRom = "$requirementsFolder\Marilyn_In_the_Magic_World_(010a).7z" -if(Test-Path $psxRom){ - New-Item -ItemType Directory -Force -Path $psxPath | Out-Null - Expand-Archive -Path $psxRom -Destination $psxPath | Out-Null -} else { - Write-Host "ERROR: $psxRom not found." - exit -1 -} + Write-Host "INFO: Setup Megadrive" + $mdPath = "$global:romPath\megadrive" + $mdRom = "$global:requirementsFolder\rickdangerous.gen" + if (Test-Path $mdRom) { + New-Item -ItemType Directory -Force -Path $mdPath | Out-Null + Copy-Item -Path $mdRom -Destination $mdPath | Out-Null + } + else { + Write-Host "ERROR: $mdRom not found." + exit -1 + } + + Write-Host "INFO: Setup SNES" + $snesPath = "$global:romPath\snes" + $snesRom = "$global:requirementsFolder\N-Warp Daisakusen V1.1.smc" + if (Test-Path $snesRom) { + New-Item -ItemType Directory -Force -Path $snesPath | Out-Null + Copy-Item -Path $snesRom -Destination $snesPath | Out-Null + } + else { + Write-Host "ERROR: $snesRom not found." + exit -1 + } + + Write-Host "INFO: Setup PSX" + $psxPath = "$global:romPath\psx" + $psxRom = "$global:requirementsFolder\Marilyn_In_the_Magic_World_(010a).7z" + if (Test-Path $psxRom) { + New-Item -ItemType Directory -Force -Path $psxPath | Out-Null + Expand-Archive -Path $psxRom -Destination $psxPath | Out-Null + } + else { + Write-Host "ERROR: $psxRom not found." + exit -1 + } -# Write-Host "INFO: Setup PS2" -# $ps2Path = "$romPath\ps2" -# $ps2Rom = "$requirementsFolder\hermes-v.latest-ps2.zip" -# if(Test-Path $ps2Rom){ + # Write-Host "INFO: Setup PS2" + # $ps2Path = "$global:romPath\ps2" + # $ps2Rom = "$global:requirementsFolder\hermes-v.latest-ps2.zip" + # if(Test-Path $ps2Rom){ # New-Item -ItemType Directory -Force -Path $ps2Path | Out-Null # Expand-Archive -Path $ps2Rom -Destination $ps2Path | Out-Null # } else { # Write-Host "ERROR: $ps2Rom not found." # exit -1 -# } - -Write-Host "INFO: Setup Gameboy" -$gbPath = "$romPath\gb" -New-Item -ItemType Directory -Force -Path $gbPath | Out-Null - -Write-Host "INFO: Setup Gameboy Colour" -$gbcPath = "$romPath\gbc" -$gbcRom = "$requirementsFolder\star_heritage.zip" -if(Test-Path $gbcRom){ - New-Item -ItemType Directory -Force -Path $gbcPath | Out-Null - Expand-Archive -Path $gbcRom -Destination $gbcPath | Out-Null -} else { - Write-Host "ERROR: $gbcRom not found." - exit -1 -} + # } + + Write-Host "INFO: Setup Gameboy" + $gbPath = "$global:romPath\gb" + New-Item -ItemType Directory -Force -Path $gbPath | Out-Null + + Write-Host "INFO: Setup Gameboy Colour" + $gbcPath = "$global:romPath\gbc" + $gbcRom = "$global:requirementsFolder\star_heritage.zip" + if (Test-Path $gbcRom) { + New-Item -ItemType Directory -Force -Path $gbcPath | Out-Null + Expand-Archive -Path $gbcRom -Destination $gbcPath | Out-Null + } + else { + Write-Host "ERROR: $gbcRom not found." + exit -1 + } -Write-Host "INFO: Setup Mastersystem" -$masterSystemPath = "$romPath\mastersystem" -$masterSystemRom = "$requirementsFolder\WahMunchers-SMS-R2.zip" -if(Test-Path $masterSystemRom){ - New-Item -ItemType Directory -Force -Path $masterSystemPath | Out-Null - Expand-Archive -Path $masterSystemRom -Destination $masterSystemPath | Out-Null -} else { - Write-Host "ERROR: $masterSystemRom not found." - exit -1 -} + Write-Host "INFO: Setup Mastersystem" + $masterSystemPath = "$global:romPath\mastersystem" + $masterSystemRom = "$global:requirementsFolder\WahMunchers-SMS-R2.zip" + if (Test-Path $masterSystemRom) { + New-Item -ItemType Directory -Force -Path $masterSystemPath | Out-Null + Expand-Archive -Path $masterSystemRom -Destination $masterSystemPath | Out-Null + } + else { + Write-Host "ERROR: $masterSystemRom not found." + exit -1 + } -Write-Host "INFO: Setup FBA" -$fbaPath = "$romPath\fba" -New-Item -ItemType Directory -Force -Path $fbaPath | Out-Null - -Write-Host "INFO: Atari2600 Setup" -$atari2600Path = "$romPath\atari2600" -$atari2600Rom = "$requirementsFolder\ramless_pong.bin" -if(Test-Path $atari2600Rom){ - New-Item -ItemType Directory -Force -Path $atari2600Path | Out-Null - Copy-Item -Path $atari2600Rom -Destination $atari2600Path | Out-Null -} else { - Write-Host "ERROR: $atari2600Rom not found." - exit -1 -} + Write-Host "INFO: Setup FBA" + $fbaPath = "$global:romPath\fba" + New-Item -ItemType Directory -Force -Path $fbaPath | Out-Null -Write-Host "INFO: MAME setup" -$mamePath = "$romPath\mame" -New-Item -ItemType Directory -Force -Path $mamePath | Out-Null - -# WIP: Need to test and find freeware games for these emulators. -# Need to write a bat to boot these -Write-Host "INFO: ScummVm Setup" -$scummVmPath = "$romPath\scummvm" -New-Item -ItemType Directory -Force -Path $scummVmPath | Out-Null - -$wiiuPath = "$romPath\wiiu" -New-Item -ItemType Directory -Force -Path $wiiuPath | Out-Null - -Write-Host "INFO: NeogeoPocket Setup" -$neogeoPocketPath = "$romPath\ngp" -$ngpRom = "$requirementsFolder\neopocket.zip" -if(Test-Path $ngpRom){ - New-Item -ItemType Directory -Force -Path $neogeoPocketPath | Out-Null - Expand-Archive -Path $ngpRom -Destination $neogeoPocketPath | Out-Null -} else { - Write-Host "ERROR: $ngpRom not found." - exit -1 -} + Write-Host "INFO: Atari2600 Setup" + $atari2600Path = "$global:romPath\atari2600" + $atari2600Rom = "$global:requirementsFolder\ramless_pong.bin" + if (Test-Path $atari2600Rom) { + New-Item -ItemType Directory -Force -Path $atari2600Path | Out-Null + Copy-Item -Path $atari2600Rom -Destination $atari2600Path | Out-Null + } + else { + Write-Host "ERROR: $atari2600Rom not found." + exit -1 + } -Write-Host "INFO: Neogeo Setup" -$neogeoPath = "$romPath\neogeo" -New-Item -ItemType Directory -Force -Path $neogeoPath | Out-Null - -Write-Host "INFO: MSX Setup" -$msxPath = "$romPath\msx" -$msxCore = "$requirementsFolder\fmsx_libretro.dll.zip" -if(Test-Path $msxCore){ - Expand-Archive -Path $msxCore -Destination $coresPath | Out-Null - New-Item -ItemType Directory -Force -Path $msxPath | Out-Null -} else { - Write-Host "ERROR: $msxCore not found." - exit -1 -} + Write-Host "INFO: MAME setup" + $mamePath = "$global:romPath\mame" + New-Item -ItemType Directory -Force -Path $mamePath | Out-Null + + # WIP: Need to test and find freeware games for these emulators. + # Need to write a bat to boot these + Write-Host "INFO: ScummVm Setup" + $scummVmPath = "$global:romPath\scummvm" + New-Item -ItemType Directory -Force -Path $scummVmPath | Out-Null + + $wiiuPath = "$global:romPath\wiiu" + New-Item -ItemType Directory -Force -Path $wiiuPath | Out-Null + + Write-Host "INFO: NeogeoPocket Setup" + $neogeoPocketPath = "$global:romPath\ngp" + $ngpRom = "$global:requirementsFolder\neopocket.zip" + if (Test-Path $ngpRom) { + New-Item -ItemType Directory -Force -Path $neogeoPocketPath | Out-Null + Expand-Archive -Path $ngpRom -Destination $neogeoPocketPath | Out-Null + } + else { + Write-Host "ERROR: $ngpRom not found." + exit -1 + } -Write-Host "INFO: Commodore 64 Setup" -$commodore64Path = "$romPath\c64" -$commodore64Core = "$requirementsFolder\vice_x64_libretro.dll.zip" -if(Test-Path $commodore64Core){ - Expand-Archive -Path $commodore64Core -Destination $coresPath | Out-Null - New-Item -ItemType Directory -Force -Path $commodore64Path | Out-Null -} else { - Write-Host "ERROR: $commodore64Core not found." - exit -1 -} + Write-Host "INFO: Neogeo Setup" + $neogeoPath = "$global:romPath\neogeo" + New-Item -ItemType Directory -Force -Path $neogeoPath | Out-Null -Write-Host "INFO: Amiga Setup" -$amigaPath = "$romPath\amiga" -$amigaCore = "$requirementsFolder\puae_libretro.dll.zip" -if(Test-Path $amigaCore){ - Expand-Archive -Path $amigaCore -Destination $coresPath | Out-Null - New-Item -ItemType Directory -Force -Path $amigaPath | Out-Null -} else { - Write-Host "ERROR: $amigaCore not found." - exit -1 -} + Write-Host "INFO: MSX Setup" + $msxPath = "$global:romPath\msx" + $msxCore = "$global:requirementsFolder\fmsx_libretro.dll.zip" + if (Test-Path $msxCore) { + Expand-Archive -Path $msxCore -Destination $global:coresPath | Out-Null + New-Item -ItemType Directory -Force -Path $msxPath | Out-Null + } + else { + Write-Host "ERROR: $msxCore not found." + exit -1 + } -Write-Host "INFO: Setup Atari7800" -$atari7800Path = "$romPath\atari7800" -$atari7800Core = "$requirementsFolder\prosystem_libretro.dll.zip" -if(Test-Path $atari7800Core){ - Expand-Archive -Path $atari7800Core -Destination $coresPath | Out-Null - New-Item -ItemType Directory -Force -Path $atari7800Path | Out-Null -} else { - Write-Host "ERROR: $atari7800Core not found." - exit -1 -} + Write-Host "INFO: Commodore 64 Setup" + $commodore64Path = "$global:romPath\c64" + $commodore64Core = "$global:requirementsFolder\vice_x64_libretro.dll.zip" + if (Test-Path $commodore64Core) { + Expand-Archive -Path $commodore64Core -Destination $global:coresPath | Out-Null + New-Item -ItemType Directory -Force -Path $commodore64Path | Out-Null + } + else { + Write-Host "ERROR: $commodore64Core not found." + exit -1 + } + + Write-Host "INFO: Amiga Setup" + $amigaPath = "$global:romPath\amiga" + $amigaCore = "$global:requirementsFolder\puae_libretro.dll.zip" + if (Test-Path $amigaCore) { + Expand-Archive -Path $amigaCore -Destination $global:coresPath | Out-Null + New-Item -ItemType Directory -Force -Path $amigaPath | Out-Null + } + else { + Write-Host "ERROR: $amigaCore not found." + exit -1 + } + + Write-Host "INFO: Setup Atari7800" + $atari7800Path = "$global:romPath\atari7800" + $atari7800Core = "$global:requirementsFolder\prosystem_libretro.dll.zip" + if (Test-Path $atari7800Core) { + Expand-Archive -Path $atari7800Core -Destination $global:coresPath | Out-Null + New-Item -ItemType Directory -Force -Path $atari7800Path | Out-Null + } + else { + Write-Host "ERROR: $atari7800Core not found." + exit -1 + } + + Write-Host "INFO: Setup Wii/Gaemcube" + $gcPath = "$global:romPath\gc" + $wiiPath = "$global:romPath\wii" + $wiiRom = "$global:requirementsFolder\Homebrew.Channel.-.OHBC.wad" + New-Item -ItemType Directory -Force -Path $gcPath | Out-Null + New-Item -ItemType Directory -Force -Path $wiiPath | Out-Null + if (Test-Path $wiiRom) { + Copy-Item $wiiRom $wiiPath | Out-Null + } + else { + Write-Host "ERROR: $wiiRom not found." + exit -1 + } -Write-Host "INFO: Setup Wii/Gaemcube" -$gcPath = "$romPath\gc" -$wiiPath = "$romPath\wii" -$wiiRom = "$requirementsFolder\Homebrew.Channel.-.OHBC.wad" -New-Item -ItemType Directory -Force -Path $gcPath | Out-Null -New-Item -ItemType Directory -Force -Path $wiiPath | Out-Null -if(Test-Path $wiiRom){ - Copy-Item $wiiRom $wiiPath | Out-Null -} else{ - Write-Host "ERROR: $wiiRom not found." - exit -1 } -Write-Host "INFO: Setting up Emulation Station Config" -$esConfigFile = "$env:userprofile\.emulationstation\es_systems.cfg" -# TO-DO -# Vita Launching is a BIT hacky, works in powershell -# .\Vita3K.exe --vpk-path "%ROM% | .\Vita3K.exe +function Setup-EmulationStationConfig { + + $global:citraInstallDir = "$env:userprofile\scoop\apps\citra\current" + $global:ppssppInstallDir = "$env:userprofile\scoop\apps\ppsspp\current" + $global:yuzuInstallDir = "$env:userprofile\scoop\apps\yuzu\current" + $global:rpcs3InstallDir = "$env:userprofile\scoop\apps\rpcs3\current" + + Write-Host "INFO: Setting up Emulation Station Config" + $esConfigFile = "$env:userprofile\.emulationstation\es_systems.cfg" + # TO-DO + # Vita Launching is a BIT hacky, works in powershell + # .\Vita3K.exe --vpk-path "%ROM% | .\Vita3K.exe -<# + + <# ---------------------------------- File extension supported by systems ---------------------------------- @@ -647,7 +659,7 @@ VBA Next: https://docs.libretro.com/library/vba_next/ ePSXe: https://fantasyanime.com/emuhelp/epsxe#dumping-your-psx-games-to-iso (NOT OFFICIAL) PCSX2: https://fantasyanime.com/emuhelp/pcsx2#loading-a-ps2-iso (NOT OFFICIAL) #> -$newConfig = " + $newConfig = " vita Vita @@ -662,7 +674,7 @@ $newConfig = " Switch $switchPath .nsp .NSP .zip .ZIP .7z .nso .NSO .nro .NRO .nca .NCA .xci .XCI - $yuzuInstallDir\yuzu.exe %ROM% + $global:yuzuInstallDir\yuzu.exe %ROM% switch switch @@ -671,7 +683,7 @@ $newConfig = " PS3 $ps3Path .iso .ISO .zip .ZIP .7z .pkg .PKG - $rpcs3InstallDir\rpcs3.exe %ROM% + $global:rpcs3InstallDir\rpcs3.exe %ROM% ps3 ps3 @@ -680,7 +692,7 @@ $newConfig = " Playstation Portable $pspPath .iso .ISO .cso .CSO .elf .ELF .pbp .PBP - $ppssppInstallDir\PPSSPPWindows.exe %ROM% + $global:ppssppInstallDir\PPSSPPWindows.exe %ROM% psp psp @@ -689,7 +701,7 @@ $newConfig = " Nintendo 3DS $3dsPath .3ds .3DS .3dsx .3DSX .cci .CCI .cxi .CXI .elf .ELF - $citraInstallDir\citra.exe %ROM% + $global:citraInstallDir\citra.exe %ROM% n3ds 3ds @@ -698,7 +710,7 @@ $newConfig = " Nintendo Entertainment System $nesPath .nes .NES .fds .FDS .unif .UNIF .unf .UNF - $retroarchExecutable -L $coresPath\fceumm_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\fceumm_libretro.dll %ROM% nes nes @@ -707,7 +719,7 @@ $newConfig = " snes $snesPath .smc .SMC .sfc .SFC .fig .FIG .swc .SWC .bs .BS .st .ST - $retroarchExecutable -L $coresPath\snes9x_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\snes9x_libretro.dll %ROM% snes snes @@ -716,7 +728,7 @@ $newConfig = " n64 $n64Path .z64 .Z64 .n64 .N64 .v64 .V64 .zip .ZIP .7z .7Z - $retroarchExecutable -L $coresPath\parallel_n64_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\parallel_n64_libretro.dll %ROM% n64 n64 @@ -743,7 +755,7 @@ $newConfig = " gb $gbPath .gb .GB .dmg .DMG .zip .ZIP .7z .7Z - $retroarchExecutable -L $coresPath\gambatte_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\gambatte_libretro.dll %ROM% gb gb @@ -752,7 +764,7 @@ $newConfig = " gbc $gbcPath .gbc .GBC .dmg .DMG .zip .ZIP - $retroarchExecutable -L $coresPath\gambatte_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\gambatte_libretro.dll %ROM% gbc gbc @@ -761,7 +773,7 @@ $newConfig = " gba $gbaPath .gba .GBA - $retroarchExecutable -L $coresPath\vba_next_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\vba_next_libretro.dll %ROM% gba gba @@ -788,7 +800,7 @@ $newConfig = " mame $mamePath .zip .ZIP - $retroarchExecutable -L $coresPath\mame2010_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\mame2010_libretro.dll %ROM% mame mame @@ -797,7 +809,7 @@ $newConfig = " fba $fbaPath .zip .ZIP .fba .FBA - $retroarchExecutable -L $coresPath\fbalpha2012_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\fbalpha2012_libretro.dll %ROM% arcade @@ -806,7 +818,7 @@ $newConfig = " amiga $amigaPath .adf .ADF - $retroarchExecutable -L $coresPath\puae_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\puae_libretro.dll %ROM% amiga amiga @@ -815,7 +827,7 @@ $newConfig = " atari2600 $atari2600Path .a26 .bin .rom .A26 .BIN .ROM - $retroarchExecutable -L $coresPath\stella_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\stella_libretro.dll %ROM% atari2600 atari2600 @@ -824,7 +836,7 @@ $newConfig = " atari7800 $atari7800Path .a78 .bin .A78 .BIN - $retroarchExecutable -L $coresPath\prosystem_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\prosystem_libretro.dll %ROM% atari7800 atari7800 @@ -833,7 +845,7 @@ $newConfig = " c64 $commodore64Path .crt .d64 .g64 .t64 .tap .x64 .zip .CRT .D64 .G64 .T64 .TAP .X64 .ZIP - $retroarchExecutable -L $coresPath\vice_x64_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\vice_x64_libretro.dll %ROM% c64 c64 @@ -842,7 +854,7 @@ $newConfig = " megadrive $mdPath .smd .SMD .bin .BIN .gen .GEN .md .MD .zip .ZIP - $retroarchExecutable -L $coresPath\genesis_plus_gx_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\genesis_plus_gx_libretro.dll %ROM% genesis,megadrive megadrive @@ -851,7 +863,7 @@ $newConfig = " mastersystem $masterSystemPath .bin .sms .zip .BIN .SMS .ZIP - $retroarchExecutable -L $coresPath\genesis_plus_gx_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\genesis_plus_gx_libretro.dll %ROM% mastersystem mastersystem @@ -860,7 +872,7 @@ $newConfig = " msx $msxPath .col .dsk .mx1 .mx2 .rom .COL .DSK .MX1 .MX2 .ROM - $retroarchExecutable -L $coresPath\fmsx_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\fmsx_libretro.dll %ROM% msx msx @@ -869,7 +881,7 @@ $newConfig = " Neo Geo $neogeoPath .zip .ZIP - $retroarchExecutable -L $coresPath\fbalpha2012_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\fbalpha2012_libretro.dll %ROM% neogeo neogeo @@ -878,7 +890,7 @@ $newConfig = " ngp $neogeoPocketPath .ngp .ngc .zip .ZIP - $retroarchExecutable -L $coresPath\race_libretro.dll %ROM% + $global:retroarchExecutable -L $global:coresPath\race_libretro.dll %ROM% ngp ngp @@ -902,33 +914,35 @@ $newConfig = " " -Set-Content $esConfigFile -Value $newConfig - -Write-Host "INFO: Setting up Emulation Station theme recalbox-backport" -$themesPath = "$env:userprofile\.emulationstation\themes\recalbox-backport\" -$themesFile = "$requirementsFolder\recalbox-backport-v2.2.zip" -if(Test-Path $themesFile){ - Expand-Archive -Path $themesFile -Destination $requirementsFolder -Force | Out-Null - $themesFolder = "$requirementsFolder\recalbox-backport\" - robocopy $themesFolder $themesPath /E /NFL /NDL /NJH /NJS /nc /ns /np | Out-Null -} else { - Write-Host "ERROR: $themesFile not found." - exit -1 -} + Set-Content $esConfigFile -Value $newConfig + + Write-Host "INFO: Setting up Emulation Station theme recalbox-backport" + $themesPath = "$env:userprofile\.emulationstation\themes\recalbox-backport\" + $themesFile = "$global:requirementsFolder\recalbox-backport-v2.2.zip" + if (Test-Path $themesFile) { + Expand-Archive -Path $themesFile -Destination $global:requirementsFolder -Force | Out-Null + $themesFolder = "$global:requirementsFolder\recalbox-backport\" + robocopy $themesFolder $themesPath /E /NFL /NDL /NJH /NJS /nc /ns /np | Out-Null + } + else { + Write-Host "ERROR: $themesFile not found." + exit -1 + } -Write-Host "INFO: Update EmulationStation binaries" -$emulationStationInstallFolder = "${env:ProgramFiles(x86)}\EmulationStation" -$updatedEmulationStatonBinaries = "$requirementsFolder\EmulationStation-Win32.zip" -if(Test-Path $updatedEmulationStatonBinaries){ - Expand-Archive -Path $updatedEmulationStatonBinaries -Destination $emulationStationInstallFolder -Force | Out-Null -} else { - Write-Host "ERROR: $updatedEmulationStatonBinaries not found." - exit -1 -} + Write-Host "INFO: Update EmulationStation binaries" + $emulationStationInstallFolder = "${env:ProgramFiles(x86)}\EmulationStation" + $updatedEmulationStatonBinaries = "$global:requirementsFolder\EmulationStation-Win32.zip" + if (Test-Path $updatedEmulationStatonBinaries) { + Expand-Archive -Path $updatedEmulationStatonBinaries -Destination $emulationStationInstallFolder -Force | Out-Null + } + else { + Write-Host "ERROR: $updatedEmulationStatonBinaries not found." + exit -1 + } -Write-Host "INFO: Generate ES settings file with favorites enabled." -$esConfigFile = "$env:userprofile\.emulationstation\es_settings.cfg" -$newSettingsConfig = " + Write-Host "INFO: Generate ES settings file with favorites enabled." + $esConfigFile = "$env:userprofile\.emulationstation\es_settings.cfg" + $newSettingsConfig = " @@ -973,193 +987,280 @@ $newSettingsConfig = " " -Set-Content $esConfigFile -Value $newSettingsConfig -$requiredTmpFolder = "$env:userprofile\.emulationstation\tmp\" -New-Item -ItemType Directory -Force -Path $requiredTmpFolder | Out-Null - -Write-Host "INFO: Genrating Dolphin Config" -$dolphinConfigFile = "$env:userprofile\.emulationstation\systems\retroarch\saves\User\Config\Dolphin.ini" -$dolphinConfigFolder = "$env:userprofile\.emulationstation\systems\retroarch\saves\User\Config\" -$dolphinConfigFileContent = "[General] -LastFilename = -ShowLag = False -ShowFrameCount = False -ISOPaths = 0 -RecursiveISOPaths = False -NANDRootPath = -DumpPath = -WirelessMac = -WiiSDCardPath = $env:userprofile\.emulationstation\systems\retroarch\saves\User\Wii\sd.raw -[Interface] -ConfirmStop = True -UsePanicHandlers = True -OnScreenDisplayMessages = True -HideCursor = False -AutoHideCursor = False -MainWindowPosX = -2147483648 -MainWindowPosY = -2147483648 -MainWindowWidth = -1 -MainWindowHeight = -1 -LanguageCode = -ShowToolbar = True -ShowStatusbar = True -ShowLogWindow = False -ShowLogConfigWindow = False -ExtendedFPSInfo = False -ThemeName = Clean -PauseOnFocusLost = False -DisableTooltips = False -[Display] -FullscreenResolution = Auto -Fullscreen = False -RenderToMain = True -RenderWindowXPos = -1 -RenderWindowYPos = -1 -RenderWindowWidth = 640 -RenderWindowHeight = 480 -RenderWindowAutoSize = False -KeepWindowOnTop = False -ProgressiveScan = False -PAL60 = False -DisableScreenSaver = False -ForceNTSCJ = False -[GameList] -ListDrives = False -ListWad = True -ListElfDol = True -ListWii = True -ListGC = True -ListJap = True -ListPal = True -ListUsa = True -ListAustralia = True -ListFrance = True -ListGermany = True -ListItaly = True -ListKorea = True -ListNetherlands = True -ListRussia = True -ListSpain = True -ListTaiwan = True -ListWorld = True -ListUnknown = True -ListSort = 3 -ListSortSecondary = 0 -ColumnPlatform = True -ColumnBanner = True -ColumnNotes = True -ColumnFileName = False -ColumnID = False -ColumnRegion = True -ColumnSize = True -ColumnState = True -[Core] -HLE_BS2 = True -TimingVariance = 40 -CPUCore = 1 -Fastmem = True -CPUThread = True -DSPHLE = True -SyncOnSkipIdle = True -SyncGPU = True -SyncGpuMaxDistance = 200000 -SyncGpuMinDistance = -200000 -SyncGpuOverclock = 1.00000000 -FPRF = False -AccurateNaNs = False -DefaultISO = -DVDRoot = -Apploader = -EnableCheats = False -SelectedLanguage = 0 -OverrideGCLang = False -DPL2Decoder = False -Latency = 2 -AudioStretch = False -AudioStretchMaxLatency = 80 -MemcardAPath = $env:userprofile\.emulationstation\systems\retroarch\saves\User\GC\MemoryCardA.USA.raw -MemcardBPath = $env:userprofile\.emulationstation\systems\retroarch\saves\User\GC\MemoryCardB.USA.raw -AgpCartAPath = -AgpCartBPath = -SlotA = 1 -SlotB = 255 -SerialPort1 = 255 -BBA_MAC = -SIDevice0 = 6 -AdapterRumble0 = True -SimulateKonga0 = False -SIDevice1 = 0 -AdapterRumble1 = True -SimulateKonga1 = False -SIDevice2 = 0 -AdapterRumble2 = True -SimulateKonga2 = False -SIDevice3 = 0 -AdapterRumble3 = True -SimulateKonga3 = False -WiiSDCard = False -WiiKeyboard = False -WiimoteContinuousScanning = False -WiimoteEnableSpeaker = False -RunCompareServer = False -RunCompareClient = False -EmulationSpeed = 1.00000000 -FrameSkip = 0x00000000 -Overclock = 1.00000000 -OverclockEnable = False -GFXBackend = OGL -GPUDeterminismMode = auto -PerfMapDir = -EnableCustomRTC = False -CustomRTCValue = 0x386d4380 -[Movie] -PauseMovie = False -Author = -DumpFrames = False -DumpFramesSilent = False -ShowInputDisplay = False -ShowRTC = False -[DSP] -EnableJIT = False -DumpAudio = False -DumpAudioSilent = False -DumpUCode = False -Backend = Libretro -Volume = 100 -CaptureLog = False -[Input] -BackgroundInput = False -[FifoPlayer] -LoopReplay = False -[Analytics] -ID = -Enabled = False -PermissionAsked = False -[Network] -SSLDumpRead = False -SSLDumpWrite = False -SSLVerifyCertificates = True -SSLDumpRootCA = False -SSLDumpPeerCert = False -[BluetoothPassthrough] -Enabled = False -VID = -1 -PID = -1 -LinkKeys = -[USBPassthrough] -Devices = -[Sysconf] -SensorBarPosition = 1 -SensorBarSensitivity = 50331648 -SpeakerVolume = 88 -WiimoteMotor = True -WiiLanguage = 1 -AspectRatio = 1 -Screensaver = 0 + Set-Content $esConfigFile -Value $newSettingsConfig + $requiredTmpFolder = "$env:userprofile\.emulationstation\tmp\" + New-Item -ItemType Directory -Force -Path $requiredTmpFolder | Out-Null +} -" -New-Item $dolphinConfigFolder -ItemType directory -Force | Out-Null -Write-Output $dolphinConfigFileContent > $dolphinConfigFile + +function Setup-DolphinConfig { + + Write-Output "INFO: Genrating Dolphin Config" + + $dolphinConfigFile = "$env:userprofile\.emulationstation\systems\retroarch\saves\User\Config\Dolphin.ini" + $dolphinConfigFolder = "$env:userprofile\.emulationstation\systems\retroarch\saves\User\Config\" + + $dolphinConfigFileContent = "[General] + LastFilename = + ShowLag = False + ShowFrameCount = False + ISOPaths = 0 + RecursiveISOPaths = False + NANDRootPath = + DumpPath = + WirelessMac = + WiiSDCardPath = $env:userprofile\.emulationstation\systems\retroarch\saves\User\Wii\sd.raw + [Interface] + ConfirmStop = True + UsePanicHandlers = True + OnScreenDisplayMessages = True + HideCursor = False + AutoHideCursor = False + MainWindowPosX = -2147483648 + MainWindowPosY = -2147483648 + MainWindowWidth = -1 + MainWindowHeight = -1 + LanguageCode = + ShowToolbar = True + ShowStatusbar = True + ShowLogWindow = False + ShowLogConfigWindow = False + ExtendedFPSInfo = False + ThemeName = Clean + PauseOnFocusLost = False + DisableTooltips = False + [Display] + FullscreenResolution = Auto + Fullscreen = False + RenderToMain = True + RenderWindowXPos = -1 + RenderWindowYPos = -1 + RenderWindowWidth = 640 + RenderWindowHeight = 480 + RenderWindowAutoSize = False + KeepWindowOnTop = False + ProgressiveScan = False + PAL60 = False + DisableScreenSaver = False + ForceNTSCJ = False + [GameList] + ListDrives = False + ListWad = True + ListElfDol = True + ListWii = True + ListGC = True + ListJap = True + ListPal = True + ListUsa = True + ListAustralia = True + ListFrance = True + ListGermany = True + ListItaly = True + ListKorea = True + ListNetherlands = True + ListRussia = True + ListSpain = True + ListTaiwan = True + ListWorld = True + ListUnknown = True + ListSort = 3 + ListSortSecondary = 0 + ColumnPlatform = True + ColumnBanner = True + ColumnNotes = True + ColumnFileName = False + ColumnID = False + ColumnRegion = True + ColumnSize = True + ColumnState = True + [Core] + HLE_BS2 = True + TimingVariance = 40 + CPUCore = 1 + Fastmem = True + CPUThread = True + DSPHLE = True + SyncOnSkipIdle = True + SyncGPU = True + SyncGpuMaxDistance = 200000 + SyncGpuMinDistance = -200000 + SyncGpuOverclock = 1.00000000 + FPRF = False + AccurateNaNs = False + DefaultISO = + DVDRoot = + Apploader = + EnableCheats = False + SelectedLanguage = 0 + OverrideGCLang = False + DPL2Decoder = False + Latency = 2 + AudioStretch = False + AudioStretchMaxLatency = 80 + MemcardAPath = $env:userprofile\.emulationstation\systems\retroarch\saves\User\GC\MemoryCardA.USA.raw + MemcardBPath = $env:userprofile\.emulationstation\systems\retroarch\saves\User\GC\MemoryCardB.USA.raw + AgpCartAPath = + AgpCartBPath = + SlotA = 1 + SlotB = 255 + SerialPort1 = 255 + BBA_MAC = + SIDevice0 = 6 + AdapterRumble0 = True + SimulateKonga0 = False + SIDevice1 = 0 + AdapterRumble1 = True + SimulateKonga1 = False + SIDevice2 = 0 + AdapterRumble2 = True + SimulateKonga2 = False + SIDevice3 = 0 + AdapterRumble3 = True + SimulateKonga3 = False + WiiSDCard = False + WiiKeyboard = False + WiimoteContinuousScanning = False + WiimoteEnableSpeaker = False + RunCompareServer = False + RunCompareClient = False + EmulationSpeed = 1.00000000 + FrameSkip = 0x00000000 + Overclock = 1.00000000 + OverclockEnable = False + GFXBackend = OGL + GPUDeterminismMode = auto + PerfMapDir = + EnableCustomRTC = False + CustomRTCValue = 0x386d4380 + [Movie] + PauseMovie = False + Author = + DumpFrames = False + DumpFramesSilent = False + ShowInputDisplay = False + ShowRTC = False + [DSP] + EnableJIT = False + DumpAudio = False + DumpAudioSilent = False + DumpUCode = False + Backend = Libretro + Volume = 100 + CaptureLog = False + [Input] + BackgroundInput = False + [FifoPlayer] + LoopReplay = False + [Analytics] + ID = + Enabled = False + PermissionAsked = False + [Network] + SSLDumpRead = False + SSLDumpWrite = False + SSLVerifyCertificates = True + SSLDumpRootCA = False + SSLDumpPeerCert = False + [BluetoothPassthrough] + Enabled = False + VID = -1 + PID = -1 + LinkKeys = + [USBPassthrough] + Devices = + [Sysconf] + SensorBarPosition = 1 + SensorBarSensitivity = 50331648 + SpeakerVolume = 88 + WiimoteMotor = True + WiiLanguage = 1 + AspectRatio = 1 + Screensaver = 0 + + " + New-Item $dolphinConfigFolder -ItemType directory -Force | Out-Null + Write-Output $dolphinConfigFileContent > $dolphinConfigFile + +} + + +function Setup-Scraper { + + Write-Host "INFO: Adding scraper in" + $scraperZip = "$global:requirementsFolder\scraper_windows_amd64.zip" + if (Test-Path $scraperZip) { + Expand-Archive -Path $scraperZip -Destination $global:romPath | Out-Null + } + else { + Write-Host "ERROR: $scraperZip not found." + exit -1 + } + +} + +function Setup-DesktopShortcuts { + + Write-Host "INFO: Adding in useful desktop shortcuts" + $userProfileVariable = Get-ChildItem Env:UserProfile + $romsShortcut = $userProfileVariable.Value + "\.emulationstation\roms" + $coresShortcut = $userProfileVariable.Value + "\.emulationstation\systems\retroarch\cores" + $windowedEmulationStation = "${env:ProgramFiles(x86)}\EmulationStation\emulationstation.exe" + + $wshshell = New-Object -ComObject WScript.Shell + $desktop = [System.Environment]::GetFolderPath('Desktop') + $lnkRoms = $wshshell.CreateShortcut("$desktop\Roms Location.lnk") + $lnkRoms.TargetPath = $romsShortcut + $lnkRoms.Save() + + $lnkCores = $wshshell.CreateShortcut("$desktop\Cores Location.lnk") + $lnkCores.TargetPath = $coresShortcut + $lnkCores.Save() + + $lnkWindowed = $wshshell.CreateShortcut("$desktop\Windowed EmulationStation.lnk") + $lnkWindowed.Arguments = "--resolution 1366 768 --windowed" + $lnkWindowed.TargetPath = $windowedEmulationStation + $lnkWindowed.Save() + +} + + +switch ($args[0]) { + "-installDependencies" { + Get-ScriptPath -ScriptPath $MyInvocation.MyCommand.Path + Install-Chocolatey + InstallScoop + ConfigureScoop + Install-AdditionalSoftware + } + "-acquireFiles" { + Get-ScriptPath -ScriptPath $MyInvocation.MyCommand.Path + AcquireFiles + } + "-setupRoms" { + Get-ScriptPath -ScriptPath $MyInvocation.MyCommand.Path + Setup-Roms + Setup-EmulationStationConfig + Setup-DolphinConfig + Setup-Scraper + Setup-DesktopShortcuts + } + default { + Get-ScriptPath -ScriptPath $MyInvocation.MyCommand.Path + Install-Chocolatey + InstallScoop + ConfigureScoop + Install-AdditionalSoftware + AcquireFiles + Install-EmulationStation + Setup-EmulatorCores + Start-RetroarchAndGenerateConfig + Setup-Roms + Setup-EmulationStationConfig + Setup-DolphinConfig + Setup-Scraper + Setup-DesktopShortcuts + } +} # TO-DO: Review if this is still needed or not # # https://www.ngemu.com/threads/epsxe-2-0-5-startup-crash-black-screen-fix-here.199169/ @@ -1168,34 +1269,4 @@ Write-Output $dolphinConfigFileContent > $dolphinConfigFile # New-Item -Path $path -Force | Out-Null # Set-ItemProperty -Path $path -Name 'CPUOverclocking' -Value '10' -Write-Host "INFO: Adding scraper in" -$scraperZip = "$requirementsFolder\scraper_windows_amd64.zip" -if(Test-Path $scraperZip){ - Expand-Archive -Path $scraperZip -Destination $romPath | Out-Null -} else { - Write-Host "ERROR: $scraperZip not found." - exit -1 -} - -Write-Host "INFO: Adding in useful desktop shortcuts" -$userProfileVariable = Get-ChildItem Env:UserProfile -$romsShortcut = $userProfileVariable.Value + "\.emulationstation\roms" -$coresShortcut = $userProfileVariable.Value + "\.emulationstation\systems\retroarch\cores" -$windowedEmulationStation = "${env:ProgramFiles(x86)}\EmulationStation\emulationstation.exe" - -$wshshell = New-Object -ComObject WScript.Shell -$desktop = [System.Environment]::GetFolderPath('Desktop') -$lnkRoms = $wshshell.CreateShortcut("$desktop\Roms Location.lnk") -$lnkRoms.TargetPath = $romsShortcut -$lnkRoms.Save() - -$lnkCores = $wshshell.CreateShortcut("$desktop\Cores Location.lnk") -$lnkCores.TargetPath = $coresShortcut -$lnkCores.Save() - -$lnkWindowed = $wshshell.CreateShortcut("$desktop\Windowed EmulationStation.lnk") -$lnkWindowed.Arguments = "--resolution 1366 768 --windowed" -$lnkWindowed.TargetPath = $windowedEmulationStation -$lnkWindowed.Save() - Write-Host "INFO: Setup completed"