Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(desktop): 支持 Xbox 与 PlayStation 手柄配件 (#3603)

Dash0d5dbc35fb44
diff --git a/apps/desktop/native/xbox-gamepad/macos-xbox-gamepad-helper.swift b/apps/desktop/native/xbox-gamepad/macos-xbox-gamepad-helper.swift
index 4eb0df62bf..0388a540a3 100644
--- a/apps/desktop/native/xbox-gamepad/macos-xbox-gamepad-helper.swift
+++ b/apps/desktop/native/xbox-gamepad/macos-xbox-gamepad-helper.swift
@@ -24,15 +24,40 @@ func emit(_ payload: [String: Any]) {
fflush(stdout)
}
-func isXboxController(_ controller: GCController) -> Bool {
- if controller.extendedGamepad is GCXboxGamepad { return true }
+func isSupportedGamepad(_ controller: GCController) -> Bool {
+ controller.extendedGamepad != nil
+}
+
+func resolveGamepadFamily(from controller: GCController) -> String {
+ if controller.extendedGamepad is GCXboxGamepad { return "xbox" }
+ if controller.extendedGamepad is GCDualShockGamepad { return "playstation" }
let vendor = controller.vendorName?.lowercased() ?? ""
let category = controller.productCategory.lowercased()
let haystack = vendor + " " + category
+ if haystack.contains("dualsense")
+ || haystack.contains("dualshock")
+ || haystack.contains("playstation")
+ || haystack.contains("sony")
+ || haystack.range(of: #"\bps[45]\b"#, options: .regularExpression) != nil
+ {
+ return "playstation"
+ }
+ if haystack.contains("nintendo")
+ || haystack.contains("switch")
+ || haystack.contains("joy-con")
+ || haystack.contains("joycon")
+ {
+ return "nintendo"
+ }
// Wired Xbox pads often advertise USB product "Controller" and vendor Microsoft.
- return haystack.contains("xbox")
+ if haystack.contains("xbox")
+ || haystack.contains("elite")
|| haystack.contains("microsoft")
|| vendor == "controller"
+ {
+ return "xbox"
+ }
+ return "generic"
}
func homePressed(_ controller: GCController) -> Bool {
@@ -54,7 +79,12 @@ func controllerTransport(for controller: GCController) -> String {
if controllerTokens.isEmpty { return "unknown" }
let manager = IOHIDManagerCreate(kCFAllocatorDefault, IOOptionBits(kIOHIDOptionsTypeNone))
- IOHIDManagerSetDeviceMatching(manager, [kIOHIDVendorIDKey as String: 0x45e] as CFDictionary)
+ let matching = [
+ [kIOHIDVendorIDKey as String: 0x045E],
+ [kIOHIDVendorIDKey as String: 0x054C],
+ [kIOHIDVendorIDKey as String: 0x057E],
+ ] as CFArray
+ IOHIDManagerSetDeviceMatchingMultiple(manager, matching)
IOHIDManagerOpen(manager, IOOptionBits(kIOHIDOptionsTypeNone))
defer { IOHIDManagerClose(manager, IOOptionBits(kIOHIDOptionsTypeNone)) }
guard let devices = IOHIDManagerCopyDevices(manager) as? Set<IOHIDDevice> else { return "unknown" }
@@ -84,7 +114,10 @@ func transportMatchTokens(_ values: String?...) -> Set<String> {
}
}
// Generic Microsoft HID tokens would match keyboards, mice, and dongles.
- tokens.subtract(["usb", "hid", "device", "microsoft", "controller"])
+ tokens.subtract([
+ "usb", "hid", "device", "microsoft", "sony", "nintendo", "controller",
+ "interactive", "entertainment",
+ ])
return tokens
}
@@ -102,6 +135,7 @@ func presencePayload(from controller: GCController) -> [String: Any] {
"present": true,
"name": controller.vendorName ?? controller.productCategory,
"category": controller.productCategory,
+ "family": resolveGamepadFamily(from: controller),
"transport": controllerTransport(for: controller),
"batteryState": "unknown",
]
@@ -115,11 +149,13 @@ func presencePayload(from controller: GCController) -> [String: Any] {
return payload
}
+let GAMEPAD_FAMILIES = ["xbox", "playstation", "nintendo", "generic"]
+
final class XboxGamepadReporter {
- private var observed: GCController?
+ private var observed: [String: GCController] = [:]
/// nil until the first refresh, so an empty device list still gets logged once.
private var lastSeenSummary: String?
- private var lastPresenceSignature = ""
+ private var lastPresenceSignature: [String: String] = [:]
func start() {
if #available(macOS 11.3, *) {
@@ -148,8 +184,8 @@ final class XboxGamepadReporter {
.map { controller in
let vendor = controller.vendorName ?? "?"
let category = controller.productCategory
- let xboxPad = controller.extendedGamepad is GCXboxGamepad
- return "\(vendor)/\(category)/xboxPad=\(xboxPad)"
+ let family = resolveGamepadFamily(from: controller)
+ return "\(vendor)/\(category)/family=\(family)"
}
.joined(separator: "; ")
if summary != lastSeenSummary {
@@ -160,37 +196,49 @@ final class XboxGamepadReporter {
"message": summary.isEmpty ? "no GameController devices" : "controllers: \(summary)",
])
}
- let next = all.first(where: isXboxController)
- if next == nil {
- observed = nil
- lastPresenceSignature = ""
- emit(["kind": "presence", "present": false])
- return
+
+ var next: [String: GCController] = [:]
+ for controller in all where isSupportedGamepad(controller) {
+ let family = resolveGamepadFamily(from: controller)
+ if next[family] == nil { next[family] = controller }
}
- if observed !== next {
- observed = next
- attach(next!)
+
+ for family in GAMEPAD_FAMILIES {
+ guard let controller = next[family] else {
+ if observed[family] != nil || lastPresenceSignature[family] != "absent" {
+ observed[family] = nil
+ lastPresenceSignature[family] = "absent"
+ emit(["kind": "presence", "present": false, "family": family])
+ }
+ continue
+ }
+ if observed[family] !== controller {
+ observed[family] = controller
+ attach(controller)
+ }
+ emitPresence(from: controller, family: family)
+ emitFrame(from: controller, family: family)
}
- emitPresence(from: next!)
- emitFrame(from: next!)
}
private func attach(_ controller: GCController) {
guard let pad = controller.extendedGamepad else { return }
pad.valueChangedHandler = { [weak self] _, _ in
- self?.emitFrame(from: controller)
+ let family = resolveGamepadFamily(from: controller)
+ self?.emitFrame(from: controller, family: family)
}
}
- private func emitPresence(from controller: GCController) {
- let payload = presencePayload(from: controller)
+ private func emitPresence(from controller: GCController, family: String) {
+ var payload = presencePayload(from: controller)
+ payload["family"] = family
let signature = String(describing: payload)
- if signature == lastPresenceSignature { return }
- lastPresenceSignature = signature
+ if signature == lastPresenceSignature[family] { return }
+ lastPresenceSignature[family] = signature
emit(payload)
}
- private func emitFrame(from controller: GCController) {
+ private func emitFrame(from controller: GCController, family: String) {
guard let pad = controller.extendedGamepad else { return }
let buttons: [String: Any] = [
"a": pad.buttonA.isPressed,
@@ -219,6 +267,7 @@ final class XboxGamepadReporter {
]
emit([
"kind": "frame",
+ "family": family,
"buttons": buttons,
"axes": axes,
"ltAnalog": Double(pad.leftTrigger.value),
diff --git a/apps/desktop/src/main/xbox-gamepad/__tests__/controller.test.ts b/apps/desktop/src/main/xbox-gamepad/__tests__/controller.test.ts
index 73f4ac862b..3374a85487 100644
--- a/apps/desktop/src/main/xbox-gamepad/__tests__/controller.test.ts
+++ b/apps/desktop/src/main/xbox-gamepad/__tests__/controller.test.ts
@@ -33,7 +33,7 @@ describe('XboxGamepadController', () => {
expect(dispatch).not.toHaveBeenCalled();
expect(preview).not.toHaveBeenCalled();
- controller.applySettings(enabledSettings());
+ controller.applySettings('xbox', enabledSettings());
controller.handleHostMessage({
kind: 'frame',
buttons: { ...XBOX_GAMEPAD_EMPTY_FRAME.buttons, a: true },
@@ -64,7 +64,7 @@ describe('XboxGamepadController', () => {
isCindyFrontmost: () => true,
dispatch,
});
- controller.applySettings(enabledSettings());
+ controller.applySettings('xbox', enabledSettings());
controller.handleHostMessage({
kind: 'frame',
buttons: XBOX_GAMEPAD_EMPTY_FRAME.buttons,
@@ -89,15 +89,14 @@ describe('XboxGamepadController', () => {
isCindyFrontmost: () => true,
dispatch: vi.fn(),
});
- controller.applySettings(enabledSettings());
+ controller.applySettings('xbox', enabledSettings());
controller.handleHostMessage({ kind: 'host-error', message: 'swiftc failed' });
- expect(controller.getState().connectionStatus).toBe('error');
- expect(controller.getState().devicePresent).toBe(false);
+ expect(controller.getState('xbox').connectionStatus).toBe('error');
+ expect(controller.getState('xbox').devicePresent).toBe(false);
- // A later presence report means the helper recovered.
controller.handleHostMessage({ kind: 'presence', present: true, name: 'Xbox' });
- expect(controller.getState().connectionStatus).toBe('connected');
+ expect(controller.getState('xbox').connectionStatus).toBe('connected');
});
it('surfaces transport and battery from the helper presence report', () => {
@@ -114,17 +113,63 @@ describe('XboxGamepadController', () => {
batteryPercentage: 64,
batteryState: 'discharging',
});
- expect(controller.getState().device).toEqual({
+ expect(controller.getState('xbox').device).toEqual({
name: 'Xbox Wireless Controller',
category: 'Xbox One',
+ family: 'xbox',
transport: 'bluetooth',
batteryPercentage: 64,
batteryState: 'discharging',
});
controller.handleHostMessage({ kind: 'presence', present: false });
- expect(controller.getState().device.transport).toBe('unknown');
- expect(controller.getState().device.batteryPercentage).toBeNull();
+ expect(controller.getState('xbox').device.transport).toBe('unknown');
+ expect(controller.getState('xbox').device.batteryPercentage).toBeNull();
+ expect(controller.getState('xbox').device.family).toBe('xbox');
});
+
+ it('keeps DualSense and Switch on their own accessories', () => {
+ const controller = new XboxGamepadController({
+ isCindyFrontmost: () => true,
+ dispatch: vi.fn(),
+ });
+ controller.handleHostMessage({
+ kind: 'presence',
+ present: true,
+ name: 'DualSense Wireless Controller',
+ category: 'DualSense',
+ family: 'playstation',
+ });
+ expect(controller.getState('playstation').devicePresent).toBe(true);
+ expect(controller.getState('xbox').devicePresent).toBeNull();
+
+ controller.handleHostMessage({
+ kind: 'presence',
+ present: true,
+ name: 'Pro Controller',
+ category: 'Nintendo Switch',
+ });
+ expect(controller.getState('nintendo').devicePresent).toBe(true);
+ expect(controller.getState('playstation').devicePresent).toBe(true);
+ expect(controller.getState('xbox').devicePresent).toBeNull();
+ expect(controller.getState('generic').devicePresent).toBeNull();
+ });
+
+ it('keeps unrecognized pads on the generic accessory', () => {
+ const controller = new XboxGamepadController({
+ isCindyFrontmost: () => true,
+ dispatch: vi.fn(),
+ });
+ controller.handleHostMessage({
+ kind: 'presence',
+ present: true,
+ name: '8BitDo Pro 2',
+ category: 'Extended Gamepad',
+ });
+ expect(controller.getState('generic').devicePresent).toBe(true);
+ expect(controller.getState('generic').device.family).toBe('generic');
+ expect(controller.getState('xbox').devicePresent).toBeNull();
+ });
+
it('previews input without dispatching while the layout editor is open', () => {
const dispatch = vi.fn();
const preview = vi.fn();
@@ -133,14 +178,14 @@ describe('XboxGamepadController', () => {
dispatch,
preview,
});
- controller.applySettings(enabledSettings());
+ controller.applySettings('xbox', enabledSettings());
controller.handleHostMessage({
kind: 'frame',
buttons: XBOX_GAMEPAD_EMPTY_FRAME.buttons,
axes: XBOX_GAMEPAD_EMPTY_FRAME.axes,
triggers: XBOX_GAMEPAD_EMPTY_FRAME.triggers,
});
- controller.setLayoutPreviewActive(true);
+ controller.setLayoutPreviewActive(true, 'xbox');
dispatch.mockClear();
preview.mockClear();
@@ -152,7 +197,7 @@ describe('XboxGamepadController', () => {
});
expect(dispatch).not.toHaveBeenCalled();
expect(preview).toHaveBeenCalledWith(
- expect.objectContaining({ buttons: expect.objectContaining({ a: true }) }),
+ expect.objectContaining({ family: 'xbox', buttons: expect.objectContaining({ a: true }) }),
);
});
@@ -163,7 +208,7 @@ describe('XboxGamepadController', () => {
dispatch: vi.fn(),
preview,
});
- controller.applySettings(enabledSettings());
+ controller.applySettings('xbox', enabledSettings());
controller.handleHostMessage({
kind: 'frame',
buttons: { ...XBOX_GAMEPAD_EMPTY_FRAME.buttons, a: true },
@@ -172,4 +217,86 @@ describe('XboxGamepadController', () => {
});
expect(preview).not.toHaveBeenCalled();
});
+
+ it('releases every family hold when layout preview starts', () => {
+ const dispatch = vi.fn();
+ const controller = new XboxGamepadController({
+ isCindyFrontmost: () => true,
+ dispatch,
+ });
+ controller.applySettings('xbox', enabledSettings());
+ controller.applySettings('playstation', enabledSettings());
+ for (const family of ['xbox', 'playstation'] as const) {
+ controller.handleHostMessage({
+ kind: 'frame',
+ family,
+ buttons: XBOX_GAMEPAD_EMPTY_FRAME.buttons,
+ axes: XBOX_GAMEPAD_EMPTY_FRAME.axes,
+ triggers: XBOX_GAMEPAD_EMPTY_FRAME.triggers,
+ });
+ controller.handleHostMessage({
+ kind: 'frame',
+ family,
+ buttons: { ...XBOX_GAMEPAD_EMPTY_FRAME.buttons, lt: true },
+ axes: { lx: 0, ly: 0, rx: 0, ry: 1 },
+ triggers: { lt: 1, rt: 0 },
+ });
+ }
+ dispatch.mockClear();
+
+ controller.setLayoutPreviewActive(true, 'xbox');
+ expect(dispatch).toHaveBeenCalledWith({ type: 'voice', phase: 'release' });
+ expect(dispatch).toHaveBeenCalledWith({ type: 'scroll-stop' });
+ });
+
+ it('keeps the other pad voice and scroll when one family releases', () => {
+ const dispatch = vi.fn();
+ const controller = new XboxGamepadController({
+ isCindyFrontmost: () => true,
+ dispatch,
+ });
+ controller.applySettings('xbox', enabledSettings());
+ controller.applySettings('playstation', enabledSettings());
+ for (const family of ['xbox', 'playstation'] as const) {
+ controller.handleHostMessage({
+ kind: 'frame',
+ family,
+ buttons: XBOX_GAMEPAD_EMPTY_FRAME.buttons,
+ axes: XBOX_GAMEPAD_EMPTY_FRAME.axes,
+ triggers: XBOX_GAMEPAD_EMPTY_FRAME.triggers,
+ });
+ controller.handleHostMessage({
+ kind: 'frame',
+ family,
+ buttons: { ...XBOX_GAMEPAD_EMPTY_FRAME.buttons, lt: true },
+ axes: { lx: 0, ly: 0, rx: 0, ry: 1 },
+ triggers: { lt: 1, rt: 0 },
+ });
+ }
+ dispatch.mockClear();
+
+ controller.handleHostMessage({
+ kind: 'frame',
+ family: 'xbox',
+ buttons: XBOX_GAMEPAD_EMPTY_FRAME.buttons,
+ axes: XBOX_GAMEPAD_EMPTY_FRAME.axes,
+ triggers: XBOX_GAMEPAD_EMPTY_FRAME.triggers,
+ });
+ expect(dispatch).not.toHaveBeenCalledWith({ type: 'voice', phase: 'release' });
+ expect(dispatch).not.toHaveBeenCalledWith({ type: 'scroll-stop' });
+ expect(dispatch).toHaveBeenCalledWith(
+ expect.objectContaining({ type: 'scroll', direction: 'up' }),
+ );
+
+ dispatch.mockClear();
+ controller.handleHostMessage({
+ kind: 'frame',
+ family: 'playstation',
+ buttons: XBOX_GAMEPAD_EMPTY_FRAME.buttons,
+ axes: XBOX_GAMEPAD_EMPTY_FRAME.axes,
+ triggers: XBOX_GAMEPAD_EMPTY_FRAME.triggers,
+ });
+ expect(dispatch).toHaveBeenCalledWith({ type: 'voice', phase: 'release' });
+ expect(dispatch).toHaveBeenCalledWith({ type: 'scroll-stop' });
+ });
});
diff --git a/apps/desktop/src/main/xbox-gamepad/__tests__/host.test.ts b/apps/desktop/src/main/xbox-gamepad/__tests__/host.test.ts
index 1f06d19b13..800e76cdee 100644
--- a/apps/desktop/src/main/xbox-gamepad/__tests__/host.test.ts
+++ b/apps/desktop/src/main/xbox-gamepad/__tests__/host.test.ts
@@ -150,7 +150,9 @@ describe('XboxGamepadHost', () => {
await flush();
for (const delay of [1_000, 2_000, 4_000]) {
const current = spawnHelper.mock.results.at(-1)?.value as ReturnType<typeof fakeChild>;
- (current.stdout as PassThrough).write(`${JSON.stringify({ kind: 'presence', present: false })}\n`);
+ (current.stdout as PassThrough).write(
+ `${JSON.stringify({ kind: 'presence', present: false })}\n`,
+ );
current.emit('exit', 1, null);
await flush();
await vi.advanceTimersByTimeAsync(delay);
@@ -250,10 +252,26 @@ describe('Xbox gamepad helper packaging contract', () => {
'utf8',
);
expect(source).toContain('func controllerTransport(for controller: GCController)');
+ expect(source).toContain('IOHIDManagerSetDeviceMatchingMultiple');
+ expect(source).toContain('0x054C');
+ expect(source).toContain('0x057E');
expect(source).not.toContain('func microsoftControllerTransport()');
expect(source).not.toContain('if sawUsb { return "usb" }');
});
+ it('attaches any extended gamepad instead of filtering to Xbox', () => {
+ const source = readFileSync(
+ new URL('../../../../native/xbox-gamepad/macos-xbox-gamepad-helper.swift', import.meta.url),
+ 'utf8',
+ );
+ expect(source).toContain('func isSupportedGamepad');
+ expect(source).toContain('func resolveGamepadFamily');
+ expect(source).toContain('for controller in all where isSupportedGamepad(controller)');
+ expect(source).toContain('return "generic"');
+ expect(source).not.toContain('func isXboxController');
+ expect(source).not.toContain('all.first(where: isXboxController)');
+ });
+
it('compiles the helper for macOS 11 so GameController Xbox APIs are available', () => {
const source = readFileSync(new URL('../../../../forge.config.ts', import.meta.url), 'utf8');
expect(source).toContain("MACOS_XBOX_GAMEPAD_HELPER_DEPLOYMENT_TARGET = 'macos11.0'");
diff --git a/apps/desktop/src/main/xbox-gamepad/__tests__/settingsIpc.test.ts b/apps/desktop/src/main/xbox-gamepad/__tests__/settingsIpc.test.ts
index 17691ef64a..52f06221f1 100644
--- a/apps/desktop/src/main/xbox-gamepad/__tests__/settingsIpc.test.ts
+++ b/apps/desktop/src/main/xbox-gamepad/__tests__/settingsIpc.test.ts
@@ -1,28 +1,37 @@
import { describe, expect, it, vi } from 'vitest';
-import { createXboxGamepadDefaultSettings } from '../../../shared/xboxGamepad.js';
+import {
+ createXboxGamepadDefaultSettings,
+ emptyGamepadDevice,
+ GAMEPAD_FAMILIES,
+ type GamepadAccessoriesState,
+ type XboxGamepadSettings,
+} from '../../../shared/xboxGamepad.js';
import { createXboxGamepadSettingsIpc } from '../settingsIpc.js';
+function accessories(settings: XboxGamepadSettings): GamepadAccessoriesState {
+ return Object.fromEntries(
+ GAMEPAD_FAMILIES.map((family) => [
+ family,
+ {
+ connectionStatus: 'disabled' as const,
+ devicePresent: true,
+ deviceName: family,
+ device: emptyGamepadDevice(family),
+ settings,
+ },
+ ]),
+ ) as GamepadAccessoriesState;
+}
+
describe('Xbox gamepad settings IPC', () => {
- it('enables the adapter through a trusted sender', () => {
+ it('enables one accessory through a trusted sender', () => {
let settings = createXboxGamepadDefaultSettings();
const applySettings = vi.fn();
const handlers = createXboxGamepadSettingsIpc({
assertTrustedSender: vi.fn(),
- getState: () => ({
- connectionStatus: 'disabled',
- devicePresent: true,
- deviceName: 'Xbox Wireless Controller',
- device: {
- name: 'Xbox Wireless Controller',
- category: 'Xbox One',
- transport: 'unknown',
- batteryPercentage: null,
- batteryState: 'unknown',
- },
- settings,
- }),
- writeSettings: (patch) => {
+ getState: () => accessories(settings),
+ writeSettings: (_family, patch) => {
settings = { ...settings, ...patch, layout: patch.layout ?? settings.layout };
return settings;
},
@@ -35,29 +44,20 @@ describe('Xbox gamepad settings IPC', () => {
setLayoutPreviewActive: vi.fn(),
});
- const next = handlers.set({}, { deviceEnabled: true });
- expect(next.settings.deviceEnabled).toBe(true);
- expect(applySettings).toHaveBeenCalledWith(expect.objectContaining({ deviceEnabled: true }));
+ const next = handlers.set({}, 'playstation', { deviceEnabled: true });
+ expect(next.playstation.settings.deviceEnabled).toBe(true);
+ expect(applySettings).toHaveBeenCalledWith(
+ 'playstation',
+ expect.objectContaining({ deviceEnabled: true }),
+ );
});
it('accepts a remapped layout', () => {
let settings = createXboxGamepadDefaultSettings();
const handlers = createXboxGamepadSettingsIpc({
assertTrustedSender: vi.fn(),
- getState: () => ({
- connectionStatus: 'disabled',
- devicePresent: true,
- deviceName: 'Xbox Wireless Controller',
- device: {
- name: 'Xbox Wireless Controller',
- category: 'Xbox One',
- transport: 'unknown',
- batteryPercentage: null,
- batteryState: 'unknown',
- },
- settings,
- }),
- writeSettings: (patch) => {
+ getState: () => accessories(settings),
+ writeSettings: (_family, patch) => {
settings = { ...settings, ...patch, layout: patch.layout ?? settings.layout };
return settings;
},
@@ -68,8 +68,8 @@ describe('Xbox gamepad settings IPC', () => {
});
const layout = createXboxGamepadDefaultSettings().layout;
layout.buttons.a = { type: 'command', commandId: 'newTask' };
- const next = handlers.set({}, { layout });
- expect(next.settings.layout.buttons.a).toEqual({ type: 'command', commandId: 'newTask' });
+ const next = handlers.set({}, 'xbox', { layout });
+ expect(next.xbox.settings.layout.buttons.a).toEqual({ type: 'command', commandId: 'newTask' });
});
it('rejects unknown settings keys', () => {
@@ -82,7 +82,7 @@ describe('Xbox gamepad settings IPC', () => {
probeDevice: vi.fn(),
setLayoutPreviewActive: vi.fn(),
});
- expect(() => handlers.set({}, { rumble: true })).toThrow('[INVALID_PARAMS]');
+ expect(() => handlers.set({}, 'xbox', { rumble: true })).toThrow('[INVALID_PARAMS]');
});
it('forwards the renderer event when toggling layout preview', () => {
@@ -99,6 +99,8 @@ describe('Xbox gamepad settings IPC', () => {
});
handlers.setLayoutPreviewActive(event, true);
- expect(setLayoutPreviewActive).toHaveBeenCalledWith(true, event);
+ expect(setLayoutPreviewActive).toHaveBeenCalledWith(true, 'xbox', event);
+ handlers.setLayoutPreviewActive(event, { active: true, family: 'nintendo' });
+ expect(setLayoutPreviewActive).toHaveBeenCalledWith(true, 'nintendo', event);
});
});
diff --git a/apps/desktop/src/main/xbox-gamepad/bindings.ts b/apps/desktop/src/main/xbox-gamepad/bindings.ts
index 221af24000..8896355661 100644
--- a/apps/desktop/src/main/xbox-gamepad/bindings.ts
+++ b/apps/desktop/src/main/xbox-gamepad/bindings.ts
@@ -6,6 +6,7 @@ import {
import {
XBOX_GAMEPAD_BUTTON_IDS,
XBOX_GAMEPAD_STICK_IDS,
+ type GamepadFamily,
type XboxGamepadBinding,
type XboxGamepadButtonId,
type XboxGamepadLayout,
@@ -96,19 +97,37 @@ export function reduceXboxGamepadFrame(
return actions;
}
+export function xboxGamepadActiveHolds(
+ frame: XboxGamepadFrame | null,
+ layout: XboxGamepadLayout,
+): {
+ voice: boolean;
+ scroll: Extract<InputDeviceRendererAction, { type: 'scroll' }> | null;
+} {
+ if (!frame) return { voice: false, scroll: null };
+ return {
+ voice: voiceHeld(frame, layout),
+ scroll: combinedScroll(frame, layout),
+ };
+}
+
export function xboxGamepadHoldReleases(
frame: XboxGamepadFrame | null,
layout: XboxGamepadLayout,
): InputDeviceRendererAction[] {
- if (!frame) return [];
+ const holds = xboxGamepadActiveHolds(frame, layout);
const actions: InputDeviceRendererAction[] = [];
- if (voiceHeld(frame, layout)) actions.push({ type: 'voice', phase: 'release' });
- if (combinedScroll(frame, layout)) actions.push({ type: 'scroll-stop' });
+ if (holds.voice) actions.push({ type: 'voice', phase: 'release' });
+ if (holds.scroll) actions.push({ type: 'scroll-stop' });
return actions;
}
-export function xboxGamepadPreviewFromFrame(frame: XboxGamepadFrame) {
+export function xboxGamepadPreviewFromFrame(
+ frame: XboxGamepadFrame,
+ family: GamepadFamily = 'xbox',
+) {
return {
+ family,
buttons: { ...frame.buttons },
sticks: {
left: { x: frame.axes.lx, y: frame.axes.ly },
diff --git a/apps/desktop/src/main/xbox-gamepad/controller.ts b/apps/desktop/src/main/xbox-gamepad/controller.ts
index e9b2658879..231bf61d40 100644
--- a/apps/desktop/src/main/xbox-gamepad/controller.ts
+++ b/apps/desktop/src/main/xbox-gamepad/controller.ts
@@ -2,8 +2,13 @@ import type { InputDeviceRendererAction } from '../../shared/inputDevices.js';
import {
cloneXboxGamepadSettings,
createXboxGamepadDefaultSettings,
- XBOX_GAMEPAD_EMPTY_DEVICE,
- XBOX_GAMEPAD_EMPTY_PREVIEW,
+ emptyGamepadDevice,
+ emptyGamepadPreview,
+ GAMEPAD_FAMILIES,
+ isGamepadFamily,
+ resolveGamepadFamily,
+ type GamepadAccessoriesState,
+ type GamepadFamily,
type XboxGamepadConnectionStatus,
type XboxGamepadDeviceInfo,
type XboxGamepadPreviewInput,
@@ -12,6 +17,7 @@ import {
} from '../../shared/xboxGamepad.js';
import {
reduceXboxGamepadFrame,
+ xboxGamepadActiveHolds,
xboxGamepadHoldReleases,
xboxGamepadPreviewFromFrame,
type XboxGamepadFrame,
@@ -24,78 +30,112 @@ export interface XboxGamepadControllerDeps {
preview?(input: XboxGamepadPreviewInput): void;
}
+interface AccessorySlot {
+ settings: XboxGamepadSettings;
+ devicePresent: boolean | null;
+ deviceName: string | null;
+ device: XboxGamepadDeviceInfo;
+ connectionStatus: XboxGamepadConnectionStatus;
+ previousFrame: XboxGamepadFrame | null;
+}
+
+function createSlot(family: GamepadFamily): AccessorySlot {
+ return {
+ settings: createXboxGamepadDefaultSettings(),
+ devicePresent: null,
+ deviceName: null,
+ device: emptyGamepadDevice(family),
+ connectionStatus: 'disabled',
+ previousFrame: null,
+ };
+}
+
export class XboxGamepadController {
- private settings: XboxGamepadSettings = createXboxGamepadDefaultSettings();
- private devicePresent: boolean | null = null;
- private deviceName: string | null = null;
- private device: XboxGamepadDeviceInfo = { ...XBOX_GAMEPAD_EMPTY_DEVICE };
- private connectionStatus: XboxGamepadConnectionStatus = 'disabled';
- private previousFrame: XboxGamepadFrame | null = null;
+ private readonly slots = Object.fromEntries(
+ GAMEPAD_FAMILIES.map((family) => [family, createSlot(family)]),
+ ) as Record<GamepadFamily, AccessorySlot>;
private hostError: string | null = null;
- private layoutPreviewActive = false;
- private listeners = new Set<(state: XboxGamepadState) => void>();
+ private layoutPreviewFamily: GamepadFamily | null = null;
+ private listeners = new Set<(state: GamepadAccessoriesState) => void>();
constructor(private readonly deps: XboxGamepadControllerDeps) {}
- getState(): XboxGamepadState {
- return {
- connectionStatus: this.connectionStatus,
- devicePresent: this.devicePresent,
- deviceName: this.deviceName,
- device: { ...this.device },
- settings: cloneXboxGamepadSettings(this.settings),
- };
+ getState(family: GamepadFamily = 'xbox'): XboxGamepadState {
+ return snapshot(this.slots[family]);
+ }
+
+ getAccessories(): GamepadAccessoriesState {
+ return Object.fromEntries(
+ GAMEPAD_FAMILIES.map((family) => [family, snapshot(this.slots[family])]),
+ ) as GamepadAccessoriesState;
}
- subscribe(listener: (state: XboxGamepadState) => void): () => void {
+ subscribe(listener: (state: GamepadAccessoriesState) => void): () => void {
this.listeners.add(listener);
- listener(this.getState());
+ listener(this.getAccessories());
return () => this.listeners.delete(listener);
}
- applySettings(settings: XboxGamepadSettings): void {
- const wasDispatching = this.shouldDispatch();
- const layoutChanged =
- JSON.stringify(this.settings.layout) !== JSON.stringify(settings.layout);
- if (layoutChanged) this.releaseHolds();
- this.settings = cloneXboxGamepadSettings(settings);
- this.syncConnectionStatus();
- if (wasDispatching && !this.shouldDispatch()) this.releaseHolds();
+ applySettings(family: GamepadFamily, settings: XboxGamepadSettings): void {
+ const slot = this.slots[family];
+ const wasDispatching = this.shouldDispatch(slot);
+ const layoutChanged = JSON.stringify(slot.settings.layout) !== JSON.stringify(settings.layout);
+ if (layoutChanged) this.releaseHolds(slot);
+ slot.settings = cloneXboxGamepadSettings(settings);
+ this.syncConnectionStatus(slot);
+ if (wasDispatching && !this.shouldDispatch(slot)) this.releaseHolds(slot);
this.emit();
}
setCindyFrontmost(frontmost: boolean): void {
if (frontmost) return;
- this.releaseHolds();
+ for (const family of GAMEPAD_FAMILIES) this.releaseHolds(this.slots[family]);
}
- setLayoutPreviewActive(active: boolean): void {
- if (this.layoutPreviewActive === active) return;
- this.layoutPreviewActive = active;
- if (active) this.releaseHolds();
+ setLayoutPreviewActive(active: boolean, family: GamepadFamily | null = null): void {
+ const next = active ? family : null;
+ if (this.layoutPreviewFamily === next) return;
+ this.layoutPreviewFamily = next;
+ if (next) {
+ for (const held of GAMEPAD_FAMILIES) this.releaseHolds(this.slots[held]);
+ }
}
handleHostMessage(message: XboxGamepadHostMessage): void {
if (message.kind === 'host-error') {
this.hostError = message.message;
- this.devicePresent = false;
- this.deviceName = null;
- this.device = { ...XBOX_GAMEPAD_EMPTY_DEVICE };
- this.syncConnectionStatus();
- this.releaseHolds();
- this.emitPreview(XBOX_GAMEPAD_EMPTY_PREVIEW);
+ for (const family of GAMEPAD_FAMILIES) {
+ const slot = this.slots[family];
+ slot.devicePresent = false;
+ slot.deviceName = null;
+ slot.device = emptyGamepadDevice(family);
+ this.syncConnectionStatus(slot);
+ this.releaseHolds(slot);
+ this.emitPreview(emptyGamepadPreview(family));
+ }
this.emit();
return;
}
if (message.kind === 'presence') {
this.hostError = null;
- this.devicePresent = message.present;
- this.deviceName = message.present ? (message.name ?? this.deviceName) : null;
- this.device = message.present ? deviceFromPresence(message) : { ...XBOX_GAMEPAD_EMPTY_DEVICE };
- this.syncConnectionStatus();
+ if (!message.present && message.family === undefined) {
+ for (const family of GAMEPAD_FAMILIES) this.applyAbsence(this.slots[family], family);
+ this.emit();
+ return;
+ }
+ const family = resolveGamepadFamily({
+ family: message.family,
+ name: message.name,
+ category: message.category,
+ });
+ const slot = this.slots[family];
+ slot.devicePresent = message.present;
+ slot.deviceName = message.present ? (message.name ?? slot.deviceName) : null;
+ slot.device = message.present ? deviceFromPresence(message, family) : emptyGamepadDevice(family);
+ this.syncConnectionStatus(slot);
if (!message.present) {
- this.releaseHolds();
- this.emitPreview(XBOX_GAMEPAD_EMPTY_PREVIEW);
+ this.releaseHolds(slot);
+ this.emitPreview(emptyGamepadPreview(family));
}
this.emit();
return;
@@ -103,67 +143,137 @@ export class XboxGamepadController {
if (message.kind !== 'frame') return;
const frame = parseXboxGamepadFrame(message);
if (!frame) return;
+ const family = isGamepadFamily(message.family) ? message.family : 'xbox';
+ const slot = this.slots[family];
this.hostError = null;
- this.emitPreview(xboxGamepadPreviewFromFrame(frame));
- if (!this.shouldDispatch()) {
- this.previousFrame = null;
+ this.emitPreview(xboxGamepadPreviewFromFrame(frame, family));
+ if (!this.shouldDispatch(slot)) {
+ this.releaseHolds(slot);
return;
}
- const actions = reduceXboxGamepadFrame(this.previousFrame, frame, this.settings.layout);
- this.previousFrame = frame;
- for (const action of actions) this.deps.dispatch(action);
+ const actions = reduceXboxGamepadFrame(slot.previousFrame, frame, slot.settings.layout);
+ slot.previousFrame = frame;
+ this.emitActions(slot, actions);
}
markUnavailable(): void {
- this.connectionStatus = this.settings.deviceEnabled ? 'unavailable' : 'disabled';
- this.devicePresent = false;
- this.deviceName = null;
- this.device = { ...XBOX_GAMEPAD_EMPTY_DEVICE };
- this.releaseHolds();
- this.emitPreview(XBOX_GAMEPAD_EMPTY_PREVIEW);
+ for (const family of GAMEPAD_FAMILIES) {
+ const slot = this.slots[family];
+ slot.connectionStatus = slot.settings.deviceEnabled ? 'unavailable' : 'disabled';
+ slot.devicePresent = false;
+ slot.deviceName = null;
+ slot.device = emptyGamepadDevice(family);
+ this.releaseHolds(slot);
+ this.emitPreview(emptyGamepadPreview(family));
+ }
this.emit();
}
- private shouldDispatch(): boolean {
- return this.settings.deviceEnabled && this.deps.isCindyFrontmost() && !this.layoutPreviewActive;
+ private applyAbsence(slot: AccessorySlot, family: GamepadFamily): void {
+ slot.devicePresent = false;
+ slot.deviceName = null;
+ slot.device = emptyGamepadDevice(family);
+ this.syncConnectionStatus(slot);
+ this.releaseHolds(slot);
+ this.emitPreview(emptyGamepadPreview(family));
+ }
+
+ private shouldDispatch(slot: AccessorySlot): boolean {
+ return (
+ slot.settings.deviceEnabled &&
+ this.deps.isCindyFrontmost() &&
+ this.layoutPreviewFamily === null
+ );
}
private emitPreview(input: XboxGamepadPreviewInput): void {
- if (!this.layoutPreviewActive) return;
+ if (this.layoutPreviewFamily !== input.family) return;
this.deps.preview?.(input);
}
- private syncConnectionStatus(): void {
- if (!this.settings.deviceEnabled) {
- this.connectionStatus = this.devicePresent
+ private syncConnectionStatus(slot: AccessorySlot): void {
+ if (!slot.settings.deviceEnabled) {
+ slot.connectionStatus = slot.devicePresent
? 'disabled'
- : this.devicePresent === false
+ : slot.devicePresent === false
? 'not-detected'
: 'disabled';
return;
}
- if (this.hostError) this.connectionStatus = 'error';
- else if (this.devicePresent) this.connectionStatus = 'connected';
- else if (this.devicePresent === false) this.connectionStatus = 'not-detected';
- else this.connectionStatus = 'connecting';
+ if (this.hostError) slot.connectionStatus = 'error';
+ else if (slot.devicePresent) slot.connectionStatus = 'connected';
+ else if (slot.devicePresent === false) slot.connectionStatus = 'not-detected';
+ else slot.connectionStatus = 'connecting';
}
- private releaseHolds(): void {
- const actions = xboxGamepadHoldReleases(this.previousFrame, this.settings.layout);
- this.previousFrame = null;
- for (const action of actions) this.deps.dispatch(action);
+ private releaseHolds(slot: AccessorySlot): void {
+ const actions = xboxGamepadHoldReleases(slot.previousFrame, slot.settings.layout);
+ slot.previousFrame = null;
+ this.emitActions(slot, actions);
+ }
+
+ private emitActions(origin: AccessorySlot, actions: InputDeviceRendererAction[]): void {
+ for (const action of actions) {
+ if (action.type === 'voice' && action.phase === 'release' && this.otherVoiceHeld(origin)) {
+ continue;
+ }
+ if (action.type === 'scroll-stop') {
+ const remaining = this.otherScroll(origin);
+ if (remaining) {
+ this.deps.dispatch(remaining);
+ continue;
+ }
+ }
+ this.deps.dispatch(action);
+ }
+ }
+
+ private otherVoiceHeld(except: AccessorySlot): boolean {
+ for (const family of GAMEPAD_FAMILIES) {
+ const slot = this.slots[family];
+ if (slot === except || !this.shouldDispatch(slot)) continue;
+ if (xboxGamepadActiveHolds(slot.previousFrame, slot.settings.layout).voice) return true;
+ }
+ return false;
+ }
+
+ private otherScroll(
+ except: AccessorySlot,
+ ): Extract<InputDeviceRendererAction, { type: 'scroll' }> | null {
+ let best: Extract<InputDeviceRendererAction, { type: 'scroll' }> | null = null;
+ for (const family of GAMEPAD_FAMILIES) {
+ const slot = this.slots[family];
+ if (slot === except || !this.shouldDispatch(slot)) continue;
+ const scroll = xboxGamepadActiveHolds(slot.previousFrame, slot.settings.layout).scroll;
+ if (scroll && (!best || scroll.intensity > best.intensity)) best = scroll;
+ }
+ return best;
}
private emit(): void {
- const state = this.getState();
+ const state = this.getAccessories();
for (const listener of this.listeners) listener(state);
}
}
-function deviceFromPresence(message: Extract<XboxGamepadHostMessage, { kind: 'presence' }>): XboxGamepadDeviceInfo {
+function snapshot(slot: AccessorySlot): XboxGamepadState {
+ return {
+ connectionStatus: slot.connectionStatus,
+ devicePresent: slot.devicePresent,
+ deviceName: slot.deviceName,
+ device: { ...slot.device },
+ settings: cloneXboxGamepadSettings(slot.settings),
+ };
+}
+
+function deviceFromPresence(
+ message: Extract<XboxGamepadHostMessage, { kind: 'presence' }>,
+ family: GamepadFamily,
+): XboxGamepadDeviceInfo {
return {
name: message.name ?? null,
category: message.category ?? null,
+ family,
transport: message.transport ?? 'unknown',
batteryPercentage:
typeof message.batteryPercentage === 'number' ? Math.round(message.batteryPercentage) : null,
diff --git a/apps/desktop/src/main/xbox-gamepad/index.ts b/apps/desktop/src/main/xbox-gamepad/index.ts
index be15adb37e..3f94e73e68 100644
--- a/apps/desktop/src/main/xbox-gamepad/index.ts
+++ b/apps/desktop/src/main/xbox-gamepad/index.ts
@@ -10,7 +10,8 @@ import {
type WorkLouderCodexRendererAction,
} from '../../shared/workLouderCodex.js';
import {
- XBOX_GAMEPAD_DEVICE,
+ GAMEPAD_DEVICES,
+ GAMEPAD_FAMILIES,
XBOX_GAMEPAD_GET_STATE_CHANNEL,
XBOX_GAMEPAD_PREVIEW_INPUT_CHANNEL,
XBOX_GAMEPAD_PROBE_CHANNEL,
@@ -18,8 +19,9 @@ import {
XBOX_GAMEPAD_SET_LAYOUT_PREVIEW_CHANNEL,
XBOX_GAMEPAD_SET_SETTINGS_CHANNEL,
XBOX_GAMEPAD_STATE_CHANGED_CHANNEL,
+ type GamepadAccessoriesState,
+ type GamepadFamily,
type XboxGamepadPreviewInput,
- type XboxGamepadState,
} from '../../shared/xboxGamepad.js';
import { assertTrustedAppRendererEvent, isTrustedAppRendererWindow } from '../security/trustedAppRenderer.js';
import { createWorkLouderCodexActiveWindowRouter } from '../worklouder-codex/actionWindow.js';
@@ -71,7 +73,7 @@ function dispatchRendererAction(action: WorkLouderCodexRendererAction): void {
});
}
-function broadcastState(state: XboxGamepadState): void {
+function broadcastState(state: GamepadAccessoriesState): void {
for (const window of BrowserWindow.getAllWindows()) {
if (!isTrustedAppRendererWindow(window)) continue;
window.webContents.send(XBOX_GAMEPAD_STATE_CHANGED_CHANNEL, state);
@@ -94,8 +96,9 @@ const controller = new XboxGamepadController({
const host = createXboxGamepadHost((message) => {
controller.handleHostMessage(message);
});
+let previewFamily: GamepadFamily | null = null;
const layoutPreviewLease = createLayoutPreviewLease((active) => {
- controller.setLayoutPreviewActive(active);
+ controller.setLayoutPreviewActive(active, active ? previewFamily : null);
});
let inputDeviceRegistered = false;
@@ -105,49 +108,60 @@ let focusHooksInstalled = false;
export function registerXboxGamepadInputDevice(): void {
if (inputDeviceRegistered) return;
inputDeviceRegistered = true;
- registerInputDevice({
- descriptor: XBOX_GAMEPAD_DEVICE,
- start: () => {
- registerXboxGamepadSettingsIpc();
- },
- updateSessionActivity: () => undefined,
- resumeTaskSlots: async () => {
- controller.applySettings(readXboxGamepadSettings());
- },
- suspendTaskSlots: () => {
- controller.applySettings({ ...readXboxGamepadSettings(), deviceEnabled: false });
- },
- dispose: async () => {
- host.stop();
- },
- });
+ for (const family of GAMEPAD_FAMILIES) {
+ registerInputDevice({
+ descriptor: GAMEPAD_DEVICES[family],
+ start: () => {
+ registerXboxGamepadSettingsIpc();
+ },
+ updateSessionActivity: () => undefined,
+ resumeTaskSlots: async () => {
+ controller.applySettings(family, readXboxGamepadSettings(family));
+ },
+ suspendTaskSlots: () => {
+ controller.applySettings(family, {
+ ...readXboxGamepadSettings(family),
+ deviceEnabled: false,
+ });
+ },
+ dispose: async () => {
+ host.stop();
+ },
+ });
+ }
}
export function registerXboxGamepadSettingsIpc(): void {
if (settingsIpcRegistered) return;
settingsIpcRegistered = true;
- controller.applySettings(readXboxGamepadSettings());
+ for (const family of GAMEPAD_FAMILIES) {
+ controller.applySettings(family, readXboxGamepadSettings(family));
+ }
if (process.platform === 'darwin') host.start();
else controller.markUnavailable();
installFocusHooks();
const handlers = createXboxGamepadSettingsIpc({
assertTrustedSender: (event) => assertTrustedAppRendererEvent(event as never),
- getState: () => controller.getState(),
+ getState: () => controller.getAccessories(),
writeSettings: writeXboxGamepadSettingsPatch,
resetSettings: resetXboxGamepadSettings,
- applySettings: (settings) => controller.applySettings(settings),
+ applySettings: (family, settings) => controller.applySettings(family, settings),
probeDevice: () => host.probe(),
- setLayoutPreviewActive: (active, event) => {
+ setLayoutPreviewActive: (active, family, event) => {
+ previewFamily = family;
layoutPreviewLease.setActive(active, layoutPreviewOwnerFromEvent(event));
+ if (active) controller.setLayoutPreviewActive(true, family);
},
});
ipcMain.handle(XBOX_GAMEPAD_GET_STATE_CHANNEL, (event) => handlers.get(event));
- ipcMain.handle(XBOX_GAMEPAD_SET_SETTINGS_CHANNEL, (event, patch: unknown) =>
- handlers.set(event, patch),
+ ipcMain.handle(XBOX_GAMEPAD_SET_SETTINGS_CHANNEL, (event, family: unknown, patch: unknown) =>
+ handlers.set(event, family, patch),
+ );
+ ipcMain.handle(XBOX_GAMEPAD_RESET_SETTINGS_CHANNEL, (event, family: unknown) =>
+ handlers.reset(event, family),
);
- ipcMain.handle(XBOX_GAMEPAD_RESET_SETTINGS_CHANNEL, (event) => handlers.reset(event));
ipcMain.handle(XBOX_GAMEPAD_PROBE_CHANNEL, (event) => handlers.probe(event));
ipcMain.handle(XBOX_GAMEPAD_SET_LAYOUT_PREVIEW_CHANNEL, (event, active: unknown) =>
handlers.setLayoutPreviewActive(event, active),
diff --git a/apps/desktop/src/main/xbox-gamepad/protocol.ts b/apps/desktop/src/main/xbox-gamepad/protocol.ts
index c2bc1822d6..9a05329305 100644
--- a/apps/desktop/src/main/xbox-gamepad/protocol.ts
+++ b/apps/desktop/src/main/xbox-gamepad/protocol.ts
@@ -1,4 +1,4 @@
-import { XBOX_GAMEPAD_BUTTON_IDS } from '../../shared/xboxGamepad.js';
+import { isGamepadFamily, XBOX_GAMEPAD_BUTTON_IDS, type GamepadFamily } from '../../shared/xboxGamepad.js';
import {
digitalTriggerPressed,
XBOX_GAMEPAD_EMPTY_FRAME,
@@ -14,12 +14,14 @@ export type XboxGamepadHostMessage =
present: boolean;
name?: string;
category?: string;
+ family?: GamepadFamily;
transport?: 'usb' | 'bluetooth' | 'unknown';
batteryPercentage?: number;
batteryState?: 'unknown' | 'discharging' | 'charging' | 'full';
}
| {
kind: 'frame';
+ family?: GamepadFamily;
buttons: XboxGamepadButtons;
axes: XboxGamepadAxes;
triggers: XboxGamepadTriggers;
@@ -40,6 +42,7 @@ export function isXboxGamepadHostMessage(value: unknown): value is XboxGamepadHo
present?: unknown;
name?: unknown;
category?: unknown;
+ family?: unknown;
transport?: unknown;
batteryPercentage?: unknown;
batteryState?: unknown;
@@ -47,6 +50,7 @@ export function isXboxGamepadHostMessage(value: unknown): value is XboxGamepadHo
if (typeof record.present !== 'boolean') return false;
if (record.name !== undefined && typeof record.name !== 'string') return false;
if (record.category !== undefined && typeof record.category !== 'string') return false;
+ if (record.family !== undefined && !isGamepadFamily(record.family)) return false;
if (
record.transport !== undefined &&
record.transport !== 'usb' &&
@@ -84,6 +88,8 @@ export function isXboxGamepadHostMessage(value: unknown): value is XboxGamepadHo
);
}
if (message.kind !== 'frame') return false;
+ const frame = message as { family?: unknown };
+ if (frame.family !== undefined && !isGamepadFamily(frame.family)) return false;
return parseXboxGamepadFrame(message) !== null;
}
diff --git a/apps/desktop/src/main/xbox-gamepad/settingsIpc.ts b/apps/desktop/src/main/xbox-gamepad/settingsIpc.ts
index 9838879f9b..551216881a 100644
--- a/apps/desktop/src/main/xbox-gamepad/settingsIpc.ts
+++ b/apps/desktop/src/main/xbox-gamepad/settingsIpc.ts
@@ -1,14 +1,16 @@
import { isInputDeviceCommandId } from '../../shared/inputDevices.js';
import {
+ isGamepadFamily,
isXboxGamepadStickMode,
XBOX_GAMEPAD_BUTTON_IDS,
XBOX_GAMEPAD_STICK_DIRECTIONS,
XBOX_GAMEPAD_STICK_IDS,
+ type GamepadAccessoriesState,
+ type GamepadFamily,
type XboxGamepadBinding,
type XboxGamepadLayout,
type XboxGamepadSettings,
type XboxGamepadSettingsPatch,
- type XboxGamepadState,
type XboxGamepadStickBinding,
} from '../../shared/xboxGamepad.js';
import { throwIpcError } from '../utils/ipcValidate.js';
@@ -17,47 +19,65 @@ const SETTING_KEYS = ['deviceEnabled', 'layout'] as const;
export interface XboxGamepadSettingsIpcDeps {
assertTrustedSender(event: unknown): void;
- getState(): XboxGamepadState;
- writeSettings(patch: XboxGamepadSettingsPatch): XboxGamepadSettings;
- resetSettings(): XboxGamepadSettings;
- applySettings(settings: XboxGamepadSettings): void;
+ getState(): GamepadAccessoriesState;
+ writeSettings(family: GamepadFamily, patch: XboxGamepadSettingsPatch): XboxGamepadSettings;
+ resetSettings(family: GamepadFamily): XboxGamepadSettings;
+ applySettings(family: GamepadFamily, settings: XboxGamepadSettings): void;
probeDevice(): void;
- setLayoutPreviewActive(active: boolean, event: unknown): void;
+ setLayoutPreviewActive(active: boolean, family: GamepadFamily | null, event: unknown): void;
}
export function createXboxGamepadSettingsIpc(deps: XboxGamepadSettingsIpcDeps) {
return {
- get(event: unknown): XboxGamepadState {
+ get(event: unknown): GamepadAccessoriesState {
deps.assertTrustedSender(event);
return deps.getState();
},
- set(event: unknown, patch: unknown): XboxGamepadState {
+ set(event: unknown, family: unknown, patch: unknown): GamepadAccessoriesState {
deps.assertTrustedSender(event);
- const next = deps.writeSettings(parseSettingsPatch(patch));
- deps.applySettings(next);
+ const next = deps.writeSettings(parseFamily(family), parseSettingsPatch(patch));
+ deps.applySettings(parseFamily(family), next);
return deps.getState();
},
- reset(event: unknown): XboxGamepadState {
+ reset(event: unknown, family: unknown): GamepadAccessoriesState {
deps.assertTrustedSender(event);
- const next = deps.resetSettings();
- deps.applySettings(next);
+ const resolved = parseFamily(family);
+ const next = deps.resetSettings(resolved);
+ deps.applySettings(resolved, next);
return deps.getState();
},
- probe(event: unknown): XboxGamepadState {
+ probe(event: unknown): GamepadAccessoriesState {
deps.assertTrustedSender(event);
deps.probeDevice();
return deps.getState();
},
setLayoutPreviewActive(event: unknown, value: unknown): void {
deps.assertTrustedSender(event);
- if (typeof value !== 'boolean') {
+ if (typeof value === 'boolean') {
+ deps.setLayoutPreviewActive(value, value ? 'xbox' : null, event);
+ return;
+ }
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
+ throwIpcError('INVALID_PARAMS', 'layout preview flag must be a boolean or object');
+ }
+ const record = value as { active?: unknown; family?: unknown };
+ if (typeof record.active !== 'boolean') {
throwIpcError('INVALID_PARAMS', 'layout preview flag must be a boolean');
}
- deps.setLayoutPreviewActive(value, event);
+ deps.setLayoutPreviewActive(
+ record.active,
+ record.active ? parseFamily(record.family) : null,
+ event,
+ );
},
};
}
+function parseFamily(value: unknown): GamepadFamily {
+ if (!isGamepadFamily(value)) throwIpcError('INVALID_PARAMS', 'gamepad family is invalid');
+ return value;
+}
+
function parseSettingsPatch(value: unknown): XboxGamepadSettingsPatch {
const record = requireRecord(value, 'Xbox gamepad settings patch required');
rejectUnknownKeys(record, SETTING_KEYS, 'Xbox gamepad setting');
diff --git a/apps/desktop/src/main/xbox-gamepad/settingsStore.ts b/apps/desktop/src/main/xbox-gamepad/settingsStore.ts
index 25b4894dd8..b57dc990c8 100644
--- a/apps/desktop/src/main/xbox-gamepad/settingsStore.ts
+++ b/apps/desktop/src/main/xbox-gamepad/settingsStore.ts
@@ -5,6 +5,8 @@ import {
cloneXboxGamepadBinding,
createXboxGamepadDefaultLayout,
createXboxGamepadDefaultSettings,
+ GAMEPAD_FAMILIES,
+ type GamepadFamily,
isXboxGamepadBinding,
isXboxGamepadStickMode,
XBOX_GAMEPAD_BUTTON_IDS,
@@ -19,8 +21,8 @@ import { xboxGamepadLayoutOverrides } from './layoutOverride.js';
const log = desktopMakerLogger.child('xbox-gamepad-settings-store');
-function settingsFilePath(): string {
- return ownerScopedUserDataPath('xbox-gamepad-settings.json');
+function settingsFileName(family: GamepadFamily): string {
+ return family === 'xbox' ? 'xbox-gamepad-settings.json' : `${family}-gamepad-settings.json`;
}
function normalizeStick(raw: unknown, fallback: XboxGamepadStickBinding): XboxGamepadStickBinding {
@@ -90,43 +92,61 @@ function normalizeSettings(raw: unknown): XboxGamepadSettings {
};
}
-const store = createOverrideSettingsFile<XboxGamepadSettings>({
- filePath: settingsFilePath,
- defaults: createXboxGamepadDefaultSettings,
- normalize: normalizeSettings,
- mergeOverrides: ({ patch, next, defaults, overrides }) => {
- const nextOverrides = { ...overrides };
- if ('deviceEnabled' in patch) {
- if (next.deviceEnabled === defaults.deviceEnabled) delete nextOverrides.deviceEnabled;
- else nextOverrides.deviceEnabled = next.deviceEnabled;
- }
- if ('layout' in patch) {
- const layout = xboxGamepadLayoutOverrides(next.layout, defaults.layout);
- if (layout) nextOverrides.layout = layout;
- else delete nextOverrides.layout;
- }
- return nextOverrides;
- },
- log,
- label: 'Xbox gamepad',
- maxBytes: 64 * 1024,
-});
+function createStore(family: GamepadFamily) {
+ return createOverrideSettingsFile<XboxGamepadSettings>({
+ filePath: () => ownerScopedUserDataPath(settingsFileName(family)),
+ defaults: createXboxGamepadDefaultSettings,
+ normalize: normalizeSettings,
+ mergeOverrides: ({ patch, next, defaults, overrides }) => {
+ const nextOverrides = { ...overrides };
+ if ('deviceEnabled' in patch) {
+ if (next.deviceEnabled === defaults.deviceEnabled) delete nextOverrides.deviceEnabled;
+ else nextOverrides.deviceEnabled = next.deviceEnabled;
+ }
+ if ('layout' in patch) {
+ const layout = xboxGamepadLayoutOverrides(next.layout, defaults.layout);
+ if (layout) nextOverrides.layout = layout;
+ else delete nextOverrides.layout;
+ }
+ return nextOverrides;
+ },
+ log,
+ label: `${family} gamepad`,
+ maxBytes: 64 * 1024,
+ });
+}
+
+const stores = Object.fromEntries(
+ GAMEPAD_FAMILIES.map((family) => [family, createStore(family)]),
+) as Record<GamepadFamily, ReturnType<typeof createStore>>;
-export function readXboxGamepadSettings(): XboxGamepadSettings {
+export function readXboxGamepadSettings(family: GamepadFamily = 'xbox'): XboxGamepadSettings {
+ const store = stores[family];
store.invalidateIfChanged();
return store.read();
}
-export function writeXboxGamepadSettingsPatch(patch: XboxGamepadSettingsPatch): XboxGamepadSettings {
+export function writeXboxGamepadSettingsPatch(
+ family: GamepadFamily,
+ patch: XboxGamepadSettingsPatch,
+): XboxGamepadSettings {
+ const store = stores[family];
store.writePatch(patch);
- log.info('Xbox gamepad settings written', { keys: Object.keys(patch) });
+ log.info('Xbox gamepad settings written', { family, keys: Object.keys(patch) });
return store.read();
}
-export function resetXboxGamepadSettings(): XboxGamepadSettings {
+export function resetXboxGamepadSettings(family: GamepadFamily = 'xbox'): XboxGamepadSettings {
+ const store = stores[family];
const keepEnabled = store.read().deviceEnabled;
store.reset();
- log.info('Xbox gamepad settings reset');
- if (keepEnabled) return writeXboxGamepadSettingsPatch({ deviceEnabled: true });
+ log.info('Xbox gamepad settings reset', { family });
+ if (keepEnabled) return writeXboxGamepadSettingsPatch(family, { deviceEnabled: true });
return store.read();
}
+
+export function readAllGamepadSettings(): Record<GamepadFamily, XboxGamepadSettings> {
+ return Object.fromEntries(
+ GAMEPAD_FAMILIES.map((family) => [family, readXboxGamepadSettings(family)]),
+ ) as Record<GamepadFamily, XboxGamepadSettings>;
+}
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index b6c23be5c8..bdee039f63 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -66,9 +66,10 @@ import {
XBOX_GAMEPAD_SET_LAYOUT_PREVIEW_CHANNEL,
XBOX_GAMEPAD_SET_SETTINGS_CHANNEL,
XBOX_GAMEPAD_STATE_CHANGED_CHANNEL,
+ type GamepadAccessoriesState,
+ type GamepadFamily,
type XboxGamepadPreviewInput,
type XboxGamepadSettingsPatch,
- type XboxGamepadState,
} from '../shared/xboxGamepad';
import {
ANALYTICS_SETTINGS_CHANGE_CHANNEL,
@@ -1660,16 +1661,26 @@ contextBridge.exposeInMainWorld('electronAPI', {
},
xboxGamepad: {
- getState: (): Promise<XboxGamepadState> => ipcRenderer.invoke(XBOX_GAMEPAD_GET_STATE_CHANNEL),
- setSettings: (patch: XboxGamepadSettingsPatch): Promise<XboxGamepadState> =>
- ipcRenderer.invoke(XBOX_GAMEPAD_SET_SETTINGS_CHANNEL, patch),
- resetSettings: (): Promise<XboxGamepadState> =>
- ipcRenderer.invoke(XBOX_GAMEPAD_RESET_SETTINGS_CHANNEL),
- probe: (): Promise<XboxGamepadState> => ipcRenderer.invoke(XBOX_GAMEPAD_PROBE_CHANNEL),
- setLayoutPreviewActive: (active: boolean): Promise<void> =>
- ipcRenderer.invoke(XBOX_GAMEPAD_SET_LAYOUT_PREVIEW_CHANNEL, active),
- onStateChanged: (callback: (state: XboxGamepadState) => void): (() => void) => {
- const listener = (_event: Electron.IpcRendererEvent, state: XboxGamepadState): void => {
+ getState: (): Promise<GamepadAccessoriesState> =>
+ ipcRenderer.invoke(XBOX_GAMEPAD_GET_STATE_CHANNEL),
+ setSettings: (
+ family: GamepadFamily,
+ patch: XboxGamepadSettingsPatch,
+ ): Promise<GamepadAccessoriesState> =>
+ ipcRenderer.invoke(XBOX_GAMEPAD_SET_SETTINGS_CHANNEL, family, patch),
+ resetSettings: (family: GamepadFamily): Promise<GamepadAccessoriesState> =>
+ ipcRenderer.invoke(XBOX_GAMEPAD_RESET_SETTINGS_CHANNEL, family),
+ probe: (): Promise<GamepadAccessoriesState> => ipcRenderer.invoke(XBOX_GAMEPAD_PROBE_CHANNEL),
+ setLayoutPreviewActive: (active: boolean, family?: GamepadFamily): Promise<void> =>
+ ipcRenderer.invoke(
+ XBOX_GAMEPAD_SET_LAYOUT_PREVIEW_CHANNEL,
+ family === undefined ? active : { active, family },
+ ),
+ onStateChanged: (callback: (state: GamepadAccessoriesState) => void): (() => void) => {
+ const listener = (
+ _event: Electron.IpcRendererEvent,
+ state: GamepadAccessoriesState,
+ ): void => {
callback(state);
};
ipcRenderer.on(XBOX_GAMEPAD_STATE_CHANGED_CHANNEL, listener);
diff --git a/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx b/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx
index 99c51b65ff..14321926ac 100644
--- a/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx
@@ -51,6 +51,11 @@ import { useXboxGamepad } from '@/hooks/useXboxGamepad';
import { createLogger } from '@/lib/logger';
import { extractIpcError } from '@/utils/ipcError';
import { WorkLouderCodexEntry, WorkLouderCodexSettings } from './WorkLouderCodexSettings';
+import {
+ GAMEPAD_FAMILIES,
+ VISIBLE_GAMEPAD_FAMILIES,
+ type GamepadFamily,
+} from '../../../shared/xboxGamepad';
import { XboxGamepadEntry, XboxGamepadSettings } from './XboxGamepadSettings';
const log = createLogger('settings:keyboard-shortcuts');
@@ -62,7 +67,7 @@ function shouldShowHardwareOutside(device: {
return device.present === true || device.enabled === true;
}
-type HardwarePane = 'list' | 'accessories' | 'worklouder' | 'xbox';
+type HardwarePane = 'list' | 'accessories' | 'worklouder' | GamepadFamily;
function AccessoriesEntry({ onOpen }: { onOpen(): void }) {
const { t } = useTranslation();
@@ -114,16 +119,31 @@ export function KeyboardShortcutsSection() {
const [hardwarePane, setHardwarePane] = useState<HardwarePane>('list');
const [hardwareReturnTo, setHardwareReturnTo] = useState<'list' | 'accessories'>('list');
const workLouder = useWorkLouderCodex({ watchConnection: true });
- const xboxGamepad = useXboxGamepad({ watchConnection: true });
+ const xboxGamepad = useXboxGamepad({ family: 'xbox', watchConnection: true });
+ const playstationGamepad = useXboxGamepad({ family: 'playstation', watchConnection: true });
+ const nintendoGamepad = useXboxGamepad({ family: 'nintendo', watchConnection: true });
+ const genericGamepad = useXboxGamepad({ family: 'generic', watchConnection: true });
+ const gamepads = {
+ xbox: xboxGamepad,
+ playstation: playstationGamepad,
+ nintendo: nintendoGamepad,
+ generic: genericGamepad,
+ };
const workLouderConnected = shouldShowHardwareOutside({
present: workLouder.state?.devicePresent,
enabled: workLouder.state?.settings.deviceEnabled,
});
- const xboxConnected = shouldShowHardwareOutside({
- present: xboxGamepad.state?.devicePresent,
- enabled: xboxGamepad.state?.settings.deviceEnabled,
- });
- const hasAccessories = !workLouderConnected || !xboxConnected;
+ const gamepadConnected = Object.fromEntries(
+ GAMEPAD_FAMILIES.map((family) => [
+ family,
+ shouldShowHardwareOutside({
+ present: gamepads[family].state?.devicePresent,
+ enabled: gamepads[family].state?.settings.deviceEnabled,
+ }),
+ ]),
+ ) as Record<GamepadFamily, boolean>;
+ const hasAccessories =
+ !workLouderConnected || VISIBLE_GAMEPAD_FAMILIES.some((family) => !gamepadConnected[family]);
const showAccessoriesEntry = hasAccessories;
const [error, setError] = useState<RecordingError | null>(null);
const [globalError, setGlobalError] = useState<string | null>(null);
@@ -146,9 +166,9 @@ export function KeyboardShortcutsSection() {
setHardwareReturnTo(from);
setHardwarePane('worklouder');
};
- const openXbox = (from: 'list' | 'accessories') => {
+ const openGamepad = (family: GamepadFamily, from: 'list' | 'accessories') => {
setHardwareReturnTo(from);
- setHardwarePane('xbox');
+ setHardwarePane(family);
};
const mutationErrorMessage = useCallback(
@@ -325,8 +345,13 @@ export function KeyboardShortcutsSection() {
if (hardwarePane === 'worklouder') {
return <WorkLouderCodexSettings onBack={() => setHardwarePane(hardwareReturnTo)} />;
}
- if (hardwarePane === 'xbox') {
- return <XboxGamepadSettings onBack={() => setHardwarePane(hardwareReturnTo)} />;
+ if ((GAMEPAD_FAMILIES as readonly string[]).includes(hardwarePane)) {
+ return (
+ <XboxGamepadSettings
+ family={hardwarePane as GamepadFamily}
+ onBack={() => setHardwarePane(hardwareReturnTo)}
+ />
+ );
}
if (hardwarePane === 'accessories' && hasAccessories) {
return (
@@ -360,14 +385,16 @@ export function KeyboardShortcutsSection() {
onOpen={() => openWorkLouder('accessories')}
/>
)}
- {!xboxConnected && (
+ {VISIBLE_GAMEPAD_FAMILIES.filter((family) => !gamepadConnected[family]).map((family) => (
<XboxGamepadEntry
- state={xboxGamepad.state}
- loading={xboxGamepad.loading}
+ key={family}
+ family={family}
+ state={gamepads[family].state}
+ loading={gamepads[family].loading}
grouped
- onOpen={() => openXbox('accessories')}
+ onOpen={() => openGamepad(family, 'accessories')}
/>
- )}
+ ))}
</div>
</div>
);
@@ -398,13 +425,15 @@ export function KeyboardShortcutsSection() {
onOpen={() => openWorkLouder('list')}
/>
)}
- {xboxConnected && (
+ {VISIBLE_GAMEPAD_FAMILIES.filter((family) => gamepadConnected[family]).map((family) => (
<XboxGamepadEntry
- state={xboxGamepad.state}
- loading={xboxGamepad.loading}
- onOpen={() => openXbox('list')}
+ key={family}
+ family={family}
+ state={gamepads[family].state}
+ loading={gamepads[family].loading}
+ onOpen={() => openGamepad(family, 'list')}
/>
- )}
+ ))}
{showAccessoriesEntry && <AccessoriesEntry onOpen={() => setHardwarePane('accessories')} />}
<div
diff --git a/apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx b/apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx
new file mode 100644
index 0000000000..a3af83ccc0
--- /dev/null
+++ b/apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx
@@ -0,0 +1,437 @@
+import type { CSSProperties } from 'react';
+
+import { Tip } from '@/components/ui/tooltip';
+import { cn } from '@/lib/utils';
+import type { XboxGamepadButtonId, XboxGamepadStickId } from '../../../shared/xboxGamepad';
+
+import type {
+ XboxGamepadEditablePart,
+ XboxGamepadKeyHint,
+ XboxGamepadLayoutProps,
+} from './XboxGamepadLayout';
+import * as Art from './dualSenseSilhouette';
+import type { EllipseGeom, RectGeom } from './dualSenseSilhouette';
+
+/** Colleague DualSense art, already cropped to the display board. */
+const VIEWBOX = { x: 0, y: 0, w: 1050, h: 660 };
+
+const PRESS_FILL = 'currentColor';
+const PRESS_OPACITY = 0.2;
+const STICK_TRAVEL = 14;
+/** Cap fill so the moving stick occludes the well and the socket behind it. */
+const CARVE = 'var(--settings-theme-card-bg)';
+
+export function PlayStationGamepadLayout({
+ disabled = false,
+ hintFor,
+ onEdit,
+ preview,
+ labels,
+}: XboxGamepadLayoutProps) {
+ const pressed = (id: XboxGamepadButtonId) => preview?.buttons[id] ?? false;
+ const analog = (id: XboxGamepadStickId) => preview?.sticks[id] ?? { x: 0, y: 0 };
+ const trigger = (id: 'lt' | 'rt') => preview?.triggers[id] ?? 0;
+
+ return (
+ <div
+ className="relative mx-auto w-full max-w-[560px] text-[var(--text-primary)]"
+ data-testid="playstation-gamepad-layout"
+ style={{ aspectRatio: `${VIEWBOX.w} / ${VIEWBOX.h}` }}
+ >
+ <svg
+ viewBox={`${VIEWBOX.x} ${VIEWBOX.y} ${VIEWBOX.w} ${VIEWBOX.h}`}
+ className="pointer-events-none absolute inset-0 h-full w-full"
+ aria-hidden="true"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2.6"
+ strokeLinejoin="round"
+ strokeLinecap="round"
+ >
+ <path d={Art.BODY} strokeWidth="3" />
+ <path d={Art.BODY_LEFT} strokeWidth="2" />
+ <path d={Art.BODY_RIGHT} strokeWidth="2" />
+ <path d={Art.BUMPER_BOTTOM} strokeWidth="2" />
+ <GeomRect geom={Art.USB_PORT} strokeWidth={2} />
+
+ <Press d={Art.PRESS_L2} on={pressed('lt') || trigger('lt') > 0.08} />
+ <Press d={Art.PRESS_R2} on={pressed('rt') || trigger('rt') > 0.08} />
+ <Press d={Art.PRESS_L1} on={pressed('lb')} />
+ <Press d={Art.PRESS_R1} on={pressed('rb')} />
+
+ <path d={Art.L2_TICK} strokeWidth="2" />
+ <path d={Art.R2_TICK} strokeWidth="2" />
+ <path d={Art.L1_BODY} strokeWidth="2" />
+ <path d={Art.L1_CREASE} strokeWidth="2" />
+ <path d={Art.R1_BODY} strokeWidth="2" />
+ <path d={Art.R1_CREASE} strokeWidth="2" />
+
+ <path d={Art.TOUCHPAD_OUTER} strokeWidth="2" />
+ <path d={Art.TOUCHPAD_INNER} strokeWidth="2" />
+
+ <GeomRect geom={Art.CREATE_OUTER} strokeWidth={2} />
+ <GeomRect geom={Art.CREATE_INNER} strokeWidth={2} />
+ {Art.CREATE_BARS.map((bar, index) => (
+ <GeomRect key={index} geom={bar} fill="currentColor" stroke="none" />
+ ))}
+ <PressRect geom={Art.PRESS_CREATE} on={pressed('view')} />
+
+ <GeomRect geom={Art.OPTIONS_OUTER} strokeWidth={2} />
+ <GeomRect geom={Art.OPTIONS_INNER} strokeWidth={2} />
+ {Art.OPTIONS_BARS.map((bar, index) => (
+ <GeomRect key={index} geom={bar} fill="currentColor" stroke="none" />
+ ))}
+ <PressRect geom={Art.PRESS_OPTIONS} on={pressed('menu')} />
+
+ <path d={Art.PS_BUTTON} fill="currentColor" stroke="none" />
+ <Press d={Art.PRESS_PS} on={pressed('xbox')} />
+
+ {Art.SPEAKER_DOTS.map((dot, index) => (
+ <circle key={index} cx={dot.cx} cy={dot.cy} r={dot.r} fill="currentColor" stroke="none" />
+ ))}
+ <path d={Art.SPEAKER_BLOB} fill="currentColor" stroke="none" />
+
+ <GeomRect geom={Art.MUTE_BODY} strokeWidth={2} />
+ <path d={Art.MUTE_CREASE} strokeWidth="2" />
+
+ <Stick
+ well={Art.STICK_LEFT_WELL}
+ ring={Art.STICK_LEFT_RING}
+ cap={Art.STICK_LEFT_CAP}
+ socket={Art.STICK_LEFT_SOCKET}
+ press={Art.PRESS_STICK_LEFT}
+ analog={analog('left')}
+ clicked={pressed('ls')}
+ />
+ <Stick
+ well={Art.STICK_RIGHT_WELL}
+ ring={Art.STICK_RIGHT_RING}
+ cap={Art.STICK_RIGHT_CAP}
+ socket={Art.STICK_RIGHT_SOCKET}
+ press={Art.PRESS_STICK_RIGHT}
+ analog={analog('right')}
+ clicked={pressed('rs')}
+ />
+
+ <path d={Art.DPAD_UP_OUTER} strokeWidth="2" />
+ <path d={Art.DPAD_UP_INNER} strokeWidth="2" />
+ <polygon points={Art.DPAD_UP_ARROW} fill="currentColor" stroke="none" />
+ <path d={Art.DPAD_LEFT_OUTER} strokeWidth="2" />
+ <path d={Art.DPAD_LEFT_INNER} strokeWidth="2" />
+ <polygon points={Art.DPAD_LEFT_ARROW} fill="currentColor" stroke="none" />
+ <path d={Art.DPAD_RIGHT_OUTER} strokeWidth="2" />
+ <path d={Art.DPAD_RIGHT_INNER} strokeWidth="2" />
+ <polygon points={Art.DPAD_RIGHT_ARROW} fill="currentColor" stroke="none" />
+ <path d={Art.DPAD_DOWN_OUTER} strokeWidth="2" />
+ <path d={Art.DPAD_DOWN_INNER} strokeWidth="2" />
+ <polygon points={Art.DPAD_DOWN_ARROW} fill="currentColor" stroke="none" />
+ <Press d={Art.PRESS_DPAD_UP} on={pressed('dpadUp')} />
+ <Press d={Art.PRESS_DPAD_DOWN} on={pressed('dpadDown')} />
+ <Press d={Art.PRESS_DPAD_LEFT} on={pressed('dpadLeft')} />
+ <Press d={Art.PRESS_DPAD_RIGHT} on={pressed('dpadRight')} />
+
+ <GeomEllipse geom={Art.FACE_TRIANGLE_RING} />
+ <path d={Art.FACE_TRIANGLE_RING_PATH} />
+ <polygon points={Art.FACE_TRIANGLE_GLYPH} fill="none" stroke="currentColor" strokeWidth="5" />
+ <PressEllipse geom={Art.PRESS_TRIANGLE} on={pressed('y')} />
+
+ <GeomEllipse geom={Art.FACE_SQUARE_RING} />
+ <GeomEllipse geom={Art.FACE_SQUARE_RING_OUTER} />
+ <GeomRect geom={Art.FACE_SQUARE_GLYPH} strokeWidth={5} />
+ <PressEllipse geom={Art.PRESS_SQUARE} on={pressed('x')} />
+
+ <GeomEllipse geom={Art.FACE_CIRCLE_RING} />
+ <path d={Art.FACE_CIRCLE_RING_PATH} />
+ <GeomEllipse geom={Art.FACE_CIRCLE_GLYPH} strokeWidth={5} />
+ <PressEllipse geom={Art.PRESS_CIRCLE} on={pressed('b')} />
+
+ <GeomEllipse geom={Art.FACE_CROSS_RING} />
+ <path d={Art.FACE_CROSS_RING_PATH} />
+ <line
+ x1={Art.FACE_CROSS_LINE_A.x1}
+ y1={Art.FACE_CROSS_LINE_A.y1}
+ x2={Art.FACE_CROSS_LINE_A.x2}
+ y2={Art.FACE_CROSS_LINE_A.y2}
+ strokeWidth="5"
+ />
+ <line
+ x1={Art.FACE_CROSS_LINE_B.x1}
+ y1={Art.FACE_CROSS_LINE_B.y1}
+ x2={Art.FACE_CROSS_LINE_B.x2}
+ y2={Art.FACE_CROSS_LINE_B.y2}
+ strokeWidth="5"
+ />
+ <PressEllipse geom={Art.PRESS_CROSS} on={pressed('a')} />
+ </svg>
+
+ <svg
+ viewBox={`${VIEWBOX.x} ${VIEWBOX.y} ${VIEWBOX.w} ${VIEWBOX.h}`}
+ className="pointer-events-none absolute inset-0 z-[2] h-full w-full"
+ fill="none"
+ stroke="none"
+ >
+ <PathHit part="lt" d={Art.PRESS_L2} hint={hintFor('lt')} disabled={disabled} pressed={pressed('lt')} onEdit={onEdit} />
+ <PathHit part="rt" d={Art.PRESS_R2} hint={hintFor('rt')} disabled={disabled} pressed={pressed('rt')} onEdit={onEdit} />
+ <PathHit part="lb" d={Art.PRESS_L1} hint={hintFor('lb')} disabled={disabled} pressed={pressed('lb')} onEdit={onEdit} />
+ <PathHit part="rb" d={Art.PRESS_R1} hint={hintFor('rb')} disabled={disabled} pressed={pressed('rb')} onEdit={onEdit} />
+ <g data-testid="playstation-gamepad-dpad">
+ <PathHit part="dpadUp" d={Art.PRESS_DPAD_UP} hint={hintFor('dpadUp')} disabled={disabled} pressed={pressed('dpadUp')} onEdit={onEdit} />
+ <PathHit part="dpadDown" d={Art.PRESS_DPAD_DOWN} hint={hintFor('dpadDown')} disabled={disabled} pressed={pressed('dpadDown')} onEdit={onEdit} />
+ <PathHit part="dpadLeft" d={Art.PRESS_DPAD_LEFT} hint={hintFor('dpadLeft')} disabled={disabled} pressed={pressed('dpadLeft')} onEdit={onEdit} />
+ <PathHit part="dpadRight" d={Art.PRESS_DPAD_RIGHT} hint={hintFor('dpadRight')} disabled={disabled} pressed={pressed('dpadRight')} onEdit={onEdit} />
+ </g>
+ </svg>
+
+ <Hit part="xbox" hint={hintFor('xbox')} disabled={disabled} pressed={pressed('xbox')} onEdit={onEdit} box={[495, 438, 67, 39]} />
+ <Hit part="view" hint={hintFor('view')} disabled={disabled} pressed={pressed('view')} onEdit={onEdit} box={[245, 217, 34, 48]} />
+ <Hit part="menu" hint={hintFor('menu')} disabled={disabled} pressed={pressed('menu')} onEdit={onEdit} box={[775, 217, 34, 48]} />
+
+ <Hit
+ part="left"
+ hint={hintFor('left')}
+ disabled={disabled}
+ pressed={pressed('ls')}
+ onEdit={onEdit}
+ box={[276, 428, 158, 152]}
+ round
+ testId="playstation-gamepad-stick-left"
+ title={labels.leftStick}
+ />
+ <Hit
+ part="right"
+ hint={hintFor('right')}
+ disabled={disabled}
+ pressed={pressed('rs')}
+ onEdit={onEdit}
+ box={[618, 428, 158, 152]}
+ round
+ testId="playstation-gamepad-stick-right"
+ title={labels.rightStick}
+ />
+
+ <div data-testid="playstation-gamepad-face">
+ <Hit part="y" hint={hintFor('y')} disabled={disabled} pressed={pressed('y')} onEdit={onEdit} box={[844, 250, 65, 61]} round />
+ <Hit part="x" hint={hintFor('x')} disabled={disabled} pressed={pressed('x')} onEdit={onEdit} box={[760, 322, 65, 59]} round />
+ <Hit part="b" hint={hintFor('b')} disabled={disabled} pressed={pressed('b')} onEdit={onEdit} box={[920, 320, 65, 59]} round />
+ <Hit part="a" hint={hintFor('a')} disabled={disabled} pressed={pressed('a')} onEdit={onEdit} box={[838, 386, 65, 61]} round />
+ </div>
+ </div>
+ );
+}
+
+function boxStyle([x, y, w, h]: [number, number, number, number]): CSSProperties {
+ return {
+ left: `${((x - VIEWBOX.x) / VIEWBOX.w) * 100}%`,
+ top: `${((y - VIEWBOX.y) / VIEWBOX.h) * 100}%`,
+ width: `${(w / VIEWBOX.w) * 100}%`,
+ height: `${(h / VIEWBOX.h) * 100}%`,
+ };
+}
+
+function PathHit({
+ part,
+ d,
+ hint,
+ disabled,
+ pressed,
+ onEdit,
+}: {
+ part: XboxGamepadEditablePart;
+ d: string;
+ hint: XboxGamepadKeyHint;
+ disabled: boolean;
+ pressed: boolean;
+ onEdit(part: XboxGamepadEditablePart): void;
+}) {
+ const label = [hint.legend, hint.name].filter(Boolean).join(' ');
+ return (
+ <Tip text={<KeyHint hint={hint} />} side="top">
+ <path
+ d={d}
+ role="button"
+ tabIndex={disabled ? -1 : 0}
+ aria-label={label}
+ aria-pressed={pressed}
+ aria-disabled={disabled || undefined}
+ className={cn(
+ 'fill-transparent stroke-none hover:fill-current/20',
+ disabled ? 'pointer-events-none' : 'pointer-events-auto cursor-pointer',
+ 'focus-visible:outline-none focus-visible:stroke-[var(--focus-ring-soft)] focus-visible:stroke-2',
+ )}
+ onClick={() => {
+ if (!disabled) onEdit(part);
+ }}
+ onKeyDown={(event) => {
+ if (disabled) return;
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ onEdit(part);
+ }
+ }}
+ />
+ </Tip>
+ );
+}
+
+function Hit({
+ part,
+ hint,
+ disabled,
+ pressed,
+ onEdit,
+ box,
+ round = false,
+ testId,
+ title,
+}: {
+ part: XboxGamepadEditablePart;
+ hint: XboxGamepadKeyHint;
+ disabled: boolean;
+ pressed: boolean;
+ onEdit(part: XboxGamepadEditablePart): void;
+ box: [number, number, number, number];
+ round?: boolean;
+ testId?: string;
+ title?: string;
+}) {
+ const label = [hint.legend, hint.name].filter(Boolean).join(' ');
+ return (
+ <Tip text={<KeyHint hint={hint} />} side="top">
+ <button
+ type="button"
+ aria-label={label}
+ aria-pressed={pressed}
+ title={title}
+ disabled={disabled}
+ data-testid={testId}
+ onClick={() => onEdit(part)}
+ style={boxStyle(box)}
+ className={cn(
+ 'absolute z-[1] border-0 bg-transparent',
+ round ? 'rounded-full' : 'rounded-[8px]',
+ !disabled && 'cursor-pointer',
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]',
+ disabled && 'cursor-not-allowed opacity-60',
+ )}
+ />
+ </Tip>
+ );
+}
+
+function Press({ d, on }: { d: string; on: boolean }) {
+ if (!on) return null;
+ return <path d={d} fill={PRESS_FILL} fillOpacity={PRESS_OPACITY} stroke="none" />;
+}
+
+function PressEllipse({ geom, on }: { geom: EllipseGeom; on: boolean }) {
+ if (!on) return null;
+ return (
+ <ellipse
+ cx={geom.cx}
+ cy={geom.cy}
+ rx={geom.rx}
+ ry={geom.ry}
+ fill={PRESS_FILL}
+ fillOpacity={PRESS_OPACITY}
+ stroke="none"
+ />
+ );
+}
+
+function PressRect({ geom, on }: { geom: RectGeom; on: boolean }) {
+ if (!on) return null;
+ return <GeomRect geom={geom} fill={PRESS_FILL} fillOpacity={PRESS_OPACITY} stroke="none" />;
+}
+
+function GeomEllipse({
+ geom,
+ fill,
+ strokeWidth,
+}: {
+ geom: EllipseGeom;
+ fill?: string;
+ strokeWidth?: number;
+}) {
+ return (
+ <ellipse
+ cx={geom.cx}
+ cy={geom.cy}
+ rx={geom.rx}
+ ry={geom.ry}
+ fill={fill}
+ strokeWidth={strokeWidth}
+ />
+ );
+}
+
+function GeomRect({
+ geom,
+ fill,
+ fillOpacity,
+ stroke,
+ strokeWidth,
+}: {
+ geom: RectGeom;
+ fill?: string;
+ fillOpacity?: number;
+ stroke?: string;
+ strokeWidth?: number;
+}) {
+ return (
+ <rect
+ x={geom.x}
+ y={geom.y}
+ width={geom.width}
+ height={geom.height}
+ rx={geom.rx}
+ ry={geom.ry}
+ transform={geom.transform}
+ fill={fill}
+ fillOpacity={fillOpacity}
+ stroke={stroke}
+ strokeWidth={strokeWidth}
+ />
+ );
+}
+
+function Stick({
+ well,
+ ring,
+ cap,
+ socket,
+ press,
+ analog,
+ clicked,
+}: {
+ well: EllipseGeom;
+ ring: EllipseGeom;
+ cap: string;
+ socket: EllipseGeom;
+ press: string;
+ analog: { x: number; y: number };
+ clicked: boolean;
+}) {
+ const dx = Math.max(-1, Math.min(1, analog.x)) * STICK_TRAVEL;
+ const dy = -Math.max(-1, Math.min(1, analog.y)) * STICK_TRAVEL;
+ return (
+ <g>
+ <GeomEllipse geom={well} />
+ <GeomEllipse geom={socket} />
+ <g transform={`translate(${dx} ${dy})`}>
+ <GeomEllipse geom={ring} fill={CARVE} />
+ <path d={cap} fill={CARVE} />
+ {clicked && <Press d={press} on />}
+ </g>
+ </g>
+ );
+}
+
+function KeyHint({ hint }: { hint: XboxGamepadKeyHint }) {
+ return (
+ <span className="flex flex-col gap-0.5">
+ <span className="font-semibold">{hint.legend}</span>
+ {hint.name && <span>{hint.name}</span>}
+ {hint.description && <span className="text-[var(--text-tertiary)]">{hint.description}</span>}
+ </span>
+ );
+}
diff --git a/apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx b/apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx
index 77a3d19964..6cbedce3fb 100644
--- a/apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx
+++ b/apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx
@@ -8,6 +8,7 @@ import type {
XboxGamepadPreviewInput,
XboxGamepadStickId,
} from '../../../shared/xboxGamepad';
+import * as Art from './xboxSeriesSilhouette';
export type XboxGamepadEditablePart = XboxGamepadButtonId | XboxGamepadStickId;
@@ -27,62 +28,25 @@ export interface XboxGamepadLayoutProps {
leftStick: string;
rightStick: string;
};
+ /** Switch Pro shares the Xbox stick layout; only the printed chrome changes. */
+ variant?: 'xbox' | 'nintendo';
}
-/**
- * Drawn over Dash's Xbox Series line-art in its own pixel grid, then verified
- * by rasterizing this SVG and diffing it against that reference — every
- * coordinate below is measured, not guessed. The viewBox is the reference
- * crop, so a measurement on the picture can be used here as-is.
- */
-const VIEWBOX = { x: 60, y: 80, w: 1050, h: 660 };
+/** Colleague Xbox Series art, already cropped to the display board. */
+const VIEWBOX = { x: 0, y: 0, w: 1050, h: 660 };
-/** Outer silhouette traced along the reference's outline stroke. */
-const BODY_PATH =
- 'M 282 89 C 286 89 292 88 297 89 C 302 90 306 91 310 93 C 314 95 317 97 320 102 C 324 108 327 122 331 126 C 335 131 336 129 342 129 C 349 129 363 128 370 128 C 377 128 380 129 384 130 C 388 131 393 134 396 136 C 400 139 402 143 405 145 C 409 148 413 150 417 151 C 421 152 422 153 431 153 C 440 153 459 153 473 153 C 487 153 501 153 515 153 C 529 153 543 153 557 153 C 571 153 585 153 599 153 C 613 153 627 153 641 153 C 655 153 669 153 683 153 C 697 153 716 153 725 153 C 734 153 734 153 739 153 C 744 153 749 153 753 151 C 757 150 761 147 765 144 C 769 141 771 138 775 135 C 779 133 783 130 787 129 C 791 128 794 128 801 128 C 808 128 823 130 829 129 C 836 128 836 129 840 124 C 844 119 848 105 852 100 C 856 95 859 94 863 92 C 867 90 872 89 876 89 C 881 89 886 89 890 90 C 895 91 899 92 903 94 C 907 96 909 96 914 103 C 919 111 928 127 935 139 C 942 151 951 165 957 175 C 963 185 967 193 971 199 C 975 205 976 201 980 209 C 984 217 991 234 996 246 C 1001 259 1006 271 1011 284 C 1016 297 1021 310 1026 323 C 1031 336 1036 348 1041 361 C 1046 374 1051 386 1055 399 C 1060 412 1064 424 1068 437 C 1072 450 1076 463 1080 476 C 1084 489 1087 502 1090 515 C 1093 528 1096 546 1098 555 C 1100 564 1100 562 1101 569 C 1102 576 1103 588 1103 597 C 1103 606 1102 616 1101 625 C 1100 634 1099 641 1095 651 C 1091 661 1082 677 1075 686 C 1069 695 1065 699 1056 705 C 1047 711 1030 719 1020 723 C 1010 727 1001 729 994 730 C 987 731 989 732 980 730 C 971 728 954 723 941 718 C 929 713 917 705 905 698 C 893 691 881 685 869 678 C 857 671 843 663 833 658 C 823 653 820 649 809 646 C 798 643 782 640 768 639 C 754 638 740 639 726 639 C 712 639 698 639 684 639 C 670 639 656 639 642 639 C 628 639 614 639 600 639 C 586 639 572 639 558 639 C 544 639 530 639 516 639 C 502 639 488 639 474 639 C 460 639 444 639 432 639 C 420 639 413 638 404 639 C 395 640 383 642 376 643 C 369 644 371 643 363 646 C 355 650 338 658 326 664 C 314 670 302 677 290 684 C 278 691 266 698 254 704 C 242 711 228 719 218 723 C 208 727 199 729 192 730 C 185 731 187 732 178 730 C 169 728 150 723 139 719 C 129 715 121 710 115 706 C 109 702 108 700 104 697 C 101 694 98 692 94 686 C 90 680 82 668 79 662 C 76 656 76 658 74 649 C 72 640 68 620 67 608 C 66 597 66 589 67 580 C 68 571 70 563 72 552 C 74 541 77 525 80 512 C 83 499 89 482 91 473 C 93 464 93 464 94 460 C 95 456 98 451 99 447 C 100 443 99 443 102 434 C 105 426 111 409 116 396 C 121 383 126 370 131 357 C 136 344 141 332 146 319 C 151 306 156 294 161 281 C 166 268 172 254 176 243 C 180 232 183 223 186 217 C 189 211 190 209 193 205 C 196 201 197 202 202 194 C 207 186 217 170 224 158 C 231 146 238 133 244 123 C 250 113 255 104 259 99 C 264 94 267 94 271 92 C 275 90 278 90 282 89 Z';
-
-/**
- * The d-pad is a raised cross on a disc. Each arm's sides run out to the disc
- * edge — the edge itself closes the arm tips — and the inner corners meet in
- * rounded fillets, so the middle is a true cross with no center plate.
- */
-/**
- * Public Xbox emblem (88×88), four petals. Scaled onto the guide button so
- * the X is the leftover gap — not two crossed strokes.
- */
-const XBOX_EMBLEM_PATH =
- 'M39.73 86.91c-6.628-.635-13.338-3.015-19.102-6.776-4.83-3.15-5.92-4.447-5.92-7.032 0-5.193 5.71-14.29 15.48-24.658 5.547-5.89 13.275-12.79 14.11-12.604 1.626.363 14.616 13.034 19.48 19 7.69 9.43 11.224 17.154 9.428 20.597-1.365 2.617-9.837 7.733-16.06 9.698-5.13 1.62-11.867 2.306-17.416 1.775zM8.184 67.703c-4.014-6.158-6.042-12.22-7.02-20.988-.324-2.895-.21-4.55.733-10.494 1.173-7.4 5.39-15.97 10.46-21.24 2.158-2.24 2.35-2.3 4.982-1.41 3.19 1.08 6.6 3.436 11.89 8.22l3.09 2.794-1.69 2.07c-7.828 9.61-16.09 23.24-19.2 31.67-1.69 4.58-2.37 9.18-1.64 11.095.49 1.294.04.812-1.61-1.714zm70.453 1.047c.397-1.936-.105-5.49-1.28-9.076-2.545-7.765-11.054-22.21-18.867-32.032l-2.46-3.092 2.662-2.443c3.474-3.19 5.886-5.1 8.49-6.723 2.053-1.28 4.988-2.413 6.25-2.413.777 0 3.516 2.85 5.726 5.95 3.424 4.8 5.942 10.63 7.218 16.69.825 3.92.894 12.3.133 16.21-.63 3.208-1.95 7.366-3.23 10.187-.97 2.113-3.36 6.218-4.41 7.554-.54.687-.54.686-.24-.796zM40.44 11.505C36.834 9.675 31.272 7.71 28.2 7.18c-1.076-.185-2.913-.29-4.08-.23-2.536.128-2.423-.004 1.643-1.925 3.38-1.597 6.2-2.536 10.03-3.34C40.098.78 48.193.77 52.43 1.663c4.575.965 9.964 2.97 13 4.84l.904.554-2.07-.104C60.148 6.745 54.15 8.408 47.71 11.54c-1.942.946-3.63 1.7-3.754 1.68-.123-.024-1.706-.795-3.52-1.715z';
-
-const DPAD_DISC = { cx: 447, cy: 522, rx: 75, ry: 72 };
-
-/**
- * Arm sides run out to the disc. Endpoints are the ellipse intersections so
- * the disc stroke itself closes each tip — no flat chord.
- */
-const DPAD_CROSS_PATH = [
- 'M 421 454.5 V 486 Q 421 496 411 496 H 377.1',
- 'M 377.1 548 H 411 Q 421 548 421 558 V 589.5',
- 'M 473 589.5 V 558 Q 473 548 483 548 H 516.9',
- 'M 516.9 496 H 483 Q 473 496 473 486 V 454.5',
-].join(' ');
-
-type Point = [number, number];
-
-const LEFT_STICK: Point = [311, 366];
-const RIGHT_STICK: Point = [724, 524];
-const FACE: Record<'y' | 'x' | 'b' | 'a', Point> = {
- y: [861, 296],
- x: [787, 369],
- b: [931, 360],
- a: [860, 432],
-};
-
-/** Backing color for carved / inverted glyphs — the card the drawing sits on. */
-const CARVE = 'var(--settings-theme-card-bg)';
-
-/** Shared press overlay — same gray on every control. */
const PRESS_FILL = 'currentColor';
const PRESS_OPACITY = 0.2;
+const STICK_TRAVEL = 14;
+/** Cap fill so the moving stick occludes the well and the socket behind it. */
+const CARVE = 'var(--settings-theme-card-bg)';
+
+const FACE_CENTER = {
+ y: [803.7, 213.2] as const,
+ x: [728.2, 287.3] as const,
+ b: [873.9, 278.7] as const,
+ a: [799.6, 351.9] as const,
+};
export function XboxGamepadLayout({
disabled = false,
@@ -90,15 +54,17 @@ export function XboxGamepadLayout({
onEdit,
preview,
labels,
+ variant = 'xbox',
}: XboxGamepadLayoutProps) {
const pressed = (id: XboxGamepadButtonId) => preview?.buttons[id] ?? false;
const analog = (id: XboxGamepadStickId) => preview?.sticks[id] ?? { x: 0, y: 0 };
const trigger = (id: 'lt' | 'rt') => preview?.triggers[id] ?? 0;
+ const nintendo = variant === 'nintendo';
return (
<div
className="relative mx-auto w-full max-w-[560px] text-[var(--text-primary)]"
- data-testid="xbox-gamepad-layout"
+ data-testid={nintendo ? 'switch-gamepad-layout' : 'xbox-gamepad-layout'}
style={{ aspectRatio: `${VIEWBOX.w} / ${VIEWBOX.h}` }}
>
<svg
@@ -111,94 +77,161 @@ export function XboxGamepadLayout({
strokeLinejoin="round"
strokeLinecap="round"
>
- <path d={BODY_PATH} strokeWidth="3" />
-
- {/* Trigger horns light up on pull; the horn itself is part of the outline. */}
- <HornFill side="left" on={pressed('lt') || trigger('lt') > 0.08} />
- <HornFill side="right" on={pressed('rt') || trigger('rt') > 0.08} />
-
- {/*
- * The bumper bar is its own plastic piece. Its top edge runs from the
- * shoulder tip, behind the trigger horn, down onto the deck; the seam
- * below runs tip to tip; the short vertical notches are where LB / RB
- * end against the center deck.
- */}
- <path d="M 205 198 C 214 178 226 161 240 149 C 272 143 300 140 332 137 C 362 139 390 145 416 152" />
- <path d="M 965 198 C 956 178 944 161 930 149 C 898 143 870 140 838 137 C 808 139 780 145 754 152" />
- <path d="M 205 199 C 290 191 360 188 435 188 C 535 186 635 186 735 188 C 810 188 880 191 965 199" />
- <path d="M 437 154 L 435 187 M 736 152 L 734 187" />
- <path d="M 440 172 C 545 170 640 170 731 172" />
- <BumperFill side="left" on={pressed('lb')} />
- <BumperFill side="right" on={pressed('rb')} />
-
- {/* Pairing oval and its ))) marks. */}
- <ellipse cx="505" cy="164" rx="12" ry="6" />
- <path d="M 527 159 C 529 162 529 166 527 169 M 535 158 C 538 161 538 167 535 170 M 543 156 C 547 160 547 168 543 172" />
-
- {/* Each trigger horn's near edge, wrapping down to the bumper. */}
- <path d="M 262 141 C 264 130 266 119 270 108 M 908 141 C 906 130 904 119 900 108" />
-
- <Stick center={LEFT_STICK} analog={analog('left')} clicked={pressed('ls')} />
- <Stick center={RIGHT_STICK} analog={analog('right')} clicked={pressed('rs')} />
-
- {/* D-pad disc and raised cross; pressed fill is clipped to the disc so tips follow the rim. */}
- <ellipse cx={DPAD_DISC.cx} cy={DPAD_DISC.cy} rx={DPAD_DISC.rx} ry={DPAD_DISC.ry} />
- <path d={DPAD_CROSS_PATH} />
- <clipPath id="xbox-dpad-disc">
- <ellipse cx={DPAD_DISC.cx} cy={DPAD_DISC.cy} rx={DPAD_DISC.rx} ry={DPAD_DISC.ry} />
- </clipPath>
- <g clipPath="url(#xbox-dpad-disc)" fill={PRESS_FILL} fillOpacity={PRESS_OPACITY} stroke="none">
- {pressed('dpadUp') && <rect x="421" y="448" width="52" height="48" />}
- {pressed('dpadDown') && <rect x="421" y="548" width="52" height="48" />}
- {pressed('dpadLeft') && <rect x="370" y="496" width="51" height="52" />}
- {pressed('dpadRight') && <rect x="473" y="496" width="51" height="52" />}
- </g>
-
- <FaceButton center={FACE.y} label="Y" pressed={pressed('y')} />
- <FaceButton center={FACE.x} label="X" pressed={pressed('x')} />
- <FaceButton center={FACE.b} label="B" pressed={pressed('b')} />
- <FaceButton center={FACE.a} label="A" pressed={pressed('a')} />
+ <path d={Art.BODY} strokeWidth="3" />
+
+ <Press d={Art.PRESS_LT} on={pressed('lt') || trigger('lt') > 0.08} />
+ <Press d={Art.PRESS_RT} on={pressed('rt') || trigger('rt') > 0.08} />
+ <Press d={Art.PRESS_LB} on={pressed('lb')} />
+ <Press d={Art.PRESS_RB} on={pressed('rb')} />
+
+ <path d={Art.BUMPER_TOP} />
+ <path d={Art.BUMPER_MID} />
+ <path d={Art.BUMPER_BOTTOM} />
+ <path d={Art.BUMPER_NOTCH} />
+ <path d={Art.LT_TICK} />
+ <path d={Art.RT_TICK} />
+
+ {!nintendo && (
+ <g>
+ <path d={Art.PAIRING_PILL} />
+ <path d={Art.PAIRING_CREASE} />
+ <path d={Art.PAIRING_CHEVRON_1} />
+ <path d={Art.PAIRING_CHEVRON_2} />
+ <path d={Art.PAIRING_CHEVRON_3} />
+ </g>
+ )}
- {/* View: two stacked screens, front one occludes the back. */}
- <circle
- cx="509"
- cy="369"
- r="22"
- fill={pressed('view') ? PRESS_FILL : 'none'}
- fillOpacity={pressed('view') ? PRESS_OPACITY : undefined}
+ <Stick
+ well={Art.STICK_LEFT_WELL}
+ ring={Art.STICK_LEFT_RING}
+ cap={Art.STICK_LEFT_CAP}
+ dish={Art.STICK_LEFT_DISH}
+ press={Art.PRESS_STICK_LEFT}
+ socket={{ cx: 250.04, cy: 271.0, r: 34.71 }}
+ analog={analog('left')}
+ clicked={pressed('ls')}
/>
- <g stroke="currentColor" strokeWidth="1.8">
- <rect x="500" y="360" width="11" height="11" rx="1.6" fill="none" />
- <rect x="507" y="366" width="11" height="11" rx="1.6" fill={CARVE} />
- </g>
- <circle
- cx="661"
- cy="369"
- r="22"
- fill={pressed('menu') ? PRESS_FILL : 'none'}
- fillOpacity={pressed('menu') ? PRESS_OPACITY : undefined}
+ <Stick
+ well={Art.STICK_RIGHT_WELL}
+ ring={Art.STICK_RIGHT_RING}
+ cap={Art.STICK_RIGHT_CAP}
+ dish={Art.STICK_RIGHT_DISH}
+ press={Art.PRESS_STICK_RIGHT}
+ socket={{ cx: 661.92, cy: 427.49, r: 33.68 }}
+ analog={analog('right')}
+ clicked={pressed('rs')}
/>
- <path d="M 654 362 H 668 M 654 369 H 668 M 654 376 H 668" stroke="currentColor" strokeWidth="2" />
- {/* Share is decor: empty pill, no binding slot. */}
- <rect x="561.51" y="412.85" width="46.98" height="24.3" rx="12.15" />
- {/* Xbox guide: official four-petal emblem. The X is the gap between the leaves. */}
- <g transform="translate(546 222) scale(0.8409)" fill="currentColor" stroke="none">
- <path d={XBOX_EMBLEM_PATH} />
- </g>
- {pressed('xbox') && (
- <circle cx="583" cy="259" r="37" fill={PRESS_FILL} fillOpacity={PRESS_OPACITY} stroke="none" />
+ <path d={Art.DPAD_DISC_OUTER} />
+ <path d={Art.DPAD_DISC_INNER} />
+ <path d={Art.DPAD_CROSS} />
+ <path d={Art.DPAD_CENTER} />
+ <path d={Art.DPAD_SEAMS} />
+ <Press d={Art.PRESS_DPAD_UP} on={pressed('dpadUp')} />
+ <Press d={Art.PRESS_DPAD_DOWN} on={pressed('dpadDown')} />
+ <Press d={Art.PRESS_DPAD_LEFT} on={pressed('dpadLeft')} />
+ <Press d={Art.PRESS_DPAD_RIGHT} on={pressed('dpadRight')} />
+
+ <path d={Art.FACE_Y_OUTER} />
+ <path d={Art.FACE_Y_INNER} />
+ <path d={Art.FACE_X_OUTER} />
+ <path d={Art.FACE_X_INNER} />
+ <path d={Art.FACE_B_OUTER} />
+ <path d={Art.FACE_B_INNER} />
+ <path d={Art.FACE_A_OUTER} />
+ <path d={Art.FACE_A_INNER} />
+ {nintendo ? (
+ <>
+ <FaceLetter center={FACE_CENTER.y} label="X" />
+ <FaceLetter center={FACE_CENTER.x} label="Y" />
+ <FaceLetter center={FACE_CENTER.b} label="A" />
+ <FaceLetter center={FACE_CENTER.a} label="B" />
+ </>
+ ) : (
+ <g fill="currentColor" stroke="none">
+ <path d={Art.FACE_Y_GLYPH} />
+ <path d={Art.FACE_X_GLYPH} />
+ <path d={Art.FACE_B_GLYPH} />
+ <path d={Art.FACE_A_GLYPH} />
+ </g>
+ )}
+ <Press d={Art.PRESS_Y} on={pressed('y')} />
+ <Press d={Art.PRESS_X} on={pressed('x')} />
+ <Press d={Art.PRESS_B} on={pressed('b')} />
+ <Press d={Art.PRESS_A} on={pressed('a')} />
+
+ <path d={Art.VIEW_OUTER} />
+ <path d={Art.VIEW_INNER} />
+ {nintendo ? (
+ <path d="M 436.2 289.1 H 456.2" strokeWidth="2.4" />
+ ) : (
+ <g fill="currentColor" stroke="none">
+ <path d={Art.VIEW_GLYPH_WINDOWS} />
+ <path d={Art.VIEW_GLYPH_STACK} />
+ </g>
+ )}
+ <Press d={Art.PRESS_VIEW} on={pressed('view')} />
+
+ <path d={Art.MENU_OUTER} />
+ <path d={Art.MENU_INNER} />
+ {nintendo ? (
+ <path d="M 592.4 288.4 H 612.4 M 602.4 278.4 V 298.4" strokeWidth="2.4" />
+ ) : (
+ <g fill="currentColor" stroke="none">
+ <path d={Art.MENU_BAR_1} />
+ <path d={Art.MENU_BAR_2} />
+ <path d={Art.MENU_BAR_3} />
+ </g>
+ )}
+ <Press d={Art.PRESS_MENU} on={pressed('menu')} />
+
+ {/* Share is decoration: capsule only, no binding slot. */}
+ <path d={Art.SHARE_OUTER} />
+ <path d={Art.SHARE_INNER} />
+
+ {nintendo ? (
+ <>
+ <circle
+ cx="524.4"
+ cy="179.7"
+ r="28"
+ fill={pressed('xbox') ? PRESS_FILL : 'none'}
+ fillOpacity={pressed('xbox') ? PRESS_OPACITY : undefined}
+ />
+ <path
+ d="M 524.4 162 L 540 174 V 196 H 532 V 186 H 516.8 V 196 H 508.8 V 174 Z"
+ strokeWidth="2"
+ />
+ </>
+ ) : (
+ <>
+ <path d={Art.GUIDE_EMBLEM} fill="currentColor" stroke="none" />
+ <Press d={Art.PRESS_GUIDE} on={pressed('xbox')} />
+ </>
)}
</svg>
- <Hit part="lt" hint={hintFor('lt')} disabled={disabled} pressed={pressed('lt')} onEdit={onEdit} box={[238, 86, 96, 62]} />
- <Hit part="rt" hint={hintFor('rt')} disabled={disabled} pressed={pressed('rt')} onEdit={onEdit} box={[836, 86, 96, 62]} />
- <Hit part="lb" hint={hintFor('lb')} disabled={disabled} pressed={pressed('lb')} onEdit={onEdit} box={[205, 136, 232, 64]} />
- <Hit part="rb" hint={hintFor('rb')} disabled={disabled} pressed={pressed('rb')} onEdit={onEdit} box={[734, 136, 231, 64]} />
+ <svg
+ viewBox={`${VIEWBOX.x} ${VIEWBOX.y} ${VIEWBOX.w} ${VIEWBOX.h}`}
+ className="pointer-events-none absolute inset-0 z-[2] h-full w-full"
+ fill="none"
+ stroke="none"
+ >
+ <PathHit part="lt" d={Art.PRESS_LT} hint={hintFor('lt')} disabled={disabled} pressed={pressed('lt')} onEdit={onEdit} />
+ <PathHit part="rt" d={Art.PRESS_RT} hint={hintFor('rt')} disabled={disabled} pressed={pressed('rt')} onEdit={onEdit} />
+ <PathHit part="lb" d={Art.PRESS_LB} hint={hintFor('lb')} disabled={disabled} pressed={pressed('lb')} onEdit={onEdit} />
+ <PathHit part="rb" d={Art.PRESS_RB} hint={hintFor('rb')} disabled={disabled} pressed={pressed('rb')} onEdit={onEdit} />
+ <g data-testid="xbox-gamepad-dpad">
+ <PathHit part="dpadUp" d={Art.PRESS_DPAD_UP} hint={hintFor('dpadUp')} disabled={disabled} pressed={pressed('dpadUp')} onEdit={onEdit} />
+ <PathHit part="dpadDown" d={Art.PRESS_DPAD_DOWN} hint={hintFor('dpadDown')} disabled={disabled} pressed={pressed('dpadDown')} onEdit={onEdit} />
+ <PathHit part="dpadLeft" d={Art.PRESS_DPAD_LEFT} hint={hintFor('dpadLeft')} disabled={disabled} pressed={pressed('dpadLeft')} onEdit={onEdit} />
+ <PathHit part="dpadRight" d={Art.PRESS_DPAD_RIGHT} hint={hintFor('dpadRight')} disabled={disabled} pressed={pressed('dpadRight')} onEdit={onEdit} />
+ </g>
+ </svg>
- <Hit part="xbox" hint={hintFor('xbox')} disabled={disabled} pressed={pressed('xbox')} onEdit={onEdit} box={[546, 222, 74, 74]} round />
- <Hit part="view" hint={hintFor('view')} disabled={disabled} pressed={pressed('view')} onEdit={onEdit} box={[485, 345, 48, 48]} round />
- <Hit part="menu" hint={hintFor('menu')} disabled={disabled} pressed={pressed('menu')} onEdit={onEdit} box={[637, 345, 48, 48]} round />
+ <Hit part="xbox" hint={hintFor('xbox')} disabled={disabled} pressed={pressed('xbox')} onEdit={onEdit} box={[484.3, 139.1, 80.3, 81.1]} />
+ <Hit part="view" hint={hintFor('view')} disabled={disabled} pressed={pressed('view')} onEdit={onEdit} box={[424.7, 268.3, 42.9, 41.6]} round />
+ <Hit part="menu" hint={hintFor('menu')} disabled={disabled} pressed={pressed('menu')} onEdit={onEdit} box={[582.0, 268.1, 40.6, 40.7]} round />
<Hit
part="left"
@@ -206,7 +239,7 @@ export function XboxGamepadLayout({
disabled={disabled}
pressed={pressed('ls')}
onEdit={onEdit}
- box={[234, 292, 154, 148]}
+ box={[182.7, 237.3, 123.9, 128.7]}
round
testId="xbox-gamepad-stick-left"
title={labels.leftStick}
@@ -217,24 +250,17 @@ export function XboxGamepadLayout({
disabled={disabled}
pressed={pressed('rs')}
onEdit={onEdit}
- box={[647, 449, 154, 150]}
+ box={[600.6, 394.4, 123.6, 129.6]}
round
testId="xbox-gamepad-stick-right"
title={labels.rightStick}
/>
<div data-testid="xbox-gamepad-face">
- <Hit part="y" hint={hintFor('y')} disabled={disabled} pressed={pressed('y')} onEdit={onEdit} box={[825, 260, 72, 72]} round />
- <Hit part="x" hint={hintFor('x')} disabled={disabled} pressed={pressed('x')} onEdit={onEdit} box={[751, 333, 72, 72]} round />
- <Hit part="b" hint={hintFor('b')} disabled={disabled} pressed={pressed('b')} onEdit={onEdit} box={[895, 324, 72, 72]} round />
- <Hit part="a" hint={hintFor('a')} disabled={disabled} pressed={pressed('a')} onEdit={onEdit} box={[824, 396, 72, 72]} round />
- </div>
-
- <div data-testid="xbox-gamepad-dpad">
- <Hit part="dpadUp" hint={hintFor('dpadUp')} disabled={disabled} pressed={pressed('dpadUp')} onEdit={onEdit} box={[423, 459, 52, 38]} />
- <Hit part="dpadLeft" hint={hintFor('dpadLeft')} disabled={disabled} pressed={pressed('dpadLeft')} onEdit={onEdit} box={[383, 497, 40, 52]} />
- <Hit part="dpadRight" hint={hintFor('dpadRight')} disabled={disabled} pressed={pressed('dpadRight')} onEdit={onEdit} box={[475, 497, 42, 52]} />
- <Hit part="dpadDown" hint={hintFor('dpadDown')} disabled={disabled} pressed={pressed('dpadDown')} onEdit={onEdit} box={[423, 549, 52, 40]} />
+ <Hit part="y" hint={hintFor('y')} disabled={disabled} pressed={pressed('y')} onEdit={onEdit} box={[768.8, 180.6, 69.9, 65.2]} round />
+ <Hit part="x" hint={hintFor('x')} disabled={disabled} pressed={pressed('x')} onEdit={onEdit} box={[693.2, 253.8, 70.0, 67.1]} round />
+ <Hit part="b" hint={hintFor('b')} disabled={disabled} pressed={pressed('b')} onEdit={onEdit} box={[840.4, 245.5, 67.0, 66.5]} round />
+ <Hit part="a" hint={hintFor('a')} disabled={disabled} pressed={pressed('a')} onEdit={onEdit} box={[767.0, 319.9, 65.2, 64.1]} round />
</div>
</div>
);
@@ -249,6 +275,51 @@ function boxStyle([x, y, w, h]: [number, number, number, number]): CSSProperties
};
}
+function PathHit({
+ part,
+ d,
+ hint,
+ disabled,
+ pressed,
+ onEdit,
+}: {
+ part: XboxGamepadEditablePart;
+ d: string;
+ hint: XboxGamepadKeyHint;
+ disabled: boolean;
+ pressed: boolean;
+ onEdit(part: XboxGamepadEditablePart): void;
+}) {
+ const label = [hint.legend, hint.name].filter(Boolean).join(' ');
+ return (
+ <Tip text={<KeyHint hint={hint} />} side="top">
+ <path
+ d={d}
+ role="button"
+ tabIndex={disabled ? -1 : 0}
+ aria-label={label}
+ aria-pressed={pressed}
+ aria-disabled={disabled || undefined}
+ className={cn(
+ 'fill-transparent stroke-none hover:fill-current/20',
+ disabled ? 'pointer-events-none' : 'pointer-events-auto cursor-pointer',
+ 'focus-visible:outline-none focus-visible:stroke-[var(--focus-ring-soft)] focus-visible:stroke-2',
+ )}
+ onClick={() => {
+ if (!disabled) onEdit(part);
+ }}
+ onKeyDown={(event) => {
+ if (disabled) return;
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ onEdit(part);
+ }
+ }}
+ />
+ </Tip>
+ );
+}
+
function Hit({
part,
hint,
@@ -294,120 +365,62 @@ function Hit({
);
}
-/** Translucent fill inside the horn outline while the trigger is pulled. */
-function HornFill({ side, on }: { side: 'left' | 'right'; on: boolean }) {
+function Press({ d, on }: { d: string; on: boolean }) {
if (!on) return null;
- const d =
- side === 'left'
- ? [
- 'M 224 158',
- 'C 231 146 238 133 244 123',
- 'C 250 113 255 104 259 99',
- 'C 264 94 267 94 271 92',
- 'C 275 90 278 90 282 89',
- 'C 286 89 292 88 297 89',
- 'C 302 90 306 91 310 93',
- 'C 314 95 317 97 320 102',
- 'C 324 108 327 122 331 126',
- 'L 332 137',
- 'C 300 140 272 143 240 149',
- 'Z',
- ].join(' ')
- : [
- 'M 840 124',
- 'C 844 119 848 105 852 100',
- 'C 856 95 859 94 863 92',
- 'C 867 90 872 89 876 89',
- 'C 881 89 886 89 890 90',
- 'C 895 91 899 92 903 94',
- 'C 907 96 909 96 914 103',
- 'C 919 111 928 127 935 139',
- 'L 930 149',
- 'C 898 143 870 140 838 137',
- 'Z',
- ].join(' ');
return <path d={d} fill={PRESS_FILL} fillOpacity={PRESS_OPACITY} stroke="none" />;
}
-/** Translucent fill over the bumper segment while it is held. */
-function BumperFill({ side, on }: { side: 'left' | 'right'; on: boolean }) {
- if (!on) return null;
- const d =
- side === 'left'
- ? 'M 205 198 C 214 178 226 161 240 149 C 272 143 300 140 332 137 C 362 139 390 145 416 152 L 437 154 L 435 188 C 360 188 290 191 205 199 Z'
- : 'M 965 198 C 956 178 944 161 930 149 C 898 143 870 140 838 137 C 808 139 780 145 754 152 L 736 152 L 734 188 C 810 188 880 191 965 199 Z';
- return <path d={d} fill={PRESS_FILL} fillOpacity={PRESS_OPACITY} stroke="none" />;
-}
-
-/**
- * A stick seen from above. The camera looks down into the recessed well, so
- * everything stacks toward the near (lower) side: the cap sits low in the
- * well, the concave top's floor sits low inside the cap — you look into the
- * dish, its far wall visible at the top. The leftover far-rim arc is completed
- * into a full circle behind the cap so the socket can be judged as a ring.
- * The cap group follows the live analog value.
- */
function Stick({
- center,
+ well,
+ ring,
+ cap,
+ dish,
+ press,
+ socket,
analog,
clicked,
}: {
- center: Point;
+ well: string;
+ ring: string;
+ cap: string;
+ dish: string;
+ press: string;
+ socket: { cx: number; cy: number; r: number };
analog: { x: number; y: number };
clicked: boolean;
}) {
- const [cx, cy] = center;
- const dx = Math.max(-1, Math.min(1, analog.x)) * 14;
- const dy = -Math.max(-1, Math.min(1, analog.y)) * 14;
+ const dx = Math.max(-1, Math.min(1, analog.x)) * STICK_TRAVEL;
+ const dy = -Math.max(-1, Math.min(1, analog.y)) * STICK_TRAVEL;
return (
<g>
- <ellipse cx={cx} cy={cy} rx="77" ry="72" />
- {/* Full socket circle fitted to the leftover far-rim crescent. */}
- <circle cx={cx - 2} cy={cy - 3.2} r="44.8" />
+ <path d={well} />
+ <path d={ring} />
+ <circle cx={socket.cx} cy={socket.cy} r={socket.r} />
<g transform={`translate(${dx} ${dy})`}>
- <circle cx={cx - 2} cy={cy + 14} r="53" fill={CARVE} />
- {clicked && (
- <circle cx={cx - 2} cy={cy + 14} r="53" fill={PRESS_FILL} fillOpacity={PRESS_OPACITY} />
- )}
- <circle cx={cx - 3} cy={cy + 22} r="41" />
+ <path d={cap} fill={CARVE} />
+ {clicked && <Press d={press} on />}
+ <path d={dish} />
</g>
</g>
);
}
-function FaceButton({
- center,
- label,
- pressed,
-}: {
- center: Point;
- label: string;
- pressed: boolean;
-}) {
+function FaceLetter({ center, label }: { center: readonly [number, number]; label: string }) {
const [cx, cy] = center;
return (
- <g>
- <circle
- cx={cx}
- cy={cy}
- r="36"
- fill={pressed ? PRESS_FILL : 'none'}
- fillOpacity={pressed ? PRESS_OPACITY : undefined}
- />
- <text
- x={cx}
- y={cy + 2}
- textAnchor="middle"
- dominantBaseline="middle"
- fill="currentColor"
- stroke="none"
- fontSize="28"
- fontWeight="600"
- fontFamily="Inter, system-ui, sans-serif"
- >
- {label}
- </text>
- </g>
+ <text
+ x={cx}
+ y={cy + 2}
+ textAnchor="middle"
+ dominantBaseline="middle"
+ fill="currentColor"
+ stroke="none"
+ fontSize="20"
+ fontWeight="600"
+ fontFamily="Inter, system-ui, sans-serif"
+ >
+ {label}
+ </text>
);
}
diff --git a/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx b/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx
index cf6d97970f..5b2517f159 100644
--- a/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx
+++ b/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx
@@ -29,6 +29,7 @@ import {
workLouderCodexCommandDescription,
workLouderCodexCommandName,
} from './workLouderCodexCommandCopy';
+import { PlayStationGamepadLayout } from './PlayStationGamepadLayout';
import {
XboxGamepadLayout,
type XboxGamepadEditablePart,
@@ -40,6 +41,7 @@ import {
createXboxGamepadDefaultLayout,
createXboxGamepadDefaultSettings,
XBOX_GAMEPAD_STICK_DIRECTIONS,
+ type GamepadFamily,
type XboxGamepadBinding,
type XboxGamepadButtonId,
type XboxGamepadConnectionStatus,
@@ -93,9 +95,7 @@ function XboxDeviceChips({ device }: { device: XboxGamepadDeviceInfo }) {
const label = deviceTitle(device);
return (
<div className="flex flex-wrap gap-2 pt-1">
- {label && (
- <DeviceChip icon={<Gamepad2 size={12} />}>{label}</DeviceChip>
- )}
+ {label && <DeviceChip icon={<Gamepad2 size={12} />}>{label}</DeviceChip>}
{device.transport === 'usb' && (
<DeviceChip icon={<Usb size={12} />}>
{t('settings.shortcuts.xboxGamepad.device.usb')}
@@ -131,18 +131,30 @@ function deviceTitle(device: XboxGamepadDeviceInfo): string | null {
return name || null;
}
+function gamepadCopyNs(
+ family: GamepadFamily,
+): 'xboxGamepad' | 'playstationGamepad' | 'nintendoGamepad' | 'genericGamepad' {
+ if (family === 'playstation') return 'playstationGamepad';
+ if (family === 'nintendo') return 'nintendoGamepad';
+ if (family === 'generic') return 'genericGamepad';
+ return 'xboxGamepad';
+}
+
export function XboxGamepadEntry({
+ family = 'xbox',
state,
loading,
grouped = false,
onOpen,
}: {
+ family?: GamepadFamily;
state: XboxGamepadState | null;
loading: boolean;
grouped?: boolean;
onOpen(): void;
}) {
const { t } = useTranslation();
+ const ns = gamepadCopyNs(family);
return (
<button
type="button"
@@ -154,17 +166,17 @@ export function XboxGamepadEntry({
: 'rounded-xl border p-4 border-[var(--settings-theme-card-border)] bg-[var(--settings-theme-card-bg)]',
'hover:bg-[var(--settings-menu-bg-hover)] focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]',
)}
- aria-label={t('settings.shortcuts.xboxGamepad.openAria')}
+ aria-label={t(`settings.shortcuts.${ns}.openAria`)}
>
<span className="flex size-10 shrink-0 items-center justify-center rounded-xl bg-[var(--surface-chip)] text-[var(--text-secondary)]">
<Gamepad2 size={18} aria-hidden="true" />
</span>
<span className="flex min-w-0 flex-1 flex-col gap-1">
<span className="truncate text-13 font-medium text-[var(--text-primary)]">
- {t('settings.shortcuts.xboxGamepad.title')}
+ {t(`settings.shortcuts.${ns}.title`)}
</span>
<span className="text-12 leading-[1.4] text-[var(--text-secondary)]">
- {t('settings.shortcuts.xboxGamepad.entryDescription')}
+ {t(`settings.shortcuts.${ns}.entryDescription`)}
</span>
</span>
<span className="flex shrink-0 items-center gap-2">
@@ -175,9 +187,15 @@ export function XboxGamepadEntry({
);
}
-export function XboxGamepadEntryContainer({ onOpen }: { onOpen(): void }) {
- const { state, loading } = useXboxGamepad({ watchConnection: true });
- return <XboxGamepadEntry state={state} loading={loading} onOpen={onOpen} />;
+export function XboxGamepadEntryContainer({
+ family = 'xbox',
+ onOpen,
+}: {
+ family?: GamepadFamily;
+ onOpen(): void;
+}) {
+ const { state, loading } = useXboxGamepad({ family, watchConnection: true });
+ return <XboxGamepadEntry family={family} state={state} loading={loading} onOpen={onOpen} />;
}
function isStickPart(part: XboxGamepadEditablePart): part is XboxGamepadStickId {
@@ -188,9 +206,17 @@ function stickClickButton(stick: XboxGamepadStickId): XboxGamepadButtonId {
return stick === 'left' ? 'ls' : 'rs';
}
-export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
+export function XboxGamepadSettings({
+ family,
+ onBack,
+}: {
+ family: GamepadFamily;
+ onBack(): void;
+}) {
const { t } = useTranslation();
+ const ns = gamepadCopyNs(family);
const { state, loading, saving, error, setSettings, resetSettings, reload } = useXboxGamepad({
+ family,
watchConnection: true,
});
const { skills, bootstrapped, refresh: refreshSkills } = useSkillhub();
@@ -208,8 +234,7 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
() => skills.filter((skill) => skill.kind === 'skill' && !skill.parseError),
[skills],
);
- const isDefault =
- state !== null && xboxGamepadSettingsMatchRestoreDefaults(settings);
+ const isDefault = state !== null && xboxGamepadSettingsMatchRestoreDefaults(settings);
useEffect(() => {
if (!bootstrapped) void refreshSkills();
@@ -217,18 +242,18 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
useEffect(() => {
const api = window.electronAPI?.xboxGamepad;
- void api?.setLayoutPreviewActive?.(true);
+ void api?.setLayoutPreviewActive?.(true, family);
return () => {
void api?.setLayoutPreviewActive?.(false);
};
- }, []);
+ }, [family]);
useEffect(() => {
const unsubscribe = window.electronAPI?.xboxGamepad?.onPreviewInput?.((input) => {
- setPreview(input);
+ if (input.family === family) setPreview(input);
});
return () => unsubscribe?.();
- }, []);
+ }, [family]);
const patchLayout = (update: (layout: XboxGamepadLayoutModel) => void): void => {
if (!state) return;
@@ -241,7 +266,7 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
if (isStickPart(part)) {
const stick = settings.layout.sticks[part];
return {
- legend: t(`settings.shortcuts.xboxGamepad.controls.${part}Stick`),
+ legend: t(familyControlKey(family, `${part}Stick`)),
name: stick
? t(`settings.shortcuts.xboxGamepad.stick.mode.options.${stick.mode}`)
: undefined,
@@ -250,7 +275,7 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
}
const binding = settings.layout.buttons[part] ?? null;
return {
- legend: t(`settings.shortcuts.xboxGamepad.controls.${part}`),
+ legend: t(familyControlKey(family, part)),
name: bindingLabel(binding, t) ?? t('settings.shortcuts.xboxGamepad.actions.none'),
description:
binding?.type === 'command'
@@ -274,7 +299,7 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
<ArrowLeft size={17} />
</button>
<h2 className="text-16 font-medium leading-[1.2] text-[var(--settings-section-title)]">
- {t('settings.shortcuts.xboxGamepad.title')}
+ {t(`settings.shortcuts.${ns}.title`)}
</h2>
</div>
<button
@@ -309,13 +334,13 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
onCheckedChange={(next) => {
void setSettings({ deviceEnabled: next });
}}
- aria-label={t('settings.shortcuts.xboxGamepad.connection.toggle.aria')}
+ aria-label={t(`settings.shortcuts.${ns}.connection.toggle.aria`)}
/>
<ConnectionBadge state={state} loading={loading} />
</div>
</div>
<p className="text-12 leading-[1.45] text-[var(--text-secondary)]">
- {t(`settings.shortcuts.xboxGamepad.connection.descriptions.${key}`)}
+ {t(`settings.shortcuts.${ns}.connection.descriptions.${key}`)}
</p>
{state?.devicePresent && <XboxDeviceChips device={state.device} />}
</div>
@@ -331,17 +356,32 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
</p>
</div>
<div className="flex justify-center">
- <XboxGamepadLayout
- layout={settings.layout}
- disabled={!state || saving}
- hintFor={hintFor}
- onEdit={setEditing}
- preview={preview}
- labels={{
- leftStick: t('settings.shortcuts.xboxGamepad.controls.leftStick'),
- rightStick: t('settings.shortcuts.xboxGamepad.controls.rightStick'),
- }}
- />
+ {family === 'playstation' ? (
+ <PlayStationGamepadLayout
+ layout={settings.layout}
+ disabled={!state || saving}
+ hintFor={hintFor}
+ onEdit={setEditing}
+ preview={preview}
+ labels={{
+ leftStick: t(familyControlKey(family, 'leftStick')),
+ rightStick: t(familyControlKey(family, 'rightStick')),
+ }}
+ />
+ ) : (
+ <XboxGamepadLayout
+ layout={settings.layout}
+ disabled={!state || saving}
+ hintFor={hintFor}
+ onEdit={setEditing}
+ preview={preview}
+ variant={family === 'nintendo' ? 'nintendo' : 'xbox'}
+ labels={{
+ leftStick: t(familyControlKey(family, 'leftStick')),
+ rightStick: t(familyControlKey(family, 'rightStick')),
+ }}
+ />
+ )}
</div>
</SettingsCard>
@@ -352,7 +392,7 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
}}
title={
editing && !isStickPart(editing)
- ? t(`settings.shortcuts.xboxGamepad.controls.${editing}`)
+ ? t(familyControlKey(family, editing))
: t('settings.shortcuts.xboxGamepad.layout.editor.title')
}
description={t('settings.shortcuts.xboxGamepad.layout.editor.description')}
@@ -386,7 +426,7 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
}}
title={
editing && isStickPart(editing)
- ? t(`settings.shortcuts.xboxGamepad.controls.${editing}Stick`)
+ ? t(familyControlKey(family, `${editing}Stick`))
: t('settings.shortcuts.xboxGamepad.layout.editor.title')
}
description={t('settings.shortcuts.xboxGamepad.stick.description')}
@@ -410,7 +450,9 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
options={[
{
value: 'conversation-scroll',
- label: t('settings.shortcuts.xboxGamepad.stick.mode.options.conversation-scroll'),
+ label: t(
+ 'settings.shortcuts.xboxGamepad.stick.mode.options.conversation-scroll',
+ ),
},
{
value: 'custom',
@@ -444,7 +486,7 @@ export function XboxGamepadSettings({ onBack }: { onBack(): void }) {
))}
<SettingsDivider />
<SettingsRow
- label={t(`settings.shortcuts.xboxGamepad.controls.${stickClickButton(editing)}`)}
+ label={t(familyControlKey(family, stickClickButton(editing)))}
description={t('settings.shortcuts.xboxGamepad.layout.editor.assignedDescription')}
control={
<BindingSelect
@@ -543,7 +585,9 @@ function BindingSelect({
onChange(binding: XboxGamepadBinding | null): void;
}) {
const { t } = useTranslation();
- const groups: SelectOptionGroup[] = [{ options: [{ value: 'none', label: t('settings.shortcuts.xboxGamepad.actions.none') }] }];
+ const groups: SelectOptionGroup[] = [
+ { options: [{ value: 'none', label: t('settings.shortcuts.xboxGamepad.actions.none') }] },
+ ];
if (allowVoice) {
groups.push({
options: [{ value: 'voice', label: t('settings.shortcuts.xboxGamepad.actions.voice') }],
@@ -715,6 +759,10 @@ function SettingsDivider() {
return <div className="my-1 h-px bg-[var(--settings-theme-card-border)]" />;
}
+function familyControlKey(family: GamepadFamily, part: string): string {
+ return `settings.shortcuts.xboxGamepad.familyControls.${family}.${part}`;
+}
+
function resolveXboxGamepadSettings(
settings: XboxGamepadSettingsModel | undefined,
): XboxGamepadSettingsModel {
diff --git a/apps/desktop/src/renderer/components/settings/__tests__/KeyboardShortcutsSection.accessories.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/KeyboardShortcutsSection.accessories.test.tsx
index 77e24e91ac..81c3f53edb 100644
--- a/apps/desktop/src/renderer/components/settings/__tests__/KeyboardShortcutsSection.accessories.test.tsx
+++ b/apps/desktop/src/renderer/components/settings/__tests__/KeyboardShortcutsSection.accessories.test.tsx
@@ -8,15 +8,26 @@ import {
createWorkLouderCodexDefaultSettings,
} from '../../../../shared/workLouderCodex';
import {
- XBOX_GAMEPAD_EMPTY_DEVICE,
+ emptyGamepadDevice,
createXboxGamepadDefaultSettings,
+ type GamepadFamily,
} from '../../../../shared/xboxGamepad';
const mocks = vi.hoisted(() => ({
workLouderPresent: false as boolean | null,
workLouderEnabled: false,
- xboxPresent: false as boolean | null,
- xboxEnabled: false,
+ present: {
+ xbox: false as boolean | null,
+ playstation: false as boolean | null,
+ nintendo: false as boolean | null,
+ generic: false as boolean | null,
+ },
+ enabled: {
+ xbox: false,
+ playstation: false,
+ nintendo: false,
+ generic: false,
+ },
}));
vi.mock('react-i18next', () => ({
@@ -72,15 +83,15 @@ vi.mock('@/hooks/useWorkLouderCodex', () => ({
}));
vi.mock('@/hooks/useXboxGamepad', () => ({
- useXboxGamepad: () => ({
+ useXboxGamepad: ({ family = 'xbox' }: { family?: GamepadFamily } = {}) => ({
state: {
- connectionStatus: mocks.xboxPresent === true ? 'connected' : 'not-detected',
- devicePresent: mocks.xboxPresent,
- deviceName: mocks.xboxPresent === true ? 'Xbox Wireless Controller' : null,
- device: { ...XBOX_GAMEPAD_EMPTY_DEVICE },
+ connectionStatus: mocks.present[family] === true ? 'connected' : 'not-detected',
+ devicePresent: mocks.present[family],
+ deviceName: mocks.present[family] === true ? family : null,
+ device: emptyGamepadDevice(family),
settings: {
...createXboxGamepadDefaultSettings(),
- deviceEnabled: mocks.xboxEnabled,
+ deviceEnabled: mocks.enabled[family],
},
},
loading: false,
@@ -94,12 +105,25 @@ vi.mock('@/hooks/useXboxGamepad', () => ({
import { KeyboardShortcutsSection } from '../KeyboardShortcutsSection';
+const GAMEPAD_OPEN = {
+ xbox: 'settings.shortcuts.xboxGamepad.openAria',
+ playstation: 'settings.shortcuts.playstationGamepad.openAria',
+ nintendo: 'settings.shortcuts.nintendoGamepad.openAria',
+ generic: 'settings.shortcuts.genericGamepad.openAria',
+} as const;
+
describe('KeyboardShortcutsSection accessories', () => {
beforeEach(() => {
mocks.workLouderPresent = false;
mocks.workLouderEnabled = false;
- mocks.xboxPresent = false;
- mocks.xboxEnabled = false;
+ mocks.present.xbox = false;
+ mocks.present.playstation = false;
+ mocks.present.nintendo = false;
+ mocks.present.generic = false;
+ mocks.enabled.xbox = false;
+ mocks.enabled.playstation = false;
+ mocks.enabled.nintendo = false;
+ mocks.enabled.generic = false;
Object.defineProperty(window, 'electronAPI', {
configurable: true,
value: {
@@ -119,26 +143,23 @@ describe('KeyboardShortcutsSection accessories', () => {
expect(
screen.queryByRole('button', { name: 'settings.shortcuts.workLouderCodex.openAria' }),
).toBeNull();
- expect(
- screen.queryByRole('button', { name: 'settings.shortcuts.xboxGamepad.openAria' }),
- ).toBeNull();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.xbox })).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'settings.shortcuts.accessories.openAria' }));
expect(
screen.getByRole('button', { name: 'settings.shortcuts.workLouderCodex.openAria' }),
).toBeTruthy();
- expect(
- screen.getByRole('button', { name: 'settings.shortcuts.xboxGamepad.openAria' }),
- ).toBeTruthy();
+ expect(screen.getByRole('button', { name: GAMEPAD_OPEN.xbox })).toBeTruthy();
+ expect(screen.getByRole('button', { name: GAMEPAD_OPEN.playstation })).toBeTruthy();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.nintendo })).toBeNull();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.generic })).toBeNull();
});
it('shows a detected device here and keeps the rest behind Accessories', () => {
- mocks.xboxPresent = true;
+ mocks.present.xbox = true;
render(<KeyboardShortcutsSection />);
- expect(
- screen.getByRole('button', { name: 'settings.shortcuts.xboxGamepad.openAria' }),
- ).toBeTruthy();
+ expect(screen.getByRole('button', { name: GAMEPAD_OPEN.xbox })).toBeTruthy();
expect(
screen.queryByRole('button', { name: 'settings.shortcuts.workLouderCodex.openAria' }),
).toBeNull();
@@ -147,18 +168,17 @@ describe('KeyboardShortcutsSection accessories', () => {
expect(
screen.getByRole('button', { name: 'settings.shortcuts.workLouderCodex.openAria' }),
).toBeTruthy();
- expect(
- screen.queryByRole('button', { name: 'settings.shortcuts.xboxGamepad.openAria' }),
- ).toBeNull();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.xbox })).toBeNull();
+ expect(screen.getByRole('button', { name: GAMEPAD_OPEN.playstation })).toBeTruthy();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.nintendo })).toBeNull();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.generic })).toBeNull();
});
it('shows an enabled device here even when it is not detected', () => {
- mocks.xboxEnabled = true;
+ mocks.enabled.xbox = true;
render(<KeyboardShortcutsSection />);
- expect(
- screen.getByRole('button', { name: 'settings.shortcuts.xboxGamepad.openAria' }),
- ).toBeTruthy();
+ expect(screen.getByRole('button', { name: GAMEPAD_OPEN.xbox })).toBeTruthy();
expect(
screen.queryByRole('button', { name: 'settings.shortcuts.workLouderCodex.openAria' }),
).toBeNull();
@@ -167,15 +187,33 @@ describe('KeyboardShortcutsSection accessories', () => {
it('hides Accessories when every hardware device is connected', () => {
mocks.workLouderPresent = true;
- mocks.xboxPresent = true;
+ mocks.present.xbox = true;
+ mocks.present.playstation = true;
+ mocks.present.nintendo = true;
+ mocks.present.generic = true;
render(<KeyboardShortcutsSection />);
expect(screen.queryByTestId('settings-shortcuts-accessories')).toBeNull();
expect(
screen.getByRole('button', { name: 'settings.shortcuts.workLouderCodex.openAria' }),
).toBeTruthy();
- expect(
- screen.getByRole('button', { name: 'settings.shortcuts.xboxGamepad.openAria' }),
- ).toBeTruthy();
+ expect(screen.getByRole('button', { name: GAMEPAD_OPEN.xbox })).toBeTruthy();
+ expect(screen.getByRole('button', { name: GAMEPAD_OPEN.playstation })).toBeTruthy();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.nintendo })).toBeNull();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.generic })).toBeNull();
+ });
+
+ it('does not surface Switch or generic accessories even when they are present', () => {
+ mocks.present.nintendo = true;
+ mocks.present.generic = true;
+ mocks.enabled.nintendo = true;
+ mocks.enabled.generic = true;
+ render(<KeyboardShortcutsSection />);
+
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.nintendo })).toBeNull();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.generic })).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'settings.shortcuts.accessories.openAria' }));
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.nintendo })).toBeNull();
+ expect(screen.queryByRole('button', { name: GAMEPAD_OPEN.generic })).toBeNull();
});
});
diff --git a/apps/desktop/src/renderer/components/settings/__tests__/PlayStationGamepadLayout.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/PlayStationGamepadLayout.test.tsx
new file mode 100644
index 0000000000..7e22c94308
--- /dev/null
+++ b/apps/desktop/src/renderer/components/settings/__tests__/PlayStationGamepadLayout.test.tsx
@@ -0,0 +1,60 @@
+// @vitest-environment jsdom
+
+import { fireEvent, render, screen } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+
+import { createXboxGamepadDefaultLayout } from '../../../../shared/xboxGamepad';
+import { PlayStationGamepadLayout } from '../PlayStationGamepadLayout';
+import type { XboxGamepadEditablePart, XboxGamepadKeyHint } from '../XboxGamepadLayout';
+
+function hintFor(part: XboxGamepadEditablePart): XboxGamepadKeyHint {
+ return { legend: part };
+}
+
+describe('PlayStationGamepadLayout', () => {
+ it('puts the d-pad above the left stick', () => {
+ render(
+ <PlayStationGamepadLayout
+ layout={createXboxGamepadDefaultLayout()}
+ hintFor={hintFor}
+ onEdit={vi.fn()}
+ preview={null}
+ labels={{ leftStick: '左摇杆', rightStick: '右摇杆' }}
+ />,
+ );
+ expect(screen.getByTestId('playstation-gamepad-layout')).toBeTruthy();
+ expect(screen.getByTestId('playstation-gamepad-stick-left')).toBeTruthy();
+ expect(screen.getByTestId('playstation-gamepad-dpad')).toBeTruthy();
+ expect(screen.getByTestId('playstation-gamepad-face')).toBeTruthy();
+ for (const part of [
+ 'a',
+ 'b',
+ 'x',
+ 'y',
+ 'lb',
+ 'rb',
+ 'lt',
+ 'rt',
+ 'view',
+ 'menu',
+ 'xbox',
+ ] as const) {
+ expect(screen.getByRole('button', { name: part })).toBeTruthy();
+ }
+ });
+
+ it('opens the matching control when a face button is clicked', () => {
+ const onEdit = vi.fn();
+ render(
+ <PlayStationGamepadLayout
+ layout={createXboxGamepadDefaultLayout()}
+ hintFor={hintFor}
+ onEdit={onEdit}
+ preview={null}
+ labels={{ leftStick: '左摇杆', rightStick: '右摇杆' }}
+ />,
+ );
+ fireEvent.click(screen.getByRole('button', { name: 'a' }));
+ expect(onEdit).toHaveBeenCalledWith('a');
+ });
+});
diff --git a/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadLayout.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadLayout.test.tsx
index b82c8ef41b..f40004d846 100644
--- a/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadLayout.test.tsx
+++ b/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadLayout.test.tsx
@@ -3,7 +3,10 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
-import { createXboxGamepadDefaultLayout, type XboxGamepadPreviewInput } from '../../../../shared/xboxGamepad';
+import {
+ createXboxGamepadDefaultLayout,
+ type XboxGamepadPreviewInput,
+} from '../../../../shared/xboxGamepad';
import {
XboxGamepadLayout,
type XboxGamepadEditablePart,
@@ -38,7 +41,19 @@ describe('XboxGamepadLayout', () => {
expect(screen.getByTestId('xbox-gamepad-stick-right')).toBeTruthy();
expect(screen.getByTestId('xbox-gamepad-dpad')).toBeTruthy();
expect(screen.getByTestId('xbox-gamepad-face')).toBeTruthy();
- for (const part of ['a', 'b', 'x', 'y', 'lb', 'rb', 'lt', 'rt', 'view', 'menu', 'xbox'] as const) {
+ for (const part of [
+ 'a',
+ 'b',
+ 'x',
+ 'y',
+ 'lb',
+ 'rb',
+ 'lt',
+ 'rt',
+ 'view',
+ 'menu',
+ 'xbox',
+ ] as const) {
expect(screen.getByRole('button', { name: part })).toBeTruthy();
}
});
@@ -49,8 +64,24 @@ describe('XboxGamepadLayout', () => {
expect(onEdit).toHaveBeenCalledWith('a');
});
+ it('draws Nintendo face letters on the Switch variant', () => {
+ render(
+ <XboxGamepadLayout
+ layout={createXboxGamepadDefaultLayout()}
+ hintFor={hintFor}
+ onEdit={vi.fn()}
+ preview={null}
+ labels={LABELS}
+ variant="nintendo"
+ />,
+ );
+ expect(screen.getByTestId('switch-gamepad-layout')).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'a' })).toBeTruthy();
+ });
+
it('marks a pressed physical button', () => {
const preview = {
+ family: 'xbox' as const,
buttons: { a: true },
sticks: { left: { x: 0, y: 0 }, right: { x: 0, y: 0 } },
triggers: { lt: 0, rt: 0 },
diff --git a/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadSettings.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadSettings.test.tsx
index c6cf29b0d4..66fc8ec794 100644
--- a/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadSettings.test.tsx
+++ b/apps/desktop/src/renderer/components/settings/__tests__/XboxGamepadSettings.test.tsx
@@ -57,6 +57,7 @@ function loadedState(
device: {
name: 'Xbox Wireless Controller',
category: 'Xbox One',
+ family: 'xbox',
transport: 'usb',
batteryPercentage: 80,
batteryState: 'discharging',
@@ -94,17 +95,42 @@ describe('XboxGamepadSettings', () => {
});
it('renders the controller while settings are still loading', () => {
- expect(() => render(<XboxGamepadSettings onBack={vi.fn()} />)).not.toThrow();
+ expect(() => render(<XboxGamepadSettings family="xbox" onBack={vi.fn()} />)).not.toThrow();
expect(screen.getByTestId('xbox-gamepad-layout')).toBeTruthy();
});
it('renders the controller when a live state is missing layout', () => {
mocks.state = loadedState({ deviceEnabled: true } as XboxGamepadSettingsModel);
mocks.loading = false;
- expect(() => render(<XboxGamepadSettings onBack={vi.fn()} />)).not.toThrow();
+ expect(() => render(<XboxGamepadSettings family="xbox" onBack={vi.fn()} />)).not.toThrow();
expect(screen.getByTestId('xbox-gamepad-layout')).toBeTruthy();
expect(
- screen.getByRole('button', { name: /settings.shortcuts.xboxGamepad.controls.a/ }),
+ screen.getByRole('button', { name: /settings.shortcuts.xboxGamepad.familyControls.xbox.a/ }),
).toBeTruthy();
});
+
+ it('draws a DualSense pad on the PlayStation accessory page', () => {
+ mocks.state = loadedState();
+ mocks.loading = false;
+ render(<XboxGamepadSettings family="playstation" onBack={vi.fn()} />);
+ expect(screen.getByTestId('playstation-gamepad-layout')).toBeTruthy();
+ expect(screen.queryByTestId('xbox-gamepad-layout')).toBeNull();
+ });
+
+ it('draws Switch chrome on the Nintendo accessory page', () => {
+ mocks.state = loadedState();
+ mocks.loading = false;
+ render(<XboxGamepadSettings family="nintendo" onBack={vi.fn()} />);
+ expect(screen.getByTestId('switch-gamepad-layout')).toBeTruthy();
+ expect(screen.queryByTestId('xbox-gamepad-layout')).toBeNull();
+ });
+
+ it('reuses the Xbox silhouette on the generic accessory page', () => {
+ mocks.state = loadedState();
+ mocks.loading = false;
+ render(<XboxGamepadSettings family="generic" onBack={vi.fn()} />);
+ expect(screen.getByTestId('xbox-gamepad-layout')).toBeTruthy();
+ expect(screen.getByText('settings.shortcuts.genericGamepad.title')).toBeTruthy();
+ });
});
+
diff --git a/apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts b/apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts
new file mode 100644
index 0000000000..a483166326
--- /dev/null
+++ b/apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts
@@ -0,0 +1,185 @@
+/**
+ * DualSense line-art from the colleague SVG (viewBox 0 0 1050 660).
+ * Stroke/fill theming happens in PlayStationGamepadLayout — geometry only.
+ */
+
+export interface EllipseGeom { cx: number; cy: number; rx: number; ry: number }
+export interface CircleGeom { cx: number; cy: number; r: number }
+export interface RectGeom {
+ x: number; y: number; width: number; height: number; rx?: number; ry?: number; transform?: string
+}
+
+export const BODY = "M782.3658,517.7091c14.0089,1.4826,24.0421,9.9526,32.2686,20.7837l51.2569,67.487c10.0965,13.2935,22.6894,22.3685,38.3366,27.8522l34.3037,9.9676c4.7737,1.3871,9.627.062390169168793,14.1535-1.8045,12.4522-5.1352,24.0251-10.9452,34.6703-19.4395,28.0095-22.3502,42.6255-52.1259,51.556-86.7855,7.0117-27.2126,9.3555-54.5137,9.3548-82.725-.000596902127654-28.8267-2.7177-56.4204-9.1977-84.4457-6.5693-28.4118-14.5362-55.6916-24.3094-83.1154l-23.4994-59.9069c-12.3464-31.4745-26.3204-55.8334-41.4864-85.9113-3.383-6.7092-6.966-12.0115-13.8584-14.8873-1.9919-4.7358-10.3128-19.3445-11.971-22.7031-9.5153-19.2744-20.1629-37.3285-34.1127-53.622-22.7136-26.5297-58.1733-30.7378-85.4303-7.5638-8.4751,7.3676-14.438,16.8577-15.4992,28.3997l-3.175,34.535c-.417362221129224,4.5397-4.456,7.7103-8.9877,7.2134-32.9952-3.6179-68.645-7.9085-101.3213-8.8197l-103.8735-2.8962-92.1464.110457303393559c-57.9826.069673068293923-115.1967,2.8117-172.9208,7.0251l-36.6847,3.5783-3.7979-39.7717c-1.6307-17.0779-10.441-30.9887-25.4305-38.9043-30.4337-16.0709-64.7718-1.627-85.3697,25.2673-10.8912,14.2203-19.4609,29.2401-27.5535,45.3421-1.8085,3.5985-8.6784,20.2105-11.8459,22.9062-5.0704,4.3154-9.9765,7.0564-13.0334,13.3357-13.841,28.431-26.9631,50.8912-38.9072,80.3112l-23.2369,57.2356c-12.3853,32.7519-22.3327,65.7374-29.6338,100.0644-10.0581,47.2888-11.619,101.3457-1.6145,148.4544,9.0813,42.7618,26.6856,80.4314,64.1093,103.9833,9.8559,6.2028,19.9643,10.9423,30.7206,15.1717,4.6824,1.8414,9.6272.246890280332082,14.1628-1.1138l27.8483-8.3547c13.3037-3.9913,25.1125-10.8413,33.9931-21.6365l22.1504-26.9254,37.3296-51.0912c9.643-13.1978,36.4827-21.2691,43.8184-14.0884,3.53,3.4553,5.8131,7.9185,8.3975,11.304,1.563,2.0474,5.0991,6.2295,12.2225,12.4826,6.2835,5.5159,13.1866,8.7039,19.947,11.6526,25.4039,11.0806,59.701,6.6365,80.8447-11.8793,11.7068-9.9775,14.227-15.1766,17.6847-18.464l206.7791.018261657716721c.562716732451008.5,9.9282,13.4581,20.2006,20.8268,22.1778,16.9965,61.8974,24.3357,96.8358-1.6837,8.491-6.2276,14.9164-13.6026,21.3951-24.9269,3.311-3.5679,9.2265-2.4071,14.5572-1.8429Z";
+
+export const BODY_LEFT = "M102.7615,138.2111s-7.2041,25.1578-2.8179,34.5601c12.3578,26.4907,51.6306,20.8102,51.6306,20.8102l104.7841-15.4355c16.6048-2.446,32.4097,7.9311,36.7662,24.1398l35.2669,131.2128c4.2433,15.7873.351233793081519,32.8172-10.8156,44.7565-.380466086396154.4375-.77137833613051.8125-1.173,1.2161-16.0658,16.1544-78.7414,85.6307-85.6132,94.4141-6.8718,8.7835-106.943,154.4147-106.943,154.4147,0,0-11.9293,16.4945-18.1049,15.613";
+
+export const BODY_RIGHT = "M948.1312,136.6972s7.4393,26.6716,3.0532,36.0739c-12.3578,26.4907-51.6306,20.8102-51.6306,20.8102l-104.7841-15.4355c-16.6048-2.446-32.4097,7.9311-36.7662,24.1398l-35.2669,131.2128c-4.2433,15.7873-.35123379308061,32.8172,10.8156,44.7565.380466086398883.4375.771378336132329.75,1.173,1.2161,16.0658,16.1544,78.7414,85.6307,85.6132,94.4141,6.8718,8.7835,106.943,154.4147,106.943,154.4147,0,0,11.9293,16.4945,18.1049,15.613";
+
+export const BUMPER_BOTTOM = "M269.4854,109.3304l.741312813078366,14.3176c.410328792159817,14.5891,10.1407,24.1128,34.0471,22.2441,54.3748-4.2502,173.6301-7.5018,223.615-7.3167,90.6913.335814831123571,219.3851,9.4138,219.3851,9.4138,12.3251.074672026569715,30.3691-4.9961,34.172-18.4017l2.3463-20.3326";
+
+export const STICK_LEFT_CAP = "M354.5629,561.3417c-32.49,0-58.9224-24.5472-58.9224-54.7198,0-30.1729,26.4324-54.7201,58.9224-54.7201,32.49,0,58.9224,24.5472,58.9224,54.7201,0,30.1726-26.4324,54.7198-58.9224,54.7198Z";
+
+export const STICK_LEFT_INNER: EllipseGeom = { cx: 354.5629, cy: 512.497, rx: 39.5533, ry: 35.3508 };
+
+export const STICK_LEFT_HIGHLIGHT = "M317.8315,464.0003c0-12.0985,16.059-25.7548,36.4264-25.7548,20.3674,0,37.0364,12.4633,37.0364,25.85";
+
+/** Socket behind the cap: colleague art only drew the top crescent; this is that arc completed into a circle. */
+export const STICK_LEFT_SOCKET: EllipseGeom = { cx: 354.5629, cy: 477.31, rx: 39.07, ry: 39.07 };
+
+export const STICK_LEFT_RING: EllipseGeom = { cx: 354.5629, cy: 494.8464, rx: 69.0797, ry: 66.5806 };
+
+export const STICK_LEFT_WELL: EllipseGeom = { cx: 354.5629, cy: 485.5948, rx: 78.6516, ry: 75.8062 };
+
+export const STICK_RIGHT_CAP = "M696.8797,561.3417c-32.49,0-58.9224-24.5472-58.9224-54.7198,0-30.1729,26.4324-54.7201,58.9224-54.7201,32.49,0,58.9224,24.5472,58.9224,54.7201,0,30.1726-26.4324,54.7198-58.9224,54.7198Z";
+
+export const STICK_RIGHT_INNER: EllipseGeom = { cx: 696.8797, cy: 512.497, rx: 39.5533, ry: 35.3508 };
+
+export const STICK_RIGHT_HIGHLIGHT = "M660.1483,464.0003c0-12.0985,16.059-25.7548,36.4264-25.7548,20.3674,0,37.0364,12.4633,37.0364,25.85";
+
+export const STICK_RIGHT_SOCKET: EllipseGeom = { cx: 696.8797, cy: 477.31, rx: 39.07, ry: 39.07 };
+
+export const STICK_RIGHT_RING: EllipseGeom = { cx: 696.8797, cy: 494.8464, rx: 69.0797, ry: 66.5806 };
+
+export const STICK_RIGHT_WELL: EllipseGeom = { cx: 696.8797, cy: 485.5948, rx: 78.6516, ry: 75.8062 };
+
+export const USB_PORT: RectGeom = {"x": 495.3365, "y": 114.7443, "width": 61.112, "height": 9.1534, "rx": 3.6906, "ry": 3.6906};
+
+export const TOUCHPAD_OUTER = "M696.1746,153.6802s-127.7251-6.2114-169.5956-5.9088c-43.5644.314915120675323-174.589,5.5158-174.589,5.5158-32.4366,3.7751-51.7646,25.7802-44.0077,58.5774l30.4183,128.6134c6.1656,26.0692,28.9429,44.4277,55.121,44.4277h263.7226c26.1815,0,48.9608-18.3632,55.1231-44.4367l30.397-128.6125c7.751-32.7951-13.6588-58.1763-46.5898-58.1763Z";
+
+export const TOUCHPAD_INNER = "M695.8453,167.8432s-127.5466-6.0619-169.3586-5.7666c-43.5035.307335298483849-174.345,5.383-174.345,5.383-32.3913,3.6842-49.5214,25.5323-41.7754,57.5401l28.205,117.0581c6.157,25.4417,28.9024,43.3584,55.044,43.3584h263.3541c26.1449,0,48.8923-17.9212,55.0461-43.3671l27.8938-115.852c7.7402-32.0058-11.179-58.3538-44.0639-58.3538Z";
+
+export const PS_BUTTON = "M558.252258000113216,467.329779473975577c-.180224634188562.710875871443932-1.461903517949395,2.012538972017865-2.222892715955822,2.232854267454968l-23.630389116575316,6.708646581495486-.350487716877979-4.776166704352363,14.168259695683446-3.94507996297034c2.533228657770451-.710936985256922.600748780629146-2.723475957272967-1.471926183263349-2.10268184601955l-12.676288181795826,3.724764667531417-.010022665312135-4.615926286975082c9.852707799022028-4.185379475222362,27.215019811168531-1.211581340385237,26.193746884096981,2.773589283835463ZM507.336690415181693,468.621419909235556l10.99419159603076-3.504510485903666-.230337960751967-4.716091826290722-18.053203666778245,4.976436669167015c-.841109406695068.230276846939887-2.302951810831473,1.862382333767528-2.262922263395012,2.713453291960832.150156638252156,3.774877994093913,12.656303964982726,5.276811059484317,20.386223473548853,4.395672105349149l.04002954743828-4.605903621662947c-4.55585140891435,1.06136358832191-6.698562802369452,3.314263186402968-10.903987608218813,1.311685765886068-.250322177564158-.120149756126921-.240299512251113-.480599024504045.030006882126145-.57074189850573ZM533.830811689593247,449.947361017389994l.08012020868955,10.563644784278949c3.41436761190198,1.752255242950923,7.189245605997712,1.702141916388427,9.842624019895084-1.181574458261821,1.872404999079663-2.022561637328181,2.172840503206316-6.147866234488902.911206950069754-8.731208218823667-.891161619443665-1.842398116952609-3.324285851715103-4.445724318100474-5.937634718173285-5.096586425293935l-18.543886470409234-4.615926286976901v33.232774738033186l9.942789559209814,2.523267106271305-.010022665313954-26.764488782602712-.010022665310316.010022665312135c0-2.383072019520114,3.714803116030453-2.112704511329866,3.724825781342588.06007487806346Z";
+
+export const SPEAKER_DOTS: CircleGeom[] = [
+ { cx: 528.5416, cy: 400.3393, r: 5.9998 },
+ { cx: 567.7276, cy: 400.3118, r: 5.9882 },
+ { cx: 508.8317, cy: 400.3496, r: 5.9404 },
+ { cx: 489.3888, cy: 400.2979, r: 5.9183 },
+ { cx: 538.2576, cy: 414.9493, r: 5.8594 },
+ { cx: 548.1438, cy: 400.3614, r: 5.8991 },
+ { cx: 557.7001, cy: 414.902, r: 5.8509 },
+ { cx: 518.4957, cy: 414.8862, r: 5.8598 },
+];
+
+export const SPEAKER_BLOB = "M499.4889,420.5619c-3.4946.293914620930082-6.1658-1.9076-6.5173-5.0798-.34621716962647-3.1247,2.0756-6.0907,5.831-6.2619,2.9974-.136631026172836,5.7749,2.2787,6.1445,5.1014.389920767258445,2.9781-2.1564,5.9626-5.4583,6.2403Z";
+
+export const L2_TICK = "M126.3493,105.0367s14.2427-8.4194,34.5223-14.5138c19.3507-5.8152,45.3549-9.8538,63.0036-10.1831,17.6487-.329379620192412,23.8481.727089012215401,29.0255,3.1894,5.1774,2.4623,12.9439,7.5947,15.4003,14.3113";
+
+export const R2_TICK = "M926.1644,105.1455s-12.207-9.1398-32.4866-15.2341c-19.3507-5.8152-42.7975-8.9742-60.4462-9.3035-17.6487-.329379620193322-30.2053,1.8349-35.3827,4.2972-5.1774,2.4623-9.1478,5.5407-11.6043,12.2573";
+
+export const L1_BODY = "M110.923,154.0278l6.198-27.6518c1.0816-4.5565,3.8888-8.5446,7.8742-11.1688,10.4224-6.8626,41.694-19.8181,71.1746-22.9966,16.1124-1.7372,53.6223-1.4645,61.5104,2.5678,7.8881,4.0323,9.0322,9.6,10.7484,21.5376,1.7162,11.9377,3.1463,22.8832,0,30.882-3.1463,7.9988-6.9939,18.6118-18.3057,23.2758-11.3118,4.6641-88.6631,11.6364-101.8255,13.0549-9.1569.986872807689906-22.4457-1.6996-32.3616-9.3758-6.0606-4.6917-7.0242-12.8564-5.0128-20.1252Z";
+
+export const L1_CREASE = "M112.8111,144.8816s1.8554,9.1083,10.3045,11.1054c9.0212,2.1323,32.125.991372052651968,37.5755.611239172210844,7.7862-.543030290666138,41.9431-4.4708,55.9667-7.1858,14.0236-2.715,32.6271-4.2405,39.8567-13.6122,3.3981-4.4049,5.4126-16.3757,5.4126-16.3757l1.9249-19.3792";
+
+export const R1_BODY = "M942.2801,153.5011l-6.641-28.2953c-1.0694-4.5565-3.8451-8.5446-7.7855-11.1688-10.305-6.8626-29.6934-16.9091-61.9443-21.5411-40.4109-5.8039-63.5742-1.676-71.3735,2.3563-7.7993,4.0323-8.9305,9.6-10.6274,21.5376-1.6968,11.9377-3.1109,22.8832,0,30.882s7.7291,17.8435,18.9135,22.5075c11.1844,4.6641,86.851,12.4047,99.8653,13.8232,9.0538.986872807688997,24.8323-2.3002,34.6366-9.9764,5.9923-4.6917,6.9451-12.8564,4.9564-20.1252Z";
+
+export const R1_CREASE = "M940.5947,145.3817s-1.8554,9.1083-10.3045,11.1054c-9.0212,2.1323-32.125.991372052652878-37.5755.611239172211754-7.7862-.543030290665229-41.9431-4.4708-55.9667-7.1858-14.0236-2.715-32.6271-4.2405-39.8567-13.6122-3.3981-4.4049-5.4126-16.3757-5.4126-16.3757l-2.9663-20.5169";
+
+export const OPTIONS_OUTER: RectGeom = {"x": 777.2517, "y": 213.6438, "width": 26.4322, "height": 50.3476, "rx": 12.3949, "ry": 12.3949, "transform": "translate(89.02205076294706 -196.896842916443063) rotate(15.036442370322531)"};
+
+export const OPTIONS_INNER: RectGeom = {"x": 776.6812, "y": 217.9667, "width": 26.4322, "height": 45.9494, "rx": 12.3949, "ry": 12.3949, "transform": "translate(89.553502499417505 -196.676114142561886) rotate(15.036442370321083)"};
+
+export const OPTIONS_BARS: RectGeom[] = [
+ {"x": 790.1962, "y": 205.8689, "width": 14.0096, "height": 2.187, "rx": 1.0902, "ry": 1.0902, "transform": "translate(30.350608547518505 -93.542765186136876) rotate(6.845336521593967)"},
+ {"x": 790.8184, "y": 200.6856, "width": 14.0096, "height": 2.187, "rx": 1.0902, "ry": 1.0902, "transform": "translate(29.737256034652432 -93.653875984698317) rotate(6.845336489574311)"},
+ {"x": 791.2696, "y": 195.777, "width": 14.0096, "height": 2.187, "rx": 1.0902, "ry": 1.0902, "transform": "translate(29.155419485344737 -93.742642496674705) rotate(6.84533652871209)"},
+];
+
+export const CREATE_OUTER: RectGeom = {"x": 247.823, "y": 213.4598, "width": 26.4322, "height": 50.3476, "rx": 12.3949, "ry": 12.3949, "transform": "translate(575.049927500898548 401.374311672411636) rotate(164.963557629648562)"};
+
+export const CREATE_INNER: RectGeom = {"x": 248.3935, "y": 217.7827, "width": 26.4322, "height": 45.9494, "rx": 12.3949, "ry": 12.3949, "transform": "translate(576.722418727958825 405.40119204390129) rotate(164.963557629658141)"};
+
+export const CREATE_BARS: RectGeom[] = [
+ {"x": 242.07, "y": 203.8465, "width": 9.6151, "height": 2.187, "rx": 1.0902, "ry": 1.0902, "transform": "translate(192.832668755174154 521.212124696142382) rotate(-119.999925869430115)"},
+ {"x": 246.9002, "y": 200.5511, "width": 14.0096, "height": 2.187, "rx": 1.0902, "ry": 1.0902, "transform": "translate(88.696363018168881 480.632810998190735) rotate(-97.822890488936864)"},
+ {"x": 256.7045, "y": 202.1604, "width": 9.6151, "height": 2.187, "rx": 1.0902, "ry": 1.0902, "transform": "translate(-4.623495162152267 400.415043180253633) rotate(-74.387417091061934)"},
+];
+
+export const FACE_TRIANGLE_RING: EllipseGeom = { cx: 876.457, cy: 280.4114, rx: 32.837, ry: 29.7383 };
+
+export const FACE_TRIANGLE_RING_PATH = "M876.2608,310.2596c-19.8304,0-35.9062-14.5587-35.9062-32.5178s16.0757-32.5178,35.9062-32.5178c19.8304,0,35.9062,14.5587,35.9062,32.5178s-16.0757,32.5178-35.9062,32.5178";
+
+export const FACE_TRIANGLE_GLYPH = "876.5132 262.3788 857.9673 291.0119 895.0592 291.0119 876.5132 262.3788";
+
+export const FACE_SQUARE_RING: EllipseGeom = { cx: 792.7726, cy: 351.2013, rx: 32.837, ry: 29.7383 };
+
+export const FACE_SQUARE_RING_OUTER: EllipseGeom = { cx: 792.5765, cy: 348.5318, rx: 35.9062, ry: 32.5178 };
+
+export const FACE_SQUARE_GLYPH: RectGeom = {"x": 775.4596, "y": 339.3197, "width": 34.3409, "height": 26.2276};
+
+export const FACE_CROSS_RING: EllipseGeom = { cx: 869.6112, cy: 416.2578, rx: 32.837, ry: 29.7383 };
+
+export const FACE_CROSS_RING_PATH = "M869.4151,446.1061c-19.8304,0-35.9062-14.5587-35.9062-32.5178,0-17.9591,16.0757-32.5178,35.9062-32.5178,19.8304,0,35.9062,14.5587,35.9062,32.5178,0,17.9591-16.0757,32.5178-35.9062,32.5178";
+
+export const FACE_CROSS_LINE_A = { x1: 853.5727, y1: 406.5237, x2: 885.786, y2: 431.8707 };
+
+export const FACE_CROSS_LINE_B = { x1: 885.786, y1: 406.5237, x2: 852.4702, y2: 432.5918 };
+
+export const FACE_CIRCLE_RING: EllipseGeom = { cx: 951.0557, cy: 348.8455, rx: 32.837, ry: 29.7383 };
+
+export const FACE_CIRCLE_RING_PATH = "M950.8596,378.6937c-19.8304,0-35.9062-14.5587-35.9062-32.5178,0-17.9591,16.0757-32.5178,35.9062-32.5178,19.8304,0,35.9062,14.5587,35.9062,32.5178,0,17.9591-16.0757,32.5178-35.9062,32.5178";
+
+export const FACE_CIRCLE_GLYPH: EllipseGeom = { cx: 951.3927, cy: 349.4088, rx: 18.8419, ry: 16.5841 };
+
+export const DPAD_UP_OUTER = "M158.5366,266.6144c-6.0352,1.6179-11.4926,7.8214-10.7765,14.0285l2.9635,25.6883c.160418366458543,4.6194,2.0855,9.0015,5.379,12.2445l17.0822,16.5262c5.0122,4.3005,12.4125,4.3005,17.4247-.000033011861888l14.6904-15.5049c3.6615-3.6961,5.8037-8.6311,6.0032-13.8299l2.1678-26.1453c.446399592644411-5.3838-6.221-12.5033-11.551-13.3842-13.5171-2.2339-30.6938-3.025-43.3833.376863722543021Z";
+
+export const DPAD_UP_INNER = "M158.5346,272.9494c-6.0352,1.6179-10.1945,8.5065-9.4784,14.7136l1.6654,18.9647c.160418366458543,4.6194,2.0855,9.0015,5.379,12.2445l17.0822,16.5262c5.0122,4.3005,12.4125,4.3005,17.4247-.00003301185825l14.6904-15.5049c3.6615-3.6961,5.8037-8.6311,6.0032-13.8299l1.5459-18.8903c.446399592644411-5.3838-4.4363-13.1524-10.929-14.6008-13.3718-2.9829-30.6938-3.025-43.3833.376863722543021Z";
+
+export const DPAD_UP_ARROW = "181.0076 283.754 172.9714 292.499 189.0437 292.499 181.0076 283.754";
+
+export const DPAD_LEFT_OUTER = "M94.0273,373.4553c1.6179,6.0352,7.8214,11.4926,14.0285,10.7765l25.6883-2.9635c4.6194-.160418366460362,9.0015-2.0855,12.2445-5.379l16.5262-17.0822c4.3005-5.0122,4.3005-12.4125-.00003301185825-17.4247l-15.5049-14.6904c-3.6961-3.6615-8.6311-5.8037-13.8299-6.0032l-26.1453-2.1678c-5.3838-.446399592643502-12.5033,6.221-13.3842,11.551-2.2339,13.5171-3.025,30.6938.376863722542112,43.3833Z";
+
+export const DPAD_LEFT_ARROW = "111.1669 355.2737 119.9119 363.3099 119.9119 347.2375 111.1669 355.2737";
+
+export const DPAD_LEFT_INNER = "M94.4767,374.026c1.6179,5.5025,7.8214,10.4781,14.0285,9.8253l25.6883-2.7019c4.6194-.146257910049826,9.0015-1.9014,12.2445-4.9042l16.2863-17.438c3.2254-4.1107,4.7459-9.7533-.000032937555261-14.0498l-15.5049-13.3937c-3.6961-3.3383-8.6311-5.2914-13.8299-5.4733l-26.1453-1.9765c-5.3838-.406994958505493-12.5033,5.6719-13.3842,10.5314-2.2339,12.3239-2.7851,28.0113.616786250002406,39.5807Z";
+
+export const DPAD_RIGHT_OUTER = "M268.1093,373.4553c-1.6179,6.0352-7.8214,11.4926-14.0285,10.7765l-25.6883-2.9635c-4.6194-.160418366460362-9.0015-2.0855-12.2445-5.379l-16.5262-17.0822c-4.3005-5.0122-4.3005-12.4125.00003301185825-17.4247l15.5049-14.6904c3.6961-3.6615,8.6311-5.8037,13.8299-6.0032l26.1453-2.1678c5.3838-.446399592643502,12.5033,6.221,13.3842,11.551,2.2339,13.5171,3.025,30.6938-.376863722542112,43.3833Z";
+
+export const DPAD_RIGHT_ARROW = "250.9697 350.9844 242.2246 359.0206 242.2246 342.9482 250.9697 350.9844";
+
+export const DPAD_RIGHT_INNER = "M267.8693,374.026c-1.6179,5.5025-7.8214,10.4781-14.0285,9.8253l-25.6883-2.7019c-4.6194-.146257910049826-9.0015-1.9014-12.2445-4.9042l-16.2863-17.438c-3.2254-4.1107-4.7459-9.7533.000032937554352-14.0498l15.5049-13.3937c3.6961-3.3383,8.6311-5.2914,13.8299-5.4733l26.1453-1.9765c5.3838-.406994958505493,12.5033,5.6719,13.3842,10.5314,2.2339,12.3239,2.7851,28.0113-.616786250003315,39.5807Z";
+
+export const DPAD_DOWN_OUTER = "M205.6561,430.8057c6.0352-1.6179,11.4926-7.8214,10.7765-14.0285l-2.9635-25.6883c-.160419876043306-4.6194-2.0855-9.0015-5.379-12.2444l-17.0822-16.5262c-5.0122-4.3005-12.4125-4.3005-17.4247.000038706166379l-14.6904,15.5049c-3.6615,3.6961-5.8037,8.6311-6.0032,13.8299l-2.1678,26.1453c-.446397833236006,5.3838,6.221,12.5033,11.551,13.3842,13.5171,2.2339,30.6938,3.025,43.3833-.376877899985629Z";
+
+export const DPAD_DOWN_INNER = "M205.5762,430.526c6.0352-1.6179,11.1025-8.1922,10.3864-14.3993l-1.6654-18.9647c-.160419876041487-4.6194-2.9935-9.3158-6.2871-12.5588l-17.0822-16.5262c-5.0122-4.3005-12.4125-4.3005-17.4247.00003870616456l-14.6904,15.5049c-3.6615,3.6961-6.2139,8.5373-6.4134,13.7361l-1.5458,18.8903c-.446397833236006,5.3838,4.8465,13.2462,11.3393,14.6945,13.3718,2.9829,30.6938,3.025,43.3833-.37687789998381Z";
+
+export const DPAD_DOWN_ARROW = "183.1852 413.6661 191.2213 404.9211 175.149 404.9211 183.1852 413.6661";
+
+export const MUTE_BODY: RectGeom = {"x": 501.3388, "y": 497.2074, "width": 53.6035, "height": 9.1534, "rx": 3.6906, "ry": 3.6906};
+
+export const MUTE_CREASE = "M554.9423,503.9955l-.228169681282452-.061724141025479c.000000047173671-2.0409-1.4263-3.6336-3.4672-3.6336l-46.2128.00000000414002c-2.0409.000000000183718-3.4859,1.5418-3.4859,3.5827l-.209490640863805.125";
+
+export const PRESS_L1 = "M110.7217,154.8277l6.198-27.6518c1.0816-4.5565,3.8888-8.5446,7.8742-11.1688,10.4224-6.8626,41.694-19.8181,71.1746-22.9966,16.1124-1.7372,53.6223-1.4645,61.5104,2.5678,7.8881,4.0323,9.0322,9.6,10.7484,21.5376,1.7162,11.9377,3.1463,22.8832,0,30.882-3.1463,7.9988-6.9939,18.6118-18.3057,23.2758-11.3118,4.6641-88.6631,11.6364-101.8255,13.0549-9.1569.986872807690816-22.4457-1.6996-32.3616-9.3758-6.0606-4.6917-7.0242-12.8564-5.0128-20.1252Z";
+
+export const PRESS_R1 = "M942.2801,154.4257l-6.641-28.2953c-1.0694-4.5565-3.8451-8.5446-7.7855-11.1688-10.305-6.8626-29.6934-16.9091-61.9443-21.5411-40.4109-5.8039-63.5742-1.676-71.3735,2.3563-7.7993,4.0323-8.9305,9.6-10.6274,21.5376-1.6968,11.9377-3.1109,22.8832,0,30.882s7.7291,17.8435,18.9135,22.5075c11.1844,4.6641,86.851,12.4047,99.8653,13.8232,9.0538.986872807688997,24.8323-2.3002,34.6366-9.9764,5.9923-4.6917,6.9451-12.8564,4.9564-20.1252Z";
+
+export const PRESS_DPAD_RIGHT = "M268.4888,334.4379c-.881138954131529-4.8562-8.0003-10.9341-13.3872-10.5236l-26.1436,1.9726c-5.1967.180224634188562-10.1331,2.1327-13.8279,5.477l-15.51,13.3872c-4.7461,4.2956-3.2241,9.9428,0,14.0481l16.5313,17.082c2.2129,2.2429,4.9564,3.865,7.9402,4.7061.20045330624271.0117.4009066125036.02.70097543375596.0234,1.2917.320419720939753,2.6334.500644355128316,3.9951.540735016378676l25.6831,2.7034c6.208.650862107193461,12.416-4.3255,14.0281-9.8326,3.4043-11.5649,2.8536-27.2551.620794111254327-39.581Z";
+
+export const PRESS_DPAD_LEFT = "M93.6911,334.4379c.881138954132439-4.8562,8.0003-10.9341,13.3872-10.5236l26.1436,1.9726c5.1967.180224634188562,10.1331,2.1327,13.8279,5.477l15.51,13.3872c4.7461,4.2956,3.2241,9.9428,0,14.0481l-16.5313,17.082c-2.2129,2.2429-4.9564,3.865-7.9402,4.7061-.2004533062518.01-.4009066125036.02-.70097543375596.0234-1.2917.320419720939753-2.6334.500644355128316-3.9951.540735016378676l-25.6831,2.7034c-6.208.650862107193461-12.416-4.3255-14.0281-9.8326-3.4043-11.5649-2.8536-27.2551-.620794111255236-39.581Z";
+
+export const PRESS_DPAD_DOWN = "M216.1276,416.1318l-1.2516-14.2784-.891161619445484-7.73c-.951175383695045-3.5745-3.2341-6.979-5.8075-9.5122l-17.082-16.5312c-5.0165-4.2956-12.4159-4.2956-17.4224,0l-14.6889,15.51c-3.2041,3.2341-5.5571,7.3294-6.238,11.7951v.010022665313954l-1.7222,20.8168v.04009066125036c-.420585260254484,5.3869,4.8662,13.207,11.3345,14.6589,2.4031.540673902567505,4.9464.981243379634179,7.5598,1.3117.30006882125235.0117.70036429563515.0234.110127090812966.0156,4.676.520689685754405,9.5924.841109406694159,14.4486.861154737320248,7.5297-.050113326564315,14.9693-.881138954133348,21.2674-2.5733,6.0378-1.6221,11.1043-8.1905,10.3834-14.3985Z";
+
+export const PRESS_DPAD_UP = "M214.1251,287.3436l-1.2516,14.2784-.891161619444574,7.73c-.951175383695045,3.5745-3.2341,6.979-5.8075,9.5122l-17.082,16.5312c-5.0165,4.2956-12.4159,4.2956-17.4224,0l-14.6889-15.51c-3.2041-3.2341-5.5571-7.3294-6.238-11.7951v-.010022665312135l-1.7222-20.8168v-.04009066125036c-.420585260254484-5.3869,4.8662-13.207,11.3345-14.6589,2.4031-.540673902567505,4.9464-.98124337963327,7.5598-1.3117.030006882126145-.9961551500055.0703-.199842168131.1101-.0199842168131,4.676-.520689685754405,9.5924-.841109406695068,14.4486-.861154737319339,7.5297.050113326562496,14.9693.881138954132439,21.2674,2.5733,6.0378,1.6221,11.1043,8.1905,10.3834,14.3985Z";
+
+export const PRESS_TRIANGLE: EllipseGeom = { cx: 876.457, cy: 280.4604, rx: 32.837, ry: 29.7383 };
+
+export const PRESS_SQUARE: EllipseGeom = { cx: 792.3129, cy: 351.2013, rx: 32.837, ry: 29.7383 };
+
+export const PRESS_CIRCLE: EllipseGeom = { cx: 952.5686, cy: 349.4088, rx: 32.837, ry: 29.7383 };
+
+export const PRESS_CROSS: EllipseGeom = { cx: 870.1294, cy: 416.1557, rx: 32.837, ry: 29.7383 };
+
+export const PRESS_CREATE: RectGeom = {"x": 248.296, "y": 217.8089, "width": 26.4322, "height": 45.9494, "rx": 12.3949, "ry": 12.3949, "transform": "translate(576.537522900934619 405.477985152035899) rotate(164.96355762970407)"};
+
+export const PRESS_OPTIONS: RectGeom = {"x": 776.6812, "y": 217.9667, "width": 26.4322, "height": 45.9494, "rx": 12.3949, "ry": 12.3949, "transform": "translate(89.55350249824312 -196.676114134473551) rotate(15.036442370316204)"};
+
+export const PRESS_PS = "M533.829590413211918,449.945252730924039l.005693245115253.01014392235993c0-2.178063719240527-3.726549207403878-2.451495044973854-3.726549207403878-.067851757430617l.006490536474303-.007923858896902.013330665633475,26.763945110626082-9.947220166965053-2.525065125844776-.002401882054983-33.229631311085541,18.550746088827509,4.617114707636574c2.610607037795489.649756731743764,5.039693544884358,3.247180845180992,5.936702090328254,5.089265535189043,1.261826722005935,2.59127039298437.957713744272041,6.711001694950028-.908514267788632,8.732985001219276-2.661519110388326,2.883649358887851-6.434843680706763,2.937991657139719-9.850775295279163,1.187626434220874l-.077501806887085-10.570608657993944ZM532.397453151734226,476.273338533301285l23.632783210325215-6.710981208434532c.759555159336742-.215690228089443,2.037366601231042-1.517825990224082,2.221679826981926-2.234277452918832,1.024225799063061-3.981309908143885-16.343346893796479-6.956047803132606-26.189256763293088-2.771252702834317l.004950548629495,4.619756690284703,12.679748511560319-3.726423321413677c2.068262193888586-.624304273513189,4.00193804049195,1.38688848680431,1.46984632814565,2.101298941426649l-14.171784317251877,3.940993123871522.352032654902359,4.780885930018485ZM507.304948172405602,469.196750852310288c-.253095925829257-.12013827537703-.235272664485819-.488790911022079.031647672781219-.573904285043682l10.990811484292863-3.504660073091145-.227514124281697-4.71778662442739-18.052750667337932,4.97612768244835c-.841153500170549.231858695358824-2.302073183131142,1.86206125096578-2.266946095955063,2.717401354357207.154961999811349,3.773304978714805,12.656137198064243,5.269520739933796,20.386790660812949,4.395721883978695l.041438786710387-4.605578360158688c-4.551043432541519,1.058381908442243-6.6997449794153,3.308084707481612-10.903477717022724,1.312678421936653Z";
+
+export const PRESS_L2 = "M262.858,88.7272c-1.592-2.2429-9.5982-5.4347-12.1615-6.7464-7.8901-4.0352-36.3992-2.3853-52.7039.340758256710615-31.0462,5.1908-51.4545,11.3586-68.7208,21.0444-2.0805,1.1671-1.3404.933373497446155-2.9224,2.8358,3.1441-6.0478,2.2271-3.6674,3.5289-6.2707,8.1004-16.1007,14.0768-29.0796,24.9608-43.3079,20.5965-26.8946,54.9407-41.3332,85.3699-25.2625,14.9893,7.9102,23.8007,21.8281,25.4328,38.9l1.3881,22.036c.010022665313045,0,.086893439367486,1.5896.217108611735966,2.9688l-.080314648247622-1.3123s-1.0142-.589974789804728-4.3085-5.2259Z";
+
+export const PRESS_R2 = "M924.3209,102.5638c-1.3217-1.6221-30.443-15.156-62.6945-19.782-40.412-5.8075-58.7692-.817485306650269-66.5692,3.2177-2.6834,1.3917-4.7893,4.761-6.2111,6.5333-1.6321,2.0326-2.6403,2.8988-2.6002,2.4382l.640778328066517-6.979.832480398912594-18.8285c1.0614-11.5449,7.0291-21.0371,15.4999-28.3965,27.2651-23.1799,62.7207-18.9744,85.43,7.5597,13.958,16.291,33.1887,49.5309,35.6719,54.237Z";
+
+export const PRESS_STICK_LEFT = "M413.4838,506.6218c0,30.1688-26.434,54.7204-58.9259,54.7204-32.4817,0-58.9158-24.5516-58.9158-54.7204,0-17.2823,8.6711-32.7221,22.1885-42.755,10.073-7.4797,22.8494-11.9654,36.7273-11.9654,13.8779,0,26.6643,4.4858,36.7373,11.9654,13.5174,10.0329,22.1886,25.4728,22.1886,42.755Z";
+
+export const PRESS_STICK_RIGHT = "M637.9589,506.6218c-.000000001355147,30.1688,26.434,54.7204,58.9259,54.7204,32.4817.000000001455192,58.9158-24.5516,58.9158-54.7204.000000000776708-17.2823-8.6711-32.7221-22.1885-42.755-10.073-7.4797-22.8494-11.9654-36.7273-11.9654-13.8779-.000000000625732-26.6643,4.4858-36.7373,11.9654-13.5174,10.0329-22.1886,25.4728-22.1886,42.755Z";
+
diff --git a/apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts b/apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts
new file mode 100644
index 0000000000..4f32b018cc
--- /dev/null
+++ b/apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts
@@ -0,0 +1,140 @@
+/**
+ * Xbox Series line-art paths from the colleague SVG (viewBox 0 0 1050 660).
+ * Stroke/fill theming happens in XboxGamepadLayout — this file is geometry only.
+ */
+
+export const BODY = "M779.24,50.08s8.36-26.22,13.59-32.58c9.58-15.15,43.38-20,61.39-.1.5-1.06,39.07,66.69,56.52,98a88.3,88.3,0,0,0,6.52,6.64c3.84,2.74,10.49,21.29,17,35.6.3,0,119.42,281.82,108.81,379-4,91.52-73.59,126-127.93,119.15-33.52-5.41-68.64-30.5-104.66-52.27-12.93-6.93-49.81-33.18-85.28-36.32-92-2.91-281-3.72-400.38.07-35.47,3.14-72.34,29.4-85.28,36.34-36,21.78-71.14,46.89-104.66,52.3C80.55,662.73,11,628.22,7,536.65c-10.6-97.19,108.5-379.13,108.8-379.16,6.51-14.32,13.17-32.88,17-35.62a92.33,92.33,0,0,0,6.52-6.64c17.45-31.33,56-99.11,56.51-98.06,18-19.63,51.77-14.76,61.39.11,5.23,6.36,12.19,32.8,12.19,32.8m403.8,24.69L375,74.67";
+
+export const BUMPER_TOP = "M906,128.92c0,.06.61-5.38.56-5.69a20.54,20.54,0,0,0-1.35-5.23C896.88,99.81,877,65.08,812.33,55,717.43,40.78,719.72,52.74,704,66.43c-8.47,7.26-25.32,8-30.18,8.06H377.48s-18.75.39-31.17-8.12C330,54.43,339.75,39.11,237.6,55.29c-86.46,14.31-94.19,66-93.18,74";
+
+export const BUMPER_MID = "M145.58,119.23S150.35,104,205.51,87.5c55.83-14.36,80.63-15.72,104.55-16,37.5.25,15.63,21,59.39,20.76,90.27.52,242.49.4,311.72,0,43.76.26,23.34-20.51,60.84-20.76,23.92.27,48.72,1.63,104.55,16,55.16,16.46,58.92,31.32,58.92,31.32";
+
+export const BUMPER_BOTTOM = "M134.23,120.53s-11.86,14.32,16.53,8.43c68.05-13.5,141-19.44,223.9-20.21-.07-.17,299.29,0,299.32,0,138.81.5,207.67,18.53,234.82,21.42,14,1.87,6.32-9.95,6.32-9.95";
+
+export const BUMPER_NOTCH = "M672.48,74.49l2.17,34m-300-34-1.45,34";
+
+export const LT_TICK = "M194.66,19.59s-1.61,13.43,0,24.07c2.37,13,6.6,20.26,6.6,20.26";
+
+export const RT_TICK = "M854.9,19.62s1.62,13.42,0,24.06c-2.37,13-6.6,20.26-6.6,20.26";
+
+export const PAIRING_PILL = "M442.22,76.37c-9.21,0-16.67,3.14-16.67,7s7.46,7,16.67,7,16.67-3.14,16.67-7S451.43,76.37,442.22,76.37Z";
+
+export const PAIRING_CREASE = "M425.55,83s6.27,3,16.67,3.14c11.29-.15,16.46-2.77,16.46-2.77";
+
+export const STICK_LEFT_WELL = "M326.9,288.24c1.83-41.56-31.54-76.85-74.55-78.83S173,239.53,171.16,281.09s31.54,76.85,74.54,78.83S325.06,329.8,326.9,288.24Z";
+
+export const STICK_LEFT_RING = "M248.34,360c36.89,0,66.79-31,66.79-69.14s-29.9-69.14-66.79-69.14-66.78,31-66.78,69.14S211.46,360,248.34,360Z";
+
+export const STICK_LEFT_DISH = "M247.27,344c22.72-.37,40.88-17.12,40.56-37.43s-19-36.46-41.7-36.09-40.87,17.12-40.56,37.42S224.56,344.35,247.27,344Z";
+
+export const STICK_LEFT_HIGHLIGHT = "M230.57,246.52s4.17-11.42,24.71-9.49c12,1.93,14.8,10.6,14.8,10.6";
+
+export const STICK_LEFT_CAP = "M261,358.21c31.81-7.84,51.58-39.51,44.18-70.74s-39.2-50.19-71-42.36S182.6,284.62,190,315.85,229.21,366,261,358.21Z";
+
+export const STICK_RIGHT_WELL = "M742.58,446.18c1.83-41.56-31.55-76.85-74.55-78.82S588.67,397.48,586.84,439s31.55,76.85,74.55,78.82S740.75,487.74,742.58,446.18Z";
+
+export const STICK_RIGHT_RING = "M730.71,442.9c-2.63-33.73-30.33-64.08-66-64.09-35.82,0-63.35,30.59-66,63.48-3.2,39.82,30.45,78.19,70.31,75.66C705.36,515.64,733.61,480.21,730.71,442.9Z";
+
+export const STICK_RIGHT_CAP = "M679.37,516c31.62-8.14,51-40.1,43.22-71.37s-39.68-50-71.31-41.89-51,40.1-43.22,71.38S647.74,524.17,679.37,516Z";
+
+export const STICK_RIGHT_DISH = "M665.89,503c22.72-.37,40.88-17.12,40.56-37.42s-19-36.47-41.7-36.1-40.87,17.12-40.56,37.42S643.18,503.32,665.89,503Z";
+
+export const STICK_RIGHT_HIGHLIGHT = "M641,406.83s5.3-14.56,25.22-12.43a16.76,16.76,0,0,1,13.57,8.48";
+
+export const DPAD_DISC_OUTER = "M466.58,451c1.67-41.16-33.29-76.05-78.09-77.94S306,403.05,304.35,444.2s33.3,76.05,78.09,77.94S464.91,492.19,466.58,451Z";
+
+export const DPAD_DISC_INNER = "M465.31,455.38c2-39-32.09-72.58-76.2-75s-81.51,27.32-83.54,66.34,32.09,72.57,76.2,75S463.28,494.4,465.31,455.38Z";
+
+export const DPAD_CROSS = "M451.29,429.83a290.74,290.74,0,0,0-39.45-5.17V395.85c0-12.8-19.57-12.56-28.26-12.56-5.8,0-26.09-.24-26.09,12.56v29.31c-15.66,1.16-30.66,2.95-38.59,4.66-19.12,4.95-15.42,47.86,0,49.45,12.51-1.38,25.5-3.07,38.57-4.31v34.63c0,14.77,54.35,14.77,54.35,0V474.4c12.94,1.2,25.91,3.14,39.48,4.85C466.64,480.68,475.34,434.11,451.29,429.83Z";
+
+export const DPAD_CENTER = "M402.84,424.43s-9-.74-17.92-.74c-8.52,0-16.87.74-16.87.74a6.58,6.58,0,0,0-6.53,6.64v31.76a6.59,6.59,0,0,0,6.53,6.65s8.77-.74,17.51-.74,17.27.74,17.27.74a6.59,6.59,0,0,0,6.53-6.65V431.07A6.58,6.58,0,0,0,402.84,424.43Z";
+
+export const DPAD_SEAMS = "M306.09,443.67a26.29,26.29,0,0,1,9.11-12.32c4.23-3.91,42.29-6.19,42.29-6.19V420c-15.72,1.16-30.81,3-38.77,4.69C311.29,426.6,305.31,438.6,306.09,443.67Zm144.59-18.62a289.4,289.4,0,0,0-38.83-5.1l0,4.72s31.16,2.38,41.05,5.87c12.61,4.49,12.35,22.83,12.34,15.14C465.29,439.87,465.85,429.4,450.68,425.05Z";
+
+export const FACE_B_OUTER = "M882.44,311.13c19.21-4.94,31-24.35,26.25-43.35a35.29,35.29,0,0,0-43.31-25.43c-19.21,4.94-31,24.35-26.25,43.35A35.29,35.29,0,0,0,882.44,311.13Z";
+
+export const FACE_B_INNER = "M881.89,310.93c18-4.63,29-22.8,24.57-40.58a33,33,0,0,0-40.53-23.8c-18,4.63-29,22.79-24.57,40.57A33,33,0,0,0,881.89,310.93Z";
+
+export const FACE_B_GLYPH = "M884.66,275.2s10.2-7.84,5-17.86c-3.07-3.21-11.58-3.19-27.08-1.62l-.95,43.9s12.1,1.58,21.13-3.08S898.58,281.27,884.66,275.2Zm-14.08-12.3c13.1-2,12.13,3.91,12.13,3.91,0,9.72-13.08,7.17-13.08,7.17Zm14.15,23.39c-1.57,7.13-16.1,8.2-16.1,8.2l1-13.33C885.4,278.9,884.73,286.29,884.73,286.29Z";
+
+export const FACE_A_OUTER = "M807.44,383.15c18.85-4.85,30.46-23.58,25.93-41.83s-23.47-29.1-42.32-24.25-30.45,23.58-25.92,41.83S788.6,388,807.44,383.15Z";
+
+export const FACE_A_INNER = "M807.4,382.91c17.48-4.46,28.18-22,23.89-39.07s-21.94-27.38-39.42-22.92S763.68,342.86,768,360,789.91,387.37,807.4,382.91Z";
+
+export const FACE_A_GLYPH = "M798,325.45l-18.11,44.1h6s2.08-4.5,4.73-10.26H810.1l3,8.2h8l-15.09-42ZM808.36,354H793.14l0-.09,8.87-19.2,6.2,18.95C808.29,353.75,808.32,353.86,808.36,354Z";
+
+export const FACE_X_OUTER = "M736.69,320.07c20.35-5.24,33-25.08,28.22-44.3s-25.13-30.56-45.49-25.31-33,25.07-28.23,44.29S716.33,325.31,736.69,320.07Z";
+
+export const FACE_X_INNER = "M736.27,319.66c18.81-4.85,30.48-23.26,26.05-41.13S739,250.11,720.22,255s-30.48,23.26-26.05,41.13S717.45,324.5,736.27,319.66Z";
+
+export const FACE_X_GLYPH = "M740.76,265l-12.07,17.43L718.62,266h-6l11.06,21.54-1,1L709.57,306h8l10.06-13.33L737.74,306h7l-12.08-18.46L747.81,265Z";
+
+export const FACE_Y_OUTER = "M811.21,245.52c20.72-5.33,33.69-25.07,29-44.09s-25.33-30.1-46-24.77-33.68,25.08-29,44.09S790.5,250.85,811.21,245.52Z";
+
+export const FACE_Y_INNER = "M811.49,244.56c18.81-4.85,30.58-22.84,26.28-40.18s-23-27.48-41.86-22.63-30.58,22.83-26.28,40.18S792.67,249.4,811.49,244.56Z";
+
+export const FACE_Y_GLYPH = "M792.08,191.11l10.07,22.56,15.09-23.58h7l-19.12,31.79v14.36h-7V220.85L785,191.11Z";
+
+export const VIEW_OUTER = "M451.41,309c13-3.45,21.18-16.32,18.18-28.74s-16-19.69-29-16.24-21.17,16.32-18.18,28.74S438.37,312.48,451.41,309Z";
+
+export const VIEW_INNER = "M451,309.17c11.64-3,18.81-14.55,16-25.81s-14.49-17.95-26.13-15-18.81,14.56-16,25.82S439.4,312.17,451,309.17Z";
+
+export const VIEW_GLYPH_WINDOWS = "M457.48,288.36v10.25H440.37V288.36Zm-15.08,1.89,0,6.31h13.08l0-6.31Z";
+
+export const VIEW_GLYPH_STACK = "M447.45,283.25h-2v-2.11h-11v7.22h3.19v2.05h-5.22V279.09h15Z";
+
+export const MENU_OUTER = "M607.65,309a23.76,23.76,0,0,0,17.29-28.56,23.25,23.25,0,0,0-28.53-16.76,23.77,23.77,0,0,0-17.29,28.56A23.26,23.26,0,0,0,607.65,309Z";
+
+export const MENU_INNER = "M606.84,307.53c11.11-2.86,18-13.85,15.32-24.56s-13.82-17.06-24.93-14.2-18,13.86-15.32,24.57S595.72,310.4,606.84,307.53Z";
+
+export const MENU_BAR_1 = "M613.2,283.31H591.88v-2.05H613.2Z";
+
+export const MENU_BAR_3 = "M613.24,297.31H591.92v-2.05h21.32Z";
+
+export const MENU_BAR_2 = "M613.24,290.31H591.92v-2.05h21.32Z";
+
+export const SHARE_OUTER = "M538.27,327.91H509.49a13.41,13.41,0,0,0-13.3,13.52v4.2a13.42,13.42,0,0,0,13.3,13.53h28.78a13.42,13.42,0,0,0,13.3-13.53v-4.2A13.41,13.41,0,0,0,538.27,327.91Z";
+
+export const SHARE_INNER = "M536.67,331.9H511a13.13,13.13,0,0,0-12.88,13.35v.5A13.13,13.13,0,0,0,511,359.11h25.67a13.12,13.12,0,0,0,12.88-13.36v-.5A13.12,13.12,0,0,0,536.67,331.9Z";
+
+export const GUIDE_EMBLEM = "M512.33,163.43l-17.11-12.31c-21.56,20.33-5,51.27-5,51.27C495.9,173.46,512.33,163.43,512.33,163.43Zm40.25-12.31-16.1,12.31c19.15,16,21.13,39,21.13,39C575.93,171.2,552.58,151.12,552.58,151.12Zm-28.17,21.54s-24.29,18.86-29.19,34.86c0,0,27.92,29.39,57.36,0C552.58,207.52,547.18,191.55,524.41,172.66Zm0-19.49s8-6.67,22.13-6.15c0,0-19.89-18.28-45.28,0C501.26,147,517,146.69,524.41,153.17Z";
+
+export const PRESS_DPAD_DOWN = "M384.94,475.59c-13.51-.43-21.87-.93-21.75,5.76v21.42c0,4.29,8.28,9.92,20.76,10.31,14.25.44,22-4.89,22-9.18l0-21.07C406,475.52,398.17,476,384.94,475.59Z";
+
+export const PRESS_DPAD_LEFT = "M354.55,449.9c-.37-15.85,1-19.06-3.08-19.32-16.43,1-20.56,1.45-30.07,3.61-17.17,5.06-13.38,40.21,2.18,39.24,18.61-3,14.67-2.65,30.09-3.59C356,469.38,355,467.11,354.55,449.9Z";
+
+export const PRESS_DPAD_RIGHT = "M448.52,433.76c-9.51-2.17-13.64-2.6-30.07-3.62-4.05.26-2.71,3.47-3.08,19.33-.4,17.2-1.41,19.48.88,19.94,15.43.93,12.53,1.6,31.88,3.61C461.6,475.09,465.69,438.81,448.52,433.76Z";
+
+export const PRESS_DPAD_UP = "M405.85,395.05c0-3.49-7.66-7.82-21.9-7.46-12.46.32-21.46,5.52-21.46,9l.1,19.43c-.15,5.43,8.64,2.35,22.13,2,13.21-.34,21.92,2.81,21.92-3.12Z";
+
+export const PRESS_RT = "M809,6.54C785.73,14,780.91,49.16,780.91,49.16c65.45,6.12,93.62,23.45,110.24,43,22.64,27.94,16.05,36.75,16.05,36.75l4.2.38s.69-2.82-1.25-10c-.11-5.09-29.92-58.85-49.09-91.44C844.84,6.72,829.33,1.2,809,6.54Z";
+
+export const PRESS_LT = "M238.83,6.54c23.24,7.43,28,42.62,28,42.62-65.44,6.12-93.61,23.45-110.24,43-22.64,27.94-16,36.75-16,36.75l-4.21.38s-.68-2.82,1.25-10c.12-5.09,29.93-58.85,49.1-91.44C203,6.72,218.46,1.2,238.83,6.54Z";
+
+export const PRESS_RB = "M725.62,51c-16.78,4.53-16.48,15.4-25.71,18.92a83.76,83.76,0,0,1-27.09,5.39c.24,0,2.09,33.67,2.09,33.67s66.57.38,128.92,5.78c52.18,4.53,102,14.17,102,14.17.09.3,2.89-33.53-49.3-59.77C817.21,51.05,742.49,46,725.62,51Z";
+
+export const PRESS_LB = "M322.18,51c16.78,4.53,16.48,15.4,25.71,18.92A83.72,83.72,0,0,0,375,75.28c-.23,0-2.09,33.67-2.09,33.67s-66.56.38-128.91,5.78c-52.18,4.53-102,14.17-102,14.17-.09.3-2.89-33.53,49.29-59.77C230.59,51.05,305.31,46,322.18,51Z";
+
+export const PRESS_STICK_LEFT = "M261,358.21c31.77-7.84,51.53-39.5,44.13-70.73S266,237.3,234.21,245.13s-51.54,39.5-44.14,70.73S229.24,366,261,358.21Z";
+
+export const PRESS_STICK_RIGHT = "M678.7,516.14c31.71-7.89,51.43-39.77,44-71.21S683.66,394.4,652,402.29s-51.43,39.77-44,71.21S647,524,678.7,516.14Z";
+
+export const PRESS_B = "M874.46,245.46c-18.79,0-34,14-34.07,32.87S854.53,312,873.32,312a34.17,34.17,0,0,0,34.11-34.09C907.49,259.08,893.24,245.46,874.46,245.46Z";
+
+export const PRESS_A = "M799.25,319.87c-18.85,0-32.22,15-32.22,32.87s12.48,31.2,31.32,31.2,33.89-13.35,33.89-31.2A32.73,32.73,0,0,0,799.25,319.87Z";
+
+export const PRESS_Y = "M805.65,180.6c-20,0-36.87,15-36.87,34s13.34,31.17,33.38,31.17,36.5-13.56,36.5-32.58S827.07,180.6,805.65,180.6Z";
+
+export const PRESS_X = "M728.24,253.78a34.7,34.7,0,0,0-35,35c0,19.2,13.77,32.07,33.66,32.07s36.32-14.32,36.32-33.52S748.12,253.78,728.24,253.78Z";
+
+export const PRESS_VIEW = "M446.19,268.26c-11.86,0-21.48,9.32-21.48,20.81s9.62,20.82,21.48,20.82,21.47-9.32,21.47-20.82S458.05,268.26,446.19,268.26Z";
+
+export const PRESS_MENU = "M602,268.09a20.34,20.34,0,1,0,20.69,20.34A20.52,20.52,0,0,0,602,268.09Z";
+
+export const PRESS_GUIDE = "M512.33,163.43l-17.11-12.31c-21.56,20.34-5,51.28-5,51.28C495.9,173.46,512.33,163.43,512.33,163.43Zm40.25-12.31-16.1,12.31c19.15,16,21.14,39,21.14,39C575.93,171.21,552.58,151.12,552.58,151.12Zm-28.17,21.54s-24.29,18.86-29.19,34.87c0,0,27.92,29.38,57.36,0C552.58,207.53,547.18,191.55,524.41,172.66Zm0-19.48s8-6.68,22.14-6.16c0,0-19.89-18.28-45.29,0C501.26,147,517,146.69,524.41,153.18Z";
+
+export const PAIRING_CHEVRON_1 = "M469.53 78.29 L473.25 82.66 L469.53 87.19";
+
+export const PAIRING_CHEVRON_2 = "M484.42 78.38 L488.14 82.75 L484.42 87.28";
+
+export const PAIRING_CHEVRON_3 = "M477.12 78.34 L480.83 82.72 L477.12 87.24";
diff --git a/apps/desktop/src/renderer/hooks/useXboxGamepad.ts b/apps/desktop/src/renderer/hooks/useXboxGamepad.ts
index b28d6c1098..bdb7871058 100644
--- a/apps/desktop/src/renderer/hooks/useXboxGamepad.ts
+++ b/apps/desktop/src/renderer/hooks/useXboxGamepad.ts
@@ -1,13 +1,16 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import type {
+ GamepadFamily,
XboxGamepadSettings,
XboxGamepadSettingsPatch,
XboxGamepadState,
} from '../../shared/xboxGamepad';
-export function useXboxGamepad(options: { watchConnection?: boolean } = {}) {
- const { watchConnection = false } = options;
+export function useXboxGamepad(
+ options: { family?: GamepadFamily; watchConnection?: boolean } = {},
+) {
+ const { family = 'xbox', watchConnection = false } = options;
const [state, setState] = useState<XboxGamepadState | null>(null);
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
@@ -30,21 +33,21 @@ export function useXboxGamepad(options: { watchConnection?: boolean } = {}) {
try {
const next = await api.getState();
if (!mountedRef.current) return;
- setState(next);
+ setState(next[family]);
setError(null);
} catch {
if (mountedRef.current) setError('load');
} finally {
if (mountedRef.current) setLoading(false);
}
- }, []);
+ }, [family]);
useEffect(() => {
mountedRef.current = true;
const api = window.electronAPI?.xboxGamepad;
const unsubscribe = api?.onStateChanged((next) => {
if (!mountedRef.current) return;
- setState(next);
+ setState(next[family]);
setLoading(false);
});
void reload();
@@ -52,7 +55,7 @@ export function useXboxGamepad(options: { watchConnection?: boolean } = {}) {
mountedRef.current = false;
unsubscribe?.();
};
- }, [reload]);
+ }, [family, reload]);
useEffect(() => {
if (!watchConnection) return;
@@ -65,31 +68,34 @@ export function useXboxGamepad(options: { watchConnection?: boolean } = {}) {
return () => window.clearInterval(timer);
}, [watchConnection]);
- const setSettings = useCallback(async (patch: XboxGamepadSettingsPatch) => {
- const api = window.electronAPI?.xboxGamepad;
- if (!api) return;
- setSaving(true);
- try {
- const next = await api.setSettings(patch);
- if (mountedRef.current) {
- setState(next);
- setError(null);
+ const setSettings = useCallback(
+ async (patch: XboxGamepadSettingsPatch) => {
+ const api = window.electronAPI?.xboxGamepad;
+ if (!api) return;
+ setSaving(true);
+ try {
+ const next = await api.setSettings(family, patch);
+ if (mountedRef.current) {
+ setState(next[family]);
+ setError(null);
+ }
+ } catch {
+ if (mountedRef.current) setError('save');
+ } finally {
+ if (mountedRef.current) setSaving(false);
}
- } catch {
- if (mountedRef.current) setError('save');
- } finally {
- if (mountedRef.current) setSaving(false);
- }
- }, []);
+ },
+ [family],
+ );
const resetSettings = useCallback(async () => {
const api = window.electronAPI?.xboxGamepad;
if (!api) return;
setSaving(true);
try {
- const next = await api.resetSettings();
+ const next = await api.resetSettings(family);
if (mountedRef.current) {
- setState(next);
+ setState(next[family]);
setError(null);
}
} catch {
@@ -97,7 +103,7 @@ export function useXboxGamepad(options: { watchConnection?: boolean } = {}) {
} finally {
if (mountedRef.current) setSaving(false);
}
- }, []);
+ }, [family]);
return { state, loading, saving, error, setSettings, resetSettings, reload };
}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 61b826b7d6..abeceea28f 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -4190,6 +4190,92 @@
"leftStick": "Left stick",
"rightStick": "Right stick"
},
+ "familyControls": {
+ "xbox": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "Xbox",
+ "ls": "Left stick click",
+ "rs": "Right stick click",
+ "dpadUp": "D-pad up",
+ "dpadDown": "D-pad down",
+ "dpadLeft": "D-pad left",
+ "dpadRight": "D-pad right",
+ "leftStick": "Left stick",
+ "rightStick": "Right stick"
+ },
+ "playstation": {
+ "a": "✕",
+ "b": "○",
+ "x": "□",
+ "y": "△",
+ "lb": "L1",
+ "rb": "R1",
+ "lt": "L2",
+ "rt": "R2",
+ "view": "Create",
+ "menu": "Options",
+ "xbox": "PS",
+ "ls": "Left stick click",
+ "rs": "Right stick click",
+ "dpadUp": "D-pad up",
+ "dpadDown": "D-pad down",
+ "dpadLeft": "D-pad left",
+ "dpadRight": "D-pad right",
+ "leftStick": "Left stick",
+ "rightStick": "Right stick"
+ },
+ "nintendo": {
+ "a": "B",
+ "b": "A",
+ "x": "Y",
+ "y": "X",
+ "lb": "L",
+ "rb": "R",
+ "lt": "ZL",
+ "rt": "ZR",
+ "view": "−",
+ "menu": "+",
+ "xbox": "HOME",
+ "ls": "Left stick click",
+ "rs": "Right stick click",
+ "dpadUp": "D-pad up",
+ "dpadDown": "D-pad down",
+ "dpadLeft": "D-pad left",
+ "dpadRight": "D-pad right",
+ "leftStick": "Left stick",
+ "rightStick": "Right stick"
+ },
+ "generic": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "Home",
+ "ls": "Left stick click",
+ "rs": "Right stick click",
+ "dpadUp": "D-pad up",
+ "dpadDown": "D-pad down",
+ "dpadLeft": "D-pad left",
+ "dpadRight": "D-pad right",
+ "leftStick": "Left stick",
+ "rightStick": "Right stick"
+ }
+ },
"actions": {
"none": "Unmapped",
"voice": "Voice input",
@@ -4233,6 +4319,57 @@
"battery": "{{percent}}%",
"charging": "Charging {{percent}}%"
}
+ },
+ "playstationGamepad": {
+ "title": "PlayStation controller",
+ "openAria": "Open PlayStation controller settings",
+ "entryDescription": "Scroll, talk, send, and switch tasks with a controller",
+ "connection": {
+ "toggle": { "aria": "Let this Cindy use a PlayStation controller while it is in the foreground" },
+ "descriptions": {
+ "connecting": "Cindy is looking for a PlayStation controller.",
+ "connected": "Cindy listens to this controller while it is in the foreground.",
+ "disabled": "Turn it on to listen while Cindy is in the foreground.",
+ "present": "Turn it on to listen while Cindy is in the foreground.",
+ "not-detected": "Connect a DualSense or DualShock with USB or Bluetooth.",
+ "error": "Cindy cannot read the controller right now and is retrying.",
+ "unavailable": "This computer cannot read a PlayStation controller yet."
+ }
+ }
+ },
+ "nintendoGamepad": {
+ "title": "Switch controller",
+ "openAria": "Open Switch controller settings",
+ "entryDescription": "Scroll, talk, send, and switch tasks with a controller",
+ "connection": {
+ "toggle": { "aria": "Let this Cindy use a Switch controller while it is in the foreground" },
+ "descriptions": {
+ "connecting": "Cindy is looking for a Switch controller.",
+ "connected": "Cindy listens to this controller while it is in the foreground.",
+ "disabled": "Turn it on to listen while Cindy is in the foreground.",
+ "present": "Turn it on to listen while Cindy is in the foreground.",
+ "not-detected": "Connect a Switch Pro or Joy-Con with USB or Bluetooth.",
+ "error": "Cindy cannot read the controller right now and is retrying.",
+ "unavailable": "This computer cannot read a Switch controller yet."
+ }
+ }
+ },
+ "genericGamepad": {
+ "title": "Generic controller",
+ "openAria": "Open generic controller settings",
+ "entryDescription": "Scroll, talk, send, and switch tasks with a controller",
+ "connection": {
+ "toggle": { "aria": "Let this Cindy use a generic controller while it is in the foreground" },
+ "descriptions": {
+ "connecting": "Cindy is looking for a controller.",
+ "connected": "Cindy listens to this controller while it is in the foreground.",
+ "disabled": "Turn it on to listen while Cindy is in the foreground.",
+ "present": "Turn it on to listen while Cindy is in the foreground.",
+ "not-detected": "Connect a controller with USB or Bluetooth.",
+ "error": "Cindy cannot read the controller right now and is retrying.",
+ "unavailable": "This computer cannot read a controller yet."
+ }
+ }
}
},
"ghosts": {
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index d22cfa5ef9..2967222b1f 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -4189,6 +4189,92 @@
"leftStick": "左スティック",
"rightStick": "右スティック"
},
+ "familyControls": {
+ "xbox": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "Xbox",
+ "ls": "左スティック押し込み",
+ "rs": "右スティック押し込み",
+ "dpadUp": "十字キー上",
+ "dpadDown": "十字キー下",
+ "dpadLeft": "十字キー左",
+ "dpadRight": "十字キー右",
+ "leftStick": "左スティック",
+ "rightStick": "右スティック"
+ },
+ "playstation": {
+ "a": "✕",
+ "b": "○",
+ "x": "□",
+ "y": "△",
+ "lb": "L1",
+ "rb": "R1",
+ "lt": "L2",
+ "rt": "R2",
+ "view": "Create",
+ "menu": "Options",
+ "xbox": "PS",
+ "ls": "左スティック押し込み",
+ "rs": "右スティック押し込み",
+ "dpadUp": "十字キー上",
+ "dpadDown": "十字キー下",
+ "dpadLeft": "十字キー左",
+ "dpadRight": "十字キー右",
+ "leftStick": "左スティック",
+ "rightStick": "右スティック"
+ },
+ "nintendo": {
+ "a": "B",
+ "b": "A",
+ "x": "Y",
+ "y": "X",
+ "lb": "L",
+ "rb": "R",
+ "lt": "ZL",
+ "rt": "ZR",
+ "view": "−",
+ "menu": "+",
+ "xbox": "HOME",
+ "ls": "左スティック押し込み",
+ "rs": "右スティック押し込み",
+ "dpadUp": "十字キー上",
+ "dpadDown": "十字キー下",
+ "dpadLeft": "十字キー左",
+ "dpadRight": "十字キー右",
+ "leftStick": "左スティック",
+ "rightStick": "右スティック"
+ },
+ "generic": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "ホーム",
+ "ls": "左スティック押し込み",
+ "rs": "右スティック押し込み",
+ "dpadUp": "十字キー上",
+ "dpadDown": "十字キー下",
+ "dpadLeft": "十字キー左",
+ "dpadRight": "十字キー右",
+ "leftStick": "左スティック",
+ "rightStick": "右スティック"
+ }
+ },
"actions": {
"none": "未設定",
"voice": "音声入力",
@@ -4232,6 +4318,57 @@
"battery": "{{percent}}%",
"charging": "充電中 {{percent}}%"
}
+ },
+ "playstationGamepad": {
+ "title": "PlayStation コントローラー",
+ "openAria": "PlayStation コントローラー設定を開く",
+ "entryDescription": "コントローラーでスクロール、音声入力、送信、タスク切り替え",
+ "connection": {
+ "toggle": { "aria": "Cindy が前面にあるとき PlayStation コントローラーを使う" },
+ "descriptions": {
+ "connecting": "Cindy は PlayStation コントローラーを探しています。",
+ "connected": "Cindy が前面にあるとき、このコントローラーを受け付けます。",
+ "disabled": "有効にすると、Cindy が前面にあるときにコントローラーを受け付けます。",
+ "present": "有効にすると、Cindy が前面にあるときにコントローラーを受け付けます。",
+ "not-detected": "USB または Bluetooth で DualSense または DualShock を接続してください。",
+ "error": "Cindy はコントローラーを読み取れず、再試行しています。",
+ "unavailable": "このコンピューターはまだ PlayStation コントローラーを読めません。"
+ }
+ }
+ },
+ "nintendoGamepad": {
+ "title": "Switch コントローラー",
+ "openAria": "Switch コントローラー設定を開く",
+ "entryDescription": "コントローラーでスクロール、音声入力、送信、タスク切り替え",
+ "connection": {
+ "toggle": { "aria": "Cindy が前面にあるとき Switch コントローラーを使う" },
+ "descriptions": {
+ "connecting": "Cindy は Switch コントローラーを探しています。",
+ "connected": "Cindy が前面にあるとき、このコントローラーを受け付けます。",
+ "disabled": "有効にすると、Cindy が前面にあるときにコントローラーを受け付けます。",
+ "present": "有効にすると、Cindy が前面にあるときにコントローラーを受け付けます。",
+ "not-detected": "USB または Bluetooth で Switch Pro または Joy-Con を接続してください。",
+ "error": "Cindy はコントローラーを読み取れず、再試行しています。",
+ "unavailable": "このコンピューターはまだ Switch コントローラーを読めません。"
+ }
+ }
+ },
+ "genericGamepad": {
+ "title": "汎用コントローラー",
+ "openAria": "汎用コントローラー設定を開く",
+ "entryDescription": "コントローラーでスクロール、音声入力、送信、タスク切り替え",
+ "connection": {
+ "toggle": { "aria": "Cindy が前面にあるとき汎用コントローラーを使う" },
+ "descriptions": {
+ "connecting": "Cindy はコントローラーを探しています。",
+ "connected": "Cindy が前面にあるとき、このコントローラーを受け付けます。",
+ "disabled": "有効にすると、Cindy が前面にあるときにコントローラーを受け付けます。",
+ "present": "有効にすると、Cindy が前面にあるときにコントローラーを受け付けます。",
+ "not-detected": "USB または Bluetooth でコントローラーを接続してください。",
+ "error": "Cindy はコントローラーを読み取れず、再試行しています。",
+ "unavailable": "このコンピューターはまだコントローラーを読めません。"
+ }
+ }
}
},
"ghosts": {
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 21a960174b..345b5b3357 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -4189,6 +4189,92 @@
"leftStick": "왼쪽 스틱",
"rightStick": "오른쪽 스틱"
},
+ "familyControls": {
+ "xbox": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "Xbox",
+ "ls": "왼쪽 스틱 클릭",
+ "rs": "오른쪽 스틱 클릭",
+ "dpadUp": "십자키 위",
+ "dpadDown": "십자키 아래",
+ "dpadLeft": "십자키 왼쪽",
+ "dpadRight": "십자키 오른쪽",
+ "leftStick": "왼쪽 스틱",
+ "rightStick": "오른쪽 스틱"
+ },
+ "playstation": {
+ "a": "✕",
+ "b": "○",
+ "x": "□",
+ "y": "△",
+ "lb": "L1",
+ "rb": "R1",
+ "lt": "L2",
+ "rt": "R2",
+ "view": "Create",
+ "menu": "Options",
+ "xbox": "PS",
+ "ls": "왼쪽 스틱 클릭",
+ "rs": "오른쪽 스틱 클릭",
+ "dpadUp": "십자키 위",
+ "dpadDown": "십자키 아래",
+ "dpadLeft": "십자키 왼쪽",
+ "dpadRight": "십자키 오른쪽",
+ "leftStick": "왼쪽 스틱",
+ "rightStick": "오른쪽 스틱"
+ },
+ "nintendo": {
+ "a": "B",
+ "b": "A",
+ "x": "Y",
+ "y": "X",
+ "lb": "L",
+ "rb": "R",
+ "lt": "ZL",
+ "rt": "ZR",
+ "view": "−",
+ "menu": "+",
+ "xbox": "HOME",
+ "ls": "왼쪽 스틱 클릭",
+ "rs": "오른쪽 스틱 클릭",
+ "dpadUp": "십자키 위",
+ "dpadDown": "십자키 아래",
+ "dpadLeft": "십자키 왼쪽",
+ "dpadRight": "십자키 오른쪽",
+ "leftStick": "왼쪽 스틱",
+ "rightStick": "오른쪽 스틱"
+ },
+ "generic": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "홈",
+ "ls": "왼쪽 스틱 클릭",
+ "rs": "오른쪽 스틱 클릭",
+ "dpadUp": "십자키 위",
+ "dpadDown": "십자키 아래",
+ "dpadLeft": "십자키 왼쪽",
+ "dpadRight": "십자키 오른쪽",
+ "leftStick": "왼쪽 스틱",
+ "rightStick": "오른쪽 스틱"
+ }
+ },
"actions": {
"none": "지정 안 함",
"voice": "음성 입력",
@@ -4232,6 +4318,57 @@
"battery": "{{percent}}%",
"charging": "충전 중 {{percent}}%"
}
+ },
+ "playstationGamepad": {
+ "title": "PlayStation 컨트롤러",
+ "openAria": "PlayStation 컨트롤러 설정 열기",
+ "entryDescription": "컨트롤러로 스크롤, 말하기, 보내기, 작업 전환",
+ "connection": {
+ "toggle": { "aria": "Cindy가 앞에 있을 때 PlayStation 컨트롤러를 사용합니다" },
+ "descriptions": {
+ "connecting": "Cindy가 PlayStation 컨트롤러를 찾고 있습니다.",
+ "connected": "Cindy가 앞에 있을 때 이 컨트롤러를 듣습니다.",
+ "disabled": "켜면 Cindy가 앞에 있을 때 컨트롤러를 듣습니다.",
+ "present": "켜면 Cindy가 앞에 있을 때 컨트롤러를 듣습니다.",
+ "not-detected": "USB 또는 Bluetooth로 DualSense 또는 DualShock를 연결하세요.",
+ "error": "Cindy가 컨트롤러를 읽지 못해 다시 시도하고 있습니다.",
+ "unavailable": "이 컴퓨터는 아직 PlayStation 컨트롤러를 읽을 수 없습니다."
+ }
+ }
+ },
+ "nintendoGamepad": {
+ "title": "Switch 컨트롤러",
+ "openAria": "Switch 컨트롤러 설정 열기",
+ "entryDescription": "컨트롤러로 스크롤, 말하기, 보내기, 작업 전환",
+ "connection": {
+ "toggle": { "aria": "Cindy가 앞에 있을 때 Switch 컨트롤러를 사용합니다" },
+ "descriptions": {
+ "connecting": "Cindy가 Switch 컨트롤러를 찾고 있습니다.",
+ "connected": "Cindy가 앞에 있을 때 이 컨트롤러를 듣습니다.",
+ "disabled": "켜면 Cindy가 앞에 있을 때 컨트롤러를 듣습니다.",
+ "present": "켜면 Cindy가 앞에 있을 때 컨트롤러를 듣습니다.",
+ "not-detected": "USB 또는 Bluetooth로 Switch Pro 또는 Joy-Con을 연결하세요.",
+ "error": "Cindy가 컨트롤러를 읽지 못해 다시 시도하고 있습니다.",
+ "unavailable": "이 컴퓨터는 아직 Switch 컨트롤러를 읽을 수 없습니다."
+ }
+ }
+ },
+ "genericGamepad": {
+ "title": "일반 컨트롤러",
+ "openAria": "일반 컨트롤러 설정 열기",
+ "entryDescription": "컨트롤러로 스크롤, 말하기, 보내기, 작업 전환",
+ "connection": {
+ "toggle": { "aria": "Cindy가 앞에 있을 때 일반 컨트롤러를 사용합니다" },
+ "descriptions": {
+ "connecting": "Cindy가 컨트롤러를 찾고 있습니다.",
+ "connected": "Cindy가 앞에 있을 때 이 컨트롤러를 듣습니다.",
+ "disabled": "켜면 Cindy가 앞에 있을 때 컨트롤러를 듣습니다.",
+ "present": "켜면 Cindy가 앞에 있을 때 컨트롤러를 듣습니다.",
+ "not-detected": "USB 또는 Bluetooth로 컨트롤러를 연결하세요.",
+ "error": "Cindy가 컨트롤러를 읽지 못해 다시 시도하고 있습니다.",
+ "unavailable": "이 컴퓨터는 아직 컨트롤러를 읽을 수 없습니다."
+ }
+ }
}
},
"ghosts": {
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 7484610d88..6f65320e66 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -4181,6 +4181,92 @@
"leftStick": "左摇杆",
"rightStick": "右摇杆"
},
+ "familyControls": {
+ "xbox": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "Xbox",
+ "ls": "左摇杆按下",
+ "rs": "右摇杆按下",
+ "dpadUp": "方向键上",
+ "dpadDown": "方向键下",
+ "dpadLeft": "方向键左",
+ "dpadRight": "方向键右",
+ "leftStick": "左摇杆",
+ "rightStick": "右摇杆"
+ },
+ "playstation": {
+ "a": "✕",
+ "b": "○",
+ "x": "□",
+ "y": "△",
+ "lb": "L1",
+ "rb": "R1",
+ "lt": "L2",
+ "rt": "R2",
+ "view": "Create",
+ "menu": "Options",
+ "xbox": "PS",
+ "ls": "左摇杆按下",
+ "rs": "右摇杆按下",
+ "dpadUp": "方向键上",
+ "dpadDown": "方向键下",
+ "dpadLeft": "方向键左",
+ "dpadRight": "方向键右",
+ "leftStick": "左摇杆",
+ "rightStick": "右摇杆"
+ },
+ "nintendo": {
+ "a": "B",
+ "b": "A",
+ "x": "Y",
+ "y": "X",
+ "lb": "L",
+ "rb": "R",
+ "lt": "ZL",
+ "rt": "ZR",
+ "view": "−",
+ "menu": "+",
+ "xbox": "HOME",
+ "ls": "左摇杆按下",
+ "rs": "右摇杆按下",
+ "dpadUp": "方向键上",
+ "dpadDown": "方向键下",
+ "dpadLeft": "方向键左",
+ "dpadRight": "方向键右",
+ "leftStick": "左摇杆",
+ "rightStick": "右摇杆"
+ },
+ "generic": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "主页",
+ "ls": "左摇杆按下",
+ "rs": "右摇杆按下",
+ "dpadUp": "方向键上",
+ "dpadDown": "方向键下",
+ "dpadLeft": "方向键左",
+ "dpadRight": "方向键右",
+ "leftStick": "左摇杆",
+ "rightStick": "右摇杆"
+ }
+ },
"actions": {
"none": "未设置",
"voice": "语音输入",
@@ -4224,6 +4310,57 @@
"battery": "{{percent}}%",
"charging": "充电中 {{percent}}%"
}
+ },
+ "playstationGamepad": {
+ "title": "PlayStation 手柄",
+ "openAria": "打开 PlayStation 手柄设置",
+ "entryDescription": "Cindy 在前台时,用手柄滚动、说话、发送和切换任务",
+ "connection": {
+ "toggle": { "aria": "让这个 Cindy 在前台时使用 PlayStation 手柄" },
+ "descriptions": {
+ "connecting": "Cindy 正在查找 PlayStation 手柄。",
+ "connected": "Cindy 在前台时会监听这只手柄。",
+ "disabled": "启用后,Cindy 在前台时会监听手柄。",
+ "present": "启用后,Cindy 在前台时会监听手柄。",
+ "not-detected": "请用 USB 或蓝牙连接 DualSense 或 DualShock。",
+ "error": "Cindy 暂时无法读取手柄,正在重试。",
+ "unavailable": "这台电脑还不能读取 PlayStation 手柄。"
+ }
+ }
+ },
+ "nintendoGamepad": {
+ "title": "Switch 手柄",
+ "openAria": "打开 Switch 手柄设置",
+ "entryDescription": "Cindy 在前台时,用手柄滚动、说话、发送和切换任务",
+ "connection": {
+ "toggle": { "aria": "让这个 Cindy 在前台时使用 Switch 手柄" },
+ "descriptions": {
+ "connecting": "Cindy 正在查找 Switch 手柄。",
+ "connected": "Cindy 在前台时会监听这只手柄。",
+ "disabled": "启用后,Cindy 在前台时会监听手柄。",
+ "present": "启用后,Cindy 在前台时会监听手柄。",
+ "not-detected": "请用 USB 或蓝牙连接 Switch Pro 或 Joy-Con。",
+ "error": "Cindy 暂时无法读取手柄,正在重试。",
+ "unavailable": "这台电脑还不能读取 Switch 手柄。"
+ }
+ }
+ },
+ "genericGamepad": {
+ "title": "通用手柄",
+ "openAria": "打开通用手柄设置",
+ "entryDescription": "Cindy 在前台时,用手柄滚动、说话、发送和切换任务",
+ "connection": {
+ "toggle": { "aria": "让这个 Cindy 在前台时使用通用手柄" },
+ "descriptions": {
+ "connecting": "Cindy 正在查找手柄。",
+ "connected": "Cindy 在前台时会监听这只手柄。",
+ "disabled": "启用后,Cindy 在前台时会监听手柄。",
+ "present": "启用后,Cindy 在前台时会监听手柄。",
+ "not-detected": "请用 USB 或蓝牙连接手柄。",
+ "error": "Cindy 暂时无法读取手柄,正在重试。",
+ "unavailable": "这台电脑还不能读取手柄。"
+ }
+ }
}
},
"ghosts": {
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 48273a12ea..541e0b8c3c 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -4181,6 +4181,92 @@
"leftStick": "左搖桿",
"rightStick": "右搖桿"
},
+ "familyControls": {
+ "xbox": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "Xbox",
+ "ls": "左搖桿按下",
+ "rs": "右搖桿按下",
+ "dpadUp": "方向鍵上",
+ "dpadDown": "方向鍵下",
+ "dpadLeft": "方向鍵左",
+ "dpadRight": "方向鍵右",
+ "leftStick": "左搖桿",
+ "rightStick": "右搖桿"
+ },
+ "playstation": {
+ "a": "✕",
+ "b": "○",
+ "x": "□",
+ "y": "△",
+ "lb": "L1",
+ "rb": "R1",
+ "lt": "L2",
+ "rt": "R2",
+ "view": "Create",
+ "menu": "Options",
+ "xbox": "PS",
+ "ls": "左搖桿按下",
+ "rs": "右搖桿按下",
+ "dpadUp": "方向鍵上",
+ "dpadDown": "方向鍵下",
+ "dpadLeft": "方向鍵左",
+ "dpadRight": "方向鍵右",
+ "leftStick": "左搖桿",
+ "rightStick": "右搖桿"
+ },
+ "nintendo": {
+ "a": "B",
+ "b": "A",
+ "x": "Y",
+ "y": "X",
+ "lb": "L",
+ "rb": "R",
+ "lt": "ZL",
+ "rt": "ZR",
+ "view": "−",
+ "menu": "+",
+ "xbox": "HOME",
+ "ls": "左搖桿按下",
+ "rs": "右搖桿按下",
+ "dpadUp": "方向鍵上",
+ "dpadDown": "方向鍵下",
+ "dpadLeft": "方向鍵左",
+ "dpadRight": "方向鍵右",
+ "leftStick": "左搖桿",
+ "rightStick": "右搖桿"
+ },
+ "generic": {
+ "a": "A",
+ "b": "B",
+ "x": "X",
+ "y": "Y",
+ "lb": "LB",
+ "rb": "RB",
+ "lt": "LT",
+ "rt": "RT",
+ "view": "View",
+ "menu": "Menu",
+ "xbox": "主頁",
+ "ls": "左搖桿按下",
+ "rs": "右搖桿按下",
+ "dpadUp": "方向鍵上",
+ "dpadDown": "方向鍵下",
+ "dpadLeft": "方向鍵左",
+ "dpadRight": "方向鍵右",
+ "leftStick": "左搖桿",
+ "rightStick": "右搖桿"
+ }
+ },
"actions": {
"none": "未設定",
"voice": "語音輸入",
@@ -4224,6 +4310,57 @@
"battery": "{{percent}}%",
"charging": "充電中 {{percent}}%"
}
+ },
+ "playstationGamepad": {
+ "title": "PlayStation 手把",
+ "openAria": "打開 PlayStation 手把設定",
+ "entryDescription": "Cindy 在前景時,用手把捲動、說話、傳送和切換任務",
+ "connection": {
+ "toggle": { "aria": "讓這個 Cindy 在前景時使用 PlayStation 手把" },
+ "descriptions": {
+ "connecting": "Cindy 正在尋找 PlayStation 手把。",
+ "connected": "Cindy 在前景時會監聽這只手把。",
+ "disabled": "啟用後,Cindy 在前景時會監聽手把。",
+ "present": "啟用後,Cindy 在前景時會監聽手把。",
+ "not-detected": "請用 USB 或藍牙連接 DualSense 或 DualShock。",
+ "error": "Cindy 暫時無法讀取手把,正在重試。",
+ "unavailable": "這台電腦還不能讀取 PlayStation 手把。"
+ }
+ }
+ },
+ "nintendoGamepad": {
+ "title": "Switch 手把",
+ "openAria": "打開 Switch 手把設定",
+ "entryDescription": "Cindy 在前景時,用手把捲動、說話、傳送和切換任務",
+ "connection": {
+ "toggle": { "aria": "讓這個 Cindy 在前景時使用 Switch 手把" },
+ "descriptions": {
+ "connecting": "Cindy 正在尋找 Switch 手把。",
+ "connected": "Cindy 在前景時會監聽這只手把。",
+ "disabled": "啟用後,Cindy 在前景時會監聽手把。",
+ "present": "啟用後,Cindy 在前景時會監聽手把。",
+ "not-detected": "請用 USB 或藍牙連接 Switch Pro 或 Joy-Con。",
+ "error": "Cindy 暫時無法讀取手把,正在重試。",
+ "unavailable": "這台電腦還不能讀取 Switch 手把。"
+ }
+ }
+ },
+ "genericGamepad": {
+ "title": "通用手把",
+ "openAria": "打開通用手把設定",
+ "entryDescription": "Cindy 在前景時,用手把捲動、說話、傳送和切換任務",
+ "connection": {
+ "toggle": { "aria": "讓這個 Cindy 在前景時使用通用手把" },
+ "descriptions": {
+ "connecting": "Cindy 正在尋找手把。",
+ "connected": "Cindy 在前景時會監聽這只手把。",
+ "disabled": "啟用後,Cindy 在前景時會監聽手把。",
+ "present": "啟用後,Cindy 在前景時會監聽手把。",
+ "not-detected": "請用 USB 或藍牙連接手把。",
+ "error": "Cindy 暫時無法讀取手把,正在重試。",
+ "unavailable": "這台電腦還不能讀取手把。"
+ }
+ }
}
},
"ghosts": {
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index d58770e914..7ef5b0a7b5 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -1861,15 +1861,21 @@ interface ElectronAPI {
};
xboxGamepad: {
- getState: () => Promise<import('../shared/xboxGamepad').XboxGamepadState>;
+ getState: () => Promise<import('../shared/xboxGamepad').GamepadAccessoriesState>;
setSettings: (
+ family: import('../shared/xboxGamepad').GamepadFamily,
patch: import('../shared/xboxGamepad').XboxGamepadSettingsPatch,
- ) => Promise<import('../shared/xboxGamepad').XboxGamepadState>;
- resetSettings: () => Promise<import('../shared/xboxGamepad').XboxGamepadState>;
- probe: () => Promise<import('../shared/xboxGamepad').XboxGamepadState>;
- setLayoutPreviewActive: (active: boolean) => Promise<void>;
+ ) => Promise<import('../shared/xboxGamepad').GamepadAccessoriesState>;
+ resetSettings: (
+ family: import('../shared/xboxGamepad').GamepadFamily,
+ ) => Promise<import('../shared/xboxGamepad').GamepadAccessoriesState>;
+ probe: () => Promise<import('../shared/xboxGamepad').GamepadAccessoriesState>;
+ setLayoutPreviewActive: (
+ active: boolean,
+ family?: import('../shared/xboxGamepad').GamepadFamily,
+ ) => Promise<void>;
onStateChanged: (
- callback: (state: import('../shared/xboxGamepad').XboxGamepadState) => void,
+ callback: (state: import('../shared/xboxGamepad').GamepadAccessoriesState) => void,
) => () => void;
onPreviewInput: (
callback: (input: import('../shared/xboxGamepad').XboxGamepadPreviewInput) => void,
diff --git a/apps/desktop/src/shared/__tests__/xboxGamepad.family.test.ts b/apps/desktop/src/shared/__tests__/xboxGamepad.family.test.ts
new file mode 100644
index 0000000000..006a2ee67c
--- /dev/null
+++ b/apps/desktop/src/shared/__tests__/xboxGamepad.family.test.ts
@@ -0,0 +1,48 @@
+import { describe, expect, it } from 'vitest';
+
+import { VISIBLE_GAMEPAD_FAMILIES, resolveGamepadFamily } from '../xboxGamepad';
+
+describe('visible gamepad accessories', () => {
+ it('publishes Xbox and PlayStation only', () => {
+ expect([...VISIBLE_GAMEPAD_FAMILIES]).toEqual(['xbox', 'playstation']);
+ });
+});
+
+describe('resolveGamepadFamily', () => {
+ it('trusts an explicit family from the helper', () => {
+ expect(resolveGamepadFamily({ family: 'nintendo', name: 'Xbox Wireless Controller' })).toBe(
+ 'nintendo',
+ );
+ });
+
+ it('classifies DualSense and DualShock as PlayStation', () => {
+ expect(resolveGamepadFamily({ name: 'DualSense Wireless Controller' })).toBe('playstation');
+ expect(resolveGamepadFamily({ name: 'Wireless Controller', category: 'DualShock 4' })).toBe(
+ 'playstation',
+ );
+ expect(resolveGamepadFamily({ name: 'Sony Interactive Entertainment' })).toBe('playstation');
+ });
+
+ it('classifies Switch Pro and Joy-Con as Nintendo', () => {
+ expect(resolveGamepadFamily({ name: 'Pro Controller', category: 'Nintendo Switch' })).toBe(
+ 'nintendo',
+ );
+ expect(resolveGamepadFamily({ name: 'Joy-Con (L)' })).toBe('nintendo');
+ });
+
+ it('keeps Xbox-named pads on the Xbox accessory', () => {
+ expect(resolveGamepadFamily({ name: 'Xbox Wireless Controller' })).toBe('xbox');
+ expect(resolveGamepadFamily({ name: 'Elite Series 2' })).toBe('xbox');
+ });
+
+ it('keeps wired Microsoft Controller pads on the Xbox accessory', () => {
+ expect(resolveGamepadFamily({ name: 'Microsoft', category: 'Controller' })).toBe('xbox');
+ expect(resolveGamepadFamily({ name: 'Controller' })).toBe('xbox');
+ });
+
+ it('defaults unknown extended pads to the generic accessory', () => {
+ expect(resolveGamepadFamily({ name: '8BitDo Pro 2' })).toBe('generic');
+ expect(resolveGamepadFamily({ name: 'Game Controller' })).toBe('generic');
+ expect(resolveGamepadFamily({})).toBe('generic');
+ });
+});
diff --git a/apps/desktop/src/shared/xboxGamepad.ts b/apps/desktop/src/shared/xboxGamepad.ts
index 16258cc65f..1a69620e65 100644
--- a/apps/desktop/src/shared/xboxGamepad.ts
+++ b/apps/desktop/src/shared/xboxGamepad.ts
@@ -5,11 +5,34 @@ import {
} from './inputDevices';
export const XBOX_GAMEPAD_DEVICE_ID = 'xbox-gamepad';
+export const PLAYSTATION_GAMEPAD_DEVICE_ID = 'playstation-gamepad';
+export const NINTENDO_GAMEPAD_DEVICE_ID = 'nintendo-gamepad';
+export const GENERIC_GAMEPAD_DEVICE_ID = 'generic-gamepad';
+
+const GAMEPAD_CAPABILITIES = [{ kind: 'commands' }, { kind: 'voice' }, { kind: 'stick' }] as const;
export const XBOX_GAMEPAD_DEVICE: InputDeviceDescriptor = {
id: XBOX_GAMEPAD_DEVICE_ID,
label: 'Xbox',
- capabilities: [{ kind: 'commands' }, { kind: 'voice' }, { kind: 'stick' }],
+ capabilities: GAMEPAD_CAPABILITIES,
+};
+
+export const PLAYSTATION_GAMEPAD_DEVICE: InputDeviceDescriptor = {
+ id: PLAYSTATION_GAMEPAD_DEVICE_ID,
+ label: 'PlayStation',
+ capabilities: GAMEPAD_CAPABILITIES,
+};
+
+export const NINTENDO_GAMEPAD_DEVICE: InputDeviceDescriptor = {
+ id: NINTENDO_GAMEPAD_DEVICE_ID,
+ label: 'Switch',
+ capabilities: GAMEPAD_CAPABILITIES,
+};
+
+export const GENERIC_GAMEPAD_DEVICE: InputDeviceDescriptor = {
+ id: GENERIC_GAMEPAD_DEVICE_ID,
+ label: 'Gamepad',
+ capabilities: GAMEPAD_CAPABILITIES,
};
export const XBOX_GAMEPAD_GET_STATE_CHANNEL = 'xbox-gamepad:get-state';
@@ -66,12 +89,7 @@ export interface XboxGamepadLayout {
}
export type XboxGamepadConnectionStatus =
- | 'connecting'
- | 'connected'
- | 'not-detected'
- | 'disabled'
- | 'error'
- | 'unavailable';
+ 'connecting' | 'connected' | 'not-detected' | 'disabled' | 'error' | 'unavailable';
export interface XboxGamepadSettings {
deviceEnabled: boolean;
@@ -82,10 +100,18 @@ export type XboxGamepadSettingsPatch = Partial<XboxGamepadSettings>;
export type XboxGamepadTransport = 'usb' | 'bluetooth' | 'unknown';
export type XboxGamepadBatteryState = 'unknown' | 'discharging' | 'charging' | 'full';
+export const GAMEPAD_FAMILIES = ['xbox', 'playstation', 'nintendo', 'generic'] as const;
+export type GamepadFamily = (typeof GAMEPAD_FAMILIES)[number];
+/** Settings currently lists Xbox and PlayStation only. Nintendo / generic stay implemented. */
+export const VISIBLE_GAMEPAD_FAMILIES = [
+ 'xbox',
+ 'playstation',
+] as const satisfies readonly GamepadFamily[];
export interface XboxGamepadDeviceInfo {
name: string | null;
category: string | null;
+ family: GamepadFamily;
transport: XboxGamepadTransport;
batteryPercentage: number | null;
batteryState: XboxGamepadBatteryState;
@@ -94,11 +120,68 @@ export interface XboxGamepadDeviceInfo {
export const XBOX_GAMEPAD_EMPTY_DEVICE: XboxGamepadDeviceInfo = {
name: null,
category: null,
+ family: 'xbox',
transport: 'unknown',
batteryPercentage: null,
batteryState: 'unknown',
};
+export function emptyGamepadDevice(family: GamepadFamily): XboxGamepadDeviceInfo {
+ return { ...XBOX_GAMEPAD_EMPTY_DEVICE, family };
+}
+
+export function isGamepadFamily(value: unknown): value is GamepadFamily {
+ return typeof value === 'string' && (GAMEPAD_FAMILIES as readonly string[]).includes(value);
+}
+
+/**
+ * Bindings stay on Apple/Xbox positions (A=bottom, B=right, X=left, Y=top).
+ * Family only changes the silhouette and the printed legends.
+ */
+export const GAMEPAD_DEVICES: Record<GamepadFamily, InputDeviceDescriptor> = {
+ xbox: XBOX_GAMEPAD_DEVICE,
+ playstation: PLAYSTATION_GAMEPAD_DEVICE,
+ nintendo: NINTENDO_GAMEPAD_DEVICE,
+ generic: GENERIC_GAMEPAD_DEVICE,
+};
+
+export function resolveGamepadFamily(input: {
+ family?: unknown;
+ name?: string | null;
+ category?: string | null;
+}): GamepadFamily {
+ if (isGamepadFamily(input.family)) return input.family;
+ const hay = `${input.name ?? ''} ${input.category ?? ''}`.toLowerCase();
+ if (
+ hay.includes('dualsense') ||
+ hay.includes('dualshock') ||
+ hay.includes('playstation') ||
+ hay.includes('sony') ||
+ /\bps[45]\b/.test(hay)
+ ) {
+ return 'playstation';
+ }
+ if (
+ hay.includes('nintendo') ||
+ hay.includes('switch') ||
+ hay.includes('joy-con') ||
+ hay.includes('joycon')
+ ) {
+ return 'nintendo';
+ }
+ // Wired Xbox pads often advertise USB product "Controller" and vendor Microsoft.
+ if (
+ hay.includes('xbox') ||
+ hay.includes('elite') ||
+ hay.includes('microsoft') ||
+ /\bseries [xs]\b/.test(hay) ||
+ (input.name ?? '').toLowerCase() === 'controller'
+ ) {
+ return 'xbox';
+ }
+ return 'generic';
+}
+
export interface XboxGamepadState {
connectionStatus: XboxGamepadConnectionStatus;
devicePresent: boolean | null;
@@ -107,7 +190,10 @@ export interface XboxGamepadState {
settings: XboxGamepadSettings;
}
+export type GamepadAccessoriesState = Record<GamepadFamily, XboxGamepadState>;
+
export interface XboxGamepadPreviewInput {
+ family: GamepadFamily;
buttons: Record<XboxGamepadButtonId, boolean>;
sticks: Record<XboxGamepadStickId, { x: number; y: number }>;
triggers: { lt: number; rt: number };
@@ -174,6 +260,7 @@ export const XBOX_GAMEPAD_DEFAULT_SETTINGS: XboxGamepadSettings = {
};
export const XBOX_GAMEPAD_EMPTY_PREVIEW: XboxGamepadPreviewInput = {
+ family: 'xbox',
buttons: Object.fromEntries(XBOX_GAMEPAD_BUTTON_IDS.map((id) => [id, false])) as Record<
XboxGamepadButtonId,
boolean
@@ -185,8 +272,14 @@ export const XBOX_GAMEPAD_EMPTY_PREVIEW: XboxGamepadPreviewInput = {
triggers: { lt: 0, rt: 0 },
};
+export function emptyGamepadPreview(family: GamepadFamily): XboxGamepadPreviewInput {
+ return { ...XBOX_GAMEPAD_EMPTY_PREVIEW, family };
+}
+
export function isXboxGamepadButtonId(value: unknown): value is XboxGamepadButtonId {
- return typeof value === 'string' && (XBOX_GAMEPAD_BUTTON_IDS as readonly string[]).includes(value);
+ return (
+ typeof value === 'string' && (XBOX_GAMEPAD_BUTTON_IDS as readonly string[]).includes(value)
+ );
}
export function isXboxGamepadStickId(value: unknown): value is XboxGamepadStickId {
@@ -195,12 +288,15 @@ export function isXboxGamepadStickId(value: unknown): value is XboxGamepadStickI
export function isXboxGamepadStickDirection(value: unknown): value is XboxGamepadStickDirection {
return (
- typeof value === 'string' && (XBOX_GAMEPAD_STICK_DIRECTIONS as readonly string[]).includes(value)
+ typeof value === 'string' &&
+ (XBOX_GAMEPAD_STICK_DIRECTIONS as readonly string[]).includes(value)
);
}
export function isXboxGamepadStickMode(value: unknown): value is XboxGamepadStickMode {
- return typeof value === 'string' && (XBOX_GAMEPAD_STICK_MODES as readonly string[]).includes(value);
+ return (
+ typeof value === 'string' && (XBOX_GAMEPAD_STICK_MODES as readonly string[]).includes(value)
+ );
}
export function cloneXboxGamepadBinding(
@@ -213,7 +309,10 @@ export function cloneXboxGamepadLayout(layout: XboxGamepadLayout): XboxGamepadLa
return {
version: 1,
buttons: Object.fromEntries(
- XBOX_GAMEPAD_BUTTON_IDS.map((id) => [id, cloneXboxGamepadBinding(layout.buttons[id] ?? null)]),
+ XBOX_GAMEPAD_BUTTON_IDS.map((id) => [
+ id,
+ cloneXboxGamepadBinding(layout.buttons[id] ?? null),
+ ]),
) as XboxGamepadLayout['buttons'],
sticks: Object.fromEntries(
XBOX_GAMEPAD_STICK_IDS.map((id) => {
@@ -252,7 +351,12 @@ export function createXboxGamepadDefaultSettings(): XboxGamepadSettings {
export function isXboxGamepadBinding(value: unknown): value is XboxGamepadBinding {
if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
- const record = value as { type?: unknown; commandId?: unknown; skillId?: unknown; name?: unknown };
+ const record = value as {
+ type?: unknown;
+ commandId?: unknown;
+ skillId?: unknown;
+ name?: unknown;
+ };
if (record.type === 'command') return isInputDeviceCommandId(record.commandId);
if (record.type === 'skill') {
return (
diff --git a/docs/design-rules/cindy-design-system.md b/docs/design-rules/cindy-design-system.md
index e9ea0a4610..c4d8201e4c 100644
--- a/docs/design-rules/cindy-design-system.md
+++ b/docs/design-rules/cindy-design-system.md
@@ -12,9 +12,13 @@
| [`token-decision-table.md`](./token-decision-table.md) | 登录链路色值 / 尺寸 → token 决策记录(新增 / 复用 / 豁免的判定理由 + 各 wave 增补台账) | 决策记录(现行 token 清单与值以 `DESIGN.md §16.1` + `colors.ts` 为准) |
| [`design-decision-log.md`](./design-decision-log.md) | 全局设计决策史台账:被推翻的方案、勘误过程、backlog(已收录原 `DESIGN.md §13` G1–G4 归档与 §15 决策史全量) | 决策台账(只增不改;与 `DESIGN.md` 冲突时以 `DESIGN.md` 为准) |
| [`README.md`](./README.md) | 本目录使用规则 | 说明 |
+| [`gamepad-silhouette-authoring.md`](./gamepad-silhouette-authoring.md) | 设置页手柄线稿交稿约定:画板网格、长弧画法、外壳/按键分家、热区与按下填充;附 Xbox Series 现稿 | 作者交稿约定 |
+| [`xbox-series-gamepad.silhouette.svg`](./xbox-series-gamepad.silhouette.svg) | 设置页 Xbox Series 线稿现稿(与 `XboxGamepadLayout.tsx` 同坐标) | 样板图 |
+| [`playstation-dualsense-gamepad.silhouette.svg`](./playstation-dualsense-gamepad.silhouette.svg) | 设置页 DualSense 线稿现稿(与 `PlayStationGamepadLayout.tsx` 同坐标) | 样板图 |
## 版本记录
+- **2026-08-24(手柄线稿交稿)**:新增 [`gamepad-silhouette-authoring.md`](./gamepad-silhouette-authoring.md),把设置页 Xbox 手柄图的画法收成同事交稿约定(同网格、长弧、键壳分家、热区与填充)。
- **2026-08-06(资源用量进程类别色)**:按用户对资源用量面板“icon 改为彩色”的走查要求,`DESIGN.md §2 / §10` 登记仅限 14px 进程类型 glyph 的六色 Light / Dark 调色板;颜色只编码任务 Agent、控制面服务、主进程、Renderer、GPU、Utility 类别,不表达健康或运行状态,行背景、文字、指标与操作继续保持中性。对应 token 加入外部主题导入保护,防类别色随导入主题漂移;该例外不得扩散到其它表格或进程 UI。
- **2026-08-03(排版立法:字重四档 + 桌面字号白名单,issue #1505 PR1)**:`DESIGN.md §3` 字重梯由「仅 400/500」修订为 400/500/600/700 四档(600 = 限量强调收编存量 72 处 semibold(生产代码口径);700 仅限豁免域;800 及中间值全禁;与手机端 `fontWeight` token 对齐),§3 Principles / §7 Don'ts / §9 Iteration Guide 三处「never bold」表述同步改写;§3 新增四个小节——「字重阶梯」(含 CJK 伪粗体注记:中文层级不得依赖 600 vs 700)、「桌面 UI 字号白名单」(UI 段 {10–16} + 标题段 {18,20,24,28},禁任意值 `text-[Npx]` 与小数;语义别名只收编 `xs/sm/base/lg`,源码侧禁止 `xl` 及以上,配置侧遗留项不在本轮删除范围;**四个权威来源的镜像关系已由 PR #1553 建立,另有 tailwind-merge 字号去重消费端单独校验**)、「排版豁免登记表」(登录品牌画布 / markdown `<strong>` / hljs 移植 / 外部页注入 / 手机 WebView 生成器 / 紧凑模式派生值)、「排版 non-goals」(line-height 混轨等本轮明确不治理)。走查数据、三项拍板与后续施工计划见 [`design-decision-log.md`](./design-decision-log.md)「2026-08-03」条与 issue #1505。
- **2026-07-29(修正:手机端功能区落位回新稿标注值)**:手机短屏 / 长屏的 `loginY` 由 main 原值 694 / 933 改回新稿标注值 **622 / 827**;短屏以下(dh<1334)改为 `min(622, max(0, dh-640))`——保留紧凑底距 18 再钳到短屏档落位(**不是**把锚常量改成 `dh-712`:那会让 dh∈[712,1222) 全段字标被面板压盖,review 实算 dh=1000 压 40 设计px)。起因:2026-07-28 剥离手机端跳过登录时把功能区落位一并退回 main,却保留了已换新稿的品牌簇,两半拼接使「字标底↔面板顶」间距变成 **92 / 131.65** 设计px(稿内为 20 / 25.65),实机肉眼可见一条空白。修正后间距回到稿值;面板 500→440 少掉的 60 落到底部留白(90 / 175,比稿内多 60)——审图拍板「方案 B」,未采纳「品牌簇整体下移 60」的方案 A。`DESIGN.md §16.2` 表与「60 去向」条目、§16 末尾勘误块 (6) 已就地更新;`loginSkinLayout.test.ts` 新增三条不变式:「间距上界不变式」(等于稿值,替代原先只判不重叠的下界)、「锚常量连续性不变式」(dh=1334 上下不跳变)、「间距不变式(短屏以下分支)」(dh∈[850,1334) 采样点面板顶不得压到字标底),防再次只改一半、也防窄屏压盖回归。pad 竖屏不受影响(无新稿帧、品牌簇未换基准,保持 621 / 158)。
diff --git a/docs/design-rules/gamepad-silhouette-authoring.md b/docs/design-rules/gamepad-silhouette-authoring.md
new file mode 100644
index 0000000000..afac4ef41c
--- /dev/null
+++ b/docs/design-rules/gamepad-silhouette-authoring.md
@@ -0,0 +1,240 @@
+# 手柄线稿交稿约定
+
+设置页里的手柄图不是插画,是 **可点的键位图**:用户点某一块,改这个键绑定什么;按下真手柄时,对应块会亮。
+
+本文以当前 Xbox Series 图为合格样板。新手柄按同一套交,不要另发明一种画法。
+
+- 线稿现稿(可直接打开):[`xbox-series-gamepad.silhouette.svg`](./xbox-series-gamepad.silhouette.svg)
+- 代码实现:`apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx`
+
+---
+
+## 1. 要交什么
+
+最小包三样,缺一不算齐:
+
+1. **分层 SVG**(主交付)
+2. **参考线稿 PNG**(和画板同尺寸,或注明缩放)
+3. **键位表**(每个可点部件的 id、热区、填充、备注)
+
+不要只交照片、自动描边、或一张打平的 AI/PNG。
+
+---
+
+## 2. 画板与坐标
+
+沿用 Xbox 这套网格,方便直接写进代码:
+
+| 项 | 值 |
+|---|---|
+| 画板 | `1050 × 660` |
+| 显示 `viewBox` | `(0, 0, 1050, 660)` |
+| 单位 | **图上 1px = 代码 1 单位** |
+| 朝向 | 正视,握把朝下,左摇杆在左上、右摇杆在右下(Xbox 布局) |
+
+量点时直接读 SVG / 参考图像素。左右对称的手柄,先定中线(Xbox 约为 `x = 525`),右半用 `x' = 2 × 中线 − x`。
+
+SVG 根节点写明:
+
+```xml
+<svg viewBox="0 0 1050 660" fill="none"
+ stroke="currentColor" stroke-width="2.6"
+ stroke-linejoin="round" stroke-linecap="round">
+```
+
+颜色用 `currentColor`,不要写死黑白。外壳轮廓可以 `stroke-width="3"`,内部零件保持 `2.6`。
+
+---
+
+## 3. 线怎么画
+
+- **少量长立方贝塞尔(`C`)一气呵成。** 外壳两侧、握把、肩键弧,各用几根长曲线,不要沿像素描成上百个短段。
+- 锚点落在结构转折上:喇叭顶、肩线与机身相接、握把最外、分界竖线。
+- 需要轻微弧度就画浅弧,不要为了「精确贴图」把线折碎。
+- 两条线在视觉上是一根贯通线时,端点必须对齐到同一坐标(例如肩键三根横线与分界竖线交于同一 `x`)。
+- 线和机身相接时,端点落在外壳 path 上,不要悬空、也不要为了贴边去改已经定稿的键位线。该收的是外壳,不是键。
+
+禁止:
+
+- 位图描边、自动 trace
+- 把按钮轮廓画进外壳(见 §5)
+- 用一块闭合色块代替「一根键的几条边」
+
+---
+
+## 4. 图层:一根线只属于一个东西
+
+先分清 **外壳 / 按键 / 装饰**,再下笔。这是 Xbox 返工最多的地方。
+
+| 层 | 画什么 | 不画什么 |
+|---|---|---|
+| `body` | 外壳外轮廓、喇叭外形、握把 | 肩键顶边、扳机内沿接到台面的那段 |
+| 扳机 `lt` / `rt` | 喇叭本身;需要时加喇叭内侧短刻线 | 肩键上缘 |
+| 肩键 `lb` / `rb` | 这颗键自己的每一条边 | 画进喇叭里面、或跟外壳抢同一段 |
+| 台面 / 中线 | 键与键之间共用的横线、竖分界 | 和外壳轮廓重复描一遍(外壳已有的台面线,键的线接到它即可) |
+| 摇杆 / 十字键 / 面键 / View / Menu / Guide | 各自零件 | — |
+| `decor` | Logo、配对灯、Share 空胶囊等 | 不要做热区 |
+
+**肩键这种「一块塑料、多条棱」的,一条棱一根 path。**
+Xbox 的 LB 是三根线,接到中间三根横线:
+
+| 肩键上的线 | 接到中间 |
+|---|---|
+| 较高的上缘弧 | 最上面那根(台面 / `y ≈ 154`) |
+| 较低的上缘弧 | 中间那根(`y ≈ 172`) |
+| 底边 | 最下面那根(`y ≈ 188`) |
+
+两根上缘弧形状相似,都画在肩键上,**都不进 LT**。底边左右可以略低于中间,但两端要落到外壳上。分界处三根横线与竖线对齐到同一 `x`(现用 `437` / `733`)。
+
+扳机(LT)和肩键(LB)不要共用一段轮廓。喇叭内沿接到台面的那条,算肩键最上沿,不算扳机。
+
+---
+
+## 5. 可点部件与热区
+
+每个能改绑定的键都要有热区。热区是叠在图上的透明按钮,不是描边的一部分。
+
+### 必须有热区的(Xbox)
+
+`lt` `rt` `lb` `rb` `xbox` `view` `menu`
+`y` `x` `b` `a`
+`left` `right`(摇杆)
+`dpadUp` `dpadDown` `dpadLeft` `dpadRight`
+
+Share、配对灯、装饰刻线:**无热区**。
+
+### 热区怎么标
+
+矩形:`[x, y, w, h]`(与画板同一坐标)。圆的加 `round`。不规则的(扳机喇叭)**直接交闭合 path**,热区和按下填充用同一条,不要另画一个方块再裁切。
+
+Xbox 扳机现用:热区 = `press-lt` / `press-rt` 同一 path。灰块必须贴满喇叭边,不能和外壳之间漏缝,也不能盖到 LB。
+
+### 键位表格式
+
+```json
+{
+ "id": "lb",
+ "hit": [205, 152, 232, 52],
+ "round": false,
+ "press": "#press-lb",
+ "notes": "三根边接到中间三根横线;热区顶边在喇叭下方,不要伸进 LT"
+}
+```
+
+摇杆额外给:
+
+- `center`:`[x, y]`
+- 凹槽椭圆、帽的圆
+- 模拟量移动半径(Xbox 现用约 `14`)
+
+---
+
+## 6. 按下填充
+
+每个可点键另出 **闭合 path**(`Z`),只用于半透明填充,不负责描边。
+
+- 填充形状贴着该键可见范围,不要漏到外壳外或邻键上
+- 描边仍用 §4 那些分开的线,不要靠填充的边当轮廓
+- 填充色由实现写成 `currentColor` + 低透明度,稿里用灰色示意即可
+
+扳机填充跟着喇叭,且与热区同一 path;肩键填充是三根线围起来的口袋。灰块若和外壳之间有缝,把填充沿贴到外壳那条弧上。
+
+---
+
+## 7. Xbox Series 现稿(合格样板)
+
+同事先打开这张图,对照图层和坐标,再画别的手柄:
+
+[`xbox-series-gamepad.silhouette.svg`](./xbox-series-gamepad.silhouette.svg)
+
+浏览器或 Figma / Illustrator 都能开。图层 id 与下表一致。
+
+### 7.1 结构
+
+```
+body 外壳
+bumper-top LB / RB 最上沿,接到中间上台面
+bumper-mid 中间弧
+bumper-bottom 底边
+bumper-notch 竖分界 x≈372 / x≈672
+press-lb/rb 肩键闭合填充(= 热区 path)
+press-lt/rt 喇叭闭合填充(= 热区 path)
+lt-tick 喇叭内侧短刻线(装饰,无热区)
+pairing 配对椭圆 + )))(装饰,无热区)
+stick-left 左摇杆(上、在十字键上方)
+stick-right 右摇杆(下、在面键下方)
+dpad 圆盘 + 十字
+face Y / X / B / A
+view / menu 圆底 + 图标
+share 空胶囊,装饰
+guide 官方四瓣 Xbox 标
+```
+
+中线约 `x = 525`。分界竖线:`372` / `672`。
+
+### 7.2 中心点
+
+| 零件 | 坐标 |
+|---|---|
+| 左摇杆 | `244.6, 301.6` |
+| 右摇杆 | `662.3, 459.2` |
+| Y / X / B / A | `803.7,213.2` / `728.2,287.3` / `873.9,278.7` / `799.6,351.9` |
+| View / Menu | `446.2,289.1` / `602.4,288.4` |
+| Guide | `524.4, 179.7` |
+| 配对灯 | `442.3, 83.1` |
+
+摇杆凹槽见 SVG `stick-left` / `stick-right`;模拟量位移半径 `14`。
+
+### 7.3 热区(现稿)
+
+| id | hit | 形状 |
+|---|---|---|
+| `lt` / `rt` | `press-lt` / `press-rt` path | 与按下填充同一轮廓 |
+| `lb` / `rb` | `press-lb` / `press-rb` path | 与按下填充同一轮廓 |
+| `xbox` | `[484.3, 139.1, 80.3, 81.1]` | 徽标外接框 |
+| `view` | `[424.7, 268.3, 42.9, 41.6]` | 圆 |
+| `menu` | `[582.0, 268.1, 40.6, 40.7]` | 圆 |
+| `left` | `[182.7, 237.3, 123.9, 128.7]` | 圆 |
+| `right` | `[600.6, 394.4, 123.6, 129.6]` | 圆 |
+| `y` / `x` / `b` / `a` | `[768.8,180.6,69.9,65.2]` / `[693.2,253.8,70.0,67.1]` / `[840.4,245.5,67.0,66.5]` / `[767.0,319.9,65.2,64.1]` | 圆 |
+| `dpadUp` / `Left` / `Right` / `Down` | `press-dpad` 四向 path | 与按下填充同一轮廓 |
+
+Share、配对灯、喇叭刻线:无热区。
+
+### 7.4 现稿 path
+
+与样板 SVG / `xboxSeriesSilhouette.ts` 同步。改线先改样板 SVG,再回写代码。路径以 SVG 图层为准,这里不再抄一份。
+
+---
+
+## 8. 交稿 SVG 检查
+
+打开 SVG 应能直接回答:
+
+- [ ] `viewBox` 是 `(0, 0, 1050, 660)` 或已换算到这套
+- [ ] 外壳是少数长弧,没有碎锚点
+- [ ] 每个可点键的边都在自己的图层,没有画进外壳
+- [ ] 肩键若有多条棱,每条单独 path,并写明接到哪根中线
+- [ ] 贯通线在分界处端点重合
+- [ ] 与外壳相接的线,端点在外壳上
+- [ ] 每个可点键有 `hit` 和 `press`,热区不互相大面积重叠
+- [ ] 装饰件标明「无热区」
+- [ ] 描边未写死颜色,用 `currentColor`
+
+---
+
+## 9. 常见不合格
+
+1. **自动描图**:轮廓一顿一顿的,两侧对不齐。退回重画长弧。
+2. **键的线画进外壳**:看起来像扳机多了一条内沿。把这段改到对应键的图层。
+3. **少线**:肩键只画了一条边,中间横线接不上。按零件真实棱数补线。
+4. **热区是个大方块**:点 LT 点到 LB。不规则键用零件自己的闭合 path 做热区。
+5. **按下灰块和轮廓之间有缝**:灰块没贴到外壳。填充左/右沿要走外壳那条弧。
+6. **为了贴边去改已经定稿的键位线**:该动的是外壳,不是键。
+7. **结构差很多的手柄**(DualSense、Switch Pro):先交分层线稿草图,确认「哪根线算谁的」,再收最终 SVG。
+
+---
+
+## 10. 给同事的一句话
+
+> 先打开旁边那张 Xbox SVG 对照。交一套同网格的分层 SVG:长弧、按键与外壳分家、多棱键一条棱一根线、热区和按下填充用同一闭合 path。不要描像素,不要把键画进壳里。
diff --git a/docs/design-rules/playstation-dualsense-gamepad.silhouette.svg b/docs/design-rules/playstation-dualsense-gamepad.silhouette.svg
new file mode 100644
index 0000000000..51946c2582
--- /dev/null
+++ b/docs/design-rules/playstation-dualsense-gamepad.silhouette.svg
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg id="_鍥惧眰_1" data-name="鍥惧眰 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1050 660">
+ <title>ps5-dualsense-controller</title>
+ <defs>
+ <style>
+ .cls-1 {
+ stroke-width: 2px;
+ }
+
+ .cls-1, .cls-2, .cls-3 {
+ fill: none;
+ stroke: #1b1b1b;
+ stroke-miterlimit: 10;
+ }
+
+ .cls-2 {
+ stroke-width: 5px;
+ }
+
+ .cls-3 {
+ stroke-width: 3px;
+ }
+
+ .cls-4 {
+ fill: #1b1b1b;
+ }
+
+ .cls-5 {
+ fill: #cacaca;
+ }
+
+ .cls-6 {
+ opacity: .08;
+ }
+ </style>
+ </defs>
+ <g id="DualSense_Controller" data-name="DualSense Controller">
+ <g id="body">
+ <path id="vector" class="cls-3" d="M782.365815928575103,517.709090003787423c14.008934742658312,1.482555498507281,24.04214318864797,9.952567180667756,32.268648281378773,20.783694759093123l51.256940554401808,67.486984740096887c10.09648007128817,13.293475772527017,22.689443591991221,22.368453608652999,38.336635908110111,27.852233886334943l34.303726387834104,9.967618505525024c4.773665057946346,1.387149519974628,9.626956859423444.062390169168793,14.153504437435913-1.804459639823108,12.452213999527885-5.135172172907915,24.025071787858906-10.945226331379672,34.670343673271418-19.439514343956034,28.009512855558569-22.350246360841993,42.625497059780173-52.125893906038982,51.555988519245147-86.785453604337818,7.011689887047396-27.212552579869225,9.355485772775864-54.513713765760258,9.354769490228136-82.724994578948099-.000596902127654-28.826685789234034-2.717695377103155-56.420376756637779-9.197664850813453-84.44570087883767-6.569266031674488-28.411803302422413-14.536238080265321-55.691601317545974-24.309435960414703-83.115357972036691l-23.499439776205691-59.906943330990543c-12.346442942896829-31.474505147712989-26.320399221003754-55.833367835945864-41.48636904360319-85.911255694823922-3.383002486105397-6.70924943708269-6.965954058892748-12.011532007826645-13.858382901275036-14.887306108912526-1.991862392575058-4.735826537562389-10.312810526891553-19.344504647455324-11.971004631346659-22.703134960515854-9.515336161963205-19.274435297126729-20.162876275453527-37.328499464238121-34.112717707690535-53.622044149578869-22.713558437861138-26.529659405267012-58.173342922071242-30.737779617618799-85.430281577881033-7.563837365762083-8.475055137760137,7.367623517966422-14.437987990417241,16.857726604209347-15.499160589015446,28.399665137216289l-3.174998236756437,34.534986585485058c-.417362221129224,4.539716178152958-4.455974941793102,7.710322343610642-8.98767471746396,7.213420597775439-32.995218938773178-3.617932057843973-68.645043690039529-7.908543088064107-101.321336116818202-8.81968874559243l-103.873504770121144-2.896166218635699-92.146407472567262.110457303393559c-57.982594942940523.069673068293923-115.196678399385746,2.811684588786193-172.920755031801491,7.025084495795454l-36.684709275972637,3.578331103326491-3.79790915349804-39.771669357310202c-1.630736606685787-17.077912921082316-10.440952287875916-30.988735776087196-25.43053753240838-38.90427607154561-30.433741302688759-16.070930735424554-64.771849252944776-1.626999664483264-85.369747797413766,25.267290223633609-10.89119556109199,14.220346067810169-19.460919375944286,29.240111696220083-27.553509476833824,45.342116134577736-1.80846421453225,3.598480457570986-8.678419691892486,20.210530597969409-11.845880820506864,22.906174327367808-5.070444794712785,4.315360494756533-9.976472898970314,7.056400962032058-13.033417599061067,13.335716587447678-13.840966484558521,28.430981603452892-26.963143429671618,50.891192489847526-38.907214649816524,80.311191794449769l-23.236922221434725,57.235575932008032c-12.385331116372981,32.75192565420457-22.33270503672702,65.737389607012119-29.633832764395265,100.064363578611847-10.05806941951414,47.288835070639834-11.618968477523595,101.345668297970406-1.614530713978638,148.454372996922757,9.081298781457008,42.761784974654802,26.685643631556559,80.431366881239228,64.109347583925228,103.983291597674906,9.85592851473757,6.202845184607213,19.964316783426511,10.942313171728529,30.720612464170699,15.171735456813622,4.682398722966354,1.841359662057585,9.627195620269958.246890280332082,14.162816110591848-1.113798039486937l27.848259746369877-8.354699112685921c13.303694881458796-3.991271483700984,25.112537925086144-10.841323637196183,33.993128366864767-21.636522246606546l22.150351437405334-26.925363591049972,37.329572487185033-51.091236703705363c9.64295383638364-13.197827030684493,36.482698554468698-21.269112759611744,43.818446605411737-14.088416985847289,3.529992507616953,3.455331561395724,5.813094463498601,7.918524955888643,8.397475382652374,11.303985734297385,1.563046878269233,2.047434959173188,5.099092091621969,6.229453174688388,12.222518121146095,12.482618508773157,6.283477785274044,5.515888295474724,13.186598544341905,8.703866426563764,19.946986238257523,11.652602580386883,25.403915729345499,11.080643322764445,59.701025844278774,6.636527789405591,80.844672002031984-11.87927218222103,11.706776029200228-9.977539433348284,14.226980925750468-15.176586010660685,17.684675355249055-18.463955968103619l206.77912244577783.018261657716721c.562716732451008.485420555840392,9.928189891674265,13.458062762001646,20.200636268617018,20.826758469465858,22.177776593853196,16.996453766743798,61.897434179825723,24.335712141255499,96.835791353256354-1.683689314013463,8.491033628870355-6.227571356024782,14.916396780452487-13.60262642050111,21.395139259071584-24.926863102036805,3.311016089781333-3.567892281249442,9.226542787804647-2.407094345693622,14.557236909204221-1.842912426825933Z"/>
+ </g>
+ <g id="body-left">
+ <path id="vector-2" data-name="vector" class="cls-1" d="M102.761528141011695,138.211061369249364s-7.204058373945372,25.157777542562144-2.817917172087618,34.56010492952646c12.35779515660397,26.490719403704134,51.63061518669474,20.810226275208151,51.63061518669474,20.810226275208151l104.784143044224038-15.435514031397361c16.604807115474614-2.446016408335709,32.409659826854295,7.931080873637256,36.766189111544008,24.139821361522991l35.266930682150814,131.21282789036286c4.243259529907846,15.787313259839721.351233793081519,32.817207845107987-10.815611914779765,44.756473665893282-.380466086396154.406783245700353-.77137833613051.812271691322167-1.173022307820247,1.216131492248678-16.065758671189542,16.154391839627351-78.741417412819828,85.630661055045493-85.613199920410807,94.414136044551924-6.871782507590979,8.78347498950825-106.94296470027075,154.414691190113444-106.94296470027075,154.414691190113444,0,0-11.929328133815034,16.494450148093165-18.104888795166517,15.613041945294754"/>
+ </g>
+ <g id="body-right">
+ <path id="vector-3" data-name="vector" class="cls-1" d="M948.131167570945763,136.697237832548126s7.439316702810174,26.671601079263382,3.053175500956058,36.073928466227699c-12.357795156605789,26.490719403704134-51.630615186697469,20.810226275207242-51.630615186697469,20.810226275207242l-104.784143044224038-15.435514031397361c-16.604807115474614-2.446016408334799-32.409659826855204,7.931080873637256-36.766189111542189,24.1398213615239l-35.266930682151724,131.21282789036286c-4.243259529906936,15.787313259839721-.35123379308061,32.817207845106168,10.815611914777037,44.756473665891463.380466086398883.406783245700353.771378336132329.812271691323986,1.173022307822976,1.216131492250497,16.065758671189542,16.154391839627351,78.741417412818919,85.630661055043674,85.613199920408078,94.414136044551924,6.871782507594617,8.783474989506431,106.942964700272569,154.414691190113444,106.942964700272569,154.414691190113444,0,0,11.929328133817762,16.494450148093165,18.104888795165607,15.613041945292935"/>
+ </g>
+ <g id="bumper-bottom">
+ <path id="vector-4" data-name="vector" class="cls-1" d="M269.485356193607004,109.330358795677967l.741312813078366,14.31762188412722c.410328792159817,14.589144757182112,10.140735225285425,24.112758595158084,34.047066795652427,22.244136921744939,54.374827229337825-4.250170309473106,173.630114661523294-7.501764904677657,223.614964235043772-7.31667929555806,90.691296304019488.335814831123571,219.385133014942767,9.413817224593004,219.385133014942767,9.413817224593004,12.325103556286194.074672026569715,30.369112711176058-4.996076763308338,34.172022560629557-18.401689496223298l2.346314594975411-20.332563576906068"/>
+ </g>
+ <g id="press-stick-left">
+ <g id="vector-5" data-name="vector">
+ <path id="_2" data-name="2" class="cls-1" d="M354.562915464784055,561.341745264229758c-32.490004340158521,0-58.922416662114301-24.547197631929521-58.922416662114301-54.719775017845677,0-30.172892639206111,26.43241232195578-54.720090271137451,58.922416662114301-54.720090271137451,32.49000434016034,0,58.92241666211612,24.54719763193134,58.92241666211612,54.720090271137451,0,30.172577385916156-26.43241232195578,54.719775017845677-58.92241666211612,54.719775017845677Z"/>
+ <ellipse id="_1" data-name="1" class="cls-1" cx="354.56291546478451" cy="512.496952225541918" rx="39.553327223870383" ry="35.350786206332941"/>
+ </g>
+ <path id="vector-6" data-name="vector" class="cls-1" d="M317.831516692705009,464.00034666155625c0-12.098466686309621,16.059030718665781-25.754799301017556,36.426397440515757-25.754799301017556,20.367366721855433,0,37.036400103646884,12.46326127719658,37.036400103646884,25.849992012601433"/>
+ <ellipse id="vector-7" data-name="vector" class="cls-1" cx="354.562915464784282" cy="494.846432180948796" rx="69.079710571569876" ry="66.580637682370252"/>
+ <ellipse id="vector-8" data-name="vector" class="cls-1" cx="354.562915464784965" cy="485.594767709770622" rx="78.651552249037209" ry="75.806202141277481"/>
+ </g>
+ <g id="press-stick-right">
+ <g id="vector-9" data-name="vector">
+ <path id="_2-2" data-name="2" class="cls-1" d="M696.879691231821198,561.341745264229758c-32.49000434015943,0-58.922416662115211-24.547197631929521-58.922416662115211-54.719775017845677,0-30.172892639206111,26.43241232195578-54.720090271137451,58.922416662115211-54.720090271137451,32.490004340163068,0,58.922416662118849,24.54719763193134,58.922416662118849,54.720090271137451,0,30.172577385916156-26.43241232195578,54.719775017845677-58.922416662118849,54.719775017845677Z"/>
+ <ellipse id="_1-2" data-name="1" class="cls-1" cx="696.879691231822108" cy="512.496952225541918" rx="39.553327223869019" ry="35.350786206332941"/>
+ </g>
+ <path id="vector-10" data-name="vector" class="cls-1" d="M660.148292459740333,464.00034666155625c0-12.098466686309621,16.059030718666691-25.754799301017556,36.426397440518485-25.754799301017556,20.367366721853614,0,37.036400103645065,12.46326127719658,37.036400103645065,25.849992012601433"/>
+ <ellipse id="vector-11" data-name="vector" class="cls-1" cx="696.879691231820743" cy="494.846432180948796" rx="69.079710571568739" ry="66.580637682370252"/>
+ <ellipse id="vector-12" data-name="vector" class="cls-1" cx="696.879691231822108" cy="485.594767709770622" rx="78.651552249036286" ry="75.806202141277481"/>
+ </g>
+ <g id="usb_port" data-name="USB port">
+ <rect id="vector-13" data-name="vector" class="cls-1" x="495.336452215994996" y="114.744309639036601" width="61.11195439510584" height="9.153362810100603" rx="3.690598414308359" ry="3.690598414308359"/>
+ </g>
+ <g id="touch_pad" data-name="touch pad">
+ <path id="vector-14" data-name="vector" class="cls-1" d="M696.174621297730482,153.680228773569979s-127.725107221744111-6.211447013491124-169.595551144115234-5.908776857759221c-43.564374124415735.314915120675323-174.588982509153539,5.515760986778332-174.588982509153539,5.515760986778332-32.436619336605872,3.775093563835981-51.76456756427342,25.780168102888638-44.007717199515355,58.577353852419947l30.418302832077643,128.613378015094895c6.165610913488308,26.069174585049041,28.942866972744923,44.427720411609698,55.121008684702247,44.427720411609698h263.722586014054286c26.181502095396354,0,48.960764662249858-18.363161805325944,55.123128243494648-44.436685348358878l30.396992077372488-128.61245171889459c7.750987192855973-32.795135241581193-13.65881692502262-58.176299340890182-46.589766998917185-58.176299340890182Z"/>
+ <path id="vector-15" data-name="vector" class="cls-1" d="M695.845334160183484,167.84321186237139s-127.546629101165308-6.061941128151375-169.358564886009844-5.766556065489567c-43.503498954391034.307335298483849-174.345018623345823,5.382999855938579-174.345018623345823,5.382999855938579-32.391293660369229,3.684229276613223-49.521420433522508,25.532285388761011-41.775409191195649,57.540062119505819l28.204984145345406,117.058112844212701c6.156995327470213,25.441704847649817,28.902423330818237,43.358371247177274,55.043984720906337,43.358371247177274h263.354070281084205c26.144917077856007,0,48.892348784987917-17.92117127439451,55.046101317906505-43.36712040315615l27.893754120983431-115.852036779021546c7.740156263394965-32.005775577315944-11.178968246651493-58.35383281916711-44.063901885674568-58.35383281916711Z"/>
+ </g>
+ <g id="ps_button" data-name="PS button">
+ <path id="vector-16" data-name="vector" class="cls-4" d="M558.252258000113216,467.329779473975577c-.180224634188562.710875871443932-1.461903517949395,2.012538972017865-2.222892715955822,2.232854267454968l-23.630389116575316,6.708646581495486-.350487716877979-4.776166704352363,14.168259695683446-3.94507996297034c2.533228657770451-.710936985256922.600748780629146-2.723475957272967-1.471926183263349-2.10268184601955l-12.676288181795826,3.724764667531417-.010022665312135-4.615926286975082c9.852707799022028-4.185379475222362,27.215019811168531-1.211581340385237,26.193746884096981,2.773589283835463ZM507.336690415181693,468.621419909235556l10.99419159603076-3.504510485903666-.230337960751967-4.716091826290722-18.053203666778245,4.976436669167015c-.841109406695068.230276846939887-2.302951810831473,1.862382333767528-2.262922263395012,2.713453291960832.150156638252156,3.774877994093913,12.656303964982726,5.276811059484317,20.386223473548853,4.395672105349149l.04002954743828-4.605903621662947c-4.55585140891435,1.06136358832191-6.698562802369452,3.314263186402968-10.903987608218813,1.311685765886068-.250322177564158-.120149756126921-.240299512251113-.480599024504045.030006882126145-.57074189850573ZM533.830811689593247,449.947361017389994l.08012020868955,10.563644784278949c3.41436761190198,1.752255242950923,7.189245605997712,1.702141916388427,9.842624019895084-1.181574458261821,1.872404999079663-2.022561637328181,2.172840503206316-6.147866234488902.911206950069754-8.731208218823667-.891161619443665-1.842398116952609-3.324285851715103-4.445724318100474-5.937634718173285-5.096586425293935l-18.543886470409234-4.615926286976901v33.232774738033186l9.942789559209814,2.523267106271305-.010022665313954-26.764488782602712-.010022665310316.010022665312135c0-2.383072019520114,3.714803116030453-2.112704511329866,3.724825781342588.06007487806346Z"/>
+ </g>
+ <g id="speaker" data-name="speaker">
+ <circle id="vector-17" data-name="vector" class="cls-4" cx="528.541622234881288" cy="400.339292288255365" r="5.999779590885055"/>
+ <circle id="vector-18" data-name="vector" class="cls-4" cx="567.727554157934264" cy="400.311846937461269" r="5.988197377180995"/>
+ <circle id="vector-19" data-name="vector" class="cls-4" cx="508.831708032767665" cy="400.349640568249924" r="5.940422292888229"/>
+ <circle id="vector-20" data-name="vector" class="cls-4" cx="489.388774096621091" cy="400.297934414763859" r="5.91828564598859"/>
+ <circle id="vector-21" data-name="vector" class="cls-4" cx="538.257616949985731" cy="414.949342793341657" r="5.859401314825391"/>
+ <circle id="vector-22" data-name="vector" class="cls-4" cx="548.143758184942271" cy="400.361400578069606" r="5.899097056142409"/>
+ <circle id="vector-23" data-name="vector" class="cls-4" cx="557.700140986824408" cy="414.902047397245042" r="5.850884054858398"/>
+ <circle id="vector-24" data-name="vector" class="cls-4" cx="518.495722364665198" cy="414.886223694526507" r="5.859840454563482"/>
+ <path id="vector-25" data-name="vector" class="cls-4" d="M499.488932969186862,420.561851004937125c-3.494616552390653.293914620930082-6.165786924377244-1.907649786518959-6.517267863964662-5.079840148986477-.34621716962647-3.124683717136577,2.075630484250723-6.090700358257891,5.831032057837547-6.261880892941917,2.997445776437416-.136631026172836,5.774927013456363,2.278746491061611,6.14450293513346,5.101425486745939.389920767258445,2.97806511509043-2.156363224570669,5.962589025757552-5.458267129006344,6.240295555182456Z"/>
+ </g>
+ <g id="l2-tick">
+ <path id="vector-26" data-name="vector" class="cls-1" d="M126.349348941083917,105.036718447402563s14.242741783435122-8.419429654444684,34.522318316987366-14.513810167118208c19.350716167477913-5.815241128050729,45.354927318192495-9.853768962992035,63.003608346035435-10.183148583185357,17.64868102784385-.329379620192412,23.84812398827944.727089012215401,29.025530067942782,3.189369205184448,5.177406079662433,2.462280192969956,12.943860481863339,7.59472438924422,15.400346657057526,14.311290623681089"/>
+ </g>
+ <g id="r2-tick">
+ <path id="vector-27" data-name="vector" class="cls-1" d="M926.164413616570528,105.145521711160654s-12.206986125378535-9.139763956662136-32.486562658930779-15.234144469335661c-19.350716167477003-5.81524112804982-42.797483578739048-8.974161836466919-60.446164606581078-9.303541456658422-17.64868102784385-.329379620193322-30.205288455430491,1.834892086661057-35.382694535092014,4.297172279630104-5.177406079665161,2.462280192969047-9.147814285917775,5.540702801929001-11.604300461112871,12.257269036365869"/>
+ </g>
+ <g id="l1-tick">
+ <path id="vector-28" data-name="vector" class="cls-1" d="M110.923020283389633,154.027755454786529l6.198034401938457-27.65175752214509c1.081598968698927-4.556460369999513,3.888832916361025-8.544622444314882,7.87415488780789-11.16877032919092,10.422373887181493-6.862645123123002,41.694041046129314-19.818050930260142,71.174645341296127-22.996616799875483,16.112419288579986-1.737223074359463,53.622345344759196-1.464477693665685,61.510444396724779,2.567790890251672,7.888099051962854,4.032268583919176,9.032206347912506,9.599974127733731,10.748367291834256,21.537628493638294,1.716160943923569,11.937654365906383,3.146295063859725,22.883210077601689,0,30.882000074279858-3.146295063857906,7.998789996679079-6.993921332954415,18.611768568735897-18.305716735178976,23.275825705729403-11.311795402225471,4.664057136995325-88.663107062285235,11.63635602987506-101.825549339439931,13.05492142409912-9.156896410270747.986872807689906-22.445671944485184-1.699607277698306-32.361578348512012-9.375845127244247-6.060567209175133-4.691689645429506-7.024217699291512-12.856369187727068-5.012801896470592-20.125176809542609Z"/>
+ <path id="vector-29" data-name="vector" class="cls-1" d="M112.81109856520834,144.881610806708522s1.855402018488348,9.108306711847035,10.304515860191714,11.105394572844489c9.021175468468755,2.132304092183404,32.124978978756189.991372052651968,37.575504489440391.611239172210844,7.78622582954813-.543030290666138,41.94306293052523-4.470849026176438,55.966669600499699-7.185800906879194,14.023606669975379-2.714951880700028,32.627081917231408-4.240534337671306,39.856677691546793-13.612150325156108,3.398102160454982-4.404908590761806,5.412620118236191-16.375719719961126,5.412620118236191-16.375719719961126l1.924937299811063-19.379206832445561"/>
+ </g>
+ <g id="r1-tick">
+ <path id="vector-30" data-name="vector" class="cls-1" d="M942.280085838048763,153.501054010867847l-6.641029946520575-28.295280205409654c-1.069421809837877-4.556460369999513-3.845050574134802-8.544622444313973-7.785503883396814-11.16877032919092-10.305033813658156-6.862645123123002-29.693363162705282-16.909126896374801-61.94433873574053-21.541066262231652-40.410899145595977-5.803881316342085-63.574173727769448-1.67595859859739-71.37346478525069,2.356309985321786-7.799291057475784,4.032268583917357-8.930517445902296,9.599974127731912-10.627357028537517,21.537628493637385-1.69683958263704,11.937654365905473-3.110872568167906,22.883210077602598,0,30.882000074279858s7.729073722179237,17.843462243898102,18.913515517773703,22.507519380893427c11.184441795599923,4.664057136993506,86.851002064546265,12.404662354710126,99.865255266808163,13.823227748935096,9.053803687858817.986872807688997,24.832289837508142-2.300154227146777,34.636558221343876-9.976392076692719,5.992334442858919-4.691689645429506,6.945135694539204-12.856369187727978,4.956365373520384-20.125176809542609Z"/>
+ <path id="vector-31" data-name="vector" class="cls-1" d="M940.594727347932348,145.381735232423125s-1.855402018487439,9.108306711847945-10.304515860192623,11.105394572843579c-9.021175468467845,2.132304092184313-32.12497897875437.991372052652878-37.575504489435843.611239172211754-7.786225829549949-.543030290665229-41.943062930527958-4.470849026176438-55.966669600502428-7.185800906879194-14.023606669972651-2.714951880700028-32.627081917231408-4.240534337671306-39.856677691544974-13.612150325155199-3.398102160455892-4.404908590763625-5.412620118235282-16.375719719962035-5.412620118235282-16.375719719962035l-2.966289819429221-20.516850222676112"/>
+ </g>
+ <g id="options">
+ <g id="vector-32" data-name="vector">
+ <rect class="cls-1" x="777.251677137339584" y="213.643751377837646" width="26.432218472337013" height="50.347552964543524" rx="12.394944429107657" ry="12.394944429107657" transform="translate(89.02205076294706 -196.896842916443063) rotate(15.036442370322531)"/>
+ <rect class="cls-1" x="776.681157392040177" y="217.966655456872701" width="26.432218472332806" height="45.949353951775237" rx="12.394944429106902" ry="12.394944429106902" transform="translate(89.553502499417505 -196.676114142561886) rotate(15.036442370321083)"/>
+ </g>
+ <g id="vector-33" data-name="vector">
+ <rect class="cls-4" x="790.196164777237641" y="205.868872229111275" width="14.009625188501559" height="2.18695790526138" rx="1.090173506955273" ry="1.090173506955273" transform="translate(30.350608547518505 -93.542765186136876) rotate(6.845336521593967)"/>
+ <rect class="cls-4" x="790.818388141464197" y="200.685637503758613" width="14.009625217108805" height="2.18695791522623" rx="1.090173375421801" ry="1.090173375421801" transform="translate(29.737256034652432 -93.653875984698317) rotate(6.845336489574311)"/>
+ <rect class="cls-4" x="791.269561164265383" y="195.777048548649475" width="14.009625205963175" height="2.186957907134456" rx="1.090173369913357" ry="1.090173369913357" transform="translate(29.155419485344737 -93.742642496674705) rotate(6.84533652871209)"/>
+ </g>
+ </g>
+ <g id="create">
+ <g id="vector-34" data-name="vector">
+ <rect class="cls-1" x="247.822957834722018" y="213.45978629242083" width="26.432218472337837" height="50.347552964543269" rx="12.39494442910811" ry="12.39494442910811" transform="translate(575.049927500898548 401.374311672411636) rotate(164.963557629648562)"/>
+ <rect class="cls-1" x="248.393477580026371" y="217.782690371455828" width="26.432218472334824" height="45.949353951774981" rx="12.39494442910666" ry="12.39494442910666" transform="translate(576.722418727958825 405.40119204390129) rotate(164.963557629658141)"/>
+ </g>
+ <g id="vector-35" data-name="vector">
+ <rect class="cls-4" x="242.069979463004444" y="203.846503635350444" width="9.615119898204455" height="2.186957883525963" rx="1.090173640794587" ry="1.090173640794587" transform="translate(192.832668755174154 521.212124696142382) rotate(-119.999925869430115)"/>
+ <rect class="cls-4" x="246.90020900584048" y="200.551139828947214" width="14.0096252565356" height="2.186957870696176" rx="1.090173220034033" ry="1.090173220034033" transform="translate(88.696363018168881 480.632810998190735) rotate(-97.822890488936864)"/>
+ <rect class="cls-4" x="256.704511579505152" y="202.160352140116231" width="9.615119790393692" height="2.186957905425629" rx="1.090175068868831" ry="1.090175068868831" transform="translate(-4.623495162152267 400.415043180253633) rotate(-74.387417091061934)"/>
+ </g>
+ </g>
+ <g id="face">
+ <g id="triangle">
+ <ellipse class="cls-1" cx="876.456953769733445" cy="280.411383645042406" rx="32.837030826089176" ry="29.738258104970555"/>
+ <path class="cls-1" d="M876.260847716504941,310.259622846181628c-19.830419553387401,0-35.906150877002801-14.558692893390798-35.906150877002801-32.517750706250808s16.0757313236154-32.517750706251718,35.906150877002801-32.517750706251718c19.830419553383763,0,35.906150876999163,14.558692893391708,35.906150876999163,32.517750706251718s-16.0757313236154,32.517750706250808-35.906150876999163,32.517750706250808"/>
+ <polygon class="cls-2" points="876.513216201001342 262.378829083957498 857.967266962154099 291.01185633500063 895.059165439843127 291.01185633500063 876.513216201001342 262.378829083957498"/>
+ </g>
+ <g id="square">
+ <ellipse class="cls-1" cx="792.772641525214567" cy="351.201290051810702" rx="32.837030826089176" ry="29.738258104970097"/>
+ <ellipse class="cls-1" cx="792.576535471985153" cy="348.531778546700025" rx="35.906150877001892" ry="32.517750706250354"/>
+ <rect class="cls-2" x="775.459591808188634" y="339.319654587474361" width="34.340944429384763" height="26.227580678994855"/>
+ </g>
+ <g id="cross">
+ <ellipse class="cls-1" cx="869.611235666712673" cy="416.257833833013592" rx="32.837030826089176" ry="29.73825810497101"/>
+ <path class="cls-1" d="M869.41512961348235,446.106073034154178c-19.830419553383763,0-35.906150876999163-14.558692893389889-35.906150876999163-32.517750706248989,0-17.95905781286092,16.0757313236154-32.517750706254446,35.906150876999163-32.517750706254446,19.830419553387401,0,35.906150877002801,14.558692893393527,35.906150877002801,32.517750706254446,0,17.959057812859101-16.0757313236154,32.517750706248989-35.906150877002801,32.517750706248989"/>
+ <line class="cls-2" x1="853.572740970363157" y1="406.523706321768259" x2="885.786038378591911" y2="431.870688312576021"/>
+ <line class="cls-2" x1="885.786038378591911" y1="406.523706321768259" x2="852.470248316169091" y2="432.591752570242534"/>
+ </g>
+ <g id="circle">
+ <ellipse class="cls-1" cx="951.055710920595175" cy="348.845490201224493" rx="32.83703082609145" ry="29.738258104968736"/>
+ <path class="cls-1" d="M950.859604867368034,378.693729402364625c-19.83041955338922,0-35.90615087700462-14.558692893391708-35.90615087700462-32.517750706252627,0-17.959057812859101,16.0757313236154-32.517750706250808,35.90615087700462-32.517750706250808,19.830419553380125,0,35.906150876997344,14.558692893391708,35.906150876997344,32.517750706250808,0,17.95905781286092-16.075731323617219,32.517750706252627-35.906150876997344,32.517750706252627"/>
+ <ellipse class="cls-2" cx="951.392749870725766" cy="349.408770964359064" rx="18.841947345832978" ry="16.584104261573884"/>
+ </g>
+ </g>
+ <g id="directional_buttons" data-name="directional buttons">
+ <g id="up">
+ <path class="cls-1" d="M158.536616849925849,266.614380712686398c-6.035200205342335,1.617939679556002-11.492599488239648,7.821373625366505-10.776530738226938,14.028515952596535l2.96345689093323,25.688313730003756c.160418366458543,4.619360665430577,2.08550423818906,9.001483759911935,5.379041259081532,12.244451675513119l17.082218942558939,16.526237958443744c5.012204870658024,4.300490686337071,12.412515549146519,4.300476666125178,17.424704124836353-.000033011861888l14.690415361340456-15.504912826443615c3.661546394681864-3.696089428667619,5.803676853907746-8.631059552249098,6.003177756032528-13.829924664480131l2.167835324310545-26.145295900854762c.446399592644411-5.383826579814922-6.221017823910188-12.503347802297867-11.551020763552515-13.384216635459779-13.517095521668125-2.233917747277701-30.693819813764094-3.024980429489915-43.38329815731413.376863722543021Z"/>
+ <path class="cls-1" d="M158.534564631258036,272.949380662966178c-6.035200205344154,1.617939679555093-10.194496582234933,8.506502455010377-9.478427832221314,14.713644782240408l1.665353984927606,18.964697679281016c.160418366458543,4.619360665431486,2.08550423818815,9.001483759912844,5.379041259080623,12.244451675514938l17.082218942558939,16.526237958440106c5.012204870658024,4.30049068633889,12.412515549147429,4.300476666128816,17.424704124837262-.00003301185825l14.690415361340456-15.504912826445434c3.661546394681864-3.6960894286658,5.803676853906836-8.631059552248189,6.003177756031619-13.829924664478312l1.545855173128984-18.890273089480615c.446399592644411-5.383826579814922-4.436284516647902-13.152401535890931-10.929040612370045-14.600752225756878-13.371789437602274-2.982868934419457-30.693819813764094-3.024980429489915-43.38329815731413.376863722543021Z"/>
+ <polygon class="cls-4" points="181.007565035830339 283.75397670201346 172.971391145743837 292.499001669635618 189.043738925912294 292.499001669635618 181.007565035830339 283.75397670201346"/>
+ </g>
+ <g id="left">
+ <path class="cls-1" d="M94.027324299863722,373.455326774514106c1.617939679555093,6.035200205344154,7.821373625368324,11.492599488241467,14.028515952596535,10.776530738226938l25.688313730003756-2.96345689093323c4.619360665432396-.160418366460362,9.001483759912844-2.085504238186331,12.244451675514028-5.379041259080623l16.526237958441925-17.082218942559848c4.300490686336161-5.012204870658024,4.300476666125178-12.41251554914561-.00003301185825-17.424704124836353l-15.504912826447253-14.690415361339547c-3.6960894286658-3.661546394680954-8.631059552248189-5.803676853907746-13.829924664478312-6.003177756032528l-26.145295900855672-2.167835324312364c-5.383826579815832-.446399592643502-12.503347802296958,6.221017823912007-13.38421663545887,11.551020763555243-2.23391774727861,13.517095521667216-3.024980429490824,30.693819813763184.376863722542112,43.383298157312311Z"/>
+ <polygon class="cls-4" points="111.166920289190784 355.273706786492767 119.911945256813851 363.309880676575631 119.911945256813851 347.237532896408084 111.166920289190784 355.273706786492767"/>
+ <path class="cls-1" d="M94.476658752336334,374.025987784565586c1.617939669105908,5.502460469564539,7.82137360546767,10.478123703509482,14.028515933936433,9.825263827573508l25.688313735134216-2.701866403358508c4.619360665711611-.146257910049826,9.001483763525357-1.901412436902319,12.244451684829073-4.904222068569652l16.286315341310001-17.438022720043591c3.225358630714254-4.110706869683781,4.745933737986888-9.753263073880589-.000032937555261-14.049827801971333l-15.504912801012324-13.393661674188479c-3.696089422326622-3.338334037040113-8.631059542197363-5.291374155996891-13.829924654083698-5.473264687622759l-26.145295897102187-1.976475925163868c-5.383826579041852-.406994958505493-12.503347813068103,5.67187560311686-13.384216655458658,10.531388047495057-2.233917770683547,12.323913259191613-2.785057880058048,28.011337836871462.616786250002406,39.580689405849625Z"/>
+ </g>
+ <g id="right">
+ <path class="cls-1" d="M268.109253788908063,373.455326774514106c-1.617939679555093,6.035200205344154-7.821373625367414,11.492599488241467-14.028515952596535,10.776530738226938l-25.688313730003756-2.96345689093323c-4.619360665431486-.160418366460362-9.001483759912844-2.085504238186331-12.244451675514028-5.379041259080623l-16.526237958441925-17.082218942559848c-4.300490686335252-5.012204870658024-4.300476666125178-12.41251554914561.00003301185825-17.424704124836353l15.504912826447253-14.690415361339547c3.69608942866671-3.661546394680954,8.631059552248189-5.803676853907746,13.829924664478312-6.003177756032528l26.145295900855672-2.167835324312364c5.383826579815832-.446399592643502,12.503347802296958,6.221017823912007,13.38421663545887,11.551020763555243,2.23391774727861,13.517095521667216,3.024980429490824,30.693819813763184-.376863722542112,43.383298157312311Z"/>
+ <polygon class="cls-4" points="250.96965779958191 350.984378588611435 242.224632831957933 359.020552478696118 242.224632831957933 342.948204698528571 250.96965779958191 350.984378588611435"/>
+ <path class="cls-1" d="M267.86933116756154,374.025987784565586c-1.617939669105908,5.502460469564539-7.82137360546767,10.478123703509482-14.028515933936433,9.825263827573508l-25.688313735135125-2.701866403358508c-4.619360665710701-.146257910049826-9.001483763524448-1.901412436902319-12.244451684828164-4.904222068569652l-16.286315341310001-17.438022720043591c-3.225358630714254-4.110706869683781-4.745933737986888-9.753263073880589.000032937554352-14.049827801971333l15.504912801013234-13.393661674188479c3.696089422325713-3.338334037040113,8.631059542197363-5.291374155996891,13.829924654083698-5.473264687622759l26.145295897101278-1.976475925163868c5.383826579042761-.406994958505493,12.503347813069013,5.67187560311686,13.384216655460477,10.531388047495057,2.233917770681728,12.323913259191613,2.785057880057138,28.011337836871462-.616786250003315,39.580689405849625Z"/>
+ </g>
+ <g id="down">
+ <path class="cls-1" d="M205.65612265924301,430.805702653515254c6.03519967660668-1.617941651828005,11.492596932253036-7.821377381089405,10.776526153777013-14.028519474311906l-2.963465285743041-25.688312761558336c-.160419876043306-4.619360613007302-2.085507179825072-9.001483078380261-5.379045260504427-12.244449917670863l-17.082224343246708-16.526232376059852c-5.012206276038341-4.300489048371674-12.412516954521379-4.300472609776989-17.424704124829077.000038706166379l-14.690410294409048,15.504917627196846c-3.661545186820149,3.696090625240686-5.803674033320931,8.631061448861146-6.003173236486873,13.829926626285669l-2.167826780162613,26.145296609291108c-.446397833236006,5.383826725697872,6.221021909944284,12.503345769300722,11.55102513744896,13.384212860646585,13.517096251698604,2.23391332995925,30.693820802311166,3.02497039890477,43.383298034155814-.376877899985629Z"/>
+ <path class="cls-1" d="M205.576233346732806,430.526035973342005c6.035199676610318-1.617941651829824,11.102507344210608-8.192183326971644,10.386436565730946-14.399325420190507l-1.665360182491895-18.96469713505212c-.160419876041487-4.619360613007302-2.993520721679488-9.315805537929919-6.28705880236248-12.558772377220521l-17.082224343245798-16.526232376059852c-5.012206276036522-4.300489048371674-12.412516954517741-4.300472609776989-17.424704124826349.00003870616456l-14.690410294412686,15.504917627198665c-3.66154518681742,3.696090625238867-6.213930709845044,8.537269320608175-6.413429913006439,13.736134498030879l-1.545848999883674,18.890273594657629c-.446397833236006,5.383826725697872,4.846545491305733,13.246192214390248,11.339302060347109,14.694540782455078,13.371790412386872,2.982864564582997,30.693820802310256,3.02497039890477,43.383298034151267-.37687789998381Z"/>
+ <polygon class="cls-4" points="183.185168872206305 413.6661140075812 191.221339904459455 404.921086413778539 175.148992124294637 404.921091666137727 183.185168872206305 413.6661140075812"/>
+ </g>
+ </g>
+ <g id="mute">
+ <rect id="vector-36" data-name="vector" class="cls-1" x="501.338786610227089" y="497.207386632810994" width="53.60352874881346" height="9.153362810102408" rx="3.690598414305538" ry="3.690598414305538"/>
+ <path id="vector-37" data-name="vector" class="cls-1" d="M554.942315365900868,503.995493779268145l-.228169681282452-.061724141025479c.000000047173671-2.040887983604989-1.426296861791343-3.633637867062134-3.467184845394513-3.633637866878416l-46.212819753184704.00000000414002c-2.040887912941798.000000000183718-3.485863820263148,1.541812940331511-3.485863828088441,3.58270085327058l-.209490640863805.112660997872808"/>
+ </g>
+ <g id="press">
+ <g id="press-l1-tick">
+ <path id="vector-38" data-name="vector" class="cls-6" d="M110.721685407356745,154.827709289013001l6.198034401938457-27.65175752214418c1.081598968698927-4.556460370001332,3.888832916361025-8.544622444315792,7.874154887806981-11.16877032919183,10.422373887182403-6.862645123123002,41.694041046129314-19.818050930260142,71.174645341295218-22.996616799876392,16.112419288581805-1.737223074359463,53.622345344760106-1.464477693665685,61.510444396725688,2.567790890252581,7.888099051963763,4.032268583918267,9.032206347912506,9.599974127733731,10.748367291835166,21.537628493638294,1.716160943923569,11.937654365906383,3.146295063858815,22.883210077601689,0,30.882000074280768-3.146295063857906,7.99878999667726-6.993921332955324,18.611768568734988-18.305716735180795,23.275825705728494-11.311795402224561,4.664057136994415-88.663107062283416,11.63635602987415-101.825549339439021,13.054921424098211-9.156896410269837.986872807690816-22.445671944484275-1.699607277698306-32.361578348512012-9.375845127243338-6.060567209175133-4.691689645430415-7.024217699291512-12.856369187727068-5.012801896469682-20.125176809542609Z"/>
+ </g>
+ <g id="press-r1-tick">
+ <path id="vector-39" data-name="vector" class="cls-6" d="M942.280085838048763,154.425650326129471l-6.641029946520575-28.295280205407835c-1.069421809837877-4.556460369999513-3.845050574134802-8.544622444314882-7.785503883396814-11.16877032919183-10.305033813658156-6.862645123122093-29.693363162705282-16.909126896374801-61.94433873574053-21.541066262231652-40.410899145595977-5.803881316342085-63.574173727769448-1.67595859859739-71.37346478525069,2.356309985320877-7.799291057475784,4.032268583919176-8.930517445902296,9.599974127732821-10.627357028537517,21.537628493639204-1.69683958263704,11.937654365905473-3.110872568167906,22.883210077600779,0,30.882000074279858s7.729073722179237,17.843462243898102,18.913515517773703,22.507519380892518c11.184441795599923,4.664057136994415,86.851002064546265,12.404662354710126,99.865255266808163,13.823227748935096,9.053803687858817.986872807688997,24.832289837508142-2.300154227146777,34.636558221343876-9.976392076692719,5.992334442858919-4.691689645429506,6.945135694539204-12.856369187727068,4.956365373520384-20.125176809543518Z"/>
+ </g>
+ <g id="press-directional_buttons" data-name="press directional buttons">
+ <path id="press-right" class="cls-6" d="M268.488814225838723,334.43790859785986c-.881138954131529-4.856225799228923-8.000287016754555-10.934055604155219-13.387225167050019-10.52355412302677l-26.143633557534486,1.972570538391665c-5.196690850794766.180224634188562-10.133097972524411,2.132749841955047-13.827855757930593,5.477019910484159l-15.509952343694749,13.387225167050929c-4.746098708415047,4.295567679848318-3.224120312401283,9.942789559208904,0,14.048109939556525l16.53128638457838,17.081982952457111c2.212870050643687,2.242876932770741,4.956391338542744,3.864959754282609,7.940212138692914,4.706069160976767.020045330624271.009961551500965.04009066125036.019984216814919.070097543375596.019984216814919,1.291701549073878.320419720939753,2.633394197084272.500644355128316,3.995132175720755.540735016378676l25.683079863655621,2.703430626648696c6.208002226365352.650862107193461,12.416004452730704-4.325513448162383,14.028064608932254-9.832601354582948,3.404344946590754-11.564933494537399,2.853648378711114-27.255110472420711.620794111254327-39.580972051149729Z"/>
+ <path id="press-left" class="cls-6" d="M93.691106444520301,334.43790859785986c.881138954132439-4.856225799228923,8.000287016755465-10.934055604155219,13.387225167050929-10.52355412302677l26.143633557534486,1.972570538391665c5.196690850793857.180224634188562,10.133097972524411,2.132749841955047,13.827855757930593,5.477019910484159l15.50995234369384,13.387225167050929c4.746098708415957,4.295567679848318,3.224120312402192,9.942789559208904,0,14.048109939556525l-16.53128638457747,17.081982952457111c-2.212870050643687,2.242876932770741-4.956391338542744,3.864959754282609-7.940212138692914,4.706069160976767-.02004533062518.009961551500965-.04009066125036.019984216814919-.070097543375596.019984216814919-1.291701549073878.320419720939753-2.633394197084272.500644355128316-3.995132175720755.540735016378676l-25.683079863655621,2.703430626648696c-6.208002226366261.650862107193461-12.416004452731613-4.325513448162383-14.028064608932254-9.832601354582948-3.404344946591664-11.564933494537399-2.853648378711114-27.255110472420711-.620794111255236-39.580972051149729Z"/>
+ <path id="press-down" class="cls-6" d="M216.127629059650644,416.131848602111859l-1.251610887822608-14.278386786496412-.891161619445484-7.729980622378207c-.951175383695045-3.574546915466271-3.234142977715237-6.978952975870925-5.807462296736048-9.512242747454366l-17.08198295245802-16.53122527076448c-5.016466216604385-4.295567679850137-12.415943338917714-4.295567679850137-17.422386890209964,0l-14.688949381437851,15.50995234369293c-3.204074981776103,3.234142977715237-5.557140119171891,7.329440692750723-6.238009108490587,11.795149227662478v.010022665313954l-1.722187247013608,20.816770285300663v.04009066125036c-.420585260254484,5.386938150295464,4.866248464541059,13.207000532862367,11.334534419969714,14.658881385499626,2.403117350146204.540673902567505,4.946368673230609.981243379634179,7.55977865350269,1.311685765886068.030006882125235.009961551499146.070036429563515.0199842168131.110127090812966.0199842168131,4.676001165040361.520689685754405,9.592362956143916.841109406694159,14.448588755372839.861154737320248,7.529710657564465-.050113326564315,14.969278441127244-.881138954133348,21.267362427680382-2.57331931902263,6.037800257488925-1.622082821513686,11.104318686844636-8.190534316256162,10.383359036275579-14.398536542623333Z"/>
+ <path id="press-up" class="cls-6" d="M214.125051639131016,287.343575451437573l-1.251610887823517,14.278386786496412-.891161619444574,7.729980622378207c-.951175383695045,3.574546915466271-3.234142977715237,6.978952975870925-5.807462296736048,9.512242747455275l-17.08198295245802,16.53122527076539c-5.016466216605295,4.295567679848318-12.415943338918623,4.295567679848318-17.422386890209964,0l-14.688949381437851-15.509952343694749c-3.204074981777012-3.234142977714328-5.557140119171891-7.329440692749813-6.238009108490587-11.795149227662478v-.010022665312135l-1.722187247013608-20.816770285301573v-.04009066125036c-.420585260254484-5.386938150296373,4.866248464541059-13.207000532863276,11.334534419969714-14.658881385499626,2.403117350146204-.540673902567505,4.946368673230609-.98124337963327,7.55977865350178-1.311685765886068.030006882126145-.009961551500055.070036429563515-.0199842168131.110127090813876-.0199842168131,4.676001165040361-.520689685754405,9.592362956143916-.841109406695068,14.448588755372839-.861154737319339,7.529710657564465.050113326562496,14.969278441127244.881138954132439,21.267362427680382,2.573319319021721,6.037800257488925,1.622082821513686,11.104318686844636,8.190534316257072,10.383359036275579,14.398536542622423Z"/>
+ </g>
+ <g id="press-face">
+ <ellipse id="press-triangle" class="cls-6" cx="876.456953769733445" cy="280.460419417357343" rx="32.837030826089176" ry="29.738258104970328"/>
+ <ellipse id="press-square" class="cls-6" cx="792.312880216411486" cy="351.201290051810702" rx="32.837030826088721" ry="29.738258104970097"/>
+ <ellipse id="press-circle" class="cls-6" cx="952.568595064087276" cy="349.408770964358837" rx="32.837030826089176" ry="29.738258104969873"/>
+ <ellipse id="press-cross" class="cls-6" cx="870.129432057639406" cy="416.155748678944292" rx="32.837030826088721" ry="29.738258104969646"/>
+ </g>
+ <g id="press-create">
+ <rect id="vector-40" data-name="vector" class="cls-6" x="248.295962241331694" y="217.808886015609573" width="26.432218472334938" height="45.949353951775493" rx="12.394944429109916" ry="12.394944429109916" transform="translate(576.537522900934619 405.477985152035899) rotate(164.96355762970407)"/>
+ </g>
+ <g id="press-options">
+ <rect id="vector-41" data-name="vector" class="cls-6" x="776.681157361052669" y="217.966655456579758" width="26.432218472336785" height="45.949353951774697" rx="12.394944429105967" ry="12.394944429105967" transform="translate(89.55350249824312 -196.676114134473551) rotate(15.036442370316204)"/>
+ </g>
+ <g id="press-mute">
+ <rect id="vector-42" data-name="vector" class="cls-6" x="502.152992042663755" y="500.300131774190618" width="52.093490013181963" height="5.779690071260575" rx="2.881109197989152" ry="2.881109197989152"/>
+ </g>
+ <g id="press-ps_button" data-name="press PS button">
+ <path id="vector-43" data-name="vector" class="cls-5" d="M533.829590413211918,449.945252730924039l.005693245115253.01014392235993c0-2.178063719240527-3.726549207403878-2.451495044973854-3.726549207403878-.067851757430617l.006490536474303-.007923858896902.013330665633475,26.763945110626082-9.947220166965053-2.525065125844776-.002401882054983-33.229631311085541,18.550746088827509,4.617114707636574c2.610607037795489.649756731743764,5.039693544884358,3.247180845180992,5.936702090328254,5.089265535189043,1.261826722005935,2.59127039298437.957713744272041,6.711001694950028-.908514267788632,8.732985001219276-2.661519110388326,2.883649358887851-6.434843680706763,2.937991657139719-9.850775295279163,1.187626434220874l-.077501806887085-10.570608657993944ZM532.397453151734226,476.273338533301285l23.632783210325215-6.710981208434532c.759555159336742-.215690228089443,2.037366601231042-1.517825990224082,2.221679826981926-2.234277452918832,1.024225799063061-3.981309908143885-16.343346893796479-6.956047803132606-26.189256763293088-2.771252702834317l.004950548629495,4.619756690284703,12.679748511560319-3.726423321413677c2.068262193888586-.624304273513189,4.00193804049195,1.38688848680431,1.46984632814565,2.101298941426649l-14.171784317251877,3.940993123871522.352032654902359,4.780885930018485ZM507.304948172405602,469.196750852310288c-.253095925829257-.12013827537703-.235272664485819-.488790911022079.031647672781219-.573904285043682l10.990811484292863-3.504660073091145-.227514124281697-4.71778662442739-18.052750667337932,4.97612768244835c-.841153500170549.231858695358824-2.302073183131142,1.86206125096578-2.266946095955063,2.717401354357207.154961999811349,3.773304978714805,12.656137198064243,5.269520739933796,20.386790660812949,4.395721883978695l.041438786710387-4.605578360158688c-4.551043432541519,1.058381908442243-6.6997449794153,3.308084707481612-10.903477717022724,1.312678421936653Z"/>
+ </g>
+ <g id="press-touch_pad" data-name="press-touch pad">
+ <path id="vector-44" data-name="vector" class="cls-6" d="M695.124233971955618,167.84321186237139s-127.546629101165308-6.061941128151375-169.358564886011663-5.766556065489567c-43.503498954390125.307335298483849-174.345018623344913,5.382999855938579-174.345018623344913,5.382999855938579-32.391293660370138,3.684229276613223-49.521420433522508,25.532285388761011-41.775409191196559,57.540062119505819l28.204984145345406,117.058112844212701c6.156995327470213,25.441704847649817,28.902423330820056,43.358371247177274,55.043984720906337,43.358371247177274h263.354070281086024c26.144917077854188,0,48.892348784986098-17.92117127439451,55.046101317904686-43.36712040315615l28.111380123018535-116.755916030681874c7.740156263393146-32.005775577315944-11.396594248686597-57.449953567506782-44.281527887707853-57.449953567506782Z"/>
+ </g>
+ <g id="press-l2-tick">
+ <path id="vector-45" data-name="vector" class="cls-6" d="M262.858021166761318,88.727197287164017c-1.592014825576371-2.242876932768922-9.598159131771354-5.434704513266297-12.161516899293929-6.746390279151456-7.890098812129509-4.035222836972025-36.399194537497351-2.385307796976122-52.703943704619633.340758256710615-31.04617025778407,5.190752091261857-51.45449676334556,11.358608557030493-68.720764538433286,21.044429441821194-2.080537714537968,1.167114741273508-1.340393809254238.933373497446155-2.922447083330553,2.835785378648325,3.144061217527451-6.047761808987161,2.227149976164583-3.667371257607556,3.528874190549686-6.270697458754512,8.100391442257205-16.100739572823841,14.076756869113524-29.079584475496631,24.960760260518327-43.307919049242628,20.59651610367473-26.894600090228778,54.940706642780242-41.333166180288572,85.36988521485091-25.262494603402956,14.989323771752424,7.910205256567679,23.800652199264732,21.828081660873067,25.432757686091463,38.900041948018952l1.388066418578092,22.036002010829179c.010022665313045,0,.086893439367486,1.589618420927764.217108611735966,2.968752075787961l-.080314648247622-1.312321313857865s-1.014247652621634-.589974789804728-4.308465508399422-5.225946407406809Z"/>
+ </g>
+ <g id="press-r2-tick">
+ <path id="vector-46" data-name="vector" class="cls-6" d="M924.320868791282919,102.563835542049674c-1.321708431198203-1.622082821513686-30.442959045800308-15.156047974798639-62.694490404199314-19.781996927086766-40.411997678716943-5.807462296736958-58.769188661002772-.817485306650269-66.569205712945404,3.217737530322665-2.683446409835597,1.391744860761719-4.789292960396779,4.76099410560073-6.211105817095813,6.533294679178653-1.632105486827641,2.032584302642135-2.640313271665946,2.898827859588891-2.600222610415585,2.438213051897037l.640778328066517-6.978952975871834.832480398912594-18.828456231894961c1.061363588320091-11.54488816391131,7.02906630243524-21.037085580741405,15.499929678378976-28.396533155616453,27.265133137734665-23.179858088009496,62.720739477908865-18.974433282161044,85.429960092913461,7.559717539688791,13.957967065556659,16.290986872326357,33.188699601365443,49.530907328405192,35.671876046384568,54.236976489382869Z"/>
+ </g>
+ <g id="press-stick-left-2" data-name="press-stick-left">
+ <path id="vector-47" data-name="vector" class="cls-6" d="M413.483750842222435,506.621843176644688c0,30.168833729192556-26.434046396349913,54.720391347338591-58.925877267000942,54.720391347338591-32.481747091524994,0-58.915793487875817-24.551557618146035-58.915793487875817-54.720391347338591,0-17.282252917271762,8.671133340762026-32.722107717592735,22.188530929251101-42.755040150801506,10.07296198064796-7.479658444814049,22.849415701756698-11.965412310351894,36.727262558624716-11.965412310351894,13.877907970680099,0,26.664323243288891,4.485753865537845,36.737285223936851,11.965412310351894,13.517397588489075,10.032932433208771,22.188592043064091,25.472787233529743,22.188592043064091,42.755040150801506Z"/>
+ </g>
+ <g id="press-stick-right-2" data-name="press-stick-right">
+ <path id="vector-48" data-name="vector" class="cls-6" d="M637.958855854383728,506.621843173998059c-.000000001355147,30.168833729196194,26.434046393893368,54.720391348530029,58.925877264544397,54.720391349988859,32.481747091524085.000000001455192,58.915793488977215-24.551557615503043,58.915793490330543-54.720391344697418.000000000776708-17.282252917271762-8.671133339292282-32.72210771798018-22.188530927331158-42.755040151794674-10.072961980313266-7.479658445268797-22.849415701219186-11.965412311377804-36.727262558086295-11.965412311999899-13.877907970681918-.000000000625732-26.664323243490799,4.485753864337312-36.737285224473453,11.965412308700252-13.517397588941094,10.032932432603047-22.188592044209145,25.472787232532937-22.188592044984034,42.75504014980288Z"/>
+ </g>
+ </g>
+ </g>
+</svg>
+
diff --git a/docs/design-rules/xbox-series-gamepad.silhouette.svg b/docs/design-rules/xbox-series-gamepad.silhouette.svg
new file mode 100644
index 0000000000..4f710fc505
--- /dev/null
+++ b/docs/design-rules/xbox-series-gamepad.silhouette.svg
@@ -0,0 +1,198 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1050 660">
+ <defs>
+ <style>
+ .cls-1, .cls-2, .cls-3, .cls-4, .cls-5, .cls-7 {
+ fill: none;
+ }
+
+ .cls-1, .cls-2, .cls-3, .cls-4, .cls-7 {
+ stroke: #231815;
+ }
+
+ .cls-1 {
+ stroke-width: 3px;
+ }
+
+ .cls-2, .cls-3, .cls-4, .cls-5, .cls-7 {
+ stroke-width: 2.6px;
+ }
+
+ .cls-4, .cls-5 {
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ }
+
+ .cls-5 {
+ stroke: #000;
+ }
+
+ .cls-6 {
+ fill: #231815;
+ }
+
+ .cls-7 {
+ stroke-miterlimit: 10;
+ }
+
+ .cls-8 {
+ fill: #d9d9d9;
+ }
+
+ .cls-9 {
+ fill-opacity: 0.08;
+ }
+
+ .cls-10 {
+ fill: #cacaca;
+ }
+ </style>
+ </defs>
+ <title>xbox-series-gamepad</title>
+ <g id="body">
+ <path id="vector" class="cls-1" d="M779.24,50.08s8.36-26.22,13.59-32.58c9.58-15.15,43.38-20,61.39-.1.5-1.06,39.07,66.69,56.52,98a88.3,88.3,0,0,0,6.52,6.64c3.84,2.74,10.49,21.29,17,35.6.3,0,119.42,281.82,108.81,379-4,91.52-73.59,126-127.93,119.15-33.52-5.41-68.64-30.5-104.66-52.27-12.93-6.93-49.81-33.18-85.28-36.32-92-2.91-281-3.72-400.38.07-35.47,3.14-72.34,29.4-85.28,36.34-36,21.78-71.14,46.89-104.66,52.3C80.55,662.73,11,628.22,7,536.65c-10.6-97.19,108.5-379.13,108.8-379.16,6.51-14.32,13.17-32.88,17-35.62a92.33,92.33,0,0,0,6.52-6.64c17.45-31.33,56-99.11,56.51-98.06,18-19.63,51.77-14.76,61.39.11,5.23,6.36,12.19,32.8,12.19,32.8m403.8,24.69L375,74.67"/>
+ </g>
+ <g id="bumper-top">
+ <path id="vector-2" data-name="vector" class="cls-2" d="M906,128.92c0,.06.61-5.38.56-5.69a20.54,20.54,0,0,0-1.35-5.23C896.88,99.81,877,65.08,812.33,55,717.43,40.78,719.72,52.74,704,66.43c-8.47,7.26-25.32,8-30.18,8.06H377.48s-18.75.39-31.17-8.12C330,54.43,339.75,39.11,237.6,55.29c-86.46,14.31-94.19,66-93.18,74"/>
+ </g>
+ <g id="bumper-mid">
+ <path id="vector-3" data-name="vector" class="cls-3" d="M145.58,119.23S150.35,104,205.51,87.5c55.83-14.36,80.63-15.72,104.55-16,37.5.25,15.63,21,59.39,20.76,90.27.52,242.49.4,311.72,0,43.76.26,23.34-20.51,60.84-20.76,23.92.27,48.72,1.63,104.55,16,55.16,16.46,58.92,31.32,58.92,31.32"/>
+ </g>
+ <g id="bumper-bottom">
+ <path id="vector-4" data-name="vector" class="cls-3" d="M134.23,120.53s-11.86,14.32,16.53,8.43c68.05-13.5,141-19.44,223.9-20.21-.07-.17,299.29,0,299.32,0,138.81.5,207.67,18.53,234.82,21.42,14,1.87,6.32-9.95,6.32-9.95"/>
+ </g>
+ <g id="bumper-notch">
+ <path id="vector-5" data-name="vector" class="cls-3" d="M672.48,74.49l2.17,34m-300-34-1.45,34"/>
+ </g>
+ <g id="lt-tick">
+ <path id="vector-6" data-name="vector" class="cls-4" d="M194.66,19.59s-1.61,13.43,0,24.07c2.37,13,6.6,20.26,6.6,20.26"/>
+ </g>
+ <g id="rt-tick">
+ <path id="vector-7" data-name="vector" class="cls-5" d="M854.9,19.62s1.62,13.42,0,24.06c-2.37,13-6.6,20.26-6.6,20.26"/>
+ </g>
+ <g id="pairing">
+ <path id="vector-8" data-name="vector" class="cls-3" d="M442.22,76.37c-9.21,0-16.67,3.14-16.67,7s7.46,7,16.67,7,16.67-3.14,16.67-7S451.43,76.37,442.22,76.37Z"/>
+ <path id="vector-9" data-name="vector" class="cls-3" d="M425.55,83s6.27,3,16.67,3.14c11.29-.15,16.46-2.77,16.46-2.77"/>
+ <g id="Union">
+ <polyline id="vector-10" data-name="vector" class="cls-3" points="469.53 78.29 473.25 82.66 469.53 87.19"/>
+ <polyline id="vector-11" data-name="vector" class="cls-3" points="484.42 78.38 488.14 82.75 484.42 87.28"/>
+ <polyline id="vector-12" data-name="vector" class="cls-3" points="477.12 78.34 480.83 82.72 477.12 87.24"/>
+ </g>
+ </g>
+ <g id="stick-left">
+ <path id="Vector-13" data-name="Vector" class="cls-3" d="M326.9,288.24c1.83-41.56-31.54-76.85-74.55-78.83S173,239.53,171.16,281.09s31.54,76.85,74.54,78.83S325.06,329.8,326.9,288.24Z"/>
+ <path id="Vector-14" data-name="Vector" class="cls-3" d="M248.34,360c36.89,0,66.79-31,66.79-69.14s-29.9-69.14-66.79-69.14-66.78,31-66.78,69.14S211.46,360,248.34,360Z"/>
+ <path id="Vector-15" data-name="Vector" class="cls-3" d="M247.27,344c22.72-.37,40.88-17.12,40.56-37.43s-19-36.46-41.7-36.09-40.87,17.12-40.56,37.42S224.56,344.35,247.27,344Z"/>
+ <path id="vector-16" data-name="vector" class="cls-3" d="M230.57,246.52s4.17-11.42,24.71-9.49c12,1.93,14.8,10.6,14.8,10.6"/>
+ <path id="Vector-17" data-name="Vector" class="cls-3" d="M261,358.21c31.81-7.84,51.58-39.51,44.18-70.74s-39.2-50.19-71-42.36S182.6,284.62,190,315.85,229.21,366,261,358.21Z"/>
+ </g>
+ <g id="stick-right">
+ <path id="Vector-18" data-name="Vector" class="cls-3" d="M742.58,446.18c1.83-41.56-31.55-76.85-74.55-78.82S588.67,397.48,586.84,439s31.55,76.85,74.55,78.82S740.75,487.74,742.58,446.18Z"/>
+ <path id="Vector-19" data-name="Vector" class="cls-3" d="M730.71,442.9c-2.63-33.73-30.33-64.08-66-64.09-35.82,0-63.35,30.59-66,63.48-3.2,39.82,30.45,78.19,70.31,75.66C705.36,515.64,733.61,480.21,730.71,442.9Z"/>
+ <path id="Vector-20" data-name="Vector" class="cls-3" d="M679.37,516c31.62-8.14,51-40.1,43.22-71.37s-39.68-50-71.31-41.89-51,40.1-43.22,71.38S647.74,524.17,679.37,516Z"/>
+ <path id="Vector-21" data-name="Vector" class="cls-3" d="M665.89,503c22.72-.37,40.88-17.12,40.56-37.42s-19-36.47-41.7-36.1-40.87,17.12-40.56,37.42S643.18,503.32,665.89,503Z"/>
+ <path id="vector-22" data-name="vector" class="cls-3" d="M641,406.83s5.3-14.56,25.22-12.43a16.76,16.76,0,0,1,13.57,8.48"/>
+ </g>
+ <g id="dpad">
+ <path id="Vector-23" data-name="Vector" class="cls-3" d="M466.58,451c1.67-41.16-33.29-76.05-78.09-77.94S306,403.05,304.35,444.2s33.3,76.05,78.09,77.94S464.91,492.19,466.58,451Z"/>
+ <path id="Vector-24" data-name="Vector" class="cls-3" d="M465.31,455.38c2-39-32.09-72.58-76.2-75s-81.51,27.32-83.54,66.34,32.09,72.57,76.2,75S463.28,494.4,465.31,455.38Z"/>
+ <path id="Vector-25" data-name="Vector" class="cls-3" d="M451.29,429.83a290.74,290.74,0,0,0-39.45-5.17V395.85c0-12.8-19.57-12.56-28.26-12.56-5.8,0-26.09-.24-26.09,12.56v29.31c-15.66,1.16-30.66,2.95-38.59,4.66-19.12,4.95-15.42,47.86,0,49.45,12.51-1.38,25.5-3.07,38.57-4.31v34.63c0,14.77,54.35,14.77,54.35,0V474.4c12.94,1.2,25.91,3.14,39.48,4.85C466.64,480.68,475.34,434.11,451.29,429.83Z"/>
+ <path id="Vector-26" data-name="Vector" class="cls-3" d="M402.84,424.43s-9-.74-17.92-.74c-8.52,0-16.87.74-16.87.74a6.58,6.58,0,0,0-6.53,6.64v31.76a6.59,6.59,0,0,0,6.53,6.65s8.77-.74,17.51-.74,17.27.74,17.27.74a6.59,6.59,0,0,0,6.53-6.65V431.07A6.58,6.58,0,0,0,402.84,424.43Z"/>
+ <path id="Vector-27" data-name="Vector" class="cls-3" d="M306.09,443.67a26.29,26.29,0,0,1,9.11-12.32c4.23-3.91,42.29-6.19,42.29-6.19V420c-15.72,1.16-30.81,3-38.77,4.69C311.29,426.6,305.31,438.6,306.09,443.67Zm144.59-18.62a289.4,289.4,0,0,0-38.83-5.1l0,4.72s31.16,2.38,41.05,5.87c12.61,4.49,12.35,22.83,12.34,15.14C465.29,439.87,465.85,429.4,450.68,425.05Z"/>
+ </g>
+ <g id="face">
+ <g id="B">
+ <path id="Vector-28" data-name="Vector" class="cls-3" d="M882.44,311.13c19.21-4.94,31-24.35,26.25-43.35a35.29,35.29,0,0,0-43.31-25.43c-19.21,4.94-31,24.35-26.25,43.35A35.29,35.29,0,0,0,882.44,311.13Z"/>
+ <path id="Vector-29" data-name="Vector" class="cls-3" d="M881.89,310.93c18-4.63,29-22.8,24.57-40.58a33,33,0,0,0-40.53-23.8c-18,4.63-29,22.79-24.57,40.57A33,33,0,0,0,881.89,310.93Z"/>
+ <path id="B-2" data-name="B" class="cls-6" d="M884.66,275.2s10.2-7.84,5-17.86c-3.07-3.21-11.58-3.19-27.08-1.62l-.95,43.9s12.1,1.58,21.13-3.08S898.58,281.27,884.66,275.2Zm-14.08-12.3c13.1-2,12.13,3.91,12.13,3.91,0,9.72-13.08,7.17-13.08,7.17Zm14.15,23.39c-1.57,7.13-16.1,8.2-16.1,8.2l1-13.33C885.4,278.9,884.73,286.29,884.73,286.29Z"/>
+ </g>
+ <g id="A">
+ <path id="Vector-30" data-name="Vector" class="cls-3" d="M807.44,383.15c18.85-4.85,30.46-23.58,25.93-41.83s-23.47-29.1-42.32-24.25-30.45,23.58-25.92,41.83S788.6,388,807.44,383.15Z"/>
+ <path id="Vector-31" data-name="Vector" class="cls-3" d="M807.4,382.91c17.48-4.46,28.18-22,23.89-39.07s-21.94-27.38-39.42-22.92S763.68,342.86,768,360,789.91,387.37,807.4,382.91Z"/>
+ <path id="A-2" data-name="A" class="cls-6" d="M798,325.45l-18.11,44.1h6s2.08-4.5,4.73-10.26H810.1l3,8.2h8l-15.09-42ZM808.36,354H793.14l0-.09,8.87-19.2,6.2,18.95C808.29,353.75,808.32,353.86,808.36,354Z"/>
+ </g>
+ <g id="X">
+ <path id="Vector-32" data-name="Vector" class="cls-3" d="M736.69,320.07c20.35-5.24,33-25.08,28.22-44.3s-25.13-30.56-45.49-25.31-33,25.07-28.23,44.29S716.33,325.31,736.69,320.07Z"/>
+ <path id="Vector-33" data-name="Vector" class="cls-3" d="M736.27,319.66c18.81-4.85,30.48-23.26,26.05-41.13S739,250.11,720.22,255s-30.48,23.26-26.05,41.13S717.45,324.5,736.27,319.66Z"/>
+ <path id="X-2" data-name="X" class="cls-6" d="M740.76,265l-12.07,17.43L718.62,266h-6l11.06,21.54-1,1L709.57,306h8l10.06-13.33L737.74,306h7l-12.08-18.46L747.81,265Z"/>
+ </g>
+ <g id="Y">
+ <path id="Vector-34" data-name="Vector" class="cls-3" d="M811.21,245.52c20.72-5.33,33.69-25.07,29-44.09s-25.33-30.1-46-24.77-33.68,25.08-29,44.09S790.5,250.85,811.21,245.52Z"/>
+ <path id="Vector-35" data-name="Vector" class="cls-3" d="M811.49,244.56c18.81-4.85,30.58-22.84,26.28-40.18s-23-27.48-41.86-22.63-30.58,22.83-26.28,40.18S792.67,249.4,811.49,244.56Z"/>
+ <path id="Y-2" data-name="Y" class="cls-6" d="M792.08,191.11l10.07,22.56,15.09-23.58h7l-19.12,31.79v14.36h-7V220.85L785,191.11Z"/>
+ </g>
+ </g>
+ <g id="view">
+ <path id="Vector-36" data-name="Vector" class="cls-3" d="M451.41,309c13-3.45,21.18-16.32,18.18-28.74s-16-19.69-29-16.24-21.17,16.32-18.18,28.74S438.37,312.48,451.41,309Z"/>
+ <path id="Vector-37" data-name="Vector" class="cls-3" d="M451,309.17c11.64-3,18.81-14.55,16-25.81s-14.49-17.95-26.13-15-18.81,14.56-16,25.82S439.4,312.17,451,309.17Z"/>
+ <g id="Union_图像" data-name="Union 图像">
+ <path id="Vector-38" data-name="Vector" class="cls-6" d="M457.48,288.36v10.25H440.37V288.36Zm-15.08,1.89,0,6.31h13.08l0-6.31Z"/>
+ <path id="Vector-39" data-name="Vector" class="cls-6" d="M447.45,283.25h-2v-2.11h-11v7.22h3.19v2.05h-5.22V279.09h15Z"/>
+ </g>
+ </g>
+ <g id="menu">
+ <path id="Vector-40" data-name="Vector" class="cls-3" d="M607.65,309a23.76,23.76,0,0,0,17.29-28.56,23.25,23.25,0,0,0-28.53-16.76,23.77,23.77,0,0,0-17.29,28.56A23.26,23.26,0,0,0,607.65,309Z"/>
+ <path id="Vector-41" data-name="Vector" class="cls-3" d="M606.84,307.53c11.11-2.86,18-13.85,15.32-24.56s-13.82-17.06-24.93-14.2-18,13.86-15.32,24.57S595.72,310.4,606.84,307.53Z"/>
+ <g id="Union-2" data-name="Union">
+ <path id="Vector-42" data-name="Vector" class="cls-6" d="M613.2,283.31H591.88v-2.05H613.2Z"/>
+ <path id="Vector-43" data-name="Vector" class="cls-6" d="M613.24,297.31H591.92v-2.05h21.32Z"/>
+ <path id="Vector-44" data-name="Vector" class="cls-6" d="M613.24,290.31H591.92v-2.05h21.32Z"/>
+ </g>
+ </g>
+ <g id="share">
+ <path id="vector-45" data-name="vector" class="cls-7" d="M538.27,327.91H509.49a13.41,13.41,0,0,0-13.3,13.52v4.2a13.42,13.42,0,0,0,13.3,13.53h28.78a13.42,13.42,0,0,0,13.3-13.53v-4.2A13.41,13.41,0,0,0,538.27,327.91Z"/>
+ <path id="vector-46" data-name="vector" class="cls-7" d="M536.67,331.9H511a13.13,13.13,0,0,0-12.88,13.35v.5A13.13,13.13,0,0,0,511,359.11h25.67a13.12,13.12,0,0,0,12.88-13.36v-.5A13.12,13.12,0,0,0,536.67,331.9Z"/>
+ <path id="vector-47" data-name="vector" class="cls-6" d="M536.54,342.69v8.2H512.39v-8.2h-3V354h30.19V342.69Zm-14.08,5.13h4v-5.13h3l-5.09-6-5,6h3Z"/>
+ </g>
+ <g id="guide">
+ <g id="Vector-48" data-name="Vector">
+ <path class="cls-6" d="M512.33,163.43l-17.11-12.31c-21.56,20.33-5,51.27-5,51.27C495.9,173.46,512.33,163.43,512.33,163.43Zm40.25-12.31-16.1,12.31c19.15,16,21.13,39,21.13,39C575.93,171.2,552.58,151.12,552.58,151.12Zm-28.17,21.54s-24.29,18.86-29.19,34.86c0,0,27.92,29.39,57.36,0C552.58,207.52,547.18,191.55,524.41,172.66Zm0-19.49s8-6.67,22.13-6.15c0,0-19.89-18.28-45.28,0C501.26,147,517,146.69,524.41,153.17Z"/>
+ </g>
+ </g>
+ <g id="press">
+ <g id="press-dpad">
+ <path id="bottom" class="cls-8" d="M384.94,475.59c-13.51-.43-21.87-.93-21.75,5.76v21.42c0,4.29,8.28,9.92,20.76,10.31,14.25.44,22-4.89,22-9.18l0-21.07C406,475.52,398.17,476,384.94,475.59Z"/>
+ <path id="left" class="cls-8" d="M354.55,449.9c-.37-15.85,1-19.06-3.08-19.32-16.43,1-20.56,1.45-30.07,3.61-17.17,5.06-13.38,40.21,2.18,39.24,18.61-3,14.67-2.65,30.09-3.59C356,469.38,355,467.11,354.55,449.9Z"/>
+ <path id="right" class="cls-8" d="M448.52,433.76c-9.51-2.17-13.64-2.6-30.07-3.62-4.05.26-2.71,3.47-3.08,19.33-.4,17.2-1.41,19.48.88,19.94,15.43.93,12.53,1.6,31.88,3.61C461.6,475.09,465.69,438.81,448.52,433.76Z"/>
+ <path id="top" class="cls-8" d="M405.85,395.05c0-3.49-7.66-7.82-21.9-7.46-12.46.32-21.46,5.52-21.46,9l.1,19.43c-.15,5.43,8.64,2.35,22.13,2,13.21-.34,21.92,2.81,21.92-3.12Z"/>
+ </g>
+ <g id="press-rt">
+ <path id="Vector-49" data-name="Vector" class="cls-9" d="M809,6.54C785.73,14,780.91,49.16,780.91,49.16c65.45,6.12,93.62,23.45,110.24,43,22.64,27.94,16.05,36.75,16.05,36.75l4.2.38s.69-2.82-1.25-10c-.11-5.09-29.92-58.85-49.09-91.44C844.84,6.72,829.33,1.2,809,6.54Z"/>
+ </g>
+ <g id="press-lt">
+ <path id="Vector-50" data-name="Vector" class="cls-9" d="M238.83,6.54c23.24,7.43,28,42.62,28,42.62-65.44,6.12-93.61,23.45-110.24,43-22.64,27.94-16,36.75-16,36.75l-4.21.38s-.68-2.82,1.25-10c.12-5.09,29.93-58.85,49.1-91.44C203,6.72,218.46,1.2,238.83,6.54Z"/>
+ </g>
+ <g id="press-rb">
+ <path id="Vector-51" data-name="Vector" class="cls-9" d="M725.62,51c-16.78,4.53-16.48,15.4-25.71,18.92a83.76,83.76,0,0,1-27.09,5.39c.24,0,2.09,33.67,2.09,33.67s66.57.38,128.92,5.78c52.18,4.53,102,14.17,102,14.17.09.3,2.89-33.53-49.3-59.77C817.21,51.05,742.49,46,725.62,51Z"/>
+ </g>
+ <g id="press-lb">
+ <path id="Vector-52" data-name="Vector" class="cls-9" d="M322.18,51c16.78,4.53,16.48,15.4,25.71,18.92A83.72,83.72,0,0,0,375,75.28c-.23,0-2.09,33.67-2.09,33.67s-66.56.38-128.91,5.78c-52.18,4.53-102,14.17-102,14.17-.09.3-2.89-33.53,49.29-59.77C230.59,51.05,305.31,46,322.18,51Z"/>
+ </g>
+ <g id="press-stick-left">
+ <path id="Vector-53" data-name="Vector" class="cls-9" d="M261,358.21c31.77-7.84,51.53-39.5,44.13-70.73S266,237.3,234.21,245.13s-51.54,39.5-44.14,70.73S229.24,366,261,358.21Z"/>
+ </g>
+ <g id="press-stick-right">
+ <path id="Vector-54" data-name="Vector" class="cls-9" d="M678.7,516.14c31.71-7.89,51.43-39.77,44-71.21S683.66,394.4,652,402.29s-51.43,39.77-44,71.21S647,524,678.7,516.14Z"/>
+ </g>
+ <g id="press-face">
+ <path id="B-3" data-name="B" class="cls-9" d="M874.46,245.46c-18.79,0-34,14-34.07,32.87S854.53,312,873.32,312a34.17,34.17,0,0,0,34.11-34.09C907.49,259.08,893.24,245.46,874.46,245.46Z"/>
+ <path id="A-3" data-name="A" class="cls-9" d="M799.25,319.87c-18.85,0-32.22,15-32.22,32.87s12.48,31.2,31.32,31.2,33.89-13.35,33.89-31.2A32.73,32.73,0,0,0,799.25,319.87Z"/>
+ <path id="Y-3" data-name="Y" class="cls-9" d="M805.65,180.6c-20,0-36.87,15-36.87,34s13.34,31.17,33.38,31.17,36.5-13.56,36.5-32.58S827.07,180.6,805.65,180.6Z"/>
+ <path id="X-3" data-name="X" class="cls-9" d="M728.24,253.78a34.7,34.7,0,0,0-35,35c0,19.2,13.77,32.07,33.66,32.07s36.32-14.32,36.32-33.52S748.12,253.78,728.24,253.78Z"/>
+ </g>
+ <g id="press-view">
+ <path id="Vector-55" data-name="Vector" class="cls-9" d="M446.19,268.26c-11.86,0-21.48,9.32-21.48,20.81s9.62,20.82,21.48,20.82,21.47-9.32,21.47-20.82S458.05,268.26,446.19,268.26Z"/>
+ </g>
+ <g id="press-menu">
+ <path id="Vector-56" data-name="Vector" class="cls-9" d="M602,268.09a20.34,20.34,0,1,0,20.69,20.34A20.52,20.52,0,0,0,602,268.09Z"/>
+ </g>
+ <g id="press-share">
+ <path id="Vector-57" data-name="Vector" class="cls-9" d="M535.29,331.9H512c-7.91,0-14.36,5.91-14.4,13.21v.83c0,7.3,6.35,13.22,14.27,13.22h23.29c7.92,0,14.37-5.92,14.41-13.22v-.83C549.59,337.81,543.21,331.9,535.29,331.9Z"/>
+ </g>
+ <g id="press-guide">
+ <path id="Vector-58" data-name="Vector" class="cls-10" d="M512.33,163.43l-17.11-12.31c-21.56,20.34-5,51.28-5,51.28C495.9,173.46,512.33,163.43,512.33,163.43Zm40.25-12.31-16.1,12.31c19.15,16,21.14,39,21.14,39C575.93,171.21,552.58,151.12,552.58,151.12Zm-28.17,21.54s-24.29,18.86-29.19,34.87c0,0,27.92,29.38,57.36,0C552.58,207.53,547.18,191.55,524.41,172.66Zm0-19.48s8-6.68,22.14-6.16c0,0-19.89-18.28-45.29,0C501.26,147,517,146.69,524.41,153.18Z"/>
+ </g>
+ <g id="press-pairing">
+ <path id="Vector-59" data-name="Vector" class="cls-9" d="M442.31,76.37c-8.7,0-15.75,3-15.75,6.68s7.05,6.68,15.75,6.68,15.75-3,15.75-6.68S451,76.37,442.31,76.37Z"/>
+ </g>
+ </g>
+</svg>