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...');