mirror of
https://github.com/originalnicodr/CinematicUnityExplorer.git
synced 2025-07-19 01:57:56 +08:00
Compare commits
5 Commits
1.0.0
...
controller
Author | SHA1 | Date | |
---|---|---|---|
1664294113 | |||
2b493d8ec0 | |||
1d59cd39ce | |||
250dec1f88 | |||
f58f3c2cee |
14
README.md
14
README.md
@ -115,6 +115,20 @@ Frameskip | `PageDown`
|
||||
HUD Toggle | `Delete`
|
||||
Freeze NPC animations | `Numpad 0`
|
||||
|
||||
The mod also allows controller input.
|
||||
|
||||
Feature | Key
|
||||
-|-
|
||||
Move the camera forward/left/right/backward | `Left stick`
|
||||
Move the camera upwards/downwards | `Left trigger`/`Right trigger`
|
||||
Speed up/down movement | `Y`/`X`
|
||||
Change freecam orientation | `Right stick`
|
||||
Tilt left/right | `Dpad left`/`Dpad right`
|
||||
Increase/Decrease FOV | `Dpad up`/`Dpad down`
|
||||
Reset FOV | `B`
|
||||
|
||||
Do keep in mind that controller support has yet to block the game's input, which only works for mouse and keyboard as of the time of writing.
|
||||
|
||||
# Features
|
||||
|
||||
The following are the features I developed for this fork. All focused on making things easier for capture artists to get marketing material for studios.
|
||||
|
BIN
UnityEditorPackage/Runtime/SharpDX.DirectInput.dll
Normal file
BIN
UnityEditorPackage/Runtime/SharpDX.DirectInput.dll
Normal file
Binary file not shown.
BIN
UnityEditorPackage/Runtime/SharpDX.dll
Normal file
BIN
UnityEditorPackage/Runtime/SharpDX.dll
Normal file
Binary file not shown.
48
build.ps1
48
build.ps1
@ -7,13 +7,15 @@ cd ..
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_ML_Cpp_net6preview
|
||||
$Path = "Release\CinematicUnityExplorer.MelonLoader.IL2CPP.net6preview"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net6 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.IL2CPP.net6preview.dll $Path/CinematicUnityExplorer.ML.IL2CPP.net6preview.dll $Path/mcs.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net6 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.IL2CPP.net6preview.dll $Path/CinematicUnityExplorer.ML.IL2CPP.net6preview.dll $Path/mcs.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/CinematicUnityExplorer.ML.IL2CPP.net6preview.deps.json
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/Iced.dll
|
||||
Remove-Item $Path/UnhollowerBaseLib.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
New-Item -Path "$Path" -Name "Mods" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.ML.IL2CPP.net6preview.dll -Destination $Path/Mods -Force
|
||||
New-Item -Path "$Path" -Name "UserLibs" -ItemType "directory" -Force
|
||||
@ -26,7 +28,7 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.ne
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_ML_Cpp_CoreCLR
|
||||
$Path = "Release\CinematicUnityExplorer.MelonLoader.IL2CPP.CoreCLR"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net6 /lib:lib/interop /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.IL2CPP.CoreCLR.dll $Path/CinematicUnityExplorer.ML.IL2CPP.CoreCLR.dll $Path/mcs.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net6 /lib:lib/interop /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.IL2CPP.CoreCLR.dll $Path/CinematicUnityExplorer.ML.IL2CPP.CoreCLR.dll $Path/mcs.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/CinematicUnityExplorer.ML.IL2CPP.CoreCLR.deps.json
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
@ -34,6 +36,8 @@ Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/Iced.dll
|
||||
Remove-Item $Path/Il2CppInterop.Common.dll
|
||||
Remove-Item $Path/Il2CppInterop.Runtime.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
Remove-Item $Path/Microsoft.Extensions.Logging.Abstractions.dll
|
||||
New-Item -Path "$Path" -Name "Mods" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.ML.IL2CPP.CoreCLR.dll -Destination $Path/Mods -Force
|
||||
@ -47,12 +51,14 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.Co
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_ML_Cpp_net472
|
||||
$Path = "Release/CinematicUnityExplorer.MelonLoader.IL2CPP"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472 /lib:lib/net35 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.IL2CPP.dll $Path/CinematicUnityExplorer.ML.IL2CPP.dll $Path/mcs.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472 /lib:lib/net35 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.IL2CPP.dll $Path/CinematicUnityExplorer.ML.IL2CPP.dll $Path/mcs.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/Iced.dll
|
||||
Remove-Item $Path/UnhollowerBaseLib.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
New-Item -Path "$Path" -Name "Mods" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.ML.IL2CPP.dll -Destination $Path/Mods -Force
|
||||
New-Item -Path "$Path" -Name "UserLibs" -ItemType "directory" -Force
|
||||
@ -65,10 +71,12 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.zi
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_ML_Mono
|
||||
$Path = "Release/CinematicUnityExplorer.MelonLoader.Mono"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.Mono.dll $Path/CinematicUnityExplorer.ML.Mono.dll $Path/mcs.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.ML.Mono.dll $Path/CinematicUnityExplorer.ML.Mono.dll $Path/mcs.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
New-Item -Path "$Path" -Name "Mods" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.ML.Mono.dll -Destination $Path/Mods -Force
|
||||
New-Item -Path "$Path" -Name "UserLibs" -ItemType "directory" -Force
|
||||
@ -81,12 +89,14 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.Mono.zip
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_BIE_Cpp
|
||||
$Path = "Release/CinematicUnityExplorer.BepInEx.IL2CPP"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472/BepInEx/build423~577 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE.IL2CPP.dll $Path/CinematicUnityExplorer.BIE.IL2CPP.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472/BepInEx/build423~577 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE.IL2CPP.dll $Path/CinematicUnityExplorer.BIE.IL2CPP.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/Iced.dll
|
||||
Remove-Item $Path/UnhollowerBaseLib.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
New-Item -Path "$Path" -Name "plugins" -ItemType "directory" -Force
|
||||
New-Item -Path "$Path" -Name "plugins/CinematicUnityExplorer" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.BIE.IL2CPP.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
|
||||
@ -99,7 +109,7 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx.IL2CPP.zip
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_BIE_CoreCLR
|
||||
$Path = "Release/CinematicUnityExplorer.BepInEx.IL2CPP.CoreCLR"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472/BepInEx/build423~577 /lib:lib/net6/ /lib:lib/interop/ /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE.IL2CPP.CoreCLR.dll $Path/CinematicUnityExplorer.BIE.IL2CPP.CoreCLR.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472/BepInEx/build423~577 /lib:lib/net6/ /lib:lib/interop/ /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE.IL2CPP.CoreCLR.dll $Path/CinematicUnityExplorer.BIE.IL2CPP.CoreCLR.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
@ -107,6 +117,8 @@ Remove-Item $Path/Iced.dll
|
||||
Remove-Item $Path/Il2CppInterop.Common.dll
|
||||
Remove-Item $Path/Il2CppInterop.Runtime.dll
|
||||
Remove-Item $Path/Microsoft.Extensions.Logging.Abstractions.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
Remove-Item $Path/CinematicUnityExplorer.BIE.IL2CPP.CoreCLR.deps.json
|
||||
New-Item -Path "$Path" -Name "plugins" -ItemType "directory" -Force
|
||||
New-Item -Path "$Path" -Name "plugins/CinematicUnityExplorer" -ItemType "directory" -Force
|
||||
@ -120,13 +132,15 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx.IL2CPP.CoreCL
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_BIE_Unity_Cpp
|
||||
$Path = "Release/CinematicUnityExplorer.BepInEx.Unity.IL2CPP.CoreCLR"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472/BepInEx/build647+ /lib:lib/net6/ /lib:lib/interop/ /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE.Unity.IL2CPP.CoreCLR.dll $Path/CinematicUnityExplorer.BIE.Unity.IL2CPP.CoreCLR.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472/BepInEx/build647+ /lib:lib/net6/ /lib:lib/interop/ /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE.Unity.IL2CPP.CoreCLR.dll $Path/CinematicUnityExplorer.BIE.Unity.IL2CPP.CoreCLR.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/Iced.dll
|
||||
Remove-Item $Path/Il2CppInterop.Common.dll
|
||||
Remove-Item $Path/Il2CppInterop.Runtime.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
Remove-Item $Path/Microsoft.Extensions.Logging.Abstractions.dll
|
||||
Remove-Item $Path/CinematicUnityExplorer.BIE.Unity.IL2CPP.CoreCLR.deps.json
|
||||
New-Item -Path "$Path" -Name "plugins" -ItemType "directory" -Force
|
||||
@ -141,10 +155,12 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx.Unity.IL2CPP.
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_BIE5_Mono
|
||||
$Path = "Release/CinematicUnityExplorer.BepInEx5.Mono"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:lib/net35/BepInEx /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE5.Mono.dll $Path/CinematicUnityExplorer.BIE5.Mono.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:lib/net35/BepInEx /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE5.Mono.dll $Path/CinematicUnityExplorer.BIE5.Mono.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
New-Item -Path "$Path" -Name "plugins" -ItemType "directory" -Force
|
||||
New-Item -Path "$Path" -Name "plugins/CinematicUnityExplorer" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.BIE5.Mono.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
|
||||
@ -157,10 +173,12 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx5.Mono.zip
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_BIE6_Mono
|
||||
$Path = "Release/CinematicUnityExplorer.BepInEx6.Mono"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:lib/net35/BepInEx/build423~577 /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE6.Mono.dll $Path/CinematicUnityExplorer.BIE6.Mono.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:lib/net35/BepInEx/build423~577 /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE6.Mono.dll $Path/CinematicUnityExplorer.BIE6.Mono.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
New-Item -Path "$Path" -Name "plugins" -ItemType "directory" -Force
|
||||
New-Item -Path "$Path" -Name "plugins/CinematicUnityExplorer" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.BIE6.Mono.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
|
||||
@ -173,10 +191,12 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx6.Mono.zip
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_BIE6_Unity_Mono
|
||||
$Path = "Release/CinematicUnityExplorer.BepInEx6.Unity.Mono"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:lib/net35/BepInEx/build647+ /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE6.Unity.Mono.dll $Path/CinematicUnityExplorer.BIE6.Unity.Mono.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:lib/net35/BepInEx/build647+ /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.BIE6.Unity.Mono.dll $Path/CinematicUnityExplorer.BIE6.Unity.Mono.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
New-Item -Path "$Path" -Name "plugins" -ItemType "directory" -Force
|
||||
New-Item -Path "$Path" -Name "plugins/CinematicUnityExplorer" -ItemType "directory" -Force
|
||||
Move-Item -Path $Path/CinematicUnityExplorer.BIE6.Unity.Mono.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
|
||||
@ -189,10 +209,12 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx6.Unity.Mono.z
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_STANDALONE_Mono
|
||||
$Path = "Release/CinematicUnityExplorer.Standalone.Mono"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.Standalone.Mono.dll $Path/CinematicUnityExplorer.Standalone.Mono.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net35 /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.Standalone.Mono.dll $Path/CinematicUnityExplorer.Standalone.Mono.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
Remove-Item $Path/../CinematicUnityExplorer.Standalone.Mono.zip -ErrorAction SilentlyContinue
|
||||
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.Standalone.Mono.zip
|
||||
|
||||
@ -200,12 +222,14 @@ compress-archive .\$Path\* $Path/../CinematicUnityExplorer.Standalone.Mono.zip
|
||||
dotnet build src/CinematicUnityExplorer.sln -c Release_STANDALONE_Cpp
|
||||
$Path = "Release/CinematicUnityExplorer.Standalone.IL2CPP"
|
||||
# ILRepack
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.Standalone.IL2CPP.dll $Path/CinematicUnityExplorer.Standalone.IL2CPP.dll $Path/mcs.dll $Path/Tomlet.dll
|
||||
lib/ILRepack.exe /target:library /lib:lib/net472 /lib:lib/unhollowed /lib:$Path /internalize /out:$Path/CinematicUnityExplorer.Standalone.IL2CPP.dll $Path/CinematicUnityExplorer.Standalone.IL2CPP.dll $Path/mcs.dll $Path/Tomlet.dll $Path/SharpDX.dll $Path/SharpDX.DirectInput.dll
|
||||
# (cleanup and move files)
|
||||
Remove-Item $Path/Tomlet.dll
|
||||
Remove-Item $Path/mcs.dll
|
||||
Remove-Item $Path/Iced.dll
|
||||
Remove-Item $Path/UnhollowerBaseLib.dll
|
||||
Remove-Item $Path/SharpDX.dll
|
||||
Remove-Item $Path/SharpDX.DirectInput.dll
|
||||
Remove-Item $Path/../CinematicUnityExplorer.Standalone.IL2CPP.zip -ErrorAction SilentlyContinue
|
||||
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.Standalone.IL2CPP.zip
|
||||
|
||||
|
@ -244,6 +244,67 @@ namespace UniverseLib.Input
|
||||
postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideMouseButtonDown))));
|
||||
}
|
||||
catch { }
|
||||
|
||||
// The following patches should allow us to block controller input, but they don't seem to be doing anything.
|
||||
try
|
||||
{
|
||||
MethodInfo getAxisTarget = t_Input.GetMethod("GetAxis", new Type[] {typeof(string)});
|
||||
#if CPP
|
||||
if (IL2CPPUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(getAxisTarget) == null)
|
||||
throw new Exception();
|
||||
#endif
|
||||
ExplorerCore.Harmony.Patch(getAxisTarget,
|
||||
postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideGetAxis))));
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
MethodInfo getAxisRawTarget = t_Input.GetMethod("GetAxisRaw", new Type[] {typeof(string)});
|
||||
#if CPP
|
||||
if (IL2CPPUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(getAxisRawTarget) == null)
|
||||
throw new Exception();
|
||||
#endif
|
||||
ExplorerCore.Harmony.Patch(getAxisRawTarget,
|
||||
postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideGetAxis))));
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
MethodInfo getButtonTarget = t_Input.GetMethod("GetButton", new Type[] {typeof(string)});
|
||||
#if CPP
|
||||
if (IL2CPPUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(getButtonTarget) == null)
|
||||
throw new Exception();
|
||||
#endif
|
||||
ExplorerCore.Harmony.Patch(getButtonTarget,
|
||||
postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideGetButton))));
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
MethodInfo getButtonDownTarget = t_Input.GetMethod("GetButtonDown", new Type[] {typeof(string)});
|
||||
#if CPP
|
||||
if (IL2CPPUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(getButtonDownTarget) == null)
|
||||
throw new Exception();
|
||||
#endif
|
||||
ExplorerCore.Harmony.Patch(getButtonDownTarget,
|
||||
postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideGetButton))));
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
MethodInfo getButtonUpTarget = t_Input.GetMethod("GetButtonUp", new Type[] {typeof(string)});
|
||||
#if CPP
|
||||
if (IL2CPPUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(getButtonUpTarget) == null)
|
||||
throw new Exception();
|
||||
#endif
|
||||
ExplorerCore.Harmony.Patch(getButtonUpTarget,
|
||||
postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideGetButton))));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
// Postfix functions
|
||||
@ -324,5 +385,19 @@ namespace UniverseLib.Input
|
||||
__result = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OverrideGetAxis(ref float __result)
|
||||
{
|
||||
if (FreeCamPanel.ShouldOverrideInput()){
|
||||
__result = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OverrideGetButton(ref bool __result)
|
||||
{
|
||||
if (FreeCamPanel.ShouldOverrideInput()){
|
||||
__result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
133
src/Cinematic/JoystickInput.cs
Normal file
133
src/Cinematic/JoystickInput.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using SharpDX.DirectInput;
|
||||
|
||||
namespace UnityExplorer
|
||||
{
|
||||
|
||||
internal enum JoystickButtons
|
||||
{
|
||||
A = 0,
|
||||
B = 1,
|
||||
X = 2,
|
||||
Y = 3,
|
||||
L1 = 4,
|
||||
R1 = 5,
|
||||
Select = 6,
|
||||
Start = 7,
|
||||
L3 = 8,
|
||||
R3 = 9,
|
||||
}
|
||||
|
||||
internal enum JoystickDPad
|
||||
{
|
||||
Up = 0,
|
||||
Right = 9000,
|
||||
Down = 18000,
|
||||
Left = 27000,
|
||||
}
|
||||
|
||||
internal class JoystickHandler{
|
||||
private DirectInput directInput;
|
||||
private Joystick joystick;
|
||||
private JoystickState currentState;
|
||||
|
||||
private float deadzone = 0.3f;
|
||||
|
||||
public void SetupController(int newControllerNumber){
|
||||
directInput = new DirectInput();
|
||||
var devices = directInput.GetDevices(SharpDX.DirectInput.DeviceType.Gamepad, DeviceEnumerationFlags.AllDevices);
|
||||
if (devices.Count > 0)
|
||||
{
|
||||
if (newControllerNumber > devices.Count)
|
||||
return;
|
||||
|
||||
joystick = new Joystick(directInput, devices[newControllerNumber].InstanceGuid);
|
||||
joystick.Acquire();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateState() {
|
||||
// Poll the joystick for input
|
||||
if (joystick != null)
|
||||
{
|
||||
joystick.Poll();
|
||||
currentState = joystick.GetCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
// Release resources
|
||||
if (joystick != null)
|
||||
{
|
||||
joystick.Unacquire();
|
||||
joystick.Dispose();
|
||||
}
|
||||
if (directInput != null)
|
||||
{
|
||||
directInput.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public float GetLeftThumbX() {
|
||||
if (joystick == null) return 0;
|
||||
|
||||
float returnValue = (currentState.X - 32767f) / 32767f;
|
||||
return Math.Abs(returnValue) < deadzone ? 0 : returnValue;
|
||||
}
|
||||
|
||||
public float GetLeftThumbY() {
|
||||
if (joystick == null) return 0;
|
||||
|
||||
float returnValue = (currentState.Y - 32767f) / 32767f;
|
||||
return Math.Abs(returnValue) < deadzone ? 0 : - returnValue;
|
||||
}
|
||||
|
||||
public float GetRightThumbX() {
|
||||
if (joystick == null) return 0;
|
||||
|
||||
float returnValue = (currentState.RotationX - 32767f) / 32767f;
|
||||
return Math.Abs(returnValue) < deadzone ? 0 : returnValue;
|
||||
}
|
||||
|
||||
public float GetRightThumbY() {
|
||||
if (joystick == null) return 0;
|
||||
|
||||
float returnValue = (currentState.RotationY - 32767f) / 32767f;
|
||||
return Math.Abs(returnValue) < deadzone ? 0 : - returnValue;
|
||||
}
|
||||
|
||||
public float GetTriggers() {
|
||||
if (joystick == null) return 0;
|
||||
|
||||
return (currentState.Z - 32767f) / 32767f;
|
||||
}
|
||||
|
||||
public bool GetDPad(JoystickDPad input) {
|
||||
if (joystick == null) return false;
|
||||
int currentDPadValue = currentState.PointOfViewControllers[0];
|
||||
if (currentDPadValue == -1) return false;
|
||||
|
||||
// currentDPadValue behaves like a thumbstick, so pressing more than one DPad button at the same time would result
|
||||
// in a number representing a "vector" pointing between those two buttons.
|
||||
switch (input){
|
||||
case JoystickDPad.Up:
|
||||
return currentDPadValue < (int)JoystickDPad.Right || currentDPadValue > (int)JoystickDPad.Left;
|
||||
case JoystickDPad.Right:
|
||||
return currentDPadValue < (int)JoystickDPad.Down && currentDPadValue > (int)JoystickDPad.Up;
|
||||
case JoystickDPad.Down:
|
||||
return currentDPadValue < (int)JoystickDPad.Left && currentDPadValue > (int)JoystickDPad.Right;
|
||||
case JoystickDPad.Left:
|
||||
return currentDPadValue > (int)JoystickDPad.Down;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetButton(JoystickButtons button) {
|
||||
if (joystick == null) return false;
|
||||
|
||||
return currentState.Buttons[(int)button];
|
||||
}
|
||||
}
|
||||
}
|
@ -170,6 +170,21 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- SharpDX net35 -->
|
||||
<ItemGroup Condition="'$(Configuration)'=='ML_Mono' or '$(Configuration)'=='BIE6_Mono' or '$(Configuration)'=='BIE6_Unity_Mono' or '$(Configuration)'=='BIE5_Mono' or '$(Configuration)'=='STANDALONE_Mono'">
|
||||
<PackageReference Include="SharpDX.DirectInput" Version="2.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- SharpDX net472 -->
|
||||
<ItemGroup Condition="'$(Configuration)'=='ML_Cpp_net472' or '$(Configuration)'=='BIE_Cpp' or '$(Configuration)'=='STANDALONE_Cpp'">
|
||||
<PackageReference Include="SharpDX.DirectInput" Version="4.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- SharpDX net6 -->
|
||||
<ItemGroup Condition="'$(Configuration)'=='ML_Cpp_net6' or '$(Configuration)'=='ML_Cpp_CoreCLR' or '$(Configuration)'=='BIE_Cpp_CoreCLR' or '$(Configuration)'=='BIE_Unity_Cpp_CoreCLR'">
|
||||
<PackageReference Include="SharpDX.DirectInput" Version="4.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ~~~~~ ASSEMBLY REFERENCES ~~~~~ -->
|
||||
<!-- net6 -->
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net6'">
|
||||
|
@ -11,6 +11,8 @@ using UnhollowerRuntimeLib;
|
||||
using Il2CppInterop.Runtime.Injection;
|
||||
#endif
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
public class FreeCamPanel : UEPanel
|
||||
@ -51,6 +53,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
static ButtonRef startStopButton;
|
||||
public static Toggle useGameCameraToggle;
|
||||
public static Dropdown controllerDropdown;
|
||||
public static Toggle blockFreecamMovementToggle;
|
||||
public static Toggle blockGamesInputOnFreecamToggle;
|
||||
static InputFieldRef positionInput;
|
||||
@ -276,12 +279,28 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
AddSpacer(5);
|
||||
|
||||
GameObject toggleObj = UIFactory.CreateToggle(ContentRoot, "UseGameCameraToggle", out useGameCameraToggle, out Text useGameCameraText);
|
||||
GameObject firstRow = UIFactory.CreateHorizontalGroup(ContentRoot, "FirstFreecamPanelRow", false, false, true, true, 3, default, new(1, 1, 1, 0));
|
||||
|
||||
GameObject toggleObj = UIFactory.CreateToggle(firstRow, "UseGameCameraToggle", out useGameCameraToggle, out Text useGameCameraText);
|
||||
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, flexibleWidth: 9999);
|
||||
useGameCameraToggle.onValueChanged.AddListener(OnUseGameCameraToggled);
|
||||
useGameCameraToggle.isOn = ConfigManager.Default_Gameplay_Freecam.Value;
|
||||
useGameCameraText.text = "Use Game Camera?";
|
||||
|
||||
Text controllerText = UIFactory.CreateLabel(firstRow, "Controller_Dropdown_Label", "Controller:", TextAnchor.MiddleRight);
|
||||
UIFactory.SetLayoutElement(controllerText.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||
|
||||
GameObject controllerDropdownGameObject = UIFactory.CreateDropdown(firstRow, $"Controller_Dropdown", out controllerDropdown, null, 14, (idx) =>{
|
||||
if (freeCamScript != null) freeCamScript.SetupController(idx);
|
||||
}
|
||||
);
|
||||
UIFactory.SetLayoutElement(controllerDropdownGameObject, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||
controllerDropdown.options.Add(new Dropdown.OptionData("1"));
|
||||
controllerDropdown.options.Add(new Dropdown.OptionData("2"));
|
||||
controllerDropdown.options.Add(new Dropdown.OptionData("3"));
|
||||
controllerDropdown.options.Add(new Dropdown.OptionData("4"));
|
||||
controllerDropdown.value = 0;
|
||||
|
||||
AddSpacer(5);
|
||||
|
||||
GameObject posRow = AddInputField("Position", "Freecam Pos:", "eg. 0 0 0", out positionInput, PositionInput_OnEndEdit);
|
||||
@ -660,8 +679,24 @@ namespace UnityExplorer.UI.Panels
|
||||
public FreeCamBehaviour(IntPtr ptr) : base(ptr) { }
|
||||
#endif
|
||||
|
||||
private JoystickHandler joystick;
|
||||
|
||||
public void SetupController(int newControllerNumber)
|
||||
{
|
||||
// Delete the current joystick object
|
||||
joystick = null;
|
||||
joystick = new JoystickHandler();
|
||||
joystick.SetupController(newControllerNumber);
|
||||
}
|
||||
|
||||
internal void Update()
|
||||
{
|
||||
if (joystick == null){
|
||||
joystick = new JoystickHandler();
|
||||
joystick.SetupController(FreeCamPanel.controllerDropdown.value);
|
||||
}
|
||||
joystick.UpdateState();
|
||||
|
||||
if (FreeCamPanel.inFreeCamMode)
|
||||
{
|
||||
if (!FreeCamPanel.ourCamera)
|
||||
@ -702,36 +737,46 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
float moveSpeed = FreeCamPanel.desiredMoveSpeed * 0.01665f; //"0.01665f" (60fps) in place of Time.DeltaTime. DeltaTime causes issues when game is paused.
|
||||
float speedModifier = 1;
|
||||
if (IInputManager.GetKey(ConfigManager.Speed_Up_Movement.Value))
|
||||
if (IInputManager.GetKey(ConfigManager.Speed_Up_Movement.Value) || joystick.GetButton(JoystickButtons.Y))
|
||||
speedModifier = 10f;
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Speed_Down_Movement.Value))
|
||||
if (IInputManager.GetKey(ConfigManager.Speed_Down_Movement.Value) || joystick.GetButton(JoystickButtons.X))
|
||||
speedModifier = 0.1f;
|
||||
|
||||
moveSpeed *= speedModifier;
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Left_1.Value) || IInputManager.GetKey(ConfigManager.Left_2.Value))
|
||||
transform.position += transform.right * -1 * moveSpeed;
|
||||
if (joystick.GetLeftThumbX() != 0 || joystick.GetLeftThumbY() != 0){
|
||||
transform.position += transform.right * joystick.GetLeftThumbX() * moveSpeed + transform.forward * joystick.GetLeftThumbY() * moveSpeed;
|
||||
}
|
||||
else {
|
||||
if (IInputManager.GetKey(ConfigManager.Left_1.Value) || IInputManager.GetKey(ConfigManager.Left_2.Value))
|
||||
transform.position += transform.right * -1 * moveSpeed;
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Right_1.Value) || IInputManager.GetKey(ConfigManager.Right_2.Value))
|
||||
transform.position += transform.right * moveSpeed;
|
||||
if (IInputManager.GetKey(ConfigManager.Right_1.Value) || IInputManager.GetKey(ConfigManager.Right_2.Value))
|
||||
transform.position += transform.right * moveSpeed;
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Forwards_1.Value) || IInputManager.GetKey(ConfigManager.Forwards_2.Value))
|
||||
transform.position += transform.forward * moveSpeed;
|
||||
if (IInputManager.GetKey(ConfigManager.Forwards_1.Value) || IInputManager.GetKey(ConfigManager.Forwards_2.Value))
|
||||
transform.position += transform.forward * moveSpeed;
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Backwards_1.Value) || IInputManager.GetKey(ConfigManager.Backwards_2.Value))
|
||||
transform.position += transform.forward * -1 * moveSpeed;
|
||||
if (IInputManager.GetKey(ConfigManager.Backwards_1.Value) || IInputManager.GetKey(ConfigManager.Backwards_2.Value))
|
||||
transform.position += transform.forward * -1 * moveSpeed;
|
||||
}
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Up.Value))
|
||||
transform.position += transform.up * moveSpeed;
|
||||
if (joystick.GetTriggers() != 0){
|
||||
transform.position += transform.up * joystick.GetTriggers() * moveSpeed;
|
||||
}
|
||||
else {
|
||||
if (IInputManager.GetKey(ConfigManager.Up.Value))
|
||||
transform.position += transform.up * moveSpeed;
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Down.Value))
|
||||
transform.position += transform.up * -1 * moveSpeed;
|
||||
if (IInputManager.GetKey(ConfigManager.Down.Value))
|
||||
transform.position += transform.up * -1 * moveSpeed;
|
||||
}
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Tilt_Left.Value))
|
||||
if (IInputManager.GetKey(ConfigManager.Tilt_Left.Value) || joystick.GetDPad(JoystickDPad.Left))
|
||||
transform.Rotate(0, 0, moveSpeed * 10, Space.Self);
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Tilt_Right.Value))
|
||||
if (IInputManager.GetKey(ConfigManager.Tilt_Right.Value) || joystick.GetDPad(JoystickDPad.Right))
|
||||
transform.Rotate(0, 0, - moveSpeed * 10, Space.Self);
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Tilt_Reset.Value)){
|
||||
@ -743,10 +788,17 @@ namespace UnityExplorer.UI.Panels
|
||||
transform.rotation = newRotation;
|
||||
}
|
||||
|
||||
if (IInputManager.GetMouseButton(1))
|
||||
Vector3 mouseDelta = Vector3.zero;
|
||||
|
||||
if (joystick.GetRightThumbX() != 0 || joystick.GetRightThumbY() != 0){
|
||||
mouseDelta = new Vector3(joystick.GetRightThumbX() * 5 * speedModifier, joystick.GetRightThumbY() * 5 * speedModifier);
|
||||
}
|
||||
else if (IInputManager.GetMouseButton(1)){
|
||||
mouseDelta = IInputManager.MousePosition - FreeCamPanel.previousMousePosition;
|
||||
}
|
||||
|
||||
if (mouseDelta != Vector3.zero)
|
||||
{
|
||||
Vector3 mouseDelta = IInputManager.MousePosition - FreeCamPanel.previousMousePosition;
|
||||
|
||||
float newRotationX = transform.localEulerAngles.y + mouseDelta.x * 0.3f;
|
||||
float newRotationY = transform.localEulerAngles.x - mouseDelta.y * 0.3f;
|
||||
|
||||
@ -773,17 +825,17 @@ namespace UnityExplorer.UI.Panels
|
||||
transform.rotation = pitchRotation * yawRotation * transform.rotation;*/
|
||||
}
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Decrease_FOV.Value))
|
||||
if (IInputManager.GetKey(ConfigManager.Decrease_FOV.Value) || joystick.GetDPad(JoystickDPad.Down))
|
||||
{
|
||||
FreeCamPanel.ourCamera.fieldOfView -= moveSpeed;
|
||||
FreeCamPanel.ourCamera.fieldOfView -= moveSpeed;
|
||||
}
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Increase_FOV.Value))
|
||||
if (IInputManager.GetKey(ConfigManager.Increase_FOV.Value) || joystick.GetDPad(JoystickDPad.Up))
|
||||
{
|
||||
FreeCamPanel.ourCamera.fieldOfView += moveSpeed;
|
||||
FreeCamPanel.ourCamera.fieldOfView += moveSpeed;
|
||||
}
|
||||
|
||||
if (IInputManager.GetKey(ConfigManager.Reset_FOV.Value)){
|
||||
if (IInputManager.GetKey(ConfigManager.Reset_FOV.Value) || joystick.GetButton(JoystickButtons.B)){
|
||||
FreeCamPanel.ourCamera.fieldOfView = FreeCamPanel.usingGameCamera ? FreeCamPanel.originalCameraFOV : 60;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user