mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-07 04:40:43 +08:00
engine: operate on a local copy of dspriteframe_t to avoid unaligned access on ARMv7
This commit is contained in:
@@ -51,20 +51,23 @@ le_struct_end();
|
||||
|
||||
static byte *Mod_SwapSpriteFrame( byte *p, byte *end, int bytes )
|
||||
{
|
||||
dspriteframe_t *frame;
|
||||
dspriteframe_t frame;
|
||||
|
||||
if( p + sizeof( *frame ) > end )
|
||||
if( p + sizeof( frame ) > end )
|
||||
return NULL;
|
||||
|
||||
frame = (dspriteframe_t *)p;
|
||||
le_struct_swap( dspriteframe_swap, frame );
|
||||
p += sizeof( *frame );
|
||||
memcpy( &frame, p, sizeof( frame ));
|
||||
le_struct_swap( dspriteframe_swap, &frame );
|
||||
#if XASH_BIG_ENDIAN
|
||||
memcpy( p, &frame, sizeof( frame ));
|
||||
#endif
|
||||
p += sizeof( frame );
|
||||
|
||||
// skip pixel data
|
||||
if( p + frame->width * frame->height * bytes > end )
|
||||
if( p + frame.width * frame.height * bytes > end )
|
||||
return NULL;
|
||||
|
||||
p += frame->width * frame->height * bytes;
|
||||
p += frame.width * frame.height * bytes;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -1009,9 +1009,6 @@ static qboolean Mod_SwapStudioModel( const char *name, void *buffer, size_t buff
|
||||
if( phdr->ident != IDSTUDIOHEADER || phdr->version != STUDIO_VERSION )
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
|
||||
#if XASH_BIG_ENDIAN
|
||||
if( phdr->studiohdr2index > 0 && phdr->studiohdr2index < phdr->length )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user