The RetroPie PI image uses the Raspbian Lite distribution as its base, so if your code can run on Raspbian, then it's highly possible it will also run on a RetroPie image.