diff --git a/UI/Debugger/Utilities/ContextMenuAction.cs b/UI/Debugger/Utilities/ContextMenuAction.cs index c0003483b..aef7fbb29 100644 --- a/UI/Debugger/Utilities/ContextMenuAction.cs +++ b/UI/Debugger/Utilities/ContextMenuAction.cs @@ -47,7 +47,7 @@ public virtual string Name } else { label = ResourceHelper.GetEnumText(ActionType); } - + if(HintText != null) { string hint = HintText(); if(!string.IsNullOrWhiteSpace(hint)) { @@ -114,7 +114,7 @@ public List? SubActions public Func? IsEnabled { get; set; } public Func? IsSelected { get; set; } public Func? IsVisible { get; set; } - + public bool AllowedWhenHidden { get; set; } public bool AlwaysShowLabel { get; set; } public RoutingStrategies RoutingStrategy { get; set; } = RoutingStrategies.Bubble; @@ -126,7 +126,7 @@ public List? SubActions [Reactive] public Image? ActionIcon { get; set; } [Reactive] public bool Enabled { get; set; } [Reactive] public bool Visible { get; set; } - + [Reactive] public string TooltipText { get; set; } = ""; private static SimpleCommand _emptyCommand = new SimpleCommand(() => { }); @@ -310,7 +310,7 @@ public enum ActionType [IconFile("EditLabel")] EditLabel, - + [IconFile("EditLabel")] EditComment, @@ -327,7 +327,7 @@ public enum ActionType [IconFile("CheatCode")] MarkAsData, - + [IconFile("Help")] MarkAsUnidentified, @@ -356,7 +356,7 @@ public enum ActionType WatchDecimalDisplay, WatchHexDisplay, WatchBinaryDisplay, - + RowDisplayFormat, RowFormatBinary, RowFormatHex8Bits, @@ -400,10 +400,10 @@ public enum ActionType [IconFile("StepInto")] StepInto, - + [IconFile("StepOver")] StepOver, - + [IconFile("StepOut")] StepOut, @@ -465,7 +465,7 @@ public enum ActionType [IconFile("SaveFloppy")] Save, - + SaveAs, [IconFile("Exit")] @@ -480,7 +480,7 @@ public enum ActionType Refresh, EnableAutoRefresh, RefreshOnBreakPause, - + ZoomIn, ZoomOut, @@ -495,7 +495,13 @@ public enum ActionType [IconFile("CheatCode")] ViewInMemoryViewer, - + + [IconFile("CheatCode")] + ViewTilemapInMemoryViewer, + + [IconFile("CheatCode")] + ViewAttributeInMemoryViewer, + LoadTblFile, ResetTblMappings, @@ -518,7 +524,7 @@ public enum ActionType [IconFile("LogWindow")] OpenTraceLogger, - + [IconFile("Find")] OpenMemorySearch, @@ -536,7 +542,7 @@ public enum ActionType [IconFile("Chip")] OpenAssembler, - + [IconFile("LogWindow")] OpenDebugLog, @@ -580,7 +586,7 @@ public enum ActionType Record, [IconFile("MediaStop")] Stop, - + [IconFile("Network")] NetPlay, Connect, @@ -684,7 +690,7 @@ public enum ActionType InsertCoin3, [IconFile("Coins")] InsertCoin4, - + SaveState, LoadState, [IconFile("SplitView")] @@ -695,7 +701,7 @@ public enum ActionType LoadStateDialog, [IconFile("Folder")] LoadStateFromFile, - + RecentFiles, LoadLastSession, @@ -719,10 +725,10 @@ public enum ActionType [IconFile("Breakpoint")] SetBreakpoint, - + [IconFile("Close")] RemoveBreakpoint, - + [IconFile("Breakpoint")] EnableBreakpoint, @@ -731,7 +737,7 @@ public enum ActionType [IconFile("Edit")] CodeWindowEditBreakpoint, - + CodeDataLogger, [IconFile("ResetSettings")] ResetCdl, @@ -750,12 +756,12 @@ public enum ActionType ResetWorkspace, [IconFile("TabContent")] Workspace, - + [IconFile("Import")] ImportLabels, [IconFile("Export")] ExportLabels, - + [IconFile("Import")] ImportWatchEntries, [IconFile("Export")] @@ -830,7 +836,7 @@ public enum ActionType [IconFile("Settings")] GameConfig, - + [IconFile("MediaStop")] FreezeMemory, [IconFile("MediaPlay")] @@ -838,7 +844,7 @@ public enum ActionType [IconFile("ResetSettings")] ResetAccessCounters, - + [IconFile("HdPack")] CopyToHdPackFormat, @@ -855,7 +861,7 @@ public enum ActionType FlipHorizontal, [IconFile("FlipVertical")] FlipVertical, - + [IconFile("TranslateLeft")] TranslateLeft, [IconFile("TranslateRight")] diff --git a/UI/Debugger/ViewModels/TileViewerViewModel.cs b/UI/Debugger/ViewModels/TileViewerViewModel.cs index 9a68d8dad..978732e2d 100644 --- a/UI/Debugger/ViewModels/TileViewerViewModel.cs +++ b/UI/Debugger/ViewModels/TileViewerViewModel.cs @@ -50,7 +50,7 @@ public class TileViewerViewModel : DisposableViewModel, ICpuTypeModel, IMouseOve [Reactive] public int GridSizeY { get; set; } = 8; [Reactive] public Rect SelectionRect { get; set; } - + [Reactive] public List? PageDelimiters { get; set; } [Reactive] public Enum[] AvailableMemoryTypes { get; set; } = Array.Empty(); @@ -64,7 +64,7 @@ public class TileViewerViewModel : DisposableViewModel, ICpuTypeModel, IMouseOve public List FileMenuActions { get; } = new(); public List ViewMenuActions { get; } = new(); - public int ColumnCount => Math.Clamp(Config.ColumnCount, 4, 256); + public int ColumnCount => Math.Clamp(Config.ColumnCount, 4, 256); public int RowCount => Math.Clamp(Config.RowCount, 4, 256); private BaseState? _ppuState; @@ -171,6 +171,12 @@ public TileViewerViewModel(CpuType cpuType, PictureViewer picViewer, Window? wnd CustomText = $"4x4 ({GridSizeX*4}px x {GridSizeY*4}px)", IsEnabled = () => GetSelectedTileAddress() >= 0, OnClick = () => EditTileGrid(4, 4, wnd) + }, + new ContextMenuAction() { + ActionType = ActionType.Custom, + CustomText = $"8x8 ({GridSizeX*8}px x {GridSizeY*8}px)", + IsEnabled = () => GetSelectedTileAddress() >= 0, + OnClick = () => EditTileGrid(8, 8, wnd) } } }, @@ -261,7 +267,7 @@ public TileViewerViewModel(CpuType cpuType, PictureViewer picViewer, Window? wnd x => x.Config.Source, x => x.Config.StartAddress, x => x.Config.ColumnCount, x => x.Config.RowCount, x => x.Config.Format ).Skip(1).Subscribe(x => ClearPresetSelection())); - + AddDisposable(ReactiveHelper.RegisterRecursiveObserver(Config, Config_PropertyChanged)); } @@ -426,7 +432,7 @@ private void Config_PropertyChanged(object? sender, PropertyChangedEventArgs e) public void RefreshData() { _ppuState = DebugApi.GetPpuState(CpuType); - + RefreshPalette(); lock(_updateLock) { @@ -456,7 +462,7 @@ private void RefreshTab() { Dispatcher.UIThread.Post(() => { InitBitmap(); - + lock(_updateLock) { Array.Resize(ref _sourceData, _coreSourceData.Length); Array.Copy(_coreSourceData, _sourceData, _coreSourceData.Length); @@ -757,7 +763,7 @@ private List GetConfigPresets() CreatePreset(0, "ROM", () => ApplyPrgPreset()), }; } - + case CpuType.Sms: return new() { CreatePreset(0, "VDP", () => ApplyPpuPreset()), diff --git a/UI/Debugger/ViewModels/TilemapViewerViewModel.cs b/UI/Debugger/ViewModels/TilemapViewerViewModel.cs index 490ec71d9..85b320e59 100644 --- a/UI/Debugger/ViewModels/TilemapViewerViewModel.cs +++ b/UI/Debugger/ViewModels/TilemapViewerViewModel.cs @@ -135,7 +135,7 @@ public TilemapViewerViewModel(CpuType cpuType, PictureViewer picViewer, Window? DebugShortcutManager.CreateContextMenu(picViewer, new List() { new ContextMenuAction() { - ActionType = ActionType.ViewInMemoryViewer, + ActionType = ActionType.ViewTilemapInMemoryViewer, HintText = () => { DebugTilemapTileInfo? tile = GetSelectedTileInfo(); return tile?.TileMapAddress > 0 ? $"${tile?.TileMapAddress:X4}" : ""; @@ -148,6 +148,20 @@ public TilemapViewerViewModel(CpuType cpuType, PictureViewer picViewer, Window? } } }, + new ContextMenuAction() { + ActionType = ActionType.ViewAttributeInMemoryViewer, + IsVisible = () => CpuType == CpuType.Nes, + HintText = () => { + DebugTilemapTileInfo? tile = GetSelectedTileInfo(); + return tile?.TileMapAddress > 0 ? $"${tile?.AttributeAddress:X4}" : ""; + }, + OnClick = () => { + DebugTilemapTileInfo? tile = GetSelectedTileInfo(); + if(tile != null && tile.Value.AttributeAddress >= 0) { + MemoryToolsWindow.ShowInMemoryTools(GetVramMemoryType(), tile.Value.AttributeAddress); + } + } + }, new ContextMenuAction() { ActionType = ActionType.ViewInTileViewer, Shortcut = () => ConfigManager.Config.Debug.Shortcuts.Get(DebuggerShortcut.TilemapViewer_ViewInTileViewer), @@ -186,6 +200,11 @@ public TilemapViewerViewModel(CpuType cpuType, PictureViewer picViewer, Window? ActionType = ActionType.Custom, CustomText = $"4x4 ({GridSizeX*4}px x {GridSizeY*4}px)", OnClick = () => EditTileGrid(4, 4, wnd) + }, + new ContextMenuAction() { + ActionType = ActionType.Custom, + CustomText = $"8x8 ({GridSizeX*8}px x {GridSizeY*8}px)", + OnClick = () => EditTileGrid(8, 8, wnd) } } }, @@ -249,7 +268,7 @@ public TilemapViewerViewModel(CpuType cpuType, PictureViewer picViewer, Window? })); AddDisposable(this.WhenAnyValue(x => x.SelectionRect).Subscribe(x => UpdatePreviewPanel())); AddDisposable(ReactiveHelper.RegisterRecursiveObserver(Config, Config_PropertyChanged)); - + InitNesGridOptions(); DebugShortcutManager.RegisterActions(wnd, FileMenuActions); diff --git a/UI/Localization/resources.en.xml b/UI/Localization/resources.en.xml index 5dc8432e9..b2570a9e0 100644 --- a/UI/Localization/resources.en.xml +++ b/UI/Localization/resources.en.xml @@ -51,17 +51,17 @@ Light detection radius for light guns: Small Large - + Hardware buttons Four Score Configuration 4-Player Adapter Configuration 2-Player Adapter Configuration - + Setup Port 1: Port 2: - + Port 1: Port 2: Port 3: @@ -145,16 +145,16 @@ Picture Select Preset... Reset - + General settings Brightness Contrast Hue Saturation - + Filter settings Filter: - + NTSC settings (blargg) Artifacts Bleed @@ -214,7 +214,7 @@
General Region: - + Audio Audio interpolation type: Volume @@ -345,11 +345,11 @@ General Model In Super Game Boy mode, use SGB2 timings and behavior - + Emulation Default power on state for RAM: Allow invalid input (e.g Down + Up or Left + Right at the same time) - + Video Game Boy (DMG) Palette Background: @@ -377,7 +377,7 @@ Square 2 Wave Noise - + Input Controllers Player 1 @@ -438,7 +438,7 @@ Channel 6 CD Audio ADPCM - + Emulation Recommended settings for developers (homebrew / ROM hacking) Default power on state for RAM: @@ -448,7 +448,7 @@ Use HuC6280A audio (reduces popping) Input - + Video Miscellaneous Settings Remove sprite limit @@ -462,13 +462,13 @@ Overscan Palette
- +
Color picker OK Cancel
- +
Load preset palette... Export palette @@ -568,7 +568,7 @@ Port 1: Port 2:
- +
Warning: Your current configuration contains conflicting key bindings. If this is not intentional, please review and correct your key bindings. Action @@ -602,12 +602,12 @@ OK Cancel
- +
General Theme: (requires restart) - + Display Language: Only allow one instance of Mesen at a time Automatically check for updates @@ -753,7 +753,7 @@ To enter multiple codes, enter 1 code per line. Some codes do not match the selected format. Format: - + OK Cancel
@@ -790,7 +790,7 @@ Record system HUD (game timer, on-screen messages, etc.) Record input HUD - + Browse... Record Cancel @@ -835,7 +835,7 @@
HD Pack Builder - + Recording Settings CHR Bank Size: Scale/Filter: @@ -854,7 +854,7 @@ Start Recording Stop Recording Open Save Folder - + Save to:
@@ -869,9 +869,9 @@ Overscan Use game-specific overscan settings - + DIP Switches - + OK Cancel
@@ -882,14 +882,14 @@ OK Cancel - +
Import cheats from cheat database... Search: OK Cancel
- +
OK Cancel @@ -900,12 +900,12 @@ Each button can be mapped to up to 4 different keyboard keys or gamepad buttons. Set Default Bindings Clear Key Bindings - + Key Set #1 Key Set #2 Key Set #3 Key Set #4 - + Turbo Speed: Fast Slow @@ -914,7 +914,7 @@ Keyboard WASD Layout Arrow Keys Layout - + Xbox Controller Controller #1 Controller #1 - A+B layout @@ -934,7 +934,7 @@ OK Cancel
- +
(not recommended)
@@ -948,7 +948,7 @@ PC Engine SMS - +
Previous track Next track @@ -956,7 +956,7 @@ Shuffle on/off Repeat on/off
- +
Tilemap Viewer @@ -973,13 +973,13 @@ Show attribute grid (16x16) Show attribute grid (32x32) Show nametable delimiters - + Highlight settings Tiles: Attributes: Show scroll overlay
- +
Tile Editor _File @@ -989,14 +989,14 @@ Background: Show grid Preview - + Select color by clicking above. Left-click: Draw selected color Hold shift: Details on pixel under cursor Shift-click/Right-click: Pick color under cursor Ctrl-click: Make pixel transparent
- +
Tile Viewer _File @@ -1064,7 +1064,7 @@ _File _Settings - + Start address: $ Bytes used: @@ -1077,23 +1077,23 @@ Apply Cancel
- +
Script Window _File _Script _Help - + Run Stop
- +
Log Window Close
- +
Debug Log Close @@ -1136,19 +1136,19 @@ Save RAM: CHR RAM: CHR Save RAM: - + Battery Trainer Save as... Cancel
- +
Trace Logger Condition: Enabled - + {0} - Log settings Use custom format: @@ -1166,7 +1166,7 @@ Use labels Indent based on stack pointer - + Condition contains invalid syntax or symbols. _File @@ -1192,7 +1192,7 @@ Show list view Select all Deselect all - + PC Scanline Cycle @@ -1217,13 +1217,13 @@ Address Condition
- +
Function PC Address ROM Address
- +
Address Result @@ -1246,7 +1246,7 @@ Name Value
- +
Search
@@ -1265,7 +1265,7 @@ Use lower case Show jump/sub labels Use 6502-like mnemonics - + Break on... BRK COP @@ -1313,11 +1313,11 @@ _File _View _Search - + Memory Type: Toggle settings panel - +
Access highlighting Fade speed: @@ -1362,9 +1362,9 @@ No match found! Previous Next - + When searching hexadecimal values, a question mark (?) can be used to define a byte that can take any value. e.g: "FF ? 55" will search for any set of three bytes that starts with FF and ends with 55. - + Close
@@ -1380,7 +1380,7 @@ Reset to default Refresh on break
- +
Go to All Search: @@ -1388,12 +1388,12 @@ Select Close
- +
Debugger Settings OK Cancel - + Debugger General settings Reset CDL when ROM changes @@ -1414,13 +1414,13 @@ Auto-start script when loaded (or reloaded) Auto-reload script from disk when file changes Auto-restart script after power cycling or reloading a game - + Restrictions Maximum execution time: seconds Allow access to I/O and OS functions Allow network access - + Fonts & Colors Font settings @@ -1429,7 +1429,7 @@ Assembler: Script window: Other (monospace): - + Syntax highlighting Opcode Label @@ -1439,7 +1439,7 @@ Effective Address Active Statement Active Statement (mid-instruction) - + Verified Data Unidentified Block Unexecuted Code @@ -1466,7 +1466,7 @@ Work RAM labels Other labels Import comments (restricted to the label types selected above) - + Shortcuts Shared Memory Viewer @@ -1476,7 +1476,7 @@ Watch Window
- +
Profiler @@ -1497,7 +1497,7 @@ Min. Cycles Max. Cycles
- +
Memory Search Apply filter @@ -1525,7 +1525,7 @@ Last Exec Match
- +
Go to Address... Address: @@ -1573,7 +1573,7 @@ OK Cancel
- +
Edit comment... OK @@ -1586,7 +1586,7 @@ _File _View
- +
Address Name @@ -1602,10 +1602,10 @@ Memory type: Break on: - + Address: to $ - + Condition: Ignore dummy reads/writes @@ -1751,7 +1751,7 @@ E No You have unsaved changes for this script - would you like to save them? - + {0} OK? A label with this name already exists. Label does not follow naming rules. @@ -1922,7 +1922,7 @@ E Datach Barcode Reader Gameboy Controller - + 2-button Controller 6-button Controller Turbo Tap @@ -2187,7 +2187,7 @@ E Dot (.) Semicolon (;) Apostrophe (') - + Slash (/) Backslash (\) Equal (=) @@ -2437,7 +2437,6 @@ E Flash (64 KB) Flash (128 KB) - None 128 bytes @@ -2610,7 +2609,7 @@ E SMS GBA - + CPU Memory SPC Memory @@ -2636,7 +2635,7 @@ E CX4 Data RAM BS-X - PSRAM BS-X - Memory Pack - + GB - CPU Memory GB - PRG ROM GB - Work RAM @@ -2658,7 +2657,7 @@ E CHR ROM CHR RAM Palette RAM - + CPU Memory HuCard ROM Work RAM @@ -2672,7 +2671,7 @@ E Palette RAM Sprite RAM Sprite RAM (VDC2) - + CPU Memory ROM System RAM @@ -2681,7 +2680,6 @@ E Video RAM Palette RAM I/O Port - CPU Memory ROM Internal Work RAM @@ -2691,7 +2689,6 @@ E Video RAM Sprite RAM Palette RAM - None @@ -2794,7 +2791,7 @@ E IRQ NMI - + Decayed OAM read $2000/5/6 scroll glitch $2006 scroll glitch @@ -2802,7 +2799,7 @@ E Bus conflict CPU crashed PPU EXT output mode - + Invalid VRAM address (>= $8000) LD B, B (NOP) @@ -3221,7 +3218,7 @@ E Signed decimal (32-bit) Unsigned decimal Clear - + Import... Export... @@ -3232,7 +3229,7 @@ E Show call stack Show console status Show controllers - + Show settings panel Show memory mappings @@ -3278,11 +3275,13 @@ E Recent Scripts Go to Location - + Export to PNG View in Tile Viewer View in Memory Viewer - + View in Memory Viewer (Tilemap) + View in Memory Viewer (Attribute) + Load TBL file... Reset TBL mappings @@ -3376,7 +3375,7 @@ E Power Off Select Disk Eject Disk - + Insert Coin (1) Insert Coin (2) Insert Coin (3 - DualSystem) @@ -3402,13 +3401,13 @@ E Toggle Breakpoint Edit Selected Code View in Debugger - + Enable Breakpoint Disable Breakpoint Set Breakpoint Remove Breakpoint Edit Breakpoint - + Code/Data Logger Reset CDL data Load CDL data from... @@ -3464,7 +3463,7 @@ E Resume Gameplay Game Settings - + Freeze Unfreeze @@ -3479,7 +3478,7 @@ E Flip horizontal Flip vertical - + Translate left Translate right Translate up