mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-23 16:21:50 +01:00
Use memcpy to save and read savebuf
This commit is contained in:
parent
a01a53e697
commit
162e16fd8e
@ -446,7 +446,8 @@ inline void SkipSaveBuf(uint8 *&buf, int32 skip)
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline const T ReadSaveBuf(uint8 *&buf)
|
inline const T ReadSaveBuf(uint8 *&buf)
|
||||||
{
|
{
|
||||||
T &value = *(T*)buf;
|
T value;
|
||||||
|
memcpy(&value, buf, sizeof(T));
|
||||||
SkipSaveBuf(buf, sizeof(T));
|
SkipSaveBuf(buf, sizeof(T));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -454,10 +455,10 @@ inline const T ReadSaveBuf(uint8 *&buf)
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
||||||
{
|
{
|
||||||
T *p = (T*)buf;
|
memcpy(buf, &value, sizeof(T));
|
||||||
*p = value;
|
T* result = (T*)buf;
|
||||||
SkipSaveBuf(buf, sizeof(T));
|
SkipSaveBuf(buf, sizeof(T));
|
||||||
return p;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user