Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bitfield generating and update Il2Cpp structs #65

Merged
merged 2 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,55 +1,45 @@
using System;
using System.Runtime.InteropServices;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.AssemblyName;

namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly;

[ApplicableToUnityVersionsSince("5.2.2")]
public unsafe class NativeAssemblyStructHandler_16_0 : INativeAssemblyStructHandler
namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly
{
public int Size()
{
return sizeof(Il2CppAssembly_16_0);
}

public INativeAssemblyStruct CreateNewStruct()
{
var ptr = Marshal.AllocHGlobal(Size());
var _ = (Il2CppAssembly_16_0*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}

public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}

internal struct Il2CppAssembly_16_0
[ApplicableToUnityVersionsSince("5.2.2")]
public unsafe class NativeAssemblyStructHandler_16_0 : INativeAssemblyStructHandler
{
public int imageIndex;
public int customAttributeIndex;
public NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0 aname;
}

internal class NativeStructWrapper : INativeAssemblyStruct
{
public NativeStructWrapper(IntPtr ptr)
public int Size() => sizeof(Il2CppAssembly_16_0);
public INativeAssemblyStruct CreateNewStruct()
{
Pointer = ptr;
IntPtr ptr = Marshal.AllocHGlobal(Size());
Il2CppAssembly_16_0* _ = (Il2CppAssembly_16_0*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}
public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}
internal unsafe struct Il2CppAssembly_16_0
{
public int imageIndex;
public int customAttributeIndex;
public NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0 aname;
}

private Il2CppAssembly_16_0* _ => (Il2CppAssembly_16_0*)Pointer;
public IntPtr Pointer { get; }
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;

public INativeAssemblyNameStruct Name
internal class NativeStructWrapper : INativeAssemblyStruct
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0*)Name.AssemblyNamePointer;
public NativeStructWrapper(IntPtr ptr) => Pointer = ptr;
public IntPtr Pointer { get; }
private Il2CppAssembly_16_0* _ => (Il2CppAssembly_16_0*)Pointer;
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;
public INativeAssemblyNameStruct Name
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0*)Name.AssemblyNamePointer;
}
public ref Il2CppImage* Image => throw new NotSupportedException();
}

public ref Il2CppImage* Image => throw new NotSupportedException();
}

}
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
using System;
using System.Runtime.InteropServices;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.AssemblyName;

namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly;

[ApplicableToUnityVersionsSince("5.3.3")]
public unsafe class NativeAssemblyStructHandler_20_0 : INativeAssemblyStructHandler
namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly
{
public int Size()
{
return sizeof(Il2CppAssembly_20_0);
}

public INativeAssemblyStruct CreateNewStruct()
{
var ptr = Marshal.AllocHGlobal(Size());
var _ = (Il2CppAssembly_20_0*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}

public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}

internal struct Il2CppAssembly_20_0
[ApplicableToUnityVersionsSince("5.3.3")]
public unsafe class NativeAssemblyStructHandler_20_0 : INativeAssemblyStructHandler
{
public int imageIndex;
public int customAttributeIndex;
public int referencedAssemblyStart;
public int referencedAssemblyCount;
public NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0 aname;
}

internal class NativeStructWrapper : INativeAssemblyStruct
{
public NativeStructWrapper(IntPtr ptr)
public int Size() => sizeof(Il2CppAssembly_20_0);
public INativeAssemblyStruct CreateNewStruct()
{
Pointer = ptr;
IntPtr ptr = Marshal.AllocHGlobal(Size());
Il2CppAssembly_20_0* _ = (Il2CppAssembly_20_0*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}
public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}
internal unsafe struct Il2CppAssembly_20_0
{
public int imageIndex;
public int customAttributeIndex;
public int referencedAssemblyStart;
public int referencedAssemblyCount;
public NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0 aname;
}

private Il2CppAssembly_20_0* _ => (Il2CppAssembly_20_0*)Pointer;
public IntPtr Pointer { get; }
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;

public INativeAssemblyNameStruct Name
internal class NativeStructWrapper : INativeAssemblyStruct
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0*)Name.AssemblyNamePointer;
public NativeStructWrapper(IntPtr ptr) => Pointer = ptr;
public IntPtr Pointer { get; }
private Il2CppAssembly_20_0* _ => (Il2CppAssembly_20_0*)Pointer;
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;
public INativeAssemblyNameStruct Name
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_16_0.Il2CppAssemblyName_16_0*)Name.AssemblyNamePointer;
}
public ref Il2CppImage* Image => throw new NotSupportedException();
}

public ref Il2CppImage* Image => throw new NotSupportedException();
}

}
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
using System;
using System.Runtime.InteropServices;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.AssemblyName;

namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly;

[ApplicableToUnityVersionsSince("2018.1.0")]
public unsafe class NativeAssemblyStructHandler_24_0 : INativeAssemblyStructHandler
namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly
{
public int Size()
{
return sizeof(Il2CppAssembly_24_0);
}

public INativeAssemblyStruct CreateNewStruct()
{
var ptr = Marshal.AllocHGlobal(Size());
var _ = (Il2CppAssembly_24_0*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}

public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}

internal struct Il2CppAssembly_24_0
[ApplicableToUnityVersionsSince("2018.1.0")]
public unsafe class NativeAssemblyStructHandler_24_0 : INativeAssemblyStructHandler
{
public Il2CppImage* image;
public int customAttributeIndex;
public int referencedAssemblyStart;
public int referencedAssemblyCount;
public NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0 aname;
}

internal class NativeStructWrapper : INativeAssemblyStruct
{
public NativeStructWrapper(IntPtr ptr)
public int Size() => sizeof(Il2CppAssembly_24_0);
public INativeAssemblyStruct CreateNewStruct()
{
Pointer = ptr;
IntPtr ptr = Marshal.AllocHGlobal(Size());
Il2CppAssembly_24_0* _ = (Il2CppAssembly_24_0*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}
public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}
internal unsafe struct Il2CppAssembly_24_0
{
public Il2CppImage* image;
public int customAttributeIndex;
public int referencedAssemblyStart;
public int referencedAssemblyCount;
public NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0 aname;
}

private Il2CppAssembly_24_0* _ => (Il2CppAssembly_24_0*)Pointer;
public IntPtr Pointer { get; }
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;

public INativeAssemblyNameStruct Name
internal class NativeStructWrapper : INativeAssemblyStruct
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0*)Name.AssemblyNamePointer;
public NativeStructWrapper(IntPtr ptr) => Pointer = ptr;
public IntPtr Pointer { get; }
private Il2CppAssembly_24_0* _ => (Il2CppAssembly_24_0*)Pointer;
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;
public INativeAssemblyNameStruct Name
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0*)Name.AssemblyNamePointer;
}
public ref Il2CppImage* Image => ref _->image;
}

public ref Il2CppImage* Image => ref _->image;
}

}
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
using System;
using System.Runtime.InteropServices;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.AssemblyName;

namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly;

[ApplicableToUnityVersionsSince("2018.3.0")]
public unsafe class NativeAssemblyStructHandler_24_1 : INativeAssemblyStructHandler
namespace Il2CppInterop.Runtime.Runtime.VersionSpecific.Assembly
{
public int Size()
{
return sizeof(Il2CppAssembly_24_1);
}

public INativeAssemblyStruct CreateNewStruct()
{
var ptr = Marshal.AllocHGlobal(Size());
var _ = (Il2CppAssembly_24_1*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}

public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}

internal struct Il2CppAssembly_24_1
[ApplicableToUnityVersionsSince("2018.3.0")]
public unsafe class NativeAssemblyStructHandler_24_1 : INativeAssemblyStructHandler
{
public Il2CppImage* image;
public uint token;
public int referencedAssemblyStart;
public int referencedAssemblyCount;
public NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0 aname;
}

internal class NativeStructWrapper : INativeAssemblyStruct
{
public NativeStructWrapper(IntPtr ptr)
public int Size() => sizeof(Il2CppAssembly_24_1);
public INativeAssemblyStruct CreateNewStruct()
{
Pointer = ptr;
IntPtr ptr = Marshal.AllocHGlobal(Size());
Il2CppAssembly_24_1* _ = (Il2CppAssembly_24_1*)ptr;
*_ = default;
return new NativeStructWrapper(ptr);
}
public INativeAssemblyStruct Wrap(Il2CppAssembly* ptr)
{
if (ptr == null) return null;
return new NativeStructWrapper((IntPtr)ptr);
}
internal unsafe struct Il2CppAssembly_24_1
{
public Il2CppImage* image;
public uint token;
public int referencedAssemblyStart;
public int referencedAssemblyCount;
public NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0 aname;
}

private Il2CppAssembly_24_1* _ => (Il2CppAssembly_24_1*)Pointer;
public IntPtr Pointer { get; }
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;

public INativeAssemblyNameStruct Name
internal class NativeStructWrapper : INativeAssemblyStruct
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0*)Name.AssemblyNamePointer;
public NativeStructWrapper(IntPtr ptr) => Pointer = ptr;
public IntPtr Pointer { get; }
private Il2CppAssembly_24_1* _ => (Il2CppAssembly_24_1*)Pointer;
public Il2CppAssembly* AssemblyPointer => (Il2CppAssembly*)Pointer;
public INativeAssemblyNameStruct Name
{
get => UnityVersionHandler.Wrap((Il2CppAssemblyName*)&_->aname);
set => _->aname = *(NativeAssemblyNameStructHandler_24_0.Il2CppAssemblyName_24_0*)Name.AssemblyNamePointer;
}
public ref Il2CppImage* Image => ref _->image;
}

public ref Il2CppImage* Image => ref _->image;
}

}
Loading