summaryrefslogtreecommitdiffhomepage
path: root/installer/opentrack-installer.iss
blob: 2f98aaac507eff20ff94bf9fbfcffde18002b8c0 (plain)
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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#include "../build/opentrack-version.hxx"
#define MyAppName "opentrack"
#define MyAppVersion OPENTRACK_VERSION
#define MyAppPublisher "opentrack"
#define MyAppURL "http://github.com/opentrack/opentrack"
#define MyAppExeName "opentrack.exe"

#include "non-ui-blocking-exec.iss"

[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={{63F53541-A29E-4B53-825A-9B6F876A2BD6}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename={#MyAppVersion}-win32-setup
SetupIconFile=..\variant\default\opentrack.ico
Compression=lzma2/ultra64
SolidCompression=yes
DisableWelcomePage=True
DisableReadyPage=True
DisableReadyMemo=True
RestartIfNeededByRun=False
InternalCompressLevel=ultra
CompressionThreads=4
LZMANumFastBytes=273
MinVersion=0,5.01sp2

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\build-clion-msvc-dev\install\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "timeout.exe"; Parameters: "/t 0"; Flags: runhidden; StatusMsg: Installing RealSense Runtime. This may take several minutes.; Check: RSCameraDriverDetectedAndEulaAccepted
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; 

[Code]
var
  EulaAccepted:Boolean;
  RSCameraDriverDetected:Boolean;
  EULAPage: TOutputMsgMemoWizardPage;
  EULAAcceptRadioButton: TNewRadioButton;
  EULARefuseRadioButton: TNewRadioButton;

function IsRSCameraDriverPresent():Boolean;
var
    Version:String;
begin
      result := RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Intel\RSSDK\Components\ivcam',
     'Version', Version) or RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Wow6432Node\Intel\RSDCM\SR300',
     'Version', Version)
end;

procedure EULAAcceptRefuseButtonStateUpdated(Sender: TObject);
begin
  EulaAccepted := EULAAcceptRadioButton.Checked
end;


function RSCameraDriverDetectedAndEulaAccepted():Boolean;
begin
result := RSCameraDriverDetected and EulaAccepted;
end;

procedure DoPostInstall();
var
  Version: String;               
  ExecInfo: TShellExecuteInfo;
begin
if RSCameraDriverDetectedAndEulaAccepted then
  begin
    NonUiBlockingExec(ExpandConstant('{app}\doc\contrib\intel_rs_sdk_runtime_websetup_10.0.26.0396.exe'), 
    '--silent --no-progress --acceptlicense=yes --front --finstall=core,face3d --fnone=all');
  end
end;

procedure CurStepChanged(CurStep: TSetupStep);
 begin
 if CurStep = ssPostInstall then
 begin
   DoPostInstall()
 end
end;

procedure InitializeWizard();
var
  EULAText: AnsiString;
begin

EulaAccepted := false
RSCameraDriverDetected := IsRSCameraDriverPresent()

if RSCameraDriverDetected then
  begin
  ExtractTemporaryFile('RS_EULA.rtf');
    if LoadStringFromFile(ExpandConstant('{tmp}\RS_EULA.rtf'), EULAText) then
    begin
    EULAPage := CreateOutputMsgMemoPage(wpLicense,
      'Information', 'Intel RealSense End-User License agreement',
      'Opentrack may use the Intel RealSense SDK Runtime on your compatible system. To get it installed, please accept its EULA:',
      EULAText); 
      EULAPage.RichEditViewer.Height := ScaleY(148);
      EULAAcceptRadioButton := TNewRadioButton.Create(EULAPage);
      EULAAcceptRadioButton.Left := EULAPage.RichEditViewer.Left;
      EULAAcceptRadioButton.Top := EULAPage.Surface.ClientHeight - ScaleY(41);
      EULAAcceptRadioButton.Width := EULAPage.RichEditViewer.Width;
      EULAAcceptRadioButton.Parent := EULAPage.Surface;
      EULAAcceptRadioButton.Caption := SetupMessage(msgLicenseAccepted);
      EULARefuseRadioButton := TNewRadioButton.Create(EULAPage);
      EULARefuseRadioButton.Left := EULAPage.RichEditViewer.Left;
      EULARefuseRadioButton.Top := EULAPage.Surface.ClientHeight - ScaleY(21);
      EULARefuseRadioButton.Width := EULAPage.RichEditViewer.Width;
      EULARefuseRadioButton.Parent := EULAPage.Surface;
      EULARefuseRadioButton.Caption := SetupMessage(msgLicenseNotAccepted);

      // Set the states and event handlers
      EULAAcceptRadioButton.OnClick := @EULAAcceptRefuseButtonStateUpdated;
      EULARefuseRadioButton.OnClick := @EULAAcceptRefuseButtonStateUpdated;
      EULARefuseRadioButton.Checked := true;
      EulaAccepted := EULAAcceptRadioButton.Checked
    //TODO: if camera is detected, activate RS EULA page and RSSDK install, save if it was accepted or not. 
    end
  end
end;