internal IntPtr method_33(IntPtr intptr_37, string string_0, params Enum20[] enum20_0) { while (intptr_37 != IntPtr.Zero) { using (AllocatedMemory allocatedMemory = this.externalProcessMemory_0.CreateAllocatedMemory(256)) { allocatedMemory.AllocateOfChunk <IntPtr>("Itr"); IntPtr intPtr; while ((intPtr = this.method_35(intptr_37, allocatedMemory["Itr"])) != IntPtr.Zero) //mono_class_get_methods { IntPtr address = this.method_37(intPtr); //mono_method_get_name if (this.externalProcessMemory_0.ReadStringA(address) == string_0) { if (enum20_0 != null) { Enum20[] array = this.method_31(intPtr); if (array.Length != enum20_0.Length || !array.SequenceEqual(enum20_0)) { continue; } } return(intPtr); } } intptr_37 = this.method_25(intptr_37); } } return(IntPtr.Zero); }
/// <summary> /// 在游戏进程中执行给出的指令 /// </summary> /// <param name="command">需要执行的指令</param> private void DoTextCommand(string command) { if (FFXIV == null) { PluginUI.Log("执行错误:接收到指令,但是没有对应的游戏进程"); throw new Exception("没有对应的游戏进程"); } PluginUI.Log(command); if (command == "") { throw new Exception("指令为空"); } var assemblyLock = Memory.Executor.AssemblyLock; var flag = false; try { Monitor.Enter(assemblyLock, ref flag); var array = Encoding.UTF8.GetBytes(command); using (AllocatedMemory allocatedMemory = Memory.CreateAllocatedMemory(400), allocatedMemory2 = Memory.CreateAllocatedMemory(array.Length + 30)) { allocatedMemory2.AllocateOfChunk("cmd", array.Length); allocatedMemory2.WriteBytes("cmd", array); allocatedMemory.AllocateOfChunk <IntPtr>("cmdAddress"); allocatedMemory.AllocateOfChunk <long>("t1"); allocatedMemory.AllocateOfChunk <long>("tLength"); allocatedMemory.AllocateOfChunk <long>("t3"); allocatedMemory.Write("cmdAddress", allocatedMemory2.Address); allocatedMemory.Write("t1", 0x40); allocatedMemory.Write("tLength", array.Length + 1); allocatedMemory.Write("t3", 0x00); _ = Memory.CallInjected64 <int>(Offsets.ProcessChatBoxPtr, Offsets.RaptureModule, allocatedMemory.Address, Offsets.UiModule); } } finally { if (flag) { Monitor.Exit(assemblyLock); } } }
internal IntPtr method_34(IntPtr intptr_37, string string_0) { while (intptr_37 != IntPtr.Zero) { using (AllocatedMemory allocatedMemory = this.externalProcessMemory_0.CreateAllocatedMemory(256)) { allocatedMemory.AllocateOfChunk <IntPtr>("Itr"); IntPtr intPtr; while ((intPtr = this.method_36(intptr_37, allocatedMemory["Itr"])) != IntPtr.Zero)//mono_class_get_fields { IntPtr address = this.method_38(intPtr); if (this.externalProcessMemory_0.ReadStringA(address) == string_0) { return(intPtr); } } } intptr_37 = this.method_25(intptr_37); } return(IntPtr.Zero); }
internal IntPtr method_43(IntPtr intptr_37, IntPtr intptr_38, params object[] object_0) { if (object_0 != null && object_0.Length != 0) { IntPtr result; using (AllocatedMemory allocatedMemory = this.externalProcessMemory_0.CreateAllocatedMemory(2048)) { allocatedMemory.AllocateOfChunk("ArrayPtrs", 512); allocatedMemory.AllocateOfChunk("Args", 512); int num = 0; int num2 = 0; foreach (object obj in object_0) { object obj2 = obj; IntPtr intPtr; if (MonoClass.IsOutParam(num, out intPtr)) { obj2 = intPtr; } MonoClass monoClass = obj as MonoClass; if (monoClass != null) { obj2 = monoClass.GetClassInstance(); } else if (obj != null) { string text = obj as string; if (text != null) { obj2 = this.method_28(text); } else if (obj.GetType().IsEnum) { obj2 = Convert.ChangeType(obj2, ((Enum)obj2).GetTypeCode()); } } else { obj2 = IntPtr.Zero; } int num3 = 4; if (!(obj2 is IntPtr)) { if (obj2 is long) { allocatedMemory.Write <long>("Args", num2, (long)obj2); num3 = 8; } else if (obj2 is ulong) { allocatedMemory.Write <ulong>("Args", num2, (ulong)obj2); num3 = 8; } else if (obj2 is uint) { allocatedMemory.Write <uint>("Args", num2, (uint)obj2); } else if (obj2 is int) { allocatedMemory.Write <int>("Args", num2, (int)obj2); } else if (obj2 is bool) { allocatedMemory.Write <int>("Args", num2, ((bool)obj2) ? 1 : 0); } else if (obj2 is double) { allocatedMemory.Write <double>("Args", num2, (double)obj2); num3 = 8; } else if (obj2 is float) { allocatedMemory.Write <float>("Args", num2, (float)obj2); } else if (obj2 is Vector3) { Vector3 vector = (Vector3)obj2; allocatedMemory.Write <float>("Args", num2 + 0, vector.X); allocatedMemory.Write <float>("Args", num2 + 4, vector.Y); allocatedMemory.Write <float>("Args", num2 + 8, vector.Z); num3 = 12; } else { if (!(obj2 is RaycastHit)) { throw new Exception("Unknown type passed as argument: " + obj2.GetType()); } RaycastHit raycastHit = (RaycastHit)obj2; allocatedMemory.Write <float>("Args", num2 + 0, raycastHit.Point.X); allocatedMemory.Write <float>("Args", num2 + 4, raycastHit.Point.Y); allocatedMemory.Write <float>("Args", num2 + 8, raycastHit.Point.Z); allocatedMemory.Write <float>("Args", num2 + 12, raycastHit.Normal.X); allocatedMemory.Write <float>("Args", num2 + 16, raycastHit.Normal.Y); allocatedMemory.Write <float>("Args", num2 + 20, raycastHit.Normal.Z); allocatedMemory.Write <int>("Args", num2 + 24, raycastHit.FaceID); allocatedMemory.Write <float>("Args", num2 + 28, raycastHit.Distance); allocatedMemory.Write <float>("Args", num2 + 32, raycastHit.UV.X); allocatedMemory.Write <float>("Args", num2 + 36, raycastHit.UV.Y); num3 = 40; } } if (obj2 is IntPtr) { allocatedMemory.Write <IntPtr>("ArrayPtrs", 4 * num, (IntPtr)obj2); } else { allocatedMemory.Write <IntPtr>("ArrayPtrs", 4 * num, allocatedMemory["Args"] + num2); } num++; num2 += num3; } result = this.method_17 <IntPtr>(this.intptr_26,//mono_runtime_invoke new object[] { intptr_37, intptr_38, allocatedMemory["ArrayPtrs"], IntPtr.Zero }); } return(result); } IntPtr temp = this.method_17 <IntPtr>(this.intptr_26,//mono_runtime_invoke new object[] { intptr_37, intptr_38, IntPtr.Zero, IntPtr.Zero }); return(temp); }