Skip to content

Commit

Permalink
Ubisoft+
Browse files Browse the repository at this point in the history
  • Loading branch information
p1xel8ted committed Jan 21, 2024
1 parent a342054 commit ca2c377
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Il2CppInterop.Common/XrefScans/XrefScanMethodDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static XrefScanMethodDb()
XrefScanCache = new MethodXrefScanCache(GeneratedDatabasesUtil.GetDatabasePath(MethodXrefScanCache.FileName));

foreach (ProcessModule module in Process.GetCurrentProcess().Modules)
if (module.ModuleName == "GameAssembly.dll")
if (module.ModuleName is "GameAssembly.dll" or "GameAssembly_plus.dll")
{
GameAssemblyBase = (long)module.BaseAddress;
break;
Expand Down
18 changes: 11 additions & 7 deletions Il2CppInterop.Runtime/Injection/InjectorHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,34 @@
using System.Runtime.InteropServices;
using System.Threading;
using Il2CppInterop.Common;
using Il2CppInterop.Common.Extensions;
using Il2CppInterop.Common.XrefScans;
using Il2CppInterop.Runtime.Injection.Hooks;
using Il2CppInterop.Runtime.Runtime;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.Class;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.FieldInfo;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.Image;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.MethodInfo;
using Il2CppInterop.Runtime.Startup;
using Microsoft.Extensions.Logging;

namespace Il2CppInterop.Runtime.Injection
{
internal static unsafe class InjectorHelpers
{
private static readonly string[] s_assemblies = {"GameAssembly.dll", "GameAssembly_plus.dll", "GameAssembly.so", "GameAssembly_plus.so", "UserAssembly.dll", "UserAssembly_plus.dll"};

internal static Assembly Il2CppMscorlib = typeof(Il2CppSystem.Type).Assembly;
internal static INativeAssemblyStruct InjectedAssembly;
internal static INativeImageStruct InjectedImage;
internal static ProcessModule Il2CppModule = Process.GetCurrentProcess()
.Modules.OfType<ProcessModule>()
.Single((x) => x.ModuleName is "GameAssembly.dll" or "GameAssembly.so" or "UserAssembly.dll");
.Single(x => s_assemblies.Contains(x.ModuleName, StringComparer.OrdinalIgnoreCase));

internal static IntPtr Il2CppHandle = NativeLibrary.Load("GameAssembly", typeof(InjectorHelpers).Assembly, null);
internal static IntPtr Il2CppHandle
{
get
{
var assembly = Il2CppModule.ModuleName != null && Il2CppModule.ModuleName.Contains("_plus") ? "GameAssembly_plus" : "GameAssembly";
return NativeLibrary.Load(assembly, typeof(InjectorHelpers).Assembly, null);
}
}

internal static readonly Dictionary<Type, OpCode> StIndOpcodes = new()
{
Expand Down

0 comments on commit ca2c377

Please sign in to comment.