feat(DSU): DSU Server — iPhone/iPad as DSU controller server (broadcasts touch + motion over LAN)
Overview
Implement DSU Server mode in Provenance for iPhone and iPad. When enabled, the app broadcasts the device's touch input and CoreMotion sensor data as a DSU controller server on the local network, making the phone act as a wireless game controller for any DSU-capable client — including Provenance on tvOS or another device.
Background
The DSU (CemuHook UDP) protocol has a server role that broadcasts controller state at ~100 Hz over UDP. Any emulator with DSU client support (Cemu, Dolphin, PCSX2, Yuzu, Provenance) can connect and treat the phone as a standard gamepad plus gyro/accelerometer.
This is the "phone as controller" transport layer — the Companion Controller UI feature (see sibling epic) builds on top of this.
Architecture
iPhone (Provenance DSU Server)
├── DSUServerService (PVControllerDSU)
│ ├── NWListener on port 26760 (or user-configured)
│ ├── Accepts RequestData packets from clients
│ └── Broadcasts ControllerData @ 100 Hz
├── TouchInputMapper
│ └── Maps on-screen touch to DSU button/axis state
└── MotionInputMapper
└── CMMotionManager → DSU gyro/accel fieldsDeliverables
PVControllerDSU/Sources/PVControllerDSU/Server/DSUServer.swift— server lifecycle, slot management, 100 Hz send loopPVControllerDSU/Sources/PVControllerDSU/Server/DSUServerSlot.swift— per-slot state: buttons, axes, gyro, accelPVUIintegration:DSUServerBootstrapTaskthat starts the server when setting is enabledPVSettingskey:dsuServerEnabled: Bool,dsuServerPort: Int(default 26760)- Background task /
UIApplication.beginBackgroundTaskso the server keeps running while the user interacts with the companion controller UI
Acceptance Criteria
- Server starts/stops cleanly from Settings toggle
- External DSU client (e.g. Cemu on macOS on same LAN) sees the iPhone as a controller with correct button state
- Gyro/accelerometer data streams correctly (validated with a reference client)
- Multiple clients can connect simultaneously (up to 4 slots)
- Server survives app backgrounding for at least 30 seconds
- Port conflict is surfaced as a Settings warning, not a crash
Depends On
- https://github.com/Provenance-Emu/Provenance/issues/2692 (PVControllerDSU module)
Part Of
Part of https://github.com/Provenance-Emu/Provenance/issues/2691 (EPIC: DSU Controller Protocol Support)
Source: Provenance-Emu/Provenance