1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-10 21:49:27 +00:00
6502bench/SourceGen/Tools/Omf/WpfGui/OmfSegmentViewer.xaml
Andy McFadden 463a0cc561 Progress toward OMF file handling
Added generation of the relocation dictionary and constant body for
segments in Load files.

Also, don't reject files with v1 segments (whose length is specified
as a block count) just because the EOF isn't a multiple of 512 bytes.
Some executables don't pad out the last block.

Various tweaks to output formatting.
2020-06-28 21:10:53 -07:00

142 lines
7.4 KiB
XML

<!--
Copyright 2020 faddenSoft
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Window x:Class="SourceGen.Tools.Omf.WpfGui.OmfSegmentViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SourceGen.Tools.Omf.WpfGui"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="OMF Segment Viewer"
SizeToContent="Height" Width="600" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<system:String x:Key="str_FileOffsetLenFmt">File offset {0}, length {1} ({2})</system:String>
<system:String x:Key="str_RecordHeaderFmt">Records ({0}):</system:String>
</Window.Resources>
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding FileOffsetLenStr, FallbackValue=File Offset / Length}" Margin="0,8,0,0"/>
<TextBlock Grid.Row="1" Text="Header fields:" Margin="0,8,0,0"/>
<DataGrid Name="headerList" Grid.Row="2" Height="145" Margin="0,8,0,0"
IsReadOnly="True"
ItemsSource="{Binding HeaderItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
CanUserSortColumns="False"
SelectionMode="Single">
<DataGrid.Resources>
<!-- make the no-focus color the same as the in-focus color -->
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"
Color="{x:Static SystemColors.HighlightColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}"
Color="{x:Static SystemColors.HighlightTextColor}"/>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Width="100" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Value" Width="120" Binding="{Binding Value}"/>
<DataGridTextColumn Header="Notes" Width="280" Binding="{Binding Note}"/>
</DataGrid.Columns>
</DataGrid>
<TextBlock Grid.Row="3" Text="{Binding RecordHeaderStr, FallbackValue=Records (123):}" Margin="0,8,0,0"/>
<DataGrid Name="recordList" Grid.Row="4" Height="145" Margin="0,8,0,0"
IsReadOnly="True"
ItemsSource="{Binding RecordItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
CanUserSortColumns="False"
SelectionMode="Single">
<DataGrid.Resources>
<!-- make the no-focus color the same as the in-focus color -->
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"
Color="{x:Static SystemColors.HighlightColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}"
Color="{x:Static SystemColors.HighlightTextColor}"/>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="OpName" Width="80" Binding="{Binding OpName}"/>
<DataGridTextColumn Header="Length" Width="80" Binding="{Binding Length}"/>
<DataGridTextColumn Header="Value" Width="380" Binding="{Binding Value}"/>
</DataGrid.Columns>
</DataGrid>
<TextBlock Grid.Row="5" Text="Relocation dictionary:" Margin="0,8,0,0"
Visibility="{Binding HasRelocs, Converter={StaticResource BoolToVis}}"/>
<DataGrid Name="relocList" Grid.Row="6" Height="145" Margin="0,8,0,0"
Visibility="{Binding HasRelocs, Converter={StaticResource BoolToVis}}"
IsReadOnly="True"
ItemsSource="{Binding RelocItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
CanUserSortColumns="False"
SelectionMode="Single">
<DataGrid.Resources>
<!-- make the no-focus color the same as the in-focus color -->
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"
Color="{x:Static SystemColors.HighlightColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}"
Color="{x:Static SystemColors.HighlightTextColor}"/>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="Bytes" Width="50" Binding="{Binding Width}"/>
<DataGridTextColumn Header="Offset" Width="70" Binding="{Binding Offset}"/>
<DataGridTextColumn Header="Rel Off" Width="70" Binding="{Binding RelOffset}"/>
<DataGridTextColumn Header="Shift" Width="50" Binding="{Binding Shift}"/>
<DataGridTextColumn Header="File Num" Width="70" Binding="{Binding FileNum}"/>
<DataGridTextColumn Header="Seg Num" Width="70" Binding="{Binding SegNum}"/>
<DataGridTextColumn Header="Super Type" Width="80" Binding="{Binding SuperType}"/>
</DataGrid.Columns>
</DataGrid>
<DockPanel Grid.Row="7" LastChildFill="False" Margin="0,16,0,0">
<Button DockPanel.Dock="Right" Content="Done" Width="70" IsCancel="True"/>
</DockPanel>
</Grid>
</Window>