From 2dd5f1abe3212eb9d6f2b9ee8e6127900fc68f6e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 20 Aug 2019 18:18:29 +0100 Subject: [PATCH 1/3] Fixes for lib_cvRegisterVar (the Lua version of CV_RegisterVar): * Make sure the consvar's properties are all initialised to zeros as defaults * Error if the consvar is not given a name * Error if the consvar has CV_CALL but no call function * Error if the consvar has CV_NOINIT but not CV_CALL --- src/lua_consolelib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index dced4e43c..7766ba1c2 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -303,6 +303,8 @@ static int lib_cvRegisterVar(lua_State *L) #define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e); #define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1))) + memset(cvar, 0x00, sizeof(consvar_t)); // zero everything by default + lua_pushnil(L); while (lua_next(L, 1)) { // stack: cvar table, cvar userdata, key/index, value @@ -390,6 +392,13 @@ static int lib_cvRegisterVar(lua_State *L) #undef FIELDERROR #undef TYPEERROR + if (!cvar->name) + return luaL_error(L, M_GetText("Variable has no name!\n")); + if ((cvar->flags & CV_NOINIT) && !(cvar->flags & CV_CALL)) + return luaL_error(L, M_GetText("Variable %s has CV_NOINIT without CV_CALL\n"), cvar->name); + if ((cvar->flags & CV_CALL) && !cvar->func) + return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name); + // stack: cvar table, cvar userdata lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars"); I_Assert(lua_istable(L, 3)); From 6ef9ee5467cf8f67847999d0d530153b304ae562 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Tue, 20 Aug 2019 15:43:59 -0400 Subject: [PATCH 2/3] true not TRUE --- src/m_cheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 6fa3ea113..05b851fef 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -109,7 +109,7 @@ static UINT8 cheatf_devmode(void) G_SetGameModified(false); for (i = 0; i < MAXUNLOCKABLES; i++) unlockables[i].unlocked = true; - devparm = TRUE; + devparm = true; cv_debug |= 0x8000; // Refresh secrets menu existing. From e5071bb6052c5202ce1d48ef8af6738bdf090e34 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 23 Aug 2019 11:00:05 -0700 Subject: [PATCH 3/3] Compare the file name only for real CL_SendRequestFile prepends the path for each file. --- src/d_netfil.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index deb04fbe1..d25b6a278 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -752,9 +752,12 @@ void Got_Filetxpak(void) { INT32 filenum = netbuffer->u.filetxpak.fileid; fileneeded_t *file = &fileneeded[filenum]; - char *filename = file->filename; + char *filename; static INT32 filetime = 0; + filename = va("%s", file->filename); + nameonly(filename); + if (!(strcmp(filename, "srb2.srb") && strcmp(filename, "srb2.wad") && strcmp(filename, "zones.dta") @@ -765,6 +768,8 @@ void Got_Filetxpak(void) )) I_Error("Tried to download \"%s\"", filename); + filename = file->filename; + if (filenum >= fileneedednum) { DEBFILE(va("fileframent not needed %d>%d\n", filenum, fileneedednum));