diff options
-rw-r--r-- | gamedata/engine.kv | 6 | ||||
-rw-r--r-- | gamedata/gamelib.kv | 4 | ||||
-rw-r--r-- | src/engineapi.c | 17 | ||||
-rw-r--r-- | src/gametype.h | 2 | ||||
-rw-r--r-- | src/os.h | 1 |
5 files changed, 19 insertions, 11 deletions
diff --git a/gamedata/engine.kv b/gamedata/engine.kv index 8ee8161..414a584 100644 --- a/gamedata/engine.kv +++ b/gamedata/engine.kv @@ -18,7 +18,11 @@ vtidx_GetGameDirectory { } Client012 37 // dmomm, ep1, ... } -vtidx_GetEngineBuildNumber { L4D2 99 } +// TODO(compat): apparently this changed, in early versions it's NOT 99! +// Come up with some way to detect it properly!? +vtidx_GetEngineBuildNumber { + //L4D2 99 +} vtidx_PEntityOfEntIndex { OrangeBox 19 } // probably OE too but??? sz_edict { diff --git a/gamedata/gamelib.kv b/gamedata/gamelib.kv index e7a4302..7db228f 100644 --- a/gamedata/gamelib.kv +++ b/gamedata/gamelib.kv @@ -26,9 +26,7 @@ vtidx_Teleport { L4D "104 + NVDTOR" L4D2 { default "116 + NVDTOR" // TODO(linux): might actually be 119!?!? - // TODO(compat): would like to be able to specify this here. - // see also engineapi.c - //TLS "117 + NVDTOR" + TheLastStand "117 + NVDTOR" // I dunno why JAiZ changed this } } diff --git a/src/engineapi.c b/src/engineapi.c index 6ba178f..5113883 100644 --- a/src/engineapi.c +++ b/src/engineapi.c @@ -22,7 +22,11 @@ #include "gametype.h" #include "intdefs.h" #include "mem.h" // " +#include "os.h" #include "vcall.h" +#include "x86.h" + +#include "con_.h" u64 _gametype_tag = 0; // declared in gametype.h but seems sensible enough here @@ -73,18 +77,17 @@ void engineapi_init(void) { _gametype_tag |= _gametype_tag_SrvDLL005; } + // TERRIBLE HACK: TODO(compat): come up with a better method later + if (GAMETYPE_MATCHES(L4D2) && os_access(OS_LIT( + "update/maps/c14m1_junkyard.bsp"), R_OK) != -1) { + _gametype_tag |= _gametype_tag_TheLastStand; + } + // need to do this now; ServerClass network table iteration requires // SendProp offsets gamedata_init(); // TODO(compat): we need this terrible hack for now because TLS somehow - // changed the entity vtable layout and I've yet to think of a way to make - // gamedata more flexible to handle that properly. I blame JAiZ. - if (engclient && has_vtidx_GetEngineBuildNumber && - VCALL(engclient, GetEngineBuildNumber) >= 2200) { - ++vtidx_Teleport; - } - if (has_vtidx_GetAllServerClasses && has_sz_SendProp && has_off_SP_varname && has_off_SP_offset) { initentprops(VCALL(srvdll, GetAllServerClasses)); diff --git a/src/gametype.h b/src/gametype.h index d7d0b3e..c825ee6 100644 --- a/src/gametype.h +++ b/src/gametype.h @@ -49,6 +49,8 @@ extern u64 _gametype_tag; #define _gametype_tag_SrvDLL009 (1 << 14) // 2013-ish #define _gametype_tag_SrvDLL005 (1 << 15) // mostly everything else, it seems +#define _gametype_tag_TheLastStand (1 << 16) /* The JAiZ update */ + /* Matches for any multiple possible tags */ #define _gametype_tag_L4D (_gametype_tag_L4D1 | _gametype_tag_L4D2) // XXX: *stupid* naming, refactor later (damn Survivors ruining everything) @@ -28,6 +28,7 @@ #include <errno.h> #include <fcntl.h> #ifdef _WIN32 +#include <direct.h> #include <io.h> #include <wchar.h> // DUMB HACK: noreturn.h is alphabetically before os.h so including it after |