Example #1
0
        internal void ResetControllerDefinition(bool subframe)
        {
            ControllerDefinition = null;

            ControllerDeck       = ControllerSettings.Instantiate(ppu.LightGunCallback);
            ControllerDefinition = ControllerDeck.ControllerDef;

            // controls other than the deck
            ControllerDefinition.BoolButtons.Add("Power");
            ControllerDefinition.BoolButtons.Add("Reset");
            if (Board is FDS b)
            {
                ControllerDefinition.BoolButtons.Add("FDS Eject");
                for (int i = 0; i < b.NumSides; i++)
                {
                    ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
                }
            }

            if (_isVS)
            {
                ControllerDefinition.BoolButtons.Add("Insert Coin P1");
                ControllerDefinition.BoolButtons.Add("Insert Coin P2");
                ControllerDefinition.BoolButtons.Add("Service Switch");
            }

            // Add in the reset timing axis for subneshawk
            if (subframe)
            {
                ControllerDefinition.AddAxis("Reset Cycle", 0.RangeTo(500000), 0);
            }

            ControllerDefinition.MakeImmutable();
        }
Example #2
0
        public LibsnesControllerDeck(LibsnesCore.SnesSyncSettings ss)
        {
            _ports = new[]
            {
                Factory(ss.LeftPort, ss),
                Factory(ss.RightPort, ss)
            };

            Definition = ControllerDefinitionMerger.GetMerged(
                "SNES Controller",
                _ports.Select(p => p.Definition),
                out var tmp);
            _mergers = tmp.ToArray();

            // add buttons that the core itself will handle
            Definition.BoolButtons.Add("Reset");
            Definition.BoolButtons.Add("Power");

            Definition.MakeImmutable();
        }
Example #3
0
        private static ControllerDefinition CreateControllerDefinition(LibAres64.ControllerType[] controllerSettings)
        {
            var ret = new ControllerDefinition("Nintendo 64 Controller");

            for (int i = 0; i < 4; i++)
            {
                if (controllerSettings[i] == LibAres64.ControllerType.Mouse)
                {
                    ret.BoolButtons.Add($"P{i + 1} Mouse Right");
                    ret.BoolButtons.Add($"P{i + 1} Mouse Left");
                    ret.AddXYPair($"P{i + 1} {{0}} Axis", AxisPairOrientation.RightAndUp, (-128).RangeTo(127), 0);
                }
                else if (controllerSettings[i] != LibAres64.ControllerType.Unplugged)
                {
                    ret.BoolButtons.Add($"P{i + 1} DPad U");
                    ret.BoolButtons.Add($"P{i + 1} DPad D");
                    ret.BoolButtons.Add($"P{i + 1} DPad L");
                    ret.BoolButtons.Add($"P{i + 1} DPad R");
                    ret.BoolButtons.Add($"P{i + 1} Start");
                    ret.BoolButtons.Add($"P{i + 1} Z");
                    ret.BoolButtons.Add($"P{i + 1} B");
                    ret.BoolButtons.Add($"P{i + 1} A");
                    ret.BoolButtons.Add($"P{i + 1} C Up");
                    ret.BoolButtons.Add($"P{i + 1} C Down");
                    ret.BoolButtons.Add($"P{i + 1} C Left");
                    ret.BoolButtons.Add($"P{i + 1} C Right");
                    ret.BoolButtons.Add($"P{i + 1} L");
                    ret.BoolButtons.Add($"P{i + 1} R");
                    ret.AddXYPair($"P{i + 1} {{0}} Axis", AxisPairOrientation.RightAndUp, (-128).RangeTo(127), 0);
                    if (controllerSettings[i] == LibAres64.ControllerType.Rumblepak)
                    {
                        ret.HapticsChannels.Add($"P{i + 1} Rumble Pak");
                    }
                }
            }
            ret.BoolButtons.Add("Reset");
            ret.BoolButtons.Add("Power");
            return(ret.MakeImmutable());
        }
Example #4
0
        public GPGXControlConverter(LibGPGX.InputData input, bool cdButtons)
        {
            Console.WriteLine("Genesis Controller report:");
            foreach (var e in input.system)
            {
                Console.WriteLine("  S:{0}", e);
            }
            foreach (var e in input.dev)
            {
                Console.WriteLine("  D:{0}", e);
            }

            int player = 1;

            ControllerDef = new("GPGX Genesis Controller");

            ControllerDef.BoolButtons.Add("Power");
            ControllerDef.BoolButtons.Add("Reset");
            if (cdButtons)
            {
                ControllerDef.BoolButtons.Add("Previous Disk");
                ControllerDef.BoolButtons.Add("Next Disk");
            }

            for (int i = 0; i < LibGPGX.MAX_DEVICES; i++)
            {
                switch (input.dev[i])
                {
                case LibGPGX.INPUT_DEVICE.DEVICE_PAD3B:
                    AddToController(i, player, Genesis3);
                    player++;
                    break;

                case LibGPGX.INPUT_DEVICE.DEVICE_PAD6B:
                    AddToController(i, player, Genesis6);
                    player++;
                    break;

                case LibGPGX.INPUT_DEVICE.DEVICE_MOUSE:
                    AddToController(i, player, Mouse);
                    DoMouseAnalog(i, player);
                    player++;
                    break;

                case LibGPGX.INPUT_DEVICE.DEVICE_NONE:
                    break;

                case LibGPGX.INPUT_DEVICE.DEVICE_LIGHTGUN:
                    // supports menacers and justifiers
                    AddToController(i, player, Lightgun);
                    DoLightgunAnalog(i, player);
                    player++;
                    break;

                case LibGPGX.INPUT_DEVICE.DEVICE_PAD2B:
                case LibGPGX.INPUT_DEVICE.DEVICE_PADDLE:
                case LibGPGX.INPUT_DEVICE.DEVICE_SPORTSPAD:
                case LibGPGX.INPUT_DEVICE.DEVICE_TEREBI:
                    throw new Exception("Master System only device?  Something went wrong.");

                case LibGPGX.INPUT_DEVICE.DEVICE_ACTIVATOR:
                    AddToController(i, player, Activator);
                    player++;
                    break;

                case LibGPGX.INPUT_DEVICE.DEVICE_XE_A1P:
                    AddToController(i, player, Xea1P);
                    DoXea1PAnalog(i, player);
                    player++;
                    break;

                case LibGPGX.INPUT_DEVICE.DEVICE_PICO:
                    // PICO isn't finished on the unmanaged side either
                    throw new Exception("Sega PICO not implemented yet!");

                default:
                    throw new Exception("Unknown Genesis control device!  Something went wrong.");
                }
            }

            ControllerDef.MakeImmutable();
        }