ISource2ModMemory

Source2Mod-facing memory address wrapper (mirrors DynLibUtils::CMemory).

Plugins use this value type instead of DynLibUtils::CMemory directly so they remain decoupled from the DynLibUtils headers. The implementation is identical: every method delegates 1:1 to the underlying arithmetic.

Header source2mod/ISource2ModMemory.h

Constructors

ISource2ModMemory();
ISource2ModMemory(const ISource2ModMemory&) noexcept = default;
ISource2ModMemory(ISource2ModMemory&& other) noexcept;
ISource2ModMemory(const uintptr_t ptr);
ISource2ModMemory(const void* ptr);

Methods

GetPtr

inline void* GetPtr() const noexcept;

The address as a pointer.

GetAddr

inline uintptr_t GetAddr() const noexcept;

The same address as an integer.

GetValue

template<class T> inline T GetValue() const noexcept;

CCast

template<typename T> inline T CCast() const noexcept;

RCast

template<typename T> inline T RCast() const noexcept;

UCast

template<typename T> inline T UCast() const noexcept;

Offset

inline ISource2ModMemory Offset(ptrdiff_t offset) const noexcept;
ParameterType
offsetptrdiff_t

OffsetSelf

inline ISource2ModMemory& OffsetSelf(ptrdiff_t offset) noexcept;
ParameterType
offsetptrdiff_t

Deref

inline ISource2ModMemory Deref(int deref = 1) const;
ParameterTypeDefault
derefint1

DerefSelf

inline ISource2ModMemory& DerefSelf(int deref = 1);
ParameterTypeDefault
derefint1

FollowNearCall

inline ISource2ModMemory FollowNearCall(const ptrdiff_t opcodeOffset = 0x1, const ptrdiff_t nextInstructionOffset = 0x5) const;
ParameterTypeDefault
opcodeOffsetconst ptrdiff_t0x1
nextInstructionOffsetconst ptrdiff_t0x5

FollowNearCallSelf

inline ISource2ModMemory& FollowNearCallSelf(const ptrdiff_t opcodeOffset = 0x1, const ptrdiff_t nextInstructionOffset = 0x5);
ParameterTypeDefault
opcodeOffsetconst ptrdiff_t0x1
nextInstructionOffsetconst ptrdiff_t0x5

ResolveRelativeAddress

inline ISource2ModMemory ResolveRelativeAddress(const ptrdiff_t registerOffset = 0x0, const ptrdiff_t nextInstructionOffset = 0x4) const;
ParameterTypeDefault
registerOffsetconst ptrdiff_t0x0
nextInstructionOffsetconst ptrdiff_t0x4

ResolveRelativeAddressSelf

inline ISource2ModMemory& ResolveRelativeAddressSelf(const ptrdiff_t registerOffset = 0x0, const ptrdiff_t nextInstructionOffset = 0x4);
ParameterTypeDefault
registerOffsetconst ptrdiff_t0x0
nextInstructionOffsetconst ptrdiff_t0x4

On this page