private void NesNameTableViewer_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.C: if (e.Modifiers == Keys.Control) { NameTableView.ScreenshotToClipboard(); } break; } }
private unsafe void Generate(bool now = false) { if (!IsHandleCreated || IsDisposed) { return; } if (now == false && _emu.Frame % RefreshRate.Value != 0) { return; } var bmpdata = NameTableView.Nametables.LockBits( new Rectangle(0, 0, 512, 480), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); var dptr = (int *)bmpdata.Scan0.ToPointer(); var pitch = bmpdata.Stride / 4; // Buffer all the data from the ppu, because it will be read multiple times and that is slow var ppuBuffer = _ppu.GetPPUBus(); var palram = _ppu.GetPalRam(); if (_ppu.ExActive) { byte[] exram = _ppu.GetExRam(); GenerateExAttr(dptr, pitch, palram, ppuBuffer, exram); } else { GenerateAttr(dptr, pitch, palram, ppuBuffer); } NameTableView.Nametables.UnlockBits(bmpdata); NameTableView.Refresh(); }
private void RefreshImageContextMenuItem_Click(object sender, EventArgs e) { UpdateValues(); NameTableView.Refresh(); }
private void ScreenshotToClipboardMenuItem_Click(object sender, EventArgs e) { NameTableView.ScreenshotToClipboard(); }
private unsafe void Generate(bool now = false) { if (!IsHandleCreated || IsDisposed) { return; } if (_nes == null) { return; } if (now == false && Global.Emulator.Frame % RefreshRate.Value != 0) { return; } var bmpdata = NameTableView.Nametables.LockBits( new Rectangle(0, 0, 512, 480), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); var dptr = (int *)bmpdata.Scan0.ToPointer(); var pitch = bmpdata.Stride / 4; // Buffer all the data from the ppu, because it will be read multiple times and that is slow var ppuBuffer = new byte[0x3000]; for (var i = 0; i < 0x3000; i++) { ppuBuffer[i] = _nes.ppu.ppubus_peek(i); } var palram = new byte[0x20]; for (var i = 0; i < 0x20; i++) { palram[i] = _nes.ppu.PALRAM[i]; } var board = _nes.GetBoard(); if (board is ExROM && (board as ExROM).ExAttrActive) { byte[] exram = new byte[1024]; var md = _nes.MemoryDomains["ExRAM"]; for (int i = 0; i < 1024; i++) { exram[i] = md.PeekByte(i); } GenerateExAttr(dptr, pitch, palram, ppuBuffer, exram); } else { GenerateAttr(dptr, pitch, palram, ppuBuffer); } NameTableView.Nametables.UnlockBits(bmpdata); NameTableView.Refresh(); }