mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Add memchecks for ReadStruct/WriteStruct.
This commit is contained in:
parent
2450724be2
commit
e2ecd1eabd
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user