private IntPtr GetPointer(Process program, string asmName) { if (string.IsNullOrEmpty(asmName)) { Searcher.MemoryFilter = delegate(MemInfo info) { return((info.State & 0x1000) != 0 && (info.Protect & 0x40) != 0 && (info.Protect & 0x100) == 0); }; } else { Tuple <IntPtr, IntPtr> range = ProgramPointer.GetAddressRange(program, asmName); Searcher.MemoryFilter = delegate(MemInfo info) { return((ulong)info.BaseAddress >= (ulong)range.Item1 && (ulong)info.BaseAddress <= (ulong)range.Item2 && (info.State & 0x1000) != 0 && (info.Protect & 0x20) != 0 && (info.Protect & 0x100) == 0); }; } BasePtr = Searcher.FindSignature(program, Signature); if (BasePtr != IntPtr.Zero) { LastVerified = DateTime.Now.AddSeconds(5); int offset = CalculateRelative(program); return(BasePtr + offset); } return(BasePtr); }
public void VerifyPointer(Process program, ref IntPtr pointer) { DateTime now = DateTime.Now; if (now <= LastVerified) { return; } bool isValid = Searcher.VerifySignature(program, BasePtr, Signature); LastVerified = now.AddSeconds(1); if (isValid) { int offset = CalculateRelative(program); IntPtr verify = ProgramPointer.DerefPointer(program, BasePtr + offset, AutoDeref); if (verify != pointer) { pointer = verify; } return; } BasePtr = IntPtr.Zero; pointer = IntPtr.Zero; }
private void UpdatedPointer(ProgramPointer pointer) { if (pointer == gameManager) { if (ProgramPointer.Version == MemVersion.V1026 || ProgramPointer.Version == MemVersion.V1031 || ProgramPointer.Version == MemVersion.V1032) { uiManager = 0x88; inputHandler = 0x6c; cameraCtrl = 0x78; gameState = 0x9c; heroController = 0x7c; camTarget = 0x24; camMode = 0x3c; menuState = 0x12c; uiState = 0x128; } else { uiManager = 0x84; inputHandler = 0x68; cameraCtrl = 0x74; gameState = 0x98; heroController = 0x78; camTarget = 0x28; camMode = 0x40; menuState = 0x128; uiState = 0x124; } } }
public HollowKnightMemory() { lastHooked = DateTime.MinValue; gameManager = new ProgramPointer( new FindPointerSignature(PointerVersion.Normal, AutoDeref.Single, "83C41083EC0C57E8????????83C410EB3D8B05", 19), new FindPointerSignature(PointerVersion.API, AutoDeref.Single, "83C41083EC0C57393FE8????????83C410EB3F8B05", 21)) { UpdatedPointer = UpdatedPointer }; playmakerFSM = new ProgramPointer(new FindPointerSignature(PointerVersion.Normal, AutoDeref.Single, "558BEC5783EC048B7D088B05????????83EC0857503900E8????????83C4108B470C85C074238B470C8BC83909", 12)); }
public HollowKnightMemory() { lastHooked = DateTime.MinValue; gameManager = new ProgramPointer(this, MemPointer.GameManager) { AutoDeref = false, UpdatedPointer = UpdatedPointer }; playmakerFSM = new ProgramPointer(this, MemPointer.PlaymakerFSM) { AutoDeref = false, UpdatedPointer = UpdatedPointer }; }
public HollowKnightMemory() { lastHooked = DateTime.MinValue; gameManager = new ProgramPointer( new FindPointerSignature(PointerVersion.Normal64, AutoDeref.Single, "41FFD3E96300000048B8????????????????488B10488BCE488D6424009049BB", 10), new FindPointerSignature(PointerVersion.Normal64, AutoDeref.Single32, "488BCE49BB????????????????41FFD3E9??000000488B1425", 25), new FindPointerSignature(PointerVersion.Normal, AutoDeref.Single, "83C41083EC0C57E8????????83C410EB3D8B05", 19), new FindPointerSignature(PointerVersion.API, AutoDeref.Single, "83C41083EC0C57393FE8????????83C410EB3F8B05", 21)) { UpdatedPointer = UpdatedPointer }; }
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); } }
public IntPtr FindPointer(Process program, string asmName) { if (string.IsNullOrEmpty(asmName)) { BasePtr = program.MainModule.BaseAddress; } else { Tuple<IntPtr, IntPtr> range = ProgramPointer.GetAddressRange(program, asmName); BasePtr = range.Item1; } if (Offsets.Length > 1) { LastVerified = DateTime.Now.AddSeconds(5); return ProgramPointer.DerefPointer(program, program.Read<IntPtr>(BasePtr, Offsets), AutoDeref); } else { LastVerified = DateTime.MaxValue; BasePtr += Offsets[0]; return ProgramPointer.DerefPointer(program, BasePtr, AutoDeref); } }
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; hazardRespawning = tilemapDirty - 8; //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; hazardRespawning = tilemapDirty - 8; 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; hazardRespawning = tilemapDirty - 8; 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; hazardRespawning = tilemapDirty - 8; } else if (lastVersion.Minor == 0) { // 10?? uiState = 0x12c; menuState = 0x130; tilemapDirty = 0xcf; hazardRespawning = tilemapDirty - 8; } 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; hazardRespawning = tilemapDirty - 8; } } HollowKnight.PlayerData.InitializeData(lastVersion); }
private void UpdatedPointer(ProgramPointer pointer) { if (pointer == gameManager) { int len = gameManager.Read <int>(0x0, 0x68, 0x2c, 0x1c, 0x8); Version version = null; //GameManager uiManager = 0x84; inputHandler = 0x68; cameraCtrl = 0x74; gameState = 0x98; heroController = 0x78; //CameraController camTarget = 0x28; camMode = 0x40; //HeroController heroAccepting = 0x457; actorState = 0x374; transistionState = 0x37c; geoCounter = 0x1dc; 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; geoCounter = version.Build > 0 ? 0x1dc : 0x1d4; if (version.Minor == 0 && (version.Build < 3 || version.Revision < 4)) { uiState = 0x128; menuState = 0x12c; } else if (version.Minor == 0) { uiState = 0x12c; menuState = 0x130; } else if (version.Minor == 1) { uiState = 0x130; menuState = 0x134; heroAccepting = 0x45b; actorState = 0x378; transistionState = 0x380; } else { uiState = 0x130; menuState = 0x134; uiManager = 0x8c; cameraCtrl = 0x7c; gameState = 0xa0; heroController = 0x80; heroAccepting = 0x46b; actorState = 0x388; transistionState = 0x390; geoCounter = 0x1e4; } } else { string ver = gameManager.Read(0x0, 0x68, 0x2c, 0x1c); version = new Version(ver); geoCounter = version.Build > 0 ? 0x1dc : 0x1d4; menuState = 0x128; uiState = 0x124; } HollowKnight.PlayerData.InitializeData(version); } }
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 IntPtr FindPointer(Process program, string asmName) { return ProgramPointer.DerefPointer(program, GetPointer(program, asmName), AutoDeref); }
private void UpdatedPointer(ProgramPointer pointer) { if (pointer == gameManager) { //GameManager playerData = 0x30; uiManager = 0x84; inputHandler = 0x68; cameraCtrl = 0x74; gameState = 0x98; heroController = 0x78; debugInfo = 0x2c; //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 = null; if (len != 7) { inputHandler = 0x6c; uiManager = 0x88; cameraCtrl = 0x78; gameState = 0x9c; heroController = 0x7c; camTarget = 0x24; camMode = 0x3c; camTeleport = 0x47; len = gameManager.Read <int>(Program, 0x0, inputHandler, debugInfo, 0x1c, 0x8); if (len != 7) { playerData = 0x60; uiManager = 0x4c; inputHandler = 0x20; cameraCtrl = 0x3c; gameState = 0xb4; heroController = 0x40; 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) { 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; } else if (lastVersion.Minor == 0) { uiState = 0x12c; menuState = 0x130; } else if (lastVersion.Minor == 1) { uiState = 0x130; menuState = 0x134; heroAccepting = 0x45b; actorState = 0x378; transistionState = 0x380; } else { 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); geoCounter = lastVersion.Build > 0 ? 0x1dc : 0x1d4; menuState = 0x128; uiState = 0x124; } HollowKnight.PlayerData.InitializeData(lastVersion); } }