[change] 删除不必要的Datas~/Templates目录,直接以原始文件为模板

main
walon 2023-11-10 13:35:53 +08:00
parent febff1c658
commit d90faed922
6 changed files with 11 additions and 56 deletions

View File

@ -1,18 +0,0 @@
#include <codegen/il2cpp-codegen-metadata.h>
#include "vm/ClassInlines.h"
#include "vm/Object.h"
#include "vm/Class.h"
#include "../metadata/MetadataModule.h"
#include "../metadata/MetadataUtil.h"
#include "../interpreter/MethodBridge.h"
#include "../interpreter/Interpreter.h"
#include "../interpreter/MemoryUtil.h"
#include "../interpreter/InstrinctDef.h"
using namespace hybridclr::interpreter;
//!!!{{CODE
//!!!}}CODE

View File

@ -1,30 +0,0 @@
#include "../metadata/ReversePInvokeMethodStub.h"
#include "../metadata/MetadataModule.h"
namespace hybridclr
{
namespace metadata
{
//!!!{{CODE
void __ReversePInvokeMethod_0(void* xState)
{
CallLuaFunction(xState, 0);
}
void __ReversePInvokeMethod_1(void* xState)
{
CallLuaFunction(xState, 1);
}
Il2CppMethodPointer s_ReversePInvokeMethodStub[]
{
(Il2CppMethodPointer)__ReversePInvokeMethod_0,
(Il2CppMethodPointer)__ReversePInvokeMethod_1,
nullptr,
};
//!!!}}CODE
}
}

View File

@ -30,8 +30,9 @@ namespace HybridCLR.Editor.Commands
Directory.Delete(il2cppBuildCachePath, true); Directory.Delete(il2cppBuildCachePath, true);
} }
private static void GenerateMethodBridgeCppFile(Analyzer analyzer, string templateCode, string outputFile) private static void GenerateMethodBridgeCppFile(Analyzer analyzer, string outputFile)
{ {
string templateCode = File.ReadAllText(outputFile, Encoding.UTF8);
var g = new Generator(new Generator.Options() var g = new Generator(new Generator.Options()
{ {
TemplateCode = templateCode, TemplateCode = templateCode,
@ -41,7 +42,7 @@ namespace HybridCLR.Editor.Commands
g.PrepareMethods(); g.PrepareMethods();
g.Generate(); g.Generate();
Debug.LogFormat("== output:{0} ==", outputFile); Debug.LogFormat("[MethodBridgeGeneratorCommand] output:{0}", outputFile);
} }
[MenuItem("HybridCLR/Generate/MethodBridge", priority = 101)] [MenuItem("HybridCLR/Generate/MethodBridge", priority = 101)]
@ -70,9 +71,8 @@ namespace HybridCLR.Editor.Commands
}); });
analyzer.Run(); analyzer.Run();
string templateCode = File.ReadAllText($"{SettingsUtil.TemplatePathInPackage}/MethodBridgeStub.cpp");
string outputFile = $"{SettingsUtil.GeneratedCppDir}/MethodBridge.cpp"; string outputFile = $"{SettingsUtil.GeneratedCppDir}/MethodBridge.cpp";
GenerateMethodBridgeCppFile(analyzer, templateCode, outputFile); GenerateMethodBridgeCppFile(analyzer, outputFile);
} }
CleanIl2CppBuildCache(); CleanIl2CppBuildCache();

View File

@ -35,13 +35,13 @@ namespace HybridCLR.Editor.Commands
var analyzer = new ReversePInvokeWrap.Analyzer(cache, hotUpdateDlls); var analyzer = new ReversePInvokeWrap.Analyzer(cache, hotUpdateDlls);
analyzer.Run(); analyzer.Run();
string templateCode = File.ReadAllText($"{SettingsUtil.TemplatePathInPackage}/ReversePInvokeMethodStub.cpp");
string outputFile = $"{SettingsUtil.GeneratedCppDir}/ReversePInvokeMethodStub.cpp"; string outputFile = $"{SettingsUtil.GeneratedCppDir}/ReversePInvokeMethodStub.cpp";
List<ABIReversePInvokeMethodInfo> methods = analyzer.BuildABIMethods(); List<ABIReversePInvokeMethodInfo> methods = analyzer.BuildABIMethods();
Debug.Log($"GenerateReversePInvokeWrapper. wraperCount:{methods.Sum(m => m.Count)} output:{outputFile}"); Debug.Log($"GenerateReversePInvokeWrapper. wraperCount:{methods.Sum(m => m.Count)} output:{outputFile}");
var generator = new Generator(); var generator = new Generator();
generator.Generate(templateCode, methods, outputFile); generator.Generate(methods, outputFile);
Debug.LogFormat("[ReversePInvokeWrapperGeneratorCommand] output:{0}", outputFile);
} }
MethodBridgeGeneratorCommand.CleanIl2CppBuildCache(); MethodBridgeGeneratorCommand.CleanIl2CppBuildCache();
} }

View File

@ -2,15 +2,18 @@
using HybridCLR.Editor.Template; using HybridCLR.Editor.Template;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using UnityEngine; using UnityEngine;
namespace HybridCLR.Editor.ReversePInvokeWrap namespace HybridCLR.Editor.ReversePInvokeWrap
{ {
public class Generator public class Generator
{ {
public void Generate(string template, List<ABIReversePInvokeMethodInfo> methods, string outputFile) public void Generate(List<ABIReversePInvokeMethodInfo> methods, string outputFile)
{ {
string template = File.ReadAllText(outputFile, Encoding.UTF8);
var frr = new FileRegionReplace(template); var frr = new FileRegionReplace(template);
var codes = new List<string>(); var codes = new List<string>();

View File

@ -7,7 +7,7 @@ namespace HybridCLR.Editor.Settings
public static class MenuProvider public static class MenuProvider
{ {
[MenuItem("HybridCLR/About HybridCLR", priority = 0)] [MenuItem("HybridCLR/About", priority = 0)]
public static void OpenAbout() => Application.OpenURL("https://hybridclr.doc.code-philosophy.com/docs/intro"); public static void OpenAbout() => Application.OpenURL("https://hybridclr.doc.code-philosophy.com/docs/intro");
[MenuItem("HybridCLR/Installer...", priority = 60)] [MenuItem("HybridCLR/Installer...", priority = 60)]