summaryrefslogtreecommitdiffhomepage
path: root/src/democustom.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-07-31 16:02:10 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-08-10 22:40:52 +0100
commit5e921bf59373d79d27c322ff86e8b5a37b151e45 (patch)
tree4d40e39543b085ce4c8cb9b1a7b3c0108de680c0 /src/democustom.c
parentc8d7588251fd4fe63ac6afe2a90ca7066c786609 (diff)
Add magical feature codegen system, at long last
Diffstat (limited to 'src/democustom.c')
-rw-r--r--src/democustom.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/democustom.c b/src/democustom.c
index 0a1174f..c7de77b 100644
--- a/src/democustom.c
+++ b/src/democustom.c
@@ -22,12 +22,18 @@
#include "demorec.h"
#include "engineapi.h"
#include "errmsg.h"
+#include "feature.h"
#include "gamedata.h"
#include "intdefs.h"
#include "mem.h"
#include "ppmagic.h"
#include "vcall.h"
+FEATURE()
+REQUIRE(demorec)
+REQUIRE_GAMEDATA(vtidx_GetEngineBuildNumber)
+REQUIRE_GAMEDATA(vtidx_RecordPacket)
+
static int nbits_msgtype, nbits_datalen;
// The engine allows usermessages up to 255 bytes, we add 2 bytes of overhead,
@@ -107,12 +113,7 @@ static bool find_WriteMessages(void) {
DECL_VFUNC_DYN(int, GetEngineBuildNumber)
-bool democustom_init(void) {
- if (!has_vtidx_GetEngineBuildNumber || !has_vtidx_RecordPacket) {
- errmsg_errorx("missing gamedata entries for this engine");
- return false;
- }
-
+INIT {
// More UncraftedkNowledge:
// > yeah okay so [the usermessage length is] 11 bits if the demo protocol
// > is 11 or if the game is l4d2 and the network protocol is 2042.