Skip to content

Commit

Permalink
Minor UI and other fixes (#802)
Browse files Browse the repository at this point in the history
* Wider DIW, rounded message boxes

* Don't log drive speed

* Change margins

* Allow changing DIW size

* Revert change to DIW sizing

* Change left column size in DIW

* Increase textbox ratio in UserInput

* Fix non-userinput margins

* Allow custom message box to move from image

* Change changelist

* PS4 pkg date is useless
  • Loading branch information
Deterous authored Dec 28, 2024
1 parent 1c9b943 commit fb05409
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 91 deletions.
1 change: 1 addition & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
- Add pure-getkey output names for PS3CFW
- Partially clean up PS3CFW
- Wrap some PhysicalTool method calls
- Minor UI and other fixes

### 3.2.4 (2024-11-24)

Expand Down
21 changes: 3 additions & 18 deletions MPF.Frontend/Tools/PhysicalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ public static bool GetBusEncryptionEnabled(Drive? drive)
}
catch
{
// We don't care what the error is
return null;
// We don't care what the error is, assume SYSTEM.CNF doesn't exist
}

// If the SYSTEM.CNF value can't be found, try PSX.EXE
Expand Down Expand Up @@ -550,14 +549,7 @@ public static bool GetBusEncryptionEnabled(Drive? drive)
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);

if (appPkgHeader != null)
{
byte[] date = BitConverter.GetBytes(appPkgHeader.VersionDate);
if (BitConverter.IsLittleEndian)
Array.Reverse(date);

string pkgDate = $"{date[0]:X2}{date[1]:X2}-{date[2]:X2}-{date[3]:X2}";
pkgInfo += $"{appPkgHeader.ContentID} ({pkgDate}, {appPkgHeader.VersionHash:X8})";
}
pkgInfo += $"{appPkgHeader.ContentID}";
}

if (pkgInfo == "")
Expand Down Expand Up @@ -708,14 +700,7 @@ public static bool GetBusEncryptionEnabled(Drive? drive)
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);

if (appPkgHeader != null)
{
byte[] date = BitConverter.GetBytes(appPkgHeader.VersionDate);
if (BitConverter.IsLittleEndian)
Array.Reverse(date);

string pkgDate = $"{date[0]:X2}{date[1]:X2}-{date[2]:X2}-{date[3]:X2}";
pkgInfo += $"{appPkgHeader.ContentID} ({pkgDate}, {appPkgHeader.VersionHash:X8})";
}
pkgInfo += $"{appPkgHeader.ContentID}";
}

if (pkgInfo == "")
Expand Down
5 changes: 1 addition & 4 deletions MPF.Frontend/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2061,10 +2061,7 @@ public void SetSupportedDriveSpeed()
VerboseLogLn($"Supported media speeds: {string.Join(", ", [.. DriveSpeeds.ConvertAll(ds => ds.ToString())])}");

// Set the selected speed
int speed = FrontendTool.GetDefaultSpeedForMediaType(CurrentMediaType, Options);

VerboseLogLn($"Setting drive speed to: {speed}");
DriveSpeed = speed;
DriveSpeed = FrontendTool.GetDefaultSpeedForMediaType(CurrentMediaType, Options);
}

/// <summary>
Expand Down
116 changes: 59 additions & 57 deletions MPF.UI/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,75 @@
WindowStyle="None"
ResizeMode="NoResize" SizeToContent="WidthAndHeight"
Title="" MinHeight="155" MaxWidth="470" MinWidth="154"
BorderBrush="DarkGray" BorderThickness="2">
AllowsTransparency="True" Background="Transparent">

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border CornerRadius="8" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="Gray" BorderThickness="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Grid Grid.Row="0" Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="115"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Margin="0,2,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="115"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>

<Image Grid.Column="0" Source="/Images/Icon.ico" Height="20" Width="20" Margin="1" />
<Label Grid.Column="1" Grid.ColumnSpan="4" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" MouseDown="TitleMouseDown" Content="{Binding Path=Title,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"/>
</Grid>
<Image Grid.Column="0" Source="/Images/Icon.ico" Height="20" Width="20" Margin="1" MouseDown="TitleMouseDown" />
<Label Grid.Column="1" Grid.ColumnSpan="4" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" MouseDown="TitleMouseDown" Content="{Binding Path=Title,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"/>
</Grid>

<!-- Make the window width fit the title by embedding the title invisibly -->
<TextBlock Text="{Binding Path=Title,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
Visibility="Hidden" Height="0" Margin="50 0 0 0" />
<!-- Make the window width fit the title by embedding the title invisibly -->
<TextBlock Text="{Binding Path=Title,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
Visibility="Hidden" Height="0" Margin="50 0 0 0" />

<Grid Grid.Row="1" Background="{DynamicResource CustomMessageBox.Static.Background}" MinHeight="69">
<DockPanel>
<Image Name="Image_MessageBox" Width="32" Height="32" HorizontalAlignment="Left" DockPanel.Dock="Left" Margin="30,0,0,0" Visibility="Collapsed"/>
<TextBlock Name="TextBlock_Message" TextWrapping="Wrap" MaxWidth="500" Width="Auto"
VerticalAlignment="Center" Margin="12,20,41,15" />
</DockPanel>
</Grid>
<Grid Grid.Row="1" Background="{DynamicResource CustomMessageBox.Static.Background}" MinHeight="69">
<DockPanel>
<Image Name="Image_MessageBox" Width="32" Height="32" HorizontalAlignment="Left" DockPanel.Dock="Left" Margin="30,0,0,0" Visibility="Collapsed"/>
<TextBlock Name="TextBlock_Message" TextWrapping="Wrap" MaxWidth="500" Width="Auto"
VerticalAlignment="Center" Margin="12,20,41,15" />
</DockPanel>
</Grid>

<Grid Grid.Row="2" Background="{DynamicResource CustomMessageBox.Static.Background}" MinHeight="49">
<DockPanel Margin="5,0">
<Grid Grid.Row="2" Background="{DynamicResource CustomMessageBox.Static.Background}" MinHeight="49">
<DockPanel Margin="5,0">

<!-- Cancel Button -->
<Button Name="Button_Cancel" MinWidth="88" MaxWidth="160" Height="26" Margin="5,0" HorizontalAlignment="Right" Visibility="Collapsed" IsCancel="True"
DockPanel.Dock="Right" Click="Button_Cancel_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_Cancel" Padding="0" Margin="10,0">_Cancel</Label>
</Button>
<!-- End Cancel Button -->
<!-- Cancel Button -->
<Button Name="Button_Cancel" MinWidth="88" MaxWidth="160" Height="26" Margin="5,0" HorizontalAlignment="Right" Visibility="Collapsed" IsCancel="True"
DockPanel.Dock="Right" Click="Button_Cancel_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_Cancel" Padding="0" Margin="10,0">_Cancel</Label>
</Button>
<!-- End Cancel Button -->

<!-- No Button -->
<Button Name="Button_No" MinWidth="88" MaxWidth="160" Height="26" Margin="5,0" HorizontalAlignment="Right" Visibility="Collapsed"
DockPanel.Dock="Right" Click="Button_No_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_No" Padding="0" Margin="10,0">_No</Label>
</Button>
<!-- End No Button -->
<!-- No Button -->
<Button Name="Button_No" MinWidth="88" MaxWidth="160" Height="26" Margin="5,0" HorizontalAlignment="Right" Visibility="Collapsed"
DockPanel.Dock="Right" Click="Button_No_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_No" Padding="0" Margin="10,0">_No</Label>
</Button>
<!-- End No Button -->

<!-- Yes Button -->
<Button Name="Button_Yes" MinWidth="88" MaxWidth="160" Height="26" Margin="35,0,5,0" HorizontalAlignment="Right" Visibility="Collapsed"
DockPanel.Dock="Right" Click="Button_Yes_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_Yes" Padding="0" Margin="10,0">_Yes</Label>
</Button>
<!-- End Yes Button -->
<!-- Yes Button -->
<Button Name="Button_Yes" MinWidth="88" MaxWidth="160" Height="26" Margin="35,0,5,0" HorizontalAlignment="Right" Visibility="Collapsed"
DockPanel.Dock="Right" Click="Button_Yes_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_Yes" Padding="0" Margin="10,0">_Yes</Label>
</Button>
<!-- End Yes Button -->

<!-- OK Button -->
<Button Name="Button_OK" MinWidth="88" MaxWidth="160" Margin="35,0,5,0" HorizontalAlignment="Right" Height="26"
Click="Button_OK_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_Ok" Padding="0" Margin="10,0">_OK</Label>
</Button>
<!-- End OK Button -->
<!-- OK Button -->
<Button Name="Button_OK" MinWidth="88" MaxWidth="160" Margin="35,0,5,0" HorizontalAlignment="Right" Height="26"
Click="Button_OK_Click" Style="{DynamicResource CustomButtonStyle}">
<Label Name="Label_Ok" Padding="0" Margin="10,0">_OK</Label>
</Button>
<!-- End OK Button -->

</DockPanel>
</DockPanel>
</Grid>
</Grid>
</Grid>
</Border>
</Window>
2 changes: 1 addition & 1 deletion MPF.UI/UserControls/UserInput.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="1.25*" />
<ColumnDefinition Width="1.50*" />
</Grid.ColumnDefinitions>

<Label Grid.Row="0" Grid.Column="0"
Expand Down
25 changes: 16 additions & 9 deletions MPF.UI/Windows/DiscInformationWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:redump="clr-namespace:SabreTools.RedumpLib.Data;assembly=SabreTools.RedumpLib"
xmlns:coreWindows="clr-namespace:MPF.UI.Windows"
mc:Ignorable="d"
Title="Disc Information" Width="515" WindowStyle="None"
Title="Disc Information" Width="600" WindowStyle="None"
WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize" SizeToContent="Height"
AllowsTransparency="True" Background="Transparent">

Expand All @@ -17,8 +17,8 @@
</Window.Resources>

<Border CornerRadius="8" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="Gray" BorderThickness="2">
<StackPanel Orientation="Vertical" Width="500" MaxHeight="650">
<Grid Margin="0,10,0,0">
<StackPanel Orientation="Vertical" MaxHeight="650">
<Grid Margin="0,2,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="115"/>
Expand Down Expand Up @@ -91,7 +91,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="1.25*" />
<ColumnDefinition Width="1.50*" />
</Grid.ColumnDefinitions>

<Label x:Name="CategoryLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Category" />
Expand All @@ -103,7 +103,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="1.25*" />
<ColumnDefinition Width="1.50*" />
</Grid.ColumnDefinitions>

<Label x:Name="RegionLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Region" />
Expand All @@ -115,7 +115,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="1.25*" />
<ColumnDefinition Width="1.50*" />
</Grid.ColumnDefinitions>

<Label x:Name="LanguagesLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Languages" />
Expand All @@ -133,7 +133,7 @@
<Grid x:Name="LanguageSelectionGrid" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="1.25*" />
<ColumnDefinition Width="1.50*" />
</Grid.ColumnDefinitions>

<Label x:Name="LanguageSelectionLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Language Selection Via" />
Expand Down Expand Up @@ -187,7 +187,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="1.25*" />
<ColumnDefinition Width="1.50*" />
</Grid.ColumnDefinitions>

<Label/>
Expand All @@ -199,7 +199,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="1.25*" />
<ColumnDefinition Width="1.50*" />
</Grid.ColumnDefinitions>

<Label/>
Expand Down Expand Up @@ -496,6 +496,13 @@

<!-- Accept / Cancel -->
<GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<GroupBox.Template>
<ControlTemplate TargetType="GroupBox">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5">
<ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</GroupBox.Template>
<UniformGrid Columns="3" Margin="5,5,5,5" Height="28">
<Button Name="AcceptButton" Height="25" Width="80" Content="Accept"
Style="{DynamicResource CustomButtonStyle}" />
Expand Down
2 changes: 1 addition & 1 deletion MPF.UI/Windows/OptionsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<Border CornerRadius="8" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="Gray" BorderThickness="2">
<StackPanel Orientation="Vertical">
<Grid Margin="0,10,0,0">
<Grid Margin="0,2,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="115"/>
Expand Down
2 changes: 1 addition & 1 deletion MPF.UI/Windows/RingCodeGuideWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<Border CornerRadius="8" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="Gray" BorderThickness="1">
<StackPanel Orientation="Vertical">
<Grid Margin="0,10,0,0">
<Grid Margin="0,2,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="115"/>
Expand Down

0 comments on commit fb05409

Please sign in to comment.