2 * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
3 * All trademarks are property of their respective owners
9 #include "vg/vg_steam.h"
10 #include "vg/vg_steam_utils.h"
11 #include "vg/vg_steam_networking.h"
12 #include "vg/vg_steam_auth.h"
13 #include "vg/vg_steam_http.h"
16 * We only want to use steamworks if building for the networked version,
17 * theres not much point otherwise. We mainly want steamworks for setting
18 * achievements etc.. so that includes our own server too.
20 * This file also wraps the functions and interfaces that we want to use to
21 * make them a bit easier to read, since they are the flat API they have very
22 * long names. in non-networked builds they will return default errors or do
26 static void recv_steam_warning( int severity
, const char *msg
)
29 vg_low( "%s\n", msg
);
31 vg_info( "%s\n", msg
);
34 static int steam_ready
= 0;
35 static void *hSteamNetworkingSockets
,
38 static HSteamPipe hSteamClientPipe
;
40 static int steam_init(void)
43 vg_info( "Initializing steamworks\n" );
45 if( !SteamAPI_Init() )
48 vg_error( "Steamworks failed to initialize\n" );
54 SteamAPI_ManualDispatch_Init();
56 /* Connect interfaces */
57 hSteamClientPipe
= SteamAPI_GetHSteamPipe();
58 hSteamNetworkingSockets
= SteamAPI_SteamNetworkingSockets_SteamAPI();
59 hSteamUser
= SteamAPI_SteamUser();
61 ISteamUtils
*utils
= SteamAPI_SteamUtils();
62 SteamAPI_ISteamUtils_SetWarningMessageHook( utils
, recv_steam_warning
);
65 vg_success( "\nSteamworks API running\n" );
71 static void steam_update(void)
74 steamworks_event_loop( hSteamClientPipe
);
77 static void steam_end(void *nothing
)
81 vg_info( "Shutting down\n..." );