Skip to content

Watches

Memory watches on the CPU’s debug registers, like “find what writes to this”. Four across all plugins. The game doesn’t stop.

remove(): void

Fine to call twice.

Get it with Api.watches().

add(address: number | bigint, length: number, kind: Wraith.Watch.Kind | Wraith.Watch.KindName, handler: Wraith.Watch.Handler): Wraith.Watch

Until it’s removed or the plugin goes.

Fails with WatchError. Uses Watch.Kind, Watch.Handler, Watch.

What can go wrong, besides Cancelled, Unsupported and Gone.

Code Error
1 Unavailable They couldn’t be set up in this game
2 NoFreeSlot All four are in use
3 Misaligned The address isn’t a multiple of the length
4 InvalidLength 1, 2, 4, or 8 on x64. execute takes 1.
5 Failed

An enum of u8.

Value Name
0 write
1 access Reads or writes, since the CPU can’t watch reads alone
2 execute About to run

A struct, 0x20 bytes, aligned to 8.

Offset Field Type
0x0 address usize What’s watched
0x8 instruction usize The instruction that hit if known, else ip. For execute, the one about to run.
0x10 ip usize Just past the instruction for write and access
0x18 thread u32
address: number
instruction: number
ip: number
thread: number

On the render thread at the start of the next frame, with the registers as they were.

Wraith.Watch.Handler

Made with ♥ by Asgard