[UGLY] Fix for a memory leak.
Miscelaneous cppcheck fixes, some cosmetic fixes, more dead code removal and code deduplication.
More sharing between the game and mkres.
Remove workaround for duplicated header.
Set PREFIX for main.cpp in a cleaner way.