forked from nomi-san/parsec-vdd
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Setup.iss
196 lines (168 loc) · 5.94 KB
/
Setup.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#define MyAppName "ParsecVDA - Always Connected"
#define MyAppVersion "1.4.1"
#define MyAppURL "https://github.com/timminator/ParsecVDA-Always-Connected"
#define MyAppExeName "ParsecVDA - Always Connected.exe"
#define _Major
#define _Minor
#define _Rev
#define _Build
#define VddVersion GetVersionComponents(".\parsec-vdd-setup.exe", _Major, _Minor, _Rev, _Build), Str(_Major) + "." + Str(_Minor)
[Setup]
SignTool=signtool $f
AppId={{4EC2E655-53B0-4B4A-A3C9-42C445FA22CE}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonpf64}\{#MyAppName}
UsePreviousAppDir=yes
LicenseFile=..\..\LICENSE
DisableProgramGroupPage=yes
PrivilegesRequired=admin
OutputBaseFilename={#MyAppName}-v{#MyAppVersion}-setup-x64
SetupIconFile=..\..\parsec.ico
Compression=lzma
SolidCompression=yes
WizardStyle=classic
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Messages]
SelectTasksLabel2=Select the additional tasks you would like Setup to perform.%nParsecVDA - Always Connected requires the Parsec Virtual Display Driver. If the driver is already installed, you can uncheck this task. To continue, click Next.
FinishedLabel=Setup has finished installing [name] on your computer.%n%nAdditional notice: If you are using this software in combination with the Parsec App, make sure that under Settings > Host > "Fallback to Virtual Display" is set to off.
[Dirs]
Name: "{app}"; Permissions: everyone-full
[Files]
Source: ".\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\parsec-vdd-setup.exe"; DestDir: "{app}\driver"
Source: ".\Setup.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\CheckPrerequisites.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\ParsecVDAAC.xml"; DestDir: "{app}"; Flags: onlyifdoesntexist
Source: ".\ParsecVDAAC.exe"; DestDir: "{app}"; Flags: onlyifdoesntexist
Source: ".\LICENSE_parsec-vdd.txt"; Flags: dontcopy
Source: ".\LICENSE_winsw.txt"; Flags: dontcopy
[Code]
procedure RunBatchFile(FileName: String; WorkingDir: String);
var
ResultCode: Integer;
begin
Exec(ExpandConstant(FileName), '', WorkingDir, SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
ExtractTemporaryFile('CheckPrerequisites.bat');
RunBatchFile('{tmp}\CheckPrerequisites.bat', ExpandConstant('{app}'));
Result := '';
end;
var
LicenseAcceptedRadioButtons: array of TRadioButton;
procedure CheckLicenseAccepted(Sender: TObject);
begin
// Update Next button when user (un)accepts the license
WizardForm.NextButton.Enabled :=
LicenseAcceptedRadioButtons[TComponent(Sender).Tag].Checked;
end;
procedure LicensePageActivate(Sender: TWizardPage);
begin
// Update Next button when user gets to second license page
CheckLicenseAccepted(LicenseAcceptedRadioButtons[Sender.Tag]);
end;
function CloneLicenseRadioButton(
Page: TWizardPage; Source: TRadioButton): TRadioButton;
begin
Result := TRadioButton.Create(WizardForm);
Result.Parent := Page.Surface;
Result.Caption := Source.Caption;
Result.Left := Source.Left;
Result.Top := Source.Top;
Result.Width := Source.Width;
Result.Height := Source.Height;
// Needed for WizardStyle=modern / WizardResizable=yes
Result.Anchors := Source.Anchors;
Result.OnClick := @CheckLicenseAccepted;
Result.Tag := Page.Tag;
end;
var
LicenseAfterPage: Integer;
procedure AddLicensePage(LicenseFileName: string);
var
Idx: Integer;
Page: TOutputMsgMemoWizardPage;
LicenseFilePath: string;
RadioButton: TRadioButton;
begin
Idx := GetArrayLength(LicenseAcceptedRadioButtons);
SetArrayLength(LicenseAcceptedRadioButtons, Idx + 1);
Page :=
CreateOutputMsgMemoPage(
LicenseAfterPage, SetupMessage(msgWizardLicense),
SetupMessage(msgLicenseLabel), SetupMessage(msgLicenseLabel3), '');
Page.Tag := Idx;
// Shrink license box to make space for radio buttons
Page.RichEditViewer.Height := WizardForm.LicenseMemo.Height;
Page.OnActivate := @LicensePageActivate;
// Load license
// Loading ex-post, as Lines.LoadFromFile supports UTF-8,
// contrary to LoadStringFromFile.
ExtractTemporaryFile(LicenseFileName);
LicenseFilePath := ExpandConstant('{tmp}\' + LicenseFileName);
Page.RichEditViewer.Lines.LoadFromFile(LicenseFilePath);
DeleteFile(LicenseFilePath);
// Clone accept/do not accept radio buttons
RadioButton :=
CloneLicenseRadioButton(Page, WizardForm.LicenseAcceptedRadio);
LicenseAcceptedRadioButtons[Idx] := RadioButton;
RadioButton :=
CloneLicenseRadioButton(Page, WizardForm.LicenseNotAcceptedRadio);
// Initially not accepted
RadioButton.Checked := True;
LicenseAfterPage := Page.ID;
end;
procedure InitializeWizard();
begin
LicenseAfterPage := wpLicense;
AddLicensePage('LICENSE_parsec-vdd.txt');
AddLicensePage('LICENSE_winsw.txt');
end;
var
isSilent: Boolean;
function InitializeSetup(): Boolean;
var
j: Integer;
begin
Result := True;
IsSilent := False;
for j := 1 to ParamCount do
begin
if (CompareText(ParamStr(j), '/verysilent') = 0) or
(CompareText(ParamStr(j), '/silent') = 0) then
begin
IsSilent := True;
Break;
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
var
I: Integer;
begin
// Automatically accept licenses if running in silent mode
if IsSilent then
begin
for I := 0 to GetArrayLength(LicenseAcceptedRadioButtons) - 1 do
begin
LicenseAcceptedRadioButtons[I].Checked := True;
end;
end;
end;
[Tasks]
Name: install_vdd; Description: "Install Parsec VDD v{#VddVersion}"
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
[Run]
Filename: "{app}\driver\parsec-vdd-setup.exe"; Parameters: "/S"; Flags: runascurrentuser; Tasks: install_vdd
Filename: "{app}\Setup.bat"; Parameters: "install"; Flags: runhidden
[UninstallRun]
Filename: "{app}\Setup.bat"; Parameters: "uninstall"; Flags: runhidden