Esempio n. 1
0
        protected override void UpdateMemory()
        {
            UpdateVisibility();

            bool traceUniquePointers = ConfigHelper.Main.Values.Debug.TraceUniquePointers;

            if (ConfigHelper.Main.Values.Overlay.MonsterWidget.IsVisible)
            {
                /*
                 * var range = new AddressRange(0x140000000, 0x140001000);//0x163B0A000);
                 * //var pattern = new BytePattern(new Config.BytePatternConfig("48 8B 05 ?? ?? ?? ?? 41 8B", "140000000", "163B0A000", null));
                 *
                 * var pattern = new BytePattern(new Config.BytePatternConfig("48 8B 05 ?? ?? ?? ?? 41 8B", "140000000", "163B0A000", null));
                 *
                 * var matches = MemoryHelper.FindPatternAddresses(Process, range, pattern, false);
                 *
                 * var res = new System.Collections.Generic.List<ulong>();
                 *
                 * foreach (ulong address in matches)
                 * {
                 *  ulong lear = MemoryHelper.LoadEffectiveAddressRelative(Process, address);
                 *  if (lear == 0x144C77498 || lear == 0x144CE4150 || lear == 0x144CEA750)// || lear == 0x144ee4630)// || lear == 0x144e437d0)
                 *  {
                 *      res.Add(address);
                 *  }
                 * }
                 */
                var monsterRootPtr  = MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First()) - 0x36CE0; //MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First());
                var monsterBaseList = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, 0x128, 0x8, 0x0);       //MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, monsterOffset, 0x18, 0xD0, 0xC8, 0x738, 0x8, 0x0);

                MhwHelper.UpdateMonsterWidget(Process, monsterBaseList);
            }
            else if (OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Any())
            {
                OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible)
            {
                ulong playerNamesPtr                = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.MatchedAddresses.First()); // Players Damages are not working (probably offset is wrong)
                var   playerDamageRootPtr           = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerDamagePattern.MatchedAddresses.First());
                var   playerDamageCollectionAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerDamageRootPtr, (long)MhwHelper.DataOffsets.PlayerDamageCollection.FirstPlayerPtr + (long)MhwHelper.DataOffsets.PlayerDamageCollection.MaxPlayerCount * sizeof(long) * (long)MhwHelper.DataOffsets.PlayerDamageCollection.NextPlayerPtr);
                var   playerNamesAddress            = MemoryHelper.Read <uint>(Process, playerNamesPtr);

                MhwHelper.UpdateTeamWidget(Process, playerDamageCollectionAddress, playerNamesAddress);
            }
            else if (OverlayViewModel.Instance.TeamWidget.Context.Players.Any())
            {
                OverlayViewModel.Instance.TeamWidget.Context.Players.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.PlayerWidget.IsVisible && false)
            {
                var playerBuffRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerBuffPattern.MatchedAddresses.First());

                // The local player is guaranteed to be the last item in the list,
                // So, keep reading each pointer in the collection until we reach null
                var   buffPtr            = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerBuffRootPtr, 0x9B0 + 0xC8, 0); // 0xA78
                ulong lastBuffAddress    = 0;
                ulong currentBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr);
                while (currentBuffAddress != 0)
                {
                    lastBuffAddress    = currentBuffAddress;
                    buffPtr           += 8;
                    currentBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr);
                }

                var buffAddress      = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, lastBuffAddress + 0x79D0, 0);
                var equipmentAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, buffAddress + 0x8, 0x70, 0x78, 0x50, -0x10);
                var weaponAddress    = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, buffAddress + 0x10, 0x8, 0x78, 0x48, 0x0);

                var isBuffAddressValid      = MemoryHelper.Read <float>(Process, equipmentAddress + 0x20) != 0;
                var isEquipmentAddressValid = MemoryHelper.Read <ulong>(Process, equipmentAddress + 0x8) == 0;
                if (isBuffAddressValid && isEquipmentAddressValid)
                {
                    MhwHelper.UpdatePlayerWidget(Process, buffAddress, equipmentAddress, weaponAddress);
                }
                else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
                {
                    OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
                }
            }
            else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
            {
                OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
            }
        }
Esempio n. 2
0
        protected override void UpdateMemory()
        {
            UpdateVisibility();

            /*
             * var range = new AddressRange(0x140000000, 0x169233000);
             * //var pattern = new BytePattern(new Config.BytePatternConfig("48 8B 05 ?? ?? ?? ?? 41 8B", "140000000", "163B0A000", null));
             *
             * var pattern = new BytePattern(new Config.BytePatternConfig("null", "48 8B 0D ?? ?? ?? ??", null));
             * var matches = MemoryHelper.FindPatternAddresses(Process, range, pattern, false);
             *
             * Log.WriteLine($"Found {matches.Count()} matches...");
             *
             * ulong[] lookingFor = new ulong[1] { 0x144FA8720 };
             *
             * var res = new System.Collections.Generic.List<ulong>();
             *
             * foreach (ulong address in matches)
             * {
             *  ulong lear = MemoryHelper.LoadEffectiveAddressRelative(Process, address);
             *  foreach (ulong looking in lookingFor)
             *  {
             *      if (looking == lear)
             *      {
             *          res.Add(address);
             *          Log.WriteLine($"Found match for 0x{looking} at 0x{address}");
             *      }
             *  }
             * }
             */
            bool traceUniquePointers = ConfigHelper.Main.Values.Debug.TraceUniquePointers;

            if (m_PlayerNamePattern.MatchedAddresses.Any() && m_CurrentPlayerNamePattern.MatchedAddresses.Any() && m_CurrentWeaponPattern.MatchedAddresses.Any() && m_LobbyStatusPattern.MatchedAddresses.Any())
            {
                ulong playerNamesPtr     = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.MatchedAddresses.First());
                ulong playerNamesAddress = MemoryHelper.Read <uint>(Process, playerNamesPtr);

                ulong currentPlayerNamePtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_CurrentPlayerNamePattern.MatchedAddresses.First());
                //ulong currentFelyneNameAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, currentPlayerNamePtr, 0xB40, 0x0, 0x890, 0x160, 0x8, 0x1E8, 0x7DC);


                ulong currentPlayerNameAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, currentPlayerNamePtr, 0xB20, 0x0, 0x530, 0xC0, 0x8, 0x78, 0x78);

                ulong currentWeaponPtr     = MemoryHelper.LoadEffectiveAddressRelative(Process, m_CurrentWeaponPattern.MatchedAddresses.First());
                ulong currentWeaponAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, currentWeaponPtr, 0x80, 0x7500);

                ulong lobbyStatusPtr     = MemoryHelper.LoadEffectiveAddressRelative(Process, m_LobbyStatusPattern.MatchedAddresses.First());
                ulong lobbyStatusAddress = MemoryHelper.Read <ulong>(Process, lobbyStatusPtr);

                MhwHelper.UpdateCurrentGame(Process, playerNamesAddress, currentPlayerNameAddress, currentWeaponAddress, lobbyStatusAddress);
            }

            if (!OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid || OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerInLobby())
            {
                if (ConfigHelper.Main.Values.Overlay.MonsterWidget.IsVisible && m_MonsterPattern.MatchedAddresses.Any())
                {
                    ulong monsterRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First()); // yeah i know this is basically a static pointer
                    //ulong monsterRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First()) - 0x36CE0; // yeah i know this is basically a static pointer
                    ulong monsterBaseList = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, 0x698, 0x0, 0x138, 0x0);
                    ulong mapBaseAddress  = 0x0;
                    if (ConfigHelper.Main.Values.Overlay.MonsterWidget.ShowOnlySelectedMonster && m_SelectedMonsterPattern.MatchedAddresses.Any())
                    {
                        ulong mapPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_SelectedMonsterPattern.MatchedAddresses.First());
                        mapBaseAddress = MemoryHelper.Read <ulong>(Process, mapPtr);
                    }

                    MhwHelper.UpdateMonsterWidget(Process, monsterBaseList, mapBaseAddress);
                }
                else if (OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Any())
                {
                    OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
                }

                if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible && m_PlayerDamagePattern.MatchedAddresses.Any() && m_PlayerNamePattern.MatchedAddresses.Any() && (!OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid || OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline()))
                {
                    ulong playerNamesPtr                = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.MatchedAddresses.First());
                    ulong playerDamageRootPtr           = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerDamagePattern.MatchedAddresses.First());
                    ulong playerDamageCollectionAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerDamageRootPtr, (long)MhwHelper.DataOffsets.PlayerDamageCollection.FirstPlayerPtr + (long)MhwHelper.DataOffsets.PlayerDamageCollection.MaxPlayerCount * sizeof(long) * (long)MhwHelper.DataOffsets.PlayerDamageCollection.NextPlayerPtr);
                    ulong playerNamesAddress            = MemoryHelper.Read <uint>(Process, playerNamesPtr);

                    MhwHelper.UpdateTeamWidget(Process, playerDamageCollectionAddress, playerNamesAddress);

                    if (m_DamageOnScreenPattern.MatchedAddresses.Any() && OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerInExpedition)
                    {
                        ulong damageOnScreenRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_DamageOnScreenPattern.MatchedAddresses.First());
                        ulong damageOnScreePtr      = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, damageOnScreenRootPtr, 0x580, 0x58, 0xC0, 0x518, 0x0);
                        MhwHelper.UpdateDamageOnScreen(Process, damageOnScreePtr);
                    }
                }
                else if (OverlayViewModel.Instance.TeamWidget.Context.Players.Any())
                {
                    OverlayViewModel.Instance.TeamWidget.Context.ClearPlayers();
                }

                if (ConfigHelper.Main.Values.Overlay.PlayerWidget.IsVisible && m_PlayerBuffPattern.MatchedAddresses.Any())
                {
                    ulong playerBuffRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerBuffPattern.MatchedAddresses.First());

                    ulong buffPtr = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerBuffRootPtr, 0x8C8, 0x1C0, 0x0);

                    ulong lastBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr - 0x38) + 0x80;

                    ulong equipmentAddress = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x14F8);
                    ulong weaponAddress    = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x76B0);
                    ulong buffAddress      = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x7D20);

                    MhwHelper.UpdatePlayerWidget(Process, buffAddress, equipmentAddress, weaponAddress);
                }
                else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
                {
                    OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
                }
            }
            else
            {
                OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
                OverlayViewModel.Instance.TeamWidget.Context.ClearPlayers();
                OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
            }
        }
        protected override void UpdateMemory()
        {
            UpdateVisibility();

            bool traceUniquePointers = ConfigHelper.Main.Values.Debug.TraceUniquePointers;

            if (ConfigHelper.Main.Values.Overlay.MonsterWidget.IsVisible)
            {
                /*
                 * var range = new AddressRange(0x140000000, 0x163B0A000);
                 * var pattern = new BytePattern(new Config.BytePatternConfig("48 8b ?? ?? ?? ??", "140000000", "163B0A000", null));
                 *
                 * System.Collections.Generic.List<ulong> matches = MemoryHelper.FindPatternAddresses(Process, range, pattern, false);
                 *
                 * System.Collections.Generic.List<ulong> res = new System.Collections.Generic.List<ulong>();
                 *
                 * foreach (ulong address in matches)
                 * {
                 *  ulong lear = MemoryHelper.LoadEffectiveAddressRelative(Process, address);
                 *  if (lear == 0x144e0c8d0 || lear == 0x144e0caf0)// || lear == 0x144ee4630)// || lear == 0x144e437d0)
                 *  {
                 *      res.Add(address);
                 *  }
                 * }
                 *
                 *
                 * //0x140224589
                 *
                 * ulong offset_for_next = 0x18;
                 * ulong offset_for_start_monster_struct = 0x40;
                 * ulong offset_for_component = 0x7670;
                 * while (true)
                 * {
                 *  ulong ptr = 0x211a80e80;//0x2196f0e80;
                 *  while (ptr != 0)
                 *  {
                 *      ulong health_component = MemoryHelper.Read<ulong>(Process, ptr + offset_for_start_monster_struct + offset_for_component);
                 *      ulong tmp = ptr + offset_for_start_monster_struct + offset_for_component + 0x179;
                 *      string name = MemoryHelper.ReadString(Process, tmp, 32);
                 *      float current = MemoryHelper.Read<float>(Process, health_component + 0x60);
                 *      float max = MemoryHelper.Read<float>(Process, health_component + 0x64);
                 *      ptr = MemoryHelper.Read<ulong>(Process, ptr + offset_for_next);
                 *  }
                 * }
                 */

                //the instructions commented sometimes return the right address (q.q)

                var monsterRootPtr  = MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First()) - 0x36CE0; //MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First());
                var monsterBaseList = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, 0x128, 0x8, 0x0);       //MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, monsterOffset, 0x18, 0xD0, 0xC8, 0x738, 0x8, 0x0);

                MhwHelper.UpdateMonsterWidget(Process, monsterBaseList);
            }
            else if (OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Any())
            {
                OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible)
            {
                ulong playerNamesPtr                = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.MatchedAddresses.First()); // Players Damages are not working (probably offset is wrong)
                var   playerDamageRootPtr           = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerDamagePattern.MatchedAddresses.First());
                var   playerDamageCollectionAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerDamageRootPtr, (long)MhwHelper.DataOffsets.PlayerDamageCollection.FirstPlayerPtr + (long)MhwHelper.DataOffsets.PlayerDamageCollection.MaxPlayerCount * sizeof(long) * (long)MhwHelper.DataOffsets.PlayerDamageCollection.NextPlayerPtr);
                var   playerNamesAddress            = MemoryHelper.Read <uint>(Process, playerNamesPtr);

                MhwHelper.UpdateTeamWidget(Process, playerDamageCollectionAddress, playerNamesAddress);
            }
            else if (OverlayViewModel.Instance.TeamWidget.Context.Players.Any())
            {
                OverlayViewModel.Instance.TeamWidget.Context.Players.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.PlayerWidget.IsVisible && false)
            {
                var playerBuffRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerBuffPattern.MatchedAddresses.First());

                // The local player is guaranteed to be the last item in the list,
                // So, keep reading each pointer in the collection until we reach null
                var   buffPtr            = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerBuffRootPtr, 0x9B0 + 0xC8, 0); // 0xA78
                ulong lastBuffAddress    = 0;
                ulong currentBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr);
                while (currentBuffAddress != 0)
                {
                    lastBuffAddress    = currentBuffAddress;
                    buffPtr           += 8;
                    currentBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr);
                }

                var buffAddress      = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, lastBuffAddress + 0x79D0, 0);
                var equipmentAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, buffAddress + 0x8, 0x70, 0x78, 0x50, -0x10);
                var weaponAddress    = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, buffAddress + 0x10, 0x8, 0x78, 0x48, 0x0);

                var isBuffAddressValid      = MemoryHelper.Read <float>(Process, equipmentAddress + 0x20) != 0;
                var isEquipmentAddressValid = MemoryHelper.Read <ulong>(Process, equipmentAddress + 0x8) == 0;
                if (isBuffAddressValid && isEquipmentAddressValid)
                {
                    MhwHelper.UpdatePlayerWidget(Process, buffAddress, equipmentAddress, weaponAddress);
                }
                else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
                {
                    OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
                }
            }
            else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
            {
                OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
            }
        }
Esempio n. 4
0
        protected override void UpdateMemory()
        {
            UpdateVisibility();

            bool traceUniquePointers = ConfigHelper.Main.Values.Debug.TraceUniquePointers;

            if (ConfigHelper.Main.Values.Overlay.MonsterWidget.IsVisible && m_MonsterPattern.MatchedAddresses.Any())
            {
                /*
                 * var range = new AddressRange(0x140000000, 0x163B0A000);
                 * //var pattern = new BytePattern(new Config.BytePatternConfig("48 8B 05 ?? ?? ?? ?? 41 8B", "140000000", "163B0A000", null));
                 *
                 * var pattern = new BytePattern(new Config.BytePatternConfig("null", "48 8B 05 ?? ?? ?? ?? 41 8B", "140000000", "163B0A000", null));
                 * var matches = MemoryHelper.FindPatternAddresses(Process, range, pattern, false);
                 *
                 * //Log.WriteLine($"Found {matches.Count()} matches...");
                 *
                 * ulong[] lookingFor = new ulong[1] { 0x144F03280 };
                 *
                 * var res = new System.Collections.Generic.List<ulong>();
                 *
                 * foreach (ulong address in matches)
                 * {
                 *  ulong lear = MemoryHelper.LoadEffectiveAddressRelative(Process, address);
                 *  foreach (ulong looking in lookingFor)
                 *  {
                 *      if (looking == lear)
                 *      {
                 *          res.Add(address);
                 *          //Log.WriteLine($"Found match for 0x{looking} at 0x{address}");
                 *      }
                 *  }
                 * }
                 */
                var monsterRootPtr  = MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First()) - 0x36CE0; //MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First());
                var monsterBaseList = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, 0x128, 0x8, 0x0);       //MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, monsterOffset, 0x18, 0xD0, 0xC8, 0x738, 0x8, 0x0);

                MhwHelper.UpdateMonsterWidget(Process, monsterBaseList);
            }
            else if (OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Any())
            {
                OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible && m_PlayerDamagePattern.MatchedAddresses.Any())
            {
                ulong playerNamesPtr                = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.MatchedAddresses.First()); // Players Damages are not working (probably offset is wrong)
                var   playerDamageRootPtr           = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerDamagePattern.MatchedAddresses.First());
                var   playerDamageCollectionAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerDamageRootPtr, (long)MhwHelper.DataOffsets.PlayerDamageCollection.FirstPlayerPtr + (long)MhwHelper.DataOffsets.PlayerDamageCollection.MaxPlayerCount * sizeof(long) * (long)MhwHelper.DataOffsets.PlayerDamageCollection.NextPlayerPtr);
                var   playerNamesAddress            = MemoryHelper.Read <uint>(Process, playerNamesPtr);

                MhwHelper.UpdateTeamWidget(Process, playerDamageCollectionAddress, playerNamesAddress);
            }
            else if (OverlayViewModel.Instance.TeamWidget.Context.Players.Any())
            {
                OverlayViewModel.Instance.TeamWidget.Context.Players.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.PlayerWidget.IsVisible && m_PlayerBuffPattern.MatchedAddresses.Any() && false)
            {
                var playerBuffRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerBuffPattern.MatchedAddresses.First());

                var buffPtr = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerBuffRootPtr, 0x8C8, 0x1C0, 0x0);

                // The local player is guaranteed to be the last item in the list,
                // So, keep reading each pointer in the collection until we reach null

                ulong lastBuffAddress    = 0x0;
                ulong currentBuffAddress = buffPtr;
                while (currentBuffAddress != 0) // non va benissimo
                {
                    lastBuffAddress    = currentBuffAddress;
                    currentBuffAddress = MemoryHelper.Read <ulong>(Process, currentBuffAddress + 0x38);
                }

                ulong equipmentAddress = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x14F8);
                ulong weaponAddress    = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x76B0);
                ulong buffAddress      = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x7D20);

                var isBuffAddressValid      = MemoryHelper.Read <float>(Process, equipmentAddress + 0x20) != 0;
                var isEquipmentAddressValid = MemoryHelper.Read <ulong>(Process, equipmentAddress + 0x8) == 0;
                if (isBuffAddressValid && isEquipmentAddressValid)
                {
                    MhwHelper.UpdatePlayerWidget(Process, buffAddress, equipmentAddress, weaponAddress);
                }
                else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
                {
                    OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
                }
            }
            else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
            {
                OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
            }
        }
Esempio n. 5
0
        protected override void UpdateMemory()
        {
            UpdateVisibility();

            bool traceUniquePointers = ConfigHelper.Main.Values.Debug.TraceUniquePointers;

            if (ConfigHelper.Main.Values.Overlay.MonsterWidget.IsVisible)
            {
                var monsterRootPtr     = MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.Addresses.First());
                var monsterOffset      = MemoryHelper.ReadStaticOffset(Process, m_MonsterOffsetPattern.Addresses.First());
                var lastMonsterAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, monsterOffset, 0x8F9BC * 8, 0, 0);

                MhwHelper.UpdateMonsterWidget(Process, lastMonsterAddress);
            }
            else if (OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Any())
            {
                OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible)
            {
                ulong playerNamesPtr                = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.Addresses.First());
                var   playerDamageRootPtr           = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerDamagePattern.Addresses.First());
                var   playerDamageCollectionAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerDamageRootPtr, 0x48 + 0x20 * 0x58);
                var   playerNamesAddress            = MemoryHelper.Read <uint>(Process, playerNamesPtr);

                MhwHelper.UpdateTeamWidget(Process, playerDamageCollectionAddress, playerNamesAddress);
            }
            else if (OverlayViewModel.Instance.TeamWidget.Context.Players.Any())
            {
                OverlayViewModel.Instance.TeamWidget.Context.Players.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.PlayerWidget.IsVisible)
            {
                var playerBuffRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerBuffPattern.Addresses.First());

                // The local player is guaranteed to be the last item in the list,
                // So, keep reading each pointer in the collection until we reach null
                var   buffPtr            = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerBuffRootPtr, 0X9B0 + 0XC8, 0);
                ulong lastBuffAddress    = 0;
                ulong currentBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr);
                while (currentBuffAddress != 0)
                {
                    lastBuffAddress    = currentBuffAddress;
                    buffPtr           += 8;
                    currentBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr);
                }

                var buffAddress      = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, lastBuffAddress + 0x79D0, 0);
                var equipmentAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, buffAddress + 0x8, 0x70, 0x78, 0x50, -0x10);
                var weaponAddress    = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, buffAddress + 0x10, 0x8, 0x78, 0x48, 0x0);

                var isBuffAddressValid      = MemoryHelper.Read <float>(Process, equipmentAddress + 0x20) != 0;
                var isEquipmentAddressValid = MemoryHelper.Read <ulong>(Process, equipmentAddress + 0x8) == 0;
                if (isBuffAddressValid && isEquipmentAddressValid)
                {
                    MhwHelper.UpdatePlayerWidget(Process, buffAddress, equipmentAddress, weaponAddress);
                }
                else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
                {
                    OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
                }
            }
            else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
            {
                OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
            }
        }
Esempio n. 6
0
        protected override void UpdateMemory()
        {
            UpdateVisibility();

            bool traceUniquePointers = ConfigHelper.Main.Values.Debug.TraceUniquePointers;

            if (ConfigHelper.Main.Values.Overlay.MonsterWidget.IsVisible && m_MonsterPattern.MatchedAddresses.Any())
            {
                /*
                 * var range = new AddressRange(0x140000000, 0x163B0A000);
                 * //var pattern = new BytePattern(new Config.BytePatternConfig("48 8B 05 ?? ?? ?? ?? 41 8B", "140000000", "163B0A000", null));
                 *
                 * var pattern = new BytePattern(new Config.BytePatternConfig("null", "48 8B 05 ?? ?? ?? ?? 41 8B", "140000000", "163B0A000", null));
                 * var matches = MemoryHelper.FindPatternAddresses(Process, range, pattern, false);
                 *
                 * //Log.WriteLine($"Found {matches.Count()} matches...");
                 *
                 * ulong[] lookingFor = new ulong[1] { 0x144F03280 };
                 *
                 * var res = new System.Collections.Generic.List<ulong>();
                 *
                 * foreach (ulong address in matches)
                 * {
                 *  ulong lear = MemoryHelper.LoadEffectiveAddressRelative(Process, address);
                 *  foreach (ulong looking in lookingFor)
                 *  {
                 *      if (looking == lear)
                 *      {
                 *          res.Add(address);
                 *          //Log.WriteLine($"Found match for 0x{looking} at 0x{address}");
                 *      }
                 *  }
                 * }
                 */
                var monsterRootPtr  = MemoryHelper.LoadEffectiveAddressRelative(Process, m_MonsterPattern.MatchedAddresses.First()) - 0x36CE0; // yeah i know this is basically a static pointer
                var monsterBaseList = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, monsterRootPtr, 0x128, 0x8, 0x0);

                MhwHelper.UpdateMonsterWidget(Process, monsterBaseList);
            }
            else if (OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Any())
            {
                OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible && m_PlayerDamagePattern.MatchedAddresses.Any())
            {
                ulong playerNamesPtr                = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.MatchedAddresses.First());
                var   playerDamageRootPtr           = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerDamagePattern.MatchedAddresses.First());
                var   playerDamageCollectionAddress = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerDamageRootPtr, (long)MhwHelper.DataOffsets.PlayerDamageCollection.FirstPlayerPtr + (long)MhwHelper.DataOffsets.PlayerDamageCollection.MaxPlayerCount * sizeof(long) * (long)MhwHelper.DataOffsets.PlayerDamageCollection.NextPlayerPtr);
                var   playerNamesAddress            = MemoryHelper.Read <uint>(Process, playerNamesPtr);

                MhwHelper.UpdateTeamWidget(Process, playerDamageCollectionAddress, playerNamesAddress);
            }
            else if (OverlayViewModel.Instance.TeamWidget.Context.Players.Any())
            {
                OverlayViewModel.Instance.TeamWidget.Context.Players.Clear();
            }

            if (ConfigHelper.Main.Values.Overlay.PlayerWidget.IsVisible && m_PlayerBuffPattern.MatchedAddresses.Any())
            {
                var playerBuffRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerBuffPattern.MatchedAddresses.First());

                var buffPtr = MemoryHelper.ReadMultiLevelPointer(traceUniquePointers, Process, playerBuffRootPtr, 0x8C8, 0x1C0, 0x0);

                ulong lastBuffAddress = MemoryHelper.Read <ulong>(Process, buffPtr - 0x38) + 0x80;

                ulong equipmentAddress = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x14F8);
                ulong weaponAddress    = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x76B0);
                ulong buffAddress      = MemoryHelper.Read <ulong>(Process, lastBuffAddress + 0x7D20);

                MhwHelper.UpdatePlayerWidget(Process, buffAddress, equipmentAddress, weaponAddress);
            }
            else if (OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Any())
            {
                OverlayViewModel.Instance.PlayerWidget.Context.StatusEffects.Clear();
            }
        }