The open source OpenXR runtime

t/common: Refactor Simulated builder [NFC]

+21 -9
+21 -9
src/xrt/targets/common/target_builder_simulated.c
··· 119 119 //! @todo Create a shared tracking origin on the system devices struct instead. 120 120 head->tracking_origin->type = XRT_TRACKING_TYPE_OTHER; // Just anything other then none. 121 121 122 - struct u_system_devices *usysd = u_system_devices_allocate(); 123 - usysd->base.roles.head = head; 124 - usysd->base.roles.left = left; 125 - usysd->base.roles.right = right; 122 + struct xrt_system_devices *xsysd = NULL; 123 + { 124 + struct u_system_devices *usysd = u_system_devices_allocate(); 125 + xsysd = &usysd->base; 126 + } 126 127 127 - usysd->base.xdevs[usysd->base.xdev_count++] = head; 128 + // Add to device list. 129 + xsysd->xdevs[xsysd->xdev_count++] = head; 128 130 if (left != NULL) { 129 - usysd->base.xdevs[usysd->base.xdev_count++] = left; 131 + xsysd->xdevs[xsysd->xdev_count++] = left; 130 132 } 131 133 if (right != NULL) { 132 - usysd->base.xdevs[usysd->base.xdev_count++] = right; 134 + xsysd->xdevs[xsysd->xdev_count++] = right; 133 135 } 134 136 135 - *out_xsysd = &usysd->base; 136 - u_builder_create_space_overseer(&usysd->base, out_xso); 137 + // Assign to role(s). 138 + xsysd->roles.head = head; 139 + xsysd->roles.left = left; 140 + xsysd->roles.right = right; 141 + 142 + 143 + /* 144 + * Done. 145 + */ 146 + 147 + *out_xsysd = xsysd; 148 + u_builder_create_space_overseer(xsysd, out_xso); 137 149 138 150 return XRT_SUCCESS; 139 151 }