Console errors on init failure

This commit is contained in:
Garry Newman 2017-08-17 12:02:32 +01:00
parent 79f398da04
commit 4ba430601a

View File

@ -39,22 +39,34 @@ internal bool InitClient( BaseSteamworks steamworks )
api = new SteamNative.SteamApi(); api = new SteamNative.SteamApi();
if ( !api.SteamAPI_Init() ) if ( !api.SteamAPI_Init() )
{
Console.Error.WriteLine( "InitClient: SteamAPI_Init returned false" );
return false; return false;
}
hUser = api.SteamAPI_GetHSteamUser(); hUser = api.SteamAPI_GetHSteamUser();
hPipe = api.SteamAPI_GetHSteamPipe(); hPipe = api.SteamAPI_GetHSteamPipe();
if ( hPipe == 0 ) if ( hPipe == 0 )
{
Console.Error.WriteLine( "InitClient: hPipe == 0" );
return false; return false;
}
FillInterfaces( steamworks, hUser, hPipe ); FillInterfaces( steamworks, hUser, hPipe );
if ( !user.IsValid ) if ( !user.IsValid )
{
Console.Error.WriteLine( "InitClient: ISteamUser is null" );
return false; return false;
}
// Ensure that the user has logged into Steam. This will always return true if the game is launched // Ensure that the user has logged into Steam. This will always return true if the game is launched
// from Steam, but if Steam is at the login prompt when you run your game it will return false. // from Steam, but if Steam is at the login prompt when you run your game it will return false.
if ( !user.BLoggedOn() ) if ( !user.BLoggedOn() )
{
Console.Error.WriteLine( "InitClient: Not Logged On" );
return false; return false;
}
return true; return true;
} }
@ -67,13 +79,17 @@ internal bool InitServer( BaseSteamworks steamworks, uint IpAddress /*uint32*/,
if ( !api.SteamInternal_GameServer_Init( IpAddress, usPort, GamePort, QueryPort, eServerMode, pchVersionString ) ) if ( !api.SteamInternal_GameServer_Init( IpAddress, usPort, GamePort, QueryPort, eServerMode, pchVersionString ) )
{ {
Console.Error.WriteLine( "InitServer: GameServer_Init returned false" );
return false; return false;
} }
hUser = api.SteamGameServer_GetHSteamUser(); hUser = api.SteamGameServer_GetHSteamUser();
hPipe = api.SteamGameServer_GetHSteamPipe(); hPipe = api.SteamGameServer_GetHSteamPipe();
if ( hPipe == 0 ) if ( hPipe == 0 )
{
Console.Error.WriteLine( "InitServer: hPipe == 0" );
return false; return false;
}
FillInterfaces( steamworks, hPipe, hUser ); FillInterfaces( steamworks, hPipe, hUser );