From 001ae4a05bfaa24b170f68692050d6a3d5cce304 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 17 Oct 2024 23:22:26 -0400 Subject: [PATCH 1/2] Disable ACSVM save debug signatures Adds a lot of extra time, and I meant to remove this when I confirmed ACS in netgames was working. --- src/acs/interface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/acs/interface.cpp b/src/acs/interface.cpp index 7f6a703cc..60689d24a 100644 --- a/src/acs/interface.cpp +++ b/src/acs/interface.cpp @@ -562,8 +562,10 @@ void ACS_Archive(savebuffer_t *save) std::ostream stream{&buffer}; ACSVM::Serial serial{stream}; +#if 0 // Enable debug signatures. serial.signs = true; +#endif try { From 3b898c528e64737959f5c23afd868e5330b2fd16 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 18 Oct 2024 11:05:40 -0400 Subject: [PATCH 2/2] Do not load invalid ACS modules BEHAVIOR being optional is now handled from our side, because using getModule or loadModule on an invalid file is supposed to be an error condition for the VM. --- src/acs/environment.cpp | 7 ++----- src/acs/interface.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index 0a4939811..b14d825df 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -228,8 +228,7 @@ void Environment::loadModule(ACSVM::Module *module) if (name->i == (size_t)LUMPERROR) { // No lump given for module. - CONS_Alert(CONS_WARNING, "Could not find ACS module \"%s\"; scripts will not function properly!\n", name->s->str); - return; //throw ACSVM::ReadError("file open failure"); + throw ACSVM::ReadError("invalid lump"); } lumpLen = W_LumpLength(name->i); @@ -280,9 +279,7 @@ void Environment::loadModule(ACSVM::Module *module) } else { - // Unlike Hexen, a BEHAVIOR lump is not required. - // Simply ignore in this instance. - CONS_Debug(DBG_SETUP, "ACS module has no data, ignoring...\n"); + throw ACSVM::ReadError("file empty"); } } diff --git a/src/acs/interface.cpp b/src/acs/interface.cpp index 60689d24a..50eb51241 100644 --- a/src/acs/interface.cpp +++ b/src/acs/interface.cpp @@ -142,6 +142,13 @@ void ACS_LoadLevelScripts(size_t mapID) map->active = true; // Insert BEHAVIOR lump into the list. + virtres_t *vRes = vres_GetMap(mapheaderinfo[mapID]->lumpnum); + auto _ = srb2::finally([vRes]() { vres_Free(vRes); }); + + // Unlike Hexen, a BEHAVIOR lump is not required. + // Simply ignore in this instance. + virtlump_t *vLump = vres_Find(vRes, "BEHAVIOR"); + if (vLump != nullptr && vLump->size > 0) { ACSVM::ModuleName name = ACSVM::ModuleName( env->getString( mapheaderinfo[mapID]->lumpname ), @@ -150,6 +157,7 @@ void ACS_LoadLevelScripts(size_t mapID) ); modules.push_back(env->getModule(name)); + CONS_Debug(DBG_SETUP, "Found BEHAVIOR lump.\n"); } if (modules.empty() == false)