mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Add warnings for any misaligned lumps. These crash on arm ports of engines.
This commit is contained in:
parent
0501ec2e98
commit
9d1c386a1b
1 changed files with 7 additions and 0 deletions
|
@ -502,15 +502,20 @@ static void Q1BSPX_Setup(qmodel_t *mod, char *filebase, unsigned int filelen, lu
|
|||
int i;
|
||||
int offs = 0;
|
||||
bspx_header_t *h;
|
||||
qboolean misaligned = false;
|
||||
|
||||
bspxbase = filebase;
|
||||
bspxheader = NULL;
|
||||
|
||||
for (i = 0; i < numlumps; i++, lumps++)
|
||||
{
|
||||
if (lumps->fileofs & 3)
|
||||
misaligned = true;
|
||||
if (offs < lumps->fileofs + lumps->filelen)
|
||||
offs = lumps->fileofs + lumps->filelen;
|
||||
}
|
||||
if (misaligned)
|
||||
Con_Warning("%s contains misaligned lumps\n", mod->name);
|
||||
offs = (offs + 3) & ~3;
|
||||
if (offs + sizeof(*bspxheader) > filelen)
|
||||
return; /*no space for it*/
|
||||
|
@ -527,6 +532,8 @@ static void Q1BSPX_Setup(qmodel_t *mod, char *filebase, unsigned int filelen, lu
|
|||
{
|
||||
h->lumps[i].fileofs = LittleLong(h->lumps[i].fileofs);
|
||||
h->lumps[i].filelen = LittleLong(h->lumps[i].filelen);
|
||||
if (h->lumps[i].fileofs & 3)
|
||||
Con_Warning("%s contains misaligned bspx limp %s\n", mod->name, h->lumps[i].lumpname);
|
||||
if ((unsigned int)h->lumps[i].fileofs + (unsigned int)h->lumps[i].filelen > filelen)
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue