Guest User

06/10/2025

a guest
Jun 10th, 2025
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.02 KB | Source Code | 0 0
  1. #include "Framework.h"
  2.  
  3. INT64 AutoOffset::ResolveMovCs(UINT64 Module, UINT64 Instruction) {
  4.  
  5.     int Relative = *(int*)(Instruction + 3);
  6.  
  7.     Instruction += 7;
  8.  
  9.     return (Instruction + Relative) - Module;
  10. }
  11.  
  12. INT64 AutoOffset::ResolveCmpCs(UINT64 Module, UINT64 Instruction) {
  13.  
  14.     int Relative = *(int*)(Instruction + 2);
  15.  
  16.     Instruction += 7;
  17.  
  18.     return (Instruction + Relative) - Module;
  19. }
  20.  
  21. INT64 AutoOffset::ResovleMovRegXmm(UINT64 Module, UINT64 Instruction) {
  22.     return *(int*)(Instruction + 4);
  23. }
  24.  
  25. INT64 AutoOffset::ResolveMovRegXmmLrg(UINT64 Module, UINT64 Instruction) {
  26.     return *(int*)(Instruction + 5);
  27. }
  28.  
  29. INT64 AutoOffset::ResovleMovRegXmmByte(UINT64 Module, UINT64 Instruction) {
  30.     return *(BYTE*)(Instruction + 4);
  31. }
  32.  
  33. INT64 AutoOffset::ResovleMovRegXmmLrgByte(UINT64 Module, UINT64 Instruction) {
  34.     return *(BYTE*)(Instruction + 5);
  35. }
  36.  
  37. INT64 AutoOffset::ResolveMovReg(UINT64 Module, UINT64 Instruction) {
  38.     return *(int*)(Instruction + 3);
  39. }
  40.  
  41. INT64 AutoOffset::ResolveMovRegByte(UINT64 Module, UINT64 Instruction) {
  42.     return *(BYTE*)(Instruction + 3);
  43. }
  44.  
  45. INT64 AutoOffset::ResolveMovRegSml(UINT64 Module, UINT64 Instruction) {
  46.     return *(int*)(Instruction + 2);
  47. }
  48.  
  49. INT64 AutoOffset::ResovleMovRegByteSml(UINT64 Module, UINT64 Instruction) {
  50.     return *(BYTE*)(Instruction + 2);
  51. }
  52.  
  53. INT64 AutoOffset::ResolveTraceMovReg(UINT64 Module, UINT64 Instruction) {
  54.    
  55.     /* we save this cause we do the pattern scan on the call - and then the offset inside the call routine */
  56.     Instruction -= m_InstructionOffset;
  57.  
  58.     auto JmpRva = *(int*)(Instruction + 1);
  59.  
  60.     Instruction += 5 + JmpRva;
  61.  
  62.     Instruction += m_InstructionOffset;
  63.  
  64.     return *(int*)(Instruction + 3);
  65. }
  66.  
  67. INT64 AutoOffset::ResolveTraceMovRegByte(UINT64 Module, UINT64 Instruction) {
  68.    
  69.     /* we save this cause we do the pattern scan on the call - and then the offset inside the call routine */
  70.     Instruction -= m_InstructionOffset;
  71.  
  72.     auto JmpRva = *(int*)(Instruction + 1);
  73.  
  74.     Instruction += 5 + JmpRva;
  75.  
  76.     Instruction += m_InstructionOffset;
  77.  
  78.     return *(BYTE*)(Instruction + 3);
  79. }
  80.  
  81. bool AutoOffset::ResolveOffset(UINT64 Module, UINT64 Instruction) {
  82.  
  83.     Instruction += m_InstructionOffset;
  84.  
  85.     switch (m_Type) {
  86.  
  87.     case ScanType::MovReg:          m_Offset = ResolveMovReg(Module, Instruction);              break;
  88.     case ScanType::MovRegByte:      m_Offset = ResolveMovRegByte(Module, Instruction);          break;
  89.     case ScanType::MovRegXmm:       m_Offset = ResovleMovRegXmm(Module, Instruction);           break;
  90.     case ScanType::MovRegXmmLrg:    m_Offset = ResolveMovRegXmmLrg(Module, Instruction);        break;
  91.     case ScanType::MovRegXmmByte:   m_Offset = ResovleMovRegXmmByte(Module, Instruction);       break;
  92.     case ScanType::MovRegXmmLrgByte:m_Offset = ResovleMovRegXmmLrgByte(Module, Instruction);    break;
  93.     case ScanType::MovRegSml:       m_Offset = ResolveMovRegSml(Module, Instruction);           break;
  94.     case ScanType::MovRegByteSml:   m_Offset = ResovleMovRegByteSml(Module, Instruction);       break;
  95.     case ScanType::TraceMovReg:     m_Offset = ResolveTraceMovReg(Module, Instruction);         break;
  96.     case ScanType::TraceMovRegByte: m_Offset = ResolveTraceMovRegByte(Module, Instruction);     break;
  97.     case ScanType::MovCs:           m_Offset = ResolveMovCs(Module, Instruction);               break;
  98.     case ScanType::CmpCs:           m_Offset = ResolveCmpCs(Module, Instruction);               break;
  99.  
  100.     }
  101.  
  102.     m_Offset += m_LastOffset;
  103.  
  104.     return m_Offset;
  105. }
  106.  
  107. bool AutoOffset::UpdateReference() {
  108.  
  109.     if (!m_Offset || !m_Reference)
  110.         return false;
  111.  
  112.     *m_Reference = m_Offset;
  113.  
  114.     return true;
  115. }
  116.  
  117. void AutoOffset::SetReference(INT64* Reference) {
  118.     m_Reference = Reference;
  119. }
  120.  
  121. void AutoOffset::SetPattern(PBYTE Pattern) {
  122.     m_Pattern = Pattern;
  123. }
  124.  
  125. void AutoOffset::SetMask(const char* Mask) {
  126.     m_Mask = Mask;
  127. }
  128.  
  129. void AutoOffset::SetSection(const char* Section) {
  130.     m_Section = Section;
  131. }
  132.  
  133. void AutoOffset::SetType(ScanType Type) {
  134.     m_Type = Type;
  135. }
  136.  
  137. void AutoOffset::SetOffset(UINT32 Offset) {
  138.     m_InstructionOffset = Offset;
  139. }
  140.  
  141. void AutoOffset::SetLastOffset(INT32 Offset) {
  142.     m_LastOffset = Offset;
  143. }
  144.  
  145. INT64 AutoOffset::GetOffset() {
  146.     return m_Offset;
  147. }
  148.  
  149. bool AutoOffset::Scan(UINT64 Module, PBYTE Allocated) {
  150.  
  151.     auto Instruction = Utils::PatternScan(
  152.         Module,
  153.         Allocated,
  154.         m_Section,
  155.         m_Pattern,
  156.         m_Mask
  157.     );
  158.  
  159.     if (!Instruction) /* oh no ! */
  160.         return false;
  161.  
  162.     return ResolveOffset(Module, Instruction);
  163. }
  164.  
  165. bool Updater::AllocateModule() {
  166.  
  167.     DWORD Pid = 0;
  168.  
  169.     if (!Utils::GetProcessId("DayZ_x64.exe", &Pid))
  170.         return false;
  171.  
  172.     if (!Utils::GetProcessBase(Pid, &m_Module, &m_Allocated))
  173.         return false;
  174.  
  175.     return true;
  176. }
  177.  
  178. bool Updater::DeallocateModule() {
  179.  
  180.     FreeLibrary((HMODULE)(m_Module));
  181.  
  182.     m_Module = NULL;
  183.     m_Allocated = NULL;
  184.  
  185.     return true;
  186. }
  187.  
  188. void Updater::SetupModbasePatterns() {
  189.  
  190.     AUTO_OFFSET(Modbase, World, "\x48\x8B\x05\x00\x00\x00\x00\x48\x8D\x54\x24\x00\x48\x8B\x48\x30", "xxx????xxxx?xxxx", ".text", ScanType::MovCs, 0);
  191.     AUTO_OFFSET(Modbase, Network, "\x48\x8D\x0D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x84\xC0\x75\x00\xE8", "xxx????x????xxx?x", ".text", ScanType::MovCs, 0);
  192.     AUTO_OFFSET(Modbase, Tick, "\x48\x8B\x05\x00\x00\x00\x00\x0F\x57\xC9\x66\x0F\x6E\x03", "xxx????xxxxxxx", ".text", ScanType::MovCs, 0);
  193.     AUTO_OFFSET(Modbase, ScriptContext, "\x48\x8B\x05\x00\x00\x00\x00\x48\x8B\xD9\x4C\x8B\x80", "xxx????xxxxxx", ".text", ScanType::MovCs, 0);
  194.  
  195. }
  196.  
  197. void Updater::SetupScriptContextPatterns() {
  198.  
  199.     AUTO_OFFSET(ScriptContext, ConstantTable, "\x48\x8B\x43\x00\x4D\x8B\xC4\x4C\x8B\x4C\x24\x00\x48\x8B\xCB", "xxx?xxxxxxx?xxx", ".text", ScanType::MovRegByte, 0);
  200.  
  201. }
  202.  
  203. void Updater::SetupNetworkPatterns() {
  204.  
  205.  
  206.  
  207. }
  208.  
  209. void Updater::SetupPlayerIdentityPatterns() {
  210.  
  211.  
  212.  
  213. }
  214.  
  215. void Updater::SetupWorldPatterns() {
  216.  
  217.     AUTO_OFFSET(World, BulletList, "\x48\x8B\x83\x00\x00\x00\x00\x48\x8D\x94\x24\x00\x00\x00\x00\x4C\x8B\x3C\xF0", "xxx????xxxx????xxxx", ".text", ScanType::MovReg, 0);
  218.     AUTO_OFFSET(World, NearEntList, "\x48\x8B\x83\x00\x00\x00\x00\x49\x8B\x14\x06\x48\x3B\xD5", "xxx????xxxxxxx", ".text", ScanType::MovReg, 0);
  219.     AUTO_OFFSET(World, FarEntList, "\x48\x8B\x83\x00\x00\x00\x00\x49\x8B\x0C\x06\x48\x3B\xCD\x74\x17\x80\xB9\x00\x00\x00\x00\x00\x75\x0E\x41\xB8\x00\x00\x00\x00\x0F\x28\xCE\xE8\x00\x00\x00\x00\xFF\xC6\x49\x83\xC6\x08\x3B\xB3\x00\x00\x00\x00\x7C\xCB", "xxx????xxxxxxxxxxx?????xxxx????xxxx????xxxxxxxx????xx", ".text", ScanType::MovReg, 0);
  220.     AUTO_OFFSET(World, Camera, "\x4C\x8B\x83\x00\x00\x00\x00\x4C\x8B\x11\x48\x89\x70\x08", "xxx????xxxxxxx", ".text", ScanType::MovReg, 0);
  221.     AUTO_OFFSET(World, LocalPlayer, "\x48\x8B\x81\x60\x00\x00\x00\x00\xD2\x48\x8B\x48\x08", "xxxx????xxxxx", ".text", ScanType::MovReg, 0);
  222.     AUTO_OFFSET(World, LocalOffset, "\xE8\x00\x00\x00\x00\x48\x8B\xC8\xC7\x44\x24\x00\x00\x00\x00\x00\x4C\x8D\x0D\x00\x00\x00\x00", "x????xxxxxx?????xxx????", ".text", ScanType::TraceMovReg, 16);
  223.     AUTO_OFFSET(World, NoGrass, "\x8B\x81\x00\x00\x00\x00\x41\x89\x00\x77", "xx????xxxx", ".text", ScanType::MovRegSml, 0);
  224.  
  225. }
  226.  
  227. void Updater::SetupHumanPatterns() {
  228.  
  229.     AUTO_OFFSET(Human, HumanType, "\x4C\x8B\x91\x00\x00\x00\x00\x48\x8B\xCE\x4C\x89\x64\x24", "xxx????xxxxxxx", ".text", ScanType::MovReg, 0);
  230.     AUTO_OFFSET(Human, VisualState, "\x48\x8B\x9F\x00\x00\x00\x00\x49\x8B\xCE\xFF\x90\x00\x00\x00\x00\x8B\x10", "xxx????xxxxx????xx", ".text", ScanType::MovReg, 0);
  231.     AUTO_OFFSET(Human, LodShape, "\x4C\x8B\x91\x00\x00\x00\x00\x48\x0F\x44\xD7\x8B\x4B", "xxx????xxxxxx", ".text", ScanType::MovReg, 0);
  232.     AUTO_OFFSET(Human, Inventory, "\x48\x8B\x8B\x00\x00\x00\x00\x48\x8B\x01\xFF\x90\x00\x00\x00\x00\xEB\x02", "xxx????xxxxx????xx", ".text", ScanType::MovReg, 0);
  233. }
  234.  
  235. void Updater::SetupDayZInfectedPatterns() {
  236.  
  237.  
  238.  
  239. }
  240.  
  241. void Updater::SetupHumanTypePatterns() {
  242.  
  243.     AUTO_OFFSET(HumanType, ObjectName, "\x48\x8B\x58\x70\x48\x85\xDB\x74\x03\xF0\xFF\x03\x48\x8B\x44\x24\x00\xBE\x00\x00\x00\x00\x48\x89\x5C\x24\x00\xEB\x21\x48\x8D\x0D\x00\x00\x00\x00", "xxxxxxxxxxxxxxxx?x????xxxx?xxxxx????", ".text", ScanType::MovRegByte, 0);
  244.     AUTO_OFFSET(HumanType, CategoryName, "\x48\x8B\x81\x00\x00\x00\x00\x48\x8B\xF9\x0F\xB6\xF2\x48\x8D\x48\x10\x48\x85\xC0\x75\x07\x48\x8D\x0D\x00\x00\x00\x00\x48\x8D\x15\x00\x00\x00\x00\x48\x89\x6C\x24\x00\xE8\x00\x00\x00\x00", "xxx????xxxxxxxxxxxxxxxxxx????xxx????xxxx?x????", ".text", ScanType::MovReg, 0);
  245.  
  246. }
  247.  
  248. void Updater::SetupDayZLocalPatterns() {
  249.  
  250.     AUTO_OFFSET(DayZInfected, Skeleton, "\x48\x8B\x8B\x00\x00\x00\x00\x48\x8D\x55\x00\x40\x32\xFF", "xxx????xxx?xxx", ".text", ScanType::MovReg, 0);
  251.  
  252. }
  253.  
  254. void Updater::SetupDayZPlayerPatterns() {
  255.  
  256.     AUTO_OFFSET(DayZPlayer, Skeleton, "\x49\x8B\x97\x00\x00\x00\x00\xF3\x0F\x10\xB3", "xxx????xxxx", ".text", ScanType::MovReg, 0);
  257.     AUTO_OFFSET(DayZPlayer, NetworkID, "\x41\x8B\x92\x00\x00\x00\x00\x48\x8B\xC8", "xxx????xxx", ".text", ScanType::MovReg, 0);
  258.     AUTO_OFFSET(DayZPlayer, Inventory, "\x48\x8B\x8B\x00\x00\x00\x00\x48\x8B\x01\xFF\x90\x00\x00\x00\x00\xEB\x02", "xxx????xxxxx????xx", ".text", ScanType::MovReg, 0);
  259.  
  260. }
  261.  
  262. void Updater::SetupDayZPlayerInventoryPatterns() {
  263.  
  264.     AUTO_OFFSET(DayZPlayerInventory, Hands, "\x48\x8B\x8B\x00\x00\x00\x00\x48\x8B\xF8\x48\x85\xC9", "xxx????xxxxxx", ".text", ScanType::MovReg, 0);
  265.     AUTO_OFFSET(DayZPlayerInventory, Clothing, "\x48\x8B\x99\x00\x00\x00\x00\x41\x8B\xF0\x8B\xB9\x00\x00\x00\x00\x48\x8B\xE9", "xxx????xxxxx????xxx", ".text", ScanType::MovReg, 0);
  266.  
  267. }
  268.  
  269. void Updater::SetupInventoryItemPatterns() {
  270.  
  271.     AUTO_OFFSET(InventoryItem, ItemInventory, "\x48\x8B\x8B\x00\x00\x00\x00\x48\x8B\x01\xFF\x90\x00\x00\x00\x00\xEB\x02", "xxx????xxxxx????xx", ".text", ScanType::MovReg, 0);
  272.  
  273.  
  274. }
  275.  
  276. void Updater::SetupWeaponPatterns() {
  277.  
  278.     AUTO_OFFSET(Weapon, WeaponIndex, "\x48\x8B\x81\x00\x00\x00\x00\x44\x8B\xC2\x49\xC1\xE0\x08", "xxx????xxxxxxx", ".text", ScanType::MovReg, 0);
  279.     AUTO_OFFSET(Weapon, WeaponInfoTable, "\x48\x8B\x81\x00\x00\x00\x00\x48\x85\xC0\x74\x00\xC7\x80", "xxx????xxxx?xx", ".text", ScanType::MovReg, 0);
  280.     AUTO_OFFSET(Weapon, MuzzleCount, "\x48\x89\xBB\x00\x00\x00\x00\x48\x89\xBB\x00\x00\x00\x00\x48\x89\xBB\x00\x00\x00\x00\x66\xC7\x83\x00\x00\x00\x00\x00\x00\xC6\x83", "xxx????xxx????xxx????xxx??????xx", ".text", ScanType::MovReg, 0);
  281.     AUTO_OFFSET(Weapon, WeaponInfoSize, "\x3B\x91\x00\x00\x00\x00\x73\x00\x8B\xCA", "xx????x?xx", ".text", ScanType::MovRegSml, 0);
  282.  
  283. }
  284.  
  285. void Updater::SetupWeaponInventoryPatterns() {
  286.  
  287.     AUTO_OFFSET(WeaponInventory, MagazineRef, "\x48\x8B\x83\x00\x00\x00\x00\xF3\x0F\x5D\x35", "xxx????xxxx", ".text", ScanType::MovReg, 0);
  288.  
  289. }
  290.  
  291. void Updater::SetupMagazinePatterns() {
  292.  
  293.     AUTO_OFFSET(Magazine, BulletList, "\x48\x8B\x83\x00\x00\x00\x00\x48\x8D\x94\x24\x00\x00\x00\x00\x4C\x8B\x3C\xF0", "xxx????xxxx????xxxx", ".text", ScanType::MovReg, 0);
  294.     AUTO_OFFSET(Magazine, BulletList2, "\x48\x8D\xB9\x00\x00\x00\x00\x48\x8B\xDA\xBD\xFF\xFF", "xxx????xxxxxx", ".text", ScanType::MovReg, 0);
  295.     AUTO_OFFSET(Magazine, MagazineType, "\x4C\x8B\x8F\x00\x00\x00\x00\x41\xB8", "xxx????xx", ".text", ScanType::MovReg, 0);
  296.     AUTO_OFFSET(Magazine, AmmoCount, "\x8B\xA9\x00\x00\x00\x00\x4C\x89\x7C\x24\x40\x4C\x8B\x00\x00\x00\x00", "xx????xxxxxxx????", ".text", ScanType::MovRegSml, 0);
  297. }
  298.  
  299.  
  300.  
  301. void Updater::SetupAmmoTypePatterns() {
  302.  
  303.     AUTO_OFFSET(AmmoType, InitSpeed, "\x45\x8B\x95\x00\x00\x00\x00\x4C\x8D\x46", "xxx????xxx", ".text", ScanType::MovReg, 0);
  304.     AUTO_OFFSET(AmmoType, AirFriction, "\xF3\x45\x0F\x10\xAE\x00\x00\x00\x00\x44\x0F\x57\x2D", "xxxxx????xxxx", ".text", ScanType::MovRegXmmLrg, 0);
  305.  
  306. }
  307.  
  308. void Updater::SetupSkeletonPatterns() {
  309.  
  310.     AUTO_OFFSET(Skeleton, AnimClass1, "\x48\x8B\x8F\x00\x00\x00\x00\x48\x85\xC9\x74\x00\x8B\x01\xF0\x0F\xC1\x19", "xxx????xxxx?xxxxxx", ".text", ScanType::MovReg, 0);
  311.     AUTO_OFFSET(Skeleton, AnimClass2, "\x48\x8B\x50\x00\x48\x85\xD2\x74\x00\x48\x83\xC2\x00\x48\x8D\x0D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\xE9", "xxx?xxxx?xxx?xxx????x????x", ".text", ScanType::MovRegByte, 0);
  312.  
  313. }
  314.  
  315. void Updater::SetupAnimClassPatterns() {
  316.  
  317.     AUTO_OFFSET(AnimClass, MatrixArray, "\x49\x8B\x93\x00\x00\x00\x00\x8B\x01", "xxx????xx", ".text", ScanType::MovReg, 0);
  318.     AUTO_OFFSET(AnimClass, AnimComponent, "\x49\x8B\x9B\x00\x00\x00\x00\x66\x44\x89\x4C\x24", "xxx????xxxxx", ".text", ScanType::MovReg, 0);
  319.     AUTO_OFFSET(AnimClass, MatrixB, "\xF3\x0F\x10\x43\x00\xF3\x41\x0F\x59\xDB", "xxxx?xxxxx", ".text", ScanType::MovRegXmmByte, 0);
  320.  
  321. }
  322.  
  323. void Updater::SetupCameraPatterns() {
  324.  
  325.     AUTO_OFFSET(Camera, ViewMatrix, "\xF3\x0F\x10\x40\x00\xF3\x0F\x10\x50\x00\xF3\x0F\x10\x58\x00", "xxxx?xxxx?xxxx?", ".text", ScanType::MovRegXmmByte, 0);
  326.     AUTO_OFFSET(Camera, ViewPortMatrix, "\xF3\x0F\x11\x47\x00\xF3\x0F\x10\x44\x24\x00\xF3\x0F\x11\x47\x00\xF3\x0F\x11\x4F\x00\x48\x89\x47\x00\xEB", "xxxx?xxxxx?xxxx?xxxx?xxx?x", ".text", ScanType::MovRegXmmByte, 0);
  327.    
  328.     AUTO_OFFSET(Camera, ViewProjection, "\x0F\x11\x86\x00\x00\x00\x00\x48\x8D\x8E\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x48\x8B\x96", "xxx????xxx????x????xxx", ".text", ScanType::MovRegByte, 0); //DONE
  329.  
  330. }
  331.  
  332. void Updater::SetupVisualStatePatterns() {
  333.  
  334.     AUTO_OFFSET(VisualState, Transform, "\xF3\x0F\x10\x40\x00\xF3\x0F\x10\x50\x00\xF3\x0F\x10\x58\x00", "xxxx?xxxx?xxxx?", ".text", ScanType::MovRegXmmByte, 0);
  335.     AUTO_OFFSET(VisualState, InverseTransform, "\x89\x8B\x00\x00\x00\x00\x8B\x4A\x04", "xx????xxx", ".text", ScanType::MovRegSml, 0);
  336.  
  337. }
  338.  
  339. void Updater::SetupItemInventoryPatterns() {
  340.  
  341.     AUTO_OFFSET(ItemInventory, CargoGrid, "\x48\x8B\x8B\x00\x00\x00\x00\x49\x8B\xD6\x48\x8B\x01", "xxx????xxxxxx", ".text", ScanType::MovReg, 0);
  342.     AUTO_OFFSET(ItemInventory, Quality, "\x0F\xBE\x89\x00\x00\x00\x00\x33\xD2\x84\xC9", "xxx????xxxx", ".text", ScanType::MovReg, 0);
  343.  
  344. }
  345.  
  346. void Updater::SetupCargoGridPatterns() {
  347.  
  348.     AUTO_OFFSET(CargoGrid, ItemList, "\x4C\x8B\x51\x00\x48\x8B\xF9\x41\x8B\xD9\x49\x8B\xF0", "xxx?xxxxxxxxx", ".text", ScanType::MovRegByte, 0);
  349.  
  350. }
  351.  
  352.  
  353. bool Updater::SetupPatterns() {
  354.  
  355.  
  356.     SetupModbasePatterns();
  357.     SetupNetworkPatterns();
  358.     SetupPlayerIdentityPatterns();
  359.     SetupWorldPatterns();
  360.     SetupHumanPatterns();
  361.     SetupDayZInfectedPatterns();
  362.     SetupHumanTypePatterns();
  363.     SetupDayZLocalPatterns();
  364.     SetupDayZPlayerPatterns();
  365.     SetupDayZPlayerInventoryPatterns();
  366.     SetupInventoryItemPatterns();
  367.     SetupWeaponPatterns();
  368.     SetupWeaponInventoryPatterns();
  369.     SetupMagazinePatterns();
  370.     SetupAmmoTypePatterns();
  371.     SetupSkeletonPatterns();
  372.     SetupAnimClassPatterns();
  373.     SetupCameraPatterns();
  374.     SetupVisualStatePatterns();
  375.     SetupItemInventoryPatterns();
  376.     SetupCargoGridPatterns();
  377.     SetupScriptContextPatterns();
  378.  
  379.     return true;
  380. }
  381.  
  382. bool Updater::Init() {
  383.  
  384.     if (!AllocateModule())
  385.         return false;
  386.  
  387.     if (!SetupPatterns())
  388.         return false;
  389.  
  390.     return true;
  391. }
  392.  
  393. bool Updater::Scan() {
  394.  
  395.     for (auto& Data : m_Scans) {
  396.  
  397. #if _DEBUG
  398.         Data.second.Scan(m_Module, m_Allocated);
  399. #else
  400.         Data.Scan(m_Module, m_Allocated);
  401. #endif
  402.  
  403.     }
  404.  
  405.  
  406.     return true;
  407. }
  408.  
  409. /* cluster fuck #if */
  410. bool Updater::Release() {
  411.  
  412.     bool Result = true;
  413.  
  414.     for (auto& Data : m_Scans) {
  415. #if _DEBUG
  416.         if (!Data.second.UpdateReference()) {
  417. #else
  418.         if (!Data.UpdateReference()) {
  419. #endif
  420.  
  421. #if _DEBUG
  422.             printf("[OFFSET] Failed to get offset: %s\n", Data.first.c_str());
  423. #endif
  424.  
  425.             Result = false;
  426.         }
  427.  
  428. #if _DEBUG
  429.         printf("[OFFSET: ] %-36s -> 0x%llX\n",
  430.             Data.first.c_str(),
  431.             (unsigned long long)Data.second.GetOffset());
  432. #endif
  433.  
  434.  
  435.     }
  436.  
  437.     m_Scans.clear();
  438.  
  439.     (void)DeallocateModule();
  440.  
  441.     return Result;
  442. }
  443.  
Add Comment
Please, Sign In to add comment