I think it is the ROM that you are using.
I found that the controller doesn’t work at all in “Super Mario All-Stars”.
It seems to work fine in “Super Mario All-Stars + Super Mario World”.
Those are the only 2 ROMs so far that I’ve had any trouble with.