MAME simply sees each button used by the game as PL1 Button A, PL1 Button B, etc. It doesn't make a distinction between which button does what; the game does that. That aside, you configure your buttons and every other key/button you use by press TAB when a game has loaded and choosing Configure Buttons (This game). The simply scroll to button/whatever you would like to change, press Enter and then press a button you want to assign on your gamepad.