X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=server.c;h=d5d5d91f10291c708a6faa28c75ae27573a36f49;hb=15beb60ade240af4e00b0d204f7e89a4d35dca36;hp=1f2863380ecf254a75f93797d110f72d39e32612;hpb=89032d64e2867adb66e4598a0c66d3e853a22bb0;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/server.c b/server.c index 1f28633..d5d5d91 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,6 @@ -// Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved +/* + * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved + */ /* * This server application requires steamclient.so to be present in the @@ -43,14 +45,14 @@ static void recieve_http( void *callresult, void *context ) SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( hSteamHTTP, request, &size ); - u8 *buffer = malloc( size ); + u8 *buffer = vg_alloc( size ); SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( hSteamHTTP, request, buffer, size ); buffer[size-1] = '\0'; vg_info( "%s\n", (char *)buffer ); - free( buffer ); + vg_free( buffer ); SteamAPI_ISteamHTTP_ReleaseHTTPRequest( hSteamHTTP, result->m_hRequest ); } @@ -123,7 +125,7 @@ static void on_inet_auth( SteamNetworkingMessage_t *msg ) return; } - vg_log( "Attempting to verify user\n" ); + vg_low( "Attempting to verify user\n" ); if( msg->m_cbSize < sizeof(netmsg_auth) ) { @@ -142,7 +144,7 @@ static void on_inet_auth( SteamNetworkingMessage_t *msg ) } u8 decrypted[1024]; - u32 ticket_len; + u32 ticket_len = 1024; int success = SteamEncryptedAppTicket_BDecryptTicket( auth->ticket, auth->ticket_length, decrypted, @@ -330,8 +332,12 @@ int main( int argc, char *argv[] ) { signal( SIGINT, inthandler ); signal( SIGQUIT, inthandler ); + + /* TODO: Options to override, ammend, remove etc */ highscores_init( 250000, 10000 ); + if( !highscores_read() ) + highscores_create_db(); steamworks_ensure_txt( "2103940" ); if( !vg_load_steam_symetric_key( "application_key", steam_symetric_key ) )