11439
|
1 |
unit uFLRunQueue;
|
|
2 |
interface
|
|
3 |
uses uFLTypes;
|
|
4 |
|
|
5 |
procedure queueExecution(var config: TGameConfig);
|
|
6 |
procedure passFlibEvent(p: pointer); cdecl;
|
|
7 |
|
|
8 |
implementation
|
11456
|
9 |
uses uFLGameConfig, hwengine, uFLData, uFLUICallback, uFLIPC;
|
11439
|
10 |
|
|
11 |
var runQueue: PGameConfig = nil;
|
|
12 |
|
|
13 |
procedure nextRun;
|
|
14 |
begin
|
|
15 |
if runQueue <> nil then
|
|
16 |
begin
|
|
17 |
if runQueue^.gameType = gtPreview then
|
|
18 |
sendUI(mtRenderingPreview, nil, 0);
|
|
19 |
|
11456
|
20 |
ipcCleanEngineQueue();
|
11439
|
21 |
RunEngine(runQueue^.argumentsNumber, @runQueue^.argv);
|
|
22 |
|
|
23 |
sendConfig(runQueue)
|
|
24 |
end
|
|
25 |
end;
|
|
26 |
|
|
27 |
procedure cleanupConfig;
|
|
28 |
var t: PGameConfig;
|
|
29 |
begin
|
|
30 |
t:= runQueue;
|
|
31 |
runQueue:= t^.nextConfig;
|
|
32 |
dispose(t)
|
|
33 |
end;
|
|
34 |
|
|
35 |
procedure queueExecution(var config: TGameConfig);
|
|
36 |
var pConfig, t, tt: PGameConfig;
|
|
37 |
i: Longword;
|
|
38 |
begin
|
|
39 |
new(pConfig);
|
|
40 |
pConfig^:= config;
|
|
41 |
|
|
42 |
with pConfig^ do
|
|
43 |
begin
|
|
44 |
nextConfig:= nil;
|
|
45 |
|
|
46 |
for i:= 0 to Pred(MAXARGS) do
|
|
47 |
begin
|
|
48 |
if arguments[i][0] = #255 then
|
|
49 |
arguments[i][255]:= #0
|
|
50 |
else
|
|
51 |
arguments[i][byte(arguments[i][0]) + 1]:= #0;
|
|
52 |
argv[i]:= @arguments[i][1]
|
|
53 |
end;
|
|
54 |
end;
|
|
55 |
|
|
56 |
if runQueue = nil then
|
|
57 |
begin
|
|
58 |
runQueue:= pConfig;
|
|
59 |
|
|
60 |
nextRun
|
|
61 |
end else
|
|
62 |
begin
|
|
63 |
t:= runQueue;
|
|
64 |
while t^.nextConfig <> nil do
|
|
65 |
begin
|
|
66 |
if (pConfig^.gameType = gtPreview) and (t^.nextConfig^.gameType = gtPreview) then
|
|
67 |
begin
|
|
68 |
tt:= t^.nextConfig;
|
|
69 |
pConfig^.nextConfig:= tt^.nextConfig;
|
|
70 |
t^.nextConfig:= pConfig;
|
|
71 |
dispose(tt);
|
|
72 |
exit // boo
|
|
73 |
end;
|
|
74 |
t:= t^.nextConfig;
|
|
75 |
end;
|
|
76 |
t^.nextConfig:= pConfig
|
|
77 |
end;
|
|
78 |
end;
|
|
79 |
|
|
80 |
procedure passFlibEvent(p: pointer); cdecl;
|
|
81 |
begin
|
|
82 |
case TFLIBEvent(p^) of
|
|
83 |
flibGameFinished: begin
|
|
84 |
cleanupConfig;
|
|
85 |
nextRun
|
11456
|
86 |
end;
|
|
87 |
flibRunNetGame: begin
|
|
88 |
runNetGame
|
|
89 |
end;
|
11439
|
90 |
end;
|
|
91 |
end;
|
|
92 |
|
|
93 |
end.
|