Before I redesigned my website, I posted the retroarch.cfg file for the PlayStation 2 controller. The file allows you to use a PlayStation 2 controller to play retro games using the RetroPie image on the raspberry pi. I am not sure if some people still want the file so I am reposting the link here. You can download the retroarch.cfg file by clicking here.
To use the retroarch.cfg file:
1. Navigate to /home/pi/RetroPie/configs/all/
2. Replace the retroarch.cfg file with the one you have downloaded.
3. Enjoy playing your retro games using the PS2 controller.