| 170 | } |
| 171 | |
| 172 | bool BootConfig::parse(const char *json) |
| 173 | { |
| 174 | TempAllocator4096 ta; |
| 175 | JsonObject cfg(ta); |
| 176 | sjson::parse(cfg, json); |
| 177 | |
| 178 | auto cur = json_object::begin(cfg); |
| 179 | auto end = json_object::end(cfg); |
| 180 | for (; cur != end; ++cur) { |
| 181 | JSON_OBJECT_SKIP_HOLE(cfg, cur); |
| 182 | |
| 183 | if (cur->first == "boot_script") { |
| 184 | sjson::parse_string(boot_script_name, cur->second); |
| 185 | } else if (cur->first == "boot_package") { |
| 186 | boot_package_name = sjson::parse_resource_name(cur->second); |
| 187 | } else if (cur->first == "window_title") { |
| 188 | sjson::parse_string(window_title, cur->second); |
| 189 | } else if (cur->first == "render_config") { |
| 190 | render_config_name = sjson::parse_resource_name(cur->second); |
| 191 | } else if (cur->first == "physics") { |
| 192 | parse_physics(&physics_settings, cur->second); |
| 193 | } else if (cur->first == "render_settings") { |
| 194 | render_settings::parse(render_settings, cur->second); |
| 195 | } else if (cur->first == "user_config") { |
| 196 | sjson::parse_string(user_config, cur->second); |
| 197 | } else if (cur->first == CROWN_PLATFORM_NAME) { |
| 198 | parse_platform_settings(this, cur->second); |
| 199 | } else { |
| 200 | if (!is_platform_name(cur->first)) { |
| 201 | logw(BOOT_CONFIG |
| 202 | , "Unknown boot_config property '%.*s'" |
| 203 | , cur->first.length() |
| 204 | , cur->first.data() |
| 205 | ); |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | return true; |
| 211 | } |
| 212 | |
| 213 | } // namespace crown |
no test coverage detected