1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2026-10-10 13:03:15 +08:00

Improved build system by wrapping the SharpDX libs inside the CUE .dll and took the whole Joystick class outside into its own file.

This commit is contained in:
originalnicodr
2024-06-30 13:02:27 -03:00
parent 250dec1f88
commit 1d59cd39ce
3 changed files with 172 additions and 167 deletions
+37 -34
View File
@@ -7,19 +7,19 @@ 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
Move-Item -Path $Path/UniverseLib.IL2CPP.Unhollower.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/UserLibs -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.net6preview.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.net6preview.zip
@@ -28,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
@@ -36,13 +36,14 @@ 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
New-Item -Path "$Path" -Name "UserLibs" -ItemType "directory" -Force
Move-Item -Path $Path/UniverseLib.ML.IL2CPP.Interop.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/UserLibs -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.CoreCLR.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.CoreCLR.zip
@@ -51,18 +52,18 @@ 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
Move-Item -Path $Path/UniverseLib.IL2CPP.Unhollower.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/UserLibs -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.IL2CPP.zip
@@ -71,16 +72,16 @@ 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
Move-Item -Path $Path/UniverseLib.Mono.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/UserLibs -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/UserLibs -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.MelonLoader.Mono.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.MelonLoader.Mono.zip
@@ -89,18 +90,18 @@ 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
Move-Item -Path $Path/UniverseLib.IL2CPP.Unhollower.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.BepInEx.IL2CPP.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx.IL2CPP.zip
@@ -109,7 +110,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
@@ -117,13 +118,13 @@ 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
Move-Item -Path $Path/CinematicUnityExplorer.BIE.IL2CPP.CoreCLR.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/UniverseLib.BIE.IL2CPP.Interop.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.BepInEx.IL2CPP.CoreCLR.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx.IL2CPP.CoreCLR.zip
@@ -132,21 +133,21 @@ 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
New-Item -Path "$Path" -Name "plugins/CinematicUnityExplorer" -ItemType "directory" -Force
Move-Item -Path $Path/CinematicUnityExplorer.BIE.Unity.IL2CPP.CoreCLR.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/UniverseLib.BIE.IL2CPP.Interop.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.BepInEx.Unity.IL2CPP.CoreCLR.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx.Unity.IL2CPP.CoreCLR.zip
@@ -155,16 +156,16 @@ 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
Move-Item -Path $Path/UniverseLib.Mono.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.BepInEx5.Mono.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx5.Mono.zip
@@ -173,16 +174,16 @@ 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
Move-Item -Path $Path/UniverseLib.Mono.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.BepInEx6.Mono.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx6.Mono.zip
@@ -191,16 +192,16 @@ 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
Move-Item -Path $Path/UniverseLib.Mono.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
Move-Item -Path $Path/SharpDX.DirectInput.dll -Destination $Path/plugins/CinematicUnityExplorer -Force
# (create zip archive)
Remove-Item $Path/../CinematicUnityExplorer.BepInEx6.Unity.Mono.zip -ErrorAction SilentlyContinue
compress-archive .\$Path\* $Path/../CinematicUnityExplorer.BepInEx6.Unity.Mono.zip
@@ -209,10 +210,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
@@ -220,12 +223,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
@@ -234,7 +239,5 @@ $Path1 = "Release/CinematicUnityExplorer.Standalone.Mono"
$Path2 = "UnityEditorPackage/Runtime"
Copy-Item $Path1/CinematicUnityExplorer.STANDALONE.Mono.dll -Destination $Path2
Copy-Item $Path1/UniverseLib.Mono.dll -Destination $Path2
Copy-Item $Path1/SharpDX.dll -Destination $Path2
Copy-Item $Path1/SharpDX.DirectInput.dll -Destination $Path2
Remove-Item Release/CinematicUnityExplorer.Editor.zip -ErrorAction SilentlyContinue
compress-archive .\UnityEditorPackage\* Release/CinematicUnityExplorer.Editor.zip
+133
View 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];
}
}
}
+2 -133
View File
@@ -12,8 +12,6 @@ using Il2CppInterop.Runtime.Injection;
#endif
using System.Linq;
using UnityEngine;
using SharpDX.DirectInput;
namespace UnityExplorer.UI.Panels
{
@@ -670,136 +668,6 @@ namespace UnityExplorer.UI.Panels
}
}
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){
//OnDestroy();
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 bool JoystickConnected(){
return false;//joystick != null;
}
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;
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];
}
}
internal class FreeCamBehaviour : MonoBehaviour
{
#if CPP
@@ -815,7 +683,8 @@ namespace UnityExplorer.UI.Panels
public void SetupController(int newControllerNumber)
{
joystick = null; // Delete the current joystick object
// Delete the current joystick object
joystick = null;
joystick = new JoystickHandler();
joystick.SetupController(newControllerNumber);
}