• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SamboyCoding / Cpp2IL / 15052278841

15 May 2025 06:16PM UTC coverage: 34.038% (-0.4%) from 34.453%
15052278841

push

github

SamboyCoding
Support injecting anything
* Nested types
* Events
* Properties
* Assemblies

Support additional metadata in injected assemblies

Make setter for TypeAnalysisContext::OverrideBaseType public

TypeAnalysisContext::InterfaceContexts as list rather than array

Fix sign bug

Support generic parameters on type contexts and method contexts

Make GenericParameterTypeAnalysisContext instances unique

Revert change to Il2CppGenericParameter::Index

Use attributes to determine if injected methods are static
* Also add hide by sig attribute for injected constructors

Support overrides on injected methods

In ControlFlowGraphOutputFormat, exclude injected assemblies

Ensure injected assemblies can't delete existing assemblies

Backing field on .NET Standard for injected method overrides

Implement requested change

1774 of 6622 branches covered (26.79%)

Branch coverage included in aggregate %.

147 of 196 new or added lines in 27 files covered. (75.0%)

53 existing lines in 2 files now uncovered.

4155 of 10797 relevant lines covered (38.48%)

188267.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.33
/Cpp2IL.Core/OutputFormats/WasmMappingOutputFormat.cs
1
using System;
2
using System.IO;
3
using System.Linq;
4
using System.Text;
5
using Cpp2IL.Core.Api;
6
using Cpp2IL.Core.Logging;
7
using Cpp2IL.Core.Model.Contexts;
8
using Cpp2IL.Core.Utils;
9
using LibCpp2IL.Wasm;
10

11
namespace Cpp2IL.Core.OutputFormats;
12

13
public class WasmMappingOutputFormat : Cpp2IlOutputFormat
14
{
15
    public override string OutputFormatId => "wasmmappings";
1✔
16
    public override string OutputFormatName => "WebAssembly Method Mappings";
×
17

18
    public override void DoOutput(ApplicationAnalysisContext context, string outputRoot)
19
    {
20
        if (context.Binary is not WasmFile wasmFile)
×
21
            throw new("This output format only works with WebAssembly files");
×
22

23
        Logger.InfoNewline("Generating WebAssembly method mappings...This may take up to a minute...", "WasmMappingOutputFormat");
×
24
        var output = new StringBuilder();
×
25

26
        foreach (var assemblyAnalysisContext in context.Assemblies)
×
27
        {
NEW
28
            output.Append("// ").Append(assemblyAnalysisContext.Name).Append(".dll").AppendLine().AppendLine();
×
29

30
            foreach (var typeAnalysisContext in assemblyAnalysisContext.Types)
×
31
            foreach (var methodAnalysisContext in typeAnalysisContext.Methods)
×
32
            {
33
                if (methodAnalysisContext is InjectedMethodAnalysisContext || methodAnalysisContext.Definition == null)
×
34
                    continue;
35

36
                output.Append(methodAnalysisContext.Definition.ReturnType)
×
37
                    .Append(' ')
×
38
                    .Append(methodAnalysisContext.DeclaringType!.FullName)
×
39
                    .Append("::")
×
40
                    .Append(methodAnalysisContext.Definition.Name)
×
41
                    .Append('(')
×
42
                    .Append(string.Join(", ", methodAnalysisContext.Definition.Parameters!.Select(p => $"{p.Type} {p.ParameterName}")))
×
43
                    .Append(") -> ");
×
44

45
                try
46
                {
47
                    var wasmDef = WasmUtils.GetWasmDefinition(methodAnalysisContext);
×
48
                    var ghidraName = WasmUtils.GetGhidraFunctionName(wasmDef);
×
49

50
                    output.AppendLine(ghidraName);
×
51
                }
×
52
                catch (Exception)
×
53
                {
54
                    output.AppendLine("<not resolved>");
×
55
                }
×
56
            }
57

58
            output.AppendLine().AppendLine();
×
59
        }
60

61
        var outPath = Path.Combine(outputRoot, "wasm_mappings.txt");
×
62
        File.WriteAllText(outPath, output.ToString());
×
63

64
        Logger.InfoNewline("Wasm mappings written to: " + outPath, "WasmMappingOutputFormat");
×
65
    }
×
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc