]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.h
Fix occasional NaN sdev in server timing reports
[xonotic/darkplaces.git] / host.h
diff --git a/host.h b/host.h
index 15b7ab93f6f9335730ac3116166b52bef020b9cd..6c4f5f60da74afac5b1426fa0ea9d96b0543572a 100644 (file)
--- a/host.h
+++ b/host.h
@@ -1,3 +1,13 @@
+#ifndef HOST_H
+#define HOST_H
+
+#include <setjmp.h>
+#include "qtypes.h"
+#include "qdefs.h"
+#include "cmd.h"
+
+struct cmd_state_s;
+
 typedef enum host_state_e
 {
        host_shutdown,
@@ -6,14 +16,14 @@ typedef enum host_state_e
        host_active
 } host_state_t;
 
-typedef struct host_s
+typedef struct host_static_s
 {
        jmp_buf abortframe;
        int state;
-       int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f)
+       unsigned int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f)
        double realtime; // the accumulated mainloop time since application started (with filtering), without any slowmo or clamping
        double dirtytime; // the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame
-       double sleeptime; // time spent sleeping overall
+       double sleeptime; // time spent sleeping after the last frame
        qbool restless; // don't sleep
        qbool paused; // global paused state, pauses both client and server
        cmd_buf_t *cbuf;
@@ -21,18 +31,23 @@ typedef struct host_s
        struct
        {
                void (*ConnectLocal)(void);
+               void (*Disconnect)(qbool, const char *, ... );
+               void (*ToggleMenu)(void);
+               qbool (*CL_Intermission)(void); // Quake compatibility
+               void (*CL_SendCvar)(struct cmd_state_s *);
+               void (*SV_SendCvar)(struct cmd_state_s *);
+               void (*SV_Shutdown)(void);
        } hook;
-} host_t;
+} host_static_t;
 
-extern host_t host;
+extern host_static_t host;
 
-void Host_InitCommands(void);
 void Host_Main(void);
-double Host_Frame(double time);
 void Host_Shutdown(void);
-void Host_StartVideo(void);
 void Host_Error(const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN;
-void Host_NoOperation_f(cmd_state_t *cmd);
 void Host_LockSession(void);
 void Host_UnlockSession(void);
-void Host_AbortCurrentFrame(void);
+void Host_AbortCurrentFrame(void) DP_FUNC_NORETURN;
+void Host_SaveConfig(const char *file);
+
+#endif