Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to .NET 9 #198

Merged
merged 13 commits into from
Dec 20, 2024
2 changes: 1 addition & 1 deletion COMPILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ If you wish to build the emulator yourself, follow these steps:

### Step 1

Install the [.NET 8.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/8.0).
Install the [.NET 9.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/9.0).
Make sure your SDK version is higher or equal to the required version specified in [global.json](global.json).

### Step 2
Expand Down
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
marco-carvalho marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<PackageVersion Include="SkiaSharp" Version="2.88.7" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="2.88.7" />
<PackageVersion Include="SPB" Version="0.0.4-build32" />
<PackageVersion Include="System.IO.Hashing" Version="8.0.0" />
<PackageVersion Include="System.Management" Version="8.0.0" />
<PackageVersion Include="System.IO.Hashing" Version="9.0.0" />
<PackageVersion Include="System.Management" Version="9.0.0" />
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ failing to meet this requirement may result in a poor gameplay experience or une

## Latest build

Stable builds are made every so often onto a separate "release" branch that then gets put into the releases you know and love.
Stable builds are made every so often onto a separate "release" branch that then gets put into the releases you know and love.
These stable builds exist so that the end user can get a more **enjoyable and stable experience**.

You can find the latest stable release [here](https://github.com/GreemDev/Ryujinx/releases/latest).
Expand Down Expand Up @@ -82,7 +82,7 @@ If you are planning to contribute or just want to learn more about this project
It translates the ARM code to a custom IR, performs a few optimizations, and turns that into x86 code.
There are three memory manager options available depending on the user's preference, leveraging both software-based (slower) and host-mapped modes (much faster).
The fastest option (host, unchecked) is set by default.
Ryujinx also features an optional Profiled Persistent Translation Cache, which essentially caches translated functions so that they do not need to be translated every time the game loads.
Ryujinx also features an optional Profiled Persistent Translation Cache, which essentially caches translated functions so that they do not need to be translated every time the game loads.
The net result is a significant reduction in load times (the amount of time between launching a game and arriving at the title screen) for nearly every game.
NOTE: This feature is enabled by default in the Options menu > System tab.
You must launch the game at least twice to the title screen or beyond before performance improvements are unlocked on the third launch!
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
1 change: 0 additions & 1 deletion src/ARMeilleure/ARMeilleure.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/ARMeilleure/Decoders/DecoderHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ARMeilleure.Common;
using System;

namespace ARMeilleure.Decoders
{
Expand Down Expand Up @@ -149,7 +150,7 @@ public static long DecodeImmS14_2(int opCode)
return (((long)opCode << 45) >> 48) & ~3;
}

public static bool VectorArgumentsInvalid(bool q, params int[] args)
public static bool VectorArgumentsInvalid(bool q, params ReadOnlySpan<int> args)
{
if (q)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/Instructions/SoftFallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static V128 Tbx4(V128 dest, V128 vector, int bytes, V128 tb0, V128 tb1, V
return TblOrTbx(dest, vector, bytes, tb0, tb1, tb2, tb3);
}

private static V128 TblOrTbx(V128 dest, V128 vector, int bytes, params V128[] tb)
private static V128 TblOrTbx(V128 dest, V128 vector, int bytes, params ReadOnlySpan<V128> tb)
{
byte[] res = new byte[16];

Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/IntermediateRepresentation/Operation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public static Operation Operation(Instruction inst, Operand dest, Operand[] srcs
return result;
}

public static Operation Operation(Intrinsic intrin, Operand dest, params Operand[] srcs)
public static Operation Operation(Intrinsic intrin, Operand dest, params ReadOnlySpan<Operand> srcs)
{
Operation result = Make(Instruction.Extended, 0, srcs.Length);

Expand Down
3 changes: 2 additions & 1 deletion src/ARMeilleure/Translation/Cache/JitCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;

namespace ARMeilleure.Translation.Cache
{
Expand All @@ -26,7 +27,7 @@ static partial class JitCache

private static readonly List<CacheEntry> _cacheEntries = new();

private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static bool _initialized;

[SupportedOSPlatform("windows")]
Expand Down
10 changes: 5 additions & 5 deletions src/ARMeilleure/Translation/EmitterContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -559,27 +559,27 @@ private Operand Add(Instruction inst, Operand dest, Operand source0, Operand sou
return dest;
}

public Operand AddIntrinsic(Intrinsic intrin, params Operand[] args)
public Operand AddIntrinsic(Intrinsic intrin, params ReadOnlySpan<Operand> args)
{
return Add(intrin, Local(OperandType.V128), args);
}

public Operand AddIntrinsicInt(Intrinsic intrin, params Operand[] args)
public Operand AddIntrinsicInt(Intrinsic intrin, params ReadOnlySpan<Operand> args)
{
return Add(intrin, Local(OperandType.I32), args);
}

public Operand AddIntrinsicLong(Intrinsic intrin, params Operand[] args)
public Operand AddIntrinsicLong(Intrinsic intrin, params ReadOnlySpan<Operand> args)
{
return Add(intrin, Local(OperandType.I64), args);
}

public void AddIntrinsicNoRet(Intrinsic intrin, params Operand[] args)
public void AddIntrinsicNoRet(Intrinsic intrin, params ReadOnlySpan<Operand> args)
{
Add(intrin, default, args);
}

private Operand Add(Intrinsic intrin, Operand dest, params Operand[] sources)
private Operand Add(Intrinsic intrin, Operand dest, params ReadOnlySpan<Operand> sources)
{
NewNextBlockIfNeeded();

Expand Down
4 changes: 1 addition & 3 deletions src/ARMeilleure/Translation/PTC/Ptc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Ptc : IPtcLoadState

private readonly ManualResetEvent _waitEvent;

private readonly object _lock;
private readonly Lock _lock = new();

private bool _disposed;

Expand Down Expand Up @@ -89,8 +89,6 @@ public Ptc()

_waitEvent = new ManualResetEvent(true);

_lock = new object();

_disposed = false;

TitleIdText = TitleIdTextDefault;
Expand Down
4 changes: 1 addition & 3 deletions src/ARMeilleure/Translation/PTC/PtcProfiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PtcProfiler

private readonly ManualResetEvent _waitEvent;

private readonly object _lock;
private readonly Lock _lock = new();

private bool _disposed;

Expand All @@ -65,8 +65,6 @@ public PtcProfiler(Ptc ptc)

_waitEvent = new ManualResetEvent(true);

_lock = new object();

_disposed = false;

ProfiledFuncs = new Dictionary<ulong, FuncProfile>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;

namespace Ryujinx.Audio.Backends.OpenAL
{
Expand All @@ -18,7 +19,7 @@ class OpenALHardwareDeviceSession : HardwareDeviceSessionOutputBase
private ulong _playedSampleCount;
private float _volume;

private readonly object _lock = new();
private readonly Lock _lock = new();

public OpenALHardwareDeviceSession(OpenALHardwareDeviceDriver driver, IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount) : base(memoryManager, requestedSampleFormat, requestedSampleRate, requestedChannelCount)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Audio/AudioManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AudioManager : IDisposable
/// <summary>
/// Lock used to control the waiters registration.
/// </summary>
private readonly object _lock = new();
private readonly Lock _lock = new();

/// <summary>
/// Events signaled when the driver played audio buffers.
Expand Down
3 changes: 2 additions & 1 deletion src/Ryujinx.Audio/Backends/Common/DynamicRingBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Ryujinx.Common.Memory;
using System;
using System.Buffers;
using System.Threading;

namespace Ryujinx.Audio.Backends.Common
{
Expand All @@ -12,7 +13,7 @@ public class DynamicRingBuffer
{
private const int RingBufferAlignment = 2048;

private readonly object _lock = new();
private readonly Lock _lock = new();

private MemoryOwner<byte> _bufferOwner;
private Memory<byte> _buffer;
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Audio/Input/AudioInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace Ryujinx.Audio.Input
/// </summary>
public class AudioInputManager : IDisposable
{
private readonly object _lock = new();
private readonly Lock _lock = new();

/// <summary>
/// Lock used for session allocation.
/// </summary>
private readonly object _sessionLock = new();
private readonly Lock _sessionLock = new();

/// <summary>
/// The session ids allocation table.
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Audio/Input/AudioInputSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class AudioInputSystem : IDisposable
/// <summary>
/// The lock of the parent.
/// </summary>
private readonly object _parentLock;
private readonly Lock _parentLock;

/// <summary>
/// The dispose state.
Expand All @@ -62,7 +62,7 @@ public class AudioInputSystem : IDisposable
/// <param name="parentLock">The lock of the manager</param>
/// <param name="deviceSession">The hardware device session</param>
/// <param name="bufferEvent">The buffer release event of the audio input</param>
public AudioInputSystem(AudioInputManager manager, object parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
public AudioInputSystem(AudioInputManager manager, Lock parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
{
_manager = manager;
_parentLock = parentLock;
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Audio/Output/AudioOutputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace Ryujinx.Audio.Output
/// </summary>
public class AudioOutputManager : IDisposable
{
private readonly object _lock = new();
private readonly Lock _lock = new();

/// <summary>
/// Lock used for session allocation.
/// </summary>
private readonly object _sessionLock = new();
private readonly Lock _sessionLock = new();

/// <summary>
/// The session ids allocation table.
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Audio/Output/AudioOutputSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class AudioOutputSystem : IDisposable
/// <summary>
/// THe lock of the parent.
/// </summary>
private readonly object _parentLock;
private readonly Lock _parentLock;

/// <summary>
/// The dispose state.
Expand All @@ -62,7 +62,7 @@ public class AudioOutputSystem : IDisposable
/// <param name="parentLock">The lock of the manager</param>
/// <param name="deviceSession">The hardware device session</param>
/// <param name="bufferEvent">The buffer release event of the audio output</param>
public AudioOutputSystem(AudioOutputManager manager, object parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
public AudioOutputSystem(AudioOutputManager manager, Lock parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
{
_manager = manager;
_parentLock = parentLock;
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Ryujinx.Audio.Renderer.Server
{
public class AudioRenderSystem : IDisposable
{
private readonly object _lock = new();
private readonly Lock _lock = new();

private AudioRendererRenderingDevice _renderingDevice;
private AudioRendererExecutionMode _executionMode;
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Audio/Renderer/Server/AudioRendererManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public class AudioRendererManager : IDisposable
/// <summary>
/// Lock used for session allocation.
/// </summary>
private readonly object _sessionLock = new();
private readonly Lock _sessionLock = new();

/// <summary>
/// Lock used to control the <see cref="AudioProcessor"/> running state.
/// </summary>
private readonly object _audioProcessorLock = new();
private readonly Lock _audioProcessorLock = new();

/// <summary>
/// The session ids allocation table.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Threading;

namespace Ryujinx.Audio.Renderer.Server.Upsampler
{
Expand All @@ -16,7 +17,7 @@ public class UpsamplerManager
/// <summary>
/// Global lock of the object.
/// </summary>
private readonly object _lock = new();
private readonly Lock _lock = new();

/// <summary>
/// The upsamplers instances.
Expand Down
1 change: 0 additions & 1 deletion src/Ryujinx.Audio/Ryujinx.Audio.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/PreciseSleep/NanosleepPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void Dispose()
}
}

private readonly object _lock = new();
private readonly Lock _lock = new();
private readonly List<NanosleepThread> _threads = new();
private readonly List<NanosleepThread> _active = new();
private readonly Stack<NanosleepThread> _free = new();
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/PreciseSleep/WindowsGranularTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public WaitingObject(long id, EventWaitHandle signal, long timePoint)
private long _lastTicks = PerformanceCounter.ElapsedTicks;
private long _lastId;

private readonly object _lock = new();
private readonly Lock _lock = new();
private readonly List<WaitingObject> _waitingObjects = new();

private WindowsGranularTimer()
Expand Down
1 change: 0 additions & 1 deletion src/Ryujinx.Common/Ryujinx.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants>
<DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
Expand Down
Loading
Loading