Пример #1
0
 public static void ImportFromFile(string path)
 {
     if (File.Exists(path))
     {
         try
         {
             var formatter = new BinaryFormatter();
             var stream    = File.OpenRead(path);
             var cfg       = (NeuralOwlConfig)formatter.Deserialize(stream);
             stream.Close();
             ESP         = cfg.esp;
             Triggerbot  = cfg.triggerbot;
             AimbotBasic = cfg.aimbotBasic;
             Misc        = cfg.misc;
             PlayerList  = cfg.playerList;
             Preferences = cfg.preferences;
             return;
         } catch (Exception ex) { MessageBox.Show("Well, an error occured while reading cfg file: \n" + ex.Message + "\n We'll create a new one..."); }
     }
     //Load Default cfg
     #region ESP
     ESP.ShowEnemies   = true;
     ESP.ShowTeammates = true;
     ESP.FullBloom     = true;
     ESP.EnemyColor    = new Color(.9f, .3f, 0, .25f);
     ESP.TeammateColor = new Color(.2f, .7f, 0, .25f);
     #endregion
     #region Triggerbot
     Triggerbot.Key         = (int)Keys.Alt;
     Triggerbot.WeaponsCfg  = new TriggerbotWeaponConfig[TriggerbotWeaponConfig.TriggerbotWeapons.Length];
     AimbotBasic.Key        = 0;
     AimbotBasic.WeaponsCfg = new AimbotBasicWeaponConfig[TriggerbotWeaponConfig.TriggerbotWeapons.Length];
     for (int i = 0; i < Triggerbot.WeaponsCfg.Length; i++)
     {
         Triggerbot.WeaponsCfg[i]  = new TriggerbotWeaponConfig();
         AimbotBasic.WeaponsCfg[i] = new AimbotBasicWeaponConfig();
     }
     #endregion
     #region Preferences
     //Preferences.ConfigFilePath = Directory.GetParent(Environment.CurrentDirectory) + Const_DefaultPath;
     Preferences.ToggleKey = (int)Keys.Home;
     #endregion
     ExportToFile(path);
 }
Пример #2
0
        public void BindShortcut(ToolStripMenuItem item, EmulatorShortcut shortcut, Func <bool> isActionEnabled = null)
        {
            item.Click += (object sender, EventArgs e) => {
                if (isActionEnabled == null || isActionEnabled())
                {
                    ExecuteShortcut(shortcut);
                }
            };

            _actionEnabledFuncs[shortcut] = isActionEnabled;

            PreferencesConfig cfg = ConfigManager.Config.Preferences;

            if (item.OwnerItem is ToolStripMenuItem)
            {
                Action updateShortcut = () => {
                    int keyIndex = cfg.ShortcutKeys1.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
                    if (keyIndex >= 0)
                    {
                        item.ShortcutKeyDisplayString = cfg.ShortcutKeys1[keyIndex].KeyCombination.ToString();
                    }
                    else
                    {
                        keyIndex = cfg.ShortcutKeys2.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
                        if (keyIndex >= 0)
                        {
                            item.ShortcutKeyDisplayString = cfg.ShortcutKeys2[keyIndex].KeyCombination.ToString();
                        }
                        else
                        {
                            item.ShortcutKeyDisplayString = "";
                        }
                    }
                    item.Enabled = isActionEnabled == null || isActionEnabled();
                };

                updateShortcut();

                //Update item shortcut text when its parent opens
                ((ToolStripMenuItem)item.OwnerItem).DropDownOpening += (object sender, EventArgs e) => { updateShortcut(); };
            }
        }
Пример #3
0
        private static void tmrUpdateBackground_Tick(object sender, EventArgs e)
        {
            Form focusedForm = null;

            foreach (Form form in Application.OpenForms)
            {
                if (form.ContainsFocus)
                {
                    focusedForm = form;
                    break;
                }
            }

            PreferencesConfig cfg = ConfigManager.Config.Preferences;

            bool needPause = focusedForm == null && cfg.PauseWhenInBackground;

            if (focusedForm != null)
            {
                needPause |= cfg.PauseWhenInMenusAndConfig && focusedForm is BaseForm && (((BaseForm)focusedForm).InMenu || ((BaseForm)focusedForm).IsConfigForm);
                needPause |= cfg.PauseWhenInMenusAndConfig && !(focusedForm is BaseInputForm) && !focusedForm.GetType().FullName.Contains("Debugger");
                needPause |= cfg.PauseWhenInDebuggingTools && focusedForm.GetType().FullName.Contains("Debugger");
            }

            if (needPause)
            {
                if (!EmuApi.IsPaused())
                {
                    _needResume = true;
                    EmuApi.Pause();
                }
            }
            else if (_needResume)
            {
                EmuApi.Resume();
                _needResume = false;
            }

            ConfigApi.SetEmulationFlag(EmulationFlags.InBackground, focusedForm == null);
        }
Пример #4
0
        public void InitializeGrid(PreferencesConfig config)
        {
            _config = config;

            EmulatorShortcut[] displayOrder = new EmulatorShortcut[] {
                EmulatorShortcut.FastForward,
                EmulatorShortcut.ToggleFastForward,
                EmulatorShortcut.Rewind,
                EmulatorShortcut.ToggleRewind,
                EmulatorShortcut.RewindTenSecs,
                EmulatorShortcut.RewindOneMin,

                EmulatorShortcut.Pause,
                EmulatorShortcut.Reset,
                EmulatorShortcut.PowerCycle,
                EmulatorShortcut.PowerOff,
                EmulatorShortcut.Exit,

                EmulatorShortcut.TakeScreenshot,
                EmulatorShortcut.RunSingleFrame,

                EmulatorShortcut.SetScale1x,
                EmulatorShortcut.SetScale2x,
                EmulatorShortcut.SetScale3x,
                EmulatorShortcut.SetScale4x,
                EmulatorShortcut.SetScale5x,
                EmulatorShortcut.SetScale6x,
                EmulatorShortcut.ToggleFullscreen,

                EmulatorShortcut.ToggleDebugInfo,
                EmulatorShortcut.ToggleFps,
                EmulatorShortcut.ToggleGameTimer,
                EmulatorShortcut.ToggleFrameCounter,
                EmulatorShortcut.ToggleOsd,
                EmulatorShortcut.ToggleAlwaysOnTop,
                EmulatorShortcut.ToggleAudio,
                EmulatorShortcut.ToggleCheats,

                EmulatorShortcut.ToggleBgLayer0,
                EmulatorShortcut.ToggleBgLayer1,
                EmulatorShortcut.ToggleBgLayer2,
                EmulatorShortcut.ToggleBgLayer3,
                EmulatorShortcut.ToggleSprites,
                EmulatorShortcut.EnableAllLayers,

                EmulatorShortcut.MaxSpeed,
                EmulatorShortcut.IncreaseSpeed,
                EmulatorShortcut.DecreaseSpeed,

                EmulatorShortcut.OpenFile,
                EmulatorShortcut.LoadRandomGame,

                EmulatorShortcut.MoveToNextStateSlot,
                EmulatorShortcut.MoveToPreviousStateSlot,
                EmulatorShortcut.SaveState,
                EmulatorShortcut.LoadState,

                EmulatorShortcut.SaveStateSlot1,
                EmulatorShortcut.SaveStateSlot2,
                EmulatorShortcut.SaveStateSlot3,
                EmulatorShortcut.SaveStateSlot4,
                EmulatorShortcut.SaveStateSlot5,
                EmulatorShortcut.SaveStateSlot6,
                EmulatorShortcut.SaveStateSlot7,
                EmulatorShortcut.SaveStateSlot8,
                EmulatorShortcut.SaveStateSlot9,
                EmulatorShortcut.SaveStateSlot10,
                EmulatorShortcut.SaveStateToFile,

                EmulatorShortcut.LoadStateSlot1,
                EmulatorShortcut.LoadStateSlot2,
                EmulatorShortcut.LoadStateSlot3,
                EmulatorShortcut.LoadStateSlot4,
                EmulatorShortcut.LoadStateSlot5,
                EmulatorShortcut.LoadStateSlot6,
                EmulatorShortcut.LoadStateSlot7,
                EmulatorShortcut.LoadStateSlot8,
                EmulatorShortcut.LoadStateSlot9,
                EmulatorShortcut.LoadStateSlot10,
                EmulatorShortcut.LoadStateFromFile,
            };

            HashSet <string> keyCombinations = new HashSet <string>();

            foreach (EmulatorShortcut shortcut in displayOrder)
            {
                int i = gridShortcuts.Rows.Add();
                gridShortcuts.Rows[i].Cells[0].Tag   = shortcut;
                gridShortcuts.Rows[i].Cells[0].Value = ResourceHelper.GetMessage("EmulatorShortcutMappings_" + shortcut.ToString());

                int keyIndex = config.ShortcutKeys1.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
                if (keyIndex >= 0)
                {
                    KeyCombination keyComb = config.ShortcutKeys1[keyIndex].KeyCombination;
                    keyCombinations.Add(keyComb.ToString());
                    gridShortcuts.Rows[i].Cells[1].Value = keyComb.ToString();
                    gridShortcuts.Rows[i].Cells[1].Tag   = keyComb;
                }

                keyIndex = config.ShortcutKeys2.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
                if (keyIndex >= 0)
                {
                    KeyCombination keyComb = config.ShortcutKeys2[keyIndex].KeyCombination;
                    keyCombinations.Add(keyComb.ToString());
                    gridShortcuts.Rows[i].Cells[2].Value = keyComb.ToString();
                    gridShortcuts.Rows[i].Cells[2].Tag   = keyComb;
                }
            }

            CheckConflicts();
        }