Exemple #1
0
        /// <summary>
        /// This call refreshes everything. This should be used less often. Inventory rendering can be more expensive and doesn't change as often.
        /// </summary>
        /// <param name="cToken"></param>
        public void Refresh()
        {
            // Perform slim lookups first.
            RefreshSlim();

            // Other lookups that don't need to update as often.
            // Player HP
            PlayerMaxHealth     = PointerPlayerHP.DerefInt(0x54);
            PlayerCurrentHealth = PointerPlayerHP.DerefInt(0x58);
            PlayerPoisoned      = PointerPlayerPoison.DerefByte(0x258) == 0x01;
            Rank      = PointerRank.DerefInt(0x58);
            RankScore = PointerRank.DerefFloat(0x5C);

            // Enemy HP
            GenerateEnemyEntries();
            for (int i = 0; i < PointerEnemyEntries.Length; ++i)
            {
                EnemyHealth[i] = new EnemyHP(PointerEnemyEntries[i].DerefInt(0x54), PointerEnemyEntries[i].DerefInt(0x58));
            }

            // Inventory
            for (int i = 0; i < PointerInventoryEntries.Length; ++i)
            {
                long   invDataPointer = PointerInventoryEntries[i].DerefLong(0x10);
                long   invDataOffset  = invDataPointer - PointerInventoryEntries[i].Address;
                int    invSlot        = PointerInventoryEntries[i].DerefInt(0x28);
                byte[] invData        = PointerInventoryEntries[i].DerefByteArray(invDataOffset + 0x10, 0x14);
                PlayerInventory[i] = new InventoryEntry(invSlot, (invData != null) ? invData : new byte[20] {
                    0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
                });
            }

            HasScanned = true;
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="proc"></param>
        public GameMemory(int pid)
        {
            memoryAccess = new ProcessMemory.ProcessMemory(pid);
            BaseAddress  = NativeWrappers.GetProcessBaseAddress(pid, ProcessMemory.PInvoke.ListModules.LIST_MODULES_64BIT).ToInt64(); // Bypass .NET's managed solution for getting this and attempt to get this info ourselves via PInvoke since some users are getting 299 PARTIAL COPY when they seemingly shouldn't. This is built as x64 only and RE3 is x64 only to my knowledge.
            SelectPointerAddresses();

            // Setup the pointers.
            PointerIGT          = new MultilevelPointer(memoryAccess, BaseAddress + pointerAddressIGT, 0x60L);       // *
            PointerRank         = new MultilevelPointer(memoryAccess, BaseAddress + pointerAddressRank);             // *
            PointerPlayerHP     = new MultilevelPointer(memoryAccess, BaseAddress + pointerAddressHP, 0x50L, 0x20L); // *
            PointerPlayerPoison = new MultilevelPointer(memoryAccess, BaseAddress + pointerAddressPoison, 0x50L, 0x20L, 0xF8L);

            PointerEnemyEntryCount = new MultilevelPointer(memoryAccess, BaseAddress + pointerAddressEnemy, 0x30L); // *
            GenerateEnemyEntries();

            PointerInventoryEntries = new MultilevelPointer[20];
            for (long i = 0; i < PointerInventoryEntries.Length; ++i)
            {
                PointerInventoryEntries[i] = new MultilevelPointer(memoryAccess, BaseAddress + pointerAddressInventory, 0x50L, 0x98L, 0x10L, 0x20L + (i * 0x08L), 0x18L); // *
            }
            // Initialize variables to default values.
            PlayerCurrentHealth = 0;
            PlayerMaxHealth     = 0;
            PlayerPoisoned      = false;
            PlayerInventory     = new InventoryEntry[20];
            EnemyHealth         = new EnemyHP[32];
            IGTRunningTimer     = 0L;
            IGTCutsceneTimer    = 0L;
            IGTMenuTimer        = 0L;
            IGTPausedTimer      = 0L;
            Rank      = 0;
            RankScore = 0f;
        }