From f962194f6e1b89ac214be7cc5469c1d6e7f86a34 Mon Sep 17 00:00:00 2001 From: HipsterSloth Date: Sun, 30 Sep 2018 11:58:12 -0700 Subject: [PATCH] Incorporating PR #6 from Stephen O'Hair https://bitbucket.org/hawkinse/psmovefreepiebridge/pull-requests/6/fix-hmd-parameter-for-cli-usage/diff --- PSMoveFreepieBridge/PSMoveFreepieBridge.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PSMoveFreepieBridge/PSMoveFreepieBridge.cpp b/PSMoveFreepieBridge/PSMoveFreepieBridge.cpp index 44a739d..c647c88 100644 --- a/PSMoveFreepieBridge/PSMoveFreepieBridge.cpp +++ b/PSMoveFreepieBridge/PSMoveFreepieBridge.cpp @@ -67,7 +67,7 @@ void prompt_arguments(eDeviceType &deviceType, int32_t &deviceCount, int* device bool parse_arguments( int argc, char** argv, - eDeviceType deviceType, + eDeviceType &deviceType, int32_t &deviceCount, PSMControllerID* deviceIDs, PSMTrackingColorType* bulbColors, @@ -82,7 +82,15 @@ bool parse_arguments( deviceType= _deviceTypeController; } else if ((strcmp(argv[index], "-hmd") == 0) && deviceCount < 1) { - deviceType= _deviceTypeHMD; + deviceType = _deviceTypeHMD; + deviceCount = 1; + + // set the HMD id if specified + index++; + if ((index < argc) && isdigit(*argv[index])) + deviceIDs[0] = atoi(argv[index]); + + index++; } else if ((strcmp(argv[index], "-t") == 0) && deviceCount < 1) { index++;