private void HandleKeyDown(string message, int keyCode) { // if (stopKeyInput == true) // return; if (GameInput.Windows2DirectXInputs.ContainsKey(keyCode)) { Keyboard.DirectXKeyStrokes key = GameInput.Windows2DirectXInputs[keyCode]; if (!KeyDownLog.ContainsKey(key) || KeyDownLog[key] <= 0) { KeyDownLog[key] = 1; if (GVCommand.gvSetup.gameName == "FORNITE") { Keyboard.DirectXKeyStrokes okey = GVCommand.KeySwitchPairing(key); if (okey != Keyboard.DirectXKeyStrokes.DIK_NULL) { SimulateKeyUp(okey); } } // System.Console.Beep(); #if DEBUG Console.WriteLine("----- External key down Pressed--------" + key.ToString()); #endif // Keyboard.SendKey(key, Keyboard.KEY_DOWN, Keyboard.InputType.Keyboard); } } }
private void Form1_Load(object sender, EventArgs e) { // GVCommand.InitData(true, GVCommand.TESTDATA_CONFIG_GEN_FORNITE); GVCommand.InitData(false); //GVCommand.LoadGVSetup(); Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs["ESCAPE"]; #if DEBUG // isDebug = true; Console.WriteLine("Debug version"); #endif Hookkeys.handlerKeyDown += HandleKeyDown; Hookkeys.handlerKeyUp += HandleKeyUp; this.TopMost = true; // checkBoxTopmost.Checked = Properties.Settings.Default.TopMost; if (GVCommand.gvSetup == null || GVCommand.gvSetup.gameName == null) { MessageBox.Show("GVC configuration was not loaded....", "Error"); Application.Exit(); Application.ExitThread(); return; //Environment.Exit(); } if (GVCommand.gvSetup.gameName == "FORNITE") { wordLastBuild = GVCommand.ActionToWord["WALL"]; wordLastWeapon = GVCommand.ActionToWord["HARVESTING TOOL"]; } BuildSpeechRecognized(); timerJump.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoJumpSpeed); timerJump.Tick = new EventHandler(TimerJump_Elapsed); timerJump.Stop(); timerBuild.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoBuildSpeed); timerBuild.Tick = new EventHandler(TimerBuild_Elapsed); timerBuild.Stop(); timerDodge.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoDodgeSpeed); timerDodge.Tick = new EventHandler(TimerDodge_Elapsed); timerDodge.Stop(); timerFire.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoFireSpeed); timerFire.Tick = new EventHandler(TimerFire_Elapsed); timerFire.Stop(); timerWindowsChecker.Interval = new TimeSpan(TIMER_MI * 300); timerWindowsChecker.Tick = new EventHandler(CheckActiveWindowd); timerWindowsChecker.Start(); timerWordOkay.Interval = new TimeSpan(TIMER_MI * 100); timerWordOkay.Tick = new EventHandler(TimerWordOkay_Elapsed); timerWordOkay.Stop(); labelAction.BackColor = Color.FromArgb(0, 200, 0); labelAction.Text = ""; }