Call SDL_OpenJoystick() and then poll it... push the buttons and you will get the mapping. It is a very simple sample app to throw together and you could even find one easily on the net.
Left stick left/right = axis0
Left stick up/down = axis1
Right stick left/right = axis2
Right stick up/down = axis3
D-Pad = Hat0 (It has 8 possible positions but it is one device)
The rest including the triggers and pushing down on the analog stick are buttons. I could fire up Odamex and easily give you the mapping but not tonight. The sdl_joystick code for Xbox is on my repository here: http://svn.huntsvegas.org/wsvn/SDLx/trunk/...L_sysjoystick.c
I don't know about the GC button mapping but the Wii mapping is right here: http://www.wiibrew.org/wiki/Sdl#SDL_joystick_mapping