Skip to content

Commit

Permalink
Uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
r57zone committed Sep 2, 2018
1 parent 50b614d commit 5c80d1f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 21 deletions.
29 changes: 19 additions & 10 deletions TrueOpenVR SteamVR/Unit1.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Main: TMain
BorderStyle = bsSingle
Caption = 'TrueOpenVR SteamVR'
ClientHeight = 92
ClientWidth = 292
ClientWidth = 283
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Expand All @@ -24,43 +24,52 @@ object Main: TMain
Height = 13
Caption = 'Debug mode (not recommended): '
end
object ApplyBtn: TButton
object InstallBtn: TButton
Left = 8
Top = 59
Width = 75
Height = 25
Caption = 'Install'
TabOrder = 1
OnClick = ApplyBtnClick
OnClick = InstallBtnClick
end
object CancelBtn: TButton
Left = 88
Left = 168
Top = 59
Width = 75
Height = 25
Caption = 'Cancel'
TabOrder = 2
TabOrder = 3
OnClick = CancelBtnClick
end
object AboutBtn: TButton
Left = 256
Left = 248
Top = 59
Width = 28
Height = 25
Caption = '?'
TabOrder = 3
TabOrder = 4
OnClick = AboutBtnClick
end
object DbgMdCb: TCheckBox
Left = 224
Left = 216
Top = 8
Width = 60
Height = 17
Caption = 'Activate'
TabOrder = 0
end
object XPManifest: TXPManifest
Left = 224
object UninstallBtn: TButton
Left = 88
Top = 59
Width = 75
Height = 25
Caption = 'Uninstall'
TabOrder = 2
OnClick = UninstallBtnClick
end
object XPManifest: TXPManifest
Left = 216
Top = 27
end
end
39 changes: 28 additions & 11 deletions TrueOpenVR SteamVR/Unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ interface

type
TMain = class(TForm)
ApplyBtn: TButton;
InstallBtn: TButton;
CancelBtn: TButton;
AboutBtn: TButton;
XPManifest: TXPManifest;
DbgMdCb: TCheckBox;
DbgMdLbl: TLabel;
UninstallBtn: TButton;
procedure FormCreate(Sender: TObject);
procedure AboutBtnClick(Sender: TObject);
procedure ApplyBtnClick(Sender: TObject);
procedure InstallBtnClick(Sender: TObject);
procedure CancelBtnClick(Sender: TObject);
procedure UninstallBtnClick(Sender: TObject);
private
{ Private declarations }
public
Expand All @@ -26,15 +28,26 @@ TMain = class(TForm)

var
Main: TMain;
SteamPath: string;

implementation

{$R *.dfm}

procedure TMain.FormCreate(Sender: TObject);
var
Reg: TRegistry;
begin
Application.Title:=Caption;

Reg:=TRegistry.Create;
//Steam
Reg.RootKey:=HKEY_CURRENT_USER;
if (Reg.OpenKey('\Software\Valve\Steam', false)) then
SteamPath:=StringReplace(Reg.ReadString('SteamPath'), '/', '\', [rfReplaceAll]);
Reg.CloseKey;
Reg.Free;

DbgMdLbl.Caption:=DbgMdLbl.Caption + #13#10 + 'Windowed borderless fullscreen' + #13#10 + 'with lock to 30 FPS';
end;

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

procedure TMain.ApplyBtnClick(Sender: TObject);
procedure TMain.InstallBtnClick(Sender: TObject);
var
Reg: TRegistry;
SteamPath: string;
Config: TStringList;
Error: boolean;

RenderWidth, RenderHeight, ScreenIndex: integer;
IPD, DistortionK1, DistortionK2: double;
begin
Error:=false;
Reg:=TRegistry.Create;
//Steam
Reg.RootKey:=HKEY_CURRENT_USER;
if (Reg.OpenKey('\Software\Valve\Steam', false)) then
SteamPath:=StringReplace(Reg.ReadString('SteamPath'), '/', '\', [rfReplaceAll]);
Reg.CloseKey;

Reg:=TRegistry.Create;
//TrueOpenVR
Reg.RootKey:=HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\TrueOpenVR', false) then begin
Expand Down Expand Up @@ -133,7 +140,7 @@ procedure TMain.ApplyBtnClick(Sender: TObject);
end;

if Error = false then
Application.MessageBox('Done', PChar(Caption), MB_ICONINFORMATION);
Application.MessageBox('Installed', PChar(Caption), MB_ICONINFORMATION);

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

procedure TMain.UninstallBtnClick(Sender: TObject);
begin
if DirectoryExists(SteamPath) then begin
if FileExists(SteamPath + '\config\steamvr.vrsettings') then
DeleteFile(SteamPath + '\config\steamvr.vrsettings');
Application.MessageBox('Uninstalled', PChar(Caption), MB_ICONINFORMATION);
end else
Application.MessageBox('Steam not found. Please install Steam and SteamVR', PChar(Caption), MB_ICONERROR);
end;

end.

0 comments on commit 5c80d1f

Please sign in to comment.