Be more space-efficient when adding/updating files (--cat only)

When adding/updating a mod with --cat it now tries to find sufficient
room within the archive (but not before the undo data!) to fit the new
files, rather than always appending them to the end. It also truncates
any wasted space off the end of the archive in case the archive has
shrunk (which will be more useful when removing a mod).

This has the potential to be dangerous if I've missed anything and will
need plenty of testing before release.