mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-23 08:11:49 +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>
|
||||
inline const T ReadSaveBuf(uint8 *&buf)
|
||||
{
|
||||
T &value = *(T*)buf;
|
||||
T value;
|
||||
memcpy(&value, buf, sizeof(T));
|
||||
SkipSaveBuf(buf, sizeof(T));
|
||||
return value;
|
||||
}
|
||||
@ -454,10 +455,10 @@ inline const T ReadSaveBuf(uint8 *&buf)
|
||||
template<typename T>
|
||||
inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
||||
{
|
||||
T *p = (T*)buf;
|
||||
*p = value;
|
||||
memcpy(buf, &value, sizeof(T));
|
||||
T* result = (T*)buf;
|
||||
SkipSaveBuf(buf, sizeof(T));
|
||||
return p;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user