IMemoryService
Interface IMemoryService
Namespace: SwiftlyS2.Shared.Memory
Assembly: SwiftlyS2.CS2.dll
public interface IMemoryServiceMethods
Alloc(ulong)
Allocate a block of memory.
nint Alloc(ulong size)Parameters
- size ulong — The size of the memory block to allocate.
Returns
- nint — The address of the allocated memory block.
Free(nint)
Free a block of memory.
void Free(nint pointer)Parameters
- pointer nint — The address of the memory block to free.
GetAddressBySignature(string, string)
Get the address of a ida-style signature.
nint? GetAddressBySignature(string library, string signature)Parameters
- library string — The library of that signature belongs to.
- signature string — The signature of the function.
Returns
- nint? — The address of the function. Return null if not found.
GetInterfaceByName(string)
Get the address of an valve or swiftly native interface by its name.
nint? GetInterfaceByName(string name)Parameters
- name string — The name of the interface.
Returns
- nint? — The address of the interface. Return null if not found.
GetObjectPtrVtableName(nint)
Get the vtable name of an object pointer.
string? GetObjectPtrVtableName(nint address)Parameters
- address nint — The address of the object pointer.
Returns
- string? — The vtable name. Return null if not found.
GetUnmanagedFunctionByAddress<TDelegate>(nint)
Get an unmanaged function by its address.
IUnmanagedFunction<TDelegate> GetUnmanagedFunctionByAddress<TDelegate>(nint address) where TDelegate : DelegateParameters
- address nint — The address of the unmanaged function.
Returns
- IUnmanagedFunction<TDelegate> — The unmanaged function.
Type Parameters
- TDelegate — The delegate type of the unmanaged function.
GetUnmanagedFunctionByVTable<TDelegate>(nint, int)
Get an unmanaged function by its vtable address and index.
IUnmanagedFunction<TDelegate> GetUnmanagedFunctionByVTable<TDelegate>(nint pVTable, int index) where TDelegate : DelegateParameters
Returns
- IUnmanagedFunction<TDelegate> — The unmanaged function.
Type Parameters
- TDelegate
GetUnmanagedMemoryByAddress(nint)
Get an unmanaged memory block by its address.
IUnmanagedMemory GetUnmanagedMemoryByAddress(nint address)Parameters
- address nint — The address from which to create the Unmanaged Memory wrapper.
Returns
GetVTableAddress(string, string)
Get the address of a vtable by its name.
nint? GetVTableAddress(string library, string vtableName)Parameters
Returns
- nint? — The address of the vtable. Return null if not found.
ObjectPtrHasBaseClass(nint, string)
Check if an object pointer has a base class.
bool ObjectPtrHasBaseClass(nint address, string baseClassName)Parameters
- address nint — The address of the object pointer.
- baseClassName string — The name of the base class.
Returns
- bool — True if the object pointer has the base class, false otherwise.
ObjectPtrHasVtable(nint)
Check if an object pointer has a vtable.
bool ObjectPtrHasVtable(nint address)Parameters
- address nint — The address of the object pointer.
Returns
- bool — True if the object pointer has a vtable, false otherwise.
Resize(nint, ulong)
Resize a block of memory.
nint Resize(nint pointer, ulong newSize)Parameters
- pointer nint — The address of the memory block to resize.
- newSize ulong — The new size of the memory block.
Returns
- nint — The address of the resized memory block.
ResolveXrefAddress(nint)
Resolve the address of a xref signature.
nint ResolveXrefAddress(nint xrefAddress)Parameters
- xrefAddress nint — The address of the xref.
Returns
- nint — The resolved address.
ToSchemaClass<T>(nint)
Convert a raw address to a schema class.
T ToSchemaClass<T>(nint address) where T : class, ISchemaClass<T>Parameters
- address nint — The address of the schema class.
Returns
- T — The schema class.
Type Parameters
- T — The schema class type.