Exemple #1
0
 public void Convert(IController source, LibGPGXDynamic.InputData target)
 {
     this.source = source;
     this.target = target;
     target.ClearAllBools();
     foreach (var f in Converts)
     {
         f();
     }
     this.source = null;
     this.target = null;
 }
Exemple #2
0
        public GPGXControlConverterDynamic(LibGPGXDynamic.InputData input)
        {
            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 ControllerDefinition();

            ControllerDef.BoolButtons.Add("Power");
            ControllerDef.BoolButtons.Add("Reset");

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

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

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

                case LibGPGXDynamic.INPUT_DEVICE.DEVICE_NONE:
                    break;

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

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

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

                case LibGPGXDynamic.INPUT_DEVICE.DEVICE_XE_A1P:
                    AddToController(i, player, XEA1P);
                    DoXEA1PAnalog(i, player);
                    player++;
                    break;

                case LibGPGXDynamic.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.Name = "GPGX Genesis Controller";
        }
		public void Convert(IController source, LibGPGXDynamic.InputData target)
		{
			this.source = source;
			this.target = target;
			target.ClearAllBools();
			foreach (var f in Converts)
				f();
			this.source = null;
			this.target = null;
		}