API Reference
Complete props reference for the GamePlayer component.
Core Configuration
| Prop | Type | Required | Description |
|---|---|---|---|
| romId | string | Yes | Unique identifier for this ROM (used for saving) |
| romUrl | string | Yes | URL to the ROM file |
| system | string | Yes | Console key (NES, SNES, GBA, PS1, etc.) |
| title | string | Yes | Display name for the game |
| romFileName | string | No | Original filename (important for Arcade/MAME) |
| core | string | No | Override automatic core selection (e.g., 'gpsp' vs 'mgba') |
| biosUrl | string | object | No | BIOS URL or config with location option |
| shader | string | No | Initial shader (e.g., 'crt/crt-lottes') |
| systemColor | string | No | Hex color for UI accents (e.g., '#FF3333') |
Save System
| Prop | Type | Description |
|---|---|---|
| onSaveState | (slot: number, blob: Blob, screenshot?: string) => Promise | Save state to your backend |
| onLoadState | (slot: number) => Promise<Blob | null> | Load state from your backend |
| onAutoSave | (blob: Blob, screenshot?: string) => Promise | Periodic auto-save callback |
| onGetSaveSlots | () => Promise<SaveSlot[]> | Fetch available save slots |
| onDeleteSaveState | (slot: number) => Promise | Delete a save slot |
| autoSaveInterval | number | Auto-save interval in ms (default: 60000) |
| initialSaveState | Blob | Pre-load a save state on boot |
| maxSlots | number | Limit available slots (for tiered access) |
| currentTier | string | User tier label (shown in upgrade prompt) |
| onUpgrade | () => void | Called when user clicks upgrade button |
Lifecycle Events
| Prop | Type | Description |
|---|---|---|
| onReady | () => void | Emulator core fully loaded |
| onError | (error: Error) => void | Fatal error (WASM crash, etc.) |
| onExit | () => void | User clicked Exit button |
| onSessionStart | () => void | Game loop started |
| onSessionEnd | () => void | Game session ended |
| onScreenshotCaptured | (image: string | Blob) => void | Screenshot taken by user |
| onShaderChange | (shader: string, requiresRestart: boolean) => void | User changed shader preset |
RetroAchievements
| Prop | Type | Description |
|---|---|---|
| retroAchievementsConfig | { username, token, hardcore? } | Enable RA integration |
| raUser | RACredentials | null | Logged-in user data |
| raGame | RAGameExtended | null | Current game RA data |
| raAchievements | RAAchievement[] | Achievement list |
| raUnlockedAchievements | Set<number> | IDs of unlocked achievements |
| raIsLoading | boolean | RA data loading state |
| raError | string | null | RA error message |
| onRALogin | (user, pass) => Promise<boolean> | Login handler |
| onRALogout | () => void | Logout handler |
| onRAHardcoreChange | (enabled: boolean) => void | Hardcore toggle handler |
Cheats
| Prop | Type | Description |
|---|---|---|
| cheats | Cheat[] | Available cheats: { id, code, description } |
| onToggleCheat | (id: number, active: boolean) => void | Called when user toggles a cheat |
BIOS Selection
| Prop | Type | Description |
|---|---|---|
| availableBios | { id, name, description? }[] | List of available BIOS options |
| currentBiosId | string | Currently selected BIOS ID |
| onSelectBios | (biosId: string) => void | BIOS selection handler |
Styling
| Prop | Type | Description |
|---|---|---|
| className | string | Additional CSS classes for container |
| style | React.CSSProperties | Inline styles for container |
Internationalization
| Prop | Type | Description |
|---|---|---|
| initialLanguage | 'en' | 'es' | 'fr' | Initial language (default: 'en') |
| translations | RecursivePartial<KoinTranslations> | Partial translation overrides for custom text |
Exported i18n Utilities
en, es, fr — Built-in translation objects
KoinTranslations — TypeScript interface for translations
useKoinTranslation() — React hook to access translations
KoinI18nProvider — Context provider for custom components