Beispiel #1
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);
            }
        }
Beispiel #2
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();
            }
        }