internal void PopulateFrom(OctoshockFIOConfigUser userConfig)
		{
			Multitaps = (bool[])userConfig.Multitaps.Clone();
			Memcards = (bool[])userConfig.Memcards.Clone();
			Devices8 = (OctoshockDll.ePeripheralType[])userConfig.Devices8.Clone();

			int id = 1;

			if (userConfig.Devices8[0] == OctoshockDll.ePeripheralType.None) PlayerAssignments[0] = -1; else PlayerAssignments[0] = id++;
			if (userConfig.Devices8[1] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0]) PlayerAssignments[1] = -1; else PlayerAssignments[1] = id++;
			if (userConfig.Devices8[2] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0]) PlayerAssignments[2] = -1; else PlayerAssignments[2] = id++;
			if (userConfig.Devices8[3] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0]) PlayerAssignments[3] = -1; else PlayerAssignments[3] = id++;

			if (userConfig.Devices8[4] == OctoshockDll.ePeripheralType.None) PlayerAssignments[4] = -1; else PlayerAssignments[4] = id++;
			if (userConfig.Devices8[5] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1]) PlayerAssignments[5] = -1; else PlayerAssignments[5] = id++;
			if (userConfig.Devices8[6] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1]) PlayerAssignments[6] = -1; else PlayerAssignments[6] = id++;
			if (userConfig.Devices8[7] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1]) PlayerAssignments[7] = -1; else PlayerAssignments[7] = id++;

			NumPlayers = id - 1;

			for (int i = 0; i < 8; i++)
			{
				int pnum = i+1;
				for (int j = 0; j < 8; j++)
				{
					if(PlayerAssignments[j] == pnum)
						DevicesPlayer[i] = userConfig.Devices8[j];
				}
			}
		}
		void GuiFromUserConfig(OctoshockFIOConfigUser user)
		{
			cbMemcard_1.Checked = user.Memcards[0];
			cbMemcard_2.Checked = user.Memcards[1];
			cbMultitap_1.Checked = user.Multitaps[0];
			cbMultitap_2.Checked = user.Multitaps[1];

			var combos = new[] { combo_1_1, combo_1_2, combo_1_3, combo_1_4, combo_2_1, combo_2_2, combo_2_3, combo_2_4 };
			for (int i = 0; i < 8; i++)
			{
				var combo = combos[i];
				if (user.Devices8[i] == OctoshockDll.ePeripheralType.None) combo.SelectedIndex = 0;
				if (user.Devices8[i] == OctoshockDll.ePeripheralType.Pad) combo.SelectedIndex = 1;
				if (user.Devices8[i] == OctoshockDll.ePeripheralType.DualShock) combo.SelectedIndex = 2;
				if (user.Devices8[i] == OctoshockDll.ePeripheralType.DualAnalog) combo.SelectedIndex = 3;
			}
		}
		OctoshockFIOConfigUser UserConfigFromGui()
		{
			OctoshockFIOConfigUser uc = new OctoshockFIOConfigUser();

			uc.Memcards[0] = cbMemcard_1.Checked;
			uc.Memcards[1] = cbMemcard_2.Checked;

			uc.Multitaps[0] = cbMultitap_1.Checked;
			uc.Multitaps[1] = cbMultitap_2.Checked;

			var combos = new[] { combo_1_1, combo_1_2, combo_1_3, combo_1_4, combo_2_1, combo_2_2, combo_2_3, combo_2_4 };
			for (int i = 0; i < 8; i++)
			{
				var combo = combos[i];
				if (combo.SelectedIndex == 0) uc.Devices8[i] = OctoshockDll.ePeripheralType.None;
				if (combo.SelectedIndex == 1) uc.Devices8[i] = OctoshockDll.ePeripheralType.Pad;
				if (combo.SelectedIndex == 2) uc.Devices8[i] = OctoshockDll.ePeripheralType.DualShock;
				if (combo.SelectedIndex == 3) uc.Devices8[i] = OctoshockDll.ePeripheralType.DualAnalog;
			}

			return uc;
		}
        internal void PopulateFrom(OctoshockFIOConfigUser userConfig)
        {
            Multitaps = (bool[])userConfig.Multitaps.Clone();
            Memcards  = (bool[])userConfig.Memcards.Clone();
            Devices8  = (OctoshockDll.ePeripheralType[])userConfig.Devices8.Clone();

            int id = 1;

            //TODO: separate sense of connect/disconnect. If we do that, then we need to make the assignments stable, here
            //and put logic in the core's SetInput instead
            if (!userConfig.Multitaps[0])
            {
                Devices8[1] = Devices8[2] = Devices8[3] = OctoshockDll.ePeripheralType.None;
            }
            if (!userConfig.Multitaps[1])
            {
                Devices8[5] = Devices8[6] = Devices8[7] = OctoshockDll.ePeripheralType.None;
            }

            //OLD LOGIC
            //if (userConfig.Devices8[0] == OctoshockDll.ePeripheralType.None) PlayerAssignments[0] = -1; else PlayerAssignments[0] = id++;
            //if (userConfig.Devices8[1] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0]) PlayerAssignments[1] = -1; else PlayerAssignments[1] = id++;
            //if (userConfig.Devices8[2] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0]) PlayerAssignments[2] = -1; else PlayerAssignments[2] = id++;
            //if (userConfig.Devices8[3] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0]) PlayerAssignments[3] = -1; else PlayerAssignments[3] = id++;
            //if (userConfig.Devices8[4] == OctoshockDll.ePeripheralType.None) PlayerAssignments[4] = -1; else PlayerAssignments[4] = id++;
            //if (userConfig.Devices8[5] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1]) PlayerAssignments[5] = -1; else PlayerAssignments[5] = id++;
            //if (userConfig.Devices8[6] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1]) PlayerAssignments[6] = -1; else PlayerAssignments[6] = id++;
            //if (userConfig.Devices8[7] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1]) PlayerAssignments[7] = -1; else PlayerAssignments[7] = id++;

            if (Devices8[0] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[0] = -1;
            }
            else
            {
                PlayerAssignments[0] = id++;
            }
            if (Devices8[1] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[1] = -1;
            }
            else
            {
                PlayerAssignments[1] = id++;
            }
            if (Devices8[2] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[2] = -1;
            }
            else
            {
                PlayerAssignments[2] = id++;
            }
            if (Devices8[3] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[3] = -1;
            }
            else
            {
                PlayerAssignments[3] = id++;
            }
            if (Devices8[4] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[4] = -1;
            }
            else
            {
                PlayerAssignments[4] = id++;
            }
            if (Devices8[5] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[5] = -1;
            }
            else
            {
                PlayerAssignments[5] = id++;
            }
            if (Devices8[6] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[6] = -1;
            }
            else
            {
                PlayerAssignments[6] = id++;
            }
            if (Devices8[7] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[7] = -1;
            }
            else
            {
                PlayerAssignments[7] = id++;
            }

            NumPlayers = id - 1;

            for (int i = 0; i < 8; i++)
            {
                int pnum = i + 1;
                for (int j = 0; j < 8; j++)
                {
                    if (PlayerAssignments[j] == pnum)
                    {
                        DevicesPlayer[i] = userConfig.Devices8[j];
                    }
                }
            }
        }
        internal void PopulateFrom(OctoshockFIOConfigUser userConfig)
        {
            Multitaps = (bool[])userConfig.Multitaps.Clone();
            Memcards  = (bool[])userConfig.Memcards.Clone();
            Devices8  = (OctoshockDll.ePeripheralType[])userConfig.Devices8.Clone();

            int id = 1;

            if (userConfig.Devices8[0] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[0] = -1;
            }
            else
            {
                PlayerAssignments[0] = id++;
            }
            if (userConfig.Devices8[1] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0])
            {
                PlayerAssignments[1] = -1;
            }
            else
            {
                PlayerAssignments[1] = id++;
            }
            if (userConfig.Devices8[2] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0])
            {
                PlayerAssignments[2] = -1;
            }
            else
            {
                PlayerAssignments[2] = id++;
            }
            if (userConfig.Devices8[3] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[0])
            {
                PlayerAssignments[3] = -1;
            }
            else
            {
                PlayerAssignments[3] = id++;
            }

            if (userConfig.Devices8[4] == OctoshockDll.ePeripheralType.None)
            {
                PlayerAssignments[4] = -1;
            }
            else
            {
                PlayerAssignments[4] = id++;
            }
            if (userConfig.Devices8[5] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1])
            {
                PlayerAssignments[5] = -1;
            }
            else
            {
                PlayerAssignments[5] = id++;
            }
            if (userConfig.Devices8[6] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1])
            {
                PlayerAssignments[6] = -1;
            }
            else
            {
                PlayerAssignments[6] = id++;
            }
            if (userConfig.Devices8[7] == OctoshockDll.ePeripheralType.None || !userConfig.Multitaps[1])
            {
                PlayerAssignments[7] = -1;
            }
            else
            {
                PlayerAssignments[7] = id++;
            }

            NumPlayers = id - 1;

            for (int i = 0; i < 8; i++)
            {
                int pnum = i + 1;
                for (int j = 0; j < 8; j++)
                {
                    if (PlayerAssignments[j] == pnum)
                    {
                        DevicesPlayer[i] = userConfig.Devices8[j];
                    }
                }
            }
        }