public SMSControllerDeck(SMSControllerTypes controller1, SMSControllerTypes controller2, bool is_GG, bool use_keyboard) { if (is_GG) { Port1 = new GGController(1); // Port 2 is defined, but not used for Game Gear Port2 = new GGController(2); Definition = new ControllerDefinition { Name = Port1.Definition.Name, BoolButtons = new[] { "Reset" } .Concat(Port1.Definition.BoolButtons) .ToList() }; } else { Port1 = ControllerCtors[controller1](1); Port2 = ControllerCtors[controller2](2); if (!use_keyboard) { Definition = new ControllerDefinition { Name = Port1.Definition.Name, BoolButtons = new[] { "Reset", "Pause" } .Concat(Port1.Definition.BoolButtons) .Concat(Port2.Definition.BoolButtons) .ToList() }; } else { Definition = new ControllerDefinition { Name = Port1.Definition.Name, BoolButtons = new[] { "Reset", "Pause" } .Concat(Port1.Definition.BoolButtons) .Concat(Port2.Definition.BoolButtons) .Concat(KeyboardMap) .ToList() }; } foreach (var kvp in Port1.Definition.Axes) { Definition.Axes.Add(kvp); } foreach (var kvp in Port2.Definition.Axes) { Definition.Axes.Add(kvp); } } }
private static PadSchema SchemaFor(SMSControllerTypes controllerName, int portNum) { if (controllerName == SMSControllerTypes.Standard) { return(JoystickController(portNum)); } if (controllerName == SMSControllerTypes.Paddle) { return(PaddleController(portNum)); } if (controllerName == SMSControllerTypes.SportsPad) { return(SportController(portNum)); } if (controllerName == SMSControllerTypes.Phaser) { return(LightGunController(portNum)); } return(null); }