Minor code changes and fixes

Sometimes I dream about cheese
This commit is contained in:
SDraw 2022-10-18 21:46:10 +03:00
parent 7fcfb04e0f
commit fd48185bdd
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
14 changed files with 183 additions and 177 deletions

View file

@ -34,6 +34,19 @@ namespace ml_dht
void Start()
{
m_camera = PlayerSetup.Instance.desktopCamera.transform;
Settings.EnabledChange += this.SetEnabled;
Settings.SmoothingChange += this.SetSmoothing;
Settings.MirroredChange += this.SetMirrored;
Settings.FaceOverrideChange += this.SetFaceOverride;
}
void OnDestroy()
{
Settings.EnabledChange -= this.SetEnabled;
Settings.SmoothingChange -= this.SetSmoothing;
Settings.MirroredChange -= this.SetMirrored;
Settings.FaceOverrideChange -= this.SetFaceOverride;
}
public void UpdateTrackingData(ref TrackingData p_data)

View file

@ -20,10 +20,6 @@ namespace ml_dht
ms_instance = this;
Settings.Init();
Settings.EnabledChange += this.OnEnabledChanged;
Settings.MirroredChange += this.OnMirroredChanged;
Settings.SmoothingChange += this.OnSmoothingChanged;
Settings.FaceOverrideChange += this.OnFaceOverrideChange;
m_mapReader = new MemoryMapReader();
m_buffer = new byte[1024];
@ -64,6 +60,18 @@ namespace ml_dht
m_localTracked.SetEnabled(Settings.Enabled);
m_localTracked.SetMirrored(Settings.Mirrored);
m_localTracked.SetSmoothing(Settings.Smoothing);
m_localTracked.SetFaceOverride(Settings.FaceOverride);
}
public override void OnDeinitializeMelon()
{
if(ms_instance == this)
ms_instance = null;
m_mapReader?.Close();
m_mapReader = null;
m_buffer = null;
m_localTracked = null;
}
public override void OnUpdate()
@ -76,27 +84,6 @@ namespace ml_dht
}
}
void OnEnabledChanged(bool p_state)
{
if(m_localTracked != null)
m_localTracked.SetEnabled(p_state);
}
void OnMirroredChanged(bool p_state)
{
if(m_localTracked != null)
m_localTracked.SetMirrored(p_state);
}
void OnSmoothingChanged(float p_value)
{
if(m_localTracked != null)
m_localTracked.SetSmoothing(p_value);
}
void OnFaceOverrideChange(bool p_state)
{
if(m_localTracked != null)
m_localTracked.SetFaceOverride(p_state);
}
static void OnCalibrateAvatar_Postfix() => ms_instance?.OnCalibrateAvatar();
void OnCalibrateAvatar()
{

View file

@ -1,10 +1,10 @@
using System.Reflection;
[assembly: AssemblyTitle("DesktopHeadTracking")]
[assembly: AssemblyVersion("1.0.6")]
[assembly: AssemblyFileVersion("1.0.6")]
[assembly: AssemblyVersion("1.0.7")]
[assembly: AssemblyFileVersion("1.0.7")]
[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.0.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.0.7", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]