mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-06 07:06:10 +00:00
t/common: Refactor WinMR builder [NFC]
This commit is contained in:
parent
0a8fa312d6
commit
8b30819b35
|
@ -271,41 +271,45 @@ wmr_open_system(struct xrt_builder *xb,
|
||||||
assert(xret_unlock == XRT_SUCCESS);
|
assert(xret_unlock == XRT_SUCCESS);
|
||||||
(void)xret_unlock;
|
(void)xret_unlock;
|
||||||
|
|
||||||
struct u_system_devices *usysd = u_system_devices_allocate();
|
struct xrt_system_devices *xsysd = NULL;
|
||||||
|
{
|
||||||
|
struct u_system_devices *usysd = u_system_devices_allocate();
|
||||||
|
xsysd = &usysd->base;
|
||||||
|
}
|
||||||
|
|
||||||
usysd->base.xdevs[usysd->base.xdev_count++] = head;
|
xsysd->xdevs[xsysd->xdev_count++] = head;
|
||||||
if (left != NULL) {
|
if (left != NULL) {
|
||||||
usysd->base.xdevs[usysd->base.xdev_count++] = left;
|
xsysd->xdevs[xsysd->xdev_count++] = left;
|
||||||
}
|
}
|
||||||
if (right != NULL) {
|
if (right != NULL) {
|
||||||
usysd->base.xdevs[usysd->base.xdev_count++] = right;
|
xsysd->xdevs[xsysd->xdev_count++] = right;
|
||||||
}
|
}
|
||||||
if (ht_left != NULL) {
|
if (ht_left != NULL) {
|
||||||
usysd->base.xdevs[usysd->base.xdev_count++] = ht_left;
|
xsysd->xdevs[xsysd->xdev_count++] = ht_left;
|
||||||
}
|
}
|
||||||
if (ht_right != NULL) {
|
if (ht_right != NULL) {
|
||||||
usysd->base.xdevs[usysd->base.xdev_count++] = ht_right;
|
xsysd->xdevs[xsysd->xdev_count++] = ht_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
usysd->base.roles.head = head;
|
// Use hand tracking if no controllers.
|
||||||
if (left != NULL) {
|
if (left == NULL) {
|
||||||
usysd->base.roles.left = left;
|
left = ht_left;
|
||||||
} else {
|
|
||||||
usysd->base.roles.left = ht_left;
|
|
||||||
}
|
}
|
||||||
if (right != NULL) {
|
if (right == NULL) {
|
||||||
usysd->base.roles.right = right;
|
right = ht_right;
|
||||||
} else {
|
|
||||||
usysd->base.roles.right = ht_right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find hand tracking devices.
|
|
||||||
usysd->base.roles.hand_tracking.left = u_system_devices_get_ht_device_left(&usysd->base);
|
// Assign to role(s).
|
||||||
usysd->base.roles.hand_tracking.right = u_system_devices_get_ht_device_right(&usysd->base);
|
xsysd->roles.head = head;
|
||||||
|
xsysd->roles.left = left;
|
||||||
|
xsysd->roles.right = right;
|
||||||
|
xsysd->roles.hand_tracking.left = ht_left;
|
||||||
|
xsysd->roles.hand_tracking.right = ht_right;
|
||||||
|
|
||||||
// Create space overseer last once all devices set.
|
// Create space overseer last once all devices set.
|
||||||
struct xrt_space_overseer *xso = NULL;
|
struct xrt_space_overseer *xso = NULL;
|
||||||
u_builder_create_space_overseer(&usysd->base, &xso);
|
u_builder_create_space_overseer(xsysd, &xso);
|
||||||
assert(xso != NULL);
|
assert(xso != NULL);
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,7 +317,7 @@ wmr_open_system(struct xrt_builder *xb,
|
||||||
* Output.
|
* Output.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*out_xsysd = &usysd->base;
|
*out_xsysd = xsysd;
|
||||||
*out_xso = xso;
|
*out_xso = xso;
|
||||||
|
|
||||||
return XRT_SUCCESS;
|
return XRT_SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue