Skip to content

Commit

Permalink
Dependency improvements:
Browse files Browse the repository at this point in the history
* Fix static properties
* Fix a couple trimming issues in Capstone
* Update to AsmResolver 6
* Bump Iced
  • Loading branch information
ds5678 committed Jun 16, 2024
1 parent c5682ad commit 09b0c04
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Cpp2IL.Core/Cpp2IL.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@

<ItemGroup>
<!--Needed for DLL output-->
<PackageReference Include="AsmResolver.DotNet" Version="5.5.0" />
<PackageReference Include="AssetRipper.CIL" Version="1.0.0" />
<PackageReference Include="AsmResolver.DotNet" Version="6.0.0-beta.1" />
<PackageReference Include="AssetRipper.CIL" Version="1.1.0" />

<!--For ARM64 dissassembly-->
<PackageReference Include="Disarm" Version="2022.1.0-master.34" />

<!--For X86/X64 disassembly-->
<PackageReference Include="Iced" Version="1.20.0" />
<PackageReference Include="Iced" Version="1.21.0" />

<!--For ARM64 and ARMv7 disassembly. Future: Remove once disarm is stable and move ARMv7 to CapstoneSharp by 6pak-->
<PackageReference Include="AssetRipper.Gee.External.Capstone" Version="2.3.1" />
<PackageReference Include="AssetRipper.Gee.External.Capstone" Version="2.3.2" />

<!--Not used at runtime, but needed for the build-->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class AsmResolverDllOutputFormatDefault : AsmResolverDllOutputFormat

protected override void FillMethodBody(MethodDefinition methodDefinition, MethodAnalysisContext methodContext)
{
methodDefinition.FillMethodBodyWithStub();
methodDefinition.ReplaceMethodBodyWithMinimalImplementation();
}
}
4 changes: 2 additions & 2 deletions Cpp2IL.Core/OutputFormats/AsmResolverDummyDllOutputFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
using System.Threading.Tasks;
using AsmResolver.DotNet;
using AsmResolver.DotNet.Builder;
using AsmResolver.PE.DotNet.Builder;
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
using AsmResolver.PE.Builder;
using AsmResolver.PE.DotNet.Metadata.Tables;
using Cpp2IL.Core.Api;
using Cpp2IL.Core.Logging;
using Cpp2IL.Core.Model.Contexts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
using AsmResolver;
using AsmResolver.DotNet;
using AsmResolver.DotNet.Signatures;
using AsmResolver.DotNet.Signatures.Types;
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
using AsmResolver.PE.DotNet.Metadata.Tables;
using Cpp2IL.Core.Model.Contexts;
using Cpp2IL.Core.Model.CustomAttributes;
using LibCpp2IL.BinaryStructures;
Expand Down
6 changes: 3 additions & 3 deletions Cpp2IL.Core/Utils/AsmResolver/AsmResolverConstants.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;
using AsmResolver.DotNet;
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
using AsmResolver.PE.DotNet.Metadata.Tables;

namespace Cpp2IL.Core.Utils.AsmResolver;

Expand Down Expand Up @@ -65,4 +65,4 @@ private static ElementType GetElementTypeFromConstant(object? primitive)
char => ElementType.Char,
_ => throw new($"Can't get a element type for the constant {primitive} of type {primitive.GetType()}"),
};
}
}
4 changes: 1 addition & 3 deletions Cpp2IL.Core/Utils/AsmResolver/AsmResolverUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using AsmResolver.DotNet;
using AsmResolver.DotNet.Signatures.Types;
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
using AsmResolver.DotNet.Signatures;
using LibCpp2IL;
using LibCpp2IL.BinaryStructures;

Expand Down
2 changes: 1 addition & 1 deletion Cpp2IL.Core/Utils/AsmResolver/ContextToTypeSignature.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Linq;
using AsmResolver.DotNet;
using AsmResolver.DotNet.Signatures.Types;
using AsmResolver.DotNet.Signatures;
using Cpp2IL.Core.Model.Contexts;
using LibCpp2IL.BinaryStructures;

Expand Down
9 changes: 4 additions & 5 deletions Cpp2IL.Gui/GuiUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using AsmResolver.PE.Win32Resources;
using AssetRipper.Primitives;
using Cpp2IL.Core.Extensions;
using LibCpp2IL;

namespace Cpp2IL.Gui;

Expand All @@ -17,9 +16,9 @@ public static UnityVersion ReadFileVersionFromUnityExeXPlatform(string path)
{
var pe = PEImage.FromFile(path);

var versionResourceDirectory = (IResourceDirectory) pe.Resources!.GetEntry(16); //ID 16 is RT_VERSION, from https://docs.microsoft.com/en-us/windows/win32/menurc/resource-types
var theSingleVersionResource = (IResourceDirectory) versionResourceDirectory.Entries.Single();
var defaultCultureVersionResource = (IResourceData) theSingleVersionResource.Entries.Single();
var versionResourceDirectory = (ResourceDirectory) pe.Resources!.GetEntry(16); //ID 16 is RT_VERSION, from https://docs.microsoft.com/en-us/windows/win32/menurc/resource-types
var theSingleVersionResource = (ResourceDirectory) versionResourceDirectory.Entries.Single();
var defaultCultureVersionResource = (ResourceData) theSingleVersionResource.Entries.Single();
var versionResource = ((DataSegment) defaultCultureVersionResource.Contents!).Data;

//https://docs.microsoft.com/en-us/windows/win32/menurc/vs-versioninfo
Expand Down Expand Up @@ -158,4 +157,4 @@ public static UnityVersion ReadFileVersionFromUnityExeXPlatform(string path)

return default;
}
}
}
2 changes: 1 addition & 1 deletion LibCpp2IL/LibCpp2IL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AssetRipper.Primitives" Version="2.1.0" />
<PackageReference Include="AssetRipper.Primitives" Version="3.1.2" />
<PackageReference Include="PolySharp" Version="1.14.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>

Expand Down

0 comments on commit 09b0c04

Please sign in to comment.