mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-10 04:19:25 -07:00
- Add Chrome Gamepad API input mapping for keyboard-only overlay flow - Add controller select/debug modals with preferred controller persistence - Add controller config schema/defaults/docs and fix stale token highlight cleanup
336 lines
12 KiB
TypeScript
336 lines
12 KiB
TypeScript
import { ResolvedConfig } from '../../types';
|
|
import { ConfigOptionRegistryEntry } from './shared';
|
|
|
|
export function buildCoreConfigOptionRegistry(
|
|
defaultConfig: ResolvedConfig,
|
|
): ConfigOptionRegistryEntry[] {
|
|
const controllerButtonEnumValues = [
|
|
'none',
|
|
'select',
|
|
'buttonSouth',
|
|
'buttonEast',
|
|
'buttonNorth',
|
|
'buttonWest',
|
|
'leftShoulder',
|
|
'rightShoulder',
|
|
'leftStickPress',
|
|
'rightStickPress',
|
|
'leftTrigger',
|
|
'rightTrigger',
|
|
];
|
|
|
|
return [
|
|
{
|
|
path: 'logging.level',
|
|
kind: 'enum',
|
|
enumValues: ['debug', 'info', 'warn', 'error'],
|
|
defaultValue: defaultConfig.logging.level,
|
|
description: 'Minimum log level for runtime logging.',
|
|
},
|
|
{
|
|
path: 'controller.enabled',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.controller.enabled,
|
|
description: 'Enable overlay controller support through the Chrome Gamepad API.',
|
|
},
|
|
{
|
|
path: 'controller.preferredGamepadId',
|
|
kind: 'string',
|
|
defaultValue: defaultConfig.controller.preferredGamepadId,
|
|
description: 'Preferred controller id saved from the controller selection modal.',
|
|
},
|
|
{
|
|
path: 'controller.preferredGamepadLabel',
|
|
kind: 'string',
|
|
defaultValue: defaultConfig.controller.preferredGamepadLabel,
|
|
description: 'Preferred controller display label saved for diagnostics.',
|
|
},
|
|
{
|
|
path: 'controller.smoothScroll',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.controller.smoothScroll,
|
|
description: 'Use smooth scrolling for controller-driven popup scroll input.',
|
|
},
|
|
{
|
|
path: 'controller.scrollPixelsPerSecond',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.scrollPixelsPerSecond,
|
|
description: 'Base popup scroll speed for controller stick input.',
|
|
},
|
|
{
|
|
path: 'controller.horizontalJumpPixels',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.horizontalJumpPixels,
|
|
description: 'Popup page-jump distance for controller jump input.',
|
|
},
|
|
{
|
|
path: 'controller.stickDeadzone',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.stickDeadzone,
|
|
description: 'Deadzone applied to controller stick axes.',
|
|
},
|
|
{
|
|
path: 'controller.triggerInputMode',
|
|
kind: 'enum',
|
|
enumValues: ['auto', 'digital', 'analog'],
|
|
defaultValue: defaultConfig.controller.triggerInputMode,
|
|
description: 'How controller triggers are interpreted: auto, pressed-only, or thresholded analog.',
|
|
},
|
|
{
|
|
path: 'controller.triggerDeadzone',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.triggerDeadzone,
|
|
description: 'Minimum analog trigger value required when trigger input uses auto or analog mode.',
|
|
},
|
|
{
|
|
path: 'controller.repeatDelayMs',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.repeatDelayMs,
|
|
description: 'Delay before repeating held controller actions.',
|
|
},
|
|
{
|
|
path: 'controller.repeatIntervalMs',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.repeatIntervalMs,
|
|
description: 'Repeat interval for held controller actions.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.select',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.select,
|
|
description: 'Raw button index used for the controller select/minus/back button.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.buttonSouth',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.buttonSouth,
|
|
description: 'Raw button index used for controller south/A button input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.buttonEast',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.buttonEast,
|
|
description: 'Raw button index used for controller east/B button input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.buttonNorth',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.buttonNorth,
|
|
description: 'Raw button index used for controller north/Y button input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.buttonWest',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.buttonWest,
|
|
description: 'Raw button index used for controller west/X button input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.leftShoulder',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.leftShoulder,
|
|
description: 'Raw button index used for controller left shoulder input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.rightShoulder',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.rightShoulder,
|
|
description: 'Raw button index used for controller right shoulder input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.leftStickPress',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.leftStickPress,
|
|
description: 'Raw button index used for controller L3 input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.rightStickPress',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.rightStickPress,
|
|
description: 'Raw button index used for controller R3 input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.leftTrigger',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.leftTrigger,
|
|
description: 'Raw button index used for controller L2 input.',
|
|
},
|
|
{
|
|
path: 'controller.buttonIndices.rightTrigger',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.controller.buttonIndices.rightTrigger,
|
|
description: 'Raw button index used for controller R2 input.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.toggleLookup',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.toggleLookup,
|
|
description: 'Controller binding for toggling lookup.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.closeLookup',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.closeLookup,
|
|
description: 'Controller binding for closing lookup.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.toggleKeyboardOnlyMode',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.toggleKeyboardOnlyMode,
|
|
description: 'Controller binding for toggling keyboard-only mode.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.mineCard',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.mineCard,
|
|
description: 'Controller binding for mining the active card.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.quitMpv',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.quitMpv,
|
|
description: 'Controller binding for quitting mpv.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.previousAudio',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.previousAudio,
|
|
description: 'Controller binding for previous Yomitan audio.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.nextAudio',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.nextAudio,
|
|
description: 'Controller binding for next Yomitan audio.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.playCurrentAudio',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.playCurrentAudio,
|
|
description: 'Controller binding for playing the current Yomitan audio.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.toggleMpvPause',
|
|
kind: 'enum',
|
|
enumValues: controllerButtonEnumValues,
|
|
defaultValue: defaultConfig.controller.bindings.toggleMpvPause,
|
|
description: 'Controller binding for toggling mpv play/pause.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.leftStickHorizontal',
|
|
kind: 'enum',
|
|
enumValues: ['leftStickX', 'leftStickY', 'rightStickX', 'rightStickY'],
|
|
defaultValue: defaultConfig.controller.bindings.leftStickHorizontal,
|
|
description: 'Axis binding used for left/right token selection.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.leftStickVertical',
|
|
kind: 'enum',
|
|
enumValues: ['leftStickX', 'leftStickY', 'rightStickX', 'rightStickY'],
|
|
defaultValue: defaultConfig.controller.bindings.leftStickVertical,
|
|
description: 'Axis binding used for primary popup scrolling.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.rightStickHorizontal',
|
|
kind: 'enum',
|
|
enumValues: ['leftStickX', 'leftStickY', 'rightStickX', 'rightStickY'],
|
|
defaultValue: defaultConfig.controller.bindings.rightStickHorizontal,
|
|
description: 'Axis binding reserved for alternate right-stick mappings.',
|
|
},
|
|
{
|
|
path: 'controller.bindings.rightStickVertical',
|
|
kind: 'enum',
|
|
enumValues: ['leftStickX', 'leftStickY', 'rightStickX', 'rightStickY'],
|
|
defaultValue: defaultConfig.controller.bindings.rightStickVertical,
|
|
description: 'Axis binding used for popup page jumps.',
|
|
},
|
|
{
|
|
path: 'texthooker.launchAtStartup',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.texthooker.launchAtStartup,
|
|
description: 'Launch texthooker server automatically when SubMiner starts.',
|
|
},
|
|
{
|
|
path: 'websocket.enabled',
|
|
kind: 'enum',
|
|
enumValues: ['auto', 'true', 'false'],
|
|
defaultValue: defaultConfig.websocket.enabled,
|
|
description: 'Built-in subtitle websocket server mode.',
|
|
},
|
|
{
|
|
path: 'websocket.port',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.websocket.port,
|
|
description: 'Built-in subtitle websocket server port.',
|
|
},
|
|
{
|
|
path: 'annotationWebsocket.enabled',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.annotationWebsocket.enabled,
|
|
description: 'Annotated subtitle websocket server enabled state.',
|
|
},
|
|
{
|
|
path: 'annotationWebsocket.port',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.annotationWebsocket.port,
|
|
description: 'Annotated subtitle websocket server port.',
|
|
},
|
|
{
|
|
path: 'subsync.defaultMode',
|
|
kind: 'enum',
|
|
enumValues: ['auto', 'manual'],
|
|
defaultValue: defaultConfig.subsync.defaultMode,
|
|
description: 'Subsync default mode.',
|
|
},
|
|
{
|
|
path: 'subsync.replace',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.subsync.replace,
|
|
description: 'Replace the active subtitle file when sync completes.',
|
|
},
|
|
{
|
|
path: 'startupWarmups.lowPowerMode',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.startupWarmups.lowPowerMode,
|
|
description: 'Defer startup warmups except Yomitan extension.',
|
|
},
|
|
{
|
|
path: 'startupWarmups.mecab',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.startupWarmups.mecab,
|
|
description: 'Warm up MeCab tokenizer at startup.',
|
|
},
|
|
{
|
|
path: 'startupWarmups.yomitanExtension',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.startupWarmups.yomitanExtension,
|
|
description: 'Warm up Yomitan extension at startup.',
|
|
},
|
|
{
|
|
path: 'startupWarmups.subtitleDictionaries',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.startupWarmups.subtitleDictionaries,
|
|
description: 'Warm up subtitle dictionaries at startup.',
|
|
},
|
|
{
|
|
path: 'startupWarmups.jellyfinRemoteSession',
|
|
kind: 'boolean',
|
|
defaultValue: defaultConfig.startupWarmups.jellyfinRemoteSession,
|
|
description: 'Warm up Jellyfin remote session at startup.',
|
|
},
|
|
{
|
|
path: 'shortcuts.multiCopyTimeoutMs',
|
|
kind: 'number',
|
|
defaultValue: defaultConfig.shortcuts.multiCopyTimeoutMs,
|
|
description: 'Timeout for multi-copy/mine modes.',
|
|
},
|
|
];
|
|
}
|