diff --git a/Assets/XLua/Examples/13_BuildFromCLI/Editor/BuildFromCLI.cs b/Assets/XLua/Examples/13_BuildFromCLI/Editor/BuildFromCLI.cs index 20994710d..c496b8912 100644 --- a/Assets/XLua/Examples/13_BuildFromCLI/Editor/BuildFromCLI.cs +++ b/Assets/XLua/Examples/13_BuildFromCLI/Editor/BuildFromCLI.cs @@ -32,6 +32,7 @@ public static void Build() private static void build(string outputDir, string packageName) { Debug.Log("构建开始:输出目录 " + outputDir); + DelegateBridge.Gen_Flag = true; Generator.ClearAll(); Generator.GenAll(); diff --git a/Assets/XLua/Examples/ExampleGenConfig.cs b/Assets/XLua/Examples/ExampleGenConfig.cs index a4d723ba2..5f6710328 100644 --- a/Assets/XLua/Examples/ExampleGenConfig.cs +++ b/Assets/XLua/Examples/ExampleGenConfig.cs @@ -75,7 +75,7 @@ public static class ExampleGenConfig new List(){"UnityEngine.CanvasRenderer", "onRequestRebuild"}, new List(){"UnityEngine.Light", "areaSize"}, new List(){"UnityEngine.Light", "lightmapBakeType"}, - #if UNITY_ANDROID || UNITY_STANDALONE_WIN + #if UNITY_ANDROID new List(){"UnityEngine.Light", "SetLightDirty"}, new List(){"UnityEngine.Light", "shadowRadius"}, new List(){"UnityEngine.Light", "shadowAngle"}, diff --git a/Assets/XLua/Src/DelegateBridge.cs b/Assets/XLua/Src/DelegateBridge.cs index 965f62e2c..c0e8eb0b1 100644 --- a/Assets/XLua/Src/DelegateBridge.cs +++ b/Assets/XLua/Src/DelegateBridge.cs @@ -32,12 +32,9 @@ public abstract class DelegateBridgeBase : LuaBase protected int errorFuncRef; - protected RealStatePtr rawL; - public DelegateBridgeBase(int reference, LuaEnv luaenv) : base(reference, luaenv) { errorFuncRef = luaenv.errorFuncRef; - rawL = luaenv.rawL; } public bool TryGetDelegate(Type key, out Delegate value) @@ -130,7 +127,7 @@ public partial class DelegateBridge : DelegateBridgeBase { internal static DelegateBridge[] DelegateBridgeList = new DelegateBridge[0]; - public static bool Gen_Flag { get { return InternalGlobals.Gen_Flag; } } + public static bool Gen_Flag = false; public DelegateBridge(int reference, LuaEnv luaenv) : base(reference, luaenv) { diff --git a/Assets/XLua/Src/Editor/Hotfix.cs b/Assets/XLua/Src/Editor/Hotfix.cs index 1153c0762..cb1b02b4c 100644 --- a/Assets/XLua/Src/Editor/Hotfix.cs +++ b/Assets/XLua/Src/Editor/Hotfix.cs @@ -260,7 +260,6 @@ public class Hotfix { private TypeReference objType = null; private TypeReference delegateBridgeType = null; - private TypeReference delegateBridgeWrapType = null; private AssemblyDefinition injectAssembly = null; private MethodReference delegateBridgeGetter = null; @@ -279,22 +278,20 @@ public class Hotfix private List bridgeIndexByKey = null; - private bool isInjectAndGenTheSameAssembly = false; + private bool isTheSameAssembly = false; private int delegateId = 0; - public void Init(AssemblyDefinition injectAssembly, AssemblyDefinition xluaAssembly, AssemblyDefinition genAssembly, IEnumerable searchDirectorys, Dictionary hotfixCfg) + public void Init(AssemblyDefinition injectAssembly, AssemblyDefinition xluaAssembly, IEnumerable searchDirectorys, Dictionary hotfixCfg) { - isInjectAndGenTheSameAssembly = injectAssembly == genAssembly; + isTheSameAssembly = injectAssembly == xluaAssembly; this.injectAssembly = injectAssembly; this.hotfixCfg = hotfixCfg; var injectModule = injectAssembly.MainModule; objType = injectModule.TypeSystem.Object; var delegateBridgeTypeDef = xluaAssembly.MainModule.Types.Single(t => t.FullName == "XLua.DelegateBridge"); - var delegateBridgeTypeWrapDef = genAssembly.MainModule.Types.SingleOrDefault(t => t.FullName == "XLua.DelegateBridge_Wrap"); delegateBridgeType = injectModule.TryImport(delegateBridgeTypeDef); - delegateBridgeWrapType = injectModule.TryImport(delegateBridgeTypeWrapDef); delegateBridgeGetter = injectModule.TryImport(xluaAssembly.MainModule.Types.Single(t => t.FullName == "XLua.HotfixDelegateBridge") .Methods.Single(m => m.Name == "Get")); hotfixFlagGetter = injectModule.TryImport(xluaAssembly.MainModule.Types.Single(t => t.FullName == "XLua.HotfixDelegateBridge") @@ -309,7 +306,7 @@ public void Init(AssemblyDefinition injectAssembly, AssemblyDefinition xluaAssem inParams = injectModule.TryImport(delegateBridgeTypeDef.Methods.Single(m => m.Name == "InParams")); outParam = injectModule.TryImport(delegateBridgeTypeDef.Methods.Single(m => m.Name == "OutParam")); - hotfixBridgesDef = (from method in (delegateBridgeTypeWrapDef ?? delegateBridgeTypeDef).Methods + hotfixBridgesDef = (from method in delegateBridgeTypeDef.Methods where method.Name.StartsWith("__Gen_Delegate_Imp") select method).ToList(); hotfixBridgeToDelegate = new Dictionary(); @@ -320,9 +317,18 @@ where method.Name.StartsWith("__Gen_Delegate_Imp") bridgeIndexByKey = new List(); var resolverOfInjectAssembly = injectAssembly.MainModule.AssemblyResolver as BaseAssemblyResolver; + var resolverOfXluaAssembly = xluaAssembly.MainModule.AssemblyResolver as BaseAssemblyResolver; + if (!isTheSameAssembly) + { + resolverOfXluaAssembly.AddSearchDirectory(Path.GetDirectoryName(injectAssembly.MainModule.FullyQualifiedName)); + } Action addSearchDirectory = (string dir) => { resolverOfInjectAssembly.AddSearchDirectory(dir); + if (!isTheSameAssembly) + { + resolverOfXluaAssembly.AddSearchDirectory(dir); + } }; addSearchDirectory("./Library/ScriptAssemblies/"); foreach (var path in @@ -493,7 +499,7 @@ bool findHotfixDelegate(MethodDefinition method, out MethodReference invoke, Hot { bool ignoreValueType = hotfixType.HasFlag(HotfixFlagInTool.ValueTypeBoxing); - bool isIntKey = hotfixType.HasFlag(HotfixFlagInTool.IntKey) && !method.DeclaringType.HasGenericParameters && isInjectAndGenTheSameAssembly; + bool isIntKey = hotfixType.HasFlag(HotfixFlagInTool.IntKey) && !method.DeclaringType.HasGenericParameters && isTheSameAssembly; bool isAdaptByDelegate = !isIntKey && hotfixType.HasFlag(HotfixFlagInTool.AdaptByDelegate); @@ -547,7 +553,7 @@ bool findHotfixDelegate(MethodDefinition method, out MethodReference invoke, Hot { continue; } - invoke = (isInjectAndGenTheSameAssembly && !isAdaptByDelegate) ? hotfixBridgeDef : getDelegateInvokeFor(method, hotfixBridgeDef, ignoreValueType); + invoke = (isTheSameAssembly && !isAdaptByDelegate) ? hotfixBridgeDef : getDelegateInvokeFor(method, hotfixBridgeDef, ignoreValueType); return true; } } @@ -692,7 +698,7 @@ public bool InjectType(TypeReference hotfixAttributeType, TypeDefinition type) { return true; } - CustomAttribute hotfixAttr = type.CustomAttributes.FirstOrDefault(ca => isSameType(ca.AttributeType, hotfixAttributeType)); + CustomAttribute hotfixAttr = type.CustomAttributes.FirstOrDefault(ca => ca.AttributeType == hotfixAttributeType); HotfixFlagInTool hotfixType; if (hotfixAttr != null) { @@ -853,11 +859,10 @@ static void writeAssembly(AssemblyDefinition assembly, string assemblyPath) #endif } - public static void HotfixInject(string injectAssemblyPath, string xluaAssemblyPath, string genAssemblyPath, IEnumerable searchDirectorys, string idMapFilePath, Dictionary hotfixConfig) + public static void HotfixInject(string injectAssemblyPath, string xluaAssemblyPath, IEnumerable searchDirectorys, string idMapFilePath, Dictionary hotfixConfig) { AssemblyDefinition injectAssembly = null; AssemblyDefinition xluaAssembly = null; - AssemblyDefinition genAssembly = null; try { injectAssembly = readAssembly(injectAssemblyPath); @@ -873,11 +878,9 @@ public static void HotfixInject(string injectAssemblyPath, string xluaAssemblyPa xluaAssembly = (injectAssemblyPath == xluaAssemblyPath || injectAssembly.MainModule.FullyQualifiedName == xluaAssemblyPath) ? injectAssembly : readAssembly(xluaAssemblyPath); - genAssembly = (injectAssemblyPath == genAssemblyPath || injectAssembly.MainModule.FullyQualifiedName == genAssemblyPath) ? - injectAssembly : readAssembly(genAssemblyPath); Hotfix hotfix = new Hotfix(); - hotfix.Init(injectAssembly, xluaAssembly, genAssembly, searchDirectorys, hotfixConfig); + hotfix.Init(injectAssembly, xluaAssembly, searchDirectorys, hotfixConfig); //var hotfixDelegateAttributeType = assembly.MainModule.Types.Single(t => t.FullName == "XLua.HotfixDelegateAttribute"); var hotfixAttributeType = xluaAssembly.MainModule.Types.Single(t => t.FullName == "XLua.HotfixAttribute"); @@ -1224,7 +1227,7 @@ bool injectMethod(MethodDefinition method, HotfixFlagInTool hotfixType) FieldReference fieldReference = null; VariableDefinition injection = null; - bool isIntKey = hotfixType.HasFlag(HotfixFlagInTool.IntKey) && !type.HasGenericParameters && isInjectAndGenTheSameAssembly; + bool isIntKey = hotfixType.HasFlag(HotfixFlagInTool.IntKey) && !type.HasGenericParameters && isTheSameAssembly; //isIntKey = !type.HasGenericParameters; if (!isIntKey) @@ -1282,7 +1285,6 @@ bool injectMethod(MethodDefinition method, HotfixFlagInTool hotfixType) { processor.InsertBefore(insertPoint, processor.Create(OpCodes.Ldc_I4, bridgeIndexByKey.Count)); processor.InsertBefore(insertPoint, processor.Create(OpCodes.Call, delegateBridgeGetter)); - processor.InsertBefore(insertPoint, processor.Create(OpCodes.Castclass, delegateBridgeWrapType)); } else { @@ -1368,7 +1370,7 @@ bool injectMethod(MethodDefinition method, HotfixFlagInTool hotfixType) bool injectGenericMethod(MethodDefinition method, HotfixFlagInTool hotfixType) { //如果注入的是xlua所在之外的Assembly的话,不支持该方式 - if (!isInjectAndGenTheSameAssembly) + if (!isTheSameAssembly) { return true; } @@ -1425,7 +1427,6 @@ bool injectGenericMethod(MethodDefinition method, HotfixFlagInTool hotfixType) processor.InsertBefore(insertPoint, jmpInstruction); processor.InsertBefore(insertPoint, processor.Create(OpCodes.Ldc_I4, bridgeIndexByKey.Count)); processor.InsertBefore(insertPoint, processor.Create(OpCodes.Call, delegateBridgeGetter)); - processor.InsertBefore(insertPoint, processor.Create(OpCodes.Castclass, delegateBridgeWrapType)); processor.InsertBefore(insertPoint, processor.Create(OpCodes.Stloc, injection)); } else @@ -1662,12 +1663,6 @@ public static void HotfixInject(string assemblyDir) return; } - if (!DelegateBridge.Gen_Flag) - { - UnityEngine.Debug.LogError("You can't inject without genenerate code, try XLua->Generate Code"); - return; - } - if (EditorApplication.isCompiling) { UnityEngine.Debug.LogError("You can't inject before the compilation is done"); @@ -1720,22 +1715,19 @@ public static void HotfixInject(string assemblyDir) } } - var genCodeAssemblyPathInProject = (from assembly in AppDomain.CurrentDomain.GetAssemblies() - select assembly.GetType("XLua.DelegateBridge_Wrap")).FirstOrDefault(x => x != null).Module.FullyQualifiedName; - var genCodeAssemblyFileName = Path.GetFileName(genCodeAssemblyPathInProject); - var genCodeAssemblyPath = Path.Combine(assemblyDir, genCodeAssemblyFileName); - List< string> args = new List() { assembly_csharp_path, - typeof(LuaEnv).Module.FullyQualifiedName, - genCodeAssemblyPath, - id_map_file_path, hotfix_cfg_in_editor }; +#if UNITY_2019_1_OR_NEWER + List args = new List() { assembly_csharp_path, assembly_csharp_path, id_map_file_path, hotfix_cfg_in_editor }; +#else + List args = new List() { assembly_csharp_path, typeof(LuaEnv).Module.FullyQualifiedName, id_map_file_path, hotfix_cfg_in_editor }; +#endif foreach (var path in - (from asm in AppDomain.CurrentDomain.GetAssemblies() select System.IO.Path.GetDirectoryName(asm.ManifestModule.FullyQualifiedName)) + (from asm in AppDomain.CurrentDomain.GetAssemblies() select asm.ManifestModule.FullyQualifiedName) .Distinct()) { try { - args.Add(path); + args.Add(System.IO.Path.GetDirectoryName(path)); } catch (Exception) { @@ -1755,8 +1747,8 @@ public static void HotfixInject(string assemblyDir) if (injectAssemblyPaths.Count > 1) { var injectAssemblyFileName = Path.GetFileName(injectAssemblyPath); - args[3] = CSObjectWrapEditor.GeneratorConfig.common_path + "Resources/hotfix_id_map_" + injectAssemblyFileName.Substring(0, injectAssemblyFileName.Length - 4) + ".lua.txt"; - idMapFileNames.Add(args[3]); + args[2] = CSObjectWrapEditor.GeneratorConfig.common_path + "Resources/hotfix_id_map_" + injectAssemblyFileName.Substring(0, injectAssemblyFileName.Length - 4) + ".lua.txt"; + idMapFileNames.Add(args[2]); } Process hotfix_injection = new Process(); hotfix_injection.StartInfo.FileName = mono_path; diff --git a/Assets/XLua/Src/Editor/Template/LuaClassWrapGCM.tpl.txt b/Assets/XLua/Src/Editor/Template/LuaClassWrapGCM.tpl.txt index c274831b7..9a7d8f7b3 100644 --- a/Assets/XLua/Src/Editor/Template/LuaClassWrapGCM.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/LuaClassWrapGCM.tpl.txt @@ -120,50 +120,50 @@ local generic_arg_list, type_constraints = GenericArgumentList(type) %> namespace XLua { - public static partial class ObjectTranslator_Gen + public partial class ObjectTranslator { - public static void __Register<%=v_type_name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L) <%=type_constraints%> + public void __Register<%=v_type_name%><%=generic_arg_list%>(RealStatePtr L) <%=type_constraints%> { System.Type type = typeof(<%=CsFullTypeName(type)%>); - Utils.BeginObjectRegister(type, L, thiz, <%=meta_func_count%>, <%=obj_method_count%>, <%=obj_getter_count%>, <%=obj_setter_count%>); - <%ForEachCsList(operators, function(operator)%>Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "<%=(OpNameMap[operator.Name]):gsub('Meta', ''):lower()%>", thiz.<%=v_type_name%><%=OpNameMap[operator.Name]%><%=generic_arg_list%>); + Utils.BeginObjectRegister(type, L, this, <%=meta_func_count%>, <%=obj_method_count%>, <%=obj_getter_count%>, <%=obj_setter_count%>); + <%ForEachCsList(operators, function(operator)%>Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "<%=(OpNameMap[operator.Name]):gsub('Meta', ''):lower()%>", <%=v_type_name%><%=OpNameMap[operator.Name]%><%=generic_arg_list%>); <%end)%> - <%ForEachCsList(methods, function(method) if not method.IsStatic then %>Utils.RegisterFunc(L, Utils.METHOD_IDX, "<%=method.Name%>", thiz.<%=v_type_name%>_m_<%=method.Name%><%=generic_arg_list%>); + <%ForEachCsList(methods, function(method) if not method.IsStatic then %>Utils.RegisterFunc(L, Utils.METHOD_IDX, "<%=method.Name%>", <%=v_type_name%>_m_<%=method.Name%><%=generic_arg_list%>); <% end end)%> - <%ForEachCsList(events, function(event) if not event.IsStatic then %>Utils.RegisterFunc(L, Utils.METHOD_IDX, "<%=event.Name%>", thiz.<%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>); + <%ForEachCsList(events, function(event) if not event.IsStatic then %>Utils.RegisterFunc(L, Utils.METHOD_IDX, "<%=event.Name%>", <%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>); <% end end)%> - <%ForEachCsList(getters, function(getter) if not getter.IsStatic then %>Utils.RegisterFunc(L, Utils.GETTER_IDX, "<%=getter.Name%>", thiz.<%=v_type_name%>_g_get_<%=getter.Name%><%=generic_arg_list%>); + <%ForEachCsList(getters, function(getter) if not getter.IsStatic then %>Utils.RegisterFunc(L, Utils.GETTER_IDX, "<%=getter.Name%>", <%=v_type_name%>_g_get_<%=getter.Name%><%=generic_arg_list%>); <%end end)%> - <%ForEachCsList(setters, function(setter) if not setter.IsStatic then %>Utils.RegisterFunc(L, Utils.SETTER_IDX, "<%=setter.Name%>", thiz.<%=v_type_name%>_s_set_<%=setter.Name%><%=generic_arg_list%>); + <%ForEachCsList(setters, function(setter) if not setter.IsStatic then %>Utils.RegisterFunc(L, Utils.SETTER_IDX, "<%=setter.Name%>", <%=v_type_name%>_s_set_<%=setter.Name%><%=generic_arg_list%>); <%end end)%> <%ForEachCsList(lazymembers, function(lazymember) if lazymember.IsStatic == 'false' then %>Utils.RegisterLazyFunc(L, Utils.<%=lazymember.Index%>, "<%=lazymember.Name%>", type, <%=lazymember.MemberType%>, <%=lazymember.IsStatic%>); <%end end)%> - Utils.EndObjectRegister(type, L, thiz, <% if type.IsArray or ((indexers.Count or 0) > 0) then %>thiz.__CSIndexer<%=v_type_name%><%=generic_arg_list%><%else%>null<%end%>, <%if type.IsArray or ((newindexers.Count or 0) > 0) then%>thiz.__NewIndexer<%=v_type_name%><%=generic_arg_list%><%else%>null<%end%>, + Utils.EndObjectRegister(type, L, this, <% if type.IsArray or ((indexers.Count or 0) > 0) then %>__CSIndexer<%=v_type_name%><%=generic_arg_list%><%else%>null<%end%>, <%if type.IsArray or ((newindexers.Count or 0) > 0) then%>__NewIndexer<%=v_type_name%><%=generic_arg_list%><%else%>null<%end%>, null, null, null); - Utils.BeginClassRegister(type, L, thiz.__CreateInstance<%=v_type_name%><%=generic_arg_list%>, <%=cls_field_count%>, <%=cls_getter_count%>, <%=cls_setter_count%>); - <%ForEachCsList(methods, function(method) if method.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_IDX, "<%=method.Overloads[0].Name%>", thiz.<%=v_type_name%>_m_<%=method.Name%><%=generic_arg_list%>); + Utils.BeginClassRegister(type, L, __CreateInstance<%=v_type_name%><%=generic_arg_list%>, <%=cls_field_count%>, <%=cls_getter_count%>, <%=cls_setter_count%>); + <%ForEachCsList(methods, function(method) if method.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_IDX, "<%=method.Overloads[0].Name%>", <%=v_type_name%>_m_<%=method.Name%><%=generic_arg_list%>); <% end end)%> - <%ForEachCsList(events, function(event) if event.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_IDX, "<%=event.Name%>", thiz.<%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>); + <%ForEachCsList(events, function(event) if event.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_IDX, "<%=event.Name%>", <%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>); <% end end)%> - <%ForEachCsList(getters, function(getter) if getter.IsStatic and getter.ReadOnly then %>Utils.RegisterObject(L, thiz, Utils.CLS_IDX, "<%=getter.Name%>", <%=CsFullTypeName(type).."."..getter.Name%>); + <%ForEachCsList(getters, function(getter) if getter.IsStatic and getter.ReadOnly then %>Utils.RegisterObject(L, this, Utils.CLS_IDX, "<%=getter.Name%>", <%=CsFullTypeName(type).."."..getter.Name%>); <%end end)%> - <%ForEachCsList(getters, function(getter) if getter.IsStatic and (not getter.ReadOnly) then %>Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "<%=getter.Name%>", thiz.<%=v_type_name%>_g_get_<%=getter.Name%><%=generic_arg_list%>); + <%ForEachCsList(getters, function(getter) if getter.IsStatic and (not getter.ReadOnly) then %>Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "<%=getter.Name%>", <%=v_type_name%>_g_get_<%=getter.Name%><%=generic_arg_list%>); <%end end)%> - <%ForEachCsList(setters, function(setter) if setter.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "<%=setter.Name%>", thiz.<%=v_type_name%>_s_set_<%=setter.Name%><%=generic_arg_list%>); + <%ForEachCsList(setters, function(setter) if setter.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "<%=setter.Name%>", <%=v_type_name%>_s_set_<%=setter.Name%><%=generic_arg_list%>); <%end end)%> <%ForEachCsList(lazymembers, function(lazymember) if lazymember.IsStatic == 'true' then %>Utils.RegisterLazyFunc(L, Utils.<%=lazymember.Index%>, "<%=lazymember.Name%>", type, <%=lazymember.MemberType%>, <%=lazymember.IsStatic%>); <%end end)%> - Utils.EndClassRegister(type, L, thiz); + Utils.EndClassRegister(type, L, this); } - static int __CreateInstance<%=v_type_name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int __CreateInstance<%=v_type_name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { <% if constructors.Count == 0 and (not type.IsValueType) then %>return LuaAPI.luaL_error(L, "<%=CsFullTypeName(type)%> does not have a constructor!");<% else %> - ObjectTranslator translator = thiz; + ObjectTranslator translator = this; <% local hasZeroParamsCtor = false ForEachCsList(constructors, function(constructor, ci) @@ -225,10 +225,10 @@ namespace XLua } <% if type.IsArray or ((indexers.Count or 0) > 0) then %> - static int __CSIndexer<%=v_type_name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int __CSIndexer<%=v_type_name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { <%if type.IsArray then %> - ObjectTranslator translator = thiz; + ObjectTranslator translator = this; if (<%=GetCheckStatement(type, 1)%> && LuaAPI.lua_isnumber(L, 2)) { int index = (int)LuaAPI.lua_tonumber(L, 2); @@ -238,7 +238,7 @@ namespace XLua return 2; } <%elseif indexers.Count > 0 then - %>ObjectTranslator translator = thiz; + %>ObjectTranslator translator = this; <% ForEachCsList(indexers, function(indexer) local paramter = indexer:GetParameters()[0] @@ -260,9 +260,9 @@ namespace XLua <% end %> <%if type.IsArray or ((newindexers.Count or 0) > 0) then%> - static int __NewIndexer<%=v_type_name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int __NewIndexer<%=v_type_name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { - <%if type.IsArray or newindexers.Count > 0 then %>ObjectTranslator translator = thiz;<%end%> + <%if type.IsArray or newindexers.Count > 0 then %>ObjectTranslator translator = this;<%end%> <%if type.IsArray then local elementType = type:GetElementType() %> @@ -298,9 +298,9 @@ namespace XLua <% end %> <%ForEachCsList(operators, function(operator) %> - static int <%=v_type_name%><%=OpNameMap[operator.Name]%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int <%=v_type_name%><%=OpNameMap[operator.Name]%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { - ObjectTranslator translator = thiz; + ObjectTranslator translator = this; <% if operator.Name ~= "op_UnaryNegation" and operator.Name ~= "op_OnesComplement" then ForEachCsList(operator.Overloads, function(overload) local left_param = overload:GetParameters()[0] @@ -326,13 +326,13 @@ namespace XLua <%end)%> <%ForEachCsList(methods, function(method)%> - static int <%=v_type_name%>_m_<%=method.Name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int <%=v_type_name%>_m_<%=method.Name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { <% local need_obj = not method.IsStatic if MethodCallNeedTranslator(method) then %> - ObjectTranslator translator = thiz; + ObjectTranslator translator = this; <%end%> <%if need_obj then%> <%=GetSelfStatement(type)%>; @@ -426,9 +426,9 @@ namespace XLua <%ForEachCsList(getters, function(getter) if getter.IsStatic and getter.ReadOnly then return end --readonly static %> - static int <%=v_type_name%>_g_get_<%=getter.Name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int <%=v_type_name%>_g_get_<%=getter.Name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { - <%if AccessorNeedTranslator(getter) then %>ObjectTranslator translator = thiz;<%end%> + <%if AccessorNeedTranslator(getter) then %>ObjectTranslator translator = this;<%end%> <%if not getter.IsStatic then%> <%=GetSelfStatement(type)%>; <%=GetPushStatement(getter.Type, "gen_to_be_invoked."..UnK(getter.Name))%>;<% else %> <%=GetPushStatement(getter.Type, CsFullTypeName(type).."."..UnK(getter.Name))%>;<% end%> @@ -439,9 +439,9 @@ namespace XLua <%ForEachCsList(setters, function(setter) local is_struct = IsStruct(setter.Type) %> - static int <%=v_type_name%>_s_set_<%=setter.Name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int <%=v_type_name%>_s_set_<%=setter.Name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { - <%if AccessorNeedTranslator(setter) then %>ObjectTranslator translator = thiz;<%end%> + <%if AccessorNeedTranslator(setter) then %>ObjectTranslator translator = this;<%end%> <%if not setter.IsStatic then %> <%=GetSelfStatement(type)%>; <%if is_struct then %><%=GetCasterStatement(setter.Type, 2, "gen_value", true)%>; @@ -460,9 +460,9 @@ namespace XLua <%end)%> <%ForEachCsList(events, function(event) if not event.IsStatic then %> - static int <%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int <%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { - ObjectTranslator translator = thiz; + ObjectTranslator translator = this; <%=GetSelfStatement(type)%>; <%=GetCasterStatement(event.Type, 3, "gen_delegate", true)%>; if (gen_delegate == null) { @@ -490,9 +490,9 @@ namespace XLua <%end end)%> <%ForEachCsList(events, function(event) if event.IsStatic then %> - static int <%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>(this ObjectTranslator thiz, RealStatePtr L, int gen_param_count) <%=type_constraints%> + int <%=v_type_name%>_e_<%=event.Name%><%=generic_arg_list%>(RealStatePtr L, int gen_param_count) <%=type_constraints%> { - ObjectTranslator translator = thiz; + ObjectTranslator translator = this; <%=GetCasterStatement(event.Type, 2, "gen_delegate", true)%>; if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#2 need <%=CsFullTypeName(event.Type)%>!"); diff --git a/Assets/XLua/Src/Editor/Template/LuaDelegateBridge.tpl.txt b/Assets/XLua/Src/Editor/Template/LuaDelegateBridge.tpl.txt index b0be85b1f..1c003bc3a 100644 --- a/Assets/XLua/Src/Editor/Template/LuaDelegateBridge.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/LuaDelegateBridge.tpl.txt @@ -1,4 +1,4 @@ -#if USE_UNI_LUA +#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; @@ -15,9 +15,8 @@ require "TemplateCommon" namespace XLua { - public partial class DelegateBridge_Wrap : DelegateBridge + public partial class DelegateBridge : DelegateBridgeBase { - public DelegateBridge_Wrap(int reference, LuaEnv luaenv) : base(reference, luaenv){} <% ForEachCsList(delegates_groups, function(delegates_group, group_idx) local delegate = delegates_group.Key @@ -46,7 +45,7 @@ namespace XLua lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.rawL; int errFunc = LuaAPI.pcall_prepare(L, errorFuncRef, luaReference); <%if CallNeedTranslator(delegate, "") then %>ObjectTranslator translator = luaEnv.translator;<%end%> <% @@ -75,6 +74,11 @@ namespace XLua #endif } <%end)%> + + static DelegateBridge() + { + Gen_Flag = true; + } public override Delegate GetDelegateByType(Type type) { diff --git a/Assets/XLua/Src/Editor/Template/LuaEnumWrapGCM.tpl.txt b/Assets/XLua/Src/Editor/Template/LuaEnumWrapGCM.tpl.txt index 8b7e9430f..60376d3e0 100644 --- a/Assets/XLua/Src/Editor/Template/LuaEnumWrapGCM.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/LuaEnumWrapGCM.tpl.txt @@ -17,7 +17,7 @@ local enum_or_op = debug.getmetatable(CS.System.Reflection.BindingFlags.Public). namespace XLua { - public static partial class ObjectTranslator_Gen + public partial class ObjectTranslator { <%ForEachCsList(types, function(type) local fields = type2fields and type2fields[type] or type:GetFields(enum_or_op(CS.System.Reflection.BindingFlags.Public, CS.System.Reflection.BindingFlags.Static)) @@ -29,32 +29,32 @@ namespace XLua end) local v_type_name = CSVariableName(type) %> - public static void __Register<%=v_type_name%>(this ObjectTranslator thiz, RealStatePtr L) + public void __Register<%=v_type_name%>(RealStatePtr L) { - Utils.BeginObjectRegister(typeof(<%=CsFullTypeName(type)%>), L, thiz, 0, 0, 0, 0); - Utils.EndObjectRegister(typeof(<%=CsFullTypeName(type)%>), L, thiz, null, null, null, null, null); + Utils.BeginObjectRegister(typeof(<%=CsFullTypeName(type)%>), L, this, 0, 0, 0, 0); + Utils.EndObjectRegister(typeof(<%=CsFullTypeName(type)%>), L, this, null, null, null, null, null); Utils.BeginClassRegister(typeof(<%=CsFullTypeName(type)%>), L, null, <%=fields.Length + 1%>, 0, 0); <%if #fields_to_gen <= 20 then%> <% ForEachCsList(fields, function(field) if field.Name == "value__" or IsObsolute(field) then return end %> - Utils.RegisterObject(L, thiz, Utils.CLS_IDX, "<%=field.Name%>", <%=CsFullTypeName(type)%>.<%=UnK(field.Name)%>); + Utils.RegisterObject(L, this, Utils.CLS_IDX, "<%=field.Name%>", <%=CsFullTypeName(type)%>.<%=UnK(field.Name)%>); <%end)%> <%else%> Utils.RegisterEnumType(L, typeof(<%=CsFullTypeName(type)%>)); <%end%> - Utils.RegisterFunc(L, Utils.CLS_IDX, "__CastFrom", thiz.__CastFrom<%=v_type_name%>); + Utils.RegisterFunc(L, Utils.CLS_IDX, "__CastFrom", __CastFrom<%=v_type_name%>); - Utils.EndClassRegister(typeof(<%=CsFullTypeName(type)%>), L, thiz); + Utils.EndClassRegister(typeof(<%=CsFullTypeName(type)%>), L, this); } - static int __CastFrom<%=v_type_name%>(this ObjectTranslator thiz, RealStatePtr L, int __gen_top) + int __CastFrom<%=v_type_name%>(RealStatePtr L, int __gen_top) { LuaTypes lua_type = LuaAPI.lua_type(L, 1); if (lua_type == LuaTypes.LUA_TNUMBER) { - thiz.Push<%=v_type_name%>(L, (<%=CsFullTypeName(type)%>)LuaAPI.xlua_tointeger(L, 1)); + Push<%=v_type_name%>(L, (<%=CsFullTypeName(type)%>)LuaAPI.xlua_tointeger(L, 1)); } <%if #fields_to_gen > 0 then%> else if(lua_type == LuaTypes.LUA_TSTRING) @@ -66,7 +66,7 @@ namespace XLua if field.Name == "value__" or IsObsolute(field) then return end %><%=(is_first and "" or "else ")%>if (LuaAPI.xlua_is_eq_str(L, 1, "<%=field.Name%>")) { - thiz.Push<%=v_type_name%>(L, <%=CsFullTypeName(type)%>.<%=UnK(field.Name)%>); + Push<%=v_type_name%>(L, <%=CsFullTypeName(type)%>.<%=UnK(field.Name)%>); } <% is_first = false diff --git a/Assets/XLua/Src/Editor/Template/LuaInterfaceBridge.tpl.txt b/Assets/XLua/Src/Editor/Template/LuaInterfaceBridge.tpl.txt index 4df7bb77f..629c64276 100644 --- a/Assets/XLua/Src/Editor/Template/LuaInterfaceBridge.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/LuaInterfaceBridge.tpl.txt @@ -19,7 +19,6 @@ namespace XLua.CSObjectWrap { public class <%=CSVariableName(type)%>Bridge : LuaBase, <%=CsFullTypeName(type)%> { - RealStatePtr rawL; public static LuaBase __Create(int reference, LuaEnv luaenv) { return new <%=CSVariableName(type)%>Bridge(reference, luaenv); @@ -27,7 +26,6 @@ namespace XLua.CSObjectWrap public <%=CSVariableName(type)%>Bridge(int reference, LuaEnv luaenv) : base(reference, luaenv) { - rawL = luaenv.L; } <% @@ -57,7 +55,7 @@ namespace XLua.CSObjectWrap lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.L; int err_func = LuaAPI.load_error_func(L, luaEnv.errorFuncRef); <%if CallNeedTranslator(method, "") then %>ObjectTranslator translator = luaEnv.translator;<%end%> @@ -116,7 +114,7 @@ namespace XLua.CSObjectWrap lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.L; int oldTop = LuaAPI.lua_gettop(L); <%if not JustLuaType(property.PropertyType) then %>ObjectTranslator translator = luaEnv.translator;<%end%> LuaAPI.lua_getref(L, luaReference); @@ -140,7 +138,7 @@ namespace XLua.CSObjectWrap lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.L; int oldTop = LuaAPI.lua_gettop(L); <%if not JustLuaType(property.PropertyType) then %>ObjectTranslator translator = luaEnv.translator;<%end%> LuaAPI.lua_getref(L, luaReference); @@ -168,7 +166,7 @@ namespace XLua.CSObjectWrap lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.L; int err_func = LuaAPI.load_error_func(L, luaEnv.errorFuncRef); <%if CallNeedTranslator(event:GetAddMethod(), "") then %>ObjectTranslator translator = luaEnv.translator;<%end%> @@ -211,7 +209,7 @@ namespace XLua.CSObjectWrap lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.L; int err_func = LuaAPI.load_error_func(L, luaEnv.errorFuncRef); <%if CallNeedTranslator(event:GetRemoveMethod(), "") then %>ObjectTranslator translator = luaEnv.translator;<%end%> @@ -272,7 +270,7 @@ namespace XLua.CSObjectWrap lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.L; int err_func = LuaAPI.load_error_func(L, luaEnv.errorFuncRef); <%if CallNeedTranslator(method, "") then %>ObjectTranslator translator = luaEnv.translator;<%end%> @@ -335,7 +333,7 @@ namespace XLua.CSObjectWrap lock (luaEnv.luaEnvLock) { #endif - RealStatePtr L = this.rawL; + RealStatePtr L = luaEnv.L; int err_func = LuaAPI.load_error_func(L, luaEnv.errorFuncRef); <%if CallNeedTranslator(method, "") then %>ObjectTranslator translator = luaEnv.translator;<%end%> diff --git a/Assets/XLua/Src/Editor/Template/LuaRegister.tpl.txt b/Assets/XLua/Src/Editor/Template/LuaRegister.tpl.txt index 40aea874b..07d02d1af 100644 --- a/Assets/XLua/Src/Editor/Template/LuaRegister.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/LuaRegister.tpl.txt @@ -1,4 +1,4 @@ -#if USE_UNI_LUA +#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; @@ -70,7 +70,7 @@ namespace XLua.CSObjectWrap split_method_count = split_method_count + 1 %>}<%end%> - public static void Init(LuaEnv luaenv, ObjectTranslator translator) + static void Init(LuaEnv luaenv, ObjectTranslator translator) { <%for i = 1, split_method_count do%> <%=split_method_perfix%><%=(i - 1)%>(luaenv, translator); @@ -79,12 +79,25 @@ namespace XLua.CSObjectWrap translator.AddInterfaceBridgeCreator(typeof(<%=CsFullTypeName(itf_bridge)%>), <%=CSVariableName(itf_bridge)%>Bridge.__Create); <%end)%> } + + static XLua_Gen_Initer_Register__() + { + XLua.LuaEnv.AddIniter(Init); + } + + } + } - namespace XLua { - internal partial class InternalGlobals_Gen + public partial class ObjectTranslator + { + static XLua.CSObjectWrap.XLua_Gen_Initer_Register__ s_gen_reg_dumb_obj = new XLua.CSObjectWrap.XLua_Gen_Initer_Register__(); + static XLua.CSObjectWrap.XLua_Gen_Initer_Register__ gen_reg_dumb_obj {get{return s_gen_reg_dumb_obj;}} + } + + internal partial class InternalGlobals { <% local type_to_methods = {} @@ -102,15 +115,8 @@ namespace XLua %><%if pi ~= 0 then%>, <%end%><%if parameter.IsOut then %>out <% elseif parameter.ParameterType.IsByRef then %>ref <% end %> <%=CsFullTypeName(parameter.ParameterType)%> <%=parameter.Name%><% end)%>); <%end)%> - private delegate bool TryArrayGet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int index); - private delegate bool TryArraySet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int array_idx, int obj_idx); - private static void Init( - out Dictionary> extensionMethodMap, - out TryArrayGet genTryArrayGetPtr, - out TryArraySet genTryArraySetPtr) + static InternalGlobals() { - XLua.LuaEnv.AddIniter(XLua.CSObjectWrap.XLua_Gen_Initer_Register__.Init); - XLua.LuaEnv.AddIniter(XLua.ObjectTranslator_Gen.Init); extensionMethodMap = new Dictionary>() { <%for _, methods_info in ipairs(seq_tbl) do%> @@ -127,8 +133,8 @@ namespace XLua <%end%> }; - genTryArrayGetPtr = StaticLuaCallbacks_Wrap.__tryArrayGet; - genTryArraySetPtr = StaticLuaCallbacks_Wrap.__tryArraySet; + genTryArrayGetPtr = StaticLuaCallbacks.__tryArrayGet; + genTryArraySetPtr = StaticLuaCallbacks.__tryArraySet; } } } diff --git a/Assets/XLua/Src/Editor/Template/LuaRegisterGCM.tpl.txt b/Assets/XLua/Src/Editor/Template/LuaRegisterGCM.tpl.txt index 8777c430e..5dcb31645 100644 --- a/Assets/XLua/Src/Editor/Template/LuaRegisterGCM.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/LuaRegisterGCM.tpl.txt @@ -70,7 +70,7 @@ namespace XLua.CSObjectWrap split_method_count = split_method_count + 1 %>}<%end%> - public static void Init(LuaEnv luaenv, ObjectTranslator translator) + static void Init(LuaEnv luaenv, ObjectTranslator translator) { <%for i = 1, split_method_count do%> <%=split_method_perfix%><%=(i - 1)%>(luaenv, translator); @@ -79,12 +79,25 @@ namespace XLua.CSObjectWrap translator.AddInterfaceBridgeCreator(typeof(<%=CsFullTypeName(itf_bridge)%>), <%=CSVariableName(itf_bridge)%>Bridge.__Create); <%end)%> } + + static XLua_Gen_Initer_Register__() + { + XLua.LuaEnv.AddIniter(Init); + } + + } + } - namespace XLua { - internal partial class InternalGlobals_Gen + public partial class ObjectTranslator + { + static XLua.CSObjectWrap.XLua_Gen_Initer_Register__ s_gen_reg_dumb_obj = new XLua.CSObjectWrap.XLua_Gen_Initer_Register__(); + static XLua.CSObjectWrap.XLua_Gen_Initer_Register__ gen_reg_dumb_obj {get{return s_gen_reg_dumb_obj;}} + } + + internal partial class InternalGlobals { <% local type_to_methods = {} @@ -102,15 +115,8 @@ namespace XLua %><%if pi ~= 0 then%>, <%end%><%if parameter.IsOut then %>out <% elseif parameter.ParameterType.IsByRef then %>ref <% end %> <%=CsFullTypeName(parameter.ParameterType)%> <%=parameter.Name%><% end)%>); <%end)%> - private delegate bool TryArrayGet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int index); - private delegate bool TryArraySet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int array_idx, int obj_idx); - private static void Init( - out Dictionary> extensionMethodMap, - out TryArrayGet genTryArrayGetPtr, - out TryArraySet genTryArraySetPtr) + static InternalGlobals() { - XLua.LuaEnv.AddIniter(XLua.CSObjectWrap.XLua_Gen_Initer_Register__.Init); - XLua.LuaEnv.AddIniter(XLua.ObjectTranslator_Gen.Init); extensionMethodMap = new Dictionary>() { <%for _, methods_info in ipairs(seq_tbl) do%> @@ -127,8 +133,8 @@ namespace XLua <%end%> }; - genTryArrayGetPtr = StaticLuaCallbacks_Wrap.__tryArrayGet; - genTryArraySetPtr = StaticLuaCallbacks_Wrap.__tryArraySet; + genTryArrayGetPtr = StaticLuaCallbacks.__tryArrayGet; + genTryArraySetPtr = StaticLuaCallbacks.__tryArraySet; } } } diff --git a/Assets/XLua/Src/Editor/Template/LuaWrapPusher.tpl.txt b/Assets/XLua/Src/Editor/Template/LuaWrapPusher.tpl.txt index f3c9a7cd5..c258beff9 100644 --- a/Assets/XLua/Src/Editor/Template/LuaWrapPusher.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/LuaWrapPusher.tpl.txt @@ -1,4 +1,4 @@ -#if USE_UNI_LUA +#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; @@ -15,44 +15,50 @@ require "TemplateCommon" namespace XLua { - public static partial class ObjectTranslator_Gen + public partial class ObjectTranslator { - public static void Init(LuaEnv luaenv, ObjectTranslator translator) - { - <%ForEachCsList(purevaluetypes, function(type_info) - local type_id_var_name = CSVariableName(type_info.Type) .. '_TypeID' - local enum_ref_var_name = CSVariableName(type_info.Type)..'_EnumRef' - local full_type_name = CsFullTypeName(type_info.Type) - local is_enum = type_info.Type.IsEnum%> - <%=type_id_var_name%> = -1;<%if is_enum then%> - <%=enum_ref_var_name%> = -1;<%end%> - <%end)%> - - <%ForEachCsList(purevaluetypes, function(type_info) - if not type_info.Type.IsValueType then return end - local full_type_name = CsFullTypeName(type_info.Type)%> - translator.RegisterPushAndGetAndUpdate<<%=full_type_name%>>(translator.Push<%=CSVariableName(type_info.Type)%>, translator.Get<%=CSVariableName(type_info.Type)%>, translator.Update<%=CSVariableName(type_info.Type)%>);<% - end)%> - <%ForEachCsList(tableoptimzetypes, function(type_info) - local full_type_name = CsFullTypeName(type_info.Type)%> - translator.RegisterCaster<<%=full_type_name%>>(translator.Get<%=full_type_name%>);<% - end)%> - } + <%if purevaluetypes.Count > 0 then + local init_class_name = "IniterAdder" .. CSVariableName(purevaluetypes[0].Type) + %> + class <%=init_class_name%> + { + static <%=init_class_name%>() + { + LuaEnv.AddIniter(Init); + } + + static void Init(LuaEnv luaenv, ObjectTranslator translator) + { + <%ForEachCsList(purevaluetypes, function(type_info) + if not type_info.Type.IsValueType then return end + local full_type_name = CsFullTypeName(type_info.Type)%> + translator.RegisterPushAndGetAndUpdate<<%=full_type_name%>>(translator.Push<%=CSVariableName(type_info.Type)%>, translator.Get, translator.Update<%=CSVariableName(type_info.Type)%>);<% + end)%> + <%ForEachCsList(tableoptimzetypes, function(type_info) + local full_type_name = CsFullTypeName(type_info.Type)%> + translator.RegisterCaster<<%=full_type_name%>>(translator.Get);<% + end)%> + } + } + + static <%=init_class_name%> s_<%=init_class_name%>_dumb_obj = new <%=init_class_name%>(); + static <%=init_class_name%> <%=init_class_name%>_dumb_obj {get{return s_<%=init_class_name%>_dumb_obj;}} + <%end%> <%ForEachCsList(purevaluetypes, function(type_info) local type_id_var_name = CSVariableName(type_info.Type) .. '_TypeID' local enum_ref_var_name = CSVariableName(type_info.Type)..'_EnumRef' local full_type_name = CsFullTypeName(type_info.Type) local is_enum = type_info.Type.IsEnum - %>static int <%=type_id_var_name%> = -1;<%if is_enum then%> - static int <%=enum_ref_var_name%> = -1; + %>int <%=type_id_var_name%> = -1;<%if is_enum then%> + int <%=enum_ref_var_name%> = -1; <%end%> - public static void Push<%=CSVariableName(type_info.Type)%>(this ObjectTranslator thiz, RealStatePtr L, <%=full_type_name%> val) + public void Push<%=CSVariableName(type_info.Type)%>(RealStatePtr L, <%=full_type_name%> val) { if (<%=type_id_var_name%> == -1) { bool is_first; - <%=type_id_var_name%> = thiz.getTypeId(L, typeof(<%=full_type_name%>), out is_first); + <%=type_id_var_name%> = getTypeId(L, typeof(<%=full_type_name%>), out is_first); <%if is_enum then%> if (<%=enum_ref_var_name%> == -1) { @@ -79,7 +85,7 @@ namespace XLua <%end)%> <%else%> IntPtr buff = LuaAPI.xlua_pushstruct(L, <%=is_enum and 4 or type_info.Size%>, <%=type_id_var_name%>); - if (!CopyByValue_Gen.Pack(buff, 0, <%=is_enum and "(int)" or ""%>val)) + if (!CopyByValue.Pack(buff, 0, <%=is_enum and "(int)" or ""%>val)) { throw new Exception("pack fail fail for <%=full_type_name%> ,value="+val); } @@ -94,7 +100,7 @@ namespace XLua <%end%> } - public static void Get<%=CSVariableName(type_info.Type)%>(this ObjectTranslator thiz, RealStatePtr L, int index, out <%=full_type_name%> val) + public void Get(RealStatePtr L, int index, out <%=full_type_name%> val) { LuaTypes type = LuaAPI.lua_type(L, index); if (type == LuaTypes.LUA_TUSERDATA ) @@ -106,7 +112,7 @@ namespace XLua IntPtr buff = LuaAPI.lua_touserdata(L, index);<%if is_enum then%> int e; - <%end%>if (!CopyByValue_Gen.UnPack(buff, 0, out <%=is_enum and "e" or "val"%>)) + <%end%>if (!CopyByValue.UnPack(buff, 0, out <%=is_enum and "e" or "val"%>)) { throw new Exception("unpack fail for <%=full_type_name%>"); }<%if is_enum then%> @@ -115,15 +121,15 @@ namespace XLua }<%if not is_enum then%> else if (type ==LuaTypes.LUA_TTABLE) { - CopyByValue_Gen.UnPack(thiz, L, index, out val); + CopyByValue.UnPack(this, L, index, out val); }<%end%> else { - val = (<%=full_type_name%>)thiz.objectCasters.GetCaster(typeof(<%=full_type_name%>))(L, index, null); + val = (<%=full_type_name%>)objectCasters.GetCaster(typeof(<%=full_type_name%>))(L, index, null); } } - public static void Update<%=CSVariableName(type_info.Type)%>(this ObjectTranslator thiz, RealStatePtr L, int index, <%=full_type_name%> val) + public void Update<%=CSVariableName(type_info.Type)%>(RealStatePtr L, int index, <%=full_type_name%> val) { <%if type_info.Flag == CS.XLua.OptimizeFlag.PackAsTable then%> if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TTABLE) @@ -139,7 +145,7 @@ namespace XLua } IntPtr buff = LuaAPI.lua_touserdata(L, index); - if (!CopyByValue_Gen.Pack(buff, 0, <%=is_enum and "(int)" or ""%>val)) + if (!CopyByValue.Pack(buff, 0, <%=is_enum and "(int)" or ""%>val)) { throw new Exception("pack fail for <%=full_type_name%> ,value="+val); } @@ -156,12 +162,12 @@ namespace XLua <%ForEachCsList(tableoptimzetypes, function(type_info) local full_type_name = CsFullTypeName(type_info.Type) %> - public static void Get<%=CSVariableName(type_info.Type)%>(this ObjectTranslator thiz, RealStatePtr L, int index, out <%=full_type_name%> val) + public void Get(RealStatePtr L, int index, out <%=full_type_name%> val) { LuaTypes type = LuaAPI.lua_type(L, index); if (type == LuaTypes.LUA_TUSERDATA ) { - val = (<%=full_type_name%>)thiz.FastGetCSObj(L, index); + val = (<%=full_type_name%>)FastGetCSObj(L, index); } else if (type == LuaTypes.LUA_TTABLE) { @@ -170,7 +176,7 @@ namespace XLua <%ForEachCsList(type_info.Fields, function(fieldInfo)%> if (Utils.LoadField(L, index, "<%=fieldInfo.Name%>")) { - thiz.Get(L, top + 1, out val.<%=fieldInfo.Name%>); + Get(L, top + 1, out val.<%=fieldInfo.Name%>); } LuaAPI.lua_pop(L, 1); <%end)%> @@ -188,7 +194,7 @@ namespace XLua } - public partial class StaticLuaCallbacks_Wrap + public partial class StaticLuaCallbacks { internal static bool __tryArrayGet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int index) { diff --git a/Assets/XLua/Src/Editor/Template/PackUnpack.tpl.txt b/Assets/XLua/Src/Editor/Template/PackUnpack.tpl.txt index e29a223e3..77991e82d 100644 --- a/Assets/XLua/Src/Editor/Template/PackUnpack.tpl.txt +++ b/Assets/XLua/Src/Editor/Template/PackUnpack.tpl.txt @@ -1,4 +1,4 @@ -#if USE_UNI_LUA +#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; @@ -15,128 +15,8 @@ require "TemplateCommon" namespace XLua { - public static partial class CopyByValue_Gen + public static partial class CopyByValue { - //-------------------------- CopyByValueBase ---------------------------------// - public static bool Pack(IntPtr buff, int offset, byte field) - { - return LuaAPI.xlua_pack_int8_t(buff, offset, field); - } - public static bool UnPack(IntPtr buff, int offset, out byte field) - { - return LuaAPI.xlua_unpack_int8_t(buff, offset, out field); - } - public static bool Pack(IntPtr buff, int offset, sbyte field) - { - return LuaAPI.xlua_pack_int8_t(buff, offset, (byte)field); - } - public static bool UnPack(IntPtr buff, int offset, out sbyte field) - { - byte tfield; - bool ret = LuaAPI.xlua_unpack_int8_t(buff, offset, out tfield); - field = (sbyte)tfield; - return ret; - } - // for int16 - public static bool Pack(IntPtr buff, int offset, short field) - { - return LuaAPI.xlua_pack_int16_t(buff, offset, field); - } - public static bool UnPack(IntPtr buff, int offset, out short field) - { - return LuaAPI.xlua_unpack_int16_t(buff, offset, out field); - } - public static bool Pack(IntPtr buff, int offset, ushort field) - { - return LuaAPI.xlua_pack_int16_t(buff, offset, (short)field); - } - public static bool UnPack(IntPtr buff, int offset, out ushort field) - { - short tfield; - bool ret = LuaAPI.xlua_unpack_int16_t(buff, offset, out tfield); - field = (ushort)tfield; - return ret; - } - // for int32 - public static bool Pack(IntPtr buff, int offset, int field) - { - return LuaAPI.xlua_pack_int32_t(buff, offset, field); - } - public static bool UnPack(IntPtr buff, int offset, out int field) - { - return LuaAPI.xlua_unpack_int32_t(buff, offset, out field); - } - public static bool Pack(IntPtr buff, int offset, uint field) - { - return LuaAPI.xlua_pack_int32_t(buff, offset, (int)field); - } - public static bool UnPack(IntPtr buff, int offset, out uint field) - { - int tfield; - bool ret = LuaAPI.xlua_unpack_int32_t(buff, offset, out tfield); - field = (uint)tfield; - return ret; - } - // for int64 - public static bool Pack(IntPtr buff, int offset, long field) - { - return LuaAPI.xlua_pack_int64_t(buff, offset, field); - } - public static bool UnPack(IntPtr buff, int offset, out long field) - { - return LuaAPI.xlua_unpack_int64_t(buff, offset, out field); - } - public static bool Pack(IntPtr buff, int offset, ulong field) - { - return LuaAPI.xlua_pack_int64_t(buff, offset, (long)field); - } - public static bool UnPack(IntPtr buff, int offset, out ulong field) - { - long tfield; - bool ret = LuaAPI.xlua_unpack_int64_t(buff, offset, out tfield); - field = (ulong)tfield; - return ret; - } - // for float - public static bool Pack(IntPtr buff, int offset, float field) - { - return LuaAPI.xlua_pack_float(buff, offset, field); - } - public static bool UnPack(IntPtr buff, int offset, out float field) - { - return LuaAPI.xlua_unpack_float(buff, offset, out field); - } - // for double - public static bool Pack(IntPtr buff, int offset, double field) - { - return LuaAPI.xlua_pack_double(buff, offset, field); - } - public static bool UnPack(IntPtr buff, int offset, out double field) - { - return LuaAPI.xlua_unpack_double(buff, offset, out field); - } - // for decimal - public static bool Pack(IntPtr buff, int offset, decimal field) - { - return LuaAPI.xlua_pack_decimal(buff, offset, ref field); - } - public static bool UnPack(IntPtr buff, int offset, out decimal field) - { - byte scale; - byte sign; - int hi32; - ulong lo64; - if (!LuaAPI.xlua_unpack_decimal(buff, offset, out scale, out sign, out hi32, out lo64)) - { - field = default(decimal); - return false; - } - - field = new Decimal((int)(lo64 & 0xFFFFFFFF), (int)(lo64 >> 32), hi32, (sign & 0x80) != 0, scale); - return true; - } - //-------------------------- CopyByValueBase ---------------------------------// - <%ForEachCsList(type_infos, function(type_info) local full_type_name = CsFullTypeName(type_info.Type) %> diff --git a/Assets/XLua/Src/Editor/Xlua.Core.Editor.asmdef b/Assets/XLua/Src/Editor/Xlua.Core.Editor.asmdef deleted file mode 100644 index 1a9b79ead..000000000 --- a/Assets/XLua/Src/Editor/Xlua.Core.Editor.asmdef +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Xlua.Core.Editor", - "references": [ - "Xlua.Core" - ], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [] -} \ No newline at end of file diff --git a/Assets/XLua/Src/Editor/Xlua.Core.Editor.asmdef.meta b/Assets/XLua/Src/Editor/Xlua.Core.Editor.asmdef.meta deleted file mode 100644 index 2f4bc1ced..000000000 --- a/Assets/XLua/Src/Editor/Xlua.Core.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 5de0c54ac5cfb9a4e85d975178cc7d93 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/XLua/Src/InternalGlobals.cs b/Assets/XLua/Src/InternalGlobals.cs index 7ae44334b..f49f33989 100644 --- a/Assets/XLua/Src/InternalGlobals.cs +++ b/Assets/XLua/Src/InternalGlobals.cs @@ -19,8 +19,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using System.Linq; -using System.Threading; namespace XLua { @@ -65,41 +63,6 @@ internal partial class InternalGlobals #endif internal static volatile LuaCSFunction LazyReflectionWrap = new LuaCSFunction(Utils.LazyReflectionCall); - internal static Type delegate_birdge_type; - // -1: not initialized yet, 0: initialized without gencode, 1: initialized with gencode - private static volatile int initState = -1; - internal static bool Gen_Flag - { - get - { - Init(); - return initState == 1; - } - } - - internal static Delegate ConvertDelegate(Delegate sourceDelegate, Type targetType) - { - return Delegate.CreateDelegate(targetType, sourceDelegate.Target, sourceDelegate.Method); - } - - internal static void Init() - { - if(Interlocked.CompareExchange(ref initState, 0, -1) != -1) - return; - delegate_birdge_type = (from assembly in AppDomain.CurrentDomain.GetAssemblies() - select assembly.GetType("XLua.DelegateBridge_Wrap")).FirstOrDefault(x => x != null); - var InternalGlobals_Gen = (from assembly in AppDomain.CurrentDomain.GetAssemblies() - select assembly.GetType("XLua.InternalGlobals_Gen")).FirstOrDefault(x => x != null); - if (delegate_birdge_type == null || InternalGlobals_Gen == null) - return; - Interlocked.Exchange(ref initState, 1); - var Init = InternalGlobals_Gen.GetMethod("Init", BindingFlags.Static | BindingFlags.NonPublic); - var parameters = new object[] {null, null, null}; - Init.Invoke(null, parameters); - extensionMethodMap = parameters[0] as Dictionary>; - genTryArrayGetPtr = ConvertDelegate(parameters[1] as Delegate, typeof(TryArrayGet)) as TryArrayGet; - genTryArraySetPtr = ConvertDelegate(parameters[2] as Delegate, typeof(TryArraySet)) as TryArraySet; - } } } diff --git a/Assets/XLua/Src/LuaEnv.cs b/Assets/XLua/Src/LuaEnv.cs index aeaad9091..a89f7ee3d 100644 --- a/Assets/XLua/Src/LuaEnv.cs +++ b/Assets/XLua/Src/LuaEnv.cs @@ -29,7 +29,7 @@ public class LuaEnv : IDisposable internal RealStatePtr rawL; - public RealStatePtr L + internal RealStatePtr L { get { @@ -43,14 +43,14 @@ public RealStatePtr L private LuaTable _G; - public ObjectTranslator translator; + internal ObjectTranslator translator; - public int errorFuncRef = -1; + internal int errorFuncRef = -1; #if THREAD_SAFE || HOTFIX_ENABLE internal /*static*/ object luaLock = new object(); - public object luaEnvLock + internal object luaEnvLock { get { @@ -73,7 +73,6 @@ public LuaEnv() lock(luaEnvLock) #endif { - InternalGlobals.Init(); LuaIndexes.LUA_REGISTRYINDEX = LuaAPI.xlua_get_registry_index(); #if GEN_CODE_MINIMIZE LuaAPI.xlua_set_csharp_wrapper_caller(InternalGlobals.CSharpWrapperCallerPtr); @@ -358,7 +357,7 @@ public void Tick() #endif } - //兼容API + //API public void GC() { Tick(); @@ -599,8 +598,8 @@ elseif not name then internal List customLoaders = new List(); - //loader : CustomLoader, filepath参数:(ref类型)输入是require的参数,如果需要支持调试,需要输出真实路径。 - // 返回值:如果返回null,代表加载该源下无合适的文件,否则返回UTF8编码的byte[] + //loader : CustomLoader filepathrefͣrequireIJҪֵ֧ԣҪʵ· + // ֵnullظԴ޺ʵļ򷵻UTF8byte[] public void AddLoader(CustomLoader loader) { customLoaders.Add(loader); diff --git a/Assets/XLua/Src/ObjectTranslator.cs b/Assets/XLua/Src/ObjectTranslator.cs index 930c3bedc..d29b0546d 100644 --- a/Assets/XLua/Src/ObjectTranslator.cs +++ b/Assets/XLua/Src/ObjectTranslator.cs @@ -83,7 +83,7 @@ public enum LuaThreadStatus LUA_ERRERR = 5, } - public static class LuaIndexes + sealed class LuaIndexes { public static int LUA_REGISTRYINDEX { @@ -106,7 +106,7 @@ public partial class ObjectTranslator { internal MethodWrapsCache methodWrapsCache; internal ObjectCheckers objectCheckers; - public ObjectCasters objectCasters; + internal ObjectCasters objectCasters; internal readonly ObjectPool objects = new ObjectPool(); internal readonly Dictionary reverseMap = new Dictionary(new ReferenceEqualsComparer()); @@ -218,6 +218,13 @@ void addAssemblieByName(IEnumerable assemblies_usorted, string name) public ObjectTranslator(LuaEnv luaenv,RealStatePtr L) { +#if XLUA_GENERAL || (UNITY_WSA && !UNITY_EDITOR) + var dumb_field = typeof(ObjectTranslator).GetField("s_gen_reg_dumb_obj", BindingFlags.Static| BindingFlags.DeclaredOnly | BindingFlags.NonPublic); + if (dumb_field != null) + { + dumb_field.GetValue(null); + } +#endif assemblies = new List(); #if (UNITY_WSA && !ENABLE_IL2CPP) && !UNITY_EDITOR @@ -258,9 +265,16 @@ public ObjectTranslator(LuaEnv luaenv,RealStatePtr L) initCSharpCallLua(); } - Type delegate_birdge_type; + internal enum LOGLEVEL{ + NO, + INFO, + WARN, + ERROR + } #if (UNITY_EDITOR || XLUA_GENERAL) && !NET_STANDARD_2_0 + Type delegate_birdge_type; + class CompareByArgRet : IEqualityComparer { public bool Equals(MethodInfo x, MethodInfo y) @@ -282,14 +296,10 @@ public int GetHashCode(MethodInfo method) void initCSharpCallLua() { - if (DelegateBridge.Gen_Flag) - { - delegate_birdge_type = InternalGlobals.delegate_birdge_type; - } - else - { - delegate_birdge_type = typeof(DelegateBridge); #if (UNITY_EDITOR || XLUA_GENERAL) && !NET_STANDARD_2_0 + delegate_birdge_type = typeof(DelegateBridge); + if (!DelegateBridge.Gen_Flag) + { List cs_call_lua = new List(); foreach (var type in Utils.GetAllTypes()) { @@ -327,8 +337,8 @@ where typeof(Delegate).IsAssignableFrom(type) && type != typeof(Delegate) && typ ce.SetGenInterfaces(cs_call_lua.Where(type=>type.IsInterface()).ToList()); delegate_birdge_type = ce.EmitDelegateImpl(groups); -#endif } +#endif } #if (UNITY_EDITOR || XLUA_GENERAL) && !NET_STANDARD_2_0 @@ -501,7 +511,16 @@ public object CreateDelegateBridge(RealStatePtr L, Type delegateType, int idx) DelegateBridgeBase bridge; try { - bridge = Activator.CreateInstance(delegate_birdge_type, new object[] { reference, luaEnv }) as DelegateBridgeBase; +#if (UNITY_EDITOR || XLUA_GENERAL) && !NET_STANDARD_2_0 + if (!DelegateBridge.Gen_Flag) + { + bridge = Activator.CreateInstance(delegate_birdge_type, new object[] { reference, luaEnv }) as DelegateBridgeBase; + } + else +#endif + { + bridge = new DelegateBridge(reference, luaEnv); + } } catch(Exception e) { @@ -806,7 +825,7 @@ int addObject(object obj, bool is_valuetype, bool is_enum) return index; } - public object GetObject(RealStatePtr L,int index) + internal object GetObject(RealStatePtr L,int index) { return (objectCasters.GetCaster(typeof(object))(L, index, null)); } @@ -1005,8 +1024,7 @@ public void PrivateAccessible(RealStatePtr L, Type type) } } - - public int getTypeId(RealStatePtr L, Type type, out bool is_first) + internal int getTypeId(RealStatePtr L, Type type, out bool is_first, LOGLEVEL log_level = LOGLEVEL.WARN) { int type_id; is_first = false; @@ -1357,7 +1375,7 @@ internal object SafeGetCSObj(RealStatePtr L, int index) return getCsObj(L, index, LuaAPI.xlua_tocsobj_safe(L, index)); } - public object FastGetCSObj(RealStatePtr L,int index) + internal object FastGetCSObj(RealStatePtr L,int index) { return getCsObj(L, index, LuaAPI.xlua_tocsobj_fast(L,index)); } diff --git a/Assets/XLua/Src/Xlua.Core.asmdef b/Assets/XLua/Src/Xlua.Core.asmdef deleted file mode 100644 index 04acefcec..000000000 --- a/Assets/XLua/Src/Xlua.Core.asmdef +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "Xlua.Core", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/XLua/Src/Xlua.Core.asmdef.meta b/Assets/XLua/Src/Xlua.Core.asmdef.meta deleted file mode 100644 index 562ba8eae..000000000 --- a/Assets/XLua/Src/Xlua.Core.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 5b37a11e6fbbe2542aa3580b9973df17 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/General/Src/XLuaHotfixInject.cs b/General/Src/XLuaHotfixInject.cs index d525927ab..6f856f63c 100644 --- a/General/Src/XLuaHotfixInject.cs +++ b/General/Src/XLuaHotfixInject.cs @@ -10,12 +10,12 @@ public class XLuaHotfixInject { public static void Useage() { - Console.WriteLine("XLuaHotfixInject assmbly_path xlua_assembly_path gencode_assembly_path id_map_file_path [cfg_assmbly2_path] [search_path1, search_path2 ...]"); + Console.WriteLine("XLuaHotfixInject assmbly_path id_map_file_path [cfg_assmbly2_path] [search_path1, search_path2 ...]"); } public static void Main(string[] args) { - if (args.Length < 4) + if (args.Length < 2) { Useage(); return; @@ -25,18 +25,17 @@ public static void Main(string[] args) { var injectAssmblyPath = Path.GetFullPath(args[0]); var xluaAssmblyPath = Path.GetFullPath(args[1]); - var genAssemblyPath = Path.GetFullPath(args[2]); string cfg_append = null; - if (args.Length > 4) + if (args.Length > 3) { - cfg_append = Path.GetFullPath(args[4]); + cfg_append = Path.GetFullPath(args[3]); if (!cfg_append.EndsWith(".data")) { cfg_append = null; } } AppDomain currentDomain = AppDomain.CurrentDomain; - List search_paths = args.Skip(cfg_append == null ? 4 : 5).ToList(); + List search_paths = args.Skip(cfg_append == null ? 3 : 4).ToList(); currentDomain.AssemblyResolve += new ResolveEventHandler((object sender, ResolveEventArgs rea) => { foreach (var search_path in search_paths) @@ -68,7 +67,7 @@ public static void Main(string[] args) } } } - Hotfix.HotfixInject(injectAssmblyPath, xluaAssmblyPath, genAssemblyPath, args.Skip(cfg_append == null ? 4 : 5), args[3], hotfixCfg); + Hotfix.HotfixInject(injectAssmblyPath, xluaAssmblyPath, args.Skip(cfg_append == null ? 3 : 3), args[2], hotfixCfg); } catch(Exception e) { diff --git a/Tools/FilesSignature.exe b/Tools/FilesSignature.exe index 0bb40b13a..cf98ac108 100644 Binary files a/Tools/FilesSignature.exe and b/Tools/FilesSignature.exe differ diff --git a/Tools/FilesSignature.pdb b/Tools/FilesSignature.pdb index fdf1d2f28..047ca2f6c 100644 Binary files a/Tools/FilesSignature.pdb and b/Tools/FilesSignature.pdb differ diff --git a/Tools/KeyPairsGen.exe b/Tools/KeyPairsGen.exe index 5b8a325b3..dba057676 100644 Binary files a/Tools/KeyPairsGen.exe and b/Tools/KeyPairsGen.exe differ diff --git a/Tools/KeyPairsGen.pdb b/Tools/KeyPairsGen.pdb index b86b5971f..129d845f8 100644 Binary files a/Tools/KeyPairsGen.pdb and b/Tools/KeyPairsGen.pdb differ diff --git a/Tools/XLua.Mini.dll b/Tools/XLua.Mini.dll index c2e8d408c..35ace6081 100644 Binary files a/Tools/XLua.Mini.dll and b/Tools/XLua.Mini.dll differ diff --git a/Tools/XLua.Mini.pdb b/Tools/XLua.Mini.pdb index ef2d11ee0..906e8663e 100644 Binary files a/Tools/XLua.Mini.pdb and b/Tools/XLua.Mini.pdb differ diff --git a/Tools/XLuaGenerate.exe b/Tools/XLuaGenerate.exe index aa6817766..9681ceb65 100644 Binary files a/Tools/XLuaGenerate.exe and b/Tools/XLuaGenerate.exe differ diff --git a/Tools/XLuaGenerate.pdb b/Tools/XLuaGenerate.pdb index edabf6d04..9dc708975 100644 Binary files a/Tools/XLuaGenerate.pdb and b/Tools/XLuaGenerate.pdb differ diff --git a/Tools/XLuaHotfixInject.exe b/Tools/XLuaHotfixInject.exe index 767940d01..a51bf8ccf 100644 Binary files a/Tools/XLuaHotfixInject.exe and b/Tools/XLuaHotfixInject.exe differ diff --git a/Tools/XLuaHotfixInject.pdb b/Tools/XLuaHotfixInject.pdb index f519ad2ff..58f34fb3b 100644 Binary files a/Tools/XLuaHotfixInject.pdb and b/Tools/XLuaHotfixInject.pdb differ