fs: recognise mods by -game cmdline args, deduplicate gamedirs, refactoring
Players often start mods using -game even when they have their own
cmdline option, and modders often provide scripts which use -game.
This was already implemented but only for the `gamedir` command.
Refactoring was required to avoid chicken vs egg problems when doing it
with cmdline gamedirs too.
Fixes a bug: the first gamedir (in the cmdline or `gamedir` args) was
used to identify the mod but it needs to be the last one that matches
because the last gamedir is the primary (first in the search path, and
where files are saved).
Includes supported game and mod directories in the main gamedir list for
interface consistency, less special cases, and to support deduplication.
Refactoring was required in the menu modlist where there was also an
opportunity to simplify.
Fixes inability to change from a supported mod (eg rogue) back to id1.