Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger: Tilemap Viewer - Add 8x8 option to Edit Tiles menu and View in Memory for attribute value #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions UI/Debugger/Utilities/ContextMenuAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,12 @@ public enum ActionType
[IconFile("CheatCode")]
ViewInMemoryViewer,

[IconFile("CheatCode")]
ViewTilemapInMemoryViewer,

[IconFile("CheatCode")]
ViewAttributeInMemoryViewer,

LoadTblFile,
ResetTblMappings,

Expand Down
6 changes: 6 additions & 0 deletions UI/Debugger/ViewModels/TileViewerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
},
Expand Down
21 changes: 20 additions & 1 deletion UI/Debugger/ViewModels/TilemapViewerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public TilemapViewerViewModel(CpuType cpuType, PictureViewer picViewer, Window?

DebugShortcutManager.CreateContextMenu(picViewer, new List<object>() {
new ContextMenuAction() {
ActionType = ActionType.ViewInMemoryViewer,
ActionType = ActionType.ViewTilemapInMemoryViewer,
HintText = () => {
DebugTilemapTileInfo? tile = GetSelectedTileInfo();
return tile?.TileMapAddress > 0 ? $"${tile?.TileMapAddress:X4}" : "";
Expand All @@ -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),
Expand Down Expand Up @@ -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)
}
}
},
Expand Down
5 changes: 2 additions & 3 deletions UI/Localization/resources.en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2373,7 +2373,6 @@ E
<Value ID="Flash64">Flash (64 KB)</Value>
<Value ID="Flash128">Flash (128 KB)</Value>
</Enum>

<Enum ID="MemorySizes">
<Value ID="None">None</Value>
<Value ID="_128Bytes">128 bytes</Value>
Expand Down Expand Up @@ -2616,7 +2615,6 @@ E
<Value ID="SmsVideoRam">Video RAM</Value>
<Value ID="SmsPaletteRam">Palette RAM</Value>
<Value ID="SmsPort">I/O Port</Value>

<Value ID="GbaMemory">CPU Memory</Value>
<Value ID="GbaPrgRom">ROM</Value>
<Value ID="GbaIntWorkRam">Internal Work RAM</Value>
Expand All @@ -2626,7 +2624,6 @@ E
<Value ID="GbaVideoRam">Video RAM</Value>
<Value ID="GbaSpriteRam">Sprite RAM</Value>
<Value ID="GbaPaletteRam">Palette RAM</Value>

<Value ID="None">None</Value>
</Enum>
<Enum ID="GameboyModel">
Expand Down Expand Up @@ -3199,6 +3196,8 @@ E
<Value ID="ExportToPng">Export to PNG</Value>
<Value ID="ViewInTileViewer">View in Tile Viewer</Value>
<Value ID="ViewInMemoryViewer">View in Memory Viewer</Value>
<Value ID="ViewTilemapInMemoryViewer">View in Memory Viewer (Tilemap)</Value>
<Value ID="ViewAttributeInMemoryViewer">View in Memory Viewer (Attribute)</Value>

<Value ID="LoadTblFile">Load TBL file...</Value>
<Value ID="ResetTblMappings">Reset TBL mappings</Value>
Expand Down