@@ -173,20 +173,22 @@ void Startup()
173
173
if (loadArgs)
174
174
Console->Execute (loadArgs + 1 );
175
175
// Initialize APP
176
- ShowWindow (Device.m_hWnd , SW_SHOWNORMAL);
177
176
Device.Create ();
178
177
LALib.OnCreate ();
179
178
pApp = new CApplication ();
180
179
g_pGamePersistent = dynamic_cast <IGame_Persistent*>(NEW_INSTANCE (CLSID_GAME_PERSISTANT));
181
180
R_ASSERT (g_pGamePersistent);
182
181
g_SpatialSpace = new ISpatial_DB (" Spatial obj" );
183
182
g_SpatialSpacePhysic = new ISpatial_DB (" Spatial phys" );
184
- // Destroy LOGO
183
+
184
+ // Show main window and destroy splash
185
+ ShowWindow (Device.m_hWnd , SW_SHOWNORMAL);
185
186
if (logoWindow != nullptr )
186
187
{
187
188
DestroyWindow (logoWindow);
188
189
logoWindow = nullptr ;
189
190
}
191
+
190
192
// Main cycle
191
193
Memory.mem_usage ();
192
194
Device.Run ();
@@ -224,92 +226,24 @@ static INT_PTR CALLBACK LogoWndProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
224
226
return true ;
225
227
}
226
228
227
- class StickyKeyFilter
229
+ XR_EXPORT int RunApplication (pcstr commandLine)
228
230
{
229
- bool screensaverState;
230
- STICKYKEYS stickyKeys;
231
- FILTERKEYS filterKeys;
232
- TOGGLEKEYS toggleKeys;
233
- DWORD stickyKeysFlags;
234
- DWORD filterKeysFlags;
235
- DWORD toggleKeysFlags;
236
-
237
- public:
238
- StickyKeyFilter ()
239
- {
240
- screensaverState = false ;
241
- stickyKeysFlags = 0 ;
242
- filterKeysFlags = 0 ;
243
- toggleKeysFlags = 0 ;
244
- stickyKeys = {};
245
- filterKeys = {};
246
- toggleKeys = {};
247
- stickyKeys.cbSize = sizeof (stickyKeys);
248
- filterKeys.cbSize = sizeof (filterKeys);
249
- toggleKeys.cbSize = sizeof (toggleKeys);
250
- }
251
-
252
- void initialize ()
253
- {
254
- SystemParametersInfo (SPI_GETSCREENSAVEACTIVE, 0 , &screensaverState, 0 );
255
-
256
- if (screensaverState)
257
- SystemParametersInfo (SPI_SETSCREENSAVEACTIVE, FALSE , nullptr , 0 );
258
-
259
- SystemParametersInfo (SPI_GETSTICKYKEYS, sizeof (stickyKeys), &stickyKeys, 0 );
260
- SystemParametersInfo (SPI_GETFILTERKEYS, sizeof (filterKeys), &filterKeys, 0 );
261
- SystemParametersInfo (SPI_GETTOGGLEKEYS, sizeof (toggleKeys), &toggleKeys, 0 );
262
-
263
- if (stickyKeys.dwFlags & SKF_AVAILABLE)
264
- {
265
- stickyKeysFlags = stickyKeys.dwFlags ;
266
- stickyKeys.dwFlags = 0 ;
267
- SystemParametersInfo (SPI_SETSTICKYKEYS, sizeof (stickyKeys), &stickyKeys, 0 );
268
- }
269
-
270
- if (filterKeys.dwFlags & FKF_AVAILABLE)
271
- {
272
- filterKeysFlags = filterKeys.dwFlags ;
273
- filterKeys.dwFlags = 0 ;
274
- SystemParametersInfo (SPI_SETFILTERKEYS, sizeof (filterKeys), &filterKeys, 0 );
275
- }
276
-
277
- if (toggleKeys.dwFlags & TKF_AVAILABLE)
278
- {
279
- toggleKeysFlags = toggleKeys.dwFlags ;
280
- toggleKeys.dwFlags = 0 ;
281
- SystemParametersInfo (SPI_SETTOGGLEKEYS, sizeof (toggleKeys), &toggleKeys, 0 );
282
- }
283
- }
284
-
285
- ~StickyKeyFilter ()
231
+ if (strstr (commandLine, " -nosplash" ) == 0 )
286
232
{
287
- if (screensaverState)
288
- SystemParametersInfo (SPI_SETSCREENSAVEACTIVE, TRUE , nullptr , 0 );
289
- if (stickyKeysFlags)
290
- {
291
- stickyKeys.dwFlags = stickyKeysFlags;
292
- SystemParametersInfo (SPI_SETSTICKYKEYS, sizeof (stickyKeys), &stickyKeys, 0 );
293
- }
294
- if (filterKeysFlags)
295
- {
296
- filterKeys.dwFlags = filterKeysFlags;
297
- SystemParametersInfo (SPI_SETFILTERKEYS, sizeof (filterKeys), &filterKeys, 0 );
298
- }
299
- if (toggleKeysFlags)
300
- {
301
- toggleKeys.dwFlags = toggleKeysFlags;
302
- SystemParametersInfo (SPI_SETTOGGLEKEYS, sizeof (toggleKeys), &toggleKeys, 0 );
303
- }
233
+ logoWindow = CreateDialog (GetModuleHandle (NULL ), MAKEINTRESOURCE (IDD_STARTUP), nullptr , LogoWndProc);
234
+ const HWND logoPicture = GetDlgItem (logoWindow, IDC_STATIC_LOGO);
235
+ RECT logoRect;
236
+ GetWindowRect (logoPicture, &logoRect);
237
+ #ifndef DEBUG
238
+ HWND prevWindow = (strstr (commandLine, " -splashnotop" ) == NULL ) ? HWND_TOPMOST : HWND_NOTOPMOST;
239
+ #else
240
+ const HWND prevWindow = HWND_NOTOPMOST;
241
+ #endif
242
+ SetWindowPos (logoWindow, prevWindow, 0 , 0 , logoRect.right - logoRect.left , logoRect.bottom - logoRect.top ,
243
+ SWP_NOMOVE | SWP_SHOWWINDOW);
244
+ UpdateWindow (logoWindow);
304
245
}
305
- };
306
246
307
- XR_EXPORT int RunApplication (pcstr commandLine)
308
- {
309
- if (strstr (commandLine, " -dedicated" ))
310
- GEnv.isDedicatedServer = true ;
311
-
312
- xrDebug::Initialize (GEnv.isDedicatedServer );
313
247
if (!IsDebuggerPresent ())
314
248
{
315
249
u32 heapFragmentation = 2 ;
@@ -326,51 +260,22 @@ XR_EXPORT int RunApplication(pcstr commandLine)
326
260
return 2 ;
327
261
}
328
262
#endif
329
- // SetThreadAffinityMask(GetCurrentThread(), 1);
330
- if (strstr (commandLine, " -nosplash" ) == 0 )
331
- {
332
- logoWindow = CreateDialog (GetModuleHandle (NULL ), MAKEINTRESOURCE (IDD_STARTUP), nullptr , LogoWndProc);
333
- HWND logoPicture = GetDlgItem (logoWindow, IDC_STATIC_LOGO);
334
- RECT logoRect;
335
- GetWindowRect (logoPicture, &logoRect);
336
- #ifndef DEBUG
337
- HWND prevWindow = (strstr (commandLine, " -splashnotop" ) == NULL ) ? HWND_TOPMOST : HWND_NOTOPMOST;
338
- #else
339
- HWND prevWindow = HWND_NOTOPMOST;
340
- #endif
341
- SetWindowPos (logoWindow, prevWindow, 0 , 0 , logoRect.right - logoRect.left , logoRect.bottom - logoRect.top ,
342
- SWP_NOMOVE | SWP_SHOWWINDOW);
343
- UpdateWindow (logoWindow);
344
- }
345
263
*g_sLaunchOnExit_app = 0 ;
346
264
*g_sLaunchOnExit_params = 0 ;
347
265
348
- pcstr fsltx = " -fsltx " ;
349
- string_path fsgame = " " ;
350
- if (strstr (commandLine, fsltx))
351
- {
352
- u32 sz = xr_strlen (fsltx);
353
- sscanf (strstr (commandLine, fsltx) + sz, " %[^ ] " , fsgame);
354
- }
355
- Core.Initialize (" xray" , nullptr , true , *fsgame ? fsgame : nullptr );
356
266
InitSettings ();
357
267
// Adjust player & computer name for Asian
358
268
if (pSettings->line_exist (" string_table" , " no_native_input" ))
359
269
{
360
270
xr_strcpy (Core.UserName , sizeof (Core.UserName ), " Player" );
361
271
xr_strcpy (Core.CompName , sizeof (Core.CompName ), " Computer" );
362
272
}
363
-
364
- StickyKeyFilter filter;
365
- if (!GEnv.isDedicatedServer )
366
- filter.initialize ();
367
273
368
274
FPU::m24r ();
369
275
InitEngine ();
370
276
InitInput ();
371
277
InitConsole ();
372
278
Engine.External .CreateRendererList ();
373
- Msg (" command line %s" , commandLine);
374
279
375
280
pcstr benchName = " -batch_benchmark " ;
376
281
if (strstr (commandLine, benchName))
0 commit comments