コード例 #1
0
ファイル: Ball.cs プロジェクト: n8bits/RocketPal
        public static Ball GetBall(List <int> ignoredAddresses = null, MemoryScanInfoPanel infoPanel = null)
        {
            var locations = MemoryScanner.FindSignatureInMemory(Ball.signature, false, ignoredAddresses, infoPanel);

            if (!locations.Any())
            {
                return(null);
            }
            var ball = new Ball(locations);

            //ball.UseNextAddress();
            return(ball);
        }
コード例 #2
0
        public static GameClock GetClock(MemoryScanInfoPanel infoPanel = null)
        {
            var foundAddresses = MemoryScanner.FindSignatureInMemory(GameClock.signature, false, null, infoPanel);

            if (foundAddresses.Any())
            {
                return(new GameClock(foundAddresses));
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
ファイル: Car.cs プロジェクト: n8bits/RocketPal
        public static Car GetCar(List <int> ignoredAddresses = null, MemoryScanInfoPanel infoPanel = null)
        {
            var results = MemoryScanner.FindSignatureInMemory(Car.signature, false, ignoredAddresses, infoPanel);

            //foreach (var result in results)
            //{
            //    var bytes = MemoryEdits.ReadMemory(result, (6*4));
            //    var a1 = Math.Abs(MemoryEdits.ReadFloat(result));
            //    var b1 = Math.Abs(MemoryEdits.ReadFloat(result + 4));
            //    var a2 = Math.Abs(MemoryEdits.ReadFloat(result + 20));
            //    var b2 = Math.Abs(MemoryEdits.ReadFloat(result + 16));
            //    if (Math.Abs(a1 - a2) > .001f && Math.Abs(b1 - b2) > .1f)
            //    {
            //        results = results.Where(x => x != result).ToList();
            //    }
            //}
            if (results.Any() != true)
            {
                return(null);
            }
            return(new Car(results));
        }
コード例 #4
0
        public static List <int> FindSignatureInMemory(MemorySignature signature, bool findAll = false, List <int> ignoredAddresses = null, MemoryScanInfoPanel panel = null)
        {
            List <int> addresses = new List <int>();
            var        regions   = MemoryEdits.DoMemoryThing();

            var smallRegions = regions.Where(x => x.Value == 65536).ToList();

            smallRegions.Reverse();
            smallRegions.Sort(delegate(KeyValuePair <int, int> x, KeyValuePair <int, int> y)
            {
                return(x.Key > y.Key ? -1 : 1);
            });

            Process process   = Process.GetProcessesByName("rocketleague")[0];
            IntPtr  hProcess1 = MemoryEdits.OpenProcess(16, false, process.Id);


            var totalBytes = 0;

            foreach (var keyValuePair in smallRegions)
            {
                totalBytes += keyValuePair.Value;
            }

            for (int j = 0; j < smallRegions.Count; j++)
            {
                if (panel != null)
                {
                    panel.SetCurrentBlock(j, smallRegions.Count());
                }

                if (j == smallRegions.Count - 1)
                {
                    var x = 2;
                }
                var region      = smallRegions[j];
                var baseAddress = region.Key;
                var size        = region.Value;

                if (baseAddress < 0x3FA61E6D && baseAddress + size > 0x3FA61E6D)
                {
                    //var index = regions.ToList().IndexOf(region);
                    //var z = regions.Where(x => x.Value != size).Select(x => x.Value).ToList();
                    //string s = "";
                    //var buffer1 = MemoryEdits.ReadMemory(region.Key, region.Value);
                    //foreach (var b in buffer1)
                    //{
                    //    s += b;
                    //    if (b < 10)
                    //    {
                    //        s += " ";
                    //    }
                    //    if (b < 100)
                    //    {
                    //        s += " ";
                    //    }
                    //    s += " ";
                    var x = 3;
                    //}
                    //Clipboard.SetText(s);
                }
                else
                {
                    // continue;
                }

                var buffer = MemoryEdits.ReadMemory(hProcess1, region.Key, region.Value);
                //continue;
                for (int i = 0; i < buffer.Length; i += 4)
                {
                    var thisFloat = BitConverter.ToSingle(buffer, i);

                    if (signature.SearchKey.Contains(thisFloat))
                    {
                        if (signature.MatchAtKeyAddress(baseAddress + i))
                        {
                            if (ignoredAddresses == null || !ignoredAddresses.Contains(baseAddress + i))
                            {
                                addresses.Add((baseAddress + i) - (signature.SearchKeyIndex * 4));
                            }
                        }
                    }
                    if (addresses.Count() >= 1 || (addresses.Count >= 1 && signature.Length < 20))
                    {
                        if (!findAll)
                        {
                            return(addresses);
                        }
                    }
                }
            }

            MemoryEdits.CloseHandle(hProcess1);

            return(addresses);
        }