mirror of
https://github.com/BepInEx/IPALoaderX.git
synced 2026-11-15 17:10:33 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca5111a7c7 | ||
|
|
79d1671629 | ||
|
|
b2295174c6 | ||
|
|
e64304a07a | ||
|
|
5c02ca7ff0 | ||
|
|
7261a47a3f | ||
|
|
7a3f8f394e | ||
|
|
03c032f2ae | ||
|
|
d8ce6f1774 | ||
|
|
739a7e5ba5 | ||
|
|
aba54d0ae0 | ||
|
|
534e4a22f4 | ||
|
|
fafe807087 | ||
|
|
6404ae0890 | ||
|
|
633b8dcf3b | ||
|
|
287048f6b8 |
No files matched your search
@@ -1,63 +0,0 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
+1
-2
@@ -258,5 +258,4 @@ paket-files/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
/lib
|
||||
*.pyc
|
||||
@@ -1,97 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B022796F-A80E-41FE-AECF-D5BF2FDB0196}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BepInEx.IPAHarmonyShimmer</RootNamespace>
|
||||
<AssemblyName>BepInEx.IPAHarmonyShimmer</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\patchers\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TargetFramework>net35</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\patchers\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\lib\0Harmony.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\lib\BepInEx.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx.Harmony">
|
||||
<HintPath>..\lib\BepInEx.Harmony.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net35\Mono.Cecil.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil.Mdb, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net35\Mono.Cecil.Mdb.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil.Pdb, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net35\Mono.Cecil.Pdb.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil.Rocks, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net35\Mono.Cecil.Rocks.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="HarmonyShimmer.cs" />
|
||||
<Compile Include="Harmony\AccessCache.cs" />
|
||||
<Compile Include="Harmony\AccessTools.cs" />
|
||||
<Compile Include="Harmony\Attributes.cs" />
|
||||
<Compile Include="Harmony\Extensions.cs" />
|
||||
<Compile Include="Harmony\FileLog.cs" />
|
||||
<Compile Include="Harmony\HarmonyInstance.cs" />
|
||||
<Compile Include="Harmony\HarmonyMethod.cs" />
|
||||
<Compile Include="Harmony\HarmonySharedState.cs" />
|
||||
<Compile Include="Harmony\MethodInvoker.cs" />
|
||||
<Compile Include="Harmony\Patch.cs" />
|
||||
<Compile Include="Harmony\PatchFunctions.cs" />
|
||||
<Compile Include="Harmony\PatchProcessor.cs" />
|
||||
<Compile Include="Harmony\PatchTools.cs" />
|
||||
<Compile Include="Harmony\Priority.cs" />
|
||||
<Compile Include="Harmony\ShimUtil.cs" />
|
||||
<Compile Include="Harmony\SymbolExtensions.cs" />
|
||||
<Compile Include="Harmony\Traverse.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<PackageReference Include="BepInEx.Core" Version="5.3.0.4" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -112,6 +112,12 @@ namespace Harmony
|
||||
return processor.Patch().FirstOrDefault();
|
||||
}
|
||||
|
||||
public void PatchVoid(MethodBase original, HarmonyMethod prefix, HarmonyMethod postfix, HarmonyMethod transpiler)
|
||||
{
|
||||
var processor = new PatchProcessor(this, new List<MethodBase> { original }, prefix, postfix, transpiler);
|
||||
processor.Patch();
|
||||
}
|
||||
|
||||
public void UnpatchAll(string harmonyID = null)
|
||||
{
|
||||
bool IDCheck(Patch patchInfo) => harmonyID == null || patchInfo.owner == harmonyID;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Harmony;
|
||||
using BepInEx.IPALoader;
|
||||
using BepInEx.Logging;
|
||||
using HarmonyLib;
|
||||
@@ -18,8 +17,8 @@ namespace BepInEx.IPAHarmonyShimmer
|
||||
public static IEnumerable<string> TargetDLLs { get; } = new[] { "Assembly-CSharp.dll" };
|
||||
|
||||
private static readonly ManualLogSource Logger = Logging.Logger.CreateLogSource("IPAHarmonyShim");
|
||||
public static ConfigWrapper<string> IPAPluginsPath { get; private set; }
|
||||
public static ConfigFile cfgFile { get; } = new ConfigFile(Path.Combine(Paths.ConfigPath, Metadata.ConfigFileName), false);
|
||||
public static ConfigEntry<string> IPAPluginsPath { get; private set; }
|
||||
public static ConfigFile CfgFile { get; } = new ConfigFile(Path.Combine(Paths.ConfigPath, Metadata.ConfigFileName), false);
|
||||
|
||||
private static DefaultAssemblyResolver resolver;
|
||||
private static ReaderParameters readerParameters;
|
||||
@@ -56,9 +55,9 @@ namespace BepInEx.IPAHarmonyShimmer
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
IPAPluginsPath = cfgFile.Wrap(Metadata.ConfigSection, Metadata.ConfigKey, Metadata.ConfigDescription, Metadata.ConfigDefaultValue);
|
||||
IPAPluginsPath = CfgFile.Bind(Metadata.ConfigSection, Metadata.ConfigKey, Metadata.ConfigDefaultValue, Metadata.ConfigDescription);
|
||||
|
||||
HarmonyWrapper.PatchAll(typeof(HarmonyShimmer));
|
||||
HarmonyLib.Harmony.CreateAndPatchAll(typeof(HarmonyShimmer));
|
||||
|
||||
resolver = new DefaultAssemblyResolver();
|
||||
readerParameters = new ReaderParameters { AssemblyResolver = resolver };
|
||||
@@ -156,8 +155,26 @@ namespace BepInEx.IPAHarmonyShimmer
|
||||
tr.Namespace = @namespace;
|
||||
tr.Scope = harmony2Ref;
|
||||
}
|
||||
|
||||
foreach (var memberReference in ad.MainModule.GetMemberReferences())
|
||||
{
|
||||
if (memberReference is MethodReference mref &&
|
||||
mref.DeclaringType.Name == "HarmonyInstance" &&
|
||||
mref.DeclaringType.Scope == harmonyRef &&
|
||||
mref.Name == "Patch" &&
|
||||
mref.ReturnType.FullName == "System.Void")
|
||||
mref.Name = "PatchVoid";
|
||||
}
|
||||
}
|
||||
|
||||
// Toss .NET 4 attribute in case mono is doesn't support it
|
||||
var tfa = ad.CustomAttributes.FirstOrDefault(c => c.AttributeType.FullName == "System.Runtime.Versioning.TargetFrameworkAttribute");
|
||||
if (tfa != null)
|
||||
{
|
||||
shimmed = true;
|
||||
ad.CustomAttributes.Remove(tfa);
|
||||
}
|
||||
|
||||
if (shimmed)
|
||||
{
|
||||
var pathPart = file.Substring(pluginDirectory.Length + 1);
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Mono.Cecil" version="0.10.3" targetFramework="net35" />
|
||||
</packages>
|
||||
@@ -3,20 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29215.179
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.IPALoader", "BepInEx.IPALoader\BepInEx.IPALoader.csproj", "{780F5E83-2A6B-4EA0-9476-449F5D96D56F}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.IPALoader", "BepInEx.IPALoader\BepInEx.IPALoader.csproj", "{780F5E83-2A6B-4EA0-9476-449F5D96D56F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.IPAVirtualizer", "BepInEx.IPAVirtualizer\BepInEx.IPAVirtualizer.csproj", "{4E636178-ADD9-4306-BE77-357ADFB13AAB}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.IPAVirtualizer", "BepInEx.IPAVirtualizer\BepInEx.IPAVirtualizer.csproj", "{4E636178-ADD9-4306-BE77-357ADFB13AAB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.IPAHarmonyShimmer", "BepInEx.IPAHarmonyShimmer\BepInEx.IPAHarmonyShimmer.csproj", "{B022796F-A80E-41FE-AECF-D5BF2FDB0196}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepInEx.IPAHarmonyShimmer", "BepInEx.IPAHarmonyShimmer\BepInEx.IPAHarmonyShimmer.csproj", "{B022796F-A80E-41FE-AECF-D5BF2FDB0196}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Shared", "Shared\Shared.shproj", "{840C3CF7-696A-4998-8BF1-9510D1C9A3E2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
Shared\Shared.projitems*{4e636178-add9-4306-be77-357adfb13aab}*SharedItemsImports = 4
|
||||
Shared\Shared.projitems*{780f5e83-2a6b-4ea0-9476-449f5d96d56f}*SharedItemsImports = 4
|
||||
Shared\Shared.projitems*{4e636178-add9-4306-be77-357adfb13aab}*SharedItemsImports = 5
|
||||
Shared\Shared.projitems*{780f5e83-2a6b-4ea0-9476-449f5d96d56f}*SharedItemsImports = 5
|
||||
Shared\Shared.projitems*{840c3cf7-696a-4998-8bf1-9510d1c9a3e2}*SharedItemsImports = 13
|
||||
Shared\Shared.projitems*{b022796f-a80e-41fe-aecf-d5bf2fdb0196}*SharedItemsImports = 4
|
||||
Shared\Shared.projitems*{b022796f-a80e-41fe-aecf-d5bf2fdb0196}*SharedItemsImports = 5
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
||||
@@ -1,62 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{780F5E83-2A6B-4EA0-9476-449F5D96D56F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BepInEx.IPALoader</RootNamespace>
|
||||
<AssemblyName>BepInEx.IPALoader</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<TargetFramework>net35</TargetFramework>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\plugins\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\lib\BepInEx.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\lib\UnityEngine.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IllusionInjector\Bootstrapper.cs" />
|
||||
<Compile Include="IllusionInjector\CompositePlugin.cs" />
|
||||
<Compile Include="IllusionInjector\ConsoleWindow.cs" />
|
||||
<Compile Include="IllusionInjector\Injector.cs" />
|
||||
<Compile Include="IllusionInjector\PluginComponent.cs" />
|
||||
<Compile Include="IllusionInjector\PluginManager.cs" />
|
||||
<Compile Include="IllusionPlugin\IEnhancedPlugin.cs" />
|
||||
<Compile Include="IllusionPlugin\IniFile.cs" />
|
||||
<Compile Include="IllusionPlugin\IPlugin.cs" />
|
||||
<Compile Include="IllusionPlugin\ModPrefs.cs" />
|
||||
<Compile Include="IPALoader.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<PackageReference Include="BepInEx.BaseLib" Version="5.3.0" IncludeAssets="compile" />
|
||||
<PackageReference Include="UnityEngine.Core" Version="5.6.0" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -14,12 +14,12 @@ namespace BepInEx.IPALoader
|
||||
internal static new ManualLogSource Logger;
|
||||
private readonly bool run = true;
|
||||
|
||||
public static ConfigWrapper<string> IPAPluginsPath { get; private set; }
|
||||
public static ConfigFile cfgFile { get; } = new ConfigFile(Path.Combine(Paths.ConfigPath, Metadata.ConfigFileName), false);
|
||||
public static ConfigEntry<string> IPAPluginsPath { get; private set; }
|
||||
public static ConfigFile CfgFile { get; } = new ConfigFile(Path.Combine(Paths.ConfigPath, Metadata.ConfigFileName), false);
|
||||
|
||||
private IPALoader()
|
||||
{
|
||||
IPAPluginsPath = cfgFile.Wrap(Metadata.ConfigSection, Metadata.ConfigKey, Metadata.ConfigDescription, Metadata.ConfigDefaultValue);
|
||||
IPAPluginsPath = CfgFile.Bind(Metadata.ConfigSection, Metadata.ConfigKey, Metadata.ConfigDefaultValue, Metadata.ConfigDescription);
|
||||
Logger = base.Logger;
|
||||
|
||||
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
||||
@@ -36,10 +36,8 @@ namespace BepInEx.IPALoader
|
||||
// Redirect missing assembly requests to this assembly, since we have all the emulated code
|
||||
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
|
||||
{
|
||||
Logger.LogInfo(args.Name);
|
||||
var name = new AssemblyName(args.Name).Name;
|
||||
if (name == "IllusionPlugin" ||
|
||||
name == "IllusionInjector")
|
||||
if (name == "IllusionPlugin" || name == "IllusionInjector")
|
||||
return Assembly.GetExecutingAssembly();
|
||||
|
||||
return null;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace IllusionInjector
|
||||
IPALoader.Logger.LogInfo(new string('-', 40));
|
||||
IPALoader.Logger.LogInfo($"IPALoader found {_Plugins.Count} plugins in \"{pluginDirectory}\"");
|
||||
foreach (var plugin in _Plugins)
|
||||
IPALoader.Logger.LogInfo($"{plugin.Name}: {plugin.Version}");
|
||||
IPALoader.Logger.LogInfo($"{plugin?.Name}: {plugin?.Version}");
|
||||
IPALoader.Logger.LogInfo(new string('-', 40));
|
||||
}
|
||||
|
||||
@@ -59,17 +59,25 @@ namespace IllusionInjector
|
||||
{
|
||||
var assembly = Assembly.LoadFrom(file);
|
||||
|
||||
foreach (var t in assembly.GetTypes())
|
||||
if (t.GetInterface("IPlugin") != null)
|
||||
foreach (var t in GetTypesSafe(assembly))
|
||||
if (typeof(IPlugin).IsAssignableFrom(t))
|
||||
try
|
||||
{
|
||||
var pluginInstance = Activator.CreateInstance(t) as IPlugin;
|
||||
|
||||
if (pluginInstance == null)
|
||||
{
|
||||
IPALoader.Logger.LogWarning($"[WRN] Could not load {t.FullName} because types mismatch. Please check if you have multiple instances of IPA installed.");
|
||||
continue;
|
||||
}
|
||||
|
||||
string[] filter = null;
|
||||
|
||||
if (pluginInstance is IEnhancedPlugin plugin)
|
||||
filter = plugin.Filter;
|
||||
|
||||
if (filter == null || filter.Contains(exeName, StringComparer.OrdinalIgnoreCase))
|
||||
var exeNameTrimmed = exeName.ToLower().Replace(".exe", "").Trim();
|
||||
if (filter == null || filter.Any(f => f.ToLower().Replace(".exe", "").Trim() == exeNameTrimmed))
|
||||
plugins.Add(pluginInstance);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -85,6 +93,21 @@ namespace IllusionInjector
|
||||
return plugins;
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetTypesSafe(Assembly assembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
return assembly.GetTypes();
|
||||
}
|
||||
catch (ReflectionTypeLoadException e)
|
||||
{
|
||||
IPALoader.Logger.LogWarning("Could not load some types from assembly " + assembly.FullName + " - check debug log for details");
|
||||
foreach (var eLoaderException in e.LoaderExceptions)
|
||||
IPALoader.Logger.LogDebug(eLoaderException);
|
||||
return e.Types.Where(x => x != null);
|
||||
}
|
||||
}
|
||||
|
||||
public class AppInfo
|
||||
{
|
||||
private static readonly HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero);
|
||||
|
||||
@@ -1,53 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4E636178-ADD9-4306-BE77-357ADFB13AAB}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BepInEx.IPAVirtualizer</RootNamespace>
|
||||
<AssemblyName>BepInEx.IPAVirtualizer</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<TargetFramework>net35</TargetFramework>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\patchers\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\patchers\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\lib\BepInEx.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net35\Mono.Cecil.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="IPAVirtualizer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<PackageReference Include="BepInEx.BaseLib" Version="5.3.0" IncludeAssets="compile" />
|
||||
<PackageReference Include="Mono.Cecil" Version="0.10.4" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Mono.Cecil" version="0.10.3" targetFramework="net35" />
|
||||
</packages>
|
||||
@@ -9,6 +9,7 @@ This plugin is an improved version of the original [IPALoader](https://github.co
|
||||
* Integration with BepInEx logger
|
||||
* Parts of IPA rewritten for simplicity
|
||||
* Allows virtualization via a preloader plugin
|
||||
* Patches IPA plugins with Harmony ILMerged to use the BepInEx's Harmony
|
||||
|
||||
While IPALoaderX aims to emulate IPA as closely as possible, I can't guarantee absolutely every plugin will work.
|
||||
If you suspect some plugin is not handled correctly by IPALoaderX, don't hesitate to make a new issue on this github page.
|
||||
@@ -21,7 +22,7 @@ For example, this plugin allows for BepInEx to be used in Honey Select in order
|
||||
## How to use
|
||||
|
||||
1. Install [BepInEx](https://github.com/BepInEx/BepInEx#readme) to your game (you may need to edit the BepInEx entrypoint for it to work).
|
||||
2. Download the latest IPALoaderX release from [here](https://github.com/Keelhauled/IPALoaderX/releases).
|
||||
3. Place IPALoaderX.dll in the `BepInEx` folder and IPAVirtualizer.dll in the `patchers` folder.
|
||||
2. Download the latest IPALoaderX release from [here](https://github.com/BepInEx/IPALoaderX/releases).
|
||||
3. Place BepInEx.IPALoader.dll in the `BepInEx\plugins` folder and BepInEx.IPAVirtualizer.dll and BepInEx.IPAHarmonyShimmer.dll in the `BepInEx\patchers` folder.
|
||||
4. Make `Plugins` folder in your game folder (just like with original IPA).
|
||||
5. Put IPA plugins into `Plugins` folder, just like with IPA.
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
{
|
||||
public static class Metadata
|
||||
{
|
||||
public const string PluginsVersion = "1.2";
|
||||
public const string PluginsVersion = "1.2.4";
|
||||
|
||||
internal const string ConfigFileName = "BepInEx.IPALoader.cfg";
|
||||
internal const string ConfigSection = "Config";
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="BepInExLibs" value="https://pkgs.dev.azure.com/bepinex/BepInEx/_packaging/BepInExLibs/nuget/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
Reference in new issue
Block a user