Skip to content

Commit

Permalink
HMDがつながっていない時に正常にエラーを出すように修正、requireHmdの案内を追加、requireHmdのチェックを追加、64bi…
Browse files Browse the repository at this point in the history
…t OSチェックを追加
  • Loading branch information
gpsnmeajp committed Jun 13, 2021
1 parent d223b5c commit 8a67250
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions vmt_manager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
MIT License
Copyright (c) 2020 gpsnmeajp
Expand Down Expand Up @@ -107,21 +107,29 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
rnd = new Random();
osc = new OSC("127.0.0.1", 39571, 39570, OnBundle, OnMessage);

//タイマー起動
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
dispatcherTimer.Tick += new EventHandler(GenericTimer);
dispatcherTimer.Start();

util = new EasyOpenVRUtil();
if (!util.StartOpenVR())
{
//var result = MessageBox.Show("Steam VR not ready. Maybe not ready for HMD or Tracking system.\nStream VRが利用できません。HMDやトラッキングシステムが利用できない状態の可能性があります。", title, MessageBoxButton.OK, MessageBoxImage.Error);
TopErrorMessage("Steam VR not ready. Maybe not ready for HMD or Tracking system.\nStream VRが利用できません。HMDやトラッキングシステムが利用できない状態の可能性があります。");
TopErrorMessage("Steam VR not ready. Maybe not ready for HMD or Tracking system.\nStream VRが利用できません。HMDやトラッキングシステムが利用できない状態の可能性があります。\n\nPlease set requireHmd to false on SteamVR If you want to use without HMD. (Almost functions will not work.)\nHMDなしで利用したい場合は、SteamVRにてrequireHmdをfalseにして再起動してください。(殆どの機能は利用できません)");
//Close();
//タイマー起動してはいけない
return;
}

if (Environment.Is64BitOperatingSystem == false)
{
TopErrorMessage("VMT works 64bit OS only.\n VMTは64bit OSでのみ動作します。");
//タイマー起動してはいけない
return;
}

//タイマー起動
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
dispatcherTimer.Tick += new EventHandler(GenericTimer);
dispatcherTimer.Start();

//セーフモードチェック
EVRSettingsError eVRSettingsError = EVRSettingsError.None;
bool safemode = OpenVR.Settings.GetBool("driver_vmt", OpenVR.k_pch_Driver_BlockedBySafemode_Bool, ref eVRSettingsError);
Expand All @@ -140,6 +148,14 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
TopErrorMessage("VMT has disabled in Steam VR setting.\nPlease enable, and restart SteamVR.\n\nVMTはSteamVR上で無効に設定されています。\n有効にし、SteamVRを再起動してください。");
return;
}
//requireHmdチェック
eVRSettingsError = EVRSettingsError.None;
bool requireHmd = OpenVR.Settings.GetBool("steamvr", OpenVR.k_pch_SteamVR_RequireHmd_String, ref eVRSettingsError);
if (eVRSettingsError == EVRSettingsError.None && !requireHmd)
{
//var result = MessageBox.Show("VMT has disabled in Steam VR setting.\nPlease enable, and restart SteamVR.\n\nVMTはSteamVR上で無効に設定されています。\n有効にし、SteamVRを再起動してください。", title, MessageBoxButton.OK, MessageBoxImage.Error);
TopWarningMessage("Manager detected requireHmd is false on SteamVR. Some functions will not work probably.\nSteamVRにてrequireHmdがfalseに設定されています。いくつかの機能は正常に動かない可能性があります。",true);
}

//デバッグのためにセーフモードを有効化
//OpenVR.Settings.SetBool(OpenVR.k_pch_SteamVR_Section, OpenVR.k_pch_SteamVR_EnableSafeMode, true,ref eVRSettingsError);
Expand Down

0 comments on commit 8a67250

Please sign in to comment.