Пример #1
0
        private void btnSetup_Click(object sender, EventArgs e)
        {
            int            index        = 0;
            ControllerType type         = ControllerType.None;
            string         selectedText = "";

            if (sender == btnSetupP1)
            {
                type         = cboPlayer1.GetEnumValue <ControllerType>();
                selectedText = cboPlayer1.SelectedItem.ToString();
                index        = 0;
            }
            else if (sender == btnSetupP2)
            {
                type         = cboPlayer2.GetEnumValue <ControllerType>();
                selectedText = cboPlayer2.SelectedItem.ToString();
                index        = 1;
            }
            else if (sender == btnSetupP3)
            {
                type         = cboPlayer3.GetEnumValue <ControllerType>();
                selectedText = cboPlayer3.SelectedItem.ToString();
                index        = 2;
            }
            else if (sender == btnSetupP4)
            {
                type         = cboPlayer4.GetEnumValue <ControllerType>();
                selectedText = cboPlayer4.SelectedItem.ToString();
                index        = 3;
            }
            else if (sender == btnSetupP5)
            {
                type         = cboPlayer4.GetEnumValue <ControllerType>();
                selectedText = cboPlayer5.SelectedItem.ToString();
                index        = 4;
            }

            BaseInputConfigForm frm = null;
            InputConfig         cfg = (InputConfig)Entity;

            switch (type)
            {
            case ControllerType.SnesController:
                frm = new frmControllerConfig(cfg.Controllers[index], index);
                break;

            case ControllerType.SuperScope:
                //frm = new frmSuperScopeConfig();
                break;

            case ControllerType.SnesMouse:
                //frm = new frmMouseConfig();
                break;
            }

            if (frm != null)
            {
                OpenSetupWindow(frm, (Button)sender, selectedText, index);
            }
        }
Пример #2
0
        private void btnSetup_Click(object sender, EventArgs e)
        {
            int index = 0;

            if (sender == btnSetupP1)
            {
                index = 0;
            }
            else if (sender == btnSetupP2)
            {
                index = 1;
            }
            else if (sender == btnSetupP3)
            {
                index = 2;
            }
            else if (sender == btnSetupP4)
            {
                index = 3;
            }
            var frm = new frmControllerConfig(ConfigManager.Config.InputInfo.Controllers[index]);

            Button    btn    = (Button)sender;
            Point     point  = btn.PointToScreen(new Point(0, btn.Height));
            Rectangle screen = Screen.FromControl(btn).Bounds;

            if (frm.Height + point.Y > screen.Bottom)
            {
                //Show on top instead
                point.Y -= btn.Height + frm.Height;
            }

            if (frm.Width + point.X > screen.Right)
            {
                //Show on left instead
                point.X -= frm.Width - btn.Width;
            }

            frm.StartPosition = FormStartPosition.Manual;
            frm.Top           = point.Y;
            frm.Left          = point.X;
            frm.ShowDialog(this);
        }
Пример #3
0
        private void btnSetup_Click(object sender, EventArgs e)
        {
            int    index        = 0;
            object selectedItem = null;
            string selectedText = "";

            if (sender == btnSetupP1)
            {
                selectedItem = cboPlayer1.GetEnumValue <InteropEmu.ControllerType>();
                selectedText = cboPlayer1.SelectedItem.ToString();
                index        = 0;
            }
            else if (sender == btnSetupP2)
            {
                selectedItem = cboPlayer2.GetEnumValue <InteropEmu.ControllerType>();
                selectedText = cboPlayer2.SelectedItem.ToString();
                index        = 1;
            }
            else if (sender == btnSetupP3)
            {
                selectedItem = cboPlayer3.GetEnumValue <InteropEmu.ControllerType>();
                selectedText = cboPlayer3.SelectedItem.ToString();
                index        = 2;
            }
            else if (sender == btnSetupP4)
            {
                selectedItem = cboPlayer4.GetEnumValue <InteropEmu.ControllerType>();
                selectedText = cboPlayer4.SelectedItem.ToString();
                index        = 3;
            }
            else if (sender == btnSetupExp)
            {
                selectedItem = cboExpansionPort.GetEnumValue <InteropEmu.ExpansionPortDevice>();
                selectedText = cboExpansionPort.SelectedItem.ToString();
                index        = 0;
            }

            Form      frm       = null;
            InputInfo inputInfo = (InputInfo)Entity;

            if (selectedItem is InteropEmu.ControllerType)
            {
                InteropEmu.ControllerType type = (InteropEmu.ControllerType)selectedItem;
                switch (type)
                {
                case InteropEmu.ControllerType.StandardController:
                case InteropEmu.ControllerType.SnesController:
                    frm = new frmControllerConfig(inputInfo.Controllers[index], index, cboConsoleType.GetEnumValue <ConsoleType>(), type);
                    break;

                case InteropEmu.ControllerType.PowerPad:
                    frm = new frmPowerPadConfig(inputInfo.Controllers[index], index);
                    break;

                case InteropEmu.ControllerType.Zapper:
                    frm = new frmZapperConfig(inputInfo.Zapper);
                    break;

                case InteropEmu.ControllerType.SnesMouse:
                    frm = new frmMouseConfig(inputInfo.SnesMouse);
                    break;

                case InteropEmu.ControllerType.SuborMouse:
                    frm = new frmMouseConfig(inputInfo.SuborMouse);
                    break;

                case InteropEmu.ControllerType.ArkanoidController:
                    frm = new frmMouseConfig(inputInfo.ArkanoidController);
                    break;

                case InteropEmu.ControllerType.VbController:
                    frm = new frmVirtualBoyConfig(inputInfo.Controllers[index], index);
                    break;
                }
            }
            else if (selectedItem is InteropEmu.ExpansionPortDevice)
            {
                InteropEmu.ExpansionPortDevice device = (InteropEmu.ExpansionPortDevice)selectedItem;
                switch (device)
                {
                case InteropEmu.ExpansionPortDevice.FamilyTrainerMat:
                    frm = new frmPowerPadConfig(inputInfo.Controllers[index], index);
                    break;

                case InteropEmu.ExpansionPortDevice.PartyTap:
                    frm = new frmPartytapConfig(inputInfo.Controllers[index]);
                    break;

                case InteropEmu.ExpansionPortDevice.Pachinko:
                    frm = new frmPachinkoConfig(inputInfo.Controllers[index]);
                    break;

                case InteropEmu.ExpansionPortDevice.ExcitingBoxing:
                    frm = new frmExcitingBoxingConfig(inputInfo.Controllers[index]);
                    break;

                case InteropEmu.ExpansionPortDevice.JissenMahjong:
                    frm = new frmJissenMahjongConfig(inputInfo.Controllers[index]);
                    break;

                case InteropEmu.ExpansionPortDevice.FamilyBasicKeyboard:
                    frm = new frmFamilyBasicKeyboardConfig(inputInfo.Controllers[index]);
                    break;

                case InteropEmu.ExpansionPortDevice.SuborKeyboard:
                    frm = new frmSuborKeyboardConfig(inputInfo.Controllers[index]);
                    break;

                case InteropEmu.ExpansionPortDevice.Zapper:
                case InteropEmu.ExpansionPortDevice.BandaiHyperShot:
                    frm = new frmZapperConfig(inputInfo.Zapper);
                    break;

                case InteropEmu.ExpansionPortDevice.HoriTrack:
                    frm = new frmMouseConfig(inputInfo.HoriTrack);
                    break;

                case InteropEmu.ExpansionPortDevice.ArkanoidController:
                    frm = new frmMouseConfig(inputInfo.ArkanoidController);
                    break;
                }
            }

            if (frm != null)
            {
                OpenSetupWindow(frm, (Button)sender, selectedText);
            }
        }
Пример #4
0
        private void btnSetup_Click(object sender, EventArgs e)
        {
            int    index        = 0;
            object selectedItem = null;

            if (sender == btnSetupP1)
            {
                selectedItem = cboPlayer1.SelectedItem;
                index        = 0;
            }
            else if (sender == btnSetupP2)
            {
                selectedItem = cboPlayer2.SelectedItem;
                index        = 1;
            }
            else if (sender == btnSetupP3)
            {
                selectedItem = cboPlayer3.SelectedItem;
                index        = 2;
            }
            else if (sender == btnSetupP4)
            {
                selectedItem = cboPlayer4.SelectedItem;
                index        = 3;
            }
            else if (sender == btnSetupExp)
            {
                selectedItem = cboExpansionPort.SelectedItem;
                index        = 0;
            }

            Form      frm       = null;
            InputInfo inputInfo = (InputInfo)Entity;

            if (selectedItem.Equals(ResourceHelper.GetEnumText(InteropEmu.ControllerType.StandardController)))
            {
                frm = new frmControllerConfig(inputInfo.Controllers[index], index, cboConsoleType.GetEnumValue <ConsoleType>());
            }
            else if (selectedItem.Equals(ResourceHelper.GetEnumText(InteropEmu.ControllerType.Zapper)))
            {
                frm = new frmZapperConfig(inputInfo.Zapper);
            }
            else if (selectedItem.Equals(ResourceHelper.GetEnumText(InteropEmu.ExpansionPortDevice.Zapper)))
            {
                frm = new frmZapperConfig(inputInfo.Zapper);
            }

            if (frm != null)
            {
                Button    btn    = (Button)sender;
                Point     point  = btn.PointToScreen(new Point(0, btn.Height));
                Rectangle screen = Screen.FromControl(btn).Bounds;

                if (frm.Height + point.Y > screen.Bottom)
                {
                    //Show on top instead
                    point.Y -= btn.Height + frm.Height;
                }

                if (frm.Width + point.X > screen.Right)
                {
                    //Show on left instead
                    point.X -= frm.Width - btn.Width;
                }

                frm.StartPosition = FormStartPosition.Manual;
                frm.Top           = point.Y;
                frm.Left          = point.X;
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    UpdateConflictWarning();
                }
                frm.Dispose();
            }
        }