Merge branch 'acs-archive-fixes' into 'master'

ACS archival fixes

See merge request KartKrew/Kart!2480
This commit is contained in:
Oni 2024-10-20 18:52:13 +00:00
commit 8ba1e19351
2 changed files with 12 additions and 5 deletions

View file

@ -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");
}
}

View file

@ -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)
@ -562,8 +570,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
{