Beispiel #1
0
        private static void OsuTap(ReplayFrame frame)
        {
            var timer         = Menu.ReadMemory(Menu.TimerAddress, 4);
            var trackPosition = BitConverter.ToInt32(timer, 0);
            var frameX        = GetScaledX(frame.X);
            var frameY        = GetScaledY(frame.Y);
            var frameTime     = frame.Time;

            var frameKey = frame.Keys;

            while (trackPosition < frameTime && Menu.IsRun)
            {
                Thread.Sleep(1);
                timer         = Menu.ReadMemory(Menu.TimerAddress, 4);
                trackPosition = BitConverter.ToInt32(timer, 0);
            }
            Input.Mouse.MoveMouseTo(frameX, frameY);

            if (GetAsyncKeyState(Keys.LControlKey) != 0)
            {
                if (UseMouse)
                {
                    Input.Mouse.LeftButtonUp();
                    Input.Mouse.RightButtonUp();
                }
                Input.Keyboard.KeyUp(OsuLeft);
                Input.Keyboard.KeyUp(OsuRight);
                _replayIndex++;
                return;
            }
            if (UseMouse)
            {
                _mouseSimulator = (frameKey.HasFlag(KeyData.M1) && !frame.Keys.HasFlag(KeyData.K1))
                                      ? Input.Mouse.LeftButtonDown()
                                      : Input.Mouse.LeftButtonUp();
                _mouseSimulator = (frameKey.HasFlag(KeyData.M2) && !frame.Keys.HasFlag(KeyData.K2))
                                      ? Input.Mouse.RightButtonDown()
                                      : Input.Mouse.RightButtonUp();
            }
            _keyboardSimulator = frameKey.HasFlag(KeyData.K1)
                                     ? Input.Keyboard.KeyDown(OsuLeft)
                                     : Input.Keyboard.KeyUp(OsuLeft);
            _keyboardSimulator = frameKey.HasFlag(KeyData.K2)
                                     ? Input.Keyboard.KeyDown(OsuRight)
                                     : Input.Keyboard.KeyUp(OsuRight);
            _replayIndex++;
        }
Beispiel #2
0
        public static void Parse()
        {
            var dialog = new OpenFileDialog
            {
                InitialDirectory = Path.GetPath(),
                Filter = Resources.mouseMoverThread_parse_osr_files____osr____osr,
                FilterIndex = 1,
                RestoreDirectory = true
            };
            if (dialog.ShowDialog() != DialogResult.OK) return;
            var path = dialog.FileName;
            Rep.Clear();
            var originalReplay = new Replay(path, true);
            _mode = originalReplay.GameMode;
            var index = 0;
            while (index < originalReplay.ReplayFrames.Count - 2)
            {
                var thisFrame = originalReplay.ReplayFrames[index];

                if (thisFrame.Time < 0) { index++; continue; } // i don't like negative time :)

                var futureFrame = originalReplay.ReplayFrames[index + 1];
                var frame = new ReplayFrame
                {
                    X = thisFrame.X,
                    Y = thisFrame.Y,
                    Time = thisFrame.Time,
                    Keys = thisFrame.Keys
                };
                Rep.Add(frame);

                //Smooth linear moving
                if (thisFrame.Time > 0 && futureFrame.TimeDiff > 19)
                {
                    var steps = futureFrame.TimeDiff / 10;
                    var xMult = (futureFrame.X - thisFrame.X) / steps;
                    var yMult = (futureFrame.Y - thisFrame.Y) / steps;

                    var startX = thisFrame.X;
                    var startY = thisFrame.Y;
                    var startTime = thisFrame.Time;
                    var startBtn = thisFrame.Keys;
                    for (var i = 0; i < steps; i++)
                    {
                        startX = startX + xMult;
                        startY = startY + yMult;
                        startTime = startTime + 10;
                        var smoothFrame = new ReplayFrame
                        {
                            X = startX,
                            Y = startY,
                            Time = startTime,
                            Keys = startBtn
                        };
                        Rep.Add(smoothFrame);
                    }
                }

                index++;
            }

            var speedFrame = new ReplayFrame
            {
                X = 0,
                Y = 0,
                Keys = KeyData.None,
                Time = 999999999
            };
            for (var i = 0; i < 4; i++) // I'm use it for speed up... Really, it don't good...
            {
                Rep.Add(speedFrame);
            }

            Menu.ReplayParsed = true;
        }
Beispiel #3
0
        private static void OsuTap(ReplayFrame frame)
        {
            var timer = Menu.ReadMemory(Menu.TimerAddress, 4);
            var trackPosition = BitConverter.ToInt32(timer, 0);
            var frameX = GetScaledX(frame.X);
            var frameY = GetScaledY(frame.Y);
            var frameTime = frame.Time;

            var frameKey = frame.Keys;
            while (trackPosition < frameTime && Menu.IsRun)
            {
                Thread.Sleep(1);
                timer = Menu.ReadMemory(Menu.TimerAddress, 4);
                trackPosition = BitConverter.ToInt32(timer, 0);
            }
            Input.Mouse.MoveMouseTo(frameX, frameY);

            if (GetAsyncKeyState(Keys.LControlKey) != 0)
            {
                if (UseMouse)
                {
                    Input.Mouse.LeftButtonUp();
                    Input.Mouse.RightButtonUp();
                }
                Input.Keyboard.KeyUp(OsuLeft);
                Input.Keyboard.KeyUp(OsuRight);
                _replayIndex++;
                return;
            }
            if (UseMouse)
            {
                _mouseSimulator = (frameKey.HasFlag(KeyData.M1) && !frame.Keys.HasFlag(KeyData.K1))
                                      ? Input.Mouse.LeftButtonDown()
                                      : Input.Mouse.LeftButtonUp();
                _mouseSimulator = (frameKey.HasFlag(KeyData.M2) && !frame.Keys.HasFlag(KeyData.K2))
                                      ? Input.Mouse.RightButtonDown()
                                      : Input.Mouse.RightButtonUp();
            }
            _keyboardSimulator = frameKey.HasFlag(KeyData.K1)
                                     ? Input.Keyboard.KeyDown(OsuLeft)
                                     : Input.Keyboard.KeyUp(OsuLeft);
            _keyboardSimulator = frameKey.HasFlag(KeyData.K2)
                                     ? Input.Keyboard.KeyDown(OsuRight)
                                     : Input.Keyboard.KeyUp(OsuRight);
            _replayIndex++;
        }
Beispiel #4
0
        public static void Parse()
        {
            var dialog = new OpenFileDialog
            {
                InitialDirectory = Path.GetPath(),
                Filter           = Resources.mouseMoverThread_parse_osr_files____osr____osr,
                FilterIndex      = 1,
                RestoreDirectory = true
            };

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var path = dialog.FileName;

            Rep.Clear();
            var originalReplay = new Replay(path, true);

            _mode = originalReplay.GameMode;
            var index = 0;

            while (index < originalReplay.ReplayFrames.Count - 2)
            {
                var thisFrame = originalReplay.ReplayFrames[index];

                if (thisFrame.Time < 0)
                {
                    index++; continue;
                }                                              // i don't like negative time :)

                var futureFrame = originalReplay.ReplayFrames[index + 1];
                var frame       = new ReplayFrame
                {
                    X    = thisFrame.X,
                    Y    = thisFrame.Y,
                    Time = thisFrame.Time,
                    Keys = thisFrame.Keys
                };
                Rep.Add(frame);

                //Smooth linear moving
                if (thisFrame.Time > 0 && futureFrame.TimeDiff > 19)
                {
                    var steps = futureFrame.TimeDiff / 10;
                    var xMult = (futureFrame.X - thisFrame.X) / steps;
                    var yMult = (futureFrame.Y - thisFrame.Y) / steps;

                    var startX    = thisFrame.X;
                    var startY    = thisFrame.Y;
                    var startTime = thisFrame.Time;
                    var startBtn  = thisFrame.Keys;
                    for (var i = 0; i < steps; i++)
                    {
                        startX    = startX + xMult;
                        startY    = startY + yMult;
                        startTime = startTime + 10;
                        var smoothFrame = new ReplayFrame
                        {
                            X    = startX,
                            Y    = startY,
                            Time = startTime,
                            Keys = startBtn
                        };
                        Rep.Add(smoothFrame);
                    }
                }

                index++;
            }

            var speedFrame = new ReplayFrame
            {
                X    = 0,
                Y    = 0,
                Keys = KeyData.None,
                Time = 999999999
            };

            for (var i = 0; i < 4; i++) // I'm use it for speed up... Really, it don't good...
            {
                Rep.Add(speedFrame);
            }

            Menu.ReplayParsed = true;
        }