-
Notifications
You must be signed in to change notification settings - Fork 0
/
pPopFix.dpr
106 lines (87 loc) · 2.93 KB
/
pPopFix.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
program pPopFix;
uses
Forms, Windows, SysUtils, Registry, Classes, Dialogs;
{$R *.RES}
{$R FILES.RES}
const
TITLE = 'PopTB Fix';
POP_NOT_FOUND = 'Put this file in your "Populous: The Beginning" directory';
POP_FIXED = 'FIXED!, Now Populous should work';
ABOUT = #13#10#13#10 + 'made by ALACN, http://www.alacn.cjb.net';
var
reg: TRegistry;
path, drive, dir: string;
sysdir: array[0..255] of char;
rs: TResourceStream;
begin
Application.Initialize;
Application.Title := 'PopFix';
Application.Run;
if not FileExists('HW_SW_Select.exe') then
begin
MessageBox(Application.Handle, POP_NOT_FOUND + ABOUT, TITLE, MB_ICONEXCLAMATION);
Exit;
end;
path := ExtractFileDir(Application.ExeName);
reg := TRegistry.Create;
with reg do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey('SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning', True) then
begin
WriteString('InstallPath', path);
drive := ExtractFileDrive(path);
WriteString('InstallDrive', drive);
dir := copy(path, Length(drive) + 2, Length(path));
WriteString('InstallDirectory', dir);
WriteString('Version', '1.01');
WriteInteger('Language', $09);
WriteString('Matchmaker URL', 'http://www.populous.net/gamelobbyfinal.html');
OpenKey('1.01', True);
CloseKey;
end;
if OpenKey('SOFTWARE\Bullfrog Productions Ltd\Populous: The Beginning\HWSWSelect', True) then
begin
WriteString('Title', 'Populous: The Beginning');
WriteString('Prompt', 'Please select the version you want to run:');
WriteString('Prompt1', 'Software Rendered - No 3D Acceleration');
WriteString('Prompt2', 'Direct3D Rendered - 3D Accelerated');
WriteString('OK', 'OK');
WriteString('Cancel', 'Cancel');
WriteString('Next', '&Next >');
WriteString('Back', '< &Back');
WriteString('Exe1', 'popTB.exe');
WriteString('Exe2', 'D3DpopTB.exe');
WriteString('CurrentExe', '');
CloseKey;
end;
if OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\POP3.EXE', True) then
begin
WriteString('', Path + '\HW_SW_Select.exe');
WriteString('Path', Path);
CloseKey;
end;
if OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\HW_SW_Select.exe', True) then
begin
WriteString('', Path + '\HW_SW_Select.exe');
WriteString('Path', Path);
CloseKey;
end;
finally
reg.Free;
end;
GetSystemDirectory(sysdir, SizeOf(sysdir));
rs := TResourceStream.Create(hInstance, 'EAEXEC', RT_RCDATA);
try
rs.SaveToFile(sysdir + '\EAEXEC.EXE');
finally
rs.Free;
end;
rs := TResourceStream.Create(hInstance, 'EALTEST', RT_RCDATA);
try
rs.SaveToFile(sysdir + '\EALTEST.EXE');
finally
rs.Free;
end;
MessageBox(Application.Handle, POP_FIXED + ABOUT, TITLE, MB_ICONASTERISK);
end.