plugin head angle override deactivates if trackir software wasn't running on startup

This commit is contained in:
jonbons 2024-05-04 14:10:01 -05:00
parent 574889b512
commit 755d3923f2
No known key found for this signature in database
2 changed files with 13 additions and 6 deletions

View File

@ -3,8 +3,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>JBTrackIR</AssemblyName> <AssemblyName>JBTrackIR</AssemblyName>
<Description>My first plugin</Description> <Description>SPT TrackIR Support</Description>
<Version>1.0.0</Version> <Version>1.0.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources> <RestoreAdditionalProjectSources>

View File

@ -16,7 +16,7 @@ using UnityEngine;
namespace JBTrackIR; namespace JBTrackIR;
[BepInPlugin("com.jonbons.trackir", "JonBons.TrackIR", "1.0.0")] [BepInPlugin("com.jonbons.trackir", "JonBons.TrackIR", "1.0.1")]
public class Plugin : BaseUnityPlugin public class Plugin : BaseUnityPlugin
{ {
static ConfigEntry<bool> tirEnabled; static ConfigEntry<bool> tirEnabled;
@ -36,9 +36,16 @@ public class Plugin : BaseUnityPlugin
tirClient = new TrackIRClient(); tirClient = new TrackIRClient();
if (tirClient != null && !tirRunning) if (tirClient != null && !tirRunning)
{ {
tirClient.TrackIR_Enhanced_Init(); var result = tirClient.TrackIR_Enhanced_Init();
tirRunning = true; Logger.LogInfo($"com.jonbons.trackir: detecting... {result}");
Logger.LogInfo($"com.jonbons.trackir: trackir is running"); if (!string.IsNullOrEmpty(result))
{
tirRunning = true;
Logger.LogInfo($"com.jonbons.trackir: detected");
}
else {
Logger.LogInfo($"com.jonbons.trackir: not detected");
}
} }
BindSettings(); BindSettings();