private void UpdateRefreshSpeedMenu() { HexEditorInfo config = ConfigManager.Config.Debug.HexEditor; mnuAutoRefreshLow.Checked = config.AutoRefreshSpeed == RefreshSpeed.Low; mnuAutoRefreshNormal.Checked = config.AutoRefreshSpeed == RefreshSpeed.Normal; mnuAutoRefreshHigh.Checked = config.AutoRefreshSpeed == RefreshSpeed.High; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); HexEditorInfo config = ConfigManager.Config.Debug.HexEditor; _entityBinder.Entity = config; _entityBinder.AddBinding(nameof(config.AutoRefresh), mnuAutoRefresh); _entityBinder.AddBinding(nameof(config.HighDensityTextMode), mnuHighDensityMode); _entityBinder.AddBinding(nameof(config.ByteEditingMode), mnuByteEditingMode); _entityBinder.AddBinding(nameof(config.EnablePerByteNavigation), mnuEnablePerByteNavigation); _entityBinder.AddBinding(nameof(config.IgnoreRedundantWrites), mnuIgnoreRedundantWrites); _entityBinder.AddBinding(nameof(config.HighlightCurrentRowColumn), mnuHighlightCurrentRowColumn); _entityBinder.AddBinding(nameof(config.ShowCharacters), mnuShowCharacters); _entityBinder.AddBinding(nameof(config.ShowLabelInfo), mnuShowLabelInfoOnMouseOver); _entityBinder.AddBinding(nameof(config.HighlightExecution), mnuHighlightExecution); _entityBinder.AddBinding(nameof(config.HighlightReads), mnuHightlightReads); _entityBinder.AddBinding(nameof(config.HighlightWrites), mnuHighlightWrites); _entityBinder.AddBinding(nameof(config.HideUnusedBytes), mnuHideUnusedBytes); _entityBinder.AddBinding(nameof(config.HideReadBytes), mnuHideReadBytes); _entityBinder.AddBinding(nameof(config.HideWrittenBytes), mnuHideWrittenBytes); _entityBinder.AddBinding(nameof(config.HideExecutedBytes), mnuHideExecutedBytes); _entityBinder.AddBinding(nameof(config.HighlightLabelledBytes), mnuHighlightLabelledBytes); _entityBinder.AddBinding(nameof(config.HighlightBreakpoints), mnuHighlightBreakpoints); _entityBinder.AddBinding(nameof(config.HighlightCodeBytes), mnuHighlightCodeBytes); _entityBinder.AddBinding(nameof(config.HighlightDataBytes), mnuHighlightDataBytes); _entityBinder.UpdateUI(); UpdateRefreshSpeedMenu(); UpdateFlags(); this.ctrlHexViewer.HighlightCurrentRowColumn = config.HighlightCurrentRowColumn; this.ctrlHexViewer.TextZoom = config.TextZoom; this.ctrlHexViewer.BaseFont = new Font(config.FontFamily, config.FontSize, config.FontStyle); this.UpdateFadeOptions(); this.InitTblMappings(); this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked; UpdateImportButton(); InitMemoryTypeDropdown(true); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; this.mnuShowCharacters.CheckedChanged += this.mnuShowCharacters_CheckedChanged; this.mnuIgnoreRedundantWrites.CheckedChanged += mnuIgnoreRedundantWrites_CheckedChanged; RestoreLocation(config.WindowLocation, config.WindowSize); this.InitShortcuts(); }
private void mnuAutoRefreshSpeed_Click(object sender, EventArgs e) { HexEditorInfo config = ConfigManager.Config.Debug.HexEditor; if (sender == mnuAutoRefreshLow) { config.AutoRefreshSpeed = RefreshSpeed.Low; } else if (sender == mnuAutoRefreshNormal) { config.AutoRefreshSpeed = RefreshSpeed.Normal; } else if (sender == mnuAutoRefreshHigh) { config.AutoRefreshSpeed = RefreshSpeed.High; } ConfigManager.ApplyChanges(); UpdateRefreshSpeedMenu(); }
private void mnuFadeSpeed_Click(object sender, EventArgs e) { HexEditorInfo config = ConfigManager.Config.Debug.HexEditor; if (sender == mnuFadeSlow) { config.FadeSpeed = 600; } else if (sender == mnuFadeNormal) { config.FadeSpeed = 300; } else if (sender == mnuFadeFast) { config.FadeSpeed = 120; } else if (sender == mnuFadeNever) { config.FadeSpeed = 0; } ConfigManager.ApplyChanges(); UpdateFadeOptions(); }
protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); HexEditorInfo config = ConfigManager.Config.Debug.HexEditor; config.TextZoom = this.ctrlHexViewer.TextZoom; config.FontFamily = ctrlHexViewer.BaseFont.FontFamily.Name; config.FontStyle = ctrlHexViewer.BaseFont.Style; config.FontSize = ctrlHexViewer.BaseFont.Size; config.WindowSize = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size; config.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location; config.MemoryType = cboMemoryType.GetEnumValue <SnesMemoryType>(); _entityBinder.UpdateObject(); ConfigManager.ApplyChanges(); if (this._notifListener != null) { this._notifListener.Dispose(); this._notifListener = null; } _formClosed = true; }
public ByteColors GetByteColor(long firstByteIndex, long byteIndex) { HexEditorInfo cfg = ConfigManager.Config.Debug.HexEditor; const int CyclesPerFrame = 357368; long index = byteIndex - firstByteIndex; double framesSinceExec = (double)(_state.MasterClock - _counters[index].ExecStamp) / CyclesPerFrame; double framesSinceWrite = (double)(_state.MasterClock - _counters[index].WriteStamp) / CyclesPerFrame; double framesSinceRead = (double)(_state.MasterClock - _counters[index].ReadStamp) / CyclesPerFrame; bool isRead = _counters[index].ReadCount > 0; bool isWritten = _counters[index].WriteCount > 0; bool isExecuted = _counters[index].ExecCount > 0; bool isUnused = !isRead && !isWritten && !isExecuted; int alpha = 0; if (isRead && _hideReadBytes || isWritten && _hideWrittenBytes || isExecuted && _hideExecutedBytes || isUnused && _hideUnusedBytes) { alpha = 128; } if (isRead && !_hideReadBytes || isWritten && !_hideWrittenBytes || isExecuted && !_hideExecutedBytes || isUnused && !_hideUnusedBytes) { alpha = 255; } _colors.BackColor = Color.Transparent; if (_cdlData != null) { if ((_cdlData[index] & (byte)CdlFlags.Code) != 0 && _highlightCodeBytes) { //Code _colors.BackColor = cfg.CodeByteColor; } else if ((_cdlData[index] & (byte)CdlFlags.Data) != 0 && _highlightDataBytes) { //Data _colors.BackColor = cfg.DataByteColor; } } if (_hasLabel[index]) { //Labels/comments _colors.BackColor = cfg.LabelledByteColor; } _colors.BorderColor = Color.Empty; if (_breakpointTypes != null) { switch (_breakpointTypes[index]) { case BreakpointTypeFlags.Execute: _colors.BorderColor = ConfigManager.Config.Debug.Debugger.CodeExecBreakpointColor; break; case BreakpointTypeFlags.Write: _colors.BorderColor = ConfigManager.Config.Debug.Debugger.CodeWriteBreakpointColor; break; case BreakpointTypeFlags.Read: _colors.BorderColor = ConfigManager.Config.Debug.Debugger.CodeReadBreakpointColor; break; } } if (_showExec && _counters[index].ExecStamp != 0 && framesSinceExec >= 0 && (framesSinceExec < _framesToFade || _framesToFade == 0)) { _colors.ForeColor = Color.FromArgb(alpha, DarkerColor(cfg.ExecColor, (_framesToFade - framesSinceExec) / _framesToFade)); } else if (_showWrite && _counters[index].WriteStamp != 0 && framesSinceWrite >= 0 && (framesSinceWrite < _framesToFade || _framesToFade == 0)) { _colors.ForeColor = Color.FromArgb(alpha, DarkerColor(cfg.WriteColor, (_framesToFade - framesSinceWrite) / _framesToFade)); } else if (_showRead && _counters[index].ReadStamp != 0 && framesSinceRead >= 0 && (framesSinceRead < _framesToFade || _framesToFade == 0)) { _colors.ForeColor = Color.FromArgb(alpha, DarkerColor(cfg.ReadColor, (_framesToFade - framesSinceRead) / _framesToFade)); } else { _colors.ForeColor = Color.FromArgb(alpha, Color.Black); } return(_colors); }