Bladeren bron

Update patcher to support Unity 2017+ DLL structure

Bepis 5 jaren geleden
bovenliggende
commit
fff4317ffa
3 gewijzigde bestanden met toevoegingen van 28 en 8 verwijderingen
  1. 10 0
      BepInEx.Patcher/BepInEx.Patcher.csproj
  2. 16 6
      BepInEx.Patcher/Program.cs
  3. 2 2
      BepInEx.Patcher/Properties/AssemblyInfo.cs

+ 10 - 0
BepInEx.Patcher/BepInEx.Patcher.csproj

@@ -42,6 +42,16 @@
   <PropertyGroup>
     <StartupObject>BepInEx.Patcher.Program</StartupObject>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'v2018|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>..\bin\patcher\</OutputPath>
+    <DefineConstants>TRACE;UNITY_2018</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>embedded</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
       <HintPath>..\packages\Mono.Cecil.0.10.0\lib\net35\Mono.Cecil.dll</HintPath>

+ 16 - 6
BepInEx.Patcher/Program.cs

@@ -42,9 +42,15 @@ namespace BepInEx.Patcher
                 string gameName = Path.GetFileNameWithoutExtension(exePath);
 
                 string managedDir = Environment.CurrentDirectory + $@"\{gameName}_Data\Managed";
-                string unityOutputDLL = Path.GetFullPath($"{managedDir}\\UnityEngine.dll");
 
-                if (!Directory.Exists(managedDir) || !File.Exists(unityOutputDLL))
+#if UNITY_2018
+				string unityOutputDLL = Path.GetFullPath($"{managedDir}\\UnityEngine.CoreModule.dll");
+#else
+				string unityOutputDLL = Path.GetFullPath($"{managedDir}\\UnityEngine.dll");
+#endif
+
+
+				if (!Directory.Exists(managedDir) || !File.Exists(unityOutputDLL))
                     continue;
 
                 hasFound = true;
@@ -95,10 +101,14 @@ namespace BepInEx.Patcher
                     AssemblyResolver = defaultResolver
                 };
 
-                string unityBackupDLL = Path.GetFullPath($"{managedDir}\\UnityEngine.dll.bak");
-                
-                //determine which assembly to use as a base
-                AssemblyDefinition unity = AssemblyDefinition.ReadAssembly(unityOutputDLL, rp);
+#if UNITY_2018
+				string unityBackupDLL = Path.GetFullPath($"{managedDir}\\UnityEngine.CoreModule.dll.bak");
+#else
+				string unityBackupDLL = Path.GetFullPath($"{managedDir}\\UnityEngine.dll.bak");
+#endif
+
+				//determine which assembly to use as a base
+				AssemblyDefinition unity = AssemblyDefinition.ReadAssembly(unityOutputDLL, rp);
 
                 if (!VerifyAssembly(unity, out message))
                 {

+ 2 - 2
BepInEx.Patcher/Properties/AssemblyInfo.cs

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.1.0.0")]
-[assembly: AssemblyFileVersion("4.1.0.0")]
+[assembly: AssemblyVersion("5.0.0.0")]
+[assembly: AssemblyFileVersion("5.0.0.0")]