Mame4all disables usb gamepad interface if a mouse is plugged in or disables the mouse if a gamepad is plugged in (I don't remember which) so you need to use a keyboard encoder for buttons & controls.
I have one of those cheap glowing ps2 trackballs & using a ps2 to usb adaptor it works fine with mame4all if I use a keyboard encoder for fire buttons (millipede, ect.)