Cherry-picked from main (8c219be) with conflict resolution. Pre-G10 clients don't have the GR field in the applicant list, so only write it when RealClientMode >= G10. Also optimizes two consecutive uint16(0) writes to single uint32(0).
8c219be