Skip to content

Instantly share code, notes, and snippets.

@Moojuiceman
Last active December 4, 2024 12:59
Show Gist options
  • Save Moojuiceman/b1b0d2d73bbe3b656abb9e5e286ebb8d to your computer and use it in GitHub Desktop.
Save Moojuiceman/b1b0d2d73bbe3b656abb9e5e286ebb8d to your computer and use it in GitHub Desktop.
Powershell script to toggle Astro C40 controller between reading as Xbox/PS4 on windows.
#Script to toggle Astro C40 controller between reading as Xbox/PS4 on windows. See this page for details:
#https://www.reddit.com/r/AstroGaming/comments/e5c5uk/psa_how_to_switch_c40_to_ps4_mode_on_windows_10/
#Self elevate script
#http://www.expta.com/2017/03/how-to-self-elevate-powershell-script.html
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator'))
{
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
{
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
exit
}
}
$keypaths = ('HKLM:\SYSTEM\CurrentControlSet\Enum\USB\VID_9886&PID_0025\','HKLM:\SYSTEM\CurrentControlSet\Enum\USB\VID_9886&PID_0024\')
foreach ($keypath in $keypaths) {
#Get the registry key
try {
$key = (gci $keypath)[0]
}
catch {echo "Error: Key $keypath doesn't exist"; pause; exit}
#Check the subkey exists
$i1 = $key.Property.IndexOf("LowerFilters")
$i2 = $key.Property.IndexOf("LowerFilters_disabled")
if ($i1 -eq -1 -and $i2 -ne -1) {
#Subkey was disabled, enable it
try {
Rename-ItemProperty -Path $key.PSPath -Name LowerFilters_disabled -NewName LowerFilters -ErrorAction Stop
}
catch {
$message = $_.Exception.Message
echo "Error renaming key: $message"; pause; exit
}
echo "LowerFilters enabled (Xbox mode)"
}
elseif ($i1 -ne -1 -and $i2 -eq -1) {
#Subkey was enabled, disable it
try {
Rename-ItemProperty -Path $key.PSPath -Name LowerFilters -NewName LowerFilters_disabled -ErrorAction Stop
}
catch {
$message = $_.Exception.Message
echo "Error renaming key: $message"; pause; exit
}
echo "LowerFilters disabled (PS4 mode)"
}
else {echo "Error: Couldn't find subkey LowerFilters or LowerFilters_disabled"; pause; exit}
}
pause
@nirinium
Copy link

Beautiful work my guy <3 Thanks

@shadow6427
Copy link

is there any possible way to bypass the dongle and convert the controller to bluetooth? even if I have to install a chip? I'm using a Mac. This

@Moojuiceman
Copy link
Author

is there any possible way to bypass the dongle and convert the controller to bluetooth? even if I have to install a chip? I'm using a Mac. This

Technically anything is possible if you have the right hardware and software knowledge, but this would be a total conversion. You'd have to add a bluetooth chip to the controller, and either reflash or add a microcontroller to read the inputs and convert it to a "bluetooth game controller" message so the receiver would understand it. Plus handle the whole pairing thing. And I'm pretty sure none of the controller specific features would work or be able to be programmed using the astro software.

TL;DR: You could, but good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment