Table of Contents

Class GameMemory

Namespace
SkyrimForge.Game
Assembly
SkyrimForge.Game.dll

Reads and writes memory at an address, and converts between addresses and views.

public static class GameMemory
Inheritance
GameMemory
Inherited Members

Remarks

An address that maps no memory faults when it is read or written, and the process ends.

Methods

AsRef<T>(nint)

A reference to the value of type T at an address, through which the value is read and written.

public static ref T AsRef<T>(nint address) where T : unmanaged

Parameters

address nint

Returns

T

Type Parameters

T

Exceptions

ArgumentOutOfRangeException

address is 0 or outside user-mode memory.

AsSpan(nint, int)

The bytes at an address, as a span through which they are read and written.

public static Span<byte> AsSpan(nint address, int length)

Parameters

address nint
length int

Returns

Span<byte>

Exceptions

ArgumentOutOfRangeException

address is 0 or outside user-mode memory, or length is negative.

AsView<T>(nint)

A view of type T over an address. A view over 0 has no address, and its Exists is false.

public static T AsView<T>(nint address) where T : struct, IAddressable

Parameters

address nint

Returns

T

Type Parameters

T

Remarks

The object at the address is not checked, so a view over an object of another type reads that object's memory as this type's.

GetAddress<T>(T)

The address a view is over.

public static nint GetAddress<T>(T view) where T : struct, IAddressable

Parameters

view T

Returns

nint

Type Parameters

T

Exceptions

InvalidOperationException

The view has no address, or one outside user-mode memory.

Matches(nint, BytePattern)

Whether the bytes at an address match a pattern.

public static bool Matches(nint address, BytePattern pattern)

Parameters

address nint
pattern BytePattern

Returns

bool

Exceptions

ArgumentNullException

pattern is null.

ArgumentOutOfRangeException

address is 0 or outside user-mode memory.