Hi, any particular reason your are using DGEN? Picodrive is the default Megadrive emulator in the latest RetroPie 1.9.1 image, it runs much better than DGEN and can be configured through Retroarch (/home/pi/RetroPie/configs/all/retroarch.cfg) You can also install it via the setup script but you will also need to update Emulation Station too or edit es_systems.cfg manually to point to Picodrive.

Regarding Gngeo I don’t use it myself but here is the gngeorc sample config:

It is located at /home/pi/.gngeo/

The section you need to look at is at the bottom:

# some sample joystick configuration
# Xbox360
# p1control A=J0B0,B=J0B1,C=J0B2,D=J0B3,START=J0B6,COIN=J0B10,UP=J0a1,DOWN=J0a1,LEFT=J0A0,RIGHT=J0A0,MENU=J0B7
# Dualshock2
# p1control A=J0B2,B=J0B1,C=J0B3,D=J0B0,START=J0B9,COIN=J0B8,UP=J0a1,DOWN=J0a1,LEFT=J0A0,RIGHT=J0A0

# Meaning of the code:
# Kxxx : keyboad key number xxx
# JxByy : Joystick number x Button
# JxAyy : Joystick number x Axe yy (use a lowercase 'a' if you need to invert the axis)
# JxHyy : Joystick number x Hat yy
# by the way, you can define a button multiple time, for example A=J0B0,A=K123,etc..

Any lines with # before it are commented out, you need to remove the # to enable the option.

Use jtest to determine the buttons on your pad:

sudo apt-get install joystick

then run:

jstest /dev/input/js0

Hope this helps