overlay-toolkit 0.11.3 → 0.13.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.
@@ -0,0 +1,40 @@
1
+ import { IOverlayAPI, OverlayCallMessage } from './overlay';
2
+ interface CommonFilePickerOptions {
3
+ excludeAcceptAllOption?: boolean;
4
+ id?: string;
5
+ startIn?: "desktop" | "documents" | "downloads" | "music" | "pictures" | "videos" | string;
6
+ types: {
7
+ description?: string;
8
+ accept: Record<string, string[]>;
9
+ }[];
10
+ }
11
+ export interface SaveFilePickerOptions extends CommonFilePickerOptions {
12
+ suggestedName?: string;
13
+ }
14
+ export interface OpenFilePickerOptions extends CommonFilePickerOptions {
15
+ multiple?: boolean;
16
+ }
17
+ export declare const showSaveFilePicker: (options?: SaveFilePickerOptions) => OverlayCallMessage;
18
+ export declare const showOpenFilePicker: (options?: OpenFilePickerOptions) => OverlayCallMessage;
19
+ /**
20
+ * FileSystem class provides methods to interact with the file system through OverlayPlugin's API.
21
+ * It implements the File System Access API-like interface, allowing you to show file pickers,
22
+ * read files, and write files using the plugin's capabilities.
23
+ */
24
+ export declare class FileSystem {
25
+ api: IOverlayAPI;
26
+ constructor(api: IOverlayAPI);
27
+ /**
28
+ * Show the save file picker dialog.
29
+ * @param options SaveFilePickerOptions to configure the file picker
30
+ * @returns A promise that resolves to a FileSystemFileHandle for the selected file
31
+ */
32
+ showSaveFilePicker(options?: SaveFilePickerOptions): Promise<FileSystemFileHandle>;
33
+ /**
34
+ * Show the open file picker dialog.
35
+ * @param options OpenFilePickerOptions to configure the file picker
36
+ * @returns A promise that resolves to an array of FileSystemFileHandle for the selected files
37
+ */
38
+ showOpenFilePicker(options?: OpenFilePickerOptions): Promise<FileSystemFileHandle[]>;
39
+ }
40
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function bufferToHex(buffer: BufferSource): string;
2
+ export declare function hexToBuffer(str: string): Uint8Array;
@@ -0,0 +1,49 @@
1
+ interface SigScanData {
2
+ base: number;
3
+ addr: number;
4
+ bytes: string;
5
+ mask: boolean[];
6
+ }
7
+ interface MemoryReadData {
8
+ addr: number;
9
+ len: number;
10
+ bytes: string;
11
+ value?: number;
12
+ }
13
+ export declare class MemoryScanResult {
14
+ addr: number;
15
+ base: number;
16
+ bytes: Uint8Array;
17
+ mask: boolean[];
18
+ get valid(): boolean;
19
+ constructor(scan: SigScanData);
20
+ private getNthRange;
21
+ /**
22
+ * get nth masked (??) data
23
+ * @param index
24
+ * @returns data slice
25
+ */
26
+ getNthMasked(index: number): Uint8Array | null;
27
+ /**
28
+ * get nth masked (??) data in DataView
29
+ * @param index
30
+ * @returns dataview
31
+ */
32
+ getDataView(index: number): DataView | null;
33
+ /**
34
+ * get relative pointer to another object, usually LEA, call, ...
35
+ * @param index
36
+ * @returns
37
+ */
38
+ getRelativePointer(index: number): number;
39
+ }
40
+ export declare class MemoryReadResult {
41
+ addr: number;
42
+ length: number;
43
+ bytes: Uint8Array;
44
+ value?: number;
45
+ get valid(): boolean;
46
+ constructor(data: MemoryReadData);
47
+ get dataView(): DataView;
48
+ }
49
+ export {};
package/dist/otk.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { OverlayHID } from './hid';
2
2
  import { OverlayCallMessage, OverlayPluginAPI } from './overlay';
3
+ import { FileSystem } from './file_system';
3
4
  import { PacketFilter, PacketHandler } from './packet';
5
+ import { MemoryReadResult, MemoryScanResult } from './memory';
4
6
  export interface DispatchMessage {
5
7
  type: string;
6
8
  }
@@ -8,20 +10,41 @@ export interface GameVersion {
8
10
  version: string;
9
11
  lang: number;
10
12
  }
13
+ export interface PluginVersion {
14
+ /**
15
+ * plugin version
16
+ */
17
+ version: string;
18
+ /**
19
+ * tools that plugin provided
20
+ */
21
+ tools?: string[];
22
+ }
11
23
  export declare class OverlayToolkit {
12
24
  /**
13
25
  * HID interface
14
26
  */
15
27
  hid: OverlayHID;
28
+ fs: FileSystem;
16
29
  api: OverlayPluginAPI;
17
30
  constructor();
18
31
  /**
19
32
  * Fetch acts like window.fetch but without CORS restrictions
33
+ *
34
+ * This is old behavior for backward compatibility, new code should use fetch() instead which returns a valid Response object
20
35
  * @param url target URL
21
36
  * @param options options
22
37
  * @returns response
38
+ * @deprecated use fetch() instead which returns a valid Response object
23
39
  */
24
40
  Fetch(url: string, options?: RequestInit): Promise<Response>;
41
+ /**
42
+ * fetch acts like window.fetch but without CORS restrictions, returns response body as text.
43
+ * @param url
44
+ * @param options
45
+ * @returns
46
+ */
47
+ fetch(url: string, options?: RequestInit): Promise<Response>;
25
48
  /**
26
49
  * Subscribe to game packets
27
50
  * @param name subscription name
@@ -42,10 +65,35 @@ export declare class OverlayToolkit {
42
65
  */
43
66
  GetGameVersion(): Promise<GameVersion>;
44
67
  /**
45
- * Plugin version
46
- * @returns get plugin version
68
+ * Get plugin version
69
+ * @returns the plugin version
47
70
  */
48
71
  GetPluginVersion(): Promise<string>;
72
+ /**
73
+ * Get plugin version and tool list
74
+ * @returns the plugin info
75
+ */
76
+ GetPluginInfo(): Promise<PluginVersion>;
77
+ /**
78
+ * Open URL in default browser
79
+ * @param url URL to open
80
+ */
81
+ OpenBrowser(url: string): Promise<void>;
82
+ /**
83
+ * Search memory sig in program TEXT section
84
+ * @param sig sig to scan. e.g. "e8 ?? ?? ?? ??"
85
+ * @param startAddr optional. address to start search, absolute address
86
+ * @param offset optional. address to start search, relative to text begin
87
+ * @returns
88
+ */
89
+ MemoryScanSig(sig: string, offset: number, startAddr?: number): Promise<MemoryScanResult>;
90
+ /**
91
+ * Read memory with address and length
92
+ * @param addr address to read
93
+ * @param length length to read. 0x10000 maximum
94
+ * @returns
95
+ */
96
+ MemoryRead(addr: number, length: number): Promise<MemoryReadResult>;
49
97
  /**
50
98
  * Call start overlay events
51
99
  *
@@ -123,4 +171,8 @@ export declare class OverlayToolkit {
123
171
  * @returns
124
172
  */
125
173
  Connect(wsUrl?: string | null): void;
174
+ /**
175
+ * Check if connected to OverlayPlugin
176
+ */
177
+ get isConnected(): boolean;
126
178
  }