private static Dictionary <ushort, string> GetSystemMessages(ModuleSnapshot snapshot, string pattern, int patternOffset) { Dictionary <ushort, string> result = new Dictionary <ushort, string>(); IntPtr funcAddress = new IntPtr(snapshot.FindPattern(pattern, 0, 0, false, false)); GetMessageNameFunc func = funcAddress.ToDelegate <GetMessageNameFunc>(); uint count = LocalMemory.Read <uint>(funcAddress + patternOffset); for (ushort i = 0; i < count; i++) { result.Add(i, Marshal.PtrToStringUni(func(i))); } return(result); }
private static Dictionary <ushort, string> GetGameMessages(ModuleSnapshot snapshot, string pattern) { Dictionary <ushort, string> result = new Dictionary <ushort, string>(); GetMessageNameFunc func = new IntPtr(snapshot.FindPattern(pattern, 0, 0, false, false)).ToDelegate <GetMessageNameFunc>(); for (ushort i = 0; i < ushort.MaxValue; i++) { string opCodeName; if ((opCodeName = Marshal.PtrToStringAnsi(func(i))) != string.Empty) { result.Add(i, opCodeName); } } return(result); }
private static uint GetVersion(ModuleSnapshot snapshot, string pattern, int patternOffset) => LocalMemory.Read <uint>((IntPtr)snapshot.FindPattern(pattern, patternOffset, 0, true, false));