diff --git a/setup/vmtsetup_script.iss b/setup/vmtsetup_script.iss index 54aaa9b..fa48336 100644 --- a/setup/vmtsetup_script.iss +++ b/setup/vmtsetup_script.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Virtual Motion Tracker" -#define MyAppVersion "0.14g" +#define MyAppVersion "0.15" #define MyAppPublisher "gpsnmeajp" #define MyAppURL "https://github.com/gpsnmeajp/VirtualMotionTracker" #define MyAppExeName "vmt_manager.exe" diff --git a/vmt_driver/CommunicationManager.h b/vmt_driver/CommunicationManager.h index cf9a5a8..8600df2 100644 --- a/vmt_driver/CommunicationManager.h +++ b/vmt_driver/CommunicationManager.h @@ -26,7 +26,7 @@ SOFTWARE. //通信系の処理の管理、OSC情報の送受信を行う namespace VMTDriver { - const string Version{ "VMT_014g" }; + const string Version{ "VMT_015" }; class OSCReceiver : public osc::OscPacketListener { private: diff --git a/vmt_driver/Config.cpp b/vmt_driver/Config.cpp index 6e34ebb..c7de364 100644 --- a/vmt_driver/Config.cpp +++ b/vmt_driver/Config.cpp @@ -145,6 +145,10 @@ namespace VMTDriver { { j["Priority"] = 10; } + if (!j.contains("AlwaysCompatible")) + { + j["AlwaysCompatible"] = false; + } return j; } @@ -209,6 +213,10 @@ namespace VMTDriver { { m_Priority = j["Priority"]; } + if (j.contains("AlwaysCompatible")) + { + m_AlwaysCompatible = j["AlwaysCompatible"]; + } SaveJson(j); } catch (...) { @@ -359,4 +367,9 @@ namespace VMTDriver { { return m_Priority; } + //常時互換モードを取得する + bool Config::GetAlwaysCompatible() + { + return m_AlwaysCompatible; + } } \ No newline at end of file diff --git a/vmt_driver/Config.h b/vmt_driver/Config.h index e36f8cd..1fd3402 100644 --- a/vmt_driver/Config.h +++ b/vmt_driver/Config.h @@ -45,6 +45,7 @@ namespace VMTDriver { bool m_AddCompatibleControllerOnStartup{ false }; bool m_DiagLogOnStartup{ false }; int m_Priority{ 10 }; + bool m_AlwaysCompatible{ false }; json LoadJson(); void SaveJson(json j); @@ -74,5 +75,6 @@ namespace VMTDriver { bool GetAddCompatibleControllerOnStartup(); bool GetDiagLogOnStartup(); int GetPriority(); + bool GetAlwaysCompatible(); }; } \ No newline at end of file diff --git a/vmt_driver/TrackedDeviceServerDriver.cpp b/vmt_driver/TrackedDeviceServerDriver.cpp index ebf0ad9..968a53c 100644 --- a/vmt_driver/TrackedDeviceServerDriver.cpp +++ b/vmt_driver/TrackedDeviceServerDriver.cpp @@ -505,22 +505,34 @@ namespace VMTDriver { m_CompatibleMode = false; break; case 5://Compatible(Knuckles) Controller Left - LogInfo("RegisterToVRSystem: %s", "ETrackedDeviceClass::TrackedDeviceClass_Controller (Left)"); + LogInfo("RegisterToVRSystem: %s", "ETrackedDeviceClass::TrackedDeviceClass_Controller (Left) [Compatible]"); m_controllerRole = ControllerRole::Left; m_deviceClass = ETrackedDeviceClass::TrackedDeviceClass_Controller; m_CompatibleMode = true; break; case 6://Compatible(Knuckles) Controller Right - LogInfo("RegisterToVRSystem: %s", "ETrackedDeviceClass::TrackedDeviceClass_Controller (Right)"); + LogInfo("RegisterToVRSystem: %s", "ETrackedDeviceClass::TrackedDeviceClass_Controller (Right) [Compatible]"); m_controllerRole = ControllerRole::Right; m_deviceClass = ETrackedDeviceClass::TrackedDeviceClass_Controller; m_CompatibleMode = true; break; + case 7://Compatible Tracker + LogInfo("RegisterToVRSystem: %s", "ETrackedDeviceClass::TrackedDeviceClass_GenericTracker [Compatible]"); + m_controllerRole = ControllerRole::None; + m_deviceClass = ETrackedDeviceClass::TrackedDeviceClass_GenericTracker; + m_CompatibleMode = true; + break; default: LogError("RegisterToVRSystem: %s", "Unknown Type"); m_deviceClass = ETrackedDeviceClass::TrackedDeviceClass_Invalid; return; //中止 } + + if (Config::GetInstance()->GetAlwaysCompatible()) { + LogError("AlwaysCompatible: %s", "true"); + m_CompatibleMode = true; + } + m_registrationInProgress = true; LogIfFalse(VRServerDriverHost()->TrackedDeviceAdded(m_serial.c_str(), m_deviceClass, this)); } @@ -1001,9 +1013,12 @@ namespace VMTDriver { RegisteredDeviceType_String += m_serial.c_str(); LogIfETrackedPropertyError(VRProperties()->SetStringProperty(m_propertyContainer, Prop_RegisteredDeviceType_String, RegisteredDeviceType_String.c_str())); - if (m_CompatibleMode) { + if (m_CompatibleMode && (m_deviceClass == ETrackedDeviceClass::TrackedDeviceClass_Controller)) { LogIfETrackedPropertyError(VRProperties()->SetStringProperty(m_propertyContainer, Prop_InputProfilePath_String, "{vmt}/input/vmt_compatible_profile.json")); //Knuckles互換モード } + else if (m_CompatibleMode && (m_deviceClass == ETrackedDeviceClass::TrackedDeviceClass_GenericTracker)) { + LogIfETrackedPropertyError(VRProperties()->SetStringProperty(m_propertyContainer, Prop_InputProfilePath_String, "{htc}/input/vive_tracker_profile.json")); //Tracker互換モード + } else { LogIfETrackedPropertyError(VRProperties()->SetStringProperty(m_propertyContainer, Prop_InputProfilePath_String, "{vmt}/input/vmt_profile.json")); //VMTモード } @@ -1088,7 +1103,7 @@ namespace VMTDriver { LogIfEVRInputError(VRDriverInput()->CreateHapticComponent(m_propertyContainer, "/output/haptic", &HapticComponent)); //互換用のコンポーネントミラーリングを登録 - if (m_CompatibleMode) { + if (m_CompatibleMode && (m_deviceClass == ETrackedDeviceClass::TrackedDeviceClass_Controller)) { LogIfEVRInputError(VRDriverInput()->CreateBooleanComponent(m_propertyContainer, (std::string("/input/system/click")).c_str(), &ButtonComponent[0])); LogIfEVRInputError(VRDriverInput()->CreateBooleanComponent(m_propertyContainer, (std::string("/input/system/touch")).c_str(), &ButtonTouchComponent[0])); @@ -1121,7 +1136,16 @@ namespace VMTDriver { LogIfEVRInputError(VRDriverInput()->CreateScalarComponent(m_propertyContainer, (std::string("/input/finger/middle/value")).c_str(), &TriggerComponent[4], EVRScalarType::VRScalarType_Absolute, EVRScalarUnits::VRScalarUnits_NormalizedOneSided)); LogIfEVRInputError(VRDriverInput()->CreateScalarComponent(m_propertyContainer, (std::string("/input/finger/ring/value")).c_str(), &TriggerComponent[5], EVRScalarType::VRScalarType_Absolute, EVRScalarUnits::VRScalarUnits_NormalizedOneSided)); LogIfEVRInputError(VRDriverInput()->CreateScalarComponent(m_propertyContainer, (std::string("/input/finger/pinky/value")).c_str(), &TriggerComponent[6], EVRScalarType::VRScalarType_Absolute, EVRScalarUnits::VRScalarUnits_NormalizedOneSided)); - + } + //互換用のコンポーネントミラーリングを登録 + if (m_CompatibleMode && (m_deviceClass == ETrackedDeviceClass::TrackedDeviceClass_GenericTracker)) { + LogIfEVRInputError(VRDriverInput()->CreateBooleanComponent(m_propertyContainer, (std::string("/input/power/click")).c_str(), &ButtonComponent[0])); + LogIfEVRInputError(VRDriverInput()->CreateBooleanComponent(m_propertyContainer, (std::string("/input/trigger/click")).c_str(), &ButtonComponent[1])); + LogIfEVRInputError(VRDriverInput()->CreateBooleanComponent(m_propertyContainer, (std::string("/input/grip/click")).c_str(), &ButtonComponent[2])); + LogIfEVRInputError(VRDriverInput()->CreateBooleanComponent(m_propertyContainer, (std::string("/input/application_menu/click")).c_str(), &ButtonComponent[3])); + LogIfEVRInputError(VRDriverInput()->CreateBooleanComponent(m_propertyContainer, (std::string("/input/thumb/click")).c_str(), &ButtonComponent[4])); + } + if (m_CompatibleMode) { //互換アイコンにする LogIfETrackedPropertyError(VRProperties()->SetStringProperty(m_propertyContainer, Prop_NamedIconPathDeviceSearching_String, "{vmt}/icons/Searching32x32_compatible.png")); LogIfETrackedPropertyError(VRProperties()->SetStringProperty(m_propertyContainer, Prop_NamedIconPathDeviceSearchingAlert_String, "{vmt}/icons/SearchingAlert32x32_compatible.png")); diff --git a/vmt_manager/MainWindow.xaml b/vmt_manager/MainWindow.xaml index b0405c7..64ab214 100644 --- a/vmt_manager/MainWindow.xaml +++ b/vmt_manager/MainWindow.xaml @@ -4,14 +4,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:vmt_manager" - Width="550" + Width="650" Height="800" mc:Ignorable="d" Title="VMT Manager" Loaded="Window_Loaded" Closed="Window_Closed" ResizeMode="NoResize"> - + @@ -200,6 +200,7 @@ + @@ -285,8 +290,11 @@ If you want to override button, axis, fingers by VMT, Please set "Target device" + - + diff --git a/vmt_manager/MainWindow.xaml.cs b/vmt_manager/MainWindow.xaml.cs index 5619212..ee6f07b 100644 --- a/vmt_manager/MainWindow.xaml.cs +++ b/vmt_manager/MainWindow.xaml.cs @@ -45,7 +45,7 @@ namespace vmt_manager /// public partial class MainWindow : Window { - const string Version = "VMT_014g"; + const string Version = "VMT_015"; private DispatcherTimer dispatcherTimer; Random rnd; string title = ""; @@ -1510,6 +1510,17 @@ private void RightHandCompatibleButton(object sender, RoutedEventArgs e) } } + private void TrackerCompatibleButton(object sender, RoutedEventArgs e) + { + var index = GetInputIndex(); + if (index.ok) + { + osc.Send(new OscMessage("/VMT/Room/Unity", + index.i, 7, 0f, + 0f, 0f, 0f, + 0f, 0f, 0f, 1f)); + } + } private void LeftHandButton(object sender, RoutedEventArgs e) { @@ -1651,6 +1662,16 @@ private void DisableDiagLogOnStartupButton(object sender, RoutedEventArgs e) osc.Send(new OscMessage("/VMT/Config", "DiagLogOnStartup", "false")); System.Media.SystemSounds.Beep.Play(); } + private void EnableAlwaysCompatibleButton(object sender, RoutedEventArgs e) + { + osc.Send(new OscMessage("/VMT/Config", "AlwaysCompatible", "true")); + System.Media.SystemSounds.Beep.Play(); + } + private void DisableAlwaysCompatibleButton(object sender, RoutedEventArgs e) + { + osc.Send(new OscMessage("/VMT/Config", "AlwaysCompatible", "false")); + System.Media.SystemSounds.Beep.Play(); + } private void DeviceReloadButton(object sender, RoutedEventArgs e) {