UI: Add Skyrim, KAFTL & HW:AOC to RPC.

Minor code improvements and comment fixes.
This commit is contained in:
Evan Husted 2024-10-16 19:23:11 -05:00
parent 280b94fc0c
commit 1800ecc1b4
13 changed files with 68 additions and 122 deletions

View file

@ -10,20 +10,7 @@ namespace Ryujinx.Ava.UI.Controls
protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
{
var newValue = Value + e.Delta.Y * TickFrequency;
if (newValue < Minimum)
{
Value = Minimum;
}
else if (newValue > Maximum)
{
Value = Maximum;
}
else
{
Value = newValue;
}
Value = Math.Clamp(Value + e.Delta.Y * TickFrequency, Minimum, Maximum);
e.Handled = true;
}

View file

@ -230,6 +230,16 @@ namespace Ryujinx.Ava.UI.Helpers
primaryButtonResult);
}
internal static async Task<UserResult> CreateLocalizedConfirmationDialog(
string primaryText,
string secondaryText) =>
await CreateConfirmationDialog(
primaryText,
secondaryText,
LocaleManager.Instance[LocaleKeys.InputDialogYes],
LocaleManager.Instance[LocaleKeys.InputDialogNo],
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
internal static async Task CreateUpdaterInfoDialog(string primary, string secondaryText)
{
await ShowTextDialog(

View file

@ -1,4 +1,4 @@
<UserControl
<UserControl
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -22,13 +22,8 @@
VerticalAlignment="Bottom"
Background="{DynamicResource ThemeContentBackgroundColor}"
DockPanel.Dock="Bottom"
IsVisible="{Binding ShowMenuAndStatusBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
IsVisible="{Binding ShowMenuAndStatusBar}"
ColumnDefinitions="Auto,Auto,*,Auto">
<StackPanel
Grid.Column="0"
Margin="5"

View file

@ -50,10 +50,8 @@ namespace Ryujinx.Ava.UI.Windows
private void Button_OnClick(object sender, RoutedEventArgs e)
{
if (sender is Button { Tag: { } url })
{
OpenHelper.OpenUrl(url.ToString());
}
if (sender is Button { Tag: string url })
OpenHelper.OpenUrl(url);
}
private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e)

View file

@ -19,20 +19,12 @@ namespace Ryujinx.Ava.UI.Windows
private const int CutOffLuminosity = 64;
private readonly struct PaletteColor
private readonly struct PaletteColor(int qck, byte r, byte g, byte b)
{
public int Qck { get; }
public byte R { get; }
public byte G { get; }
public byte B { get; }
public PaletteColor(int qck, byte r, byte g, byte b)
{
Qck = qck;
R = r;
G = g;
B = b;
}
public int Qck { get; } = qck;
public byte R { get; } = r;
public byte G { get; } = g;
public byte B { get; } = b;
}
public static SKColor GetFilteredColor(SKBitmap image)
@ -164,16 +156,6 @@ namespace Ryujinx.Ava.UI.Windows
return score;
}
private static int BalanceHitCount(int hitCount, int maxHitCount)
{
return (hitCount << 8) / maxHitCount;
}
private static int GetColorApproximateLuminosity(byte r, byte g, byte b)
{
return (r + g + b) / 3;
}
private static int GetColorSaturation(PaletteColor color)
{
int cMax = Math.Max(Math.Max(color.R, color.G), color.B);
@ -188,10 +170,11 @@ namespace Ryujinx.Ava.UI.Windows
return (delta << 8) / cMax;
}
private static int GetColorValue(PaletteColor color)
{
return Math.Max(Math.Max(color.R, color.G), color.B);
}
private static int GetColorValue(PaletteColor color) => Math.Max(Math.Max(color.R, color.G), color.B);
private static int BalanceHitCount(int hitCount, int maxHitCount) => (hitCount << 8) / maxHitCount;
private static int GetColorApproximateLuminosity(byte r, byte g, byte b) => (r + g + b) / 3;
private static int GetQuantizedColorKey(byte r, byte g, byte b)
{