mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-11 21:29:14 +00:00
Merge branch 'Ryujinx:master' into master
This commit is contained in:
commit
b1ffdbd173
20 changed files with 130 additions and 77 deletions
|
@ -17,12 +17,11 @@
|
||||||
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.5" />
|
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.5" />
|
||||||
<PackageVersion Include="GtkSharp.Dependencies" Version="1.1.1" />
|
<PackageVersion Include="GtkSharp.Dependencies" Version="1.1.1" />
|
||||||
<PackageVersion Include="GtkSharp.Dependencies.osx" Version="0.0.5" />
|
<PackageVersion Include="GtkSharp.Dependencies.osx" Version="0.0.5" />
|
||||||
<PackageVersion Include="jp2masa.Avalonia.Flexbox" Version="0.3.0-beta.4" />
|
|
||||||
<PackageVersion Include="LibHac" Version="0.19.0" />
|
<PackageVersion Include="LibHac" Version="0.19.0" />
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
|
||||||
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.3.0" />
|
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.3.0" />
|
||||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
|
||||||
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.0" />
|
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.0" />
|
||||||
<PackageVersion Include="MsgPack.Cli" Version="1.0.1" />
|
<PackageVersion Include="MsgPack.Cli" Version="1.0.1" />
|
||||||
<PackageVersion Include="NetCoreServer" Version="8.0.7" />
|
<PackageVersion Include="NetCoreServer" Version="8.0.7" />
|
||||||
|
@ -33,7 +32,7 @@
|
||||||
<PackageVersion Include="OpenTK.Audio.OpenAL" Version="4.8.2" />
|
<PackageVersion Include="OpenTK.Audio.OpenAL" Version="4.8.2" />
|
||||||
<PackageVersion Include="OpenTK.Windowing.GraphicsLibraryFramework" Version="4.8.2" />
|
<PackageVersion Include="OpenTK.Windowing.GraphicsLibraryFramework" Version="4.8.2" />
|
||||||
<PackageVersion Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" />
|
<PackageVersion Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" />
|
||||||
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build13" />
|
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.3-build14" />
|
||||||
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
|
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
|
||||||
<PackageVersion Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
<PackageVersion Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
||||||
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
|
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
|
||||||
|
@ -51,4 +50,4 @@
|
||||||
<PackageVersion Include="System.Management" Version="8.0.0" />
|
<PackageVersion Include="System.Management" Version="8.0.0" />
|
||||||
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
|
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
<PackageReference Include="Avalonia.Markup.Xaml.Loader" />
|
<PackageReference Include="Avalonia.Markup.Xaml.Loader" />
|
||||||
<PackageReference Include="Avalonia.Svg" />
|
<PackageReference Include="Avalonia.Svg" />
|
||||||
<PackageReference Include="Avalonia.Svg.Skia" />
|
<PackageReference Include="Avalonia.Svg.Skia" />
|
||||||
<PackageReference Include="jp2masa.Avalonia.Flexbox" />
|
|
||||||
<PackageReference Include="DynamicData" />
|
<PackageReference Include="DynamicData" />
|
||||||
<PackageReference Include="FluentAvaloniaUI" />
|
<PackageReference Include="FluentAvaloniaUI" />
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
|
|
||||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
|
@ -33,11 +32,10 @@
|
||||||
SelectionChanged="GameList_SelectionChanged">
|
SelectionChanged="GameList_SelectionChanged">
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<flex:FlexPanel
|
<WrapPanel
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Top"
|
||||||
AlignContent="FlexStart"
|
Orientation="Horizontal" />
|
||||||
JustifyContent="FlexStart" />
|
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
<ListBox.Styles>
|
<ListBox.Styles>
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||||
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
|
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
|
||||||
|
@ -40,11 +39,10 @@
|
||||||
ItemsSource="{Binding Profiles}">
|
ItemsSource="{Binding Profiles}">
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<flex:FlexPanel
|
<WrapPanel
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Center"
|
||||||
AlignContent="FlexStart"
|
Orientation="Horizontal"/>
|
||||||
JustifyContent="FlexStart" />
|
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
<ListBox.Styles>
|
<ListBox.Styles>
|
||||||
|
@ -161,4 +159,4 @@
|
||||||
Content="{locale:Locale UserProfilesClose}" />
|
Content="{locale:Locale UserProfilesClose}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
|
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
|
@ -49,13 +48,11 @@
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Height="80"
|
Height="80"
|
||||||
Source="resm:Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png?assembly=Ryujinx.Ui.Common" />
|
Source="resm:Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png?assembly=Ryujinx.Ui.Common" />
|
||||||
<flex:FlexPanel
|
<WrapPanel
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Center"
|
||||||
Direction="Column"
|
Orientation="Vertical">
|
||||||
JustifyContent="SpaceAround"
|
|
||||||
RowSpacing="2">
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
@ -71,7 +68,7 @@
|
||||||
Text="(REE-YOU-JINX)"
|
Text="(REE-YOU-JINX)"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
Width="110" />
|
Width="110" />
|
||||||
</flex:FlexPanel>
|
</WrapPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
public readonly List<InstInfo> Instructions;
|
public readonly List<InstInfo> Instructions;
|
||||||
public readonly bool EndsWithBranch;
|
public readonly bool EndsWithBranch;
|
||||||
public readonly bool HasHostCall;
|
public readonly bool HasHostCall;
|
||||||
|
public readonly bool HasHostCallSkipContext;
|
||||||
public readonly bool IsTruncated;
|
public readonly bool IsTruncated;
|
||||||
public readonly bool IsLoopEnd;
|
public readonly bool IsLoopEnd;
|
||||||
public readonly bool IsThumb;
|
public readonly bool IsThumb;
|
||||||
|
@ -20,6 +21,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
List<InstInfo> instructions,
|
List<InstInfo> instructions,
|
||||||
bool endsWithBranch,
|
bool endsWithBranch,
|
||||||
bool hasHostCall,
|
bool hasHostCall,
|
||||||
|
bool hasHostCallSkipContext,
|
||||||
bool isTruncated,
|
bool isTruncated,
|
||||||
bool isLoopEnd,
|
bool isLoopEnd,
|
||||||
bool isThumb)
|
bool isThumb)
|
||||||
|
@ -31,6 +33,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
Instructions = instructions;
|
Instructions = instructions;
|
||||||
EndsWithBranch = endsWithBranch;
|
EndsWithBranch = endsWithBranch;
|
||||||
HasHostCall = hasHostCall;
|
HasHostCall = hasHostCall;
|
||||||
|
HasHostCallSkipContext = hasHostCallSkipContext;
|
||||||
IsTruncated = isTruncated;
|
IsTruncated = isTruncated;
|
||||||
IsLoopEnd = isLoopEnd;
|
IsLoopEnd = isLoopEnd;
|
||||||
IsThumb = isThumb;
|
IsThumb = isThumb;
|
||||||
|
@ -57,6 +60,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
Instructions.GetRange(0, splitIndex),
|
Instructions.GetRange(0, splitIndex),
|
||||||
false,
|
false,
|
||||||
HasHostCall,
|
HasHostCall,
|
||||||
|
HasHostCallSkipContext,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
IsThumb);
|
IsThumb);
|
||||||
|
@ -67,6 +71,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
Instructions.GetRange(splitIndex, splitCount),
|
Instructions.GetRange(splitIndex, splitCount),
|
||||||
EndsWithBranch,
|
EndsWithBranch,
|
||||||
HasHostCall,
|
HasHostCall,
|
||||||
|
HasHostCallSkipContext,
|
||||||
IsTruncated,
|
IsTruncated,
|
||||||
IsLoopEnd,
|
IsLoopEnd,
|
||||||
IsThumb);
|
IsThumb);
|
||||||
|
|
|
@ -208,6 +208,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
InstMeta meta;
|
InstMeta meta;
|
||||||
InstFlags extraFlags = InstFlags.None;
|
InstFlags extraFlags = InstFlags.None;
|
||||||
bool hasHostCall = false;
|
bool hasHostCall = false;
|
||||||
|
bool hasHostCallSkipContext = false;
|
||||||
bool isTruncated = false;
|
bool isTruncated = false;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -246,9 +247,17 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
meta = InstTableA32<T>.GetMeta(encoding, cpuPreset.Version, cpuPreset.Features);
|
meta = InstTableA32<T>.GetMeta(encoding, cpuPreset.Version, cpuPreset.Features);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta.Name.IsSystemOrCall() && !hasHostCall)
|
if (meta.Name.IsSystemOrCall())
|
||||||
{
|
{
|
||||||
hasHostCall = meta.Name.IsCall() || InstEmitSystem.NeedsCall(meta.Name);
|
if (!hasHostCall)
|
||||||
|
{
|
||||||
|
hasHostCall = InstEmitSystem.NeedsCall(meta.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasHostCallSkipContext)
|
||||||
|
{
|
||||||
|
hasHostCallSkipContext = meta.Name.IsCall() || InstEmitSystem.NeedsCallSkipContext(meta.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
insts.Add(new(encoding, meta.Name, meta.EmitFunc, meta.Flags | extraFlags));
|
insts.Add(new(encoding, meta.Name, meta.EmitFunc, meta.Flags | extraFlags));
|
||||||
|
@ -259,8 +268,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
|
|
||||||
if (!isTruncated && IsBackwardsBranch(meta.Name, encoding))
|
if (!isTruncated && IsBackwardsBranch(meta.Name, encoding))
|
||||||
{
|
{
|
||||||
hasHostCall = true;
|
|
||||||
isLoopEnd = true;
|
isLoopEnd = true;
|
||||||
|
hasHostCallSkipContext = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new(
|
return new(
|
||||||
|
@ -269,6 +278,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
insts,
|
insts,
|
||||||
!isTruncated,
|
!isTruncated,
|
||||||
hasHostCall,
|
hasHostCall,
|
||||||
|
hasHostCallSkipContext,
|
||||||
isTruncated,
|
isTruncated,
|
||||||
isLoopEnd,
|
isLoopEnd,
|
||||||
isThumb);
|
isThumb);
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
{
|
{
|
||||||
public readonly List<Block> Blocks;
|
public readonly List<Block> Blocks;
|
||||||
public readonly bool HasHostCall;
|
public readonly bool HasHostCall;
|
||||||
|
public readonly bool HasHostCallSkipContext;
|
||||||
public readonly bool IsTruncated;
|
public readonly bool IsTruncated;
|
||||||
|
|
||||||
public MultiBlock(List<Block> blocks)
|
public MultiBlock(List<Block> blocks)
|
||||||
|
@ -15,12 +16,14 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
Block block = blocks[0];
|
Block block = blocks[0];
|
||||||
|
|
||||||
HasHostCall = block.HasHostCall;
|
HasHostCall = block.HasHostCall;
|
||||||
|
HasHostCallSkipContext = block.HasHostCallSkipContext;
|
||||||
|
|
||||||
for (int index = 1; index < blocks.Count; index++)
|
for (int index = 1; index < blocks.Count; index++)
|
||||||
{
|
{
|
||||||
block = blocks[index];
|
block = blocks[index];
|
||||||
|
|
||||||
HasHostCall |= block.HasHostCall;
|
HasHostCall |= block.HasHostCall;
|
||||||
|
HasHostCallSkipContext |= block.HasHostCallSkipContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
block = blocks[^1];
|
block = blocks[^1];
|
||||||
|
|
|
@ -106,6 +106,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
if ((regMask & AbiConstants.ReservedRegsMask) == 0)
|
if ((regMask & AbiConstants.ReservedRegsMask) == 0)
|
||||||
{
|
{
|
||||||
_gprMask |= regMask;
|
_gprMask |= regMask;
|
||||||
|
UsedGprsMask |= regMask;
|
||||||
|
|
||||||
return firstCalleeSaved;
|
return firstCalleeSaved;
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,12 +305,23 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
ForceConditionalEnd(cgContext, ref lastCondition, lastConditionIp);
|
ForceConditionalEnd(cgContext, ref lastCondition, lastConditionIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int reservedStackSize = 0;
|
||||||
|
|
||||||
|
if (multiBlock.HasHostCall)
|
||||||
|
{
|
||||||
|
reservedStackSize = CalculateStackSizeForCallSpill(regAlloc.UsedGprsMask, regAlloc.UsedFpSimdMask, UsablePStateMask);
|
||||||
|
}
|
||||||
|
else if (multiBlock.HasHostCallSkipContext)
|
||||||
|
{
|
||||||
|
reservedStackSize = 2 * sizeof(ulong); // Context and page table pointers.
|
||||||
|
}
|
||||||
|
|
||||||
RegisterSaveRestore rsr = new(
|
RegisterSaveRestore rsr = new(
|
||||||
regAlloc.UsedGprsMask & AbiConstants.GprCalleeSavedRegsMask,
|
regAlloc.UsedGprsMask & AbiConstants.GprCalleeSavedRegsMask,
|
||||||
regAlloc.UsedFpSimdMask & AbiConstants.FpSimdCalleeSavedRegsMask,
|
regAlloc.UsedFpSimdMask & AbiConstants.FpSimdCalleeSavedRegsMask,
|
||||||
OperandType.FP64,
|
OperandType.FP64,
|
||||||
multiBlock.HasHostCall,
|
multiBlock.HasHostCall || multiBlock.HasHostCallSkipContext,
|
||||||
multiBlock.HasHostCall ? CalculateStackSizeForCallSpill(regAlloc.UsedGprsMask, regAlloc.UsedFpSimdMask, UsablePStateMask) : 0);
|
reservedStackSize);
|
||||||
|
|
||||||
TailMerger tailMerger = new();
|
TailMerger tailMerger = new();
|
||||||
|
|
||||||
|
@ -596,7 +607,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
name == InstName.Ldm ||
|
name == InstName.Ldm ||
|
||||||
name == InstName.Ldmda ||
|
name == InstName.Ldmda ||
|
||||||
name == InstName.Ldmdb ||
|
name == InstName.Ldmdb ||
|
||||||
name == InstName.Ldmib)
|
name == InstName.Ldmib ||
|
||||||
|
name == InstName.Pop)
|
||||||
{
|
{
|
||||||
// Arm32 does not have a return instruction, instead returns are implemented
|
// Arm32 does not have a return instruction, instead returns are implemented
|
||||||
// either using BX LR (for leaf functions), or POP { ... PC }.
|
// either using BX LR (for leaf functions), or POP { ... PC }.
|
||||||
|
@ -711,7 +723,14 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case BranchType.SyncPoint:
|
case BranchType.SyncPoint:
|
||||||
InstEmitSystem.WriteSyncPoint(context.Writer, context.RegisterAllocator, context.TailMerger, context.GetReservedStackOffset());
|
InstEmitSystem.WriteSyncPoint(
|
||||||
|
context.Writer,
|
||||||
|
ref asm,
|
||||||
|
context.RegisterAllocator,
|
||||||
|
context.TailMerger,
|
||||||
|
context.GetReservedStackOffset(),
|
||||||
|
context.StoreToContext,
|
||||||
|
context.LoadFromContext);
|
||||||
break;
|
break;
|
||||||
case BranchType.SoftwareInterrupt:
|
case BranchType.SoftwareInterrupt:
|
||||||
context.StoreToContext();
|
context.StoreToContext();
|
||||||
|
|
|
@ -199,12 +199,12 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteSpillSkipContext(ref Assembler asm, RegisterAllocator regAlloc, int spillOffset)
|
public static void WriteSpillSkipContext(ref Assembler asm, RegisterAllocator regAlloc, int spillOffset)
|
||||||
{
|
{
|
||||||
WriteSpillOrFillSkipContext(ref asm, regAlloc, spillOffset, spill: true);
|
WriteSpillOrFillSkipContext(ref asm, regAlloc, spillOffset, spill: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteFillSkipContext(ref Assembler asm, RegisterAllocator regAlloc, int spillOffset)
|
public static void WriteFillSkipContext(ref Assembler asm, RegisterAllocator regAlloc, int spillOffset)
|
||||||
{
|
{
|
||||||
WriteSpillOrFillSkipContext(ref asm, regAlloc, spillOffset, spill: false);
|
WriteSpillOrFillSkipContext(ref asm, regAlloc, spillOffset, spill: false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,11 +354,18 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
// All instructions that might do a host call should be included here.
|
// All instructions that might do a host call should be included here.
|
||||||
// That is required to reserve space on the stack for caller saved registers.
|
// That is required to reserve space on the stack for caller saved registers.
|
||||||
|
|
||||||
|
return name == InstName.Mrrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool NeedsCallSkipContext(InstName name)
|
||||||
|
{
|
||||||
|
// All instructions that might do a host call should be included here.
|
||||||
|
// That is required to reserve space on the stack for caller saved registers.
|
||||||
|
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case InstName.Mcr:
|
case InstName.Mcr:
|
||||||
case InstName.Mrc:
|
case InstName.Mrc:
|
||||||
case InstName.Mrrc:
|
|
||||||
case InstName.Svc:
|
case InstName.Svc:
|
||||||
case InstName.Udf:
|
case InstName.Udf:
|
||||||
return true;
|
return true;
|
||||||
|
@ -372,7 +379,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
Assembler asm = new(writer);
|
Assembler asm = new(writer);
|
||||||
|
|
||||||
WriteCall(ref asm, regAlloc, GetBkptHandlerPtr(), skipContext: true, spillBaseOffset, null, pc, imm);
|
WriteCall(ref asm, regAlloc, GetBkptHandlerPtr(), skipContext: true, spillBaseOffset, null, pc, imm);
|
||||||
WriteSyncPoint(writer, ref asm, regAlloc, tailMerger, skipContext: true, spillBaseOffset);
|
WriteSyncPoint(writer, ref asm, regAlloc, tailMerger, spillBaseOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteSvc(CodeWriter writer, RegisterAllocator regAlloc, TailMerger tailMerger, int spillBaseOffset, uint pc, uint svcId)
|
public static void WriteSvc(CodeWriter writer, RegisterAllocator regAlloc, TailMerger tailMerger, int spillBaseOffset, uint pc, uint svcId)
|
||||||
|
@ -380,7 +387,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
Assembler asm = new(writer);
|
Assembler asm = new(writer);
|
||||||
|
|
||||||
WriteCall(ref asm, regAlloc, GetSvcHandlerPtr(), skipContext: true, spillBaseOffset, null, pc, svcId);
|
WriteCall(ref asm, regAlloc, GetSvcHandlerPtr(), skipContext: true, spillBaseOffset, null, pc, svcId);
|
||||||
WriteSyncPoint(writer, ref asm, regAlloc, tailMerger, skipContext: true, spillBaseOffset);
|
WriteSyncPoint(writer, ref asm, regAlloc, tailMerger, spillBaseOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteUdf(CodeWriter writer, RegisterAllocator regAlloc, TailMerger tailMerger, int spillBaseOffset, uint pc, uint imm)
|
public static void WriteUdf(CodeWriter writer, RegisterAllocator regAlloc, TailMerger tailMerger, int spillBaseOffset, uint pc, uint imm)
|
||||||
|
@ -388,7 +395,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
Assembler asm = new(writer);
|
Assembler asm = new(writer);
|
||||||
|
|
||||||
WriteCall(ref asm, regAlloc, GetUdfHandlerPtr(), skipContext: true, spillBaseOffset, null, pc, imm);
|
WriteCall(ref asm, regAlloc, GetUdfHandlerPtr(), skipContext: true, spillBaseOffset, null, pc, imm);
|
||||||
WriteSyncPoint(writer, ref asm, regAlloc, tailMerger, skipContext: true, spillBaseOffset);
|
WriteSyncPoint(writer, ref asm, regAlloc, tailMerger, spillBaseOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteReadCntpct(CodeWriter writer, RegisterAllocator regAlloc, int spillBaseOffset, int rt, int rt2)
|
public static void WriteReadCntpct(CodeWriter writer, RegisterAllocator regAlloc, int spillBaseOffset, int rt, int rt2)
|
||||||
|
@ -422,14 +429,14 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
WriteFill(ref asm, regAlloc, resultMask, skipContext: false, spillBaseOffset, tempRegister);
|
WriteFill(ref asm, regAlloc, resultMask, skipContext: false, spillBaseOffset, tempRegister);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteSyncPoint(CodeWriter writer, RegisterAllocator regAlloc, TailMerger tailMerger, int spillBaseOffset)
|
public static void WriteSyncPoint(
|
||||||
{
|
CodeWriter writer,
|
||||||
Assembler asm = new(writer);
|
ref Assembler asm,
|
||||||
|
RegisterAllocator regAlloc,
|
||||||
WriteSyncPoint(writer, ref asm, regAlloc, tailMerger, skipContext: false, spillBaseOffset);
|
TailMerger tailMerger,
|
||||||
}
|
int spillBaseOffset,
|
||||||
|
Action storeToContext = null,
|
||||||
private static void WriteSyncPoint(CodeWriter writer, ref Assembler asm, RegisterAllocator regAlloc, TailMerger tailMerger, bool skipContext, int spillBaseOffset)
|
Action loadFromContext = null)
|
||||||
{
|
{
|
||||||
int tempRegister = regAlloc.AllocateTempGprRegister();
|
int tempRegister = regAlloc.AllocateTempGprRegister();
|
||||||
|
|
||||||
|
@ -440,7 +447,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
int branchIndex = writer.InstructionPointer;
|
int branchIndex = writer.InstructionPointer;
|
||||||
asm.Cbnz(rt, 0);
|
asm.Cbnz(rt, 0);
|
||||||
|
|
||||||
WriteSpill(ref asm, regAlloc, 1u << tempRegister, skipContext, spillBaseOffset, tempRegister);
|
storeToContext?.Invoke();
|
||||||
|
WriteSpill(ref asm, regAlloc, 1u << tempRegister, skipContext: true, spillBaseOffset, tempRegister);
|
||||||
|
|
||||||
Operand rn = Register(tempRegister == 0 ? 1 : 0);
|
Operand rn = Register(tempRegister == 0 ? 1 : 0);
|
||||||
|
|
||||||
|
@ -449,7 +457,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
|
|
||||||
tailMerger.AddConditionalZeroReturn(writer, asm, Register(0, OperandType.I32));
|
tailMerger.AddConditionalZeroReturn(writer, asm, Register(0, OperandType.I32));
|
||||||
|
|
||||||
WriteFill(ref asm, regAlloc, 1u << tempRegister, skipContext, spillBaseOffset, tempRegister);
|
WriteFill(ref asm, regAlloc, 1u << tempRegister, skipContext: true, spillBaseOffset, tempRegister);
|
||||||
|
loadFromContext?.Invoke();
|
||||||
|
|
||||||
asm.LdrRiUn(rt, Register(regAlloc.FixedContextRegister), NativeContextOffsets.CounterOffset);
|
asm.LdrRiUn(rt, Register(regAlloc.FixedContextRegister), NativeContextOffsets.CounterOffset);
|
||||||
|
|
||||||
|
@ -514,18 +523,31 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
|
|
||||||
private static void WriteSpill(ref Assembler asm, RegisterAllocator regAlloc, uint exceptMask, bool skipContext, int spillOffset, int tempRegister)
|
private static void WriteSpill(ref Assembler asm, RegisterAllocator regAlloc, uint exceptMask, bool skipContext, int spillOffset, int tempRegister)
|
||||||
{
|
{
|
||||||
WriteSpillOrFill(ref asm, regAlloc, skipContext, exceptMask, spillOffset, tempRegister, spill: true);
|
if (skipContext)
|
||||||
|
{
|
||||||
|
InstEmitFlow.WriteSpillSkipContext(ref asm, regAlloc, spillOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WriteSpillOrFill(ref asm, regAlloc, exceptMask, spillOffset, tempRegister, spill: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteFill(ref Assembler asm, RegisterAllocator regAlloc, uint exceptMask, bool skipContext, int spillOffset, int tempRegister)
|
private static void WriteFill(ref Assembler asm, RegisterAllocator regAlloc, uint exceptMask, bool skipContext, int spillOffset, int tempRegister)
|
||||||
{
|
{
|
||||||
WriteSpillOrFill(ref asm, regAlloc, skipContext, exceptMask, spillOffset, tempRegister, spill: false);
|
if (skipContext)
|
||||||
|
{
|
||||||
|
InstEmitFlow.WriteFillSkipContext(ref asm, regAlloc, spillOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WriteSpillOrFill(ref asm, regAlloc, exceptMask, spillOffset, tempRegister, spill: false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteSpillOrFill(
|
private static void WriteSpillOrFill(
|
||||||
ref Assembler asm,
|
ref Assembler asm,
|
||||||
RegisterAllocator regAlloc,
|
RegisterAllocator regAlloc,
|
||||||
bool skipContext,
|
|
||||||
uint exceptMask,
|
uint exceptMask,
|
||||||
int spillOffset,
|
int spillOffset,
|
||||||
int tempRegister,
|
int tempRegister,
|
||||||
|
@ -533,11 +555,6 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
{
|
{
|
||||||
uint gprMask = regAlloc.UsedGprsMask & ~(AbiConstants.GprCalleeSavedRegsMask | exceptMask);
|
uint gprMask = regAlloc.UsedGprsMask & ~(AbiConstants.GprCalleeSavedRegsMask | exceptMask);
|
||||||
|
|
||||||
if (skipContext)
|
|
||||||
{
|
|
||||||
gprMask &= ~Compiler.UsableGprsMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!spill)
|
if (!spill)
|
||||||
{
|
{
|
||||||
// We must reload the status register before reloading the GPRs,
|
// We must reload the status register before reloading the GPRs,
|
||||||
|
@ -600,11 +617,6 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
|
|
||||||
uint fpSimdMask = regAlloc.UsedFpSimdMask;
|
uint fpSimdMask = regAlloc.UsedFpSimdMask;
|
||||||
|
|
||||||
if (skipContext)
|
|
||||||
{
|
|
||||||
fpSimdMask &= ~Compiler.UsableFpSimdMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (fpSimdMask != 0)
|
while (fpSimdMask != 0)
|
||||||
{
|
{
|
||||||
int reg = BitOperations.TrailingZeroCount(fpSimdMask);
|
int reg = BitOperations.TrailingZeroCount(fpSimdMask);
|
||||||
|
|
|
@ -147,6 +147,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
A1B5G5R5Unorm,
|
A1B5G5R5Unorm,
|
||||||
B8G8R8A8Unorm,
|
B8G8R8A8Unorm,
|
||||||
B8G8R8A8Srgb,
|
B8G8R8A8Srgb,
|
||||||
|
B10G10R10A2Unorm,
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FormatExtensions
|
public static class FormatExtensions
|
||||||
|
@ -260,6 +261,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
case Format.R10G10B10A2Sint:
|
case Format.R10G10B10A2Sint:
|
||||||
case Format.R10G10B10A2Uscaled:
|
case Format.R10G10B10A2Uscaled:
|
||||||
case Format.R10G10B10A2Sscaled:
|
case Format.R10G10B10A2Sscaled:
|
||||||
|
case Format.B10G10R10A2Unorm:
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
case Format.S8Uint:
|
case Format.S8Uint:
|
||||||
|
@ -451,6 +453,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
case Format.R32G32Uint:
|
case Format.R32G32Uint:
|
||||||
case Format.B8G8R8A8Unorm:
|
case Format.B8G8R8A8Unorm:
|
||||||
case Format.B8G8R8A8Srgb:
|
case Format.B8G8R8A8Srgb:
|
||||||
|
case Format.B10G10R10A2Unorm:
|
||||||
case Format.R10G10B10A2Unorm:
|
case Format.R10G10B10A2Unorm:
|
||||||
case Format.R10G10B10A2Uint:
|
case Format.R10G10B10A2Uint:
|
||||||
case Format.R8G8B8A8Unorm:
|
case Format.R8G8B8A8Unorm:
|
||||||
|
@ -611,6 +614,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
case Format.B5G5R5A1Unorm:
|
case Format.B5G5R5A1Unorm:
|
||||||
case Format.B8G8R8A8Unorm:
|
case Format.B8G8R8A8Unorm:
|
||||||
case Format.B8G8R8A8Srgb:
|
case Format.B8G8R8A8Srgb:
|
||||||
|
case Format.B10G10R10A2Unorm:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||||
public const int PrimitiveRestartStateIndex = 12;
|
public const int PrimitiveRestartStateIndex = 12;
|
||||||
public const int RenderTargetStateIndex = 27;
|
public const int RenderTargetStateIndex = 27;
|
||||||
|
|
||||||
|
// Vertex buffers larger than this size will be clamped to the mapped size.
|
||||||
|
private const ulong VertexBufferSizeToMappedSizeThreshold = 256 * 1024 * 1024; // 256 MB
|
||||||
|
|
||||||
private readonly GpuContext _context;
|
private readonly GpuContext _context;
|
||||||
private readonly GpuChannel _channel;
|
private readonly GpuChannel _channel;
|
||||||
private readonly DeviceStateWithShadow<ThreedClassState> _state;
|
private readonly DeviceStateWithShadow<ThreedClassState> _state;
|
||||||
|
@ -1144,6 +1147,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||||
|
|
||||||
size = Math.Min(size, maxVertexBufferSize);
|
size = Math.Min(size, maxVertexBufferSize);
|
||||||
}
|
}
|
||||||
|
else if (size > VertexBufferSizeToMappedSizeThreshold)
|
||||||
|
{
|
||||||
|
// Make sure we have a sane vertex buffer size, since in some cases applications
|
||||||
|
// might set the "end address" of the vertex buffer to the end of the GPU address space,
|
||||||
|
// which would result in a several GBs large buffer.
|
||||||
|
|
||||||
|
size = _channel.MemoryManager.GetMappedSize(address, size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||||
R16G16Sint = 0xdc,
|
R16G16Sint = 0xdc,
|
||||||
R16G16Uint = 0xdd,
|
R16G16Uint = 0xdd,
|
||||||
R16G16Float = 0xde,
|
R16G16Float = 0xde,
|
||||||
|
B10G10R10A2Unorm = 0xdf,
|
||||||
R11G11B10Float = 0xe0,
|
R11G11B10Float = 0xe0,
|
||||||
R32Sint = 0xe3,
|
R32Sint = 0xe3,
|
||||||
R32Uint = 0xe4,
|
R32Uint = 0xe4,
|
||||||
|
@ -104,6 +105,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||||
ColorFormat.R16G16Sint => new FormatInfo(Format.R16G16Sint, 1, 1, 4, 2),
|
ColorFormat.R16G16Sint => new FormatInfo(Format.R16G16Sint, 1, 1, 4, 2),
|
||||||
ColorFormat.R16G16Uint => new FormatInfo(Format.R16G16Uint, 1, 1, 4, 2),
|
ColorFormat.R16G16Uint => new FormatInfo(Format.R16G16Uint, 1, 1, 4, 2),
|
||||||
ColorFormat.R16G16Float => new FormatInfo(Format.R16G16Float, 1, 1, 4, 2),
|
ColorFormat.R16G16Float => new FormatInfo(Format.R16G16Float, 1, 1, 4, 2),
|
||||||
|
ColorFormat.B10G10R10A2Unorm => new FormatInfo(Format.B10G10R10A2Unorm, 1, 1, 4, 4),
|
||||||
ColorFormat.R11G11B10Float => new FormatInfo(Format.R11G11B10Float, 1, 1, 4, 3),
|
ColorFormat.R11G11B10Float => new FormatInfo(Format.R11G11B10Float, 1, 1, 4, 3),
|
||||||
ColorFormat.R32Sint => new FormatInfo(Format.R32Sint, 1, 1, 4, 1),
|
ColorFormat.R32Sint => new FormatInfo(Format.R32Sint, 1, 1, 4, 1),
|
||||||
ColorFormat.R32Uint => new FormatInfo(Format.R32Uint, 1, 1, 4, 1),
|
ColorFormat.R32Uint => new FormatInfo(Format.R32Uint, 1, 1, 4, 1),
|
||||||
|
|
|
@ -161,6 +161,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
Add(Format.A1B5G5R5Unorm, new FormatInfo(4, true, false, All.Rgb5A1, PixelFormat.Rgba, PixelType.UnsignedShort5551));
|
Add(Format.A1B5G5R5Unorm, new FormatInfo(4, true, false, All.Rgb5A1, PixelFormat.Rgba, PixelType.UnsignedShort5551));
|
||||||
Add(Format.B8G8R8A8Unorm, new FormatInfo(4, true, false, All.Rgba8, PixelFormat.Rgba, PixelType.UnsignedByte));
|
Add(Format.B8G8R8A8Unorm, new FormatInfo(4, true, false, All.Rgba8, PixelFormat.Rgba, PixelType.UnsignedByte));
|
||||||
Add(Format.B8G8R8A8Srgb, new FormatInfo(4, false, false, All.Srgb8Alpha8, PixelFormat.Rgba, PixelType.UnsignedByte));
|
Add(Format.B8G8R8A8Srgb, new FormatInfo(4, false, false, All.Srgb8Alpha8, PixelFormat.Rgba, PixelType.UnsignedByte));
|
||||||
|
Add(Format.B10G10R10A2Unorm, new FormatInfo(4, false, false, All.Rgb10A2, PixelFormat.Rgba, PixelType.UnsignedInt2101010Reversed));
|
||||||
|
|
||||||
Add(Format.R8Unorm, SizedInternalFormat.R8);
|
Add(Format.R8Unorm, SizedInternalFormat.R8);
|
||||||
Add(Format.R8Uint, SizedInternalFormat.R8ui);
|
Add(Format.R8Uint, SizedInternalFormat.R8ui);
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
|
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
|
||||||
<ProjectReference Include="..\Ryujinx.Graphics.Device\Ryujinx.Graphics.Device.csproj" />
|
<ProjectReference Include="..\Ryujinx.Graphics.Device\Ryujinx.Graphics.Device.csproj" />
|
||||||
<ProjectReference Include="..\Ryujinx.Graphics.Host1x\Ryujinx.Graphics.Host1x.csproj" />
|
|
||||||
<ProjectReference Include="..\Ryujinx.Graphics.Texture\Ryujinx.Graphics.Texture.csproj" />
|
<ProjectReference Include="..\Ryujinx.Graphics.Texture\Ryujinx.Graphics.Texture.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
Add(Format.A1B5G5R5Unorm, VkFormat.R5G5B5A1UnormPack16);
|
Add(Format.A1B5G5R5Unorm, VkFormat.R5G5B5A1UnormPack16);
|
||||||
Add(Format.B8G8R8A8Unorm, VkFormat.B8G8R8A8Unorm);
|
Add(Format.B8G8R8A8Unorm, VkFormat.B8G8R8A8Unorm);
|
||||||
Add(Format.B8G8R8A8Srgb, VkFormat.B8G8R8A8Srgb);
|
Add(Format.B8G8R8A8Srgb, VkFormat.B8G8R8A8Srgb);
|
||||||
|
Add(Format.B10G10R10A2Unorm, VkFormat.A2R10G10B10UnormPack32);
|
||||||
#pragma warning restore IDE0055
|
#pragma warning restore IDE0055
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,13 @@ using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using ShellLink;
|
using ShellLink;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
|
using SixLabors.ImageSharp.Formats.Png;
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
|
using SixLabors.ImageSharp.Processing;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
using Image = System.Drawing.Image;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ui.Common.Helper
|
namespace Ryujinx.Ui.Common.Helper
|
||||||
{
|
{
|
||||||
|
@ -23,12 +21,9 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
iconPath += ".ico";
|
iconPath += ".ico";
|
||||||
|
|
||||||
MemoryStream iconDataStream = new(iconData);
|
MemoryStream iconDataStream = new(iconData);
|
||||||
using Image image = Image.FromStream(iconDataStream);
|
var image = Image.Load(iconDataStream);
|
||||||
using Bitmap bitmap = new(128, 128);
|
image.Mutate(x => x.Resize(128, 128));
|
||||||
using System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(bitmap);
|
SaveBitmapAsIcon(image, iconPath);
|
||||||
graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
|
||||||
graphic.DrawImage(image, 0, 0, 128, 128);
|
|
||||||
SaveBitmapAsIcon(bitmap, iconPath);
|
|
||||||
|
|
||||||
var shortcut = Shortcut.CreateShortcut(basePath, GetArgsString(applicationFilePath), iconPath, 0);
|
var shortcut = Shortcut.CreateShortcut(basePath, GetArgsString(applicationFilePath), iconPath, 0);
|
||||||
shortcut.StringData.NameString = cleanedAppName;
|
shortcut.StringData.NameString = cleanedAppName;
|
||||||
|
@ -42,7 +37,7 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
var desktopFile = EmbeddedResources.ReadAllText("Ryujinx.Ui.Common/shortcut-template.desktop");
|
var desktopFile = EmbeddedResources.ReadAllText("Ryujinx.Ui.Common/shortcut-template.desktop");
|
||||||
iconPath += ".png";
|
iconPath += ".png";
|
||||||
|
|
||||||
var image = SixLabors.ImageSharp.Image.Load<Rgba32>(iconData);
|
var image = Image.Load<Rgba32>(iconData);
|
||||||
image.SaveAsPng(iconPath);
|
image.SaveAsPng(iconPath);
|
||||||
|
|
||||||
using StreamWriter outputFile = new(Path.Combine(desktopPath, cleanedAppName + ".desktop"));
|
using StreamWriter outputFile = new(Path.Combine(desktopPath, cleanedAppName + ".desktop"));
|
||||||
|
@ -83,7 +78,7 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
}
|
}
|
||||||
|
|
||||||
const string IconName = "icon.png";
|
const string IconName = "icon.png";
|
||||||
var image = SixLabors.ImageSharp.Image.Load<Rgba32>(iconData);
|
var image = Image.Load<Rgba32>(iconData);
|
||||||
image.SaveAsPng(Path.Combine(resourceFolderPath, IconName));
|
image.SaveAsPng(Path.Combine(resourceFolderPath, IconName));
|
||||||
|
|
||||||
// plist file
|
// plist file
|
||||||
|
@ -147,7 +142,7 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
/// <param name="source">The source bitmap image that will be saved as an .ico file</param>
|
/// <param name="source">The source bitmap image that will be saved as an .ico file</param>
|
||||||
/// <param name="filePath">The location that the new .ico file will be saved too (Make sure to include '.ico' in the path).</param>
|
/// <param name="filePath">The location that the new .ico file will be saved too (Make sure to include '.ico' in the path).</param>
|
||||||
[SupportedOSPlatform("windows")]
|
[SupportedOSPlatform("windows")]
|
||||||
private static void SaveBitmapAsIcon(Bitmap source, string filePath)
|
private static void SaveBitmapAsIcon(Image source, string filePath)
|
||||||
{
|
{
|
||||||
// Code Modified From https://stackoverflow.com/a/11448060/368354 by Benlitz
|
// Code Modified From https://stackoverflow.com/a/11448060/368354 by Benlitz
|
||||||
byte[] header = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 32, 0, 0, 0, 0, 0, 22, 0, 0, 0 };
|
byte[] header = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 32, 0, 0, 0, 0, 0, 22, 0, 0, 0 };
|
||||||
|
@ -155,7 +150,7 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
|
|
||||||
fs.Write(header);
|
fs.Write(header);
|
||||||
// Writing actual data
|
// Writing actual data
|
||||||
source.Save(fs, ImageFormat.Png);
|
source.Save(fs, PngFormat.Instance);
|
||||||
// Getting data length (file length minus header)
|
// Getting data length (file length minus header)
|
||||||
long dataLength = fs.Length - header.Length;
|
long dataLength = fs.Length - header.Length;
|
||||||
// Write it in the correct place
|
// Write it in the correct place
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DiscordRichPresence" />
|
<PackageReference Include="DiscordRichPresence" />
|
||||||
<PackageReference Include="securifybv.ShellLink" />
|
<PackageReference Include="securifybv.ShellLink" />
|
||||||
<PackageReference Include="System.Drawing.Common" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in a new issue