Exemplo n.º 1
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;
        }
        internal void Initialize(int pid)
        {
            SelectPointerAddresses(GameHashes.DetectVersion(Process.GetProcessesByName("re7").FirstOrDefault().MainModule.FileName));
            memoryAccess = new ProcessMemoryHandler(pid);

            if (ProcessRunning)
            {
                connected   = true;
                BaseAddress = NativeWrappers.GetProcessBaseAddress(pid, 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.

                PointerMrEverythingCount = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + mrEverythingCount), 0x78L, 0x1F0L);
                PointerDA      = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + difficultyAdjustment));
                PointerMapName = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + mapName), 0x700L);
                PointerHP      = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + hitPoints), 0xA0L, 0xD0L, 0x70L);
                //PointerHP = new MultilevelPointer(memoryAccess, BaseAddress + hitPoints, 0xA0L, 0xD0L, 0x70L);
                PointerEnemyEntryCount = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + enemyHitPoints), 0x190L, 0x70L);
                GenerateEnemyEntries();

                PointerBagCount              = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + bagCount));
                PointerInventoryCount        = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + itemCount), 0x60L);
                PointerInventorySlotSelected = new MultilevelPointer(memoryAccess, (IntPtr)(BaseAddress + selectedSlot), 0x240L, 0x58L, 0x228L);
                PointerItemNames             = new MultilevelPointer[32];
                PointerItemInfo              = new MultilevelPointer[32];
            }
        }
        public void Initialize(Process process)
        {
            if ((_process = process) == null)
            {
                return;
            }

            try
            {
                if (!SetPointerAddresses(GameHashes.DetectVersion(_process?.MainModule?.FileName)))
                {
                    return;
                }
            }
            catch { return; }

            int pid = GetProcessId(_process).Value;

            _processMemory = new ProcessMemoryHandler(pid);

            if (ProcessRunning)
            {
                Pointers.BaseAddress = NativeWrappers.GetProcessBaseAddress(_process.Id, PInvoke.ListModules.LIST_MODULES_32BIT);

                Pointers.WindowHandleId     = IntPtr.Add(Pointers.BaseAddress, Pointers._addressWindowHandle);
                Pointers.FrameCount         = IntPtr.Add(Pointers.BaseAddress, Pointers._addressFrameCount);
                Pointers.CurrentCharacterId = IntPtr.Add(Pointers.BaseAddress, Pointers._addressCurrentCharacterId);
                Pointers.CurrentRoomId      = IntPtr.Add(Pointers.BaseAddress, Pointers._addressCurrentRoomId);
                Pointers.ZombieMaxHP        = IntPtr.Add(Pointers.BaseAddress, Pointers._addressZombieMaxHP);

                Pointers.Characters = new IntPtr[Memory.Characters.Length];
                for (int i = 0; i < Pointers.Characters.Length; ++i)
                {
                    Pointers.Characters[i] = IntPtr.Add(Pointers.BaseAddress, Pointers._addressCharacters + (0xAC4 * i));
                }

                Pointers.Inventory = new IntPtr[Memory.Characters.Length, 18];
                for (int i = 0; i < Pointers.Inventory.GetLength(0); ++i)
                {
                    for (int j = 0; j < Pointers.Inventory.GetLength(1); ++j)
                    {
                        Pointers.Inventory[i, j] = IntPtr.Add(Pointers.BaseAddress, Pointers._addressInventory + (0x438 * i) + (0x3c * j));
                    }
                }

                Pointers.Enemy = new IntPtr[Memory.Enemy.Length];
                for (int i = 0; i < Pointers.Enemy.Length; ++i)
                {
                    Pointers.Enemy[i] = IntPtr.Add(Pointers.BaseAddress, Pointers._addressEnemy + (0xAC4 * i));
                }

                Update();
            }
        }
Exemplo n.º 4
0
        internal void Initialize(int pid)
        {
            memoryAccess = new ProcessMemory.ProcessMemory(pid);

            if (ProcessRunning)
            {
                BaseAddress = NativeWrappers.GetProcessBaseAddress(pid, 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.

                PointerPlayerHP = new MultilevelPointer(memoryAccess, BaseAddress + pointerAddressHP, 0xC0L, 0x48L, 0x98L, 0x78L);
            }
        }
        internal void Initialize(Process process)
        {
            if (process == null)
            {
                return; // Do not continue if this is null.
            }
            SelectPointerAddresses();

            int pid = GetProcessId(process).Value;

            memoryAccess = new ProcessMemory.ProcessMemory(pid);

            if (ProcessRunning)
            {
                BaseAddress = NativeWrappers.GetProcessBaseAddress(pid, 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.

                PointerSecretAreas = new MultilevelPointer(memoryAccess, BaseAddress + PointerAddressSecretAreas, 0x148L, 0x8L, 0x50L, 0x3E0L, 0x10L);
            }
        }
        internal unsafe void Initialize(Process process, ILogger logger)
        {
            this.logger = logger;
            if (process == null)
            {
                return; // Do not continue if this is null.
            }
            if (!SelectPointerAddresses(GameHashes.DetectVersion(process.MainModule.FileName)))
            {
                return; // Unknown version.
            }
            int pid = GetProcessId(process).Value;

            memoryAccess = new ProcessMemoryHandler(pid);
            if (ProcessRunning)
            {
                BaseAddress = NativeWrappers.GetProcessBaseAddress(pid, PInvoke.ListModules.LIST_MODULES_64BIT); // 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.

                // Setup the pointers.
                //PointerPlayerHP = new MultilevelPointer(memoryAccess, IntPtr.Add(BaseAddress, pointerAddressHP), 0x58L, 0x18L, 0x18L, 0x78L, 0x68L, 0x48L);
                //PointerCurrentView = new MultilevelPointer(memoryAccess, IntPtr.Add(BaseAddress, pointerCurrentView), 0x58L);

                PointerEventActionType = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x38L,
                    0x50L
                    );

                PointerIsMotionPlay = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x38L
                    );

                PointerEventActionTask = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerEventActionTask),
                    0x58L,
                    0x60L,
                    0x40L,
                    0x80L,
                    0x10L,
                    0x10L,
                    0x20L,
                    0x28L
                    );

                PointerPlayerStatus = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L
                    );

                PointerPlayerHP = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x68L,
                    0x48L
                    );

                PointerPlayerPosition = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerPropsManager),
                    0x58L,
                    0x68L,
                    0x68L,
                    0xD0L,
                    0x78L,
                    0x50L
                    );

                PointerRankManager = new MultilevelPointer(
                    memoryAccess,
                    IntPtr.Add(BaseAddress, pointerRankManager)
                    );

                try
                {
                    PointerInventory = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerInventory),
                        0x60L,
                        0x18L,
                        0x10L
                        );

                    //Enemies
                    PointerEnemyEntryList = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerAddressEnemies),
                        0x58L,
                        0x10L
                        );

                    PointerEnemyCount = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerAddressEnemies),
                        0x58L,
                        0x10L
                        );

                    GenerateEnemyEntries();

                    //Items
                    PointerInventoryCount = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerInventory),
                        0x60L,
                        0x18L,
                        0x10L
                        );

                    PointerInventoryEntryList = new MultilevelPointer(
                        memoryAccess,
                        IntPtr.Add(BaseAddress, pointerAddressItems),
                        0x78L,
                        0x70L
                        );

                    GenerateItemEntries();
                }
                catch

                {
                    // May fail in main menu
                }
            }
        }