Compare commits

..

2 Commits

Author SHA1 Message Date
Daenorth
9b6f409a86 Merge branch 'master' into master 2024-12-22 03:01:37 +01:00
Daenorth
30728e3053 Update Norwegian Translation
swiggybobo
2024-12-21 07:21:42 +01:00
18 changed files with 331 additions and 246 deletions

View File

@@ -6,6 +6,7 @@ namespace Ryujinx.Common
// DO NOT EDIT, filled by CI
public static class ReleaseInformation
{
private const string FlatHubChannel = "flathub";
private const string CanaryChannel = "canary";
private const string ReleaseChannel = "release";
@@ -28,6 +29,8 @@ namespace Ryujinx.Common
!ReleaseChannelRepo.StartsWith("%%") &&
!ConfigFileName.StartsWith("%%");
public static bool IsFlatHubBuild => IsValid && ReleaseChannelOwner.Equals(FlatHubChannel);
public static bool IsCanaryBuild => IsValid && ReleaseChannelName.Equals(CanaryChannel);
public static bool IsReleaseBuild => IsValid && ReleaseChannelName.Equals(ReleaseChannel);

View File

@@ -230,20 +230,25 @@ namespace Ryujinx.Cpu.AppleHv
{
if (size == 0)
{
yield break;
return Enumerable.Empty<HostMemoryRange>();
}
var guestRegions = GetPhysicalRegionsImpl(va, size);
if (guestRegions == null)
{
yield break;
return null;
}
foreach (var guestRegion in guestRegions)
var regions = new HostMemoryRange[guestRegions.Count];
for (int i = 0; i < regions.Length; i++)
{
var guestRegion = guestRegions[i];
nint pointer = _backingMemory.GetPointer(guestRegion.Address, guestRegion.Size);
yield return new HostMemoryRange((nuint)(ulong)pointer, guestRegion.Size);
regions[i] = new HostMemoryRange((nuint)(ulong)pointer, guestRegion.Size);
}
return regions;
}
/// <inheritdoc/>
@@ -251,24 +256,23 @@ namespace Ryujinx.Cpu.AppleHv
{
if (size == 0)
{
yield break;
return Enumerable.Empty<MemoryRange>();
}
foreach (var physicalRegion in GetPhysicalRegionsImpl(va, size))
{
yield return physicalRegion;
}
return GetPhysicalRegionsImpl(va, size);
}
private IEnumerable<MemoryRange> GetPhysicalRegionsImpl(ulong va, ulong size)
private List<MemoryRange> GetPhysicalRegionsImpl(ulong va, ulong size)
{
if (!ValidateAddress(va) || !ValidateAddressAndSize(va, size))
{
yield break;
return null;
}
int pages = GetPagesCount(va, (uint)size, out va);
var regions = new List<MemoryRange>();
ulong regionStart = GetPhysicalAddressInternal(va);
ulong regionSize = PageSize;
@@ -276,14 +280,14 @@ namespace Ryujinx.Cpu.AppleHv
{
if (!ValidateAddress(va + PageSize))
{
yield break;
return null;
}
ulong newPa = GetPhysicalAddressInternal(va + PageSize);
if (GetPhysicalAddressInternal(va) + PageSize != newPa)
{
yield return new MemoryRange(regionStart, regionSize);
regions.Add(new MemoryRange(regionStart, regionSize));
regionStart = newPa;
regionSize = 0;
}
@@ -292,7 +296,9 @@ namespace Ryujinx.Cpu.AppleHv
regionSize += PageSize;
}
yield return new MemoryRange(regionStart, regionSize);
regions.Add(new MemoryRange(regionStart, regionSize));
return regions;
}
/// <remarks>

View File

@@ -250,20 +250,25 @@ namespace Ryujinx.Cpu.Jit
{
if (size == 0)
{
yield break;
return Enumerable.Empty<HostMemoryRange>();
}
var guestRegions = GetPhysicalRegionsImpl(va, size);
if (guestRegions == null)
{
yield break;
return null;
}
foreach (var guestRegion in guestRegions)
var regions = new HostMemoryRange[guestRegions.Count];
for (int i = 0; i < regions.Length; i++)
{
var guestRegion = guestRegions[i];
nint pointer = _backingMemory.GetPointer(guestRegion.Address, guestRegion.Size);
yield return new HostMemoryRange((nuint)(ulong)pointer, guestRegion.Size);
regions[i] = new HostMemoryRange((nuint)(ulong)pointer, guestRegion.Size);
}
return regions;
}
/// <inheritdoc/>
@@ -271,24 +276,23 @@ namespace Ryujinx.Cpu.Jit
{
if (size == 0)
{
yield break;
return Enumerable.Empty<MemoryRange>();
}
foreach (var physicalRegion in GetPhysicalRegionsImpl(va, size))
{
yield return physicalRegion;
}
return GetPhysicalRegionsImpl(va, size);
}
private IEnumerable<MemoryRange> GetPhysicalRegionsImpl(ulong va, ulong size)
private List<MemoryRange> GetPhysicalRegionsImpl(ulong va, ulong size)
{
if (!ValidateAddress(va) || !ValidateAddressAndSize(va, size))
{
yield break;
return null;
}
int pages = GetPagesCount(va, (uint)size, out va);
var regions = new List<MemoryRange>();
ulong regionStart = GetPhysicalAddressInternal(va);
ulong regionSize = PageSize;
@@ -296,14 +300,14 @@ namespace Ryujinx.Cpu.Jit
{
if (!ValidateAddress(va + PageSize))
{
yield break;
return null;
}
ulong newPa = GetPhysicalAddressInternal(va + PageSize);
if (GetPhysicalAddressInternal(va) + PageSize != newPa)
{
yield return new MemoryRange(regionStart, regionSize);
regions.Add(new MemoryRange(regionStart, regionSize));
regionStart = newPa;
regionSize = 0;
}
@@ -312,7 +316,9 @@ namespace Ryujinx.Cpu.Jit
regionSize += PageSize;
}
yield return new MemoryRange(regionStart, regionSize);
regions.Add(new MemoryRange(regionStart, regionSize));
return regions;
}
/// <inheritdoc/>

View File

@@ -475,15 +475,17 @@ namespace Ryujinx.Cpu.Jit
return GetPhysicalRegionsImpl(va, size);
}
private IEnumerable<MemoryRange> GetPhysicalRegionsImpl(ulong va, ulong size)
private List<MemoryRange> GetPhysicalRegionsImpl(ulong va, ulong size)
{
if (!ValidateAddress(va) || !ValidateAddressAndSize(va, size))
{
yield break;
return null;
}
int pages = GetPagesCount(va, (uint)size, out va);
var regions = new List<MemoryRange>();
ulong regionStart = GetPhysicalAddressInternal(va);
ulong regionSize = PageSize;
@@ -491,14 +493,14 @@ namespace Ryujinx.Cpu.Jit
{
if (!ValidateAddress(va + PageSize))
{
yield break;
return null;
}
ulong newPa = GetPhysicalAddressInternal(va + PageSize);
if (GetPhysicalAddressInternal(va) + PageSize != newPa)
{
yield return new MemoryRange(regionStart, regionSize);
regions.Add(new MemoryRange(regionStart, regionSize));
regionStart = newPa;
regionSize = 0;
}
@@ -507,7 +509,9 @@ namespace Ryujinx.Cpu.Jit
regionSize += PageSize;
}
yield return new MemoryRange(regionStart, regionSize);
regions.Add(new MemoryRange(regionStart, regionSize));
return regions;
}
/// <inheritdoc/>

View File

@@ -8,6 +8,8 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
{
public IEnumerable<ulong> GetCallStack(nint framePointer, nint codeRegionStart, int codeRegionSize, nint codeRegion2Start, int codeRegion2Size)
{
List<ulong> functionPointers = new();
while (true)
{
nint functionPointer = Marshal.ReadIntPtr(framePointer, nint.Size);
@@ -18,9 +20,11 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
break;
}
yield return (ulong)functionPointer - 4;
functionPointers.Add((ulong)functionPointer - 4);
framePointer = Marshal.ReadIntPtr(framePointer);
}
return functionPointers;
}
}
}

View File

@@ -168,14 +168,16 @@ namespace Ryujinx.Graphics.Vulkan
return BinarySearch(list, offset, size) >= 0;
}
public readonly IEnumerable<Range> FindOverlaps(int offset, int size)
public readonly List<Range> FindOverlaps(int offset, int size)
{
var list = _ranges;
if (list == null)
{
yield break;
return null;
}
List<Range> result = null;
int index = BinarySearch(list, offset, size);
if (index >= 0)
@@ -187,10 +189,12 @@ namespace Ryujinx.Graphics.Vulkan
do
{
yield return list[index++];
(result ??= new List<Range>()).Add(list[index++]);
}
while (index < list.Count && list[index].OverlapsWith(offset, size));
}
return result;
}
private static int BinarySearch(List<Range> list, int offset, int size)

View File

@@ -341,7 +341,7 @@ namespace Ryujinx.HLE.HOS
{
if (VirtualAmiibo.ApplicationBytes.Length > 0)
{
VirtualAmiibo.ApplicationBytes = Array.Empty<byte>();
VirtualAmiibo.ApplicationBytes = new byte[0];
VirtualAmiibo.InputBin = string.Empty;
}
if (NfpDevices[nfpDeviceId].State == NfpDeviceState.SearchingForTag)
@@ -356,7 +356,7 @@ namespace Ryujinx.HLE.HOS
VirtualAmiibo.InputBin = path;
if (VirtualAmiibo.ApplicationBytes.Length > 0)
{
VirtualAmiibo.ApplicationBytes = Array.Empty<byte>();
VirtualAmiibo.ApplicationBytes = new byte[0];
}
byte[] encryptedData = File.ReadAllBytes(path);
VirtualAmiiboFile newFile = AmiiboBinReader.ReadBinFile(encryptedData);

View File

@@ -15,8 +15,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
private readonly long[] _current2;
private readonly long[] _peak;
// type is not Lock due to Monitor class usage
private readonly object _lock = new();
private readonly Lock _lock = new();
private readonly LinkedList<KThread> _waitingThreads;

View File

@@ -357,6 +357,7 @@ namespace Ryujinx.HLE.HOS
{
string cheatName = DefaultCheatName;
List<string> instructions = new();
List<Cheat> cheats = new();
using StreamReader cheatData = cheatFile.OpenText();
while (cheatData.ReadLine() is { } line)
@@ -372,13 +373,13 @@ namespace Ryujinx.HLE.HOS
Logger.Warning?.Print(LogClass.ModLoader, $"Ignoring cheat '{cheatFile.FullName}' because it is malformed");
yield break;
return Array.Empty<Cheat>();
}
// Add the previous section to the list.
if (instructions.Count > 0)
{
yield return new Cheat($"<{cheatName} Cheat>", cheatFile, instructions);
cheats.Add(new Cheat($"<{cheatName} Cheat>", cheatFile, instructions));
}
// Start a new cheat section.
@@ -395,8 +396,10 @@ namespace Ryujinx.HLE.HOS
// Add the last section being processed.
if (instructions.Count > 0)
{
yield return new Cheat($"<{cheatName} Cheat>", cheatFile, instructions);
cheats.Add(new Cheat($"<{cheatName} Cheat>", cheatFile, instructions));
}
return cheats;
}
// Assumes searchDirPaths don't overlap

View File

@@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
static class VirtualAmiibo
{
public static uint OpenedApplicationAreaId;
public static byte[] ApplicationBytes = Array.Empty<byte>();
public static byte[] ApplicationBytes = new byte[0];
public static string InputBin = string.Empty;
public static string NickName = string.Empty;
private static readonly AmiiboJsonSerializerContext _serializerContext = AmiiboJsonSerializerContext.Default;
@@ -137,7 +137,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
if (ApplicationBytes.Length > 0)
{
byte[] bytes = ApplicationBytes;
ApplicationBytes = Array.Empty<byte>();
ApplicationBytes = new byte[0];
return bytes;
}
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);

View File

@@ -106,13 +106,10 @@ namespace Ryujinx.Memory
{
if (size == 0)
{
yield break;
return Enumerable.Empty<HostMemoryRange>();
}
foreach (var hostRegion in GetHostRegionsImpl(va, size))
{
yield return hostRegion;
}
return GetHostRegionsImpl(va, size);
}
/// <inheritdoc/>
@@ -120,36 +117,51 @@ namespace Ryujinx.Memory
{
if (size == 0)
{
yield break;
return Enumerable.Empty<MemoryRange>();
}
var hostRegions = GetHostRegionsImpl(va, size);
if (hostRegions == null)
{
yield break;
return null;
}
var regions = new MemoryRange[hostRegions.Count];
ulong backingStart = (ulong)_backingMemory.Pointer;
ulong backingEnd = backingStart + _backingMemory.Size;
foreach (var hostRegion in hostRegions)
int count = 0;
for (int i = 0; i < regions.Length; i++)
{
var hostRegion = hostRegions[i];
if (hostRegion.Address >= backingStart && hostRegion.Address < backingEnd)
{
yield return new MemoryRange(hostRegion.Address - backingStart, hostRegion.Size);
regions[count++] = new MemoryRange(hostRegion.Address - backingStart, hostRegion.Size);
}
}
if (count != regions.Length)
{
return new ArraySegment<MemoryRange>(regions, 0, count);
}
return regions;
}
private IEnumerable<HostMemoryRange> GetHostRegionsImpl(ulong va, ulong size)
private List<HostMemoryRange> GetHostRegionsImpl(ulong va, ulong size)
{
if (!ValidateAddress(va) || !ValidateAddressAndSize(va, size))
{
yield break;
return null;
}
int pages = GetPagesCount(va, size, out va);
var regions = new List<HostMemoryRange>();
nuint regionStart = GetHostAddress(va);
ulong regionSize = PageSize;
@@ -157,14 +169,14 @@ namespace Ryujinx.Memory
{
if (!ValidateAddress(va + PageSize))
{
yield break;
return null;
}
nuint newHostAddress = GetHostAddress(va + PageSize);
if (GetHostAddress(va) + PageSize != newHostAddress)
{
yield return new HostMemoryRange(regionStart, regionSize);
regions.Add(new HostMemoryRange(regionStart, regionSize));
regionStart = newHostAddress;
regionSize = 0;
}
@@ -173,7 +185,9 @@ namespace Ryujinx.Memory
regionSize += PageSize;
}
yield return new HostMemoryRange(regionStart, regionSize);
regions.Add(new HostMemoryRange(regionStart, regionSize));
return regions;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@@ -23,7 +23,7 @@ namespace Ryujinx.UI.Common.Helper
[LibraryImport("shell32.dll", SetLastError = true)]
public static partial void SHChangeNotify(uint wEventId, uint uFlags, nint dwItem1, nint dwItem2);
public static bool IsTypeAssociationSupported => (OperatingSystem.IsLinux() || OperatingSystem.IsWindows());
public static bool IsTypeAssociationSupported => (OperatingSystem.IsLinux() || OperatingSystem.IsWindows()) && !ReleaseInformation.IsFlatHubBuild;
public static bool AreMimeTypesRegistered
{

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,7 @@
<MenuItem
Click="CreateApplicationShortcut_Click"
Header="{ext:Locale GameListContextMenuCreateShortcut}"
IsEnabled="{Binding CreateShortcutEnabled}"
Icon="{ext:Icon fa-solid fa-bookmark}"
ToolTip.Tip="{OnPlatform Default={ext:Locale GameListContextMenuCreateShortcutToolTip}, macOS={ext:Locale GameListContextMenuCreateShortcutToolTipMacOS}}" />
<Separator />

View File

@@ -424,6 +424,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool OpenBcatSaveDirectoryEnabled => !SelectedApplication.ControlHolder.ByteSpan.IsZeros() && SelectedApplication.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
public bool CreateShortcutEnabled => !ReleaseInformation.IsFlatHubBuild;
public string LoadHeading
{
get => _loadHeading;

View File

@@ -181,11 +181,15 @@
SelectedTime="{Binding CurrentTime}"
Width="350"
ToolTip.Tip="{ext:Locale TimeTooltip}" />
</StackPanel>
<StackPanel
Margin="350,0,0,10"
Orientation="Horizontal">
<Button
Margin="10, 0, 0, 0"
VerticalAlignment="Center"
Click="MatchSystemTime_OnClick"
Background="{DynamicResource SystemAccentColor}"
Width="150"
ToolTip.Tip="{ext:Locale MatchTimeTooltip}">
<TextBlock Text="{ext:Locale SettingsTabSystemSystemTimeMatch}" />
</Button>

View File

@@ -1,7 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Ryujinx.Ava.UI.ViewModels;
using System;
using TimeZone = Ryujinx.Ava.UI.Models.TimeZone;
namespace Ryujinx.Ava.UI.Views.Settings

View File

@@ -686,11 +686,22 @@ namespace Ryujinx.Ava
#else
if (showWarnings)
{
Dispatcher.UIThread.InvokeAsync(() =>
ContentDialogHelper.CreateWarningDialog(
LocaleManager.Instance[LocaleKeys.UpdaterDisabledWarningTitle],
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildSubMessage])
if (ReleaseInformation.IsFlatHubBuild)
{
Dispatcher.UIThread.InvokeAsync(() =>
ContentDialogHelper.CreateWarningDialog(
LocaleManager.Instance[LocaleKeys.UpdaterDisabledWarningTitle],
LocaleManager.Instance[LocaleKeys.DialogUpdaterFlatpakNotSupportedMessage])
);
}
else
{
Dispatcher.UIThread.InvokeAsync(() =>
ContentDialogHelper.CreateWarningDialog(
LocaleManager.Instance[LocaleKeys.UpdaterDisabledWarningTitle],
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildSubMessage])
);
}
}
return false;