Skip to content

Commit 5c80d1f

Browse files
committed
Uninstall
1 parent 50b614d commit 5c80d1f

File tree

2 files changed

+47
-21
lines changed

2 files changed

+47
-21
lines changed

TrueOpenVR SteamVR/Unit1.dfm

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object Main: TMain
55
BorderStyle = bsSingle
66
Caption = 'TrueOpenVR SteamVR'
77
ClientHeight = 92
8-
ClientWidth = 292
8+
ClientWidth = 283
99
Color = clBtnFace
1010
Font.Charset = DEFAULT_CHARSET
1111
Font.Color = clWindowText
@@ -24,43 +24,52 @@ object Main: TMain
2424
Height = 13
2525
Caption = 'Debug mode (not recommended): '
2626
end
27-
object ApplyBtn: TButton
27+
object InstallBtn: TButton
2828
Left = 8
2929
Top = 59
3030
Width = 75
3131
Height = 25
3232
Caption = 'Install'
3333
TabOrder = 1
34-
OnClick = ApplyBtnClick
34+
OnClick = InstallBtnClick
3535
end
3636
object CancelBtn: TButton
37-
Left = 88
37+
Left = 168
3838
Top = 59
3939
Width = 75
4040
Height = 25
4141
Caption = 'Cancel'
42-
TabOrder = 2
42+
TabOrder = 3
4343
OnClick = CancelBtnClick
4444
end
4545
object AboutBtn: TButton
46-
Left = 256
46+
Left = 248
4747
Top = 59
4848
Width = 28
4949
Height = 25
5050
Caption = '?'
51-
TabOrder = 3
51+
TabOrder = 4
5252
OnClick = AboutBtnClick
5353
end
5454
object DbgMdCb: TCheckBox
55-
Left = 224
55+
Left = 216
5656
Top = 8
5757
Width = 60
5858
Height = 17
5959
Caption = 'Activate'
6060
TabOrder = 0
6161
end
62-
object XPManifest: TXPManifest
63-
Left = 224
62+
object UninstallBtn: TButton
63+
Left = 88
6464
Top = 59
65+
Width = 75
66+
Height = 25
67+
Caption = 'Uninstall'
68+
TabOrder = 2
69+
OnClick = UninstallBtnClick
70+
end
71+
object XPManifest: TXPManifest
72+
Left = 216
73+
Top = 27
6574
end
6675
end

TrueOpenVR SteamVR/Unit1.pas

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ interface
88

99
type
1010
TMain = class(TForm)
11-
ApplyBtn: TButton;
11+
InstallBtn: TButton;
1212
CancelBtn: TButton;
1313
AboutBtn: TButton;
1414
XPManifest: TXPManifest;
1515
DbgMdCb: TCheckBox;
1616
DbgMdLbl: TLabel;
17+
UninstallBtn: TButton;
1718
procedure FormCreate(Sender: TObject);
1819
procedure AboutBtnClick(Sender: TObject);
19-
procedure ApplyBtnClick(Sender: TObject);
20+
procedure InstallBtnClick(Sender: TObject);
2021
procedure CancelBtnClick(Sender: TObject);
22+
procedure UninstallBtnClick(Sender: TObject);
2123
private
2224
{ Private declarations }
2325
public
@@ -26,15 +28,26 @@ TMain = class(TForm)
2628

2729
var
2830
Main: TMain;
31+
SteamPath: string;
2932

3033
implementation
3134

3235
{$R *.dfm}
3336

3437
procedure TMain.FormCreate(Sender: TObject);
38+
var
39+
Reg: TRegistry;
3540
begin
3641
Application.Title:=Caption;
3742

43+
Reg:=TRegistry.Create;
44+
//Steam
45+
Reg.RootKey:=HKEY_CURRENT_USER;
46+
if (Reg.OpenKey('\Software\Valve\Steam', false)) then
47+
SteamPath:=StringReplace(Reg.ReadString('SteamPath'), '/', '\', [rfReplaceAll]);
48+
Reg.CloseKey;
49+
Reg.Free;
50+
3851
DbgMdLbl.Caption:=DbgMdLbl.Caption + #13#10 + 'Windowed borderless fullscreen' + #13#10 + 'with lock to 30 FPS';
3952
end;
4053

@@ -45,24 +58,18 @@ procedure TMain.AboutBtnClick(Sender: TObject);
4558
'[email protected]', PChar(Caption), MB_ICONINFORMATION);
4659
end;
4760

48-
procedure TMain.ApplyBtnClick(Sender: TObject);
61+
procedure TMain.InstallBtnClick(Sender: TObject);
4962
var
5063
Reg: TRegistry;
51-
SteamPath: string;
5264
Config: TStringList;
5365
Error: boolean;
5466

5567
RenderWidth, RenderHeight, ScreenIndex: integer;
5668
IPD, DistortionK1, DistortionK2: double;
5769
begin
5870
Error:=false;
59-
Reg:=TRegistry.Create;
60-
//Steam
61-
Reg.RootKey:=HKEY_CURRENT_USER;
62-
if (Reg.OpenKey('\Software\Valve\Steam', false)) then
63-
SteamPath:=StringReplace(Reg.ReadString('SteamPath'), '/', '\', [rfReplaceAll]);
64-
Reg.CloseKey;
6571

72+
Reg:=TRegistry.Create;
6673
//TrueOpenVR
6774
Reg.RootKey:=HKEY_CURRENT_USER;
6875
if Reg.OpenKey('\Software\TrueOpenVR', false) then begin
@@ -133,7 +140,7 @@ procedure TMain.ApplyBtnClick(Sender: TObject);
133140
end;
134141

135142
if Error = false then
136-
Application.MessageBox('Done', PChar(Caption), MB_ICONINFORMATION);
143+
Application.MessageBox('Installed', PChar(Caption), MB_ICONINFORMATION);
137144

138145
end else
139146
Application.MessageBox('Steam not found. Please install Steam and SteamVR', PChar(Caption), MB_ICONERROR);
@@ -147,4 +154,14 @@ procedure TMain.CancelBtnClick(Sender: TObject);
147154
Close;
148155
end;
149156

157+
procedure TMain.UninstallBtnClick(Sender: TObject);
158+
begin
159+
if DirectoryExists(SteamPath) then begin
160+
if FileExists(SteamPath + '\config\steamvr.vrsettings') then
161+
DeleteFile(SteamPath + '\config\steamvr.vrsettings');
162+
Application.MessageBox('Uninstalled', PChar(Caption), MB_ICONINFORMATION);
163+
end else
164+
Application.MessageBox('Steam not found. Please install Steam and SteamVR', PChar(Caption), MB_ICONERROR);
165+
end;
166+
150167
end.

0 commit comments

Comments
 (0)