-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.dpr
121 lines (100 loc) · 2.83 KB
/
install.dpr
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
program install;
{$APPTYPE CONSOLE}
uses
Windows, SysUtils, IniFiles, Registry;
type
TInstallCLEO = function(const aGamePath, aSannyPath: PChar; CLEOInstallType: Byte): Boolean;
var
I: Integer;
lpExeName, lpDir, lpLib: string;
CLEOInstallType: Byte = 0;
hndDLLHandle: THandle;
InstallCLEO: TInstallCLEO;
begin
lpExeName := ParamStr(1) + '\sanny.exe';
with TIniFile.Create(ExtractFileDir(ParamStr(0)) + '\data\settings.ini') do
try
i := 1;
while i <= ParamCount do
begin
// file assotiation
if ParamStr(i) = '-a' then
begin
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
OpenKey('.scm\shell\Open with Sanny Builder\command', True);
WriteString('', lpExeName + ' "%1"');
finally
Free;
end;
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
OpenKey('.scm\DefaultIcon', True);
WriteString('', lpExeName + ',0');
finally
Free;
end;
end
// current game and path
else if ParamStr(i) = '-g' then
begin
if i = ParamCount then
Continue
else begin
Inc(i);
lpDir := ParamStr(i);
if not DirectoryExists(lpDir) then Continue;
if (FileExists(lpDir + '\gta_sa.exe') or (FileExists(lpDir + '\gta-sa.exe'))) then
begin
WriteString('SA', 'GamePath', lpDir);
WriteInteger('Main', 'EditMode', 2);
CLEOInstallType := 2;
end
else if FileExists(lpDir + '\gta-vc.exe') then
begin
WriteString('VC', 'GamePath', lpDir);
WriteInteger('Main', 'EditMode', 1);
CLEOInstallType := 5;
end
else if FileExists(lpDir + '\gta3.exe') then
begin
WriteString('GTA3', 'GamePath', lpDir);
WriteInteger('Main', 'EditMode', 0);
CLEOInstallType := 6;
end
end
end
else if (ParamStr(i) = '-c') and (CLEOInstallType > 0) then
begin
lpLib := ParamStr(1) + '\data\common.dll';
hndDLLHandle := LoadLibrary(PChar(lpLib));
try
if hndDLLHandle <> 0 then
begin
@InstallCLEO := GetProcAddress(hndDLLHandle, 'InstallCLEO');
if Addr(InstallCLEO) <> nil then
begin
InstallCLEO(Pchar(lpDir), PChar(ParamStr(1) + '\'), CLEOInstallType);
end;
end
finally
freeLibrary(hndDLLHandle);
end;
end
else if (ParamStr(i) = '-l') then
begin
if i = ParamCount then
Continue
else begin
Inc(i);
WriteString('Lang', 'Lang', ParamStr(i));
end;
end;
Inc(i);
end;
finally
Free;
end;
end.