public void CloseInstrument() { if (hostProcess) { if (Sharlayan.MemoryHandler.Instance.IsAttached) { if (Sharlayan.Reader.CanGetPerformance()) { if (!Sharlayan.Reader.GetPerformance().IsUp()) { return; } } } } if (!performanceUp) { return; } hook.ClearLastPerformanceKeybinds(); FFXIVKeybindDat.Keybind keybind = hotkeys["ESC"]; Console.WriteLine(keybind.ToString()); if (keybind is FFXIVKeybindDat.Keybind && keybind.GetKey() != Keys.None) { hook.SendSyncKeybind(keybind); performanceUp = false; } }
// OnMidiVoice + OffMidiVoice is called with correct octave shift private void OnMidiVoice(Object o, NoteEvent onNote) { Statistics.AddNoteCount(); if (Properties.Settings.Default.Verbose) { FFXIVKeybindDat.Keybind thiskeybind = FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note); if (thiskeybind == null) { string ns = FFXIVKeybindDat.RawNoteByteToPianoKey(onNote.note); if (!string.IsNullOrEmpty(ns)) { string str = string.Format("Note {0} is out of range, it will not be played.", ns); this.LogMidi(str); } } } if (LocalOrchestra.OrchestraEnabled) { return; } if (Player.Status == PlayerStatus.Conducting) { return; } if (!FFXIV.IsPerformanceReady()) { return; } if (onNote.track != null) { // If from midi file if (onNote.track != Player.Player.LoadedTrack) { return; } } if (Sharlayan.Reader.CanGetChatInput()) { if (FFXIV.memory.ChatInputOpen) { return; } } if (FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note) is FFXIVKeybindDat.Keybind keybind) { if (WantsHold) { FFXIV.hook.SendKeybindDown(keybind); } else { FFXIV.hook.SendAsyncKeybind(keybind); } } }
public void EnsembleAccept() { FFXIVKeybindDat.Keybind keybind = hotkeys["OK"]; if (keybind is FFXIVKeybindDat.Keybind && keybind.GetKey() != Keys.None) { hook.SendSyncKeybind(keybind); hook.SendSyncKeybind(keybind); } }
public bool GetHotkeyForHotbarSlot(int hnum, int snum, int jnum, out FFXIVKeybindDat.Keybind keybind) { string keyMap = hotbar.GetHotbarSlotKeyMap(hnum, snum, jnum); if (!string.IsNullOrEmpty(keyMap)) { keybind = hotkeys[keyMap]; return(true); } keybind = new FFXIVKeybindDat.Keybind(); return(false); }
public bool GetHotkeyForInstrument(Performance.Instrument ins, out FFXIVKeybindDat.Keybind keybind) { string keyMap = hotbar.GetInstrumentKeyMap(ins); if (!string.IsNullOrEmpty(keyMap)) { keybind = hotkeys[keyMap]; return(true); } keybind = new FFXIVKeybindDat.Keybind(); return(false); }
public void OpenInstrument() { // Exert the effort to check memory i guess if (hostProcess) { return; } if (performanceUp) { return; } // don't open instrument if we don't have anything loaded if (sequencer == null || sequencer.Sequence == null) { return; } // don't open instrument if we're not on a valid track if (TrackNum == 0 || TrackNum >= sequencer.Sequence.Count) { return; } string keyMap = hotbar.GetInstrumentKeyMap(chosenInstrument); if (!string.IsNullOrEmpty(keyMap)) { FFXIVKeybindDat.Keybind keybind = hotkeys[keyMap]; if (keybind is FFXIVKeybindDat.Keybind && keybind.GetKey() != Keys.None) { hook.SendTimedSyncKeybind(keybind); openDelay = true; Timer openTimer = new Timer { Interval = 1000 }; openTimer.Elapsed += delegate(object o, ElapsedEventArgs e) { openTimer.Stop(); openTimer = null; openDelay = false; }; openTimer.Start(); performanceUp = true; } } }
public void OpenInstrument() { // Exert the effort to check memory i guess if (hostProcess) { if (Sharlayan.MemoryHandler.Instance.IsAttached) { if (Sharlayan.Reader.CanGetPerformance()) { if (Sharlayan.Reader.GetPerformance().IsUp()) { return; } } } } if (performanceUp) { return; } string keyMap = hotbar.GetInstrumentKeyMap(chosenInstrument); if (!string.IsNullOrEmpty(keyMap)) { FFXIVKeybindDat.Keybind keybind = hotkeys[keyMap]; if (keybind is FFXIVKeybindDat.Keybind && keybind.GetKey() != Keys.None) { hook.SendSyncKeybind(keybind); openDelay = true; Timer openTimer = new Timer { Interval = 1000 }; openTimer.Elapsed += delegate(object o, ElapsedEventArgs e) { openTimer.Stop(); openTimer = null; openDelay = false; }; openTimer.Start(); performanceUp = true; } } }
public void CloseInstrument() { if (hostProcess) { return; } if (!performanceUp) { return; } hook.ClearLastPerformanceKeybinds(); FFXIVKeybindDat.Keybind keybind = hotkeys["ESC"]; Console.WriteLine(keybind.ToString()); if (keybind is FFXIVKeybindDat.Keybind && keybind.GetKey() != Keys.None) { hook.SendSyncKeybind(keybind); performanceUp = false; } }
public void SendChatString(string text) { if (true) { Stopwatch watch = new Stopwatch(); FFXIVKeybindDat.Keybind chatKeybind = hotkeys["CMD_CHAT"]; hook.FocusWindow(); // Now that our window is focused, we may use SendInput as much as we want List <FFXIVHook.KEYBDINPUT> keyInputs = new List <FFXIVHook.KEYBDINPUT>(); if (IsPerformanceReady()) { // First reset the keyboard then focus chat input keyInputs.Clear(); foreach (FFXIVKeybindDat.Keybind keybind in hotkeys.GetPerformanceKeybinds()) { keyInputs.Add(new FFXIVHook.KEYBDINPUT { wVk = (ushort)keybind.GetKey(), dwFlags = 0x0002, }); } hook.SendKeyInput(keyInputs); } if (Reader.CanGetChatInput() && !memory.ChatInputOpen) { while (!memory.ChatInputOpen) { if (chatKeybind is FFXIVKeybindDat.Keybind) { hook.SendSyncKeybind(chatKeybind); System.Threading.Thread.Sleep(100); } } } if (Reader.CanGetChatInput() && !string.IsNullOrEmpty(memory.ChatInputString)) { hook.SendSyncKey(Keys.A | Keys.Control); watch.Start(); while (!string.IsNullOrEmpty(memory.ChatInputString)) { hook.SendSyncKey(Keys.Back); if (watch.ElapsedMilliseconds > 500) { break; } System.Threading.Thread.Sleep(1); } watch.Stop(); } hook.SendString(text); bool entered = false; if (Reader.CanGetChatInput()) { watch.Start(); while (!memory.ChatInputString.Equals(text)) { // ... if (watch.ElapsedMilliseconds > 100) { break; } System.Threading.Thread.Sleep(1); } entered = memory.ChatInputString.Equals(text); } hook.SendSyncKey(Keys.Enter); } }
// OnMidiVoice + OffMidiVoice is called with correct octave shift private void OnMidiVoice(Object o, NoteEvent onNote) { Statistics.AddNoteCount(); if (Properties.Settings.Default.Verbose) { FFXIVKeybindDat.Keybind keybind = FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note); if (keybind == null) { string ns = FFXIVKeybindDat.RawNoteByteToPianoKey(onNote.note); if (!string.IsNullOrEmpty(ns)) { string str = string.Format("Note {0} is out of range, it will not be played.", ns); ChatLogAll.AppendRtf(BmpChatParser.FormatRtf(str, "\\red255\\green200\\blue200")); } } } if (LocalOrchestra.OrchestraEnabled) { LocalOrchestra.ProcessOnNote(onNote); return; } if (Player.Status == PlayerStatus.Conducting) { return; } if (!Player.Player.IsPlaying) { return; } if (!FFXIV.IsPerformanceReady()) { return; } if (onNote.track != null) { // If from midi file if (onNote.track != Player.Player.LoadedTrack) { return; } } if (!FFXIV.memory.ChatInputOpen) { if (WantsSlow) { if (FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note) is FFXIVKeybindDat.Keybind keybind) { int delay = Decimal.ToInt32(Properties.Settings.Default.PlayHold); // Slow play Player.Player.InternalClock.Stop(); FFXIV.hook.SendSyncKey(keybind.GetKey(), true, true, false); //Bmp.Player.InternalClock.Sleep(delay); Thread.Sleep(delay); FFXIV.hook.SendSyncKey(keybind.GetKey(), true, false, true); Player.Player.InternalClock.Continue(); return; } } if (Properties.Settings.Default.AutoArpeggiate) { if (chordNotes.OnKey(onNote)) { // Chord detected and queued Console.WriteLine("Delay " + onNote + " by 100ms"); } } if (!chordNotes.HasTimer(onNote)) { if (FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note) is FFXIVKeybindDat.Keybind keybind) { if (WantsHold) { FFXIV.hook.SendKeybindDown(keybind); } else { FFXIV.hook.SendAsyncKeybind(keybind); } } } } }