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_stdint.h"
11 #include "network_msg.h"
12 #include "highscores.h"
13 #include "addon_types.h"
15 #define NETWORK_MAX_REQUESTS 8
17 static int network_scores_updated
= 0;
22 //#define SR_USE_LOCALHOST
24 /* Call it at start; Connects us to the gameserver */
25 static void network_init(void);
27 /* Run this from main loop */
28 static void network_update(void);
30 /* Call it at shutdown */
31 static void network_end(void);
34 * Can buffer up a bunch of these by calling many times, they will be
35 * sent at the next connection
37 static void network_submit_highscore( u32 trackid
, u16 points
, u16 time
);
40 * Game endpoints are provided with the same names to allow running without a
45 u8 app_symmetric_key
[ 1024 ];
47 EServerMode auth_mode
;
49 HSteamNetConnection remote
;
50 ESteamNetworkingConnectionState state
;
52 f64 last_attempt
, last_frame
;
57 struct network_request
{
58 vg_pool_node poolnode
;
59 void (*callback
)( netmsg_request
*res
, vg_msg
*body
);
65 static network_client
= {
66 .auth_mode
= eServerModeAuthentication
,
67 .state
= k_ESteamNetworkingConnectionState_None
,
70 static int packet_minsize( SteamNetworkingMessage_t
*msg
, u32 size
);
71 static void network_send_item( enum netmsg_playeritem_type type
);
72 static void network_request_scoreboard( const char *mod_uid
,
73 const char *route_uid
,
75 static void network_publish_laptime( const char *mod_uid
,
76 const char *route_uid
, f64 lap_time
);
78 #endif /* NETWORK_H */