Files
Sweetcade/scripts/ps/controls.ps1
2024-12-28 20:05:03 -08:00

76 lines
4.4 KiB
PowerShell

Function fSCControlIOSelection() {
Write-Host "---Configure Control Input Board---"
Write-Host "Please select a control configuration from the following list:"
Write-Host "[1] - J-PAC"
Write-Host "[2] - Taito FastIO + FastIO2KB"
Write-Host "[3] - OpenJVS with RS485 adapter, or JVS2X"
Write-Host "[0] - Other - I'll configure my own controls manually"
$vSCControlIOSelectionResponse = Read-Host "Select a number from the list above:"
if ($vSCControlIOSelectionResponse -neq [0...3])
{
Write-Host "SC-CTL-ERR001: INVALID SELECTION"
Write-Host "The number you have entered is invalid. Please enter a number from the list and try again"
fSCControlIOSelection
}
elseif ($vSCControlIOSelectionResponse -eq 1)
{
Write-Host "The J-PAC interface does not require any driver installation and should already be functional, provided that you have connected it correctly"
Write-Host "If you need to make adjustments to its settings, the WinIPAC application has been installed for you already"
Write-Host "Displaying this message for 60 seconds and then moving on"
Start-Sleep -Seconds 60
Exit 0
}
elseif ($vSCControlIOSelectionResponse -eq 2)
{
Write-Host "This option requires drivers extracted from a Taito Type X3 system (specifically iDmacDrv64.dll)"
Write-Host "Please retrieve these files and place them in the following location"
Write-Host "C:\sc\tools\fastio2kb\FastIO2KB_2021.04.04_Easter\Win64 TTX3\MAME Keymap\"
Write-Host "After this is done, please press C to [C]ontinue"
Read-Host "C"
Write-Host "Now starting fast2kb.exe"
Start-Process -FilePath "C:\sc\tools\fastio2kb\FastIO2KB_2021.04.04_Easter\Win64 TTX3\MAME Keymap\fast2kb.exe" -WorkingDirectory "C:\sc\tools\fastio2kb\FastIO2KB_2021.04.04_Easter\Win64 TTX3\MAME Keymap\" -Verb Open
$vSCControlIOFastIO2KBExitCode = $?
if ($vSCControlIOFastIO2KBExitCode -eq $true)
{
Write-Host "Application seems to be running OK"
Write-Host "Moving on after 15 seconds"
Start-Sleep -Seconds 15
Exit 0
}
else
{
Write-Host "SC-CTL-ERR002: FAST2KB.EXE EXITED WITH NON-ZERO EXIT CODE"
Write-Host "For some reason, fast2kb.exe exited with a non-zero exit code"
Write-Host "Please open a issue on the git repository at https://git.sdf.org/camoy/Sweetcade"
Write-Host "Unfortunately, Sweetcade cannot continue since your controls won't work"
Write-Host "This script will now exit in 60 seconds"
Start-Sleep -Seconds 60
Exit 1
}
}
elseif ($vSCControlIOSelectionResponse -eq 3)
{
Write-Host "This selection requires manual setup, which Sweetcade can't help directly with"
Write-Host "You'll need to configure this on your own, though typically it is a plug and play solution with no drivers needed"
Write-Host "Displaying this message for 60 seconds and then moving on"
Start-Sleep -Seconds 60
Exit 0
}
elseif ($vSCControlIOSelectionResponse -eq 0)
{
Write-Host "You have chosen to configure a custom Control Input Board"
Write-Host "Sweetcade can't help you with any further setup at this point"
Write-Host "If you would like to request support for your control method, please open a issue on the git repository at https://git.sdf.org/camoy/Sweetcade"
Write-Host "Displaying this message for 60 seconds and then moving on"
}
else
{
Write-Host "SC-CTL-ERR00X: INVALID SELECTION"
Write-Host "The number you have entered is invalid. Please enter a number from the list and try again"
fSCControlIOSelection
}
}
fSCControlIOSelection