Add memchecks for ReadStruct/WriteStruct.

This commit is contained in:
Unknown W. Brackets 2015-04-05 18:09:35 -07:00
parent 2450724be2
commit e2ecd1eabd
14 changed files with 27 additions and 27 deletions

View File

@ -15,7 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"

View File

@ -21,7 +21,7 @@
#include "Core/HLE/FunctionWrappers.h"
#include "Core/MIPS/MIPS.h"
#include "Core/CoreTiming.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Common/ChunkFile.h"
#include "Common/StdMutex.h"
#include "Core/HLE/sceCtrl.h"

View File

@ -16,7 +16,7 @@
#include "Core/MIPS/MIPS.h"
#include "Core/FileSystems/FileSystem.h"
#include "Core/FileSystems/MetaFileSystem.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"
#include "Core/System.h"
#include "Core/Font/PGF.h"

View File

@ -23,10 +23,11 @@
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/MIPS/MIPS.h"
#include "Core/System.h"
#include "Core/CoreParameter.h"
#include "Core/CoreTiming.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"
#include "Core/System.h"
#include "Core/HLE/sceGe.h"
#include "Core/HLE/sceKernelMemory.h"
#include "Core/HLE/sceKernelThread.h"

View File

@ -23,7 +23,7 @@
#include "Core/Core.h"
#include "Core/Config.h"
#include "Core/Debugger/Breakpoints.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/System.h"
#include "Core/Host.h"
#include "Core/SaveState.h"

View File

@ -18,6 +18,7 @@
#include "Core/Core.h"
#include "Core/Config.h"
#include "Core/CwCheat.h"
#include "Core/MemMapHelpers.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/MIPS/MIPS.h"

View File

@ -20,7 +20,7 @@
#include "Core/HLE/HLE.h"
#include "Core/MIPS/MIPS.h"
#include "Core/CoreTiming.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"
#include "Common/ChunkFile.h"

View File

@ -23,7 +23,7 @@
#include "Core/HLE/sceKernelMbx.h"
#include "Core/HLE/HLE.h"
#include "Core/CoreTiming.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"
#include "Core/HLE/KernelWaitHelpers.h"

View File

@ -19,7 +19,7 @@
#include <map>
#include <unordered_map>
#include "Common/ChunkFile.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/HLE/HLE.h"
#include "Core/MIPS/MIPS.h"
#include "Core/CoreTiming.h"

View File

@ -19,7 +19,7 @@
#include "Core/HLE/HLE.h"
#include "Core/MIPS/MIPS.h"
#include "Core/CoreTiming.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"
#include "Common/ChunkFile.h"
#include "Core/HLE/sceKernel.h"

View File

@ -15,7 +15,6 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "net/resolve.h"
#include "util/text/parsers.h"
@ -24,7 +23,7 @@
#include "Core/HLE/FunctionWrappers.h"
#include "Core/MIPS/MIPS.h"
#include "Core/Config.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "sceKernel.h"
#include "sceKernelThread.h"

View File

@ -34,7 +34,7 @@
#include "Core/MIPS/MIPS.h"
#include "Core/Reporting.h"
#include "Core/CoreTiming.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include "Core/HLE/sceKernel.h"
#include "Core/HLE/sceRtc.h"

View File

@ -289,21 +289,6 @@ inline bool IsValidAddress(const u32 address) {
return false;
}
template<class T>
void ReadStruct(u32 address, T *ptr)
{
size_t sz = sizeof(*ptr);
memcpy(ptr, GetPointer(address), sz);
}
template<class T>
void WriteStruct(u32 address, T *ptr)
{
size_t sz = sizeof(*ptr);
memcpy(GetPointer(address), ptr, sz);
}
};
template <typename T>

View File

@ -62,4 +62,18 @@ inline void Memcpy(const u32 to_address, const u32 from_address, const u32 len)
void Memset(const u32 _Address, const u8 _Data, const u32 _iLength);
template<class T>
void ReadStruct(u32 address, T *ptr)
{
const u32 sz = (u32)sizeof(*ptr);
Memcpy(ptr, address, sz);
}
template<class T>
void WriteStruct(u32 address, T *ptr)
{
const u32 sz = (u32)sizeof(*ptr);
Memcpy(address, ptr, sz);
}
}