├── README.md
├── lib
├── 0Harmony.dll
├── BepInEx.Core.dll
├── BepInEx.IL2CPP.dll
├── BepInEx.dll
├── UnhollowerBaseLib.dll
├── mono
│ ├── UnityEngine.UI.dll
│ └── UnityEngine.dll
└── unhollowed
│ ├── Il2CppSystem.Core.dll
│ ├── Il2Cppmscorlib.dll
│ ├── UnityEngine.CoreModule.dll
│ ├── UnityEngine.IMGUIModule.dll
│ ├── UnityEngine.TextRenderingModule.dll
│ ├── UnityEngine.UI.dll
│ ├── UnityEngine.UIModule.dll
│ └── UnityEngine.dll
└── src
├── FreeMoveInjector.csproj
├── FreeMoveInjector.sln
├── FreeMoveInjectorPlugin.cs
├── Properties
└── AssemblyInfo.cs
└── packages.config
/README.md:
--------------------------------------------------------------------------------
1 | # FreeMoveInjector
2 |
3 | Builds BepInEx 5 mono and BepIn 6 Il2cpp plugins that add a Free Move behaviour
4 |
5 | Solution and Project configuration https://github.com/sinai-dev/BepInExConfigManager
6 |
7 | Movement and Rotation Code https://gist.github.com/FreyaHolmer/650ecd551562352120445513efa1d952
8 |
--------------------------------------------------------------------------------
/lib/0Harmony.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/0Harmony.dll
--------------------------------------------------------------------------------
/lib/BepInEx.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/BepInEx.Core.dll
--------------------------------------------------------------------------------
/lib/BepInEx.IL2CPP.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/BepInEx.IL2CPP.dll
--------------------------------------------------------------------------------
/lib/BepInEx.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/BepInEx.dll
--------------------------------------------------------------------------------
/lib/UnhollowerBaseLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/UnhollowerBaseLib.dll
--------------------------------------------------------------------------------
/lib/mono/UnityEngine.UI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/mono/UnityEngine.UI.dll
--------------------------------------------------------------------------------
/lib/mono/UnityEngine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/mono/UnityEngine.dll
--------------------------------------------------------------------------------
/lib/unhollowed/Il2CppSystem.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/Il2CppSystem.Core.dll
--------------------------------------------------------------------------------
/lib/unhollowed/Il2Cppmscorlib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/Il2Cppmscorlib.dll
--------------------------------------------------------------------------------
/lib/unhollowed/UnityEngine.CoreModule.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/UnityEngine.CoreModule.dll
--------------------------------------------------------------------------------
/lib/unhollowed/UnityEngine.IMGUIModule.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/UnityEngine.IMGUIModule.dll
--------------------------------------------------------------------------------
/lib/unhollowed/UnityEngine.TextRenderingModule.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/UnityEngine.TextRenderingModule.dll
--------------------------------------------------------------------------------
/lib/unhollowed/UnityEngine.UI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/UnityEngine.UI.dll
--------------------------------------------------------------------------------
/lib/unhollowed/UnityEngine.UIModule.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/UnityEngine.UIModule.dll
--------------------------------------------------------------------------------
/lib/unhollowed/UnityEngine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtvrv/FreeMoveInjector/8ed8a0173a8fbfe246ea9694bba6215c721f7577/lib/unhollowed/UnityEngine.dll
--------------------------------------------------------------------------------
/src/FreeMoveInjector.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {51308BD5-5872-4A72-85D2-6194673C8A5E}
8 | Library
9 | Properties
10 | FreeMoveInjector
11 | 512
12 | true
13 | 8.0
14 | true
15 |
16 |
17 |
18 |
19 |
20 |
21 | v4.7.2
22 | ..\Release\FreeMoveInjector.Il2Cpp\
23 | CPP
24 | FreeMoveInjector.Il2Cpp
25 | true
26 | x64
27 |
28 |
29 |
30 | v3.5
31 | ..\Release\FreeMoveInjector.Mono\
32 | MONO
33 | FreeMoveInjector.Mono
34 | false
35 | false
36 | x64
37 |
38 |
39 | FreeMoveInjector
40 |
41 |
42 |
43 | ..\lib\0Harmony.dll
44 | False
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | ..\lib\BepInEx.dll
57 | False
58 |
59 |
60 | ..\lib\mono\UnityEngine.dll
61 | False
62 |
63 |
64 | ..\lib\mono\UnityEngine.UI.dll
65 | False
66 |
67 |
68 | packages\UniverseLib.1.1.2\lib\net35\UniverseLib.Mono.dll
69 |
70 |
71 |
72 |
73 |
74 | packages\UniverseLib.1.1.2\lib\net472\UniverseLib.IL2CPP.dll
75 |
76 |
77 | ..\lib\BepInEx.Core.dll
78 | False
79 |
80 |
81 | ..\lib\BepInEx.IL2CPP.dll
82 | False
83 |
84 |
85 | ..\lib\UnhollowerBaseLib.dll
86 | False
87 |
88 |
89 | ..\lib\unhollowed\Il2Cppmscorlib.dll
90 | False
91 |
92 |
93 | ..\lib\unhollowed\Il2CppSystem.Core.dll
94 | False
95 |
96 |
97 | ..\lib\unhollowed\Il2Cppmscorlib.dll
98 | False
99 |
100 |
101 | ..\lib\unhollowed\Il2CppSystem.Core.dll
102 | False
103 |
104 |
105 | ..\lib\unhollowed\UnityEngine.CoreModule.dll
106 | False
107 |
108 |
109 | ..\lib\unhollowed\UnityEngine.TextRenderingModule.dll
110 | False
111 |
112 |
113 | ..\lib\unhollowed\UnityEngine.UI.dll
114 | False
115 |
116 |
117 | ..\lib\unhollowed\UnityEngine.UIModule.dll
118 | False
119 |
120 |
121 | ..\lib\unhollowed\UnityEngine.IMGUIModule.dll
122 | False
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/src/FreeMoveInjector.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31005.135
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeMoveInjector", "FreeMoveInjector.csproj", "{51308BD5-5872-4A72-85D2-6194673C8A5E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Release_IL2CPP|Any CPU = Release_IL2CPP|Any CPU
11 | Release_Mono|Any CPU = Release_Mono|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {51308BD5-5872-4A72-85D2-6194673C8A5E}.Release_IL2CPP|Any CPU.ActiveCfg = Release_IL2CPP|Any CPU
15 | {51308BD5-5872-4A72-85D2-6194673C8A5E}.Release_IL2CPP|Any CPU.Build.0 = Release_IL2CPP|Any CPU
16 | {51308BD5-5872-4A72-85D2-6194673C8A5E}.Release_Mono|Any CPU.ActiveCfg = Release_Mono|Any CPU
17 | {51308BD5-5872-4A72-85D2-6194673C8A5E}.Release_Mono|Any CPU.Build.0 = Release_Mono|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {C10D47E7-2C36-46A8-A9C9-2BC3541E43C1}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/src/FreeMoveInjectorPlugin.cs:
--------------------------------------------------------------------------------
1 | //Solution and Project configuration borrowed from
2 | //https://github.com/sinai-dev/BepInExConfigManager
3 |
4 | //Movement and Rotation Code
5 | //https://gist.github.com/FreyaHolmer/650ecd551562352120445513efa1d952
6 |
7 | using System;
8 | using BepInEx;
9 | using BepInEx.Configuration;
10 | using BepInEx.Logging;
11 | using UnityEngine;
12 | using UniverseLib.Input;
13 |
14 | namespace BehaviourInjector
15 | {
16 | [BepInPlugin("com.vtvrvxiv.FreeMoveInjector", "FreeMoveInjector", "1.0.0")]
17 | public class FreeMovePlugin
18 |
19 | #if MONO
20 | : BaseUnityPlugin
21 | #else
22 | : BepInEx.IL2CPP.BasePlugin
23 | #endif
24 | {
25 | public static ConfigEntry KB_MoveForward { get; private set; }
26 | public static ConfigEntry KB_MoveBackward { get; private set; }
27 | public static ConfigEntry KB_MoveLeft { get; private set; }
28 | public static ConfigEntry KB_MoveRight { get; private set; }
29 | public static ConfigEntry KB_MoveUp { get; private set; }
30 | public static ConfigEntry KB_MoveDown { get; private set; }
31 |
32 |
33 | public static ConfigEntry acceleration { get; private set; }
34 | public static ConfigEntry dampingCoefficient { get; private set; }
35 |
36 |
37 | public static ConfigEntry KB_IncreaseAcceleration { get; private set; }
38 | public static ConfigEntry KB_DecreaseAcceleration { get; private set; }
39 |
40 | public static ConfigEntry KB_IncreaseDampening { get; private set; }
41 | public static ConfigEntry KB_DecreaseDampening { get; private set; }
42 |
43 |
44 | public static ConfigEntry toggleMouse { get; private set; }
45 | public static ConfigEntry lookSensitivity { get; private set; }
46 |
47 | public static ConfigEntry swapMouseAxis { get; private set; }
48 | public static ConfigEntry invertMouseHorz { get; private set; }
49 | public static ConfigEntry invertMouseVert { get; private set; }
50 |
51 |
52 |
53 | #if MONO
54 | internal void Awake()
55 | {
56 | ConfigEntrySetup();
57 | }
58 |
59 | internal void Update()
60 | {
61 |
62 | }
63 | #else
64 | public override void Load()
65 | {
66 | UnhollowerRuntimeLib.ClassInjector.RegisterTypeInIl2Cpp();
67 | ConfigEntrySetup();
68 | }
69 | #endif
70 |
71 | private void ConfigEntrySetup()
72 | {
73 | acceleration = Config.Bind("Keyboard Movement", "acceleration", 300.0f, "how fast you accelerate");
74 | dampingCoefficient = Config.Bind("Keyboard Movement", "dampingCoefficient", 10.0f, "how quickly you break to a halt after you stop your input");
75 |
76 | KB_MoveForward = Config.Bind("Keyboard Movement", "Move Forward", KeyCode.I);
77 | KB_MoveBackward = Config.Bind("Keyboard Movement", "Move Backward", KeyCode.K);
78 | KB_MoveLeft = Config.Bind("Keyboard Movement", "Move Left", KeyCode.J);
79 | KB_MoveRight = Config.Bind("Keyboard Movement", "Move Right", KeyCode.L);
80 | KB_MoveUp = Config.Bind("Keyboard Movement", "Move Up", KeyCode.O);
81 | KB_MoveDown = Config.Bind("Keyboard Movement", "Move Down", KeyCode.U);
82 |
83 | KB_IncreaseAcceleration = Config.Bind("Keyboard Movement", "Increase Acceleration", KeyCode.RightBracket);
84 | KB_DecreaseAcceleration = Config.Bind("Keyboard Movement", "Decrease Acceleration", KeyCode.LeftBracket);
85 |
86 | KB_IncreaseDampening = Config.Bind("Keyboard Movement", "Increase Dampening", KeyCode.Quote);
87 | KB_DecreaseDampening = Config.Bind("Keyboard Movement", "Decrease Dampening", KeyCode.Semicolon);
88 |
89 | swapMouseAxis = Config.Bind("Mouse Look", "Swap Mouse Axes", false);
90 | invertMouseHorz = Config.Bind("Mouse Look", "Invert Horizontal Mouse Movement", false);
91 | invertMouseVert = Config.Bind("Mouse Look", "Invert Vertical Mouse Movement", false);
92 |
93 | toggleMouse = Config.Bind("Mouse Look", "Toggle", MouseToggle.Left_Mouse_Button);
94 | lookSensitivity = Config.Bind("Mouse Look", "look Sensitivity", 0.5f);
95 | }
96 | }
97 |
98 |
99 | public enum MouseToggle
100 | {
101 | Left_Mouse_Button = 0,
102 | Right_Mouse_Button = 1,
103 | Middle_Mouse_Button = 2,
104 | Mouse_4 = 3,
105 | Mouse_5 = 4,
106 | Always_On = 10,
107 | Always_Off = 11
108 | }
109 |
110 |
111 | public class FreeMove : MonoBehaviour
112 | {
113 | private Vector3 prevMouse = Vector3.zero;
114 | internal static FreeMove Instance { get; private set; }
115 |
116 | internal void Start()
117 | {
118 | UnityEngine.Debug.Log("FreeMoveInjector Starting...");
119 | }
120 |
121 | Vector3 velocity; // current velocity
122 |
123 | #if CPP
124 | public FreeMove(IntPtr ptr) : base(ptr) { }
125 | #endif
126 | internal void Update()
127 | {
128 | // Input
129 | UpdateInput();
130 |
131 | // Physics
132 | velocity = Vector3.Lerp(velocity, Vector3.zero, FreeMovePlugin.dampingCoefficient.Value * 0.01665f); //"0.01665f" (60fps) in place of Time.DeltaTime. DeltaTime causes issues when game is paused.
133 | base.gameObject.transform.position += velocity * 0.01665f; //"0.01665f" in place of Time.DeltaTime.
134 | }
135 |
136 | void UpdateInput()
137 | {
138 | //some hotkeys
139 | if (InputManager.GetKey(FreeMovePlugin.KB_IncreaseAcceleration.Value))
140 | FreeMovePlugin.acceleration.Value *= 1.1f;
141 | if (InputManager.GetKey(FreeMovePlugin.KB_DecreaseAcceleration.Value))
142 | FreeMovePlugin.acceleration.Value *= 0.9f;
143 |
144 | if (InputManager.GetKey(FreeMovePlugin.KB_IncreaseDampening.Value))
145 | FreeMovePlugin.dampingCoefficient.Value *= 1.05f;
146 | if (InputManager.GetKey(FreeMovePlugin.KB_DecreaseDampening.Value))
147 | FreeMovePlugin.dampingCoefficient.Value *= 0.95f;
148 |
149 | //hacky mouse input.
150 | //GetAxis() causes problems with games that use custom axis names
151 | Vector3 mousePos = InputManager.MousePosition;
152 | Vector3 mouseDelta = (mousePos - prevMouse) * FreeMovePlugin.lookSensitivity.Value;
153 | prevMouse = mousePos;
154 |
155 | // Rotation
156 | if (InputManager.GetMouseButton((int)FreeMovePlugin.toggleMouse.Value)
157 | || FreeMovePlugin.toggleMouse.Value == MouseToggle.Always_On)
158 | {
159 | if (FreeMovePlugin.invertMouseHorz.Value)
160 | mouseDelta.x = -mouseDelta.x;
161 | if (FreeMovePlugin.invertMouseVert.Value)
162 | mouseDelta.y = -mouseDelta.y;
163 | if (FreeMovePlugin.swapMouseAxis.Value)
164 | mouseDelta = new Vector3(mouseDelta.y, mouseDelta.x, mouseDelta.z);
165 |
166 | // Rotation; Does anyone know how I can make this smooth?
167 | Quaternion rotation = transform.rotation;
168 | Quaternion horiz = Quaternion.AngleAxis(mouseDelta.x, Vector3.up);
169 | Quaternion vert = Quaternion.AngleAxis(-mouseDelta.y, Vector3.right);
170 | transform.rotation = horiz * rotation * vert;
171 | }
172 |
173 | // Position
174 | velocity += GetAccelerationVector() * 0.01665f; //"0.01665f" in place of Time.DeltaTime
175 | }
176 |
177 | Vector3 GetAccelerationVector()
178 | {
179 | Vector3 moveInput = default;
180 |
181 | void AddMovement(KeyCode key, Vector3 dir)
182 | {
183 | if (InputManager.GetKey(key))
184 | moveInput += dir;
185 | }
186 |
187 | AddMovement(FreeMovePlugin.KB_MoveForward.Value, Vector3.forward);
188 | AddMovement(FreeMovePlugin.KB_MoveBackward.Value, Vector3.back);
189 | AddMovement(FreeMovePlugin.KB_MoveRight.Value, Vector3.right);
190 | AddMovement(FreeMovePlugin.KB_MoveLeft.Value, Vector3.left);
191 | AddMovement(FreeMovePlugin.KB_MoveUp.Value, Vector3.up);
192 | AddMovement(FreeMovePlugin.KB_MoveDown.Value, Vector3.down);
193 | Vector3 direction = transform.TransformVector(moveInput.normalized);
194 |
195 | return direction * FreeMovePlugin.acceleration.Value;
196 | }
197 | }
198 | }
--------------------------------------------------------------------------------
/src/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("FreeMoveInjector")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("FreeMoveInjector")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("51308bd5-5872-4a72-85d2-6194673c8a5f")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------