From 12b3af41c1da7645dcfd023451a56ae7963fbe15 Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Thu, 20 Jul 2023 01:37:28 +0200 Subject: [PATCH] Add header for globals.c With DECLARE_SYMBOLS and DECLARE_EXTERNS macros hw extern for hw.so handler Externs engine and client symbol pointers (and originals) globals_init function --- src/include/globals.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/include/globals.h diff --git a/src/include/globals.h b/src/include/globals.h new file mode 100644 index 0000000..0e000dc --- /dev/null +++ b/src/include/globals.h @@ -0,0 +1,32 @@ +#ifndef _GLOBALS_H +#define _GLOBALS_H + +#include "sdk.h" + +/*----------------------------------------------------------------------------*/ + +/* + * prefix | meaning + * -------+---------------- + * gp_* | global pointer + * go_* | global original + */ +#define DECLARE_SYMBOLS(type, name) \ + type* gp_##name = NULL; \ + type go_##name; + +#define DECLARE_EXTERNS(type, name) \ + extern type* gp_##name; \ + extern type go_##name; + +/*----------------------------------------------------------------------------*/ + +extern void* hw; +DECLARE_EXTERNS(cl_enginefunc_t, engine); +DECLARE_EXTERNS(cl_clientfunc_t, client); + +/*----------------------------------------------------------------------------*/ + +bool globals_init(void); + +#endif /* _GLOBALS_H */