Files
SteamlessController/resources/InnoInstallerScript.iss
T
Dylan DeverillandClaude Opus 5 c7866ecfa7 Check that ViGEmBus actually installed instead of assuming it did
With another program's rebranded ViGEm already on the machine, setup's driver
install silently does nothing and reports success. The user finds out when
they click Enable Steamless Mode and no controller reaches the game. Reported
in #68, where the only ViGEm driver package left afterwards was the Oculus
fork's; running the ViGEmBus installer by hand then offered Modify/Repair/
Remove rather than a fresh install, so the bundle had registered itself
without a working driver ever landing.

Everything downstream of that — the connect failures, the retry storm, and on
1.13 the device cycling that stranded a reporter's HID collections — starts
here. The preceding commits make that state survivable and diagnosable; this
one keeps it from being reached.

Setup now asks the same question the app asks at runtime: is a device
publishing the ViGEm bus interface present? Every cheaper check was measured
and found to lie. The bundle exits 0 when it detects a related product and
declines to act, so the exit code says nothing. The registry records the
product whether or not a driver landed. And the driver's version is no guide
either, since 1.22.0 ships a binary still stamped 1.21.442.0 — which cost an
afternoon before it was pinned down.

ViGEmBusProbe carries the check, and is installed rather than left a build
artefact: its other job is being the thing to ask a user to run when a
controller never reaches a game. Exit code 0 means at least one usable bus,
1 means none. Verified both directions against a real bus and a disabled one.

A failed check does not fail the install. The app is fine, and it now picks
the driver up on its own once it appears, so the message says what to install
and that no reinstall is needed afterwards. Silent installs log the finding
instead of stopping on a dialog nobody is present to close.

It informs rather than repairs. Running msiexec /fa or the bundle's own repair
would be acting on shared-identity MSIs on the one kind of machine known to
have other products' drivers registered against them, which is not a risk
worth taking to save a download.

The installer code itself is unverified: there is no Inno Setup on the machine
this was written on, so the Pascal has not been compiled and no install has
been run. It also assumes ssPostInstall follows the non-postinstall [Run]
entries. That assumption fails loudly if wrong — every healthy install would
warn — which is why the check sits there rather than behind a wrapper built to
guarantee the ordering.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 22:17:28 -07:00

141 lines
6.6 KiB
Plaintext

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; Non-commercial use only
#define MyAppName "SteamlessController"
#define MyAppVersion "1.15"
#define ViGEmSetup "ViGEmBus_1.22.0_x64_x86_arm64.exe"
#define MyAppPublisher "Dylan Deverill"
#define MyAppURL "https://github.com/ddeverill/SteamlessController"
#define MyAppExeName "SteamlessController.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{4E6FF864-969A-44C6-B4AC-848F22D5EF57}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
SourceDir=..
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run
; on anything but x64 and Windows 11 on Arm.
ArchitecturesAllowed=x64compatible
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the
; install be done in "64-bit mode" on x64 or Windows 11 on Arm,
; meaning it should use the native 64-bit Program Files directory and
; the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64compatible
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only).
;PrivilegesRequired=lowest
OutputBaseFilename=SteamlessController-Setup
SetupIconFile=resources\SteamControllerON.ico
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "build\release\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "build\release\Release\SteamlessDeviceCycle.exe"; DestDir: "{app}"; Flags: ignoreversion
; Setup's driver check, and the thing to ask a user to run when a controller
; never reaches a game. Installed rather than temporary for the second reason.
Source: "build\release\Release\ViGEmBusProbe.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "resources\{#ViGEmSetup}"; DestDir: "{tmp}"; Flags: deleteafterinstall
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
; ViGEmBus uses MSI-style silent switches; /install is rejected by the 1.22.0 bootstrapper.
Filename: "{tmp}\{#ViGEmSetup}"; Parameters: "/qn /norestart"; StatusMsg: "Installing ViGEmBus driver..."; Flags: waituntilterminated
; Register the elevated on-demand device-cycle task while the installer is
; already elevated, so users never see a UAC prompt from the app itself.
Filename: "{app}\SteamlessDeviceCycle.exe"; Parameters: "--register"; StatusMsg: "Registering controller helper task..."; Flags: waituntilterminated runhidden
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[UninstallRun]
Filename: "{app}\SteamlessDeviceCycle.exe"; Parameters: "--unregister"; RunOnceId: "RemoveCycleTask"; Flags: waituntilterminated runhidden
[Code]
// Did ViGEmBus actually install? Established the way the app establishes it at
// runtime — by enumerating the ViGEm bus interface — because every cheaper
// answer has been measured and found to lie:
//
// * the bundle exits 0 when it finds a related product already registered
// and decides there is nothing for it to do
// * the registry records the product whether or not a driver ever landed
// * the driver's own version is no guide either: 1.22.0 ships a binary still
// stamped 1.21.442.0
//
// Reported in #68: with another program's rebranded ViGEm already present,
// setup looked entirely successful and left the machine with no working bus.
// The user found out when they clicked Enable Steamless Mode.
function ViGEmBusPresent(): Boolean;
var
ResultCode: Integer;
begin
// Assume the best when the check itself cannot run. A missing or broken
// probe is our bug, and telling every user their driver failed on account of
// it would be worse than saying nothing at all.
Result := True;
if not Exec(ExpandConstant('{app}\ViGEmBusProbe.exe'), '', '',
SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
Log('ViGEmBus verification: probe could not be run');
Exit;
end;
Log('ViGEmBus verification: probe exit code ' + IntToStr(ResultCode));
Result := ResultCode = 0;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
WarningText: String;
begin
// ssPostInstall runs after the [Run] entries above, so the driver installer
// has finished by the time this fires. Worth stating because it is
// load-bearing: were that ordering ever wrong, every healthy install would
// warn. That is a loud failure rather than a quiet one, which is why the
// check sits here rather than behind a wrapper built to guarantee ordering.
if CurStep <> ssPostInstall then
Exit;
if ViGEmBusPresent() then
Exit;
WarningText :=
'SteamlessController is installed, but the ViGEmBus driver is not.' + #13#10 + #13#10 +
'That driver is what presents your controller to games. Setup ran its ' +
'installer, but no virtual gamepad bus is present afterwards. Usually this ' +
'means another program has already registered a version of it — Oculus and ' +
'Virtual Desktop both ship their own copy — which stops the bundled ' +
'installer from doing anything.' + #13#10 + #13#10 +
'To finish:' + #13#10 + #13#10 +
' 1. Download ViGEmBus from' + #13#10 +
' https://github.com/nefarius/ViGEmBus/releases/latest' + #13#10 +
' 2. Run it, choosing Repair if it offers that rather than a fresh install' + #13#10 +
' 3. Start SteamlessController — it picks the driver up on its own,' + #13#10 +
' with no reinstall and no restart needed' + #13#10 + #13#10 +
'To check again later, run ViGEmBusProbe.exe from the installation folder.';
// An unattended install must not stop on a dialog nobody is there to close.
// The Inno log carries the same finding either way, and so will the app's
// event log the first time somebody enables Steamless Mode.
if WizardSilent() then
Log('ViGEmBus verification: no bus present after install (silent, not shown)')
else
MsgBox(WarningText, mbInformation, MB_OK);
end;