umm, have you tried deleting mame.ini? Then you run mame from commandline with the -cc option to create a default config, then you follow the GM setup guide again.
Save your current mame.ini first, just in case.
And you can always delete default.cfg from the cfgs folder if your buttons are screwed up as well.