@@ -173,20 +173,22 @@ void Startup()
173173 if (loadArgs)
174174 Console->Execute (loadArgs + 1 );
175175 // Initialize APP
176- ShowWindow (Device.m_hWnd , SW_SHOWNORMAL);
177176 Device.Create ();
178177 LALib.OnCreate ();
179178 pApp = new CApplication ();
180179 g_pGamePersistent = dynamic_cast <IGame_Persistent*>(NEW_INSTANCE (CLSID_GAME_PERSISTANT));
181180 R_ASSERT (g_pGamePersistent);
182181 g_SpatialSpace = new ISpatial_DB (" Spatial obj" );
183182 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);
185186 if (logoWindow != nullptr )
186187 {
187188 DestroyWindow (logoWindow);
188189 logoWindow = nullptr ;
189190 }
191+
190192 // Main cycle
191193 Memory.mem_usage ();
192194 Device.Run ();
@@ -224,92 +226,24 @@ static INT_PTR CALLBACK LogoWndProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
224226 return true ;
225227}
226228
227- class StickyKeyFilter
229+ XR_EXPORT int RunApplication (pcstr commandLine)
228230{
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 )
286232 {
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);
304245 }
305- };
306246
307- XR_EXPORT int RunApplication (pcstr commandLine)
308- {
309- if (strstr (commandLine, " -dedicated" ))
310- GEnv.isDedicatedServer = true ;
311-
312- xrDebug::Initialize (GEnv.isDedicatedServer );
313247 if (!IsDebuggerPresent ())
314248 {
315249 u32 heapFragmentation = 2 ;
@@ -326,51 +260,22 @@ XR_EXPORT int RunApplication(pcstr commandLine)
326260 return 2 ;
327261 }
328262#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- }
345263 *g_sLaunchOnExit_app = 0 ;
346264 *g_sLaunchOnExit_params = 0 ;
347265
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 );
356266 InitSettings ();
357267 // Adjust player & computer name for Asian
358268 if (pSettings->line_exist (" string_table" , " no_native_input" ))
359269 {
360270 xr_strcpy (Core.UserName , sizeof (Core.UserName ), " Player" );
361271 xr_strcpy (Core.CompName , sizeof (Core.CompName ), " Computer" );
362272 }
363-
364- StickyKeyFilter filter;
365- if (!GEnv.isDedicatedServer )
366- filter.initialize ();
367273
368274 FPU::m24r ();
369275 InitEngine ();
370276 InitInput ();
371277 InitConsole ();
372278 Engine.External .CreateRendererList ();
373- Msg (" command line %s" , commandLine);
374279
375280 pcstr benchName = " -batch_benchmark " ;
376281 if (strstr (commandLine, benchName))
0 commit comments