Esempio n. 1
0
        public HotkeyControl(CrashMemory memory, DataControl data)
        {
            this.memory = memory;
            this.data   = data;

            hotkeys = new []
            {
                new Hotkey("Set zero lives: ", KeyModifiers.Alt, (uint)Keys.D, () =>
                {
                    memory.Lives.Write(0);
                    data.Lives = 0;
                })
            };

            InitializeComponent();
            RegisterHotkeys();

            labels = new []
            {
                zeroLivesLabel,
                zeroLivesHotkeyLabel
            };

            zeroLivesHotkeyLabel.Text      = hotkeys[0].ToString();
            zeroLivesHotkeyLabel.ForeColor = Color.ForestGreen;
        }
        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. 3
0
        public ProcessControl(CrashMemory memory, DataControl data, HotkeyControl hotkeys, HelperForm parent)
        {
            this.memory  = memory;
            this.data    = data;
            this.hotkeys = hotkeys;
            this.parent  = parent;

            InitializeComponent();

            processTimer          = new Timer();
            processTimer.Interval = 1000;
            processTimer.Tick    += (sender, e) =>
            {
                retryTimeRemaining--;

                if (retryTimeRemaining == 0)
                {
                    Rescan();
                }
                else
                {
                    processLabel.Text = $"Process {filler}. Retrying in {retryTimeRemaining}...";
                }
            };

            filler = "not found";
        }
Esempio n. 4
0
        public DataControl(CrashMemory memory)
        {
            this.memory = memory;

            memory.Lives.OnValueChange += OnLivesChange;
            memory.Masks.OnValueChange += OnMasksChange;

            InitializeComponent();
        }
Esempio n. 5
0
        public HelperForm()
        {
            InitializeComponent();

            memory         = new CrashMemory();
            dataControl    = new DataControl(memory);
            hotkeyControl  = new HotkeyControl(memory, dataControl);
            processControl = new ProcessControl(memory, dataControl, hotkeyControl, this);

            flowLayoutPanel.Controls.Add(processControl);
            flowLayoutPanel.Controls.Add(dataControl);
            flowLayoutPanel.Controls.Add(hotkeyControl);
            flowLayoutPanel.Height--;

            refreshTimer = new Timer
            {
                Interval = (int)(1000f / Framerate),
            };

            refreshTimer.Tick += (sender, e) => { RefreshHelper(); };
            processControl.Rescan();
        }
        public CrashComponent()
        {
            settings = new CrashControl();
            memory   = new CrashMemory();
            memory.Fade.OnValueChange  += OnFadeChange;
            memory.Stage.OnValueChange += OnStageChange;
            memory.Boxes.OnValueChange += (oldBoxes, newBoxes) =>
            {
                if (settings.DisplayBoxes)
                {
                    boxDisplay.BoxCount = newBoxes;
                }
            };

            hubSet = new HashSet <Stages>
            {
                Stages.TheWumpaIslands,
                Stages.NSanityIsland,
                Stages.CortexIsland,
                Stages.TheWarpRoom,
                Stages.TheTimeTwister
            };

            StageData[] crash1Data = LoadStageData("Crash1.xml");
            StageData[] crash2Data = LoadStageData("Crash2.xml");
            StageData[] crash3Data = LoadStageData("Crash3.xml");

            stageArray = new StageData[Enum.GetValues(typeof(Stages)).Length];

            for (int i = 0; i < crash1Data.Length; i++)
            {
                stageArray[i + (int)Stages.NSanityBeach] = crash1Data[i];
            }

            for (int i = 0; i < crash2Data.Length; i++)
            {
                stageArray[i + (int)Stages.TurtleWoods] = crash2Data[i];
            }

            for (int i = 0; i < crash3Data.Length; i++)
            {
                stageArray[i + (int)Stages.ToadVillage] = crash3Data[i];
            }

            stageMap = new Dictionary <string, Stages>
            {
                // Crash 1
                { "N. SANITY BEACH", Stages.NSanityBeach },
                { "JUNGLE ROLLERS", Stages.JungleRollers },
                { "THE GREAT GATE", Stages.TheGreatGate },
                { "BOULDERS", Stages.Boulders },
                { "UPSTREAM", Stages.Upstream },
                { "ROLLING STONES", Stages.RollingStones },
                { "HOG WILD", Stages.HogWild },
                { "NATIVE FORTRESS", Stages.NativeFortress },
                { "UP THE CREEK", Stages.UpTheCreek },
                { "THE LOST CITY", Stages.TheLostCity },
                { "TEMPLE RUINS", Stages.TempleRuins },
                { "ROAD TO NOWHERE", Stages.RoadToNowhere },
                { "BOULDER DASH", Stages.BoulderDash },
                { "WHOLE HOG", Stages.WholeHog },
                { "SUNSET VISTA", Stages.SunsetVista },
                { "HEAVY MACHINERY", Stages.HeavyMachinery },
                { "CORTEX POWER", Stages.CortexPower },
                { "GENERATOR ROOM", Stages.GeneratorRoom },
                { "TOXIC WASTE", Stages.ToxicWaste },
                { "THE HIGH ROAD", Stages.TheHighRoad },
                { "SLIPPERY CLIMB", Stages.SlipperyClimb },
                { "LIGHTS OUT", Stages.LightsOut },
                { "FUMBLING IN THE DARK", Stages.FumblingInTheDark },
                { "JAWS OF DARKNESS", Stages.JawsOfDarkness },
                { "CASTLE MACHINERY", Stages.CastleMachinery },
                { "THE LAB", Stages.TheLab },
                { "THE GREAT HALL", Stages.TheGreatHall },
                { "STORMY ASCENT", Stages.StormyAscent },
                { "PAPU PAPU", Stages.PapuPapu },
                { "KOALA KONG", Stages.KoalaKong },
                { "PINSTRIPE POTOROO", Stages.PinstripePotoroo },
                { "DR. NITRUS BRIO", Stages.DrNitrusBrio },

                // Crash 2
                { "TURTLE WOODS", Stages.TurtleWoods },
                { "SNOW GO", Stages.SnowGo },
                { "HANG EIGHT", Stages.HangEight },
                { "THE PITS", Stages.ThePits },
                { "CRASH DASH", Stages.CrashDash },
                { "AIR CRASH", Stages.AirCrash },
                { "SNOW BIZ", Stages.SnowBiz },
                { "BEAR IT", Stages.BearIt },
                { "CRASH CRUSH", Stages.CrashCrush },
                { "THE EEL DEAL", Stages.TheEelDeal },
                { "PLANT FOOD", Stages.PlantFood },
                { "SEWER OR LATER", Stages.SewerOrLater },
                { "BEAR DOWN", Stages.BearDown },
                { "ROAD TO RUIN", Stages.RoadToRuin },
                { "UN-BEARABLE", Stages.UnBearable },
                { "HANGIN' OUT", Stages.HanginOut },
                { "DIGGIN' IT", Stages.DigginIt },
                { "COLD HARD CRASH", Stages.ColdHardCrash },
                { "RUINATION", Stages.Ruination },
                { "BEE-HAVING", Stages.BeeHaving },
                { "PISTON IT AWAY", Stages.PistonItAway },
                { "ROCK IT", Stages.RockIt },
                { "NIGHT FIGHT", Stages.NightFight },
                { "PACK ATTACK", Stages.PackAttack },
                { "SPACED OUT", Stages.SpacedOut },
                { "TOTALLY BEAR", Stages.TotallyBear },
                { "TOTALLY FLY", Stages.TotallyFly },
                { "KOMODO BROTHERS", Stages.KomodoBrothers },

                // Crash 3
                { "TOAD VILLAGE", Stages.ToadVillage },
                { "UNDER PRESSURE", Stages.UnderPressure },
                { "ORIENT EXPRESS", Stages.OrientExpress },
                { "BONE YARD", Stages.BoneYard },
                { "MAKIN' WAVES", Stages.MakinWaves },
                { "GEE WIZ", Stages.GeeWiz },
                { "HANG'EM HIGH", Stages.HangEmHigh },
                { "HOG RIDE", Stages.HogRide },
                { "TOMB TIME", Stages.TombTime },
                { "MIDNIGHT RUN", Stages.MidnightRun },
                { "DINO MIGHT!", Stages.DinoMight },
                { "DEEP TROUBLE", Stages.DeepTrouble },
                { "HIGH TIME", Stages.HighTime },
                { "ROAD CRASH", Stages.RoadCrash },
                { "DOUBLE HEADER", Stages.DoubleHeader },
                { "SPHYNXINATOR", Stages.Sphynxinator },
                { "BYE BYE BLIMPS", Stages.ByeByeBlimps },
                { "TELL NO TALES", Stages.TellNoTales },
                { "FUTURE FRENZY", Stages.FutureFrenzy },
                { "TOMB WADER", Stages.TombWader },
                { "GONE TOMORROW", Stages.GoneTomorrow },
                { "ORANGE ASPHALT", Stages.OrangeAsphalt },
                { "FLAMING PASSION", Stages.FlamingPassion },
                { "MAD BOMBERS", Stages.MadBombers },
                { "BUG LITE", Stages.BugLite },
                { "SKI CRAZED", Stages.SkiCrazed },
                { "AREA 51?", Stages.Area51 },
                { "RINGS OF POWER", Stages.RingsOfPower },
                { "HOT COCO", Stages.HotCoco },
                { "EGGIPUS REX", Stages.EggipusRex },
                { "DINGODILE", Stages.Dingodile },
                { "DR. N. TROPY", Stages.DrNTropy },
                { "FUTURE TENSE", Stages.FutureTense },

                // Repeated bosses
                { "RIPPER ROO", Stages.RipperRoo },
                { "TINY TIGER", Stages.TinyTiger },
                { "DR. N. GIN", Stages.DrNGin },
                { "DR. NEO CORTEX", Stages.DrNeoCortex },

                // Hubs
                { "N. SANITY ISLANDS", Stages.NSanityIsland },
                { "THE WUMPA ISLANDS", Stages.TheWumpaIslands },
                { "CORTEX ISLANDS", Stages.CortexIsland },
                { "THE WARP ROOM", Stages.TheWarpRoom },
                { "THE TIME TWISTER", Stages.TheTimeTwister }
            };

            Logging.Write("[Component] Component created.");
        }