mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 02:54:14 +01:00
Use memcpy for reading and writing SaveBufs
This commit is contained in:
parent
58e725bd03
commit
ec1f0f4c93
@ -32,7 +32,7 @@ template<typename T>
|
|||||||
inline void
|
inline void
|
||||||
ReadSaveBuf(T *out, uint8 *&buf)
|
ReadSaveBuf(T *out, uint8 *&buf)
|
||||||
{
|
{
|
||||||
*out = *(T *)buf;
|
memcpy(out, buf, sizeof(T));
|
||||||
SkipSaveBuf(buf, sizeof(T));
|
SkipSaveBuf(buf, sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ template<typename T>
|
|||||||
inline void
|
inline void
|
||||||
ReadSaveBuf(T *out, uint8 *&buf, uint32 &length)
|
ReadSaveBuf(T *out, uint8 *&buf, uint32 &length)
|
||||||
{
|
{
|
||||||
*out = *(T *)buf;
|
memcpy(out, buf, sizeof(T));
|
||||||
SkipSaveBuf(buf, length, sizeof(T));
|
SkipSaveBuf(buf, length, sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ template<typename T>
|
|||||||
inline T *
|
inline T *
|
||||||
WriteSaveBuf(uint8 *&buf, const T &value)
|
WriteSaveBuf(uint8 *&buf, const T &value)
|
||||||
{
|
{
|
||||||
|
memcpy(buf, &value, sizeof(T));
|
||||||
T* p = (T*)buf;
|
T* p = (T*)buf;
|
||||||
*p = value;
|
|
||||||
SkipSaveBuf(buf, sizeof(T));
|
SkipSaveBuf(buf, sizeof(T));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -58,8 +58,8 @@ template<typename T>
|
|||||||
inline T *
|
inline T *
|
||||||
WriteSaveBuf(uint8 *&buf, uint32 &length, const T &value)
|
WriteSaveBuf(uint8 *&buf, uint32 &length, const T &value)
|
||||||
{
|
{
|
||||||
|
memcpy(buf, &value, sizeof(T));
|
||||||
T* p = (T*)buf;
|
T* p = (T*)buf;
|
||||||
*p = value;
|
|
||||||
SkipSaveBuf(buf, length, sizeof(T));
|
SkipSaveBuf(buf, length, sizeof(T));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user