From 2d38eb923dc7e584fa12a628d9152901b8604092 Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 1 Jul 2021 18:09:32 +0200 Subject: zero out work_buff before writing padding in save --- src/save/GenericGameStorage.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/save') diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 84ab118c..a56ff2c3 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -251,6 +251,11 @@ GenericSave(int file) WriteSaveDataBlock(CStreaming::MemoryCardSave, "StreamingSize"); WriteSaveDataBlock(CPedType::Save, "PedTypeSize"); + // sure just write garbage data repeatedly ... +#ifndef THIS_IS_STUPID + memset(work_buff, 0, sizeof(work_buff)); +#endif + // Write padding for (int i = 0; i < 4; i++) { size = align4bytes(SIZE_OF_ONE_GAME_IN_BYTES - totalSize - 4); -- cgit v1.2.3 From 65219365db5129d37bdd3be95e45ef5d4db8bc51 Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 1 Jul 2021 21:51:52 +0200 Subject: fix compilation when ctype.h is included --- src/save/SaveBuf.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/save') diff --git a/src/save/SaveBuf.h b/src/save/SaveBuf.h index de27017e..6e9b3ae9 100644 --- a/src/save/SaveBuf.h +++ b/src/save/SaveBuf.h @@ -83,29 +83,29 @@ WriteSaveBuf(uint8 *&buf, uint32 &length, const T &value) #ifdef VALIDATE_SAVE_SIZE #define CheckSaveHeader(buf, a, b, c, d, size) do { \ - char _C; uint32 _size;\ - ReadSaveBuf(&_C, buf);\ - assert(_C == a);\ - ReadSaveBuf(&_C, buf);\ - assert(_C == b);\ - ReadSaveBuf(&_C, buf);\ - assert(_C == c);\ - ReadSaveBuf(&_C, buf);\ - assert(_C == d);\ + char _c; uint32 _size;\ + ReadSaveBuf(&_c, buf);\ + assert(_c == a);\ + ReadSaveBuf(&_c, buf);\ + assert(_c == b);\ + ReadSaveBuf(&_c, buf);\ + assert(_c == c);\ + ReadSaveBuf(&_c, buf);\ + assert(_c == d);\ ReadSaveBuf(&_size, buf);\ assert(_size == size);\ } while(0) #define CheckSaveHeaderWithLength(buf,len,a,b,c,d,size) do { \ - char _C; uint32 _size;\ - ReadSaveBuf(&_C, buf, len);\ - assert(_C == a);\ - ReadSaveBuf(&_C, buf, len);\ - assert(_C == b);\ - ReadSaveBuf(&_C, buf, len);\ - assert(_C == c);\ - ReadSaveBuf(&_C, buf, len);\ - assert(_C == d);\ + char _c; uint32 _size;\ + ReadSaveBuf(&_c, buf, len);\ + assert(_c == a);\ + ReadSaveBuf(&_c, buf, len);\ + assert(_c == b);\ + ReadSaveBuf(&_c, buf, len);\ + assert(_c == c);\ + ReadSaveBuf(&_c, buf, len);\ + assert(_c == d);\ ReadSaveBuf(&_size, buf, len);\ assert(_size == size);\ } while(0) -- cgit v1.2.3