Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't install/update ViGEmBus if 1.17 or later is already installed #1953

Merged
merged 3 commits into from
Dec 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src_assets/windows/misc/gamepad/install-gamepad.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
@echo off
setlocal enabledelayedexpansion

rem Check if a compatible version of ViGEmBus is already installed (1.17 or later)
set Version=
for /f "usebackq delims=" %%a in (`wmic product where "name='ViGEm Bus Driver' or name='Nefarius Virtual Gamepad Emulation Bus Driver'" get Version /format:Textvaluelist`) do (
for /f "delims=" %%# in ("%%a") do set "%%#"
)

rem Extract Major and Minor versions
for /f "tokens=1,2 delims=." %%a in ("%Version%") do (
set "MajorVersion=%%a"
set "MinorVersion=%%b"
)

rem Compare the version to 1.17
if /i !MajorVersion! gtr 1 goto skip
if /i !MajorVersion! equ 1 (
if /i !MinorVersion! geq 17 (
goto skip
)
)
goto continue

:skip
echo "The installed version is %Version%, no update needed. Exiting."
exit /b 0

:continue
rem Get temp directory
set temp_dir=%temp%/Sunshine

Expand Down