The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/steamvr_lh: Choose the first tracking universe that is found

lighthousedb.json may contain many more tracking universes than are
actually configured in chaperone_info.vrchap.

+16 -8
+16 -8
src/xrt/drivers/steamvr_lh/device.cpp
··· 604 604 return; 605 605 } 606 606 607 - // XXX: This may be broken if there are multiple known universes - how do we determine which to use then? 608 - const JSONNode universe = lighthousedb["known_universes"][0]; 609 - const std::string id = universe["id"].asString(); 610 607 JSONNode info = {}; 611 - for (const JSONNode &u : chap_info["universes"].asArray()) { 612 - if (u["universeID"].asString() == id) { 613 - DEV_INFO("Found info for universe %s", id.c_str()); 614 - info = u; 608 + bool universe_found = false; 609 + 610 + // XXX: This may be broken if there are multiple known universes - how do we determine which to use then? 611 + auto known_universes = lighthousedb["known_universes"].asArray(); 612 + for (auto &universe : known_universes) { 613 + const std::string id = universe["id"].asString(); 614 + for (const JSONNode &u : chap_info["universes"].asArray()) { 615 + if (u["universeID"].asString() == id) { 616 + DEV_INFO("Found info for universe %s", id.c_str()); 617 + info = u; 618 + universe_found = true; 619 + break; 620 + } 621 + } 622 + if (universe_found) { 615 623 break; 616 624 } 617 625 } 618 626 619 627 if (info.isInvalid()) { 620 - DEV_ERR("Couldn't find chaperone info for universe %s, playspace center will be off", id.c_str()); 628 + DEV_ERR("Couldn't find chaperone info for any known universe, playspace center will be off"); 621 629 return; 622 630 } 623 631