first commit

This commit is contained in:
murdle
2026-03-01 02:38:58 +02:00
commit 19250b9db4
19111 changed files with 4358159 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#ifndef _HEAPINSPECTORSERVER_HEAPINFO_H_
#define _HEAPINSPECTORSERVER_HEAPINFO_H_
#include "HeapInspectorServerTypes.h"
#include <string>
BEGIN_NAMESPACE(HeapInspectorServer)
struct Range
{
uint32 m_Min;
uint32 m_Max;
};
struct HeapInfo
{
std::string m_Description;
Range m_Range;
};
END_NAMESPACE(HeapInspectorServer)
#endif // _HEAPINSPECTORSERVER_HEAPINFO_H_

View File

@@ -0,0 +1,33 @@
#ifndef _HEAPINSPECTORSERVER_PLATFORMINTERFACES_HEAPINSPECTORSERVER_H_
#define _HEAPINSPECTORSERVER_PLATFORMINTERFACES_HEAPINSPECTORSERVER_H_
#include "HeapInfo.h"
#include <vector>
BEGIN_NAMESPACE(HeapInspectorServer)
enum EWaitForConnection
{
WaitForConnection_Disabled,
WaitForConnection_Enabled
};
std::vector<HeapInfo> GetDefaultHeapInfo();
bool Initialise(const std::vector<HeapInfo>& a_HeapInfo, int a_Port, EWaitForConnection a_WaitForConnection);
bool IsInitialised();
void Shutdown();
typedef int Mutation;
Mutation BeginAlloc();
void EndAlloc(Mutation a_Mutation, uint16 a_HeapID, void* a_Address, uint32 a_SizeRequested, uint32 a_SizeReceived);
Mutation BeginReAlloc();
void EndReAlloc(Mutation a_Mutation, uint16 a_HeapID, void* a_OldAddress, void* a_NewAddress, uint32 a_SizeRequested, uint32 a_SizeReceived);
Mutation BeginFree();
void EndFree(Mutation a_Mutation, uint16 a_HeapID, void* a_Address);
END_NAMESPACE(HeapInspectorServer)
#endif // _HEAPINSPECTORSERVER_PLATFORMINTERFACES_HEAPINSPECTORSERVER_H_

View File

@@ -0,0 +1,32 @@
#ifndef _HEAPINSPECTORSERVER_TYPES_H_
#define _HEAPINSPECTORSERVER_TYPES_H_
#define BEGIN_NAMESPACE(x) namespace x {
#define END_NAMESPACE(x) }
#define BEGIN_UNNAMED_NAMESPACE() namespace {
#define END_UNNAMED_NAMESPACE() }
BEGIN_NAMESPACE(HeapInspectorServer)
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
#if HEAPINSPECTOR_PS3
typedef unsigned long long uint64;
typedef long long int64;
#else
typedef unsigned __int64 uint64;
typedef __int64 int64;
#endif
typedef char int8;
typedef short int16;
typedef int int32;
typedef char char8;
typedef wchar_t char16;
END_NAMESPACE(HeapInspectorServer)
#endif //_HEAPINSPECTORSERVER_TYPES_H_

View File

@@ -0,0 +1,63 @@
#ifndef _HEAPINSPECTORSERVER_PS3_HEAPHOOKS_HPP_
#define _HEAPINSPECTORSERVER_PS3_HEAPHOOKS_HPP_
#include <stdlib.h>
extern "C" void* __real_memalign(size_t a_Boundary, size_t a_Size);
extern "C" void* __wrap_memalign(size_t a_Boundary, size_t a_Size)
{
HeapInspectorServer::Mutation mutation = HeapInspectorServer::BeginAlloc();
void* result = __real_memalign(a_Boundary, a_Size);
size_t usableSize = malloc_usable_size(result);
HeapInspectorServer::EndAlloc(mutation, 0, result, a_Size, usableSize);
return result;
}
extern "C" void* __real_calloc(size_t a_NumElements, size_t a_SizePerElement);
extern "C" void* __wrap_calloc(size_t a_NumElements, size_t a_SizePerElement)
{
HeapInspectorServer::Mutation mutation = HeapInspectorServer::BeginAlloc();
void* result = __real_calloc(a_NumElements, a_SizePerElement);
size_t usableSize = malloc_usable_size(result);
HeapInspectorServer::EndAlloc(mutation, 0, result, a_NumElements * a_SizePerElement, usableSize);
return result;
}
extern "C" void* __real_malloc(size_t a_Size);
extern "C" void* __wrap_malloc(size_t a_Size)
{
HeapInspectorServer::Mutation mutation = HeapInspectorServer::BeginAlloc();
void* result = __real_malloc(a_Size);
size_t usableSize = malloc_usable_size(result);
HeapInspectorServer::EndAlloc(mutation, 0, result, a_Size, usableSize);
return result;
}
extern "C" void __real_free(void* a_Address);
extern "C" void __wrap_free(void* a_Address)
{
HeapInspectorServer::Mutation mutation = HeapInspectorServer::BeginFree();
__real_free(a_Address);
HeapInspectorServer::EndFree(mutation, 0, a_Address);
}
extern "C" void *__real_realloc(void *a_Address, size_t a_Size);
extern "C" void *__wrap_realloc(void *a_Address, size_t a_Size)
{
HeapInspectorServer::Mutation mutation = HeapInspectorServer::BeginReAlloc();
void* result = __real_realloc(a_Address, a_Size);
size_t usableSize = malloc_usable_size(result);
HeapInspectorServer::EndReAlloc(mutation, 0, a_Address, result, a_Size, usableSize);
return result;
}
extern "C" void* __real_reallocalign(void *a_Address, size_t a_Size, size_t a_Boundary);
extern "C" void* __wrap_reallocalign(void *a_Address, size_t a_Size, size_t a_Boundary)
{
HeapInspectorServer::Mutation mutation = HeapInspectorServer::BeginReAlloc();
void* result = __real_reallocalign(a_Address, a_Size, a_Boundary);
size_t usableSize = malloc_usable_size(result);
HeapInspectorServer::EndReAlloc(mutation, 0, a_Address, result, a_Size, usableSize);
return result;
}
#endif //_HEAPINSPECTORSERVER_PS3_HEAPHOOKS_HPP_