static void DumpBuffs(FFXIVLIB instance, Serializer s) { List<Buff> buffsList = new List<Buff>(); // This has to be modified by hand atm, // just change your buff a few times, look for where the description is then find out what references this part of memory. (First byte of name) IntPtr pointerToBuff = (IntPtr)0x12F6BEC8; IntPtr finalPTR = (IntPtr)BitConverter.ToInt32(instance.ReadMemory(pointerToBuff, 4), 0); for (short i = 0; i < 370; i++) { Entity player = instance.GetEntityById(0); player.Modify("Buffs", i); // Give time to client to update widget Thread.Sleep(50); byte[] buff = instance.ReadMemory(finalPTR, 400); buffsList.Add(new Buff(i, buff)); } s.Serialize("Buff.xml", buffsList, "Buff"); }
/// <summary> /// Master array -> Instance /// </summary> /// <param name="instance"></param> /// <param name="s"></param> static void DumpAutoTranslate(FFXIVLIB instance, Serializer s) { List<Autotranslate> atlist = new List<Autotranslate>(); IntPtr pointerInMasterArray = (IntPtr)0x4494280; IntPtr finalPTR = (IntPtr)BitConverter.ToInt32(instance.ReadMemory(pointerInMasterArray, 4), 0); int categoryiter = 0; while (finalPTR != IntPtr.Zero) { IntPtr objectPtr = (IntPtr)BitConverter.ToInt32(instance.ReadMemory(finalPTR + 4, 4), 0); IntPtr addressOfArray = (IntPtr)BitConverter.ToInt32(instance.ReadMemory(objectPtr, 4), 0); int itemId = 0; while (addressOfArray != IntPtr.Zero) { byte[] memrep = instance.ReadMemory(addressOfArray, 128); byte[] category = instance.ReadMemory(addressOfArray - 5, 1); List<byte> workingCopy = memrep.ToList(); int name = workingCopy.FindIndex(0, item => item == 0x00); if (name != -1) { workingCopy.RemoveRange(name + 1, workingCopy.Count - name - 1); } string rep = System.Text.Encoding.UTF8.GetString(workingCopy.ToArray()); rep = rep.Replace("\0", string.Empty); atlist.Add(new Autotranslate(categories[categoryiter].Id, categories[categoryiter].First + itemId, rep)); itemId += 1; addressOfArray = (IntPtr)BitConverter.ToInt32(instance.ReadMemory(objectPtr + (itemId * 4), 4), 0); } // Move in master array pointerInMasterArray += 0x4; finalPTR = (IntPtr)BitConverter.ToInt32(instance.ReadMemory(pointerInMasterArray, 4), 0); categoryiter += 1; } s.Serialize("Autotranslate.xml", atlist, "Autotranslate"); }