Skip to content

Commit 4a98081

Browse files
committed
Pre-Release Version 0.11
1 parent db8e10b commit 4a98081

15 files changed

Lines changed: 1210 additions & 340 deletions

ButtJiggle.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32922.545
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ButtJiggle", "ButtJiggle\ButtJiggle.csproj", "{21D55085-3997-4A44-B09B-2B1735CA6D2A}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.Configuration.Json", "..\BepInEx.Configuration.Json\BepInEx.Configuration.Json\BepInEx.Configuration.Json.csproj", "{FF4B6D69-D118-4506-B65E-DB55555F7F13}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
1517
{21D55085-3997-4A44-B09B-2B1735CA6D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{21D55085-3997-4A44-B09B-2B1735CA6D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{21D55085-3997-4A44-B09B-2B1735CA6D2A}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{FF4B6D69-D118-4506-B65E-DB55555F7F13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{FF4B6D69-D118-4506-B65E-DB55555F7F13}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{FF4B6D69-D118-4506-B65E-DB55555F7F13}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{FF4B6D69-D118-4506-B65E-DB55555F7F13}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

ButtJiggle/BoneMorph_Patch.cs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,35 @@ internal static class BoneMorph_Patch
99
[HarmonyPrefix, HarmonyPatch(nameof(BoneMorph_.Blend))]
1010
static void Blend_Prefix(BoneMorph_ __instance)
1111
{
12-
if (!__instance.m_tbSkin.body.TryGetHipHelpers(out var jbhHipL, out var jbhHipR)) return;
12+
// Copy helper's transform so we can see if it gets changed
1313

14-
// Copy helper's transform so we can see if it get's changed
15-
jbhHipL.CopyLocalTransformToBone();
16-
jbhHipR.CopyLocalTransformToBone();
14+
if (__instance.m_tbSkin.body.TryGetHipHelpers(out var jbhHipL, out var jbhHipR))
15+
{
16+
jbhHipL.CheckForChanges();
17+
jbhHipR.CheckForChanges();
18+
}
1719

18-
jbhHipL.IsChangeCheck = true;
19-
jbhHipR.IsChangeCheck = true;
20+
if (__instance.m_tbSkin.body.TryGetPelvisHelper(out var jbhPelvis))
21+
{
22+
jbhPelvis.CheckForChanges();
23+
}
2024
}
2125

2226
[HarmonyPostfix, HarmonyPatch(nameof(BoneMorph_.Blend))]
2327
static void Blend_Postfix(BoneMorph_ __instance)
2428
{
25-
if (!__instance.m_tbSkin.body.TryGetHipHelpers(out var jbhHipL, out var jbhHipR)) return;
26-
2729
// Copy the bones's transform and any changes back to the helper
28-
jbhHipL.CopyLocalTransformFromBone();
29-
jbhHipR.CopyLocalTransformFromBone();
30+
31+
if (__instance.m_tbSkin.body.TryGetHipHelpers(out var jbhHipL, out var jbhHipR))
32+
{
33+
jbhHipL.ApplyChanges();
34+
jbhHipR.ApplyChanges();
35+
}
36+
37+
if (__instance.m_tbSkin.body.TryGetPelvisHelper(out var jbhPelvis))
38+
{
39+
jbhPelvis.ApplyChanges();
40+
}
3041
}
3142
}
3243
}

ButtJiggle/ButtJiggle.cs

Lines changed: 97 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
using BepInEx;
22
using BepInEx.Configuration;
3+
using BepInEx.Configuration.Json;
34
using BepInEx.Logging;
45
using HarmonyLib;
5-
using MaidStatus;
6-
using PrivateMaidMode;
7-
using RootMotion;
6+
using Newtonsoft.Json;
87
using System;
9-
using System.Collections;
108
using System.Collections.Generic;
11-
using System.Linq;
9+
using System.IO;
1210
using System.Reflection;
1311
using System.Security;
1412
using System.Security.Permissions;
15-
using System.Text;
1613
using UnityEngine;
17-
using UnityEngine.SceneManagement;
18-
using UnityEngine.UI;
19-
using UniverseLib;
20-
using UniverseLib.Input;
21-
using UniverseLib.UI;
14+
using UnityEngine.Events;
15+
using static Newtonsoft.Json.JsonToken;
16+
2217

2318

2419
// If there are errors in the above using statements, restore the NuGet packages:
@@ -39,8 +34,9 @@
3934

4035
// This is the major & minor version with an asterisk (*) appended to auto increment numbers.
4136
[assembly: AssemblyVersion(COM3D2.ButtJiggle.PluginInfo.PLUGIN_VERSION + ".*")]
37+
[assembly: AssemblyFileVersion(COM3D2.ButtJiggle.PluginInfo.PLUGIN_VERSION)]
4238

43-
// These two lines tell your plugin to not give a flying fuck about accessing private variables/classes whatever.
39+
// These two lines tell your plugin to not give a flying flip about accessing private variables/classes whatever.
4440
// It requires a publicized stubb of the library with those private objects though.
4541
[module: UnverifiableCode]
4642
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
@@ -55,7 +51,7 @@ public static class PluginInfo
5551
// The name of this plugin.
5652
public const string PLUGIN_NAME = "Butt Jiggle";
5753
// The version of this plugin.
58-
public const string PLUGIN_VERSION = "0.7";
54+
public const string PLUGIN_VERSION = "0.11";
5955
}
6056
}
6157

@@ -76,51 +72,126 @@ public sealed partial class ButtJiggle : BaseUnityPlugin
7672
private ManualLogSource _Logger => base.Logger;
7773

7874
internal static ConfigEntry<KeyboardShortcut> UIHotkey;
75+
76+
77+
internal static ConfigEntry<double> ButtJiggle_ConfigVersion;
78+
7979
internal static ConfigEntry<bool> ButtJiggle_Enabled;
80-
internal static ConfigEntry<float> ButtJiggle_DefaultSoftness;
80+
internal static ConfigEntry<float> ButtJiggle_DefaultSoftness_Hip;
81+
internal static ConfigEntry<float> ButtJiggle_DefaultSoftness_Pelvis;
82+
83+
//internal static ConfigEntry<bool> Experimental_PelvisEnabled;
84+
85+
internal static ConfigEntry<bool> GlobalOverride_Enabled;
86+
internal static ConfigEntry<string> GlobalOverride_Json;
87+
internal static ConfigEntryJson<MaidJiggleOverride> GlobalOverride_Settings;
88+
89+
public UnityEvent OnGlobalOverrideUpdated;
8190

8291
void Awake()
8392
{
8493
// Useful for engaging coroutines or accessing non-static variables. Completely optional though.
8594
Instance = this;
8695

8796
// Binds the configuration. In other words it sets your ConfigEntry var to your config setup.
88-
ButtJiggle_Enabled = Config.Bind("Butt Jiggle", "Enabled" , true, "Description");
89-
ButtJiggle_DefaultSoftness = Config.Bind("Butt Jiggle", "DefaultSoftness", 0.5f, "Description");
97+
ButtJiggle_ConfigVersion = Config.Bind("ButtJiggle", "ConfigVersion", 0.0, new ConfigDescription(
98+
"Do not change this",
99+
null,
100+
new ConfigurationManagerAttributes()
101+
{
102+
IsAdvanced = true,
103+
ReadOnly = true,
104+
}
105+
));
106+
107+
ButtJiggle_Enabled = Config.Bind("ButtJiggle", "Enabled", true);
108+
ButtJiggle_DefaultSoftness_Hip = Config.Bind("ButtJiggle", "DefaultSoftness.Hip" , MaidJiggleOverride.Default.HipOverride.Softness.Value);
109+
ButtJiggle_DefaultSoftness_Pelvis = Config.Bind("ButtJiggle", "DefaultSoftness.Pelvis", MaidJiggleOverride.Default.PelvisOverride.Softness.Value);
110+
if (ButtJiggle_ConfigVersion.Value < 1.11)
111+
{
112+
ButtJiggle_DefaultSoftness_Pelvis.Value = MaidJiggleOverride.Default.PelvisOverride.Softness.Value;
113+
}
114+
115+
//Experimental_PelvisEnabled = Config.Bind("Experimental", "PelvisEnabled", false);
116+
117+
118+
ConfigBindGlobalOverride();
90119

91120
// Add the keybind
92121
KeyboardShortcut hotkey = new KeyboardShortcut(KeyCode.A, KeyCode.LeftControl);
93-
UIHotkey = Config.Bind("UI", "Toggle", hotkey, "Recomend using Ctrl A for 'Ass'");
122+
UIHotkey = Config.Bind("UI", "Toggle", hotkey, "Recommend using Ctrl A for 'Ass'");
94123

95-
Logger.LogInfo("Patching ButtJiggle");
124+
ButtJiggle_ConfigVersion.Value = double.Parse(PluginInfo.PLUGIN_VERSION);
125+
126+
Logger.LogDebug("Patching ButtJiggle");
96127
Harmony.CreateAndPatchAll(typeof(ButtJiggle));
97128

98-
Logger.LogInfo("Patching TBodyPatch");
129+
Logger.LogDebug("Patching TBodyPatch");
99130
Harmony.CreateAndPatchAll(typeof(TBodyPatch));
100131

101-
Logger.LogInfo("Patching BoneMorph_Patch");
132+
Logger.LogDebug("Patching BoneMorph_Patch");
102133
Harmony.CreateAndPatchAll(typeof(BoneMorph_Patch));
103134

104-
Logger.LogInfo("Finished patching");
135+
Logger.LogDebug("Finished patching");
105136
}
106137

107138
void Start()
108139
{
109140
Universe_Init();
110141
}
111142

112-
private bool m_IsHotkeyHandled = false;
113143
void Update()
114144
{
115-
if (UIHotkey.Value.IsDown() && !m_IsHotkeyHandled)
145+
if (UIHotkey.Value.IsDown())
116146
{
117147
ToggleUI();
118-
m_IsHotkeyHandled = true;
119148
}
120-
else if (UIHotkey.Value.IsUp())
149+
}
150+
151+
private void ConfigBindGlobalOverride()
152+
{
153+
if (GlobalOverride_Enabled != null) return;
154+
155+
string defaultJson = SerializeGlobalOverride();
156+
157+
GlobalOverride_Enabled = Config.Bind("GlobalOverride", "Enabled", false , "Enable global override of jiggle settings");
158+
//GlobalOverride_Json = Config.Bind("Global Override", "Json" , defaultJson, "The jiggle settings in JSON format" );
159+
GlobalOverride_Settings = Config.BindJson("GlobalOverride", "Settings", MaidJiggleOverride.Default, "The settings used for the global override");
160+
161+
if (ButtJiggle_ConfigVersion.Value < 1.11)
121162
{
122-
m_IsHotkeyHandled = false;
163+
GlobalOverride_Settings.Value = MaidJiggleOverride.Default;
123164
}
165+
166+
JiggleBoneHelper.UseGlobalOverride = GlobalOverride_Enabled.Value;
167+
JiggleBoneHelper.GlobalOverride = GlobalOverride_Settings.Value;
168+
169+
GlobalOverride_Enabled.SettingChanged += delegate (object sender, EventArgs eventArgs)
170+
{
171+
JiggleBoneHelper.UseGlobalOverride = GlobalOverride_Enabled.Value;
172+
OnGlobalOverrideUpdated.Invoke();
173+
};
174+
GlobalOverride_Settings.SettingChanged += delegate (object sender, EventArgs eventArgs)
175+
{
176+
JiggleBoneHelper.GlobalOverride = GlobalOverride_Settings.Value;
177+
OnGlobalOverrideUpdated.Invoke();
178+
};
179+
}
180+
181+
public static void ConfigSaveGlobalOverride()
182+
{
183+
Logger.LogDebug("ConfigSaveGlobalOverride");
184+
GlobalOverride_Enabled .Value = JiggleBoneHelper.UseGlobalOverride;
185+
//GlobalOverride_Json .Value = SerializeGlobalOverride();
186+
GlobalOverride_Settings.Value = JiggleBoneHelper.GlobalOverride;
187+
}
188+
189+
private static string SerializeGlobalOverride()
190+
{
191+
JsonSerializer serializer = new JsonSerializer();
192+
StringWriter writer = new StringWriter();
193+
serializer.Serialize(writer, JiggleBoneHelper.GlobalOverride);
194+
return writer.ToString();
124195
}
125196
}
126197
}

ButtJiggle/ButtJiggle.csproj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
<PackageReference Include="Mono.Cecil" Version="0.10.4" targetFramework="net35" />
5050
<PackageReference Include="MonoMod.RuntimeDetour" Version="21.12.13.1" targetFramework="net35" />
5151
<PackageReference Include="MonoMod.Utils" Version="21.12.13.1" targetFramework="net35" />
52-
<PackageReference Include="UniverseLib.Analyzers" Version="1.0.3" targetFramework="net35" developmentDependency="true">
52+
<PackageReference Include="UniverseLib.Analyzers" Version="1.0.4" targetFramework="net35" developmentDependency="true">
5353
<PrivateAssets>all</PrivateAssets>
5454
</PackageReference>
55-
<PackageReference Include="UniverseLib.Mono" Version="1.3.3" targetFramework="net35" />
55+
<PackageReference Include="UniverseLib.Mono" Version="1.5.1" targetFramework="net35" />
5656
</ItemGroup>
5757
<ItemGroup>
5858
<Reference Include="System">
@@ -81,17 +81,29 @@
8181
</PropertyGroup>
8282
<ItemGroup>
8383
<Compile Include="ButtJiggleUI.cs" />
84+
<Compile Include="ConfigurationManagerAttributes.cs" />
8485
<Compile Include="JiggleBoneHelper.cs" />
8586
<Compile Include="BoneMorph_Patch.cs" />
8687
<Compile Include="JiggleBoneOverride.cs" />
88+
<Compile Include="MaidJiggleOverride.cs" />
89+
<Compile Include="Override.cs" />
8790
<Compile Include="Properties\AssemblyInfo.cs" />
8891
<Compile Include="ButtJiggle.cs" />
92+
<Compile Include="UnityRuntimeGizmos.cs" />
8993
<Compile Include="SphereRenderer.cs" />
94+
<Compile Include="Stiffness.cs" />
9095
<Compile Include="TBodyPatch.cs" />
96+
<Compile Include="UIControlFactory.cs" />
9197
</ItemGroup>
9298
<ItemGroup>
9399
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
94100
</ItemGroup>
101+
<ItemGroup>
102+
<ProjectReference Include="..\..\BepInEx.Configuration.Json\BepInEx.Configuration.Json\BepInEx.Configuration.Json.csproj">
103+
<Project>{ff4b6d69-d118-4506-b65e-db55555f7f13}</Project>
104+
<Name>BepInEx.Configuration.Json</Name>
105+
</ProjectReference>
106+
</ItemGroup>
95107
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
96108
<PropertyGroup>
97109
<PostBuildEvent>

0 commit comments

Comments
 (0)