So, I'll do my best to explain! MAME in retropie is a little interesting as far as controls. By default, it is set to use the classic keyboard inputs (such as CTRL, Alt, 1, 2) AND also use the Emulation Station gamepad configuration. The tricky part is, your keyboard CAN be configured as a controller in Emulation Station. And the MAME controls CAN be adjusted separately once MAME is launched.
So, first question: Does your control block send keyboard or gamepad presses? For example, I use the Arcade Bonnet from Adafruit which send keyboard inputs. But other people might use a Zero Delay Encoder which send gamepad presses. If it's sending keyboard presses, you might have conflicting controls in MAME itself vs the control block.
Either way, an easy way to get going again would be to remap your controls. Boot into Emulation Station, go into the menu, and choose the option to Configure Input. When it prompts, hold a button on whichever device you want to configure input for and then go button by button. If you've completely whacked out your controls and can't even open the menu, plug in a new gamepad temporarily. ES should detect it, ask if you want to configure input, and do it correctly for that gamepad. Then use that correctly configured device to open the menu, get to the input, and configure your control block.
Hope that helps