MAME & RA DS4 button issues

I’m trying to use MAME via RetroArch and there’s some weirdness regarding the button commands overlapping with the basic UI functions in MAME. I’ve got a DualShock 4 (connected via DS4Windows) and am trying to play A.B. Cop, an analog bike game. I’m trying to set L2 for jump and R2 for acceleration, and use the left analog stick for movement, but the DualShock buttons seem to function as keyboard key inputs. Hitting L2 makes some FPS display at the top right corner (functions as F11) and L2 acts as the Tab key. When I try to reconfigure the buttons in MAME UI, my DS4 button inputs function as keyboard inputs, and when I try to revert it back to it’s default keys by hitting esc, it just closes out RA. What should I do?

Bump, I really need help with this

Try remapping the ‘exit retroarch’ key to something other than esc in your retroarch.cfg. That should keep it from exiting when you try to null out the MAME mappings.