public SplitterComponent()
        {
#endif
            mem = new SplitterMemory();
            foreach (string key in keys)
            {
                currentValues[key] = "";
            }

#if !Info
            if (state != null)
            {
                Model = new TimerModel()
                {
                    CurrentState = state
                };
                Model.InitializeGameTime();
                Model.CurrentState.IsGameTimePaused = true;
                state.OnReset     += OnReset;
                state.OnPause     += OnPause;
                state.OnResume    += OnResume;
                state.OnStart     += OnStart;
                state.OnSplit     += OnSplit;
                state.OnUndoSplit += OnUndoSplit;
                state.OnSkipSplit += OnSkipSplit;
            }
#endif
        }
Ejemplo n.º 2
0
        void state_OnStart(object sender, EventArgs e)
        {
            _prevGameTime = TimeSpan.Zero;

            // assume we're holding pause
            _holdingFirstPause = Settings.HoldUntilPause.Value;

            _cumulativeTime = 0;
            _timer.InitializeGameTime();
            _totalTicks = 0;
            MapTimesForm.Instance.Reset();
            _totalMapTicks = 0;
            _splitOperations.Clear();
            _splitCount = 0;

            _gameMemory._state?.GameSupport?.OnTimerResetFull(true);

            // hack to make sure Portal players aren't using manual offset. we handle offset automatically now.
            // remove this eventually
            if (_timer.CurrentState.TimePausedAt.Seconds == 53 && _timer.CurrentState.TimePausedAt.Milliseconds == 10)
            {
                _timer.CurrentState.TimePausedAt = TimeSpan.Zero;
                _timer.CurrentState.Run.Offset   = TimeSpan.Zero;
            }

            if (_timer.CurrentState.TimePausedAt >= TimeSpan.Zero)
            {
                _sessionTicksOffset = _sessionTicks - (int)(_timer.CurrentState.TimePausedAt.TotalSeconds / _intervalPerTick);
            }
            else
            {
                _waitingForDelay = true;
            }
        }
Ejemplo n.º 3
0
        public HollowKnightComponent(LiveSplitState state)
        {
            mem      = new HollowKnightMemory();
            settings = new HollowKnightSettings();
            foreach (string key in keys)
            {
                currentValues[key] = "";
            }

            if (state != null)
            {
                Model = new TimerModel()
                {
                    CurrentState = state
                };
                Model.InitializeGameTime();
                Model.CurrentState.IsGameTimePaused = true;
                state.OnReset     += OnReset;
                state.OnPause     += OnPause;
                state.OnResume    += OnResume;
                state.OnStart     += OnStart;
                state.OnSplit     += OnSplit;
                state.OnUndoSplit += OnUndoSplit;
                state.OnSkipSplit += OnSkipSplit;
            }
        }
Ejemplo n.º 4
0
        public SplitterComponent(LiveSplitState state)
        {
            mem      = new SplitterMemory();
            settings = new SplitterSettings();

            foreach (LogObject key in Enum.GetValues(typeof(LogObject)))
            {
                currentValues[key] = "";
            }

            if (state != null)
            {
                Model = new TimerModel()
                {
                    CurrentState = state
                };
                Model.InitializeGameTime();
                Model.CurrentState.IsGameTimePaused = true;
                state.OnReset     += OnReset;
                state.OnPause     += OnPause;
                state.OnResume    += OnResume;
                state.OnStart     += OnStart;
                state.OnSplit     += OnSplit;
                state.OnUndoSplit += OnUndoSplit;
                state.OnSkipSplit += OnSkipSplit;
            }

            ContextMenuControls = new Dictionary <string, Action>();
            ContextMenuControls.Add("Add enter split", () => AddLevelSplit(false));
            ContextMenuControls.Add("Add exit split", () => AddLevelSplit(true));
            ContextMenuControls.Add("Auto add enter splits", () => { autoAdding = true; autoAddingExit = false; });
            ContextMenuControls.Add("Auto add exit splits", () => { autoAdding = true; autoAddingExit = true; });
        }
Ejemplo n.º 5
0
        public SplitterComponent(LiveSplitState state)
        {
            mem = new SplitterMemory();
            foreach (string key in keys)
            {
                currentValues[key] = "";
            }

            if (state != null)
            {
                Model = new TimerModel()
                {
                    CurrentState = state
                };
                Model.InitializeGameTime();
                Model.CurrentState.IsGameTimePaused = true;
                state.OnReset     += OnReset;
                state.OnPause     += OnPause;
                state.OnResume    += OnResume;
                state.OnStart     += OnStart;
                state.OnSplit     += OnSplit;
                state.OnUndoSplit += OnUndoSplit;
                state.OnSkipSplit += OnSkipSplit;
            }

            manager        = new DefunctManager();
            manager.Memory = mem;
            manager.Show();
            manager.Visible = false;
        }
Ejemplo n.º 6
0
        void state_OnStart(object sender, EventArgs e)
        {
            _timer.InitializeGameTime();
            _totalTicks = 0;
            _mapsVisited.Clear();
            MapTimesForm.Instance.Reset();
            _splitCount    = 0;
            _totalMapTicks = 0;
            _gamePauseTime = null;

            // hack to make sure Portal players aren't using manual offset. we handle offset automatically now.
            // remove this eventually
            if (_timer.CurrentState.TimePausedAt.Seconds == 53 && _timer.CurrentState.TimePausedAt.Milliseconds == 10)
            {
                _timer.CurrentState.TimePausedAt = TimeSpan.Zero;
                _timer.CurrentState.Run.Offset   = TimeSpan.Zero;
            }

            if (_timer.CurrentState.TimePausedAt >= TimeSpan.Zero)
            {
                _sessionTicksOffset = _sessionTicks - (int)(_timer.CurrentState.TimePausedAt.TotalSeconds / _intervalPerTick);
            }
            else
            {
                _waitingForDelay = true;
            }
        }
        public SplitterComponent(LiveSplitState state)
        {
            mem      = new SplitterMemory();
            settings = new SplitterSettings();
            foreach (LogObject key in Enum.GetValues(typeof(LogObject)))
            {
                currentValues[key] = "";
            }

            if (state != null)
            {
                Model = new TimerModel()
                {
                    CurrentState = state
                };
                Model.InitializeGameTime();
                Model.CurrentState.IsGameTimePaused = true;
                state.OnReset     += OnReset;
                state.OnPause     += OnPause;
                state.OnResume    += OnResume;
                state.OnStart     += OnStart;
                state.OnSplit     += OnSplit;
                state.OnUndoSplit += OnUndoSplit;
                state.OnSkipSplit += OnSkipSplit;
            }
        }
        void timer_OnStart(object sender, EventArgs e)
        {
            InitNumberOfLoadsFromState();
            timer.InitializeGameTime();
            timerStarted = true;

            ReloadLogFile();
        }
Ejemplo n.º 9
0
        // This is executed repeatedly as long as the game is connected and initialized.
        private void DoUpdate(LiveSplitState state)
        {
            OldState = State.RefreshValues(_game);

            if (!(RunMethod(_methods.update, state) ?? true))
            {
                // If Update explicitly returns false, don't run anything else
                return;
            }

            // Call the start segment if the splits are not running, but ensure that the segment is called at least once.
            if (state.CurrentPhase == TimerPhase.NotRunning || !startMethodCalledFromUpdate)
            {
                if (RunMethod(_methods.start, state) ?? false)
                {
                    if (_settings.GetBasicSettingValue("start") && state.CurrentPhase == TimerPhase.NotRunning)
                    {
                        _timer.Start();
                    }
                }
                startMethodCalledFromUpdate = true;
            }

            if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused)
            {
                if (_uses_game_time && !state.IsGameTimeInitialized)
                {
                    _timer.InitializeGameTime();
                }

                var is_paused = RunMethod(_methods.isLoading, state);
                if (is_paused != null)
                {
                    state.IsGameTimePaused = is_paused;
                }

                var game_time = RunMethod(_methods.gameTime, state);
                if (game_time != null)
                {
                    state.SetGameTime(game_time);
                }

                if (RunMethod(_methods.reset, state) ?? false)
                {
                    if (_settings.GetBasicSettingValue("reset"))
                    {
                        _timer.Reset();
                    }
                }
                else if (RunMethod(_methods.split, state) ?? false)
                {
                    if (_settings.GetBasicSettingValue("split"))
                    {
                        _timer.Split();
                    }
                }
            }
        }
Ejemplo n.º 10
0
        // This is executed repeatedly as long as the game is connected and initialized.
        private void DoUpdate(LiveSplit.UI.Components.LiveSplitState state)
        {
            OldState = State.RefreshValues(_game);

            if (!(RunMethod(_methods.update, state) ?? true))
            {
                // If Update explicitly returns false, don't run anything else
                return;
            }

            if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused)
            {
                if (_uses_game_time && !state.IsGameTimeInitialized)
                {
                    _timer.InitializeGameTime();
                }

                var is_paused = RunMethod(_methods.isLoading, state);
                if (is_paused != null)
                {
                    state.IsGameTimePaused = is_paused;
                }

                var game_time = RunMethod(_methods.gameTime, state);
                if (game_time != null)
                {
                    state.SetGameTime(game_time);
                }

                if (RunMethod(_methods.reset, state) ?? false)
                {
                    if (_settings.GetBasicSettingValue("reset"))
                    {
                        _timer.Reset();
                    }
                }
                else if (RunMethod(_methods.split, state) ?? false)
                {
                    if (_settings.GetBasicSettingValue("split"))
                    {
                        _timer.Split();
                    }
                }
            }

            if (state.CurrentPhase == TimerPhase.NotRunning)
            {
                if (RunMethod(_methods.start, state) ?? false)
                {
                    if (_settings.GetBasicSettingValue("start"))
                    {
                        _timer.Start();
                    }
                }
            }
        }
Ejemplo n.º 11
0
 public Component(LiveSplitState state)
 {
     state.OnStart += OnStart;
     model          = new TimerModel()
     {
         CurrentState = state
     };
     model.InitializeGameTime();
     pipeThread = new Thread(PipeThreadFunc);
     pipeThread.Start();
 }
Ejemplo n.º 12
0
 void timer_OnStart(object sender, EventArgs e)
 {
     InitNumberOfLoadsFromState();
     timer.InitializeGameTime();
     runningFrames = 0;
     framesSinceLastManualSplit = 0;
     pausedFrames  = 0;
     timerStarted  = true;
     threadRunning = true;
     //StartCaptureThread();
     //highResTimer.Start();
 }
Ejemplo n.º 13
0
        public virtual void Update(LiveSplitState state)
        {
            emulator.Update(state);

            if (!state.IsGameTimeInitialized)
            {
                timer.CurrentState = state;
                timer.InitializeGameTime();
            }

            state.SetGameTime(GameTime(state));
        }
Ejemplo n.º 14
0
        public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            gameData.Update(state);

            if (state.IsGameTimeInitialized)
            {
                timer.InitializeGameTime();
            }
            if (state.CurrentPhase == TimerPhase.Running)
            {
                state.SetGameTime(gameData.GameTime);
            }
        }
Ejemplo n.º 15
0
        void timer_OnStart(object sender, EventArgs e)
        {
            InitNumberOfLoadsFromState();
            timer.InitializeGameTime();
            runningFrames = 0;
            framesSinceLastManualSplit = 0;
            pausedFrames  = 0;
            timerStarted  = true;
            threadRunning = true;
            first_frame_post_load_transition = false;
            total_paused_time = 0.0f;

            ReloadLogFile();
            //StartCaptureThread();
            //highResTimer.Start();
        }
        public void Update(IInvalidator invalidator, LiveSplitState lvstate, float width, float height, LayoutMode mode)
        {
            if (Model == null)
            {
                Model = new TimerModel()
                {
                    CurrentState = lvstate
                };
                Model.InitializeGameTime();
                Model.CurrentState.IsGameTimePaused = true;
                lvstate.OnReset     += OnReset;
                lvstate.OnPause     += OnPause;
                lvstate.OnResume    += OnResume;
                lvstate.OnStart     += OnStart;
                lvstate.OnSplit     += OnSplit;
                lvstate.OnUndoSplit += OnUndoSplit;
                lvstate.OnSkipSplit += OnSkipSplit;
            }

            GetValues();
        }
Ejemplo n.º 17
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (timer == null)
            {
                timer = new TimerModel
                {
                    CurrentState = state
                };

                timer.CurrentState.OnStart += (sender, e) =>
                {
                    firstLoad = true;

                    if (!startedFromTitle)
                    {
                        startedFromTitle = memory.EnteringGame.Read();
                    }

                    timer.InitializeGameTime();
                };

                timer.CurrentState.OnReset += (sender, value) =>
                {
                    firstLoad        = false;
                    startedFromTitle = false;
                    exitingToTitle   = false;
                    quit             = false;
                };
            }

            Autosplit();

            if (memory.ProcessHooked && settings.DisplayEnabled)
            {
                invalidator?.Invalidate(0, 0, width, height);
            }
        }
Ejemplo n.º 18
0
 private void timer_OnStart(object sender, EventArgs e)
 {
     _timer.InitializeGameTime();
 }
        public virtual void Update(LiveSplitState state, TimerModel timer)
        {
            if (!game.Attach())
            {
                return;
            }
            switch (state.CurrentPhase)
            {
            case TimerPhase.NotRunning:
                if (StartTimer())
                {
                    timer.Start();
                }
                return;

            case TimerPhase.Running:
            case TimerPhase.Paused:
                if (ProvidesGameTime)
                {
                    TimeSpan?igt = GameTime();
                    if (!state.IsGameTimeInitialized)
                    {
                        timer.InitializeGameTime();
                    }
                    state.IsGameTimePaused = true;
                    state.SetGameTime(igt);
                }

                while (true)
                {
                    var cursplit = state.CurrentSplitIndex;
                    if (cursplit <= lastsplit || cursplit >= state.Run.Count)
                    {
                        return;
                    }

                    Match  m         = split_regex.Match(state.Run[cursplit].Name);
                    string splitname = m.Success ? m.Groups[2].Value.Normalize().ToLowerInvariant() : "";
                    if (!splits.ContainsKey(splitname))
                    {
                        timer.SkipSplit();
                    }
                    else if (intsplits[splits[splitname]]())
                    {
                        if (DateTime.UtcNow - lastsplitat < TimeSpan.FromMilliseconds(100))
                        {
                            timer.SkipSplit();
                        }
                        else
                        {
                            timer.Split();
                        }
                    }
                    else
                    {
                        return;
                    }
                    lastsplitat = DateTime.UtcNow;
                    lastsplit   = cursplit;
                }
            }
        }
Ejemplo n.º 20
0
 void State_OnStart(object sender, EventArgs e)
 {
     _gameMemory.Reset();
     _timer.InitializeGameTime();
     BearCartSplit = new Time();
 }
Ejemplo n.º 21
0
 void _state_OnStart(object sender, EventArgs e)
 {
     _timer.InitializeGameTime();
     _splitHistory.Clear();
 }