Skip to content

Commit

Permalink
Showing 14 changed files with 183 additions and 177 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Merged set of MelonLoader mods for ChilloutVR.

**State table for game build 2022r169:**
**State table for game build 2022r169p1:**
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | Current Status | Notes |
|-----------|------------|----------------|-----------------------------------------------------------------|----------------|-------|
| Avatar Change Info | ml_aci | 1.0.3 | Yes | Working |
| Avatar Motion Tweaker | ml_amt | 1.1.3 | Yes | Working |
| Desktop Head Tracking | ml_dht | 1.0.6 | Yes | Working |
| Avatar Motion Tweaker | ml_amt | 1.1.4 | On review | Working |
| Desktop Head Tracking | ml_dht | 1.0.7 | On review | Working |
| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working |
| Four Point Tracking | ml_fpt | 1.0.8 | Yes | Working |
| Leap Motion Extension | ml_lme | 1.2.3 | On review | Working |
| Four Point Tracking | ml_fpt | 1.0.9 | On review | Working |
| Leap Motion Extension | ml_lme | 1.2.4 | On review | Working |
| Server Connection Info | ml_sci | 1.0.2 | Yes | Working |
51 changes: 5 additions & 46 deletions ml_amt/Main.cs
Original file line number Diff line number Diff line change
@@ -15,14 +15,6 @@ public override void OnInitializeMelon()
ms_instance = this;

Settings.Init();
Settings.IKOverrideCrouchChange += this.OnIKOverrideCrouchChange;
Settings.CrouchLimitChange += this.OnCrouchLimitChange;
Settings.IKOverrideProneChange += this.OnIKOverrideProneChange;
Settings.ProneLimitChange += this.OnProneLimitChange;
Settings.PoseTransitionsChange += this.OnPoseTransitonsChange;
Settings.AdjustedMovementChange += this.OnAdjustedMovementChange;
Settings.IKOverrideFlyChange += this.OnIKOverrideFlyChange;
Settings.DetectEmotesChange += this.OnDetectEmotesChange;

HarmonyInstance.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.ClearAvatar)),
@@ -54,45 +46,12 @@ System.Collections.IEnumerator WaitForLocalPlayer()
m_localTweaker.SetDetectEmotes(Settings.DetectEmotes);
}

void OnIKOverrideCrouchChange(bool p_state)
public override void OnDeinitializeMelon()
{
if(m_localTweaker != null)
m_localTweaker.SetIKOverrideCrouch(p_state);
}
void OnCrouchLimitChange(float p_value)
{
if(m_localTweaker != null)
m_localTweaker.SetCrouchLimit(p_value);
}
void OnIKOverrideProneChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetIKOverrideProne(p_state);
}
void OnProneLimitChange(float p_value)
{
if(m_localTweaker != null)
m_localTweaker.SetProneLimit(p_value);
}
void OnPoseTransitonsChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetPoseTransitions(p_state);
}
void OnAdjustedMovementChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetAdjustedMovement(p_state);
}
void OnIKOverrideFlyChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetIKOverrideFly(p_state);
}
void OnDetectEmotesChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetDetectEmotes(p_state);
if(ms_instance == this)
ms_instance = null;

m_localTweaker = null;
}

static void OnAvatarClear_Postfix() => ms_instance?.OnAvatarClear();
27 changes: 25 additions & 2 deletions ml_amt/MotionTweaker.cs
Original file line number Diff line number Diff line change
@@ -78,6 +78,30 @@ public MotionTweaker()
{
m_parameters = new List<AdditionalParameterInfo>();
}

void Start()
{
Settings.IKOverrideCrouchChange += this.SetIKOverrideCrouch;
Settings.CrouchLimitChange += this.SetCrouchLimit;
Settings.IKOverrideProneChange += this.SetIKOverrideProne;
Settings.ProneLimitChange += this.SetProneLimit;
Settings.PoseTransitionsChange += this.SetPoseTransitions;
Settings.AdjustedMovementChange += this.SetAdjustedMovement;
Settings.IKOverrideFlyChange += this.SetIKOverrideFly;
Settings.DetectEmotesChange += this.SetDetectEmotes;
}

void OnDestroy()
{
Settings.IKOverrideCrouchChange -= this.SetIKOverrideCrouch;
Settings.CrouchLimitChange -= this.SetCrouchLimit;
Settings.IKOverrideProneChange -= this.SetIKOverrideProne;
Settings.ProneLimitChange -= this.SetProneLimit;
Settings.PoseTransitionsChange -= this.SetPoseTransitions;
Settings.AdjustedMovementChange -= this.SetAdjustedMovement;
Settings.IKOverrideFlyChange -= this.SetIKOverrideFly;
Settings.DetectEmotesChange -= this.SetDetectEmotes;
}

void Update()
{
@@ -123,13 +147,12 @@ void Update()

m_poseState = l_poseState;

m_emoteActive = false;
if(m_detectEmotes && (m_locomotionLayer >= 0))
{
AnimatorStateInfo l_animState = PlayerSetup.Instance._animator.GetCurrentAnimatorStateInfo(m_locomotionLayer);
m_emoteActive = (l_animState.tagHash == ms_emoteHash);
}
else
m_emoteActive = false;

if(m_parameters.Count > 0)
{
6 changes: 3 additions & 3 deletions ml_amt/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Reflection;

[assembly: AssemblyTitle("AvatarMotionTweaker")]
[assembly: AssemblyVersion("1.1.3")]
[assembly: AssemblyFileVersion("1.1.3")]
[assembly: AssemblyVersion("1.1.4")]
[assembly: AssemblyFileVersion("1.1.4")]

[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.1.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.1.4", "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)]
13 changes: 13 additions & 0 deletions ml_dht/HeadTracked.cs
Original file line number Diff line number Diff line change
@@ -34,6 +34,19 @@ class HeadTracked : MonoBehaviour
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)
37 changes: 12 additions & 25 deletions ml_dht/Main.cs
Original file line number Diff line number Diff line change
@@ -20,10 +20,6 @@ public override void OnInitializeMelon()
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 @@ System.Collections.IEnumerator WaitForPlayer()
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 @@ public override void OnUpdate()
}
}

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()
{
6 changes: 3 additions & 3 deletions ml_dht/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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)]
27 changes: 22 additions & 5 deletions ml_fpt/Main.cs
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ public class FourPointTracking : MelonLoader.MelonMod

bool m_ready = false;

IndexIK m_indexIk = null;
IndexIK m_indexIK = null;
RootMotion.FinalIK.VRIK m_vrIK = null;
RuntimeAnimatorController m_runtimeAnimator = null;
List<CVRAdvancedSettingsFileProfileValue> m_aasParameters = null;
@@ -78,11 +78,28 @@ System.Collections.IEnumerator WaitForLocalPlayer()
while(PlayerSetup.Instance == null)
yield return null;

m_indexIk = PlayerSetup.Instance.gameObject.GetComponent<IndexIK>();
m_indexIK = PlayerSetup.Instance.gameObject.GetComponent<IndexIK>();

m_ready = true;
}

public override void OnDeinitializeMelon()
{
if(ms_instance == this)
ms_instance = null;

m_ready = false;
m_aasParameters?.Clear();
m_aasParameters = null;
m_avatarCalibrations?.Clear();
m_avatarCalibrations = null;
m_hipsTrackerIndex = -1;

if(m_calibrationTask != null)
MelonLoader.MelonCoroutines.Stop(m_calibrationTask);
m_calibrationTask = null;
}

void StartCalibration()
{
if(m_ready && !m_calibrationActive && PlayerSetup.Instance._inVr && !PlayerSetup.Instance.avatarIsLoading && PlayerSetup.Instance._animator.isHuman && !BodySystem.isCalibrating && !BodySystem.isCalibratedAsFullBody)
@@ -128,7 +145,7 @@ System.Collections.IEnumerator CalibrationTask()
if(m_vrIK != null)
m_vrIK.enabled = false;

m_indexIk.enabled = false;
m_indexIK.enabled = false;

PlayerSetup.Instance._trackerManager.trackers[m_hipsTrackerIndex].ShowLine(true, m_hips);

@@ -155,7 +172,7 @@ System.Collections.IEnumerator CalibrationTask()
m_vrIK.enabled = true;
}

m_indexIk.enabled = true;
m_indexIK.enabled = true;

PlayerSetup.Instance._animator.runtimeAnimatorController = m_runtimeAnimator;
PlayerSetup.Instance.animatorManager.SetAnimator(PlayerSetup.Instance._animator, m_runtimeAnimator);
@@ -213,7 +230,7 @@ void OnAvatarClear()
if(m_calibrationTask != null)
MelonLoader.MelonCoroutines.Stop(m_calibrationTask);

m_indexIk.enabled = true;
m_indexIK.enabled = true;

IKSystem.Instance.leftHandModel.SetActive(false);
IKSystem.Instance.rightHandModel.SetActive(false);
6 changes: 3 additions & 3 deletions ml_fpt/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Reflection;

[assembly: AssemblyTitle("FourPointTracking")]
[assembly: AssemblyVersion("1.0.8")]
[assembly: AssemblyFileVersion("1.0.8")]
[assembly: AssemblyVersion("1.0.9")]
[assembly: AssemblyFileVersion("1.0.9")]

[assembly: MelonLoader.MelonInfo(typeof(ml_fpt.FourPointTracking), "FourPointTracking", "1.0.8", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_fpt.FourPointTracking), "FourPointTracking", "1.0.9", "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)]
6 changes: 3 additions & 3 deletions ml_lme/GestureMatcher.cs
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public class GesturesData
public bool[] m_handsPresenses = null;
public Vector3[] m_handsPositons = null;
public Quaternion[] m_handsRotations = null;
public Vector3[] m_elbowPositions = null;
public Vector3[] m_elbowsPositions = null;
public float[] m_leftFingersBends = null;
public float[] m_leftFingersSpreads = null;
public float[] m_rightFingersBends = null;
@@ -33,7 +33,7 @@ public GesturesData()
m_handsPresenses = new bool[ms_handsCount];
m_handsPositons = new Vector3[ms_handsCount];
m_handsRotations = new Quaternion[ms_handsCount];
m_elbowPositions = new Vector3[ms_handsCount];
m_elbowsPositions = new Vector3[ms_handsCount];
m_leftFingersBends = new float[ms_fingersCount];
m_leftFingersSpreads = new float[ms_fingersCount];
m_rightFingersBends = new float[ms_fingersCount];
@@ -63,7 +63,7 @@ public static void GetGestures(Leap.Frame p_frame, ref GesturesData p_data)
p_data.m_handsPresenses[l_sideID] = true;
FillHandPosition(l_hand, ref p_data.m_handsPositons[l_sideID]);
FillHandRotation(l_hand, ref p_data.m_handsRotations[l_sideID]);
FillElbowPosition(l_hand, ref p_data.m_elbowPositions[l_sideID]);
FillElbowPosition(l_hand, ref p_data.m_elbowsPositions[l_sideID]);
switch(l_sideID)
{
case 0:
Loading

0 comments on commit fd48185

Please sign in to comment.