mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2025-02-20 08:50:38 +00:00
Add MSB_FIRST ifdefs around endian code in state.cpp
This commit is contained in:
parent
b13d003548
commit
162483a4e3
@ -154,6 +154,7 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix = NULL)
|
||||
smem_write(st, nameo, 1 + nameo[0]);
|
||||
smem_write32le(st, bytesize);
|
||||
|
||||
#ifdef MSB_FIRST
|
||||
/* Flip the byte order... */
|
||||
if(sf->flags & MDFNSTATE_BOOL)
|
||||
{
|
||||
@ -167,6 +168,7 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix = NULL)
|
||||
Endian_A16_NE_to_LE(sf->v, bytesize / sizeof(uint16_t));
|
||||
else if(sf->flags & RLSB)
|
||||
Endian_V_NE_to_LE(sf->v, bytesize);
|
||||
#endif
|
||||
|
||||
// Special case for the evil bool type, to convert bool to 1-byte elements.
|
||||
// Don't do it if we're only saving the raw data.
|
||||
@ -182,6 +184,7 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix = NULL)
|
||||
else
|
||||
smem_write(st, (uint8_t *)sf->v, bytesize);
|
||||
|
||||
#ifdef MSB_FIRST
|
||||
/* Now restore the original byte order. */
|
||||
if(sf->flags & MDFNSTATE_BOOL)
|
||||
{
|
||||
@ -195,6 +198,7 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix = NULL)
|
||||
Endian_A16_LE_to_NE(sf->v, bytesize / sizeof(uint16_t));
|
||||
else if(sf->flags & RLSB)
|
||||
Endian_V_LE_to_NE(sf->v, bytesize);
|
||||
#endif
|
||||
sf++;
|
||||
}
|
||||
|
||||
@ -364,6 +368,7 @@ static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
|
||||
((bool *)tmp->v)[bool_monster] = ((uint8_t *)tmp->v)[bool_monster];
|
||||
}
|
||||
}
|
||||
#ifdef MSB_FIRST
|
||||
if(tmp->flags & MDFNSTATE_RLSB64)
|
||||
Endian_A64_LE_to_NE(tmp->v, expected_size / sizeof(uint64_t));
|
||||
else if(tmp->flags & MDFNSTATE_RLSB32)
|
||||
@ -372,6 +377,7 @@ static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
|
||||
Endian_A16_LE_to_NE(tmp->v, expected_size / sizeof(uint16_t));
|
||||
else if(tmp->flags & RLSB)
|
||||
Endian_V_LE_to_NE(tmp->v, expected_size);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user