private void UpdatedPointer(ProgramPointer pointer)
        {
            if (pointer == gameManager)
            {
                int len = gameManager.Read <int>(0x0, 0x68, 0x2c, 0x1c, 0x8);

                Version version = null;

                if (len != 7)
                {
                    string ver = gameManager.Read(0x0, 0x6c, 0x2c, 0x1c);
                    version = new Version(ver);

                    uiManager      = 0x88;
                    inputHandler   = 0x6c;
                    cameraCtrl     = 0x78;
                    gameState      = 0x9c;
                    heroController = 0x7c;
                    camTarget      = 0x24;
                    camMode        = 0x3c;
                    if (version.Build < 3 || version.Revision < 4)
                    {
                        uiState   = 0x128;
                        menuState = 0x12c;
                    }
                    else
                    {
                        uiState   = 0x12c;
                        menuState = 0x130;
                    }
                }
                else
                {
                    string ver = gameManager.Read(0x0, 0x68, 0x2c, 0x1c);
                    version = new Version(ver);

                    uiManager      = 0x84;
                    inputHandler   = 0x68;
                    cameraCtrl     = 0x74;
                    gameState      = 0x98;
                    heroController = 0x78;
                    camTarget      = 0x28;
                    camMode        = 0x40;
                    menuState      = 0x128;
                    uiState        = 0x124;
                }

                HollowKnight.PlayerData.InitializeData(version);
            }
        }
        private void UpdatedPointer(ProgramPointer pointer)
        {
            if (pointer != gameManager)
            {
                return;
            }

            // 1028?

            //GameManager
            playerData     = 0x30;
            uiManager      = 0x84;
            inputHandler   = 0x68;
            cameraCtrl     = 0x74;
            gameState      = 0x98;
            heroController = 0x78;
            debugInfo      = 0x2c;
            tilemapDirty   = 0xcf;

            //CameraController
            camTarget   = 0x28;
            camMode     = 0x40;
            camTeleport = 0x4b;

            //HeroController
            heroAccepting    = 0x457;
            actorState       = 0x374;
            transistionState = 0x37c;
            geoCounter       = 0x1dc;

            int    len = gameManager.Read <int>(Program, 0x0, inputHandler, debugInfo, 0x1c, 0x8);
            string version;

            if (len != 7)
            {
                // before 1221 but after 1118
                inputHandler   = 0x6c;
                uiManager      = 0x88;
                cameraCtrl     = 0x78;
                gameState      = 0x9c;
                heroController = 0x7c;
                camTarget      = 0x24;
                camMode        = 0x3c;
                camTeleport    = 0x47;
                tilemapDirty   = 0xd3;

                len = gameManager.Read <int>(Program, 0x0, inputHandler, debugInfo, 0x1c, 0x8);
                if (len != 7)
                {
                    // 1432/1315
                    playerData     = 0x60;
                    uiManager      = 0x4c;
                    inputHandler   = 0x20;
                    cameraCtrl     = 0x3c;
                    gameState      = 0xb4;
                    heroController = 0x40;
                    tilemapDirty   = 0xef;
                    debugInfo      = 0x30;

                    camMode     = 0x38;
                    camTeleport = 0x43;

                    heroAccepting    = 0x497;
                    actorState       = 0x3b0;
                    transistionState = 0x3b8;
                    geoCounter       = 0x120;

                    uiState   = 0x148;
                    menuState = 0x14c;

                    do
                    {
                        version = gameManager.Read(Program, 0x0, inputHandler, debugInfo, 0x1c);
                        if (string.IsNullOrEmpty(version))
                        {
                            Thread.Sleep(50);
                        }
                    } while (string.IsNullOrEmpty(version) && len-- > 0);

                    lastVersion = new Version(version);

                    if (lastVersion.Minor > 3)
                    {
                        // 1432
                        gameState = 0xb8;

                        heroAccepting    = 0x4b3;
                        actorState       = 0x3cc;
                        transistionState = 0x3d4;

                        uiState   = 0x154;
                        menuState = 0x158;
                    }
                }
                else
                {
                    do
                    {
                        version = gameManager.Read(Program, 0x0, inputHandler, debugInfo, 0x1c);
                        if (string.IsNullOrEmpty(version))
                        {
                            Thread.Sleep(50);
                        }
                    } while (string.IsNullOrEmpty(version) && len-- > 0);

                    lastVersion = new Version(version);
                    geoCounter  = lastVersion.Build > 0 ? 0x1dc : 0x1d4;

                    if (lastVersion.Minor == 0 && (lastVersion.Build < 3 || lastVersion.Revision < 4))
                    {
                        uiState      = 0x128;
                        menuState    = 0x12c;
                        tilemapDirty = 0xcf;
                    }
                    else if (lastVersion.Minor == 0)
                    {
                        // 10??
                        uiState      = 0x12c;
                        menuState    = 0x130;
                        tilemapDirty = 0xcf;
                    }
                    else if (lastVersion.Minor == 1)
                    {
                        // 1118?
                        uiState          = 0x130;
                        menuState        = 0x134;
                        heroAccepting    = 0x45b;
                        actorState       = 0x378;
                        transistionState = 0x380;
                    }
                    else
                    {
                        // 1221
                        uiState          = 0x130;
                        menuState        = 0x134;
                        uiManager        = 0x8c;
                        cameraCtrl       = 0x7c;
                        gameState        = 0xa0;
                        heroController   = 0x80;
                        heroAccepting    = 0x46b;
                        actorState       = 0x388;
                        transistionState = 0x390;
                        geoCounter       = 0x1e4;
                    }
                }
            }
            else
            {
                len = 40;
                do
                {
                    version = gameManager.Read(Program, 0x0, inputHandler, debugInfo, 0x1c);
                    if (string.IsNullOrEmpty(version))
                    {
                        Thread.Sleep(50);
                    }
                } while (string.IsNullOrEmpty(version) && len-- > 0);

                lastVersion = new Version(version);

                // 1006 yes/1118???
                geoCounter = lastVersion.Build > 0 ? 0x1dc : 0x1d4;
                menuState  = 0x128;
                uiState    = 0x124;

                if (lastVersion.Major == 1 &&
                    lastVersion.Minor == 0 &&
                    lastVersion.Build == 0 &&
                    lastVersion.Revision == 6)
                {
                    transistionState = 0x36c;
                    tilemapDirty     = 0xcb;
                }
            }

            HollowKnight.PlayerData.InitializeData(lastVersion);
        }
Exemplo n.º 3
0
        private void UpdatedPointer(ProgramPointer pointer)
        {
            //GameManager
            playerData = 0x30;
            //sceneData = 0x34;
            sceneName          = 0xc;
            nextSceneName      = 0x10;
            uiManager          = 0x84;
            inputHandler       = 0x68;
            cameraCtrl         = 0x74;
            gameState          = 0x98;
            heroController     = 0x78;
            debugInfo          = 0x2c;
            tilemapDirty       = 0xcf;
            achievementHandler = 0x78;

            //AchievementHandler
            //awardAchievementEvent = 0x20;

            //CameraController
            camTarget   = 0x28;
            camMode     = 0x40;
            camTeleport = 0x4b;
            camDest     = 0x24;
            camTMode    = 0x20;

            //HeroController
            cState           = 0x108;
            heroAccepting    = 0x457;
            actorState       = 0x374;
            transistionState = 0x37c;
            hazardRespawning = 0x26;

            int    versionString = 0x1c;
            string version;
            int    len = 12;

            //1568
            if (MemoryReader.is64Bit)
            {
                sceneName          = 0x18;
                nextSceneName      = 0x20;
                inputHandler       = 0x40;
                achievementHandler = 0x50;
                cameraCtrl         = 0x80;
                heroController     = 0x88;
                uiManager          = 0xa0;
                playerData         = 0xc8;
                //sceneData = 0xd0;
                gameState    = 0x174;
                tilemapDirty = 0x1ab;

                //InputHandler
                debugInfo = 0x60;

                //CameraController
                camTarget   = 0x48;
                camMode     = 0x6c;
                camTeleport = 0x77;

                //CameraTarget
                camTMode = 0x3c;
                camDest  = 0x40;

                //HeroController
                cState           = 0x210;
                actorState       = 0x600;
                transistionState = 0x608;
                heroAccepting    = 0x6e7;

                //HeroControllerStates
                hazardRespawning = 0x2e;

                versionString = 0x38;

                do
                {
                    version = gameManager.Read(Program, 0x0, inputHandler, debugInfo, versionString);
                    if (string.IsNullOrEmpty(version))
                    {
                        Thread.Sleep(50);
                    }
                } while (string.IsNullOrEmpty(version) && len-- > 0);

                lastVersion = new Version(version);

                if (lastVersion.Build == 68)
                {
                    //UIManager
                    uiState   = 0x29c;
                    menuState = 0x2a0;
                }
                else
                {
                    //UIManager
                    uiState   = 0x2a4;
                    menuState = 0x2a8;
                }
            }
            else
            {
                len = gameManager.Read <int>(Program, 0x0, inputHandler, debugInfo, versionString, 0x8);

                if (len != 7)
                {
                    // before 1221 but after 1118
                    inputHandler   = 0x6c;
                    uiManager      = 0x88;
                    cameraCtrl     = 0x78;
                    gameState      = 0x9c;
                    heroController = 0x7c;
                    camTarget      = 0x24;
                    camMode        = 0x3c;
                    camTeleport    = 0x47;
                    tilemapDirty   = 0xd3;

                    len = gameManager.Read <int>(Program, 0x0, inputHandler, debugInfo, versionString, 0x8);
                    if (len != 7)
                    {
                        // 1432/1315
                        playerData     = 0x60;
                        uiManager      = 0x4c;
                        inputHandler   = 0x20;
                        cameraCtrl     = 0x3c;
                        gameState      = 0xb4;
                        heroController = 0x40;
                        tilemapDirty   = 0xef;
                        debugInfo      = 0x30;

                        camMode     = 0x38;
                        camTeleport = 0x43;

                        heroAccepting    = 0x497;
                        actorState       = 0x3b0;
                        transistionState = 0x3b8;

                        uiState   = 0x148;
                        menuState = 0x14c;

                        do
                        {
                            version = gameManager.Read(Program, 0x0, inputHandler, debugInfo, versionString);
                            if (string.IsNullOrEmpty(version))
                            {
                                Thread.Sleep(50);
                            }
                        } while (string.IsNullOrEmpty(version) && len-- > 0);

                        lastVersion = new Version(version);

                        if (lastVersion.Minor > 3)
                        {
                            // 1432
                            gameState = 0xb8;

                            heroAccepting    = 0x4b3;
                            actorState       = 0x3cc;
                            transistionState = 0x3d4;

                            uiState   = 0x154;
                            menuState = 0x158;
                        }
                    }
                    else
                    {
                        do
                        {
                            version = gameManager.Read(Program, 0x0, inputHandler, debugInfo, versionString);
                            if (string.IsNullOrEmpty(version))
                            {
                                Thread.Sleep(50);
                            }
                        } while (string.IsNullOrEmpty(version) && len-- > 0);

                        lastVersion = new Version(version);

                        if (lastVersion.Minor == 0 && (lastVersion.Build < 3 || lastVersion.Revision < 4))
                        {
                            uiState      = 0x128;
                            menuState    = 0x12c;
                            tilemapDirty = 0xcf;
                        }
                        else if (lastVersion.Minor == 0)
                        {
                            // 10??
                            uiState      = 0x12c;
                            menuState    = 0x130;
                            tilemapDirty = 0xcf;
                        }
                        else if (lastVersion.Minor == 1)
                        {
                            // 1118?
                            uiState          = 0x130;
                            menuState        = 0x134;
                            heroAccepting    = 0x45b;
                            actorState       = 0x378;
                            transistionState = 0x380;
                        }
                        else
                        {
                            // 1221
                            uiState          = 0x130;
                            menuState        = 0x134;
                            uiManager        = 0x8c;
                            cameraCtrl       = 0x7c;
                            gameState        = 0xa0;
                            heroController   = 0x80;
                            cState           = 0x10C;
                            heroAccepting    = 0x46b;
                            actorState       = 0x388;
                            transistionState = 0x390;
                        }
                    }
                }
                else
                {
                    len = 40;
                    do
                    {
                        version = gameManager.Read(Program, 0x0, inputHandler, debugInfo, versionString);
                        if (string.IsNullOrEmpty(version))
                        {
                            Thread.Sleep(50);
                        }
                    } while (string.IsNullOrEmpty(version) && len-- > 0);

                    lastVersion = new Version(version);

                    // 1006 yes/1118???
                    menuState = 0x128;
                    uiState   = 0x124;

                    if (lastVersion.Major == 1 &&
                        lastVersion.Minor == 0 &&
                        lastVersion.Build == 0 &&
                        lastVersion.Revision == 6)
                    {
                        cState           = 0x104;
                        transistionState = 0x36c;
                        tilemapDirty     = 0xcb;
                    }
                }
            }

            HollowKnight.PlayerData.InitializeData(lastVersion);
        }
        public PointF GetCameraTarget()
        {
            //GameManger._instance.cameraCtrl.camTarget.destination
            float x = gameManager.Read <float>(0x0, cameraCtrl, camTarget, 0x24);
            float y = gameManager.Read <float>(0x0, cameraCtrl, camTarget, 0x28);

            return(new PointF(x, y));
        }