import DosBundle from "./dos/bundle/dos-bundle"; import { AsyncifyStats, TransportLayer, FsNode } from "./protocol/protocol"; export interface DosConfig { dosboxConf: string; jsdosConf: { version: string; }; } export declare enum NetworkType { NETWORK_DOSBOX_IPX = 0 } export interface BackendOptions { token?: string | undefined; onExtractProgress?: (bundleIndex: number, file: string, extracted: number, total: number) => void; } export type InitBundleEntry = Uint8Array; export interface InitFileEntry { path: string; contents: Uint8Array; } export type InitFsEntry = InitBundleEntry | InitFileEntry | DosConfig | string; export type InitFs = InitFsEntry | InitFsEntry[]; export type PersistedSockdrives = { drives: { url: string; persist: Uint8Array; }[]; } | null; export interface Emulators { pathPrefix: string; pathSuffix: string; version: string; wdosboxJs: string; bundle: () => Promise; bundleConfig: (bundle: InitBundleEntry) => Promise; bundleUpdateConfig: (bundle: InitBundleEntry, config: DosConfig) => Promise; dosboxNode: (init: InitFs, options?: BackendOptions) => Promise; dosboxDirect: (init: InitFs, options?: BackendOptions) => Promise; dosboxWorker: (init: InitFs, options?: BackendOptions) => Promise; dosboxXNode: (init: InitFs, options?: BackendOptions) => Promise; dosboxXDirect: (init: InitFs, options?: BackendOptions) => Promise; dosboxXWorker: (init: InitFs, options?: BackendOptions) => Promise; backend: (init: InitFs, transportLayer: TransportLayer, options?: BackendOptions) => Promise; } export interface CommandInterface { config: () => Promise; height: () => number; width: () => number; soundFrequency: () => number; screenshot: () => Promise; pause: () => void; resume: () => void; mute: () => void; unmute: () => void; exit: () => Promise; simulateKeyPress: (...keyCodes: number[]) => void; sendKeyEvent: (keyCode: number, pressed: boolean) => void; sendMouseMotion: (x: number, y: number) => void; sendMouseRelativeMotion: (x: number, y: number) => void; sendMouseButton: (button: number, pressed: boolean) => void; sendMouseSync: () => void; sendBackendEvent: (event: any) => void; persist(onlyChanges?: boolean): Promise; events(): CommandInterfaceEvents; networkConnect(networkType: NetworkType, address: string): Promise; networkDisconnect(networkType: NetworkType): Promise; asyncifyStats(): Promise; fsTree(): Promise; fsReadFile(file: string): Promise; fsWriteFile(file: string, contents: ReadableStream | Uint8Array): Promise; fsDeleteFile(file: string): Promise; } export type MessageType = "log" | "warn" | "error" | string; export interface CommandInterfaceEvents { onStdout: (consumer: (message: string) => void) => void; onFrameSize: (consumer: (width: number, height: number) => void) => void; onFrame: (consumer: (rgb: Uint8Array | null, rgba: Uint8Array | null) => void) => void; onSoundPush: (consumer: (samples: Float32Array) => void) => void; onExit: (consumer: () => void) => void; onMessage: (consumer: (msgType: MessageType, ...args: any[]) => void) => void; onNetworkConnected: (consumer: (networkType: NetworkType, address: string) => void) => void; onNetworkDisconnected: (consumer: (networkType: NetworkType) => void) => void; onUnload: (consumer: () => Promise) => void; }