Well, I got the controller to work in Mame.
Had to change Joystick setting in mame.ini from 0 to 1.
I tried this earlier but it didnt work, but I found out why.
My controller has a button on it to switch from analog to digital mode.
When I switched it to digital, the left analog stick works in mame, and the number 1 button is the fire (L CTRL) button in Mame. I havent tried the other buttons yet.
But I do not have ESC to quit the game, or number 5 or number 1 to insert credit and start game. Still have to do these functions on the keyboard.
Is there anyway to map the controller buttons in mame?