@asdf-overlay/core 0.9.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon-aarch64.node +0 -0
- package/addon-x64.node +0 -0
- package/asdf_overlay-aarch64.dll +0 -0
- package/asdf_overlay-x64.dll +0 -0
- package/asdf_overlay-x86.dll +0 -0
- package/lib/addon.d.ts +7 -4
- package/lib/index.d.ts +38 -19
- package/lib/index.js +50 -23
- package/lib/types.d.ts +24 -0
- package/package.json +1 -1
package/addon-aarch64.node
CHANGED
|
Binary file
|
package/addon-x64.node
CHANGED
|
Binary file
|
package/asdf_overlay-aarch64.dll
CHANGED
|
Binary file
|
package/asdf_overlay-x64.dll
CHANGED
|
Binary file
|
package/asdf_overlay-x86.dll
CHANGED
|
Binary file
|
package/lib/addon.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { OverlayEventEmitter } from './index.js';
|
|
2
|
-
import { CopyRect, Cursor, PercentLength } from './types.js';
|
|
2
|
+
import { CopyRect, Cursor, PercentLength, type GpuLuid, type UpdateSharedHandle } from './types.js';
|
|
3
3
|
export type Addon = {
|
|
4
4
|
attach(dllDir: string, pid: number, timeout?: number): Promise<number>;
|
|
5
5
|
overlaySetPosition(id: number, winId: number, x: PercentLength, y: PercentLength): Promise<void>;
|
|
6
6
|
overlaySetAnchor(id: number, winId: number, x: PercentLength, y: PercentLength): Promise<void>;
|
|
7
7
|
overlaySetMargin(id: number, winId: number, top: PercentLength, right: PercentLength, bottom: PercentLength, left: PercentLength): Promise<void>;
|
|
8
|
+
overlayUpdateHandle(id: number, winId: number, update: UpdateSharedHandle): Promise<void>;
|
|
8
9
|
overlayListenInput(id: number, winId: number, cursor: boolean, keyboard: boolean): Promise<void>;
|
|
9
10
|
overlayBlockInput(id: number, winId: number, block: boolean): Promise<void>;
|
|
10
11
|
overlaySetBlockingCursor(id: number, winId: number, cursor?: Cursor): Promise<void>;
|
|
11
|
-
overlayUpdateBitmap(id: number, winId: number, width: number, data: Buffer): Promise<void>;
|
|
12
|
-
overlayUpdateShtex(id: number, winId: number, width: number, height: number, handle: Buffer, rect?: CopyRect): Promise<void>;
|
|
13
|
-
overlayClearSurface(id: number, winId: number): Promise<void>;
|
|
14
12
|
overlayCallNextEvent(id: number, emitter: OverlayEventEmitter, emit: OverlayEventEmitter['emit']): Promise<boolean>;
|
|
15
13
|
overlayDestroy(id: number): void;
|
|
14
|
+
surfaceCreate(luid: GpuLuid): number;
|
|
15
|
+
surfaceClear(id: number): void;
|
|
16
|
+
surfaceUpdateBitmap(id: number, width: number, data: Buffer): UpdateSharedHandle | null;
|
|
17
|
+
surfaceUpdateShtex(id: number, width: number, height: number, handle: Buffer, rect?: CopyRect): UpdateSharedHandle | null;
|
|
18
|
+
surfaceDestroy(id: number): void;
|
|
16
19
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { CursorInput, KeyboardInput } from './input.js';
|
|
3
|
-
import { PercentLength, CopyRect, Cursor } from './types.js';
|
|
3
|
+
import { PercentLength, CopyRect, Cursor, type UpdateSharedHandle, type GpuLuid } from './types.js';
|
|
4
4
|
export * from './types.js';
|
|
5
5
|
export * from './util.js';
|
|
6
6
|
/**
|
|
@@ -11,7 +11,7 @@ export type OverlayEventEmitter = EventEmitter<{
|
|
|
11
11
|
/**
|
|
12
12
|
* A window has been added.
|
|
13
13
|
*/
|
|
14
|
-
added: [id: number, width: number, height: number];
|
|
14
|
+
added: [id: number, width: number, height: number, luid: GpuLuid];
|
|
15
15
|
/**
|
|
16
16
|
* A window has been resized.
|
|
17
17
|
*/
|
|
@@ -88,40 +88,59 @@ export declare class Overlay {
|
|
|
88
88
|
*/
|
|
89
89
|
setBlockingCursor(id: number, cursor?: Cursor): Promise<void>;
|
|
90
90
|
/**
|
|
91
|
-
* Update overlay
|
|
91
|
+
* Update overlay surface.
|
|
92
92
|
* @param id target window id
|
|
93
|
+
* @param update shared handle update
|
|
94
|
+
*/
|
|
95
|
+
updateHandle(id: number, update: UpdateSharedHandle): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Destroy overlay
|
|
98
|
+
*/
|
|
99
|
+
destroy(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Attach overlay to target process
|
|
102
|
+
*
|
|
103
|
+
* Name must be unique or it will fail if there is a connection with same name
|
|
104
|
+
* @param dllDir path to dlls
|
|
105
|
+
* @param pid target process pid
|
|
106
|
+
* @param timeout Timeout for injection, in milliseconds. Will wait indefinitely if not provided.
|
|
107
|
+
* @returns new {@link Overlay} object
|
|
108
|
+
*/
|
|
109
|
+
static attach(dllDir: string, pid: number, timeout?: number): Promise<Overlay>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Represent a surface for overlay.
|
|
113
|
+
*/
|
|
114
|
+
export declare class OverlaySurface {
|
|
115
|
+
readonly [idSym]: number;
|
|
116
|
+
private constructor();
|
|
117
|
+
/**
|
|
118
|
+
* Update surface using bitmap buffer. The size of overlay is `width x (data.byteLength / 4 / width)`
|
|
93
119
|
* @param width width of the bitmap
|
|
94
120
|
* @param data bgra formatted bitmap
|
|
95
121
|
*/
|
|
96
|
-
updateBitmap(
|
|
122
|
+
updateBitmap(width: number, data: Buffer): UpdateSharedHandle | null;
|
|
97
123
|
/**
|
|
98
|
-
* Update
|
|
99
|
-
* @param id target window id
|
|
124
|
+
* Update surface using D3D11 shared texture.
|
|
100
125
|
* @param width width of the surface
|
|
101
126
|
* @param height height of the surface
|
|
102
127
|
* @param handle NT Handle of shared D3D11 Texture
|
|
103
128
|
* @param rect Area to update
|
|
104
129
|
*/
|
|
105
|
-
updateShtex(
|
|
130
|
+
updateShtex(width: number, height: number, handle: Buffer, rect?: CopyRect): UpdateSharedHandle | null;
|
|
106
131
|
/**
|
|
107
|
-
* Clear
|
|
108
|
-
* @param id target window id
|
|
132
|
+
* Clear the surface.
|
|
109
133
|
*/
|
|
110
|
-
|
|
134
|
+
clear(): void;
|
|
111
135
|
/**
|
|
112
|
-
* Destroy
|
|
136
|
+
* Destroy the surface.
|
|
113
137
|
*/
|
|
114
138
|
destroy(): void;
|
|
115
139
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* Name must be unique or it will fail if there is a connection with same name
|
|
119
|
-
* @param dllDir path to dlls
|
|
120
|
-
* @param pid target process pid
|
|
121
|
-
* @param timeout Timeout for injection, in milliseconds. Will wait indefinitely if not provided.
|
|
122
|
-
* @returns new {@link Overlay} object
|
|
140
|
+
* Create a new overlay surface.
|
|
141
|
+
* @param luid The GPU LUID for surface textures.
|
|
123
142
|
*/
|
|
124
|
-
static
|
|
143
|
+
static create(luid: GpuLuid): OverlaySurface;
|
|
125
144
|
}
|
|
126
145
|
/**
|
|
127
146
|
* Default dll directory path
|
package/lib/index.js
CHANGED
|
@@ -117,31 +117,12 @@ export class Overlay {
|
|
|
117
117
|
await addon.overlaySetBlockingCursor(this[idSym], id, cursor);
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
|
-
* Update overlay
|
|
121
|
-
* @param id target window id
|
|
122
|
-
* @param width width of the bitmap
|
|
123
|
-
* @param data bgra formatted bitmap
|
|
124
|
-
*/
|
|
125
|
-
async updateBitmap(id, width, data) {
|
|
126
|
-
await addon.overlayUpdateBitmap(this[idSym], id, width, data);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Update overlay using D3D11 shared texture.
|
|
130
|
-
* @param id target window id
|
|
131
|
-
* @param width width of the surface
|
|
132
|
-
* @param height height of the surface
|
|
133
|
-
* @param handle NT Handle of shared D3D11 Texture
|
|
134
|
-
* @param rect Area to update
|
|
135
|
-
*/
|
|
136
|
-
async updateShtex(id, width, height, handle, rect) {
|
|
137
|
-
await addon.overlayUpdateShtex(this[idSym], id, width, height, handle, rect);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Clear overlay
|
|
120
|
+
* Update overlay surface.
|
|
141
121
|
* @param id target window id
|
|
122
|
+
* @param update shared handle update
|
|
142
123
|
*/
|
|
143
|
-
async
|
|
144
|
-
await addon.
|
|
124
|
+
async updateHandle(id, update) {
|
|
125
|
+
await addon.overlayUpdateHandle(this[idSym], id, update);
|
|
145
126
|
}
|
|
146
127
|
/**
|
|
147
128
|
* Destroy overlay
|
|
@@ -163,6 +144,52 @@ export class Overlay {
|
|
|
163
144
|
return new Overlay(await addon.attach(dllDir, pid, timeout));
|
|
164
145
|
}
|
|
165
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Represent a surface for overlay.
|
|
149
|
+
*/
|
|
150
|
+
export class OverlaySurface {
|
|
151
|
+
[idSym];
|
|
152
|
+
constructor(id) {
|
|
153
|
+
this[idSym] = id;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Update surface using bitmap buffer. The size of overlay is `width x (data.byteLength / 4 / width)`
|
|
157
|
+
* @param width width of the bitmap
|
|
158
|
+
* @param data bgra formatted bitmap
|
|
159
|
+
*/
|
|
160
|
+
updateBitmap(width, data) {
|
|
161
|
+
return addon.surfaceUpdateBitmap(this[idSym], width, data);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Update surface using D3D11 shared texture.
|
|
165
|
+
* @param width width of the surface
|
|
166
|
+
* @param height height of the surface
|
|
167
|
+
* @param handle NT Handle of shared D3D11 Texture
|
|
168
|
+
* @param rect Area to update
|
|
169
|
+
*/
|
|
170
|
+
updateShtex(width, height, handle, rect) {
|
|
171
|
+
return addon.surfaceUpdateShtex(this[idSym], width, height, handle, rect);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Clear the surface.
|
|
175
|
+
*/
|
|
176
|
+
clear() {
|
|
177
|
+
addon.surfaceClear(this[idSym]);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Destroy the surface.
|
|
181
|
+
*/
|
|
182
|
+
destroy() {
|
|
183
|
+
addon.surfaceDestroy(this[idSym]);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Create a new overlay surface.
|
|
187
|
+
* @param luid The GPU LUID for surface textures.
|
|
188
|
+
*/
|
|
189
|
+
static create(luid) {
|
|
190
|
+
return new OverlaySurface(addon.surfaceCreate(luid));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
166
193
|
/**
|
|
167
194
|
* Default dll directory path
|
|
168
195
|
*/
|
package/lib/types.d.ts
CHANGED
|
@@ -5,6 +5,30 @@ export type PercentLength = {
|
|
|
5
5
|
ty: 'percent' | 'length';
|
|
6
6
|
value: number;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Locally unique identifier for a GPU.
|
|
10
|
+
*/
|
|
11
|
+
export type GpuLuid = {
|
|
12
|
+
/**
|
|
13
|
+
* Low part of the LUID.
|
|
14
|
+
*/
|
|
15
|
+
low: number;
|
|
16
|
+
/**
|
|
17
|
+
* High part of the LUID.
|
|
18
|
+
*/
|
|
19
|
+
high: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Describe a update of overlay surface texture handle.
|
|
23
|
+
*/
|
|
24
|
+
export type UpdateSharedHandle = {
|
|
25
|
+
/**
|
|
26
|
+
* KMT handle to surface texture.
|
|
27
|
+
*
|
|
28
|
+
* Not supplying this value will clear the existing texture.
|
|
29
|
+
*/
|
|
30
|
+
handle?: number;
|
|
31
|
+
};
|
|
8
32
|
/**
|
|
9
33
|
* Describe a rectangle when copying from source to destination.
|
|
10
34
|
*/
|