You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Well, config load failed. Attempt to read reg or read user input...
@@ -157,43 +157,38 @@ function TSettings.GetGameDir(): string;
157
157
functionTryReadRegKey(
158
158
reg: TRegistry;
159
159
key: string;
160
-
t: string
160
+
subkey: string;
161
+
exe_path: string
161
162
): string;
162
163
var
163
164
tmp: string;
164
165
begin
165
-
Result := '';
166
166
if reg.KeyExists(key) then
167
167
begin
168
168
reg.OpenKeyReadOnly(key);
169
-
if reg.ValueExists(t) then
170
-
tmp := reg.ReadString( t );
169
+
if reg.ValueExists(subkey) then
170
+
tmp := reg.ReadString(subkey);
171
171
reg.CloseKey();
172
172
173
-
tmp := path_join(tmp, 'Generals.exe');
173
+
tmp := path_join(tmp, exe_path);
174
174
if FileExists(tmp) then
175
175
Result := tmp;
176
176
end;
177
177
end;
178
178
179
-
functionResolveZH(
180
-
reg: TRegistry;
181
-
t: string
182
-
): string;
179
+
functionResolveZH(reg: TRegistry): string;
183
180
var
184
-
key: string;
185
181
tmp: string;
186
182
begin
187
-
Result := TryReadRegKey(reg, 'SOFTWARE\Electronic Arts\EA Games\Command and Conquer Generals Zero Hour', t);
183
+
// Try the Ultimatate Collection launcher first, if exists.
184
+
Result := TryReadRegKey(reg, 'SOFTWARE\EA Games\Command and Conquer Generals Zero Hour', 'Install Dir', 'Command and Conquer Generals Zero Hour\Generals.exe');
188
185
if Result <> ''then Exit(Result);
189
-
190
-
Result := TryReadRegKey(reg, 'SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Command and Conquer Generals Zero Hour', t);
186
+
Result := TryReadRegKey(reg, 'SOFTWARE\WOW6432Node\EA Games\Command and Conquer Generals Zero Hour', 'Install Dir', 'Command and Conquer Generals Zero Hour\Generals.exe');
191
187
if Result <> ''then Exit(Result);
192
188
193
-
Result := TryReadRegKey(reg, 'SOFTWARE\Electronic Arts\EA Games\Generals', t);
189
+
Result := TryReadRegKey(reg, 'SOFTWARE\Electronic Arts\EA Games\Command and Conquer Generals Zero Hour', 'InstallPath', 'Generals.exe');
194
190
if Result <> ''then Exit(Result);
195
-
196
-
Result := TryReadRegKey(reg, 'SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Generals', t);
191
+
Result := TryReadRegKey(reg, 'SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Command and Conquer Generals Zero Hour', 'InstallPath', 'Generals.exe');
197
192
if Result <> ''then Exit(Result);
198
193
199
194
// Try where mod4.exe is
@@ -204,16 +199,18 @@ function ResolveZH(
204
199
205
200
// read values from
206
201
// SOFTWARE\Electronic Arts\EA Games\Command and Conquer Generals Zero Hour
0 commit comments