public EmulationSlot(uint slotNumber, XboxGamepad gamepad, Keyboard keyboard, Mouse mouse, Preset preset) : base(slotNumber, gamepad, keyboard, mouse, preset) { this.InitializeComponent(); if (gamepad.Exsists) { this.InvalidateReason = SlotInvalidationReason.Controller_Already_Plugged_In; } }
/// <summary> /// Creates an XboxGamepad for this console. /// </summary> /// <returns>A new XboxGamepad.</returns> /// <remarks> /// Does not attempt to connect the XboxGamepad, and does not /// provide control over a physical controller. /// </remarks> public XboxGamepad CreateXboxGamepad() { this.ThrowIfDisposed(); var gamepad = new XboxGamepad(this); this.XboxGamepads.Add(gamepad); return(gamepad); }
public void TestPairWithVirtualControllerExclusiveThrowsArgumentExceptions() { XboxGamepad gamepad = new XboxGamepad(this.xboxConsole); XboxUser user = this.CreateTestUser(); ShimXboxConsoleAdapterBase.AllInstances.PairGamepadToUserExclusiveStringUInt64UInt32 = (adapter, systemIpAddress, gamepadId, userId) => { Assert.Fail("Test should never have gotten to the adapters method."); }; user.PairWithVirtualControllerExclusive(gamepad); }
/// <summary> /// Pairs a user with a virtual controller exclusivly. /// </summary> /// <param name="gamepad">The virtual gamepad with which the user will be paired.</param> public void PairWithVirtualControllerExclusive(XboxGamepad gamepad) { if (gamepad == null) { throw new ArgumentNullException("gamepad", "gamepad cannot be null."); } if (!gamepad.Id.HasValue) { throw new ArgumentException("gamepad must have a non-null id value.", "gamepad"); } this.Console.Adapter.PairGamepadToUserExclusive(this.Console.SystemIpAddressAndSessionKeyCombined, gamepad.Id.Value, this.UserId); }
public void TestPairWithMethodsPassOnIds() { const uint ExpectedUserId = TestUserId; const ulong ExpectedGamepadId = 9876543210; var gamepad = new XboxGamepad(this.xboxConsole); XboxUser user = this.CreateTestUser(); ShimXboxConsoleAdapterBase.AllInstances.ConnectXboxGamepadString = (_, __) => ExpectedGamepadId; gamepad.Connect(); ShimXboxConsoleAdapterBase.AllInstances.PairGamepadToUserStringUInt64UInt32 = (adapter, systemIpAddress, gamepadId, userId) => { Assert.AreEqual(ExpectedGamepadId, gamepadId, "The XboxUser did not pass in the expected id parameter"); Assert.AreEqual(ExpectedUserId, userId, "The XboxUser did not pass in the expected id parameter"); }; user.PairWithPhysicalController(ExpectedGamepadId); user.PairWithVirtualController(gamepad); }
public void TestPairWithMethodsCallAdapterPairGamepadToUser() { var gamepad = new XboxGamepad(this.xboxConsole); gamepad.Connect(); XboxUser user = this.CreateTestUser(); bool isCorrectMethodCalled = false; ShimXboxConsoleAdapterBase.AllInstances.PairGamepadToUserStringUInt64UInt32 = (adapter, systemIpAddress, gamepadId, userId) => { isCorrectMethodCalled = true; }; user.PairWithPhysicalController(0); Assert.IsTrue(isCorrectMethodCalled, "The PairWithPhysicalController method didn't call the adapter's PairGamepadToUser(systemIpAddress, gamepadId, userId)."); isCorrectMethodCalled = false; user.PairWithVirtualController(gamepad); Assert.IsTrue(isCorrectMethodCalled, "The PairWithVirtualController method didn't call the adapter's PairGamepadToUser(systemIpAddress, gamepadId, userId)."); }