Actually the details are quite simple really. All I did was add
a bit of code to the main input loop and the input related parts
of the 'common functions' for each of the emulators. The bit
of code just looks at the gamepad struct for active (plugged in)
controllers and uses the first one it finds as the primary input
for the rest of the loop/function. This means that if controllers
2 and 4 are plugged in then controller 2 is used as controller
1 and controller 4 is used as controller 2.
The controller 'mappings' are determined whenever such code
is called ie. once per loop iteration. The code is very simple
and does not cause any significant cpu load. I therefore see
no problem with this and prefer it to the other possible solution
of setting controller mappings once at runtime because it allows for
controllers to be unplugged/added for whatever reason without
restarting the program.
The dynamic controller mapping behavior is only a problem
during gameplay (imho), when things like that might cause
confusion or undesired results. I might be adding some kind
of something in there to keep controllers from being remapped
during gameplay tomorrow (if i have time) or this weekend
depending on input I receive and my thoughts on the issue.
It won't be difficult by any means to do this, I just have not
decided at the moment exactly what the desired behavior is
as I didn't consider this issue until earlier today.
Please do make comments that are thoughtful, insightful, and
constructive. Please refrain from cluttering up the board with
garbage that is irrelevant, pointless, or otherwise a waste of
your and the reader's time. I say this with the hope of preventing
such occurrences and not as a passive-aggressive jab at any
previous posts. I appreciate everyone's interest in this topic.

Alternatively I have considered just setting the primary controller
once at runtime and adding new options to the config menu
that would allow a user to set custom mappings to be used
durring gameplay, a mapping to be used if more than one
controller is found, and an option to turn off the remapping
altogether. This obviously would require a bit more code
and I was hoping to avoid whatever work I could. I will at
the very least be adding an option to turn off the remapping
behavior for those that have 4 working ports and don't want
to deal with the wierdness.
QUOTE(madmab @ Dec 22 2009, 06:14 PM)

Wow... I'm surprised he took the time to go thru all the code and create for loops to read all the ports.
I suppose the easiest thing to do would have been to create a macro and change everything to use that instead.
Actually I call a function that contains the loop and returns a value to be used as
the index for the gamepads array.
But yes, there is a lot of input code strewn about the project(s) in question and many changes
and checks are required to ensure correctness.