public override void Enable() { if (Enabled) { return; } config = LoadConfig <Configs>() ?? new Configs(); changeAddress = Common.Scanner.ScanText("41 80 7E 2F 06 75 1E 48 8D 0D"); if (SafeMemory.ReadBytes(changeAddress, 5, out originalBytes)) { if (SafeMemory.WriteBytes(changeAddress, new byte[] { 0x41, 0xF6, 0x46, 0x36, 0x10 })) // cmp byte ptr [r14+2Fh], 6 -> test byte ptr [r14+36h], 10 { base.Enable(); } else { SimpleLog.Error("Failed to write new instruction"); } } else { SimpleLog.Error("Failed to read original instruction"); } if (config.FixCones) { ModifyCones(true); } }
public Replacer(IntPtr addr, byte[] bytes) { if (addr == IntPtr.Zero) { return; } Address = addr; newBytes = bytes; SafeMemory.ReadBytes(addr, bytes.Length, out oldBytes); createdReplacers.Add(this); }
/// <summary> /// Read memory from an offset and hexdump them via Serilog. /// </summary> /// <param name="offset">The offset to read from.</param> /// <param name="len">The length to read.</param> public static void DumpMemory(IntPtr offset, int len = 512) { try { SafeMemory.ReadBytes(offset, len, out var data); Log.Information(ByteArrayToHex(data)); } catch (Exception ex) { Log.Error(ex, "Read failed"); } }
/// <summary> /// Enables the anti-debugging by overwriting code in memory. /// </summary> public void Enable() { this.original = new byte[this.nop.Length]; if (this.debugCheckAddress != IntPtr.Zero && !this.IsEnabled) { Log.Information($"Overwriting debug check at 0x{this.debugCheckAddress.ToInt64():X}"); SafeMemory.ReadBytes(this.debugCheckAddress, this.nop.Length, out this.original); SafeMemory.WriteBytes(this.debugCheckAddress, this.nop); } else { Log.Information("Debug check already overwritten?"); } this.IsEnabled = true; }
public Replacer(string sig, byte[] bytes) { var addr = IntPtr.Zero; try { addr = Fractionality.Interface.TargetModuleScanner.ScanModule(sig); } catch { } if (addr == IntPtr.Zero) { return; } Address = addr; newBytes = bytes; SafeMemory.ReadBytes(addr, bytes.Length, out oldBytes); createdReplacers.Add(this); }
public Replacer(IntPtr addr, byte[] bytes, bool startEnabled = false) { if (addr == IntPtr.Zero) { return; } Address = addr; newBytes = bytes; SafeMemory.ReadBytes(addr, bytes.Length, out oldBytes); createdReplacers.Add(this); if (startEnabled) { Enable(); } }
public override void Enable() { if (Enabled) { return; } try { changeAddress = Common.Scanner.ScanText("0F 86 ?? ?? ?? ?? 48 8B 4D 77"); SimpleLog.Verbose($"Found Signature: {changeAddress.ToInt64():X}"); } catch { SimpleLog.Error("Failed to find Signature"); return; } if (changeAddress == IntPtr.Zero) { return; } originalBytes = new byte[6]; var readOriginalSuccess = SafeMemory.ReadBytes(changeAddress, 6, out originalBytes); if (readOriginalSuccess) { var relAddr = BitConverter.ToInt32(originalBytes, 2) + 1; var relAddrBytes = BitConverter.GetBytes(relAddr); var writeNewSuccess = SafeMemory.WriteBytes(changeAddress, new byte[6] { 0xE9, relAddrBytes[0], relAddrBytes[1], relAddrBytes[2], relAddrBytes[3], 0x90 }); if (writeNewSuccess) { base.Enable(); } else { SimpleLog.Error("Failed to write new instruction"); } } else { originalBytes = new byte[0]; SimpleLog.Error("Failed to read original instruction"); } }
public Replacer(string sig, byte[] bytes, bool startEnabled = false) { var addr = IntPtr.Zero; try { addr = DalamudApi.SigScanner.ScanModule(sig); } catch { PluginLog.LogError($"Failed to find signature {sig}"); } if (addr == IntPtr.Zero) { return; } Address = addr; newBytes = bytes; SafeMemory.ReadBytes(addr, bytes.Length, out oldBytes); createdReplacers.Add(this); if (startEnabled) { Enable(); } }
public override void Enable() { if (Enabled) { return; } changeAddress = Common.Scanner.ScanText("E8 ?? ?? ?? ?? 44 0F B6 F0 41 8B ED"); if (SafeMemory.ReadBytes(changeAddress, 7, out originalBytes)) { if (SafeMemory.WriteBytes(changeAddress, new byte[] { 0xB8, numGearSets, 0x00, 0x00, 0x00, 0x90, 0x90 })) { base.Enable(); } else { SimpleLog.Error("Failed to write new instruction"); } } else { SimpleLog.Error("Failed to read original instruction"); } }
public void Initialize(DalamudPluginInterface pluginInterface) { _pi = pluginInterface; TimePtr = (long *)(_pi.Framework.Address.BaseAddress + 0x1608); TimeStopPtr = _pi.TargetModuleScanner.ScanText("48 89 ?? 08 16 00 00 48 69"); //yeeted from cmtool https://github.com/imchillin/CMTool if (!SafeMemory.ReadBytes(TimeStopPtr, 7, out TimeStopOff)) { throw new Exception("Could not read memory"); } CurrentWeatherPtr = (byte *)(*(IntPtr *)_pi.TargetModuleScanner.GetStaticAddressFromSig("48 8B 05 ?? ?? ?? ?? 0F B6 EA 48 8B F9 41 8B DE 48 8B 70 08 48 85 F6 0F 84 ?? ?? ?? ??") + 0x27); //thanks daemitus //CurrentWeatherPtr = (byte*)(*(IntPtr*)(Process.GetCurrentProcess().MainModule.BaseAddress + 0x1D682B8) + 0x27); //yeeted from cmtool yet again FirstByteTimeStopPtr = (byte *)TimeStopPtr; zones = pluginInterface.Data.GetExcelSheet <TerritoryType>().ToDictionary(row => (ushort)row.RowId, row => row); weathers = pluginInterface.Data.GetExcelSheet <Weather>().ToDictionary(row => (byte)row.RowId, row => row.Name.ToString()); weatherRates = _pi.Data.GetExcelSheet <WeatherRate>(); ZoneSettings = new Dictionary <ushort, ZoneSettings>(); foreach (var z in zones) { var s = new ZoneSettings(); s.ZoneId = z.Key; s.ZoneName = z.Value.PlaceName.Value.Name; s.terr = z.Value; s.Init(this); ZoneSettings.Add(s.ZoneId, s); } configuration = pluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); configuration.Initialize(this); var normalweathers = new HashSet <byte>(); foreach (var z in ZoneSettings) { foreach (var a in z.Value.SupportedWeathers) { if (a.IsNormal) { normalweathers.Add(a.Id); } } } var tempdict = new Dictionary <byte, bool>(configuration.BlacklistedWeathers); foreach (var i in tempdict) { if (!normalweathers.Contains(i.Key)) { configuration.BlacklistedWeathers.Remove(i.Key); } } foreach (var i in normalweathers) { if (!configuration.BlacklistedWeathers.ContainsKey(i)) { configuration.BlacklistedWeathers.Add(i, false); } } WeatherSvc = new FFXIVWeatherLuminaService(_pi.Data); _pi.Framework.OnUpdateEvent += HandleFrameworkUpdate; ConfigGui = new Gui(this); _pi.UiBuilder.OnBuildUi += ConfigGui.Draw; _pi.UiBuilder.OnOpenConfigUi += delegate { ConfigGui.configOpen = true; }; _pi.ClientState.TerritoryChanged += HandleZoneChange; if (_pi.ClientState != null) { ApplyWeatherChanges(_pi.ClientState.TerritoryType); } _pi.CommandManager.AddHandler("/weatherman", new Dalamud.Game.Command.CommandInfo(delegate { ConfigGui.configOpen = true; }) { }); _pi.Framework.Gui.Chat.OnChatMessage += HandleChatMessage; }