From 0c59344bc626bc3ea3d503f589beed40fba6008a Mon Sep 17 00:00:00 2001 From: Christian Hammacher Date: Thu, 30 Nov 2006 22:53:44 +0000 Subject: [PATCH] fixed it up again :x added notice if cs:s doesn't run longer than 10 seconds after start --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40314 --- installer/HL2Launch.dpr | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/installer/HL2Launch.dpr b/installer/HL2Launch.dpr index f1befff..7eacc19 100644 --- a/installer/HL2Launch.dpr +++ b/installer/HL2Launch.dpr @@ -53,11 +53,8 @@ var eStream: TFileStream; eStr: TStringList; i: integer; CheckSuccessful: Boolean; + StartTime: Cardinal; begin - WriteLn(FindWindow(nil, 'STEAM')); - readln; - exit; - ePath := ExtractFilePath(ParamStr(0)); for i := 1 to ParamCount do eParams := eParams + #32 + ParamStr(i); @@ -87,7 +84,7 @@ begin ReadLn; exit; end; - if not FileExists(Copy(ePath, 1, Pos('\SteamApps\', ePath)) + 'steam.exe') then begin + if not FileExists(Copy(ePath, 1, Pos('\steamapps\', LowerCase(ePath))) + 'steam.exe') then begin SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12); WriteLn('Error: Cannot find steam.exe! Make sure this application is located in your listen server''s directory.'); ReadLn; @@ -161,13 +158,17 @@ begin eStream := nil; end; { Launch Steam if not opened } - - ShellExecute(0, 'open', PChar(Copy(ePath, 1, Pos('\SteamApps\', ePath)) + 'steam.exe'), nil, PChar(Copy(ePath, 1, Pos('\SteamApps\', ePath))), SW_SHOW); - //ShellExecute(0, 'open', + ShellExecute(0, 'open', PChar(Copy(ePath, 1, Pos('\steamapps\', LowerCase(ePath))) + 'steam.exe'), nil, PChar(Copy(ePath, 1, Pos('\steamapps\', LowerCase(ePath)))), SW_SHOW); { Launch game } SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7); Write('Starting HL2...'); + StartTime := GetTickCount; LaunchFile(ePath + 'hl2.exe', Copy(ePath, 1, Pos('Steam', ePath)+5), eParams); + if (GetTickCount - StartTime < 10000) then begin + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14); + WriteLn('Important: If you experience any problems starting HL2 using this program, please start it once via Steam and try again.'); + ReadLn; + end; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7); { Free GameInfo.txt } Write('Removing read-only again from GameInfo.txt...');