Skip to content

Commit

Permalink
Too many changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SDraw committed Oct 5, 2024
1 parent 4555794 commit a22e599
Show file tree
Hide file tree
Showing 72 changed files with 1,052 additions and 915 deletions.
36 changes: 13 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
Merged set of MelonLoader mods for ChilloutVR.

**Table for game build 2023r175:**
| Full name | Short name | Latest version |
|:---------:|:----------:|:--------------:|
| [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.4.1 [:arrow_down:](../../releases/latest/download/ml_amt.dll)|
| [Avatar Synced Look](/ml_asl/README.md) | ml_asl | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_asl.dll)|
| [Better Fingers Tracking](/ml_bft/README.md) | ml_bft | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_bft.dll)|
| [Desktop Head Tracking](/ml_dht/README.md) | ml_dht | 1.2.5 [:arrow_down:](../../releases/latest/download/ml_dht.dll)|
| [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.5.2 [:arrow_down:](../../releases/latest/download/ml_lme.dll)|
| [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.1.4 [:arrow_down:](../../releases/latest/download/ml_pam.dll)|
| [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)|
| [Player Ragdoll Mod](/ml_prm/README.md) | ml_prm | 1.1.9 [:arrow_down:](../../releases/latest/download/ml_prm.dll)|
| [Players Instance Notifier](/ml_pin/README.md) | ml_pin | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)|
| [Vive Extended Input](/ml_vei/README.md) | ml_vei | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_vei.dll)|

**Archived mods:**
| Full name | Short name | Notes |
|:---------:|:----------:|-------|
| Avatar Change Info | ml_aci | Superseded by `Extended Game Notifications` |
| Desktop Reticle Switch | ml_drs | Boring functionality |
| Extended Game Notifications | ml_egn | In-game feature since 2023r172 update |
| Four Point Tracking | ml_fpt | In-game feature since 2022r170 update |
| Game Main Fixes | ml_gmf | In-game feature since 2023r172 update |
| Server Connection Info | ml_sci | Superseded by `Extended Game Notifications`
**Table for game build 2023r177:**
| Full name | Latest version |
|:---------:|:--------------:|
|[Avatar Motion Tweaker](/ml_amt/README.md)|1.5.0 [:arrow_down:](../../releases/latest/download/ml_amt.dll)|
|[Avatar Synced Look](/ml_asl/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/ml_asl.dll)|
|[Better Fingers Tracking](/ml_bft/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/ml_bft.dll)|
|[Desktop Head Tracking](/ml_dht/README.md)|1.3.0 [:arrow_down:](../../releases/latest/download/ml_dht.dll)|
|[Leap Motion Extension](/ml_lme/README.md)| 1.6.0 [:arrow_down:](../../releases/latest/download/ml_lme.dll)|
|[Pickup Arm Movement](/ml_pam/README.md)|1.2.0 [:arrow_down:](../../releases/latest/download/ml_pam.dll)|
|[Player Movement Copycat](/ml_pmc/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)|
|[Player Ragdoll Mod](/ml_prm/README.md)|1.2.0 [:arrow_down:](../../releases/latest/download/ml_prm.dll)|
|[Players Instance Notifier](/ml_pin/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)|
|[Vive Extended Input](/ml_vei/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/ml_vei.dll)|
42 changes: 28 additions & 14 deletions ml_amt/MotionTweaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ml_amt
[DisallowMultipleComponent]
class MotionTweaker : MonoBehaviour
{
struct IKState
struct IKInfo
{
public float m_weight;
public float m_locomotionWeight;
Expand All @@ -20,7 +20,9 @@ struct IKState
public bool m_bendNormalRight;
}

IKState m_ikState;
static MotionTweaker ms_instance = null;

IKInfo m_ikInfo;
VRIK m_vrIk = null;
float m_avatarScale = 1f;
Vector3 m_locomotionOffset = Vector3.zero; // Original locomotion offset
Expand All @@ -37,10 +39,19 @@ internal MotionTweaker()
}

// Unity events
void Start()
void Awake()
{
DontDestroyOnLoad(this);
if(ms_instance != null)
{
DestroyImmediate(this);
return;
}

ms_instance = this;
DontDestroyOnLoad(this);
}
void Start()
{
OnCrouchLimitChanged(Settings.CrouchLimit);
OnProneLimitChanged(Settings.ProneLimit);

Expand All @@ -56,6 +67,9 @@ void Start()

void OnDestroy()
{
if(ms_instance == this)
ms_instance = null;

m_vrIk = null;
m_ikLimits = null;
m_parameters.Clear();
Expand Down Expand Up @@ -170,11 +184,11 @@ void OnAvatarReuse()
// IK events
void OnIKPreSolverUpdate()
{
m_ikState.m_weight = m_vrIk.solver.IKPositionWeight;
m_ikState.m_locomotionWeight = m_vrIk.solver.locomotion.weight;
m_ikState.m_plantFeet = m_vrIk.solver.plantFeet;
m_ikState.m_bendNormalLeft = m_vrIk.solver.leftLeg.useAnimatedBendNormal;
m_ikState.m_bendNormalRight = m_vrIk.solver.rightLeg.useAnimatedBendNormal;
m_ikInfo.m_weight = m_vrIk.solver.IKPositionWeight;
m_ikInfo.m_locomotionWeight = m_vrIk.solver.locomotion.weight;
m_ikInfo.m_plantFeet = m_vrIk.solver.plantFeet;
m_ikInfo.m_bendNormalLeft = m_vrIk.solver.leftLeg.useAnimatedBendNormal;
m_ikInfo.m_bendNormalRight = m_vrIk.solver.rightLeg.useAnimatedBendNormal;

if(!BodySystem.isCalibratedAsFullBody)
{
Expand All @@ -200,11 +214,11 @@ void OnIKPreSolverUpdate()

void OnIKPostSolverUpdate()
{
m_vrIk.solver.IKPositionWeight = m_ikState.m_weight;
m_vrIk.solver.locomotion.weight = m_ikState.m_locomotionWeight;
m_vrIk.solver.plantFeet = m_ikState.m_plantFeet;
m_vrIk.solver.leftLeg.useAnimatedBendNormal = m_ikState.m_bendNormalLeft;
m_vrIk.solver.rightLeg.useAnimatedBendNormal = m_ikState.m_bendNormalRight;
m_vrIk.solver.IKPositionWeight = m_ikInfo.m_weight;
m_vrIk.solver.locomotion.weight = m_ikInfo.m_locomotionWeight;
m_vrIk.solver.plantFeet = m_ikInfo.m_plantFeet;
m_vrIk.solver.leftLeg.useAnimatedBendNormal = m_ikInfo.m_bendNormalLeft;
m_vrIk.solver.rightLeg.useAnimatedBendNormal = m_ikInfo.m_bendNormalRight;
}

// Settings
Expand Down
5 changes: 3 additions & 2 deletions ml_amt/ResourcesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ namespace ml_amt
{
static class ResourcesHandler
{
readonly static string ms_namespace = typeof(ResourcesHandler).Namespace;

public static string GetEmbeddedResource(string p_name)
{
string l_result = "";
Assembly l_assembly = Assembly.GetExecutingAssembly();
string l_assemblyName = l_assembly.GetName().Name;

try
{
Stream l_libraryStream = l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + p_name);
Stream l_libraryStream = l_assembly.GetManifestResourceStream(ms_namespace + ".resources." + p_name);
StreamReader l_streadReader = new StreamReader(l_libraryStream);
l_result = l_streadReader.ReadToEnd();
}
Expand Down
14 changes: 0 additions & 14 deletions ml_amt/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@ static class Utils

public static bool HasToes(this IKSolverVR p_instance) => (bool)ms_hasToes.GetValue(p_instance);

public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
public static float GetWorldMovementLimit()
{
float l_result = 1f;
if(CVRWorld.Instance != null)
{
l_result = CVRWorld.Instance.baseMovementSpeed;
l_result *= CVRWorld.Instance.sprintMultiplier;
l_result *= CVRWorld.Instance.inAirMovementMultiplier;
l_result *= CVRWorld.Instance.flyMultiplier;
}
return l_result;
}

public static void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);

public static void SetAvatarTPose()
Expand Down
2 changes: 1 addition & 1 deletion ml_amt/ml_amt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Company>SDraw</Company>
<Product>AvatarMotionTweaker</Product>
<PackageId>AvatarMotionTweaker</PackageId>
<Version>1.4.2</Version>
<Version>1.5.0</Version>
<Platforms>x64</Platforms>
<AssemblyName>AvatarMotionTweaker</AssemblyName>
</PropertyGroup>
Expand Down
10 changes: 10 additions & 0 deletions ml_asl/Main.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using ABI_RC.Core.Player;
using System.Reflection;
using UnityEngine;

namespace ml_asl
{
public class AvatarSyncedLook : MelonLoader.MelonMod
{
readonly static Matrix4x4 ms_back = Matrix4x4.Translate(Vector3.back);

public override void OnInitializeMelon()
{
Settings.Init();
Expand All @@ -19,7 +22,14 @@ public override void OnInitializeMelon()
static void OnPlayerAvatarMovementDataUpdate_Postfix(ref PlayerSetup __instance, PlayerAvatarMovementData ____playerAvatarMovementData)
{
if(Settings.Enabled && (__instance.EyeMovementController != null))
{
____playerAvatarMovementData.EyeTrackingOverride = true;

if(__instance.EyeMovementController.CurrentTarget != null)
____playerAvatarMovementData.EyeTrackingPosition = __instance.EyeMovementController.CurrentTarget.GetPosition();
else
____playerAvatarMovementData.EyeTrackingPosition = (__instance.transform.GetMatrix() * ms_back).GetPosition();
}
}
}
}
2 changes: 1 addition & 1 deletion ml_asl/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_asl.AvatarSyncedLook), "AvatarSyncedLook", "1.0.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_asl.AvatarSyncedLook), "AvatarSyncedLook", "1.1.0", "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)]
7 changes: 2 additions & 5 deletions ml_asl/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Avatar Synced Look
This mod Forces local player's eyes look direction to be synced for remote players.
This mod forces local player's eyes look direction to be synced for remote players.

# Installation
* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader)
* Get [latest release DLL](../../../releases/latest):
* Put `ml_asl.dll` in `Mods` folder of game
* Put `AvatarSyncedLook.dll` in `Mods` folder of game

# Usage
Available mod's settings in `Settings - Interactions - Avatar Synced Look`:
* **Enabled:** sets eyes look direction to be synced or locally generated on remote users side; `true` by default.

# Notes
* Remote users with [EyeMovementFix](https://github.com/kafeijao/Kafe_CVR_Mods/tree/master/EyeMovementFix) installed can't see synced look direction.
5 changes: 3 additions & 2 deletions ml_asl/ResourcesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ namespace ml_asl
{
static class ResourcesHandler
{
readonly static string ms_namespace = typeof(ResourcesHandler).Namespace;

public static string GetEmbeddedResource(string p_name)
{
string l_result = "";
Assembly l_assembly = Assembly.GetExecutingAssembly();
string l_assemblyName = l_assembly.GetName().Name;

try
{
Stream l_libraryStream = l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + p_name);
Stream l_libraryStream = l_assembly.GetManifestResourceStream(ms_namespace + ".resources." + p_name);
StreamReader l_streadReader = new StreamReader(l_libraryStream);
l_result = l_streadReader.ReadToEnd();
}
Expand Down
7 changes: 7 additions & 0 deletions ml_asl/Utils.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ABI_RC.Core.UI;
using System.Reflection;
using UnityEngine;

namespace ml_asl
{
Expand All @@ -8,5 +9,11 @@ static class Utils
static readonly FieldInfo ms_view = typeof(CohtmlControlledViewWrapper).GetField("_view", BindingFlags.NonPublic | BindingFlags.Instance);

public static void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);

// Extensions
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
{
return Matrix4x4.TRS(p_pos ? p_transform.position : Vector3.zero, p_rot ? p_transform.rotation : Quaternion.identity, p_scl ? p_transform.localScale : Vector3.one);
}
}
}
10 changes: 8 additions & 2 deletions ml_asl/ml_asl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<Platforms>x64</Platforms>
<PackageId>AvatarSyncedLook</PackageId>
<Authors>SDraw</Authors>
<Company>None</Company>
<Company>SDraw</Company>
<Product>AvatarSyncedLook</Product>
<Version>1.0.4</Version>
<Version>1.1.0</Version>
<AssemblyName>AvatarSyncedLook</AssemblyName>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down Expand Up @@ -50,6 +51,11 @@
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
<Reference Include="UnityEngine">
<HintPath>D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll</HintPath>
<SpecificVersion>false</SpecificVersion>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
Expand Down
8 changes: 4 additions & 4 deletions ml_bft/AssetsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ namespace ml_bft
{
static class AssetsHandler
{
readonly static string ms_namespace = typeof(AssetsHandler).Namespace;

static readonly List<string> ms_assets = new List<string>()
{
"ovr_fingers.asset",
"oxr_fingers.asset"
"ovr_fingers.asset"
};

static readonly Dictionary<string, AssetBundle> ms_loadedAssets = new Dictionary<string, AssetBundle>();
Expand All @@ -19,13 +20,12 @@ static class AssetsHandler
public static void Load()
{
Assembly l_assembly = Assembly.GetExecutingAssembly();
string l_assemblyName = l_assembly.GetName().Name;

foreach(string l_assetName in ms_assets)
{
try
{
Stream l_assetStream = l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + l_assetName);
Stream l_assetStream = l_assembly.GetManifestResourceStream(ms_namespace + ".resources." + l_assetName);
if(l_assetStream != null)
{
MemoryStream l_memorySteam = new MemoryStream((int)l_assetStream.Length);
Expand Down
Loading

0 comments on commit a22e599

Please sign in to comment.