diff --git a/.github/workflows/dotnet-core-pull.yml b/.github/workflows/dotnet-core-pull.yml index 659447e9..704aaf39 100644 --- a/.github/workflows/dotnet-core-pull.yml +++ b/.github/workflows/dotnet-core-pull.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.101 + dotnet-version: 5.0.100 - name: Install dependencies run: dotnet restore - name: Build - Windows x64 diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 78348c3d..42679d76 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.101 + dotnet-version: 5.0.100 - name: Install dependencies run: dotnet restore - name: Build - Common Lib diff --git a/Cpp2IL/AssemblyBuilder.cs b/Cpp2IL/AssemblyBuilder.cs index 8a68f913..a88d6717 100644 --- a/Cpp2IL/AssemblyBuilder.cs +++ b/Cpp2IL/AssemblyBuilder.cs @@ -282,7 +282,12 @@ private static List ProcessTypeContents(Il2CppMetadata metadata, var fieldName = metadata.GetStringFromIndex(fieldDef.nameIndex); var fieldTypeRef = Utils.ImportTypeInto(ilTypeDefinition, fieldType, cppAssembly, metadata); + var fieldOffsetAttributeInst = new CustomAttribute(ilTypeDefinition.Module.ImportReference(fieldOffsetAttribute)); + fieldOffsetAttributeInst.Fields.Add(new CustomAttributeNamedArgument("Offset", new CustomAttributeArgument(stringType, $"0x{fieldOffset:X}"))); + var fieldDefinition = new FieldDefinition(fieldName, (FieldAttributes) fieldType.attrs, fieldTypeRef); + fieldDefinition.CustomAttributes.Add(fieldOffsetAttributeInst); + ilTypeDefinition.Fields.Add(fieldDefinition); //Field default values diff --git a/Cpp2IL/Cpp2IL.csproj b/Cpp2IL/Cpp2IL.csproj index cc09539a..4733eb76 100644 --- a/Cpp2IL/Cpp2IL.csproj +++ b/Cpp2IL/Cpp2IL.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net5.0 Exe 8 annotations