Palremap extras (#16)

Fix demos, fix compiler warnings, at least TRY to validate patches instead
of allowing palette remaps in the entire address space
This commit is contained in:
GenericHeroGuy 2025-01-25 18:05:08 +01:00
parent 577c0ac4b4
commit 43d38194fe
3 changed files with 6 additions and 4 deletions

View file

@ -2361,6 +2361,7 @@ static void G_SkipDemoExtraFiles(UINT8 **pp)
{
SKIPSTRING((*pp));// file name
(*pp) += 16;// md5
(*pp) += 1; // compatmode
}
}

View file

@ -297,11 +297,12 @@ static boolean R_CheckTextureLumpLength(texture_t *texture, size_t patch)
void R_DoPaletteRemapPatch(softwarepatch_t *patch, size_t size)
{
(void)size;
UINT32 *columns = patch->columnofs;
if (!Picture_CheckIfDoomPatch(patch, size))
return;
for (INT16 i = 0; i < patch->width; i++)
{
UINT8 *p = (UINT8 *)patch + columns[i];
UINT8 *p = (UINT8 *)patch + patch->columnofs[i];
while (*p++ != 0xff) // topdelta
{
int length = *p++;

View file

@ -1839,7 +1839,7 @@ void *W_CacheSoftwarePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
// we already know this is a patch, do palette remapping here
if (wadfiles[wad]->compatmode)
R_DoPaletteRemapPatch(ptr, wadfiles[wad]->lumpinfo[lump].size);
R_DoPaletteRemapPatch(ptr, len);
dest = Z_Calloc(sizeof(patch_t), tag, &lumpcache[lump]);
Patch_Create(ptr, len, dest);