Restructure mod mounting code a bit to make it reusable, and use it for replays. Fixes #2703. This was SVN commit r15676.