public Crash4LoadRemoverComponent(LiveSplitState state)
        {
            settings = new Crash4LoadRemoverSettings(state);
            memory   = new CrashMemory();
            memory.Loading.OnValueChange += OnLoadingChange;
            memory.Swirl.OnValueChange   += OnSwirlChange;

            GameName       = state.Run.GameName;
            GameCategory   = state.Run.CategoryName;
            NumberOfSplits = state.Run.Count;
            SplitNames     = new List <string>();

            foreach (var split in state.Run)
            {
                SplitNames.Add(split.Name);
            }

            liveSplitState        = state;
            NumberOfLoadsPerSplit = new List <int>();
            InitNumberOfLoadsFromState();

            settings = new Crash4LoadRemoverSettings(state);
            timer    = new TimerModel {
                CurrentState = state
            };
            timer.CurrentState.OnStart     += timer_OnStart;
            timer.CurrentState.OnReset     += timer_OnReset;
            timer.CurrentState.OnSkipSplit += timer_OnSkipSplit;
            timer.CurrentState.OnSplit     += timer_OnSplit;
            timer.CurrentState.OnUndoSplit += timer_OnUndoSplit;
            timer.CurrentState.OnPause     += timer_OnPause;
            timer.CurrentState.OnResume    += timer_OnResume;

            Logging.Write("[Component] Component created.");
        }
Esempio n. 2
0
        public Crash4LoadRemoverComponent(LiveSplitState state)
        {
            GameName       = state.Run.GameName;
            GameCategory   = state.Run.CategoryName;
            NumberOfSplits = state.Run.Count;
            SplitNames     = new List <string>();

            foreach (var split in state.Run)
            {
                SplitNames.Add(split.Name);
            }

            liveSplitState        = state;
            NumberOfLoadsPerSplit = new List <int>();
            InitNumberOfLoadsFromState();

            settings = new Crash4LoadRemoverSettings(state);

            lastTime         = DateTime.Now;
            segmentTimeStart = DateTime.Now;
            timer            = new TimerModel {
                CurrentState = state
            };
            timer.CurrentState.OnStart     += timer_OnStart;
            timer.CurrentState.OnReset     += timer_OnReset;
            timer.CurrentState.OnSkipSplit += timer_OnSkipSplit;
            timer.CurrentState.OnSplit     += timer_OnSplit;
            timer.CurrentState.OnUndoSplit += timer_OnUndoSplit;
            timer.CurrentState.OnPause     += timer_OnPause;
            timer.CurrentState.OnResume    += timer_OnResume;
            //highResTimer = new HighResolutionTimer.HighResolutionTimer(16.0f);
            //highResTimer.Elapsed += (s, e) => { CaptureLoads(); };

            hsv_ranges_load_1          = new List <FeatureDetector.HSVRange>();
            hsv_ranges_load_2          = new List <FeatureDetector.HSVRange>();
            gradient_thresholds_load_1 = new List <int>();
            gradient_thresholds_load_2 = new List <int>();

            //isLoading = FeatureDetector.compareImageCaptureHSVCrash4(capture, 0.3f, out achieved_threshold, 5, 55, 50, 101, 75, 101);

            //isLoading &= FeatureDetector.compareImageCaptureHSVCrash4(capture, 0.08f, out achieved_threshold_2, -1, 361, 30, 101, -1, 30);
            //FeatureDetector.compareImageCaptureHSVCrash4(capture, 0.3f, out achieved_threshold_1, 200, 230, 80, 101, 50, 101);

            //FeatureDetector.compareImageCaptureHSVCrash4(capture, 0.3f, out achieved_threshold_2, -1, 360, 95, 101, -1, 15);

            hsv_ranges_load_1.Add(new FeatureDetector.HSVRange(15, 55, 70, 101, 75, 101));
            hsv_ranges_load_1.Add(new FeatureDetector.HSVRange(-1, 361, 30, 101, -1, 30));
            gradient_thresholds_load_1.Add(102);
            gradient_thresholds_load_1.Add(10);

            hsv_ranges_load_2.Add(new FeatureDetector.HSVRange(200, 230, 80, 101, 50, 101));
            hsv_ranges_load_2.Add(new FeatureDetector.HSVRange(-1, 360, 60, 101, -1, 35));

            // TODO: determine optimal gradient thresholds
            gradient_thresholds_load_2.Add(80);
            gradient_thresholds_load_2.Add(10);

            test_hsv_ranges      = new List <FeatureDetector.HSVRange>();
            test_gradient_ranges = new List <int>();
            test_hsv_ranges.Add(new FeatureDetector.HSVRange(5, 55, 50, 101, 75, 101));
            test_hsv_ranges.Add(new FeatureDetector.HSVRange(-1, 361, 30, 101, -1, 30));
            test_gradient_ranges.Add(102);
            test_gradient_ranges.Add(10);

            test_hsv_ranges.Add(new FeatureDetector.HSVRange(200, 230, 80, 101, 50, 101));
            test_hsv_ranges.Add(new FeatureDetector.HSVRange(-1, 360, 60, 101, -1, 35));


            achieved_hsv_ranges           = new List <float>();
            achieved_gradient_thresholds  = new List <float>();
            average_thresholded_gradients = new List <float>();

            for (int i = 0; i < test_hsv_ranges.Count; i++)
            {
                achieved_hsv_ranges.Add(0);
            }

            for (int i = 0; i < test_gradient_ranges.Count; i++)
            {
                achieved_gradient_thresholds.Add(0);
                average_thresholded_gradients.Add(0);
            }
        }