public void RefreshViewer() { EventViewerDisplayOptions options = GetInteropOptions(); _pictureData = InteropEmu.GetEventViewerOutput(_scanlineCount, options); int picHeight = (int)_scanlineCount * 2; if (_screenBitmap == null || _screenBitmap.Height != picHeight) { _screenBitmap = new Bitmap(_baseWidth, picHeight, PixelFormat.Format32bppPArgb); _overlayBitmap = new Bitmap(_baseWidth, picHeight, PixelFormat.Format32bppPArgb); _displayBitmap = new Bitmap(_baseWidth, picHeight, PixelFormat.Format32bppPArgb); } GCHandle handle = GCHandle.Alloc(this._pictureData, GCHandleType.Pinned); try { Bitmap source = new Bitmap(_baseWidth, (int)_scanlineCount * 2, _baseWidth * 4, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject()); using (Graphics g = Graphics.FromImage(_screenBitmap)) { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; g.DrawImageUnscaled(source, 0, 0); } } finally { handle.Free(); } UpdateDisplay(true); }
public void RefreshViewer() { _entityBinder.UpdateObject(); EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions(); _pictureData = DebugApi.GetEventViewerOutput(options); int picHeight = _baseHeight; if (_screenBitmap == null || _screenBitmap.Height != picHeight) { _screenBitmap = new Bitmap(_baseWidth, picHeight); _overlayBitmap = new Bitmap(_baseWidth, picHeight); _displayBitmap = new Bitmap(_baseWidth, picHeight); } GCHandle handle = GCHandle.Alloc(this._pictureData, GCHandleType.Pinned); try { Bitmap source = new Bitmap(_baseWidth, _baseHeight, _baseWidth * 4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject()); using (Graphics g = Graphics.FromImage(_screenBitmap)) { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; g.DrawImageUnscaled(source, 0, 0); } } finally { handle.Free(); } UpdateDisplay(true); }
private DebugEventInfo?GetEventAtPosition(Point location) { Point pos = GetHClockAndScanline(location); EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions(); DebugEventInfo evt = new DebugEventInfo(); DebugApi.GetEventViewerEvent(this.CpuType, ref evt, (UInt16)pos.Y, (UInt16)pos.X, options); if (evt.ProgramCounter == 0xFFFFFFFF) { int[] xOffsets = new int[] { 0, 1, -1, 2, -2, 3 }; int[] yOffsets = new int[] { 0, -1, 1 }; //Check for other events near the current mouse position for (int j = 0; j < yOffsets.Length; j++) { for (int i = 0; i < xOffsets.Length; i++) { DebugApi.GetEventViewerEvent(this.CpuType, ref evt, (UInt16)(pos.Y + yOffsets[j]), (UInt16)(pos.X + xOffsets[i] * _xRatio), options); if (evt.ProgramCounter != 0xFFFFFFFF) { return(evt); } } } return(null); } else { return(evt); } }
public void RefreshData() { this.BeginInvoke((Action)(() => { _entityBinder.UpdateObject(); })); EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions(); DebugApi.TakeEventSnapshot(options); }
public void RefreshViewer() { _breakpoints = BreakpointManager.Breakpoints; EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions(); DebugEventInfo[] eventInfoArray = DebugApi.GetDebugEvents(options); lstEvents.BeginUpdate(); _debugEvents = new List <DebugEventInfo>(eventInfoArray); SortData(); lstEvents.VirtualListSize = _debugEvents.Count; lstEvents.EndUpdate(); }
public void RefreshViewer() { EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions(); _isGameboy = EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy; if (_isGameboy) { _baseWidth = 456 * 2; _xRatio = 0.5; } else { _baseWidth = 1364 / 2; _xRatio = 2; } _pictureData = DebugApi.GetEventViewerOutput(_baseWidth, ScanlineCount, options); int picHeight = (int)ScanlineCount * 2; if (_screenBitmap == null || _screenBitmap.Height != picHeight || _screenBitmap.Width != _baseWidth) { _screenBitmap = new Bitmap(_baseWidth, picHeight, PixelFormat.Format32bppPArgb); _overlayBitmap = new Bitmap(_baseWidth, picHeight, PixelFormat.Format32bppPArgb); _displayBitmap = new Bitmap(_baseWidth, picHeight, PixelFormat.Format32bppPArgb); } GCHandle handle = GCHandle.Alloc(this._pictureData, GCHandleType.Pinned); try { Bitmap source = new Bitmap(_baseWidth, (int)ScanlineCount * 2, _baseWidth * 4, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject()); using (Graphics g = Graphics.FromImage(_screenBitmap)) { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; g.DrawImageUnscaled(source, 0, 0); } } finally { handle.Free(); } UpdateDisplay(true); }
public void RefreshData() { EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions(); ctrlPpuView.ScanlineCount = DebugApi.TakeEventSnapshot(options); }
public void GetData() { EventViewerDisplayOptions options = GetInteropOptions(); _scanlineCount = InteropEmu.TakeEventSnapshot(options); }
private void picViewer_MouseMove(object sender, MouseEventArgs e) { Point pos = GetCycleScanline(e.Location); if (_lastPos == pos) { return; } EventViewerDisplayOptions options = GetInteropOptions(); DebugEventInfo debugEvent = new DebugEventInfo(); InteropEmu.GetEventViewerEvent(ref debugEvent, (Int16)(pos.Y - 1), (UInt16)pos.X, options); if (debugEvent.ProgramCounter == 0xFFFFFFFF) { ResetTooltip(); UpdateOverlay(e.Location); return; } Dictionary <string, string> values = new Dictionary <string, string>() { { "Type", ResourceHelper.GetEnumText(debugEvent.Type) }, { "Scanline", debugEvent.Scanline.ToString() }, { "Cycle", debugEvent.Cycle.ToString() }, { "PC", "$" + debugEvent.ProgramCounter.ToString("X4") }, }; switch (debugEvent.Type) { case DebugEventType.MapperRegisterRead: case DebugEventType.MapperRegisterWrite: case DebugEventType.PpuRegisterRead: case DebugEventType.PpuRegisterWrite: values["Register"] = "$" + debugEvent.Address.ToString("X4"); values["Value"] = "$" + debugEvent.Value.ToString("X2"); if (debugEvent.PpuLatch >= 0) { values["2nd Write"] = debugEvent.PpuLatch == 0 ? "false" : "true"; } break; case DebugEventType.DmcDmaRead: values["Address"] = "$" + debugEvent.Address.ToString("X4"); values["Value"] = "$" + debugEvent.Value.ToString("X2"); break; case DebugEventType.Breakpoint: 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; } ResetTooltip(); UpdateOverlay(new Point((int)(debugEvent.Cycle * 2 * picViewer.ImageScale), (int)((debugEvent.Scanline + 1) * 2 * picViewer.ImageScale))); Form parentForm = this.FindForm(); _tooltip = new frmCodeTooltip(parentForm, values, null, null, null, 10); _tooltip.FormClosed += (s, evt) => { _tooltip = null; }; Point location = Control.MousePosition; location.Offset(10, 10); _tooltip.SetFormLocation(location, this); }
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); }
private void picPicture_MouseMove(object sender, MouseEventArgs e) { Point pos = GetCycleScanline(e.Location); if (_lastPos == pos) { return; } EventViewerDisplayOptions options = ConfigManager.Config.Debug.EventViewer.GetInteropOptions(); DebugEventInfo evt = DebugApi.GetEventViewerEvent((UInt16)pos.Y, (UInt16)pos.X, 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"); if (isDma) { bool indirectHdma = false; values["Channel"] = evt.DmaChannel.ToString(); if (evt.DmaChannelInfo.InterruptedByHdma != 0) { indirectHdma = evt.DmaChannelInfo.HdmaIndirectAddressing != 0; values["Channel"] += indirectHdma ? " (Indirect HDMA)" : " (HDMA)"; values["Line Counter"] = "$" + evt.DmaChannelInfo.HdmaLineCounterAndRepeat.ToString("X2"); } values["Mode"] = evt.DmaChannelInfo.TransferMode.ToString(); int aBusAddress; if (indirectHdma) { aBusAddress = (evt.DmaChannelInfo.SrcBank << 16) | evt.DmaChannelInfo.TransferSize; } else { aBusAddress = (evt.DmaChannelInfo.SrcBank << 16) | evt.DmaChannelInfo.SrcAddress; } if (evt.DmaChannelInfo.InvertDirection == 0) { values["Transfer"] = "$" + aBusAddress.ToString("X4") + " -> $" + evt.DmaChannelInfo.DestAddress.ToString("X2"); } else { values["Transfer"] = "$" + aBusAddress.ToString("X4") + " <- $" + evt.DmaChannelInfo.DestAddress.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; } UpdateOverlay(new Point((int)(evt.Cycle * 2 * this.ImageScale), (int)(evt.Scanline * 2 * this.ImageScale))); Form parentForm = this.FindForm(); Point location = parentForm.PointToClient(this.PointToScreen(new Point(e.Location.X - picViewer.ScrollOffsets.X, e.Location.Y - picViewer.ScrollOffsets.Y))); BaseForm.GetPopupTooltip(parentForm).SetTooltip(location, values); }