Make sure duplicated names have unique keys.

This also makes the sort stable.
Tweaks to archive functions

Allow entryIndex to start from arbitrary point, so as not to iterate
over all the entries every time.
Override of detectNamespace which works with index value instead of
entry pointer.
The generic detectNamespace functions is moved to Archive to remove code
duplication.
Added flat hack detection routine to WadArchive.
Implemented entry sorting, with a lot of hacks

This would have been a lot simpler if maps were self-contained single
lumps. Really, this single point forced to establish mechanisms to
enforce that certain assumptions could be relied upon.