The open source OpenXR runtime

t/common: Refactor SimulaVR builder [NFC]

+14 -7
+14 -7
src/xrt/targets/common/target_builder_simulavr.c
··· 192 192 struct xrt_space_overseer **out_xso) 193 193 { 194 194 struct simula_builder *sb = (struct simula_builder *)xb; 195 - struct u_system_devices *usysd = u_system_devices_allocate(); 196 195 xrt_result_t result = XRT_SUCCESS; 197 196 198 197 if (out_xsysd == NULL || *out_xsysd != NULL) { ··· 211 210 struct xrt_device *head_device = multi_create_tracking_override( 212 211 XRT_TRACKING_OVERRIDE_ATTACHED, svr_dev, t265_dev, XRT_INPUT_GENERIC_TRACKER_POSE, &ident); 213 212 214 - usysd->base.roles.head = head_device; 215 - usysd->base.xdevs[0] = usysd->base.roles.head; 216 - usysd->base.xdev_count = 1; 213 + struct xrt_system_devices *xsysd = NULL; 214 + { 215 + struct u_system_devices *usysd = u_system_devices_allocate(); 216 + xsysd = &usysd->base; 217 + } 218 + 219 + // Add to device list. 220 + xsysd->xdevs[xsysd->xdev_count++] = head_device; 221 + 222 + // Assign to role(s). 223 + xsysd->roles.head = head_device; 217 224 218 225 219 226 end: 220 227 if (result == XRT_SUCCESS) { 221 - *out_xsysd = &usysd->base; 222 - u_builder_create_space_overseer(&usysd->base, out_xso); 228 + *out_xsysd = xsysd; 229 + u_builder_create_space_overseer(xsysd, out_xso); 223 230 } else { 224 - u_system_devices_destroy(&usysd); 231 + xrt_system_devices_destroy(&xsysd); 225 232 } 226 233 227 234 return result;