@@ -4,11 +4,12 @@ interface
44
55uses
66 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7- Dialogs, ExtCtrls, Jpeg, StdCtrls;
7+ Dialogs, ExtCtrls, Jpeg, StdCtrls, XPMan, Registry ;
88
99type
1010 TMain = class (TForm)
1111 View : TImage;
12+ XPManifest1: TXPManifest;
1213 procedure FormCreate (Sender: TObject);
1314 procedure FormKeyDown (Sender: TObject; var Key: Word;
1415 Shift: TShiftState);
@@ -25,18 +26,6 @@ TMain = class(TForm)
2526 { Public declarations }
2627 end ;
2728
28- type
29- // VR Init
30- PVRInfo = ^TVRInfo;
31- _VRInfo = record
32- ScreenIndex: integer;
33- Scale: boolean;
34- UserWidth: integer;
35- UserHeight: integer;
36- end ;
37- VRInfo = _VRInfo;
38- TVRInfo = VRInfo;
39-
4029var
4130 Main: TMain;
4231
@@ -46,52 +35,66 @@ implementation
4635
4736{ $R *.dfm}
4837
49- function GetInfo (out myVRInfo: TVRInfo): DWORD; stdcall; external ' TOVR.dll' name ' GetInfo' ;
50-
5138procedure TMain.FormCreate (Sender: TObject);
5239var
53- iResult: integer; myVRInfo: TVRInfo ;
40+ iResult: integer; Reg: TRegistry; ScreenIndex, UserWidth, UserHeight: integer; ScreenScale: boolean ;
5441begin
5542 Application.Title:=Caption;
5643
5744 if FileExists(ExtractFilePath(ParamStr(0 )) + ' VR-Quake-screenshot.jpg' ) then
5845 View .Picture.LoadFromFile(ExtractFilePath(ParamStr(0 )) + ' VR-Quake-screenshot.jpg' );
46+
5947 // VR Init info
60- iResult:=GetInfo(myVRInfo);
61- if iResult = 0 then begin
62- ShowMessage(' Info not found' );
63- Exit;
64- end ;
48+ Reg:=TRegistry.Create;
49+ Reg.RootKey:=HKEY_CURRENT_USER;
50+ if Reg.OpenKey(' \Software\TrueOpenVR' , true) then begin
51+ try
52+ ScreenScale:=Reg.ReadBool(' Scale' );
53+ ScreenIndex:=Reg.ReadInteger(' ScreenIndex' );
54+ UserWidth:=Reg.ReadInteger(' UserWidth' );
55+ UserHeight:=Reg.ReadInteger(' UserHeight' );
56+ except
57+ ScreenScale:=false;
58+ ScreenIndex:=1 ;
59+ UserWidth:=1280 ;
60+ UserHeight:=720 ;
61+ end ;
62+ Reg.CloseKey;
63+ end else begin
64+ ShowMessage(' TrueOpenVR not found' );
65+ Exit;
66+ end ;
67+ Reg.Free;
6568
66- if myVRInfo. ScreenIndex <= Screen.MonitorCount then begin
69+ if ScreenIndex <= Screen.MonitorCount then begin
6770
68- Left:=Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Left;
69- Top:=Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Top;
71+ Left:=Screen.Monitors[ScreenIndex - 1 ].Left;
72+ Top:=Screen.Monitors[ScreenIndex - 1 ].Top;
7073
71- if Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Width > myVRInfo. UserWidth
74+ if Screen.Monitors[ScreenIndex - 1 ].Width > UserWidth
7275 then begin
7376 // Image on center
74- Width:=Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Width;
75- View .Width:=myVRInfo. UserWidth;
77+ Width:=Screen.Monitors[ScreenIndex - 1 ].Width;
78+ View .Width:=UserWidth;
7679 View .Left:=Width div 2 - View .Width div 2 ;
7780 end else begin
78- Width:=Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Width;
81+ Width:=Screen.Monitors[ScreenIndex - 1 ].Width;
7982 View .Width:=Width;
8083 end ;
8184
82- if Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Height > myVRInfo. UserHeight
85+ if Screen.Monitors[ScreenIndex - 1 ].Height > UserHeight
8386 then begin
8487 // Image on center
85- Height:=Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Height;
86- View .Height:=myVRInfo. UserHeight;
88+ Height:=Screen.Monitors[ScreenIndex - 1 ].Height;
89+ View .Height:=UserHeight;
8790 View .Top:=Height div 2 - View .Height div 2 ;
8891 end else begin
89- Height:=Screen.Monitors[myVRInfo. ScreenIndex - 1 ].Height;
92+ Height:=Screen.Monitors[ScreenIndex - 1 ].Height;
9093 View .Height:=Height;
9194 end ;
9295
9396 // Scale
94- if myVRInfo.Scale then begin
97+ if ScreenScale then begin
9598 View .Left:=0 ;
9699 View .Top:=0 ;
97100 View .Width:=Width;
0 commit comments