public DSRHook(int refreshInterval, int minLifetime) : base(refreshInterval, minLifetime, p => p.MainWindowTitle == "DARK SOULS™: REMASTERED") { Offsets = new DSROffsets(); CamMan = RegisterRelativeAOB(DSROffsets.CamManBaseAOB, 3, 7, DSROffsets.CamManOffset); ChrFollowCam = RegisterRelativeAOB(DSROffsets.ChrFollowCamAOB, 3, 7, DSROffsets.ChrFollowCamOffset1, DSROffsets.ChrFollowCamOffset2, DSROffsets.ChrFollowCamOffset3); GroupMaskAddr = RegisterRelativeAOB(DSROffsets.GroupMaskAOB, 2, 7); GraphicsData = RegisterRelativeAOB(DSROffsets.GraphicsDataAOB, 3, 7, DSROffsets.GraphicsDataOffset1, DSROffsets.GraphicsDataOffset2); ChrClassWarp = RegisterRelativeAOB(DSROffsets.ChrClassWarpAOB, 3, 7, DSROffsets.ChrClassWarpOffset1); WorldChrBase = RegisterRelativeAOB(DSROffsets.WorldChrBaseAOB, 3, 7, DSROffsets.WorldChrBaseOffset1); ChrDbgAddr = RegisterRelativeAOB(DSROffsets.ChrDbgAOB, 2, 7); MenuMan = RegisterRelativeAOB(DSROffsets.MenuManAOB, 3, 7, DSROffsets.MenuManOffset1); ChrClassBasePtr = RegisterRelativeAOB(DSROffsets.ChrClassBaseAOB, 3, 7); EventFlags = RegisterRelativeAOB(DSROffsets.EventFlagsAOB, 3, 7, DSROffsets.EventFlagsOffset1, DSROffsets.EventFlagsOffset2); ItemGetAddr = RegisterAbsoluteAOB(DSROffsets.ItemGetAOB); BonfireWarpAddr = RegisterAbsoluteAOB(DSROffsets.BonfireWarpAOB); ChrData1 = CreateChildPointer(WorldChrBase, (int)DSROffsets.WorldChrBase.ChrData1); ChrMapData = CreateBasePointer(IntPtr.Zero); ChrAnimData = CreateBasePointer(IntPtr.Zero); ChrPosData = CreateBasePointer(IntPtr.Zero); ChrData2 = CreateChildPointer(ChrClassBasePtr, DSROffsets.ChrData2Offset1, DSROffsets.ChrData2Offset2); ChrSpellData = CreateChildPointer(ChrData2, (int)DSROffsets.ChrData2.Spells); OnHooked += DSRHook_OnHooked; }
void DSRHook_OnHooked(object sender, PHEventArgs e) { Offsets = DSROffsets.GetOffsets(Process.MainModule.ModuleMemorySize); ChrMapData = CreateChildPointer(ChrData1, (int)DSROffsets.ChrData1.ChrMapData + Offsets.ChrData1Boost1); ChrAnimData = CreateChildPointer(ChrMapData, (int)DSROffsets.ChrMapData.ChrAnimData); ChrPosData = CreateChildPointer(ChrMapData, (int)DSROffsets.ChrMapData.ChrPosData); }
public static DSROffsets GetOffsets(int moduleSize) { DSROffsets result = new DSROffsets(); int version = versions.ContainsKey(moduleSize) ? versions[moduleSize] : 100; if (version > 1) { result.ChrClassWarpBoost = 0x10; } if (version > 2) { result.ChrData1Boost1 = 0x20; result.ChrData1Boost2 = 0x10; } return(result); }