forked from medfreeman/RogueSquadron3DInstaller
-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.nsi
99 lines (86 loc) · 2.3 KB
/
utils.nsi
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
!include "LogicLib.nsh"
Function RunningOnWine
Push $R0
Push $R1
ClearErrors
EnumRegKey $R1 HKCU "Software\Wine" 0
${If} ${Errors} ;key does not exist
StrCpy $R0 0
${Else}
StrCpy $R0 1
${EndIf}
Pop $R1
Exch $R0
FunctionEnd
Function GetnGlideVersion
Push $R0
Push $R1
ClearErrors
EnumRegKey $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\nGlide" 0
${If} ${Errors} ;key does not exist
StrCpy $R0 0
${Else}
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\nGlide" "DisplayVersion"
${If} ${Errors}
StrCpy $R0 0
${Else}
StrCpy $R0 $R1 1 ; get the major version
StrCpy $R1 $R1 2 2 ; get the minor version
IntOp $R0 $R0 * 100
IntOp $R0 $R0 + $R1
${EndIf}
${EndIf}
Pop $R1
Exch $R0
FunctionEnd
Function SetnGlideDefaults
Push $R0
Call 64bitRegistrySet
ClearErrors
WriteRegStr HKCU "Software\Zeus Software\nGlide" "Aspect" "0"
WriteRegStr HKCU "Software\Zeus Software\nGlide" "Gamma" "5"
WriteRegStr HKCU "Software\Zeus Software\nGlide" "Refresh" "0"
WriteRegStr HKCU "Software\Zeus Software\nGlide" "Resolution" "1"
WriteRegStr HKCU "Software\Zeus Software\nGlide" "Splash" "0"
WriteRegStr HKCU "Software\Zeus Software\nGlide" "Vsync" "1"
Call 64bitRegistryUnset
Pop $R0
FunctionEnd
Function GetDXVersion
Call 64bitRegistrySet
Push $0
Push $1
ClearErrors
ReadRegStr $0 HKLM "Software\Microsoft\DirectX" "Version"
IfErrors noDirectX
StrCpy $1 $0 2 5 ; get the minor version
StrCpy $0 $0 2 2 ; get the major version
IntOp $0 $0 * 100 ; $0 = major * 100 + minor
IntOp $0 $0 + $1
Goto done
noDirectX:
StrCpy $0 0
done:
Pop $1
Exch $0
Call 64bitRegistryUnset
FunctionEnd
; Create the shared function.
!macro 64BITREGISTRY un
Function ${un}64bitRegistrySet
!include "x64.nsh"
;64bit registry
${If} ${RunningX64}
SetRegView 64
${EndIf}
FunctionEnd
Function ${un}64bitRegistryUnset
!include "x64.nsh"
${If} ${RunningX64}
SetRegView 32
${EndIf}
FunctionEnd
!macroend
; Insert function as an installer and uninstaller function.
!insertmacro 64BITREGISTRY ""
!insertmacro 64BITREGISTRY "un."