settings: fix decoding; move C code from gen_settings_tmpl.cpp => SettingsSupport.cpp