@grimmdev/retrokit 0.0.0-stage → 0.2.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/README.md +2 -3
- package/dist/index.d.ts +1272 -0
- package/dist/retrokit.js +7270 -0
- package/dist/retrokit.js.map +1 -0
- package/dist/retrokit.umd.cjs +149 -0
- package/dist/retrokit.umd.cjs.map +1 -0
- package/package.json +59 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1272 @@
|
|
|
1
|
+
export declare interface AchievementDefinition {
|
|
2
|
+
id: number;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
points: number;
|
|
6
|
+
badgeName?: string;
|
|
7
|
+
badgeUrl?: string;
|
|
8
|
+
unlocked: boolean;
|
|
9
|
+
unlockedHardcore?: boolean;
|
|
10
|
+
progress?: {
|
|
11
|
+
current: number;
|
|
12
|
+
max: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Headless RetroAchievements Subsystem.
|
|
18
|
+
* Inspects live emulator RAM via adapter memory bridges and unlocks achievements
|
|
19
|
+
* without requiring server-side TCP/WebSocket socket bridges.
|
|
20
|
+
*/
|
|
21
|
+
export declare class AchievementManager implements IAchievementManager {
|
|
22
|
+
private readonly _getAdapter;
|
|
23
|
+
private readonly _emit;
|
|
24
|
+
private _user;
|
|
25
|
+
private _achievements;
|
|
26
|
+
private _gameHash;
|
|
27
|
+
private _gameId;
|
|
28
|
+
private _gameTitle;
|
|
29
|
+
private _hardcore;
|
|
30
|
+
private _unlockedIds;
|
|
31
|
+
private _defaultApi;
|
|
32
|
+
constructor(_getAdapter: () => ICoreAdapter | null, _emit: (event: string, payload: any) => void);
|
|
33
|
+
get user(): AchievementUser | null;
|
|
34
|
+
get isLoggedIn(): boolean;
|
|
35
|
+
get achievements(): AchievementDefinition[];
|
|
36
|
+
get gameHash(): string | null;
|
|
37
|
+
get gameId(): number | null;
|
|
38
|
+
get gameTitle(): string | null;
|
|
39
|
+
get hardcore(): boolean;
|
|
40
|
+
setHardcore(enabled: boolean): void;
|
|
41
|
+
computeGameHash(romData: Uint8Array): string;
|
|
42
|
+
login(username: string, tokenOrPassword: string, apiEndpoint?: string): Promise<{
|
|
43
|
+
success: boolean;
|
|
44
|
+
error?: string;
|
|
45
|
+
user?: AchievementUser;
|
|
46
|
+
}>;
|
|
47
|
+
logout(): void;
|
|
48
|
+
loadAchievements(gameHash: string, fallbackTitle?: string, apiEndpoint?: string): Promise<AchievementDefinition[]>;
|
|
49
|
+
setAchievements(items: AchievementDefinition[], gameHash?: string, gameTitle?: string): void;
|
|
50
|
+
unlock(achievementId: number, apiEndpoint?: string): Promise<boolean>;
|
|
51
|
+
updateProgress(achievementId: number, current: number, max: number): void;
|
|
52
|
+
evaluate(): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export declare interface AchievementUser {
|
|
56
|
+
username: string;
|
|
57
|
+
token?: string;
|
|
58
|
+
score?: number;
|
|
59
|
+
softcoreScore?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export declare interface AdapterContext {
|
|
63
|
+
canvas: HTMLCanvasElement;
|
|
64
|
+
assetBaseUrl: string;
|
|
65
|
+
audioContext: AudioContext;
|
|
66
|
+
fetchHeaders?: Record<string, string>;
|
|
67
|
+
debug?: boolean;
|
|
68
|
+
onFpsUpdate?: (fps: number) => void;
|
|
69
|
+
onSramDirty?: (data: Uint8Array | Record<string, Uint8Array>) => void;
|
|
70
|
+
onLog?: (message: string, level?: 'info' | 'warn' | 'error') => void;
|
|
71
|
+
retroAchievements?: {
|
|
72
|
+
username?: string;
|
|
73
|
+
token?: string;
|
|
74
|
+
hardcore?: boolean;
|
|
75
|
+
apiEndpoint?: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* ArchiveExtractor provides utilities to decompress 7z and zip archives
|
|
81
|
+
* inside a Web Worker to prevent blocking the main browser thread.
|
|
82
|
+
*/
|
|
83
|
+
export declare class ArchiveExtractor {
|
|
84
|
+
private static _workerScriptCache;
|
|
85
|
+
/**
|
|
86
|
+
* Decompresses an archive buffer into a key-value mapping of relative file paths to Uint8Array contents.
|
|
87
|
+
*/
|
|
88
|
+
static decompress(archiveData: Uint8Array, format: '7z' | 'zip', onProgress?: (percent: number) => void): Promise<Record<string, Uint8Array>>;
|
|
89
|
+
/**
|
|
90
|
+
* Fetches the decompression worker script text from local proxy or CDN, caching the text in memory.
|
|
91
|
+
*/
|
|
92
|
+
private static _getWorkerScript;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export declare class AudioManager implements IAudioManager {
|
|
96
|
+
private readonly _ctx;
|
|
97
|
+
private readonly _getAdapter;
|
|
98
|
+
private _masterGain;
|
|
99
|
+
private _volume;
|
|
100
|
+
private _isMuted;
|
|
101
|
+
constructor(_ctx: AudioContext, _getAdapter: () => ICoreAdapter | null);
|
|
102
|
+
getVolume(): number;
|
|
103
|
+
setVolume(volume: number): void;
|
|
104
|
+
setMute(mute: boolean): void;
|
|
105
|
+
isMuted(): boolean;
|
|
106
|
+
unlockAudio(): Promise<void>;
|
|
107
|
+
getAudioContext(): AudioContext;
|
|
108
|
+
destroy(): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* BaseCoreBridge provides safe, non-breaking default implementations for all
|
|
113
|
+
* emulation operations. If a specific core does not support a feature, it gracefully
|
|
114
|
+
* no-ops instead of throwing unhandled exceptions.
|
|
115
|
+
*/
|
|
116
|
+
export declare abstract class BaseCoreBridge implements ICoreAdapter {
|
|
117
|
+
abstract readonly id: string;
|
|
118
|
+
abstract readonly name: string;
|
|
119
|
+
abstract readonly system: string;
|
|
120
|
+
abstract readonly capabilities: CoreCapabilities;
|
|
121
|
+
protected context: AdapterContext | null;
|
|
122
|
+
protected isRunningInternal: boolean;
|
|
123
|
+
protected isPausedInternal: boolean;
|
|
124
|
+
init(context: AdapterContext): Promise<void>;
|
|
125
|
+
abstract loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
126
|
+
start(): void;
|
|
127
|
+
pause(): void;
|
|
128
|
+
resume(): void;
|
|
129
|
+
stop(): Promise<void>;
|
|
130
|
+
restart(): Promise<void>;
|
|
131
|
+
destroy(): Promise<void>;
|
|
132
|
+
rawSaveState(_slot?: number): Promise<Uint8Array | null>;
|
|
133
|
+
rawLoadState(_data: Uint8Array, _slot?: number): Promise<boolean>;
|
|
134
|
+
rawSetBios(_name: string, _data: Uint8Array): Promise<void>;
|
|
135
|
+
rawReadMemory(_address: number, _length: number): Uint8Array | null;
|
|
136
|
+
rawGetMemorySize(): number;
|
|
137
|
+
rawGetSram(): Promise<Uint8Array | Record<string, Uint8Array> | null>;
|
|
138
|
+
rawSetSram(_data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
139
|
+
rawFlushSram(): Promise<void>;
|
|
140
|
+
getSramPath(): string;
|
|
141
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
142
|
+
rawSetOption(_key: string, _value: string): void;
|
|
143
|
+
rawSetCheat(_index: number, _enabled: boolean, _code: string): void;
|
|
144
|
+
rawResetCheats(): void;
|
|
145
|
+
rawGetDiscCount(): number;
|
|
146
|
+
rawChangeDisc(_index: number): Promise<boolean>;
|
|
147
|
+
rawSendButton(_player: number, _buttonId: number, _pressed: boolean): void;
|
|
148
|
+
rawSendAxis(_player: number, _axisId: number, _value: number): void;
|
|
149
|
+
rawSetVolume(_volume: number): void;
|
|
150
|
+
rawSetSpeed(_ratio: number): void;
|
|
151
|
+
rawGetFps(): number;
|
|
152
|
+
getCanvas(): HTMLCanvasElement;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Manages system BIOS and firmware files, automatically injecting them into
|
|
157
|
+
* the virtual system directories of active emulation cores.
|
|
158
|
+
*/
|
|
159
|
+
export declare class BiosManager implements IBiosManager {
|
|
160
|
+
private _biosMap;
|
|
161
|
+
register(name: string, data: Uint8Array | ArrayBuffer): void;
|
|
162
|
+
unregister(name: string): boolean;
|
|
163
|
+
has(name: string): boolean;
|
|
164
|
+
get(name: string): Uint8Array | undefined;
|
|
165
|
+
list(): string[];
|
|
166
|
+
clear(): void;
|
|
167
|
+
injectIntoAdapter(adapter: ICoreAdapter): Promise<void>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* In-game cheat definition.
|
|
172
|
+
*/
|
|
173
|
+
export declare interface CheatItem {
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
code: string;
|
|
177
|
+
enabled: boolean;
|
|
178
|
+
type?: 'gameshark' | 'gamegenie' | 'actionreplay' | 'raw' | 'pnach';
|
|
179
|
+
address?: number;
|
|
180
|
+
value?: number;
|
|
181
|
+
description?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare class CheatManager implements ICheatManager {
|
|
185
|
+
private readonly _getAdapter;
|
|
186
|
+
private _cheats;
|
|
187
|
+
private _counter;
|
|
188
|
+
constructor(_getAdapter: () => ICoreAdapter | null);
|
|
189
|
+
getCheats(): CheatItem[];
|
|
190
|
+
addCheat(cheat: Omit<CheatItem, 'id'>): string;
|
|
191
|
+
removeCheat(id: string): boolean;
|
|
192
|
+
toggleCheat(id: string, enabled: boolean): void;
|
|
193
|
+
clearAllCheats(): void;
|
|
194
|
+
loadCheatFile(content: string, format?: 'cht' | 'pnach' | 'json'): void;
|
|
195
|
+
exportCheatFile(): string;
|
|
196
|
+
private _syncToCore;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export declare interface CompanionFile {
|
|
200
|
+
name: string;
|
|
201
|
+
data: Uint8Array | ArrayBuffer | Blob;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
declare type CoreAdapterFactory = () => ICoreAdapter;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Core capability manifest declaring which features an emulation engine natively supports.
|
|
208
|
+
*/
|
|
209
|
+
export declare interface CoreCapabilities {
|
|
210
|
+
/** Execution snapshot save states (CPU/RAM/VRAM freeze) */
|
|
211
|
+
saveStates: boolean;
|
|
212
|
+
/** Physical in-game battery RAM (.srm, .sav, MC0, .sol) */
|
|
213
|
+
sram: boolean;
|
|
214
|
+
/** Real-time cheat code engine (Action Replay, GameShark, PNACH) */
|
|
215
|
+
cheats: boolean;
|
|
216
|
+
/** Runtime internal variables (overclocks, rendering mode, region) */
|
|
217
|
+
coreOptions: boolean;
|
|
218
|
+
/** Multi-disc media swapping (.m3u, disc trays) */
|
|
219
|
+
multiDisc: boolean;
|
|
220
|
+
/** Hardware video shaders (CRT, scanlines, xBRZ) */
|
|
221
|
+
shaders: boolean;
|
|
222
|
+
/** Real-time execution rewind buffer */
|
|
223
|
+
rewind: boolean;
|
|
224
|
+
/** Dynamic speed manipulation (Fast forward, slow motion) */
|
|
225
|
+
variableSpeed: boolean;
|
|
226
|
+
/** Maximum simultaneous input players supported (e.g. 1, 2, 4, 8) */
|
|
227
|
+
maxPlayers: number;
|
|
228
|
+
/** Pointer / touch / mouse / light gun input */
|
|
229
|
+
pointer: boolean;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Metadata defining a WebAssembly emulator core.
|
|
234
|
+
*/
|
|
235
|
+
export declare interface CoreMetadata {
|
|
236
|
+
id: string;
|
|
237
|
+
name: string;
|
|
238
|
+
system: string;
|
|
239
|
+
family: 'libretro' | 'play' | 'ruffle' | 'pico8' | 'emulatorjs' | 'love';
|
|
240
|
+
extensions: string[];
|
|
241
|
+
capabilities: CoreCapabilities;
|
|
242
|
+
needsThreads?: boolean;
|
|
243
|
+
needsWebGL2?: boolean;
|
|
244
|
+
assetFile?: string;
|
|
245
|
+
wasmFile?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Core option choice item.
|
|
250
|
+
*/
|
|
251
|
+
export declare interface CoreOptionChoice {
|
|
252
|
+
value: string;
|
|
253
|
+
label: string;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Definition of an internal emulation variable/option exposed by a core.
|
|
258
|
+
*/
|
|
259
|
+
export declare interface CoreOptionDefinition {
|
|
260
|
+
id: string;
|
|
261
|
+
label: string;
|
|
262
|
+
description?: string;
|
|
263
|
+
category?: string;
|
|
264
|
+
type: 'enum' | 'boolean' | 'string' | 'number';
|
|
265
|
+
choices: CoreOptionChoice[];
|
|
266
|
+
defaultValue: string;
|
|
267
|
+
currentValue: string;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export declare class CoreOptionsManager implements ICoreOptionsManager {
|
|
271
|
+
private readonly _getAdapter;
|
|
272
|
+
private _optionOverrides;
|
|
273
|
+
private _listeners;
|
|
274
|
+
constructor(_getAdapter: () => ICoreAdapter | null);
|
|
275
|
+
getOptions(): CoreOptionDefinition[];
|
|
276
|
+
getOption(id: string): string | undefined;
|
|
277
|
+
setOption(id: string, value: string): void;
|
|
278
|
+
resetOption(id: string): void;
|
|
279
|
+
resetAll(): void;
|
|
280
|
+
onOptionChanged(callback: (id: string, value: string) => void): () => void;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export declare class CoreRegistry {
|
|
284
|
+
private static _cores;
|
|
285
|
+
private static _extensionMap;
|
|
286
|
+
private static _systemCores;
|
|
287
|
+
private static _factories;
|
|
288
|
+
private static registerBuiltinCores;
|
|
289
|
+
static registerCore(metadata: CoreMetadata): void;
|
|
290
|
+
static getCore(id: string): CoreMetadata | undefined;
|
|
291
|
+
static normalizeSystem(sys: string): string;
|
|
292
|
+
static getAllCores(): CoreMetadata[];
|
|
293
|
+
static getCoresForSystem(system: string): CoreMetadata[];
|
|
294
|
+
static resolveCoreFromFileName(fileName: string, systemHint?: string): CoreMetadata | undefined;
|
|
295
|
+
static registerAdapterFactory(coreId: string, factory: CoreAdapterFactory): void;
|
|
296
|
+
static getAdapterFactory(coreId: string): CoreAdapterFactory | undefined;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Computes standard 32-bit CRC checksum of a byte buffer.
|
|
301
|
+
*/
|
|
302
|
+
export declare function crc32(data: Uint8Array): number;
|
|
303
|
+
|
|
304
|
+
export declare const DEFAULT_CAPABILITIES: CoreCapabilities;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Multi-disc media item.
|
|
308
|
+
*/
|
|
309
|
+
export declare interface DiscInfo {
|
|
310
|
+
index: number;
|
|
311
|
+
name: string;
|
|
312
|
+
path: string;
|
|
313
|
+
isCurrent: boolean;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export declare class DiscManager implements IDiscManager {
|
|
317
|
+
private readonly _getAdapter;
|
|
318
|
+
private _currentDisc;
|
|
319
|
+
private _discs;
|
|
320
|
+
private _listeners;
|
|
321
|
+
constructor(_getAdapter: () => ICoreAdapter | null);
|
|
322
|
+
setDiscs(paths: string[]): void;
|
|
323
|
+
getDiscCount(): number;
|
|
324
|
+
getCurrentDiscIndex(): number;
|
|
325
|
+
getDiscList(): DiscInfo[];
|
|
326
|
+
changeDisc(index: number): Promise<boolean>;
|
|
327
|
+
nextDisc(): Promise<boolean>;
|
|
328
|
+
previousDisc(): Promise<boolean>;
|
|
329
|
+
ejectDisc(): Promise<void>;
|
|
330
|
+
insertDisc(index: number): Promise<void>;
|
|
331
|
+
onDiscChanged(callback: (disc: DiscInfo) => void): () => void;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Typed events emitted by EmuHeadless.
|
|
336
|
+
*/
|
|
337
|
+
export declare interface EmuEventMap {
|
|
338
|
+
ready: {
|
|
339
|
+
core: string;
|
|
340
|
+
gameId: string;
|
|
341
|
+
};
|
|
342
|
+
frame: {
|
|
343
|
+
fps: number;
|
|
344
|
+
};
|
|
345
|
+
fps: {
|
|
346
|
+
fps: number;
|
|
347
|
+
};
|
|
348
|
+
pause: void;
|
|
349
|
+
resume: void;
|
|
350
|
+
stop: void;
|
|
351
|
+
stateSaved: {
|
|
352
|
+
slot?: number;
|
|
353
|
+
metadata: SaveStateMetadata;
|
|
354
|
+
};
|
|
355
|
+
stateLoaded: {
|
|
356
|
+
slot?: number;
|
|
357
|
+
};
|
|
358
|
+
sramModified: {
|
|
359
|
+
data: Uint8Array | Record<string, Uint8Array>;
|
|
360
|
+
};
|
|
361
|
+
discChanged: {
|
|
362
|
+
disc: DiscInfo;
|
|
363
|
+
};
|
|
364
|
+
optionChanged: {
|
|
365
|
+
id: string;
|
|
366
|
+
value: string;
|
|
367
|
+
};
|
|
368
|
+
speedChanged: {
|
|
369
|
+
fastForward: boolean;
|
|
370
|
+
slowMotion: boolean;
|
|
371
|
+
ratio: number;
|
|
372
|
+
};
|
|
373
|
+
error: {
|
|
374
|
+
error: Error;
|
|
375
|
+
fatal: boolean;
|
|
376
|
+
};
|
|
377
|
+
log: {
|
|
378
|
+
message: string;
|
|
379
|
+
level: 'info' | 'warn' | 'error';
|
|
380
|
+
};
|
|
381
|
+
achievementUnlocked: {
|
|
382
|
+
achievement: AchievementDefinition;
|
|
383
|
+
hardcore: boolean;
|
|
384
|
+
};
|
|
385
|
+
achievementProgress: {
|
|
386
|
+
achievement: AchievementDefinition;
|
|
387
|
+
current: number;
|
|
388
|
+
max: number;
|
|
389
|
+
};
|
|
390
|
+
achievementLogin: {
|
|
391
|
+
user: AchievementUser;
|
|
392
|
+
};
|
|
393
|
+
achievementsLoaded: {
|
|
394
|
+
gameId: number | null;
|
|
395
|
+
gameTitle: string | null;
|
|
396
|
+
achievements: AchievementDefinition[];
|
|
397
|
+
};
|
|
398
|
+
romPatched: {
|
|
399
|
+
format: 'IPS' | 'BPS' | 'UPS';
|
|
400
|
+
originalSize: number;
|
|
401
|
+
patchedSize: number;
|
|
402
|
+
};
|
|
403
|
+
biosLoaded: {
|
|
404
|
+
name: string;
|
|
405
|
+
sizeBytes: number;
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** Backwards-compatibility alias for RetroKit */
|
|
410
|
+
export declare const EmuHeadless: typeof RetroKit;
|
|
411
|
+
|
|
412
|
+
export declare type EmuHeadless = RetroKit;
|
|
413
|
+
|
|
414
|
+
/** Legacy alias for RetroKitConfig */
|
|
415
|
+
export declare type EmuHeadlessConfig = RetroKitConfig;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* EmulatorJSAdapter manages standalone Emscripten Libretro cores provided by
|
|
419
|
+
* the EmulatorJS ecosystem (such as PPSSPP for PSP and Azahar for Nintendo 3DS).
|
|
420
|
+
*
|
|
421
|
+
* It transparently unpacks compressed .data 7z bundles, injects required assets,
|
|
422
|
+
* sets up WebGL2 context attributes, and initializes multi-threaded pthread environments.
|
|
423
|
+
*/
|
|
424
|
+
export declare class EmulatorJSAdapter extends BaseCoreBridge {
|
|
425
|
+
readonly id: string;
|
|
426
|
+
readonly name: string;
|
|
427
|
+
readonly system: string;
|
|
428
|
+
readonly capabilities: CoreCapabilities;
|
|
429
|
+
private _module;
|
|
430
|
+
private _romData;
|
|
431
|
+
private _romPath;
|
|
432
|
+
private _sramPath;
|
|
433
|
+
private _fps;
|
|
434
|
+
private _coreOptionsMap;
|
|
435
|
+
private _additionalFiles;
|
|
436
|
+
private _started;
|
|
437
|
+
private _blobUrlsToRevoke;
|
|
438
|
+
private _scriptElement;
|
|
439
|
+
private _pendingBios;
|
|
440
|
+
constructor(id: string, name: string, system: string, capabilities: CoreCapabilities);
|
|
441
|
+
init(context: AdapterContext): Promise<void>;
|
|
442
|
+
loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
443
|
+
start(): void;
|
|
444
|
+
pause(): void;
|
|
445
|
+
resume(): void;
|
|
446
|
+
stop(): Promise<void>;
|
|
447
|
+
restart(): Promise<void>;
|
|
448
|
+
destroy(): Promise<void>;
|
|
449
|
+
rawSaveState(slot?: number): Promise<Uint8Array | null>;
|
|
450
|
+
rawLoadState(data: Uint8Array, slot?: number): Promise<boolean>;
|
|
451
|
+
rawGetSram(): Promise<Uint8Array | null>;
|
|
452
|
+
rawSetSram(data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
453
|
+
rawFlushSram(): Promise<void>;
|
|
454
|
+
getSramPath(): string;
|
|
455
|
+
rawSetBios(name: string, data: Uint8Array): Promise<void>;
|
|
456
|
+
rawReadMemory(address: number, length: number): Uint8Array | null;
|
|
457
|
+
rawGetMemorySize(): number;
|
|
458
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
459
|
+
rawSetOption(key: string, value: string): void;
|
|
460
|
+
rawSetCheat(index: number, enabled: boolean, code: string): void;
|
|
461
|
+
rawResetCheats(): void;
|
|
462
|
+
rawGetDiscCount(): number;
|
|
463
|
+
rawChangeDisc(index: number): Promise<boolean>;
|
|
464
|
+
rawSendButton(player: number, buttonId: number, pressed: boolean): void;
|
|
465
|
+
rawSendAxis(player: number, axisId: number, value: number): void;
|
|
466
|
+
/**
|
|
467
|
+
* Dispatches pointer events for touchscreens (such as the Nintendo 3DS bottom screen).
|
|
468
|
+
*/
|
|
469
|
+
rawSendPointer(x: number, y: number, pressed: boolean, _player?: number): void;
|
|
470
|
+
rawGetFps(): number;
|
|
471
|
+
/**
|
|
472
|
+
* Downloads and unpacks the core binaries, prepares the Emscripten runtime module,
|
|
473
|
+
* injects assets, and boots the virtual environment.
|
|
474
|
+
*/
|
|
475
|
+
private _instantiateCoreModule;
|
|
476
|
+
/**
|
|
477
|
+
* Initializes bindings matching EJS_GameManager so simulateInput, save/load states,
|
|
478
|
+
* variables, and SRAM flushing function properly across all EmulatorJS cores.
|
|
479
|
+
*/
|
|
480
|
+
private _initializeGameManager;
|
|
481
|
+
/**
|
|
482
|
+
* Fetches or decompresses the core's .js harness and .wasm binary.
|
|
483
|
+
*/
|
|
484
|
+
private _acquireCoreBinaries;
|
|
485
|
+
/**
|
|
486
|
+
* Downloads and unpacks firmware assets required by PPSSPP.
|
|
487
|
+
*/
|
|
488
|
+
private _acquirePpssppAssets;
|
|
489
|
+
/**
|
|
490
|
+
* Injects extracted PPSSPP files into the virtual filesystem.
|
|
491
|
+
*/
|
|
492
|
+
private _injectPpssppAssets;
|
|
493
|
+
/**
|
|
494
|
+
* Appends a script element to the DOM and resolves when loaded.
|
|
495
|
+
*/
|
|
496
|
+
private _loadScriptTag;
|
|
497
|
+
private _ensureDirectories;
|
|
498
|
+
private _sendCommand;
|
|
499
|
+
private _isDispatchingFallback;
|
|
500
|
+
private _dispatchKeyboardFallback;
|
|
501
|
+
private _findStateFiles;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export declare class EventEmitter<TMap extends Record<string, any>> {
|
|
505
|
+
private _listeners;
|
|
506
|
+
on<K extends keyof TMap>(event: K, listener: EventListener_2<TMap[K]>): () => void;
|
|
507
|
+
once<K extends keyof TMap>(event: K, listener: EventListener_2<TMap[K]>): () => void;
|
|
508
|
+
off<K extends keyof TMap>(event: K, listener: EventListener_2<TMap[K]>): void;
|
|
509
|
+
emit<K extends keyof TMap>(event: K, ...args: TMap[K] extends void ? [] : [TMap[K]]): void;
|
|
510
|
+
removeAllListeners(): void;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Strongly-typed event emitter for headless emulation events.
|
|
515
|
+
*/
|
|
516
|
+
declare type EventListener_2<T> = (data: T) => void | Promise<void>;
|
|
517
|
+
export { EventListener_2 as EventListener }
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Options provided when loading a game.
|
|
521
|
+
*/
|
|
522
|
+
export declare interface GameLoadOptions {
|
|
523
|
+
/** Explicit core ID to use instead of auto-detection. */
|
|
524
|
+
core?: string;
|
|
525
|
+
/** System identifier (e.g. 'ps1', 'psx', 'ps2', 'snes', 'nes', 'genesis', 'n64'). Disambiguates shared extensions like .chd, .bin, and .iso. */
|
|
526
|
+
system?: string;
|
|
527
|
+
/** Platform or console tag (e.g. 'snes', 'ps2', 'pico8'). */
|
|
528
|
+
platformTag?: string;
|
|
529
|
+
/** Filename with extension (crucial when passing ArrayBuffer / Blob). */
|
|
530
|
+
fileName?: string;
|
|
531
|
+
/** Additional companion files (e.g. .bin tracks accompanying a .cue file, or multi-disc sets). */
|
|
532
|
+
additionalFiles?: CompanionFile[];
|
|
533
|
+
/** Unique game ID used for state and SRAM scoping. */
|
|
534
|
+
gameId?: string;
|
|
535
|
+
/** Initial in-game battery SRAM or memory card data to inject. */
|
|
536
|
+
initialSram?: Uint8Array | Record<string, Uint8Array>;
|
|
537
|
+
/** Initial save state slot to load automatically on boot. */
|
|
538
|
+
initialStateSlot?: number;
|
|
539
|
+
/** ROM patch data (IPS, BPS, UPS) to apply in memory before boot. */
|
|
540
|
+
patch?: Uint8Array | ArrayBuffer | Blob;
|
|
541
|
+
/** Enforce checksum verification when applying patches. */
|
|
542
|
+
verifyPatchChecksum?: boolean;
|
|
543
|
+
/** BIOS or system firmware files to inject into the core's system directory before boot. */
|
|
544
|
+
bios?: Record<string, Uint8Array | ArrayBuffer> | Array<{
|
|
545
|
+
name: string;
|
|
546
|
+
data: Uint8Array;
|
|
547
|
+
}>;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
export declare interface GamepadDetails {
|
|
551
|
+
index: number;
|
|
552
|
+
id: string;
|
|
553
|
+
connected: boolean;
|
|
554
|
+
mapping: string;
|
|
555
|
+
assignedPlayer: number | null;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export declare interface IAchievementManager {
|
|
559
|
+
readonly user: AchievementUser | null;
|
|
560
|
+
readonly isLoggedIn: boolean;
|
|
561
|
+
readonly achievements: AchievementDefinition[];
|
|
562
|
+
readonly gameHash: string | null;
|
|
563
|
+
readonly gameId: number | null;
|
|
564
|
+
readonly gameTitle: string | null;
|
|
565
|
+
readonly hardcore: boolean;
|
|
566
|
+
login(username: string, tokenOrPassword: string, apiEndpoint?: string): Promise<{
|
|
567
|
+
success: boolean;
|
|
568
|
+
error?: string;
|
|
569
|
+
user?: AchievementUser;
|
|
570
|
+
}>;
|
|
571
|
+
logout(): void;
|
|
572
|
+
setHardcore(enabled: boolean): void;
|
|
573
|
+
loadAchievements(gameHash: string, gameTitle?: string, apiEndpoint?: string): Promise<AchievementDefinition[]>;
|
|
574
|
+
setAchievements(items: AchievementDefinition[], gameHash?: string, gameTitle?: string): void;
|
|
575
|
+
evaluate(): void;
|
|
576
|
+
unlock(achievementId: number, apiEndpoint?: string): Promise<boolean>;
|
|
577
|
+
computeGameHash(romData: Uint8Array): string;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export declare interface IAudioManager {
|
|
581
|
+
getVolume(): number;
|
|
582
|
+
setVolume(volume: number): void;
|
|
583
|
+
setMute(mute: boolean): void;
|
|
584
|
+
isMuted(): boolean;
|
|
585
|
+
unlockAudio(): Promise<void>;
|
|
586
|
+
getAudioContext(): AudioContext;
|
|
587
|
+
destroy(): void;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export declare interface IBiosManager {
|
|
591
|
+
register(name: string, data: Uint8Array | ArrayBuffer): void;
|
|
592
|
+
unregister(name: string): boolean;
|
|
593
|
+
has(name: string): boolean;
|
|
594
|
+
get(name: string): Uint8Array | undefined;
|
|
595
|
+
list(): string[];
|
|
596
|
+
clear(): void;
|
|
597
|
+
injectIntoAdapter(adapter: ICoreAdapter): Promise<void>;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export declare interface ICheatManager {
|
|
601
|
+
getCheats(): CheatItem[];
|
|
602
|
+
addCheat(cheat: Omit<CheatItem, 'id'>): string;
|
|
603
|
+
removeCheat(id: string): boolean;
|
|
604
|
+
toggleCheat(id: string, enabled: boolean): void;
|
|
605
|
+
clearAllCheats(): void;
|
|
606
|
+
loadCheatFile(content: string, format?: 'cht' | 'pnach' | 'json'): void;
|
|
607
|
+
exportCheatFile(): string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Unified interface contract that every emulation core adapter must satisfy.
|
|
612
|
+
*/
|
|
613
|
+
export declare interface ICoreAdapter {
|
|
614
|
+
readonly id: string;
|
|
615
|
+
readonly name: string;
|
|
616
|
+
readonly system: string;
|
|
617
|
+
readonly capabilities: CoreCapabilities;
|
|
618
|
+
init(context: AdapterContext): Promise<void>;
|
|
619
|
+
loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
620
|
+
start(): void;
|
|
621
|
+
pause(): void;
|
|
622
|
+
resume(): void;
|
|
623
|
+
stop(): Promise<void>;
|
|
624
|
+
restart(): Promise<void>;
|
|
625
|
+
destroy(): Promise<void>;
|
|
626
|
+
rawSaveState(slot?: number): Promise<Uint8Array | null>;
|
|
627
|
+
rawLoadState(data: Uint8Array, slot?: number): Promise<boolean>;
|
|
628
|
+
rawSetBios(name: string, data: Uint8Array): Promise<void>;
|
|
629
|
+
rawReadMemory(address: number, length: number): Uint8Array | null;
|
|
630
|
+
rawGetMemorySize(): number;
|
|
631
|
+
rawGetSram(): Promise<Uint8Array | Record<string, Uint8Array> | null>;
|
|
632
|
+
rawSetSram(data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
633
|
+
rawFlushSram(): Promise<void>;
|
|
634
|
+
getSramPath(): string;
|
|
635
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
636
|
+
rawSetOption(key: string, value: string): void;
|
|
637
|
+
rawSetCheat(index: number, enabled: boolean, code: string): void;
|
|
638
|
+
rawResetCheats(): void;
|
|
639
|
+
rawGetDiscCount(): number;
|
|
640
|
+
rawChangeDisc(index: number): Promise<boolean>;
|
|
641
|
+
rawSendButton(player: number, buttonId: number, pressed: boolean): void;
|
|
642
|
+
rawSendAxis(player: number, axisId: number, value: number): void;
|
|
643
|
+
rawSetVolume(volume: number): void;
|
|
644
|
+
rawSetSpeed(ratio: number): void;
|
|
645
|
+
rawGetFps(): number;
|
|
646
|
+
getCanvas(): HTMLCanvasElement;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export declare interface ICoreOptionsManager {
|
|
650
|
+
getOptions(): CoreOptionDefinition[];
|
|
651
|
+
getOption(id: string): string | undefined;
|
|
652
|
+
setOption(id: string, value: string): void;
|
|
653
|
+
resetOption(id: string): void;
|
|
654
|
+
resetAll(): void;
|
|
655
|
+
onOptionChanged(callback: (id: string, value: string) => void): () => void;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
export declare interface IDiscManager {
|
|
659
|
+
getDiscCount(): number;
|
|
660
|
+
getCurrentDiscIndex(): number;
|
|
661
|
+
getDiscList(): DiscInfo[];
|
|
662
|
+
changeDisc(index: number): Promise<boolean>;
|
|
663
|
+
nextDisc(): Promise<boolean>;
|
|
664
|
+
previousDisc(): Promise<boolean>;
|
|
665
|
+
ejectDisc(): Promise<void>;
|
|
666
|
+
insertDisc(index: number): Promise<void>;
|
|
667
|
+
onDiscChanged(callback: (disc: DiscInfo) => void): () => void;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export declare interface IInputManager {
|
|
671
|
+
player(index: number): PlayerInputChannel;
|
|
672
|
+
getMaxPlayers(): number;
|
|
673
|
+
autoAssignGamepads(): void;
|
|
674
|
+
setHotkeyBinding(hotkey: StandardHotkey, keyOrButton: string | number): void;
|
|
675
|
+
getConnectedControllers(): GamepadDetails[];
|
|
676
|
+
sendButton(player: number, button: StandardButton, pressed: boolean): void;
|
|
677
|
+
sendAxis(player: number, axis: StandardAxis, value: number): void;
|
|
678
|
+
sendAnalogStick(player: number, stick: 'LEFT' | 'RIGHT', x: number, y: number): void;
|
|
679
|
+
destroy(): void;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export declare interface INetplayManager {
|
|
683
|
+
isConnected(): boolean;
|
|
684
|
+
isHost(): boolean;
|
|
685
|
+
getPlayerIndex(): number;
|
|
686
|
+
getConnectedPeers(): NetplayPeer[];
|
|
687
|
+
connect(serverUrl: string, roomId: string, nickname?: string): Promise<void>;
|
|
688
|
+
disconnect(): void;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
export declare class InputManager implements IInputManager {
|
|
692
|
+
private readonly _getAdapter;
|
|
693
|
+
private readonly _maxPlayers;
|
|
694
|
+
private _players;
|
|
695
|
+
private _hotkeys;
|
|
696
|
+
private _hotkeyHandlers;
|
|
697
|
+
private _pollRaf;
|
|
698
|
+
private _onKeyDownRef;
|
|
699
|
+
private _onKeyUpRef;
|
|
700
|
+
constructor(_getAdapter: () => ICoreAdapter | null, _maxPlayers?: number);
|
|
701
|
+
player(index: number): PlayerInputChannel;
|
|
702
|
+
sendButton(player: number, button: StandardButton, pressed: boolean): void;
|
|
703
|
+
sendAxis(player: number, axis: StandardAxis, value: number): void;
|
|
704
|
+
sendAnalogStick(player: number, stick: 'LEFT' | 'RIGHT', x: number, y: number): void;
|
|
705
|
+
getMaxPlayers(): number;
|
|
706
|
+
autoAssignGamepads(): void;
|
|
707
|
+
setHotkeyBinding(hotkey: StandardHotkey, keyOrButton: string | number): void;
|
|
708
|
+
registerHotkeyHandler(hotkey: StandardHotkey, handler: () => void): void;
|
|
709
|
+
getConnectedControllers(): GamepadDetails[];
|
|
710
|
+
destroy(): void;
|
|
711
|
+
private _handleKeyDown;
|
|
712
|
+
private _handleKeyUp;
|
|
713
|
+
private _startGamepadLoop;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
export declare interface ISramManager {
|
|
717
|
+
getSram(): Promise<Uint8Array | Record<string, Uint8Array> | null>;
|
|
718
|
+
setSram(data: Uint8Array | Record<string, Uint8Array>, options?: {
|
|
719
|
+
restart?: boolean;
|
|
720
|
+
}): Promise<boolean>;
|
|
721
|
+
flushSram(): Promise<void>;
|
|
722
|
+
isDirty(): boolean;
|
|
723
|
+
onSramModified(callback: (data: Uint8Array | Record<string, Uint8Array>) => void): () => void;
|
|
724
|
+
getSaveFilePath(): string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
export declare interface IStateManager {
|
|
728
|
+
saveState(slot?: number): Promise<SaveStateRecord | null>;
|
|
729
|
+
loadState(source: number | Uint8Array): Promise<boolean>;
|
|
730
|
+
getStateBuffer(): Promise<Uint8Array | null>;
|
|
731
|
+
listStates(): Promise<SaveStateMetadata[]>;
|
|
732
|
+
hasState(slot: number): Promise<boolean>;
|
|
733
|
+
deleteState(slot: number): Promise<void>;
|
|
734
|
+
autoSave(): Promise<SaveStateRecord | null>;
|
|
735
|
+
autoLoad(): Promise<boolean>;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
export declare interface ITimingManager {
|
|
739
|
+
readonly isFastForward: boolean;
|
|
740
|
+
readonly isSlowMotion: boolean;
|
|
741
|
+
readonly speedRatio: number;
|
|
742
|
+
setFastForward(active: boolean, rate?: number): void;
|
|
743
|
+
setSlowMotion(active: boolean, rate?: number): void;
|
|
744
|
+
setSpeed(ratio: number): void;
|
|
745
|
+
stepFrame(): void;
|
|
746
|
+
isRewindSupported(): boolean;
|
|
747
|
+
startRewind(): void;
|
|
748
|
+
stopRewind(): void;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export declare interface IVideoManager {
|
|
752
|
+
readonly aspectRatio: string;
|
|
753
|
+
readonly rotation: number;
|
|
754
|
+
readonly currentShader: string;
|
|
755
|
+
setShader(shader: 'crt-geom' | 'scanlines' | 'xbrz' | 'sharp-bilinear' | 'disabled' | string): Promise<void>;
|
|
756
|
+
setAspectRatio(mode: 'auto' | '4:3' | '16:9' | 'stretch' | 'pixel-perfect'): void;
|
|
757
|
+
setRotation(degrees: 0 | 90 | 180 | 270): void;
|
|
758
|
+
setVsync(enabled: boolean): void;
|
|
759
|
+
takeScreenshot(format?: 'image/png' | 'image/jpeg' | 'image/webp', quality?: number): Promise<Blob>;
|
|
760
|
+
getMetrics(): {
|
|
761
|
+
internalWidth: number;
|
|
762
|
+
internalHeight: number;
|
|
763
|
+
fps: number;
|
|
764
|
+
};
|
|
765
|
+
clear(): void;
|
|
766
|
+
destroy(): void;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* LibretroAdapter manages Emscripten-compiled Libretro cores from both
|
|
771
|
+
* EmulatorJS data bundles and web.libretro.com (including retro8 for PICO-8).
|
|
772
|
+
*/
|
|
773
|
+
export declare class LibretroAdapter extends BaseCoreBridge {
|
|
774
|
+
readonly id: string;
|
|
775
|
+
readonly name: string;
|
|
776
|
+
readonly system: string;
|
|
777
|
+
readonly capabilities: CoreCapabilities;
|
|
778
|
+
private _module;
|
|
779
|
+
private _romData;
|
|
780
|
+
private _romPath;
|
|
781
|
+
private _sramPath;
|
|
782
|
+
private _fps;
|
|
783
|
+
private _coreOptionsMap;
|
|
784
|
+
private _additionalFiles;
|
|
785
|
+
private _started;
|
|
786
|
+
private _pendingBios;
|
|
787
|
+
constructor(id: string, name: string, system: string, capabilities: CoreCapabilities);
|
|
788
|
+
init(context: AdapterContext): Promise<void>;
|
|
789
|
+
loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
790
|
+
start(): void;
|
|
791
|
+
pause(): void;
|
|
792
|
+
resume(): void;
|
|
793
|
+
stop(): Promise<void>;
|
|
794
|
+
restart(): Promise<void>;
|
|
795
|
+
destroy(): Promise<void>;
|
|
796
|
+
rawSaveState(slot?: number): Promise<Uint8Array | null>;
|
|
797
|
+
rawLoadState(data: Uint8Array, slot?: number): Promise<boolean>;
|
|
798
|
+
rawGetSram(): Promise<Uint8Array | null>;
|
|
799
|
+
rawSetSram(data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
800
|
+
rawFlushSram(): Promise<void>;
|
|
801
|
+
getSramPath(): string;
|
|
802
|
+
rawSetBios(name: string, data: Uint8Array): Promise<void>;
|
|
803
|
+
rawReadMemory(address: number, length: number): Uint8Array | null;
|
|
804
|
+
rawGetMemorySize(): number;
|
|
805
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
806
|
+
rawSetOption(key: string, value: string): void;
|
|
807
|
+
rawSetCheat(index: number, enabled: boolean, code: string): void;
|
|
808
|
+
rawResetCheats(): void;
|
|
809
|
+
rawGetDiscCount(): number;
|
|
810
|
+
rawChangeDisc(index: number): Promise<boolean>;
|
|
811
|
+
rawSendButton(player: number, buttonId: number, pressed: boolean): void;
|
|
812
|
+
private _sendCommand;
|
|
813
|
+
private _isDispatchingFallback;
|
|
814
|
+
private _dispatchKeyboardFallback;
|
|
815
|
+
rawSendAxis(player: number, axisId: number, value: number): void;
|
|
816
|
+
rawGetFps(): number;
|
|
817
|
+
private _instantiateCoreModule;
|
|
818
|
+
private _findStateFiles;
|
|
819
|
+
private _ensureDirectories;
|
|
820
|
+
private _parseCoreOptionsString;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* LoveAdapter integrates love.js (LÖVE 11.5 WebAssembly) with support for
|
|
825
|
+
* both standalone .love files and zip archives.
|
|
826
|
+
*
|
|
827
|
+
* It embeds normalize1.lua and normalize2.lua into the virtual filesystem
|
|
828
|
+
* at /usr/local/share/lua/5.1/ and establishes the synchronous JavaScript
|
|
829
|
+
* communication bridge required by modern Love2D games like Little Bookbinder.
|
|
830
|
+
*/
|
|
831
|
+
export declare class LoveAdapter extends BaseCoreBridge {
|
|
832
|
+
readonly id = "love";
|
|
833
|
+
readonly name = "L\u00D6VE (love.js)";
|
|
834
|
+
readonly system = "love";
|
|
835
|
+
readonly capabilities: CoreCapabilities;
|
|
836
|
+
private static readonly RETROPAD_TO_KEY;
|
|
837
|
+
private _module;
|
|
838
|
+
private _gameData;
|
|
839
|
+
private _fileName;
|
|
840
|
+
private _fps;
|
|
841
|
+
private _scriptElement;
|
|
842
|
+
private _isReady;
|
|
843
|
+
get isReady(): boolean;
|
|
844
|
+
loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
845
|
+
start(): void;
|
|
846
|
+
pause(): void;
|
|
847
|
+
resume(): void;
|
|
848
|
+
stop(): Promise<void>;
|
|
849
|
+
restart(): Promise<void>;
|
|
850
|
+
destroy(): Promise<void>;
|
|
851
|
+
rawSendButton(_player: number, buttonId: number, pressed: boolean): void;
|
|
852
|
+
rawSendAxis(player: number, axisId: number, value: number): void;
|
|
853
|
+
rawGetFps(): number;
|
|
854
|
+
rawGetSram(): Promise<Uint8Array | Record<string, Uint8Array> | null>;
|
|
855
|
+
rawSetSram(data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
856
|
+
rawFlushSram(): Promise<void>;
|
|
857
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
858
|
+
private _ensureDirectoryExists;
|
|
859
|
+
private _instantiateLove;
|
|
860
|
+
private _loadScript;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
export declare function md5(data: Uint8Array): string;
|
|
864
|
+
|
|
865
|
+
export declare class NetplayManager implements INetplayManager {
|
|
866
|
+
private _connected;
|
|
867
|
+
private _isHost;
|
|
868
|
+
private _playerIndex;
|
|
869
|
+
private _peers;
|
|
870
|
+
private _socket;
|
|
871
|
+
isConnected(): boolean;
|
|
872
|
+
isHost(): boolean;
|
|
873
|
+
getPlayerIndex(): number;
|
|
874
|
+
getConnectedPeers(): NetplayPeer[];
|
|
875
|
+
connect(serverUrl: string, roomId: string, nickname?: string): Promise<void>;
|
|
876
|
+
disconnect(): void;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
export declare interface NetplayPeer {
|
|
880
|
+
id: string;
|
|
881
|
+
name: string;
|
|
882
|
+
playerIndex: number;
|
|
883
|
+
pingMs?: number;
|
|
884
|
+
isHost: boolean;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
export declare type PatchFormat = 'IPS' | 'BPS' | 'UPS';
|
|
888
|
+
|
|
889
|
+
export declare interface PatchResult {
|
|
890
|
+
patchedRom: Uint8Array;
|
|
891
|
+
format: PatchFormat;
|
|
892
|
+
originalCrc32: number;
|
|
893
|
+
patchedCrc32: number;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Pico8Adapter bridges the official Lexaloffle PICO-8 standalone web runtime
|
|
898
|
+
* to RetroKit using the proven architecture from JellyEmu.
|
|
899
|
+
*
|
|
900
|
+
* It boots cartridges (.p8 and .p8.png) via Module.arguments and Module.readAsync,
|
|
901
|
+
* providing 100% native Lexaloffle PICO-8 compatibility for both binary PNG carts
|
|
902
|
+
* and plaintext .p8 carts without syntax errors or drop timing failures.
|
|
903
|
+
*/
|
|
904
|
+
export declare class Pico8Adapter extends BaseCoreBridge {
|
|
905
|
+
readonly id = "pico8";
|
|
906
|
+
readonly name = "PICO-8 (Official Lexaloffle)";
|
|
907
|
+
readonly system = "pico8";
|
|
908
|
+
readonly capabilities: CoreCapabilities;
|
|
909
|
+
private static readonly BUTTON_LEFT;
|
|
910
|
+
private static readonly BUTTON_RIGHT;
|
|
911
|
+
private static readonly BUTTON_UP;
|
|
912
|
+
private static readonly BUTTON_DOWN;
|
|
913
|
+
private static readonly BUTTON_O;
|
|
914
|
+
private static readonly BUTTON_X;
|
|
915
|
+
private static readonly BUTTON_MENU;
|
|
916
|
+
private static readonly RETROPAD_TO_PICO8;
|
|
917
|
+
private _scriptElement;
|
|
918
|
+
private _textareaElement;
|
|
919
|
+
private _createdBlobUrls;
|
|
920
|
+
private _currentCartName;
|
|
921
|
+
private _lastFrameNumber;
|
|
922
|
+
private _lastFpsCalcTime;
|
|
923
|
+
private _currentFps;
|
|
924
|
+
private _isReady;
|
|
925
|
+
get isReady(): boolean;
|
|
926
|
+
init(context: AdapterContext): Promise<void>;
|
|
927
|
+
loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
928
|
+
start(): void;
|
|
929
|
+
pause(): void;
|
|
930
|
+
resume(): void;
|
|
931
|
+
stop(): Promise<void>;
|
|
932
|
+
restart(): Promise<void>;
|
|
933
|
+
destroy(): Promise<void>;
|
|
934
|
+
rawSendButton(player: number, buttonId: number, pressed: boolean): void;
|
|
935
|
+
rawSendAxis(player: number, axisId: number, value: number): void;
|
|
936
|
+
rawGetFps(): number;
|
|
937
|
+
rawGetSram(): Promise<Uint8Array | Record<string, Uint8Array> | null>;
|
|
938
|
+
rawSetSram(data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
939
|
+
rawFlushSram(): Promise<void>;
|
|
940
|
+
getSramPath(): string;
|
|
941
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
942
|
+
private _getGlobalWindow;
|
|
943
|
+
private _ensureDOMTextarea;
|
|
944
|
+
private _ensureGlobalState;
|
|
945
|
+
private _ensureDirectoryExists;
|
|
946
|
+
private _isPngSignature;
|
|
947
|
+
private _getRomBytes;
|
|
948
|
+
private _bootPico8;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* PlayAdapter handles the Play! PS2 WebAssembly core.
|
|
953
|
+
* Features chunked DiscImageDevice streaming, multithreaded workers,
|
|
954
|
+
* dual analog sticks, and /work/mc0 memory card synchronization.
|
|
955
|
+
*/
|
|
956
|
+
export declare class PlayAdapter extends BaseCoreBridge {
|
|
957
|
+
readonly id = "play";
|
|
958
|
+
readonly name = "PlayStation 2 (Play!)";
|
|
959
|
+
readonly system = "ps2";
|
|
960
|
+
readonly capabilities: CoreCapabilities;
|
|
961
|
+
private _playModule;
|
|
962
|
+
private _romBlob;
|
|
963
|
+
private _mcMemory;
|
|
964
|
+
private readonly PS2_KEY_MAP;
|
|
965
|
+
getRomBlob(): Blob | null;
|
|
966
|
+
init(context: AdapterContext): Promise<void>;
|
|
967
|
+
loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
968
|
+
start(): void;
|
|
969
|
+
pause(): void;
|
|
970
|
+
resume(): void;
|
|
971
|
+
stop(): Promise<void>;
|
|
972
|
+
destroy(): Promise<void>;
|
|
973
|
+
rawGetSram(): Promise<Record<string, Uint8Array> | null>;
|
|
974
|
+
rawSetSram(data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
975
|
+
rawFlushSram(): Promise<void>;
|
|
976
|
+
getSramPath(): string;
|
|
977
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
978
|
+
rawSetOption(key: string, value: string): void;
|
|
979
|
+
rawSendButton(_player: number, buttonId: number, pressed: boolean): void;
|
|
980
|
+
rawSendAxis(_player: number, axisId: number, value: number): void;
|
|
981
|
+
private _simulateCanvasKey;
|
|
982
|
+
private _instantiatePlayRuntime;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Dedicated, isolated input channel for a single player (Player 1..N).
|
|
987
|
+
* Supports digital buttons, analog triggers, and dual analog sticks (-1.0 to 1.0).
|
|
988
|
+
*/
|
|
989
|
+
export declare class PlayerInputChannel {
|
|
990
|
+
readonly playerIndex: number;
|
|
991
|
+
private readonly _getAdapter;
|
|
992
|
+
private _assignedGamepadIndex;
|
|
993
|
+
private _keyBindings;
|
|
994
|
+
private _gamepadBindings;
|
|
995
|
+
private _buttonStates;
|
|
996
|
+
private _axisStates;
|
|
997
|
+
private _turboIntervals;
|
|
998
|
+
constructor(playerIndex: number, _getAdapter: () => ICoreAdapter | null);
|
|
999
|
+
get assignedGamepadIndex(): number | null;
|
|
1000
|
+
assignGamepad(gamepadIndex: number | null): void;
|
|
1001
|
+
/**
|
|
1002
|
+
* Sends button press or release state.
|
|
1003
|
+
*/
|
|
1004
|
+
sendButton(button: StandardButton, pressed: boolean): void;
|
|
1005
|
+
/**
|
|
1006
|
+
* Sends analog axis value (-1.0 to 1.0) for dual analog sticks.
|
|
1007
|
+
*/
|
|
1008
|
+
sendAxis(axis: StandardAxis, value: number): void;
|
|
1009
|
+
/**
|
|
1010
|
+
* Convenience helper to set both X and Y axes of an analog stick simultaneously
|
|
1011
|
+
* (e.g. from virtual on-screen joysticks, touch controls, or mouse drag).
|
|
1012
|
+
* @param stick 'LEFT' for Left Analog Stick, 'RIGHT' for Right Analog Stick
|
|
1013
|
+
* @param x Horizontal tilt from -1.0 (left) to 1.0 (right)
|
|
1014
|
+
* @param y Vertical tilt from -1.0 (up) to 1.0 (down)
|
|
1015
|
+
*/
|
|
1016
|
+
sendAnalogStick(stick: 'LEFT' | 'RIGHT', x: number, y: number): void;
|
|
1017
|
+
/**
|
|
1018
|
+
* Gets current button press state.
|
|
1019
|
+
*/
|
|
1020
|
+
isButtonPressed(button: StandardButton): boolean;
|
|
1021
|
+
/**
|
|
1022
|
+
* Gets current axis value (-1.0 to 1.0).
|
|
1023
|
+
*/
|
|
1024
|
+
getAxisValue(axis: StandardAxis): number;
|
|
1025
|
+
setKeyBinding(action: StandardButton, keyCode: string): void;
|
|
1026
|
+
setGamepadBinding(action: StandardButton, buttonIndex: number): void;
|
|
1027
|
+
resetBindings(): void;
|
|
1028
|
+
setTurbo(button: StandardButton, enabled: boolean, rateHz?: number): void;
|
|
1029
|
+
handleKeyEvent(keyCode: string, pressed: boolean): boolean;
|
|
1030
|
+
handleGamepadState(gamepad: Gamepad): void;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* RetroKit: Universal Headless WebAssembly Emulation Runtime Orchestrator
|
|
1035
|
+
*/
|
|
1036
|
+
export declare class RetroKit extends EventEmitter<EmuEventMap> {
|
|
1037
|
+
readonly state: IStateManager;
|
|
1038
|
+
readonly sram: ISramManager;
|
|
1039
|
+
readonly cheats: ICheatManager;
|
|
1040
|
+
readonly options: ICoreOptionsManager;
|
|
1041
|
+
readonly discs: IDiscManager;
|
|
1042
|
+
readonly input: IInputManager;
|
|
1043
|
+
readonly audio: IAudioManager;
|
|
1044
|
+
readonly video: IVideoManager;
|
|
1045
|
+
readonly timing: ITimingManager;
|
|
1046
|
+
readonly netplay: INetplayManager;
|
|
1047
|
+
readonly bios: IBiosManager;
|
|
1048
|
+
readonly achievements: IAchievementManager;
|
|
1049
|
+
private _adapter;
|
|
1050
|
+
private _config;
|
|
1051
|
+
private _audioCtx;
|
|
1052
|
+
private _activeRom;
|
|
1053
|
+
private _lastLoadOptions?;
|
|
1054
|
+
private _isRunning;
|
|
1055
|
+
private _isPaused;
|
|
1056
|
+
private _fpsTimer;
|
|
1057
|
+
constructor(config: RetroKitConfig);
|
|
1058
|
+
get capabilities(): CoreCapabilities;
|
|
1059
|
+
load(rom: ArrayBuffer | Blob | string | Uint8Array, options?: GameLoadOptions): Promise<void>;
|
|
1060
|
+
play(): Promise<void>;
|
|
1061
|
+
pause(): void;
|
|
1062
|
+
stop(): Promise<void>;
|
|
1063
|
+
/**
|
|
1064
|
+
* Updates the active target platform hint for subsequent game launches.
|
|
1065
|
+
*/
|
|
1066
|
+
setSystem(system: string | undefined): void;
|
|
1067
|
+
/**
|
|
1068
|
+
* Returns the configuration options supplied during the most recent load.
|
|
1069
|
+
*/
|
|
1070
|
+
get lastLoadOptions(): GameLoadOptions | undefined;
|
|
1071
|
+
/**
|
|
1072
|
+
* Returns the active ROM payload held in memory.
|
|
1073
|
+
*/
|
|
1074
|
+
get activeRom(): ArrayBuffer | Blob | string | Uint8Array | null;
|
|
1075
|
+
restart(): Promise<void>;
|
|
1076
|
+
destroy(): Promise<void>;
|
|
1077
|
+
private _startFpsMonitoring;
|
|
1078
|
+
dispose(): Promise<void>;
|
|
1079
|
+
switchCore(coreId: string): Promise<void>;
|
|
1080
|
+
getCoreMetadata(): CoreMetadata;
|
|
1081
|
+
isRunning(): boolean;
|
|
1082
|
+
isPaused(): boolean;
|
|
1083
|
+
private _resolveCore;
|
|
1084
|
+
/**
|
|
1085
|
+
* Replaces the canvas DOM element with a clean canvas surface to prevent
|
|
1086
|
+
* WebGL, WebGL2, or 2D context collisions when switching emulator cores.
|
|
1087
|
+
*/
|
|
1088
|
+
private _resetCanvas;
|
|
1089
|
+
private _createAdapter;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Initialization configuration for RetroKit.
|
|
1094
|
+
*/
|
|
1095
|
+
export declare interface RetroKitConfig {
|
|
1096
|
+
/** Target canvas element for rendering. */
|
|
1097
|
+
canvas: HTMLCanvasElement;
|
|
1098
|
+
/** Core ID or 'auto' to detect by ROM file extension. */
|
|
1099
|
+
core?: string;
|
|
1100
|
+
/** Target platform/system identifier (e.g. 'ps1', 'psx', 'ps2', 'snes', 'genesis'). */
|
|
1101
|
+
system?: string;
|
|
1102
|
+
/** Base URL for loading core WASM/JS binaries and data assets. */
|
|
1103
|
+
assetBaseUrl?: string;
|
|
1104
|
+
/** Custom AudioContext, or automatically creates one. */
|
|
1105
|
+
audioContext?: AudioContext;
|
|
1106
|
+
/** Cross-origin credentials or headers if needed. */
|
|
1107
|
+
fetchHeaders?: Record<string, string>;
|
|
1108
|
+
/** Enable debug logging. */
|
|
1109
|
+
debug?: boolean;
|
|
1110
|
+
/** RetroAchievements account credentials for native in-core and headless integration. */
|
|
1111
|
+
retroAchievements?: {
|
|
1112
|
+
username?: string;
|
|
1113
|
+
token?: string;
|
|
1114
|
+
hardcore?: boolean;
|
|
1115
|
+
apiEndpoint?: string;
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Universal ROM Patcher supporting standard formats: IPS, BPS, and UPS.
|
|
1121
|
+
*/
|
|
1122
|
+
export declare class RomPatcher {
|
|
1123
|
+
/**
|
|
1124
|
+
* Identifies patch format based on binary magic headers.
|
|
1125
|
+
*/
|
|
1126
|
+
static identifyFormat(patch: Uint8Array): PatchFormat;
|
|
1127
|
+
/**
|
|
1128
|
+
* Applies an IPS, BPS, or UPS patch to source ROM in-memory.
|
|
1129
|
+
*/
|
|
1130
|
+
static applyPatch(rom: Uint8Array, patch: Uint8Array, verifyChecksum?: boolean): PatchResult;
|
|
1131
|
+
private static applyIps;
|
|
1132
|
+
private static applyBps;
|
|
1133
|
+
private static applyUps;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* RuffleAdapter integrates the Ruffle WebAssembly engine to execute
|
|
1138
|
+
* Adobe Flash (.swf) games, movies, and animations without browser plugins.
|
|
1139
|
+
*/
|
|
1140
|
+
export declare class RuffleAdapter extends BaseCoreBridge {
|
|
1141
|
+
readonly id = "ruffle";
|
|
1142
|
+
readonly name = "Adobe Flash (Ruffle)";
|
|
1143
|
+
readonly system = "flash";
|
|
1144
|
+
readonly capabilities: CoreCapabilities;
|
|
1145
|
+
private _player;
|
|
1146
|
+
private _swfBuffer;
|
|
1147
|
+
init(context: AdapterContext): Promise<void>;
|
|
1148
|
+
loadGame(rom: ArrayBuffer | Blob | string | Uint8Array, _options?: GameLoadOptions): Promise<void>;
|
|
1149
|
+
start(): void;
|
|
1150
|
+
pause(): void;
|
|
1151
|
+
resume(): void;
|
|
1152
|
+
stop(): Promise<void>;
|
|
1153
|
+
destroy(): Promise<void>;
|
|
1154
|
+
rawGetSram(): Promise<Record<string, Uint8Array> | null>;
|
|
1155
|
+
rawSetSram(data: Uint8Array | Record<string, Uint8Array>): Promise<boolean>;
|
|
1156
|
+
rawGetOptions(): CoreOptionDefinition[];
|
|
1157
|
+
rawSetOption(key: string, value: string): void;
|
|
1158
|
+
rawSendButton(_player: number, buttonId: number, pressed: boolean): void;
|
|
1159
|
+
private _instantiateRuffle;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Save state metadata record.
|
|
1164
|
+
*/
|
|
1165
|
+
export declare interface SaveStateMetadata {
|
|
1166
|
+
slot: number;
|
|
1167
|
+
timestamp: number;
|
|
1168
|
+
gameId: string;
|
|
1169
|
+
coreId: string;
|
|
1170
|
+
screenshot?: Blob | string;
|
|
1171
|
+
sizeBytes: number;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
export declare interface SaveStateRecord {
|
|
1175
|
+
data: Uint8Array;
|
|
1176
|
+
metadata: SaveStateMetadata;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
export declare class SramManager implements ISramManager {
|
|
1180
|
+
private readonly _getAdapter;
|
|
1181
|
+
private _isDirty;
|
|
1182
|
+
private _lastData;
|
|
1183
|
+
private _modifiedListeners;
|
|
1184
|
+
private _pollTimer;
|
|
1185
|
+
constructor(_getAdapter: () => ICoreAdapter | null);
|
|
1186
|
+
getSram(): Promise<Uint8Array | Record<string, Uint8Array> | null>;
|
|
1187
|
+
setSram(data: Uint8Array | Record<string, Uint8Array>, options?: {
|
|
1188
|
+
restart?: boolean;
|
|
1189
|
+
}): Promise<boolean>;
|
|
1190
|
+
flushSram(): Promise<void>;
|
|
1191
|
+
isDirty(): boolean;
|
|
1192
|
+
onSramModified(callback: (data: Uint8Array | Record<string, Uint8Array>) => void): () => void;
|
|
1193
|
+
getSaveFilePath(): string;
|
|
1194
|
+
destroy(): void;
|
|
1195
|
+
private _startDirtyWatchdog;
|
|
1196
|
+
private _hasChanged;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Standard analog stick axes.
|
|
1201
|
+
*/
|
|
1202
|
+
export declare type StandardAxis = 'L_STICK_X' | 'L_STICK_Y' | 'R_STICK_X' | 'R_STICK_Y';
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Standard button definitions matching a standard controller.
|
|
1206
|
+
*/
|
|
1207
|
+
export declare type StandardButton = 'DPAD_UP' | 'DPAD_DOWN' | 'DPAD_LEFT' | 'DPAD_RIGHT' | 'ACTION_DOWN' | 'ACTION_RIGHT' | 'ACTION_LEFT' | 'ACTION_UP' | 'START' | 'SELECT' | 'HOME' | 'L1' | 'R1' | 'L2' | 'R2' | 'L3' | 'R3' | 'HOTKEY_FAST_FORWARD' | 'HOTKEY_REWIND' | 'HOTKEY_SAVE' | 'HOTKEY_LOAD';
|
|
1208
|
+
|
|
1209
|
+
export declare type StandardHotkey = 'FAST_FORWARD' | 'SLOW_MOTION' | 'REWIND' | 'QUICK_SAVE' | 'QUICK_LOAD' | 'PAUSE' | 'RESTART' | 'FULLSCREEN' | 'SCREENSHOT';
|
|
1210
|
+
|
|
1211
|
+
export declare class StateManager implements IStateManager {
|
|
1212
|
+
private readonly _getAdapter;
|
|
1213
|
+
private readonly _getScreenshot;
|
|
1214
|
+
private _stateCache;
|
|
1215
|
+
private _activeGameId;
|
|
1216
|
+
constructor(_getAdapter: () => ICoreAdapter | null, _getScreenshot: () => Promise<Blob | null>);
|
|
1217
|
+
setGameId(gameId: string): void;
|
|
1218
|
+
saveState(slot?: number): Promise<SaveStateRecord | null>;
|
|
1219
|
+
loadState(source: number | Uint8Array): Promise<boolean>;
|
|
1220
|
+
getStateBuffer(): Promise<Uint8Array | null>;
|
|
1221
|
+
listStates(): Promise<SaveStateMetadata[]>;
|
|
1222
|
+
hasState(slot: number): Promise<boolean>;
|
|
1223
|
+
deleteState(slot: number): Promise<void>;
|
|
1224
|
+
autoSave(): Promise<SaveStateRecord | null>;
|
|
1225
|
+
autoLoad(): Promise<boolean>;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
export declare class TimingManager implements ITimingManager {
|
|
1229
|
+
private readonly _getAdapter;
|
|
1230
|
+
private _speedRatio;
|
|
1231
|
+
private _isFastForward;
|
|
1232
|
+
private _isSlowMotion;
|
|
1233
|
+
constructor(_getAdapter: () => ICoreAdapter | null);
|
|
1234
|
+
get isFastForward(): boolean;
|
|
1235
|
+
get isSlowMotion(): boolean;
|
|
1236
|
+
get speedRatio(): number;
|
|
1237
|
+
setFastForward(active: boolean, rate?: number): void;
|
|
1238
|
+
setSlowMotion(active: boolean, rate?: number): void;
|
|
1239
|
+
setSpeed(ratio: number): void;
|
|
1240
|
+
stepFrame(): void;
|
|
1241
|
+
isRewindSupported(): boolean;
|
|
1242
|
+
startRewind(): void;
|
|
1243
|
+
stopRewind(): void;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
export declare class VideoManager implements IVideoManager {
|
|
1247
|
+
private readonly _getAdapter;
|
|
1248
|
+
private readonly _getCanvas;
|
|
1249
|
+
private _aspectRatio;
|
|
1250
|
+
private _rotation;
|
|
1251
|
+
private _currentShader;
|
|
1252
|
+
private _resizeObserver;
|
|
1253
|
+
constructor(_getAdapter: () => ICoreAdapter | null, _getCanvas: () => HTMLCanvasElement | null);
|
|
1254
|
+
get aspectRatio(): string;
|
|
1255
|
+
get rotation(): number;
|
|
1256
|
+
get currentShader(): string;
|
|
1257
|
+
setShader(shader: string): Promise<void>;
|
|
1258
|
+
setAspectRatio(mode: 'auto' | '4:3' | '16:9' | 'stretch' | 'pixel-perfect'): void;
|
|
1259
|
+
updateLayout(): void;
|
|
1260
|
+
setRotation(degrees: 0 | 90 | 180 | 270): void;
|
|
1261
|
+
setVsync(_enabled: boolean): void;
|
|
1262
|
+
takeScreenshot(format?: 'image/png' | 'image/jpeg' | 'image/webp', quality?: number): Promise<Blob>;
|
|
1263
|
+
getMetrics(): {
|
|
1264
|
+
internalWidth: number;
|
|
1265
|
+
internalHeight: number;
|
|
1266
|
+
fps: number;
|
|
1267
|
+
};
|
|
1268
|
+
clear(): void;
|
|
1269
|
+
destroy(): void;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
export { }
|