summaryrefslogtreecommitdiffhomepage
path: root/src/demorec.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-05-16 21:07:41 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-05-16 22:15:46 +0100
commit278b61bc3f2018515e26fd6b45410aded8b6417e (patch)
tree39a860b66c3d88e91359f48dbf937c0c71d61833 /src/demorec.c
parente8843dba3eb1c7a67f6ff7b920046ae36a12acd0 (diff)
Clean up some random bits and bobs
Diffstat (limited to 'src/demorec.c')
-rw-r--r--src/demorec.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/demorec.c b/src/demorec.c
index c8871bd..5c79384 100644
--- a/src/demorec.c
+++ b/src/demorec.c
@@ -351,6 +351,8 @@ static bool find_WriteMessages(void) {
return false;
}
+DECL_VFUNC_DYN(int, GetEngineBuildNumber)
+
bool demorec_custom_init(void) {
if (!has_vtidx_GetEngineBuildNumber || !has_vtidx_RecordPacket) {
con_warn("demorec: custom: missing gamedata entries for this engine\n");
@@ -363,22 +365,8 @@ bool demorec_custom_init(void) {
// > otherwise it's 12 bits
// > there might be some other l4d2 versions where it's 11 but idk
// So here we have to figure out the network protocol version!
- void *clientiface;
- uint buildnum;
- // TODO(compat): probably expose VEngineClient/VEngineServer some other way
- // if it's useful elsewhere later!?
- if (clientiface = factory_engine("VEngineClient013", 0)) {
- typedef uint (*VCALLCONV GetEngineBuildNumber_func)(void *this);
- buildnum = (*(GetEngineBuildNumber_func **)clientiface)[
- vtidx_GetEngineBuildNumber](clientiface);
- }
- // add support for other interfaces here:
- // else if (clientiface = factory_engine("VEngineClient0XX", 0)) {
- // ...
- // }
- else {
- return false;
- }
+ // NOTE: assuming engclient != null as GEBN index relies on client version
+ int buildnum = VCALL(engclient, GetEngineBuildNumber);
// condition is redundant until other GetEngineBuildNumber offsets are added
// if (GAMETYPE_MATCHES(L4D2)) {
nbits_msgtype = 6;