Skip to content

Display

What the game shows: its camera’s view, output encoding, frame captures and frame times.

Get it with Api.display().

claimView(changed: Wraith.Lease.Changed | null): Wraith.Lease
gameView(): Wraith.Display.View
setColorSpace(space: Wraith.ColorSpace | Wraith.ColorSpaceName): void
capture(point: Wraith.Capture.Point | Wraith.Capture.PointName): Promise<Wraith.Capture>
frameStats(): Wraith.Display.Stats
times(): Array<number>

A lease on the output color space, see Lease. Only the holder’s setColorSpace counts.

Fails with LeaseError. Uses Lease.Changed, Lease.

The last view set. Any thread.

Uses Display.View.

How the game’s output is encoded, for where the swap chain can’t say. The swap chain’s own setting wins. Kept till it gets the lease, and gone with it. Any thread.

Uses ColorSpace.

The next frame drawn at point. Any thread.

Async. Fails with CaptureError. Uses Capture.Point, Capture.

Updated a few times a second, so cheap every frame. Any thread.

Uses Display.Stats.

Newest frame times in ms, oldest first. Good till the thread’s next call into Wraith. Any thread.

4 bytes a pixel except rgba16f’s 8.

An enum of u8.

Value Name
0 unknown
1 rgba8
2 bgra8
3 bgrx8 Alpha is junk
4 rgb10a2 32 bits from the low bits up: 10 red, 10 green, 10 blue, 2 alpha
5 bgr10a2 Same with red and blue swapped
6 rgba16f Half floats, usually scRGB

An enum of u8.

Value Name
0 srgb SDR, sRGB-encoded
1 scrgb Linear Rec.709, 1.0 is 80 nits, can go past 0..1
2 hdr10 Rec.2020 with PQ, 1.0 is 10000 nits

An enum of u8.

Value Name
0 unknown
1 d3d9
2 d3d10
3 d3d11
4 d3d12
5 vulkan
6 opengl

An enum of u8.

Value Name
0 before_overlay Before the overlay draws
1 after_overlay With the overlay, as presented

A copy of a frame, owned by whoever takes it.

A struct, 0x30 bytes, aligned to 8.

Offset Field Type
0x0 width u32
0x4 height u32
0x8 pitch u32 Bytes per row, top row first. Can be more than the pixels need.
0xc format PixelFormat
0x10 native_format u32 The API’s own format: DXGI_FORMAT, VkFormat, D3DFORMAT or a GL internal format
0x14 graphics_api GraphicsApi
0x15 color_space ColorSpace
0x18 sdr_white_nits f32 SDR white on the game’s display, in nits
0x20 pixels blob
width: number
height: number
pitch: number
format: Wraith.PixelFormat | Wraith.PixelFormatName
native_format: number
graphics_api: Wraith.GraphicsApi | Wraith.GraphicsApiName
color_space: Wraith.ColorSpace | Wraith.ColorSpaceName
sdr_white_nits: number
pixels: Uint8Array | null

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

Code Error
1 NoFrames
2 Failed This game’s graphics can’t be copied, or the overlay can’t draw
3 NotDeclared Its wraith.json doesn’t list “capture” in “permissions”

The game camera’s view, for drawing over the world. Row vectors, D3D style: clip = [x y z 1] * view * projection, looking down +z, depth 0 near to 1 far, clip y up.

A struct, 0x84 bytes, aligned to 4.

Offset Field Type
0x0 viewMatrix Mat4
0x40 projection Mat4
0x80 known bool False till the camera’s plugin puts its camera in the scene, or once it’s gone
viewMatrix: Wraith.Mat4
projection: Wraith.Mat4
known: boolean

A struct, 0x50 bytes, aligned to 8.

Offset Field Type
0x0 window_seconds f32 What these cover. Less than the window early on or after a reset.
0x4 frames u32
0x8 fps f32 From the average frame time
0xc avg_ms f32
0x10 min_ms f32
0x14 max_ms f32
0x18 p50_ms f32
0x1c p95_ms f32
0x20 p99_ms f32
0x24 low_1_fps f32 The fps at the 99th and 99.9th percentile frame times
0x28 low_01_fps f32
0x2c hitches u32 Frames over hitch_factor times the median
0x30 hitch_factor f32
0x38 total_frames u64 Since the game started or the stats were reset
0x40 total_avg_ms f32
0x44 total_min_ms f32
0x48 total_max_ms f32
window_seconds: number
frames: number
fps: number
avg_ms: number
min_ms: number
max_ms: number
p50_ms: number
p95_ms: number
p99_ms: number
low_1_fps: number
low_01_fps: number
hitches: number
hitch_factor: number
total_frames: bigint
total_avg_ms: number
total_min_ms: number
total_max_ms: number

Made with ♥ by Asgard