Or, use a file compare program such as Beyond Compare, to compare the upgrade version's files to the previous version running on your server, and modify the necessary sections, preserving the hacks.

You must compare the originals for both, and then apply the newer code modifications from the newest version to your hacked, older version.