From 4bcf82ca1073519b64cdc84c6f12c6b41c8f7edf Mon Sep 17 00:00:00 2001 From: Sinai Date: Tue, 9 Mar 2021 17:35:54 +1100 Subject: [PATCH] separate Bep5 and Bep6 support. Fix enums not backed by ints. --- README.md | 36 +- lib/BepInEx.Unity.dll | Bin 0 -> 26112 bytes src/ExplorerBepIn5Plugin.cs | 35 + ...BepInPlugin.cs => ExplorerBepIn6Plugin.cs} | 2 +- src/ExplorerCore.cs | 2 +- .../InteractiveValue/InteractiveEnum.cs | 23 +- .../Reflection/ReflectionInspector.cs | 5 +- src/Tests/Tests.cs | 10 + src/UI/ForceUnlockCursor.cs | 2 +- src/UnityExplorer.csproj | 684 +++++++++--------- src/UnityExplorer.sln | 9 +- 11 files changed, 462 insertions(+), 346 deletions(-) create mode 100644 lib/BepInEx.Unity.dll create mode 100644 src/ExplorerBepIn5Plugin.cs rename src/{ExplorerBepInPlugin.cs => ExplorerBepIn6Plugin.cs} (99%) diff --git a/README.md b/README.md index 1b96e8b..dc04d5c 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,9 @@ | Mod Loader | IL2CPP | Mono | | ----------- | ------ | ---- | -| [BepInEx](https://github.com/BepInEx/BepInEx) | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx.Il2Cpp.zip) | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx.Mono.zip) | -| [MelonLoader](https://github.com/HerpDerpinstine/MelonLoader) | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Il2Cpp.zip) | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Mono.zip) | +| [BepInEx](https://github.com/BepInEx/BepInEx) 6.X | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx.Il2Cpp.zip) | ❓ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx6.Mono.zip) | +| [BepInEx](https://github.com/BepInEx/BepInEx) 5.X | ❌ | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx5.Mono.zip) | +| [MelonLoader](https://github.com/HerpDerpinstine/MelonLoader) 0.3 | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Il2Cpp.zip) | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Mono.zip) | | Standalone | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.Standalone.Il2Cpp.zip) | ✔️ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.Standalone.Mono.zip) | ## Features @@ -47,6 +48,8 @@ ### BepInEx +Note: For IL2CPP you should use [BepInEx 6 (Bleeding Edge)](https://builds.bepis.io/projects/bepinex_be), for Mono you should use [BepInEx 5](https://github.com/BepInEx/BepInEx/releases) (until Mono support stabilizes in BepInEx 6). + 0. Install [BepInEx](https://github.com/BepInEx/BepInEx) for your game. 1. Download the UnityExplorer release for BepInEx IL2CPP or Mono above. 2. Take the `UnityExplorer.BIE.___.dll` file and put it in `[GameFolder]\BepInEx\plugins\` @@ -54,6 +57,8 @@ ### MelonLoader +Note: You must use version 0.3 of MelonLoader or greater. Version 0.3 is currently in pre-release, so you must opt-in from your MelonLoader installer (enable alpha releases). + 0. Install [MelonLoader](https://github.com/HerpDerpinstine/MelonLoader) for your game. 1. Download the UnityExplorer release for MelonLoader IL2CPP or Mono above. 2. Take the contents of the release and put it in the `[GameFolder]\Mods\` folder. It should look like `[GameFolder]\Mods\UnityExplorer.ML.___.dll` @@ -62,12 +67,12 @@ 0. Load the DLL from your mod or inject it. 1. Create an instance of Unity Explorer with `new ExplorerCore();` -2. You will need to call ExplorerCore.Update() (static method) from your Update method. +2. You will need to call `ExplorerCore.Update()` (static method) from your Update method. 3. Subscribe to the `ExplorerCore.OnLog__` methods for logging. -## Mod Config +## Settings -You can access the settings via the "Options" page of the main menu, or directly from the config at `Mods\UnityExplorer\config.ini` (generated after first launch). +You can change the settings via the "Options" page of the main menu, or directly from the config file (generated after first launch). The config file will be found either inside a "UnityExplorer" folder in the same directory as where you put the DLL file, or for BepInEx it will be at `BepInEx\config\UnityExplorer\`. `Main Menu Toggle` (KeyCode) * Default: `F7` @@ -91,17 +96,24 @@ You can access the settings via the "Options" page of the main menu, or directly * Default: `false` * Listens for Unity `Debug.Log` messages and prints them to UnityExplorer's log. +`Hide on Startup` (bool) +* Default: `false` +* If true, UnityExplorer will be hidden when you start the game, you must open it via the keybind. + ## Building -If you'd like to build this yourself, you will need to have installed BepInEx and/or MelonLoader for at least one Unity game. If you want to build all 4 versions, you will need at least one IL2CPP and one Mono game, with BepInEx and MelonLoader installed for both. +If you'd like to build this yourself, all you need to do is download this repository and build from Visual Studio. If you want to build for BepInEx or MelonLoader IL2CPP then you will need to install the mod loader for a game and set the directory in the `csproj` file. -1. Install BepInEx or MelonLoader for your game, or use the standalone build. +For IL2CPP: +1. Install BepInEx or MelonLoader for your game. 2. Open the `src\UnityExplorer.csproj` file in a text editor. -3. For IL2CPP builds, make sure you set `BIECppGameFolder` (for BepInEx) and/or `MLCppGameFolder` (for MelonLoader) so the project can locate the necessary references. -4. Open the `src\UnityExplorer.sln` project. -5. Select `Solution 'UnityExplorer' (1 of 1 project)` in the Solution Explorer panel, and set the Active config property to the version you want to build, then build it. -5. The DLLs are built to the `Release\` folder in the root of the repository. -6. If ILRepack fails or is missing, use the NuGet package manager to re-install `ILRepack.Lib.MSBuild.Task`, then re-build. +3. Set `BIECppGameFolder` (for BepInEx) and/or `MLCppGameFolder` (for MelonLoader) so the project can locate the necessary references. + +For all builds: +1. Open the `src\UnityExplorer.sln` project. +2. Select `Solution 'UnityExplorer' (1 of 1 project)` in the Solution Explorer panel, and set the Active config property to the version you want to build, then build it. +3. The DLLs are built to the `Release\` folder in the root of the repository. +4. If ILRepack fails or is missing, use the NuGet package manager to re-install `ILRepack.Lib.MSBuild.Task`, then re-build. ## Credits diff --git a/lib/BepInEx.Unity.dll b/lib/BepInEx.Unity.dll new file mode 100644 index 0000000000000000000000000000000000000000..c26ad652fa4b11be87649f588b2ca9df5b05c96a GIT binary patch literal 26112 zcmeHvdwko~k?;H-`bm~;*^=Lh<0uaY#V;J^4Q_~ENgVQy1B3#OVk?d|vVKOALyU2- z8=y@WSW+kpY+FcZ+J!<3EtIB&mS_ULjrKPv+(%#VCc1v=@Z{H0fqxl{qS`n0+dg_E=jCbN z(pJ4Zt!sNU85~I1eTi^?uqPak+o|BzNH8%N4@Tp`_O%;>{dRApAwSVK(Q3{g=_E(;ysEtQK6J|r8g5;e|bF#2s*zET6#UR^8d`! zL79ZtF34TWg;Ap0*b%3`?jgzp?K1FHo?7>p@F0;VtKI{AMHb$WitI`OfBP~3)QPQ* z-oWG)B-+xDNG5uKiEg7Pu%TP<&U!7ya5W?%F&m7mE8T-P%j(5D>$Q}qH4ByE1F(x< zteZ|QTC|X8CdNb)>VF+n>7hwP-kPFDi@t~EkmJ`wlR?r$@SoRf)dv$G4(OpNK|&BuqYq<1&0KeAE~*sO zs~3-O?J>7IG!N7_EPFm4A&9EAF+AS9+ES0b2!;F{dodoz+@S*Wd5k=^A87qgk9j?H zmd8fed*6T)G`K{k*;Kfgpd!C6CC^rJV^lPq*3x1zt;8piD4AOHh?6M+c56mNKPAgHk$8riyt=m+vJn zg!pP>1c6{y>m!H)^MthuwB!X45n2j>?&`R^7VfU*g>pUAijr=(0oF|~PwYme!m8`d zS;e(3yB#$$j=~8SP*I~nU3kLV{^V+i_gcnC5V&QIOyfrqGOdy6DC(gi6zhwvVa6^XrCbL#)?}n1vK?OsSUx2wWGNZc7*$ru96$kRrPKR62ha8M*ySgwKru^w=?x3 zrd|vXx&&ZW%?o;&qmc0hGXxJS>70=)qrS)tp@-VK+{DcsU>`@5t7{hM2B#`(1i942 z@L+sgv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MfTRPw3SUjcAdWsKL;D>sn)mR=r>wNbbnlG1y9WrFDnwIKu zi$fIKow8&=n5X$TdABg=V9?3)t`G|f5pjkFUf<8GAkd<;q_Iyi;#$*o2FN?8jT$D(Es&ZQAD{5Up(fh zmbvXAEPimsZ+RY$euP2AocW07XkMTNOD5YkD2tblVvz=UKK2KmGOUP3_8A_4K0Mg1 zsPs5g$(bSc6hH@qPSXQVF<5Ve2!Ce`t8oaa<-r_${Z|>mm5nX{jH-ux+-eYfl_((4 zHG~d+f`jiP7=m%s^G7OXp|>t{nm)0zy>z?v=@GoHsN&-zBQbFeVfa{G&b>>{`=&L zip!%!do0E`Pb6Oli$oguQ%HWDtcHw2K4913+t*p*Rnz~0{|OK9U!;(~`!YI_Sq&-% z{4_fAt-$*d)GR{APQMlz^H98qHsUhrBDu)fh|8+AxQ^+@a}B-+zgAeEF#r7o|L%~# zv#q{4uDFt;RvzJIVABRV;c??{F=%83fv~}$(N5TF+9_U z8)2Y_%sVjCG-#JOew;2TB|MEd`Ko{OaLR@cs2RU-(D2=UzHJzgK89eCb5chA#4~mS zWsZjg-MMYLFFrXZaoFL5Waa?II{qaY^Kg>S$hZhHGUsb#|KE7cf+Jc>yhI Instance?.Logger; + + public static readonly Harmony HarmonyInstance = new Harmony(ExplorerCore.GUID); + + internal void Awake() + { + Instance = this; + + new ExplorerCore(); + + // HarmonyInstance.PatchAll(); + } + + internal void Update() + { + ExplorerCore.Update(); + } + } +} +#endif diff --git a/src/ExplorerBepInPlugin.cs b/src/ExplorerBepIn6Plugin.cs similarity index 99% rename from src/ExplorerBepInPlugin.cs rename to src/ExplorerBepIn6Plugin.cs index cb0d780..ecddcd1 100644 --- a/src/ExplorerBepInPlugin.cs +++ b/src/ExplorerBepIn6Plugin.cs @@ -1,4 +1,4 @@ -#if BIE +#if BIE6 using System; using System.IO; using System.Reflection; diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index e606186..6ab5d0c 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -15,7 +15,7 @@ namespace UnityExplorer public class ExplorerCore { public const string NAME = "UnityExplorer"; - public const string VERSION = "3.1.12"; + public const string VERSION = "3.2.0"; public const string AUTHOR = "Sinai"; public const string GUID = "com.sinai.unityexplorer"; diff --git a/src/Inspectors/Reflection/InteractiveValue/InteractiveEnum.cs b/src/Inspectors/Reflection/InteractiveValue/InteractiveEnum.cs index 754feff..a2d82af 100644 --- a/src/Inspectors/Reflection/InteractiveValue/InteractiveEnum.cs +++ b/src/Inspectors/Reflection/InteractiveValue/InteractiveEnum.cs @@ -47,13 +47,34 @@ namespace UnityExplorer.Inspectors.Reflection var list = new List>(); var set = new HashSet(); + foreach (var value in values) { var name = value.ToString(); + if (set.Contains(name)) continue; + set.Add(name); - list.Add(new KeyValuePair((int)value, name)); + + var backingType = Enum.GetUnderlyingType(type); + int intValue; + try + { + // this approach is necessary, a simple '(int)value' is not sufficient. + + var unbox = Convert.ChangeType(value, backingType); + + intValue = (int)Convert.ChangeType(unbox, typeof(int)); + } + catch (Exception ex) + { + ExplorerCore.LogWarning("[InteractiveEnum] Could not Unbox underlying type " + backingType.Name + " from " + type.FullName); + ExplorerCore.Log(ex.ToString()); + continue; + } + + list.Add(new KeyValuePair(intValue, name)); } s_enumNamesCache.Add(type, list.ToArray()); diff --git a/src/Inspectors/Reflection/ReflectionInspector.cs b/src/Inspectors/Reflection/ReflectionInspector.cs index 5b9bcf8..fdb3a7a 100644 --- a/src/Inspectors/Reflection/ReflectionInspector.cs +++ b/src/Inspectors/Reflection/ReflectionInspector.cs @@ -43,6 +43,7 @@ namespace UnityExplorer.Inspectors "Collider2D.Cast", "Collider2D.Raycast", "Texture2D.SetPixelDataImpl", + "Camera.CalculateProjectionMatrixFromPhysicalProperties", #endif }; private static readonly HashSet bl_memberNameStartsWith = new HashSet @@ -172,11 +173,11 @@ namespace UnityExplorer.Inspectors { try { + var sig = GetSig(member); + //ExplorerCore.Log($"Trying to cache member {sig}..."); //ExplorerCore.Log(member.DeclaringType.FullName + "." + member.Name); - var sig = GetSig(member); - var mi = member as MethodInfo; var pi = member as PropertyInfo; var fi = member as FieldInfo; diff --git a/src/Tests/Tests.cs b/src/Tests/Tests.cs index 90fea25..7846676 100644 --- a/src/Tests/Tests.cs +++ b/src/Tests/Tests.cs @@ -13,6 +13,14 @@ using UnityExplorer.Helpers; namespace UnityExplorer.Tests { + internal enum TestByteEnum : byte + { + One, + Two, + Three, + TwoFiftyFive = 255, + } + public static class StaticTestClass { public static int StaticProperty => 5; @@ -28,6 +36,8 @@ namespace UnityExplorer.Tests public class TestClass { + internal static TestByteEnum testingByte = TestByteEnum.One; + public string AAALongString = @"1 2 3 diff --git a/src/UI/ForceUnlockCursor.cs b/src/UI/ForceUnlockCursor.cs index 5942cbf..1cd0f7a 100644 --- a/src/UI/ForceUnlockCursor.cs +++ b/src/UI/ForceUnlockCursor.cs @@ -104,7 +104,7 @@ namespace UnityExplorer.UI { var harmony = #if ML - ExplorerMelonMod.Instance.harmonyInstance; + ExplorerMelonMod.Instance.Harmony; #elif BIE ExplorerBepInPlugin.HarmonyInstance; #elif STANDALONE diff --git a/src/UnityExplorer.csproj b/src/UnityExplorer.csproj index 7d5c988..e37d6f7 100644 --- a/src/UnityExplorer.csproj +++ b/src/UnityExplorer.csproj @@ -1,330 +1,364 @@  - - - Release_ML_Cpp - AnyCPU - {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D} - Library - - Properties - 512 - true - - ..\Release\Explorer.MelonLoader.Il2Cpp\ - - - false - false - false - none - false - prompt - 4 - x64 - false - UnityExplorer - - E:\source\Unity Projects\Test\_BUILD - - E:\source\Unity Projects\Test\_BUILD - - - - - v4.7.2 - ..\Release\UnityExplorer.MelonLoader.Il2Cpp\ - CPP,ML - UnityExplorer.ML.IL2CPP - true - true - true - - - v3.5 - ..\Release\UnityExplorer.MelonLoader.Mono\ - MONO,ML - UnityExplorer.ML.Mono - false - false - true - true - - - v4.7.2 - ..\Release\UnityExplorer.BepInEx.Il2Cpp\ - CPP,BIE - UnityExplorer.BIE.IL2CPP - true - false - true - - - v3.5 - ..\Release\UnityExplorer.BepInEx.Mono\ - MONO,BIE - UnityExplorer.BIE.Mono - false - false - true - - - v3.5 - ..\Release\UnityExplorer.Standalone.Mono\ - MONO,STANDALONE - UnityExplorer.STANDALONE.Mono - false - false - true - - - v4.7.2 - ..\Release\UnityExplorer.Standalone.Il2Cpp\ - CPP,STANDALONE - UnityExplorer.STANDALONE.IL2CPP - true - false - true - - - - packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll - False - - - - - - - - - - ..\lib\mcs.dll - False - - - - - - ..\lib\UnityEngine.dll - False - - - ..\lib\UnityEngine.UI.dll - False - - - - - - ..\lib\MelonLoader.dll - False - - - - - - ..\lib\BepInEx.dll - False - - - ..\lib\0Harmony.dll - False - - - - - - $(MLCppGameFolder)\MelonLoader\MelonLoader.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnhollowerBaseLib.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\Il2Cppmscorlib.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\Il2CppSystem.Core.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.CoreModule.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.PhysicsModule.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.UI.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.UIModule.dll - False - - - $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.IMGUIModule.dll - False - - - - - - $(BIECppGameFolder)\BepInEx\core\BepInEx.Core.dll - False - - - $(BIECppGameFolder)\BepInEx\core\0Harmony.dll - False - - - $(BIECppGameFolder)\BepInEx\core\BepInEx.IL2CPP.dll - False - - - $(BIECppGameFolder)\BepInEx\core\UnhollowerBaseLib.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\Il2Cppmscorlib.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\Il2CppSystem.Core.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.CoreModule.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.PhysicsModule.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.TextRenderingModule.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.UI.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.UIModule.dll - False - - - $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.IMGUIModule.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + Release_ML_Cpp + AnyCPU + {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D} + Library + + Properties + 512 + true + + ..\Release\UnityExplorer.MelonLoader.Il2Cpp\ + + + false + false + false + none + false + prompt + 4 + x64 + false + UnityExplorer + + E:\source\Unity Projects\Test\_BUILD + + E:\source\Unity Projects\Test\_BUILD + + - - + + v4.7.2 + ..\Release\UnityExplorer.MelonLoader.Il2Cpp\ + CPP,ML + UnityExplorer.ML.IL2CPP + true + true + true + + + v3.5 + ..\Release\UnityExplorer.MelonLoader.Mono\ + MONO,ML + UnityExplorer.ML.Mono + false + false + true + true + + + v4.7.2 + ..\Release\UnityExplorer.BepInEx.Il2Cpp\ + CPP,BIE,BIE6 + UnityExplorer.BIE.IL2CPP + true + false + true + + + v3.5 + ..\Release\UnityExplorer.BepInEx6.Mono\ + MONO,BIE,BIE6 + UnityExplorer.BIE6.Mono + false + false + true + + + ..\Release\UnityExplorer.BepInEx5.Mono\ + MONO,BIE,BIE5 + UnityExplorer.BIE5.Mono + true + x64 + 7.3 + prompt + + + v3.5 + ..\Release\UnityExplorer.Standalone.Mono\ + MONO,STANDALONE + UnityExplorer.STANDALONE.Mono + false + false + true + true + + + v4.7.2 + ..\Release\UnityExplorer.Standalone.Il2Cpp\ + CPP,STANDALONE + UnityExplorer.STANDALONE.IL2CPP + true + false + true + true + + + + packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll + False + + + + + + + + + + ..\lib\mcs.dll + False + + + + + + ..\lib\UnityEngine.dll + False + + + ..\lib\UnityEngine.UI.dll + False + + + + + + ..\lib\MelonLoader.dll + False + + + + + + ..\lib\BepInEx.dll + False + + + ..\lib\0Harmony.dll + False + + + + + + ..\lib\BepInEx.Core.dll + False + + + ..\lib\BepInEx.Unity.dll + False + + + ..\lib\0Harmony.dll + False + + + + + + ..\lib\0Harmony.dll + False + + + + + + $(MLCppGameFolder)\MelonLoader\MelonLoader.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnhollowerBaseLib.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\Il2Cppmscorlib.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\Il2CppSystem.Core.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.CoreModule.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.PhysicsModule.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.UI.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.UIModule.dll + False + + + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.IMGUIModule.dll + False + + + + + + $(BIECppGameFolder)\BepInEx\core\BepInEx.Core.dll + False + + + $(BIECppGameFolder)\BepInEx\core\0Harmony.dll + False + + + $(BIECppGameFolder)\BepInEx\core\BepInEx.IL2CPP.dll + False + + + $(BIECppGameFolder)\BepInEx\core\UnhollowerBaseLib.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\Il2Cppmscorlib.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\Il2CppSystem.Core.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.CoreModule.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.PhysicsModule.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.TextRenderingModule.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.UI.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.UIModule.dll + False + + + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.IMGUIModule.dll + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + \ No newline at end of file diff --git a/src/UnityExplorer.sln b/src/UnityExplorer.sln index 21180ec..d71f046 100644 --- a/src/UnityExplorer.sln +++ b/src/UnityExplorer.sln @@ -8,7 +8,8 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release_BIE_Cpp|Any CPU = Release_BIE_Cpp|Any CPU - Release_BIE_Mono|Any CPU = Release_BIE_Mono|Any CPU + Release_BIE5_Mono|Any CPU = Release_BIE5_Mono|Any CPU + Release_BIE6_Mono|Any CPU = Release_BIE6_Mono|Any CPU Release_ML_Cpp|Any CPU = Release_ML_Cpp|Any CPU Release_ML_Mono|Any CPU = Release_ML_Mono|Any CPU Release_STANDALONE_Cpp|Any CPU = Release_STANDALONE_Cpp|Any CPU @@ -17,8 +18,10 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE_Cpp|Any CPU.ActiveCfg = Release_BIE_Cpp|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE_Cpp|Any CPU.Build.0 = Release_BIE_Cpp|Any CPU - {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE_Mono|Any CPU.ActiveCfg = Release_BIE_Mono|Any CPU - {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE_Mono|Any CPU.Build.0 = Release_BIE_Mono|Any CPU + {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE5_Mono|Any CPU.ActiveCfg = Release_BIE5_Mono|Any CPU + {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE5_Mono|Any CPU.Build.0 = Release_BIE5_Mono|Any CPU + {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE6_Mono|Any CPU.ActiveCfg = Release_BIE6_Mono|Any CPU + {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_BIE6_Mono|Any CPU.Build.0 = Release_BIE6_Mono|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp|Any CPU.ActiveCfg = Release_ML_Cpp|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp|Any CPU.Build.0 = Release_ML_Cpp|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Mono|Any CPU.ActiveCfg = Release_ML_Mono|Any CPU