public void Send(Gamepad.GamepadOutput player) { if (_class.Define.Write == null) { return; } var boolOverride = _class.BaseClass.Home.boolIDE; if ((_class.Define.IsConnected() != 1) && !boolOverride) { return; } _class.Define.Write(player.Output); var report = new Define.GcapiReportControllermax(); if (_class.Define.Read(ref report) == IntPtr.Zero) { return; } if (_class.BaseClass.System.UseRumble) { GamePad.SetState(player.PlayerIndex, report.Rumble[0], report.Rumble[1]); } //TODO: Read report to see what authenticating controller is doing }
public void Send(Gamepad.GamepadOutput player) { if (!_isConnected) { if (_class.MDefine.GcmapiConnect != null) { _class.MDefine.GcmapiConnect((ushort)_class.Write.DevId); } _isConnected = true; } if (_class.MDefine.GcmapiIsConnected(player.Index - 1) == 1) { //todo: assign active divice to each player. For now, just assign player number to device, also menu options for multiplayer _class.MDefine.GcmapiWrite(player.Index - 1, player.Output); //_class.MDefine.GcmapiWrite(_activeIndex, player.Output); if (!_class.System.UseRumble) { return; } var report = new Define.GcmapiReport(); if (_class.MDefine.GcmapiRead(player.Index - 1, ref report) != IntPtr.Zero) { GamePad.SetState(player.PlayerIndex, report.Rumble[0], report.Rumble[1]); } } else { _class.System.Debug("titanone.log", "not connected to " + _activeDevice); } }
public static GcmapiStatus[] Send(Gamepad.GamepadOutput player) { if (_notConnected == null) { _notConnected = new List <int>(); } if (_connected == null) { _connected = new List <int>(); } //Do a nice little notifier to know if the device is found or not if (Connected(player.Index) != 1) { if (_notConnected.IndexOf(player.Index) > -1) { return(null); } if (_connected.IndexOf(player.Index) > -1) { _connected.Remove(player.Index); } _notConnected.Add(player.Index); Debug.Log($"TitanOne device {player.Index} not connected"); return(null); } if (_connected.IndexOf(player.Index) == -1) { _connected.Add(player.Index); if (_notConnected.IndexOf(player.Index) > -1) { _notConnected.Remove(player.Index); } Debug.Log($"TitanOne device {player.Index} connected"); } Write(player.Index, player.Output); var report = new Report(); if (Read(player.Index, ref report) == IntPtr.Zero) { return(null); } if (AppSettings.AllowPassthrough) { Gamepad.ReturnOutput[player.Index - 1] = report.Input; } if (AppSettings.AllowRumble[player.Index]) { Gamepad.SetState(player.Index, report.Rumble[0], report.Rumble[1]); } return(report.Input); }
public void Send(Gamepad.GamepadOutput player) { if (ApiMethod == Define.ApiMethod.Multi) { _class.MWrite.Send(player); return; } if (_class.Define.Write == null) { return; } var boolOverride = _class.FrmMain.boolIDE; if ((_class.Define.IsConnected() == 1) || boolOverride) { //Block authenticating gamepad rumble //gcapi_WriteEX(uint8_t *outpacket, uint8_t size) /* * [0xFF,0x01 : 2 byte, Packet Signature] * [Update LED Command (0,1) : 1 byte] * [LED 1 Status : 1 byte] * [LED 2 Status : 1 byte] * [LED 3 Status : 1 byte] * [LED 4 Status : 1 byte] * [Reset LEDs Command (0,1) : 1 byte] * [Update Rumble Command (0,1) : 1 byte] * [Rumble 1 Value : 1 byte] * [Rumble 2 Value : 1 byte] * [Rumble 3 Value : 1 byte] * [Rumble 4 Value : 1 byte] * [Reset Rumble Command (0,1) : 1 byte] * [Block Rumble Command (0,1) : 1 byte] * [Turn Off Controller Command (0,1) : 1 byte] * [Button States : 36 bytes - same format as gcapi_Write] */ //No multi - api, so no point accepting controls from any gamepad here if (player.Index != 1) { return; } _class.Define.Write(player.Output); if (!_class.System.UseRumble) { return; } if (DevId == Define.DevPid.TitanOne) { var report = new Define.GcapiReportTitanone(); if (_class.Define.Read(ref report) != IntPtr.Zero) { GamePad.SetState(PlayerIndex.One, report.Rumble[0], report.Rumble[1]); } } else { var report = new Define.GcapiReportControllermax(); if (_class.Define.ReadCm(ref report) != IntPtr.Zero) { GamePad.SetState(PlayerIndex.One, report.Rumble[0], report.Rumble[1]); } } } else { if (_isToDisconnected) { return; } _class.System.Debug("titanOne.log", "[NOTE] TitanOne is disconnected"); _isToDisconnected = true; } }