New settings menu.

This overhauls and merges the settings menu for all mods.
This pr includes patches from the unmerged prerequisite prs (#3983, #3989, #3990) so that this can be tested and reviewed without waiting for them to be merged.

293e3e5 onward are the real contents of this pr, and will be rebased once the prerequisites have been merged.