2022-09-23 09:40:06 +08:00
|
|
|
|
using HybridCLR.Editor.Link;
|
2022-09-22 08:56:07 +08:00
|
|
|
|
using HybridCLR.Editor.ReversePInvokeWrap;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace HybridCLR.Editor.Commands
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public static class ReversePInvokeWrapperGeneratorCommand
|
|
|
|
|
{
|
|
|
|
|
|
2022-09-23 14:26:28 +08:00
|
|
|
|
[MenuItem("HybridCLR/Generate/ReversePInvokeWrapper", priority = 103)]
|
2022-09-22 08:56:07 +08:00
|
|
|
|
public static void GenerateReversePInvokeWrapper()
|
|
|
|
|
{
|
|
|
|
|
string ReversePInvokeWrapperStubFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/metadata/ReversePInvokeMethodStub.cpp";
|
2022-09-26 13:30:07 +08:00
|
|
|
|
string wrapperTemplateStr = File.ReadAllText($"{SettingsUtil.TemplatePathInPackage}/ReversePInvokeMethodStub.cpp.txt");
|
2022-10-09 20:53:13 +08:00
|
|
|
|
int wrapperCount = SettingsUtil.HybridCLRSettings.ReversePInvokeWrapperCount;
|
2022-09-23 09:40:06 +08:00
|
|
|
|
var generator = new Generator();
|
2022-09-22 08:56:07 +08:00
|
|
|
|
generator.Generate(wrapperTemplateStr, wrapperCount,ReversePInvokeWrapperStubFile);
|
|
|
|
|
Debug.Log($"GenerateReversePInvokeWrapper. wraperCount:{wrapperCount} output:{ReversePInvokeWrapperStubFile}");
|
|
|
|
|
MethodBridgeGeneratorCommand.CleanIl2CppBuildCache();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|