-Here's the rules: If preferred Jaguar controller is not checked, the profile is
-skipped. If one or the other is checked, it's put into that slot. If *both* are
-checked, it will take over any slot that isn't claimed by another gamepad. If
-there are ties, present it to the user *once* and ask them which gamepad should
-be #1; don't ask again unless a), they change the profiles and b), the
-situation warrants it.
-
-Also, there is a problem with this approach and having multiple devices
-that are the same. Currently, if two of the same device are plugged in
-and the profile is set to both controllers, it will broadcast buttons
-pressed from either gamepad, no matter who is pressing them. This is
-BAD(tm). [Not true, but there's a different problem described under 'How to
-solve?', so GOOD(tm).]
-
-Also, the gamepad logic doesn't distinguish inputs by controller, it just
-grabs them all regardless. This is also BAD(tm). [Actually, it doesn't. It
-properly segregates the inputs. So this is GOOD(tm).]
-
-How to solve?
-
-Seems there's yet ANOTHER dimension to all this: The physical gamepads
-plugged into their ports. Now the device # can map these fine if they're
-different, but we still run into problems with the handling in the MainWin
-because it's hardwired to take pad 0 in slot 0 and pad 1 in slot 1. If you have
-them configured other than this, you won't get anything. So we need to also
-map the physical devices to their respective slots.
-
-
-Steps:
-
-1) Make a list of all devices attached to the system.
-
-2) Make a list of all profiles belonging to those devices, as long as they have
- one or more Jaguar controllers that are "mapped to".
-
-3) See if there are any conflicts. If there are, see if the user has already
- been asked to resolve and chosen a resolution; otherwise, ask the user to
- resolve.
-
- a) Loop through all found profiles. If they are set to a single controller,
- set it in the appropriate list (one list for controller 1, another for
- controller 2).
-
- b) Loop through all found profiles. If they are set to both controllers,
- ... (first stab at it:)
- Check for list #1. If nothing there, assign it to list #1.
- Else, check for List #2. If nothing there, assign to list #2.
- [But the wording of it implies that it will assign it to both.
- Does that mean we should make another combobox will all the possible
- combinations laid out? Probably. Not many people will understand that
- checking both means "assign to either one that's free".]
-
-4) Connect profiles to controllers, and set gamepad slots (for the MainWin
- handler).
-
+One more stab at this...
+
+ - Connect keyboard to slot #0.
+ - Loop thru all connected devices. For each device:
+ - Grab all profiles for the device. For each profile:
+ - Check to see what its preferred device is.
+ - If PD is slot #0, see if slot is already taken (gamepadIDSlot1 != -1).
+ If not taken, take it; otherwise put in list to tell user to solve the
+ conflict for us.
+ - If the slot is already taken and *it's the same device* as the one
+ we're looking at, set it in slot #1.
+ - If PD is slot #1, see if slot is already taken. If not, take it;
+ otherwise, put in list to tell user to solve conflict for us.
+ - If PD is slot #0 & #1, see if either is already taken. Try #0 first,
+ then try #1. If both are already taken, skip it. Do this *after* we've
+ connected devices with preferred slots.