The link in your post is the file that needs to be amended, not the patch itself. You can create a patch file using the diff command though it may be more straightforward to apply the patch manually using the RetroPie setup script.
Before you begin, please back up your image and then run the following commands:
sudo ./retropie_packages.sh pifba sources
sudo nano /home/pi/RetroPie-Setup/tmp/build/pifba/rpi/gp2xsdk.cpp
Please check the path of the file as I do not have my pi set up.
Edit line 286 as you outline in your post. Save your change.
Build and Install binary
sudo ./retropie_packages.sh pifba build install
You shouldn’t need to configure piFBA if you already have it installed but if you do, you can run the command:
sudo ./retropie_packages.sh pifba configure
And finally, to remove the source code folder: