I don't know what your experience level is, so please don't be offended at me suggesting something that you may feel is obvious...
Start a game, then hit 'tab'. This will bring up a menu, where you can edit the inputs either for that specific game, or (more importantly in your case) globally.
Then you just go through and 'teach' Mame what you want it to use for up, down, left, right, button 1, button 2 etc etc.
This is also useful if you want to play a game that has an unusual control setup (eg Robotron). In that case, select 'this game', and teach Mame the controls that you want to use for that specific game. Mame will then generate a config file just for that game with your customized control setup.
I have attempted to do that via the Tab key. I can see why this needs to be configured from inside MAME4ALL, the cfg files in /home/pi/pimame/emulators/mame4all-pi/cfg/ are all binary.
When I am in the Tab menu, clicking the 'Input (general)' setup does nothing but close the menu, so instead I click the 'Input (this game)'... even though I'd like to setup default controls for all games.
When I'm in the 'Input (this game)' I try to change the 'P1 Up' and I use 'up' on my joystick which gives me ^[[B in the terminal. Nothing happens. It doesn't register :(
Something I have noticed. Raspbian - apparently by default - is configured for en-GB locale - and that includes keyboard layout.
PiPlay also appears to be setup that way. However, when I use raspi-config to change the default locale to en-US.UTF-8, the timezone, and the keyboard layout all the default key layouts work perfectly.