Motion Control Implementation #33
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "MediaMoots/MeloNX:motionDev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
This pull request introduces motion control support to MeloNX by implementing a Cemuhook-compatible DSU (UDP) server.
This allows Ryujinx, running within MeloNX, to receive motion data from the iOS device's internal IMU or from connected game controllers that expose motion capabilities through Apple's GameController framework.
Key Changes:
DSU Server Core (
DSUServer.swift
- New File):DSUServer
class responsible for handling DSU communications.CocoaAsyncSocket
for efficient UDP packet handling on the standard DSU port26760
.0x100001 - DSUSPortInfo
).0x100002 - DSUSPadDataRsp
) to subscribed clients (Ryujinx).DSUMotionProvider
s.Motion Providers (
DSUMotionProviders.swift
- New File):DSUMotionProvider
protocol for sources of motion data.DeviceMotionProvider
:CoreMotion
.DSUMotionSample
data to theDSUServer
.ControllerMotionProvider
:GCController
instances (e.g., Switch Pro Controller, DualSense) that supportGCMotion
.DSUMotionSample
data to theDSUServer
.MeloNX Application Integration:
Ryujinx.swift
(MeloNX/MeloNXApp/Core):Configuration
struct now includesinputDSUServers: [String]
.--input-dsu-server-[slot]
or--input-dsu-server-handheld
) are appended, pointing to the local DSU server (127.0.0.1:26760
).ContentView.swift
(MeloNX/MeloNXApp/View/Main):registerMotionForMatchingControllers()
function is called before starting Ryujinx.NativeController
s and theVirtualController
(if active) to register corresponding motion providers with the sharedDSUServer
.NativeController.swift
&VirtualController.swift
:tryRegisterMotion(slot: UInt8)
methods. These methods instantiate and register either aControllerMotionProvider
(for native controllers) or aDeviceMotionProvider
(for the virtual/handheld controller) with theDSUServer.shared
.Package.resolved
:CocoaAsyncSocket
dependency.Ryujinx Headless SDL Modifications:
Options.cs
(src/Ryujinx.Headless.SDL2):input-dsu-server-1
throughinput-dsu-server-8
, andinput-dsu-server-handheld
. These options allow specifying the DSU server address (host:port) for each player and the handheld mode.Program.cs
(src/Ryujinx.Headless.SDL2):HandlePlayerConfiguration
: Modified to accept a newstring inputDSUServer
parameter. If this string is provided and not empty, it parses the host and port, then configures aCemuHookMotionController
for the player's input configuration.LoadPlayerConfiguration
(and its callers): Updated to pass theoption.InputDSUServerX
oroption.InputDSUServerHandheld
value toHandlePlayerConfiguration
.How it Works:
DeviceMotionProvider
orControllerMotionProvider
) with theDSUServer
.127.0.0.1:26760
for DSU motion input for the relevant player slots.CemuHookMotionController
connects to this local DSU server.DSUMotionSample
data to theDSUServer
.DSUServer
then broadcasts this data in the DSU protocol format to Ryujinx, enabling in-game motion controls.Limitations & Considerations:
GCMotion
.26760
.Motion Control showcases:
https://discord.com/channels/1300369899704680479/1320760791087185930/1375007254486716497
https://discord.com/channels/1300369899704680479/1320760791087185930/1374793679503491146
https://discord.com/channels/1300369899704680479/1320760791087185930/1374793679503491146
https://discord.com/channels/1300369899704680479/1320760811622371544/1373227385138184214
https://discord.com/channels/1300369899704680479/1320760791087185930/1374759886814183604