| 282 | } |
| 283 | |
| 284 | static bool MergeConfigValues(const rdcstr &prefix, SDObject *dstConfig, const SDObject *srcConfig, |
| 285 | bool updateDescs) |
| 286 | { |
| 287 | bool ret = false; |
| 288 | |
| 289 | // for every child in the destination, see if it has a source node. If not, we're out of date |
| 290 | for(size_t i = 0; i < dstConfig->NumChildren(); i++) |
| 291 | ret |= (srcConfig->FindChild(dstConfig->GetChild(i)->name) == NULL); |
| 292 | |
| 293 | // for every child in the source |
| 294 | for(size_t i = 0; i < srcConfig->NumChildren(); i++) |
| 295 | { |
| 296 | // see if it's present in the destination |
| 297 | const SDObject *srcChild = srcConfig->GetChild(i); |
| 298 | SDObject *dstChild = dstConfig->FindChild(srcChild->name); |
| 299 | |
| 300 | if(dstChild) |
| 301 | { |
| 302 | // if present, merge the values |
| 303 | rdcstr prefixedChild = prefix + dstChild->name; |
| 304 | |
| 305 | if(dstChild->type.name == "category"_lit) |
| 306 | { |
| 307 | // recurse if this child is not a setting node |
| 308 | ret |= MergeConfigValues(prefixedChild + ".", dstChild, srcChild, updateDescs); |
| 309 | } |
| 310 | else |
| 311 | { |
| 312 | SDObject *dstVal = dstChild->FindChild("value"); |
| 313 | const SDObject *srcVal = srcChild->FindChild("value"); |
| 314 | SDObject *dstDesc = dstChild->FindChild("description"); |
| 315 | const SDObject *srcDesc = srcChild->FindChild("description"); |
| 316 | |
| 317 | bool customised = !srcVal->HasEqualValue(dstVal); |
| 318 | |
| 319 | // otherwise see if the value is customised, and if so log the change |
| 320 | if(customised) |
| 321 | { |
| 322 | rdcstr oldVal = valueString(dstVal); |
| 323 | rdcstr newVal = valueString(srcVal); |
| 324 | |
| 325 | RDCLOG("%s has been customised from %s to %s", (prefix + dstChild->name).c_str(), |
| 326 | oldVal.c_str(), newVal.c_str()); |
| 327 | |
| 328 | #if RENDERDOC_STABLE_BUILD |
| 329 | if(rdcstr(dstDesc->data.str).contains(debugOnlyString)) |
| 330 | { |
| 331 | RDCWARN("%s customisation will not apply - read only in this build", |
| 332 | (prefix + dstChild->name).c_str()); |
| 333 | } |
| 334 | #endif |
| 335 | |
| 336 | // always set the value. For a debug-only setting this will do nothing but we want to |
| 337 | // update our config value with the user's in case we're going to write out some new |
| 338 | // values/descriptions |
| 339 | dstVal->data.str = srcVal->data.str; |
| 340 | memcpy(&dstVal->data.basic, &srcVal->data.basic, sizeof(dstVal->data.basic)); |
| 341 |
no test coverage detected