Esempio n. 1
0
 private void ResetTooltip()
 {
     if (_tooltip != null)
     {
         _tooltip.Close();
         _tooltip = null;
     }
 }
Esempio n. 2
0
        private void picPicture_MouseMove(object sender, MouseEventArgs e)
        {
            int cycle    = ((e.X & ~0x01) / (_zoomed ? 2 : 1)) / 2;
            int scanline = ((e.Y & ~0x01) / (_zoomed ? 2 : 1)) / 2;

            EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions();
            DebugEventInfo            evt     = DebugApi.GetEventViewerEvent((UInt16)scanline, (UInt16)cycle, options);

            if (evt.ProgramCounter == 0xFFFFFFFF)
            {
                ResetTooltip();
                UpdateOverlay(e.Location);
                return;
            }

            Dictionary <string, string> values = new Dictionary <string, string>()
            {
                { "Type", ResourceHelper.GetEnumText(evt.Type) },
                { "Scanline", evt.Scanline.ToString() },
                { "Cycle", evt.Cycle.ToString() },
                { "PC", "$" + evt.ProgramCounter.ToString("X6") },
            };

            switch (evt.Type)
            {
            case DebugEventType.Register:
                bool isWrite = evt.Operation.Type == MemoryOperationType.Write || evt.Operation.Type == MemoryOperationType.DmaWrite;
                bool isDma   = evt.Operation.Type == MemoryOperationType.DmaWrite || evt.Operation.Type == MemoryOperationType.DmaRead;
                values["Register"] = "$" + evt.Operation.Address.ToString("X4") + (isWrite ? " (Write)" : " (Read)") + (isDma ? " (DMA)" : "");
                values["Value"]    = "$" + evt.Operation.Value.ToString("X2");
                break;

            case DebugEventType.Breakpoint:
                //TODO

                /*ReadOnlyCollection<Breakpoint> breakpoints = BreakpointManager.Breakpoints;
                 * if(debugEvent.BreakpointId >= 0 && debugEvent.BreakpointId < breakpoints.Count) {
                 *      Breakpoint bp = breakpoints[debugEvent.BreakpointId];
                 *      values["BP Type"] = bp.ToReadableType();
                 *      values["BP Addresses"] = bp.GetAddressString(true);
                 *      if(bp.Condition.Length > 0) {
                 *              values["BP Condition"] = bp.Condition;
                 *      }
                 * }*/
                break;
            }

            double scale = _zoomed ? 2 : 1;

            UpdateOverlay(new Point((int)(evt.Cycle * 2 * scale), (int)(evt.Scanline * 2 * scale)));

            ResetTooltip();
            Form parentForm = this.FindForm();

            _tooltip             = new frmInfoTooltip(parentForm, values, 10);
            _tooltip.FormClosed += (s, ev) => { _tooltip = null; };
            Point location = picViewer.PointToScreen(e.Location);

            location.Offset(10, 10);
            _tooltip.SetFormLocation(location, this);
        }