Merge branch 'master' into vulnerable-dependency

This commit is contained in:
Huo Yaoyuan
2024-11-29 01:10:37 +08:00
committed by GitHub
29 changed files with 118 additions and 128 deletions

View File

@@ -122,7 +122,10 @@ jobs:
dotnet-version: "8.0.x"
- name: Restore .NET workloads
run: dotnet workload install android
# since windows image 20241113.3.0, not specifying a version here
# installs the .NET 7 version of android workload for very unknown reasons.
# revisit once we upgrade to .NET 9, it's probably fixed there.
run: dotnet workload install android --version (dotnet --version)
- name: Compile
run: dotnet build -c Debug osu-framework.Android.slnf

View File

@@ -131,7 +131,10 @@ jobs:
java-version: 11
- name: Restore .NET workloads
run: dotnet workload install android
# since windows image 20241113.3.0, not specifying a version here
# installs the .NET 7 version of android workload for very unknown reasons.
# revisit once we upgrade to .NET 9, it's probably fixed there.
run: dotnet workload install android --version (dotnet --version)
- name: Pack (Android Framework)
run: dotnet pack -c Release osu.Framework.Android /p:Version=${{ github.ref_name }} /p:GenerateDocumentationFile=true -o ${{steps.artifactsPath.outputs.nuget_artifacts}}

View File

@@ -46,8 +46,49 @@ dotnet_diagnostic.IDE0130.severity = warning
# IDE1006: Naming style
dotnet_diagnostic.IDE1006.severity = warning
#Disable operator overloads requiring alternate named methods
dotnet_diagnostic.CA2225.severity = none
# CA1305: Specify IFormatProvider
# Too many noisy warnings for parsing/formatting numbers
dotnet_diagnostic.CA1305.severity = none
# CA1806: Do not ignore method results
# Not sure why it's performance, but causing too much noise
dotnet_diagnostic.CA1806.severity = none
# CA1822: Mark members as static
# Potential false positive around reflection/too much noise
dotnet_diagnostic.CA1822.severity = none
# CA1826: Do not use Enumerable methods on indexable collections
# Noise for FirstOrDefault and LastOrDefault
dotnet_diagnostic.CA1826.severity = none
# CA1859: Use concrete types when possible for improved performance
# Involves design considerations
dotnet_diagnostic.CA1859.severity = none
# CA1861: Avoid constant arrays as arguments
# Outdated with collection expressions
dotnet_diagnostic.CA1861.severity = none
# CA1868: Unnecessary call to 'Contains(item)'
# Causing noises only
dotnet_diagnostic.CA1868.severity = none
# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = warning
# CA2101: Specify marshaling for P/Invoke string arguments
# Reports warning for all non-UTF16 usages on DllImport; consider migrating to LibraryImport
dotnet_diagnostic.CA2101.severity = none
# CA2201: Do not raise reserved exception types
dotnet_diagnostic.CA2201.severity = warning
# CA2208: Instantiate argument exceptions correctly
dotnet_diagnostic.CA2208.severity = warning
# CA2242: Test for NaN correctly
dotnet_diagnostic.CA2242.severity = warning
# Banned APIs
dotnet_diagnostic.RS0030.severity = error

View File

@@ -8,8 +8,4 @@ M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely()
M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty.
P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks.
M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever.
M:System.Char.ToLower(System.Char);char.ToLower() changes behaviour depending on CultureInfo.CurrentCulture. Use char.ToLowerInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture.
M:System.Char.ToUpper(System.Char);char.ToUpper() changes behaviour depending on CultureInfo.CurrentCulture. Use char.ToUpperInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture.
M:System.String.ToLower();string.ToLower() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToLowerInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString.
M:System.String.ToUpper();string.ToUpper() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToUpperInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString.
M:System.Reflection.Assembly.GetEntryAssembly();Use osu.Framework.RuntimeInfo.EntryAssembly instead

View File

@@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="osu!Framework Rule Set" Description=" " ToolsVersion="16.0">
<Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">
<Rule Id="CA1010" Action="None" />
<Rule Id="CA1016" Action="None" />
<Rule Id="CA1028" Action="None" />
<Rule Id="CA1030" Action="None" />
<Rule Id="CA1031" Action="None" />
<Rule Id="CA1034" Action="None" />
<Rule Id="CA1036" Action="None" />
<Rule Id="CA1040" Action="None" />
<Rule Id="CA1044" Action="None" />
<Rule Id="CA1051" Action="None" />
<Rule Id="CA1054" Action="None" />
<Rule Id="CA1055" Action="None" />
<Rule Id="CA1056" Action="None" />
<Rule Id="CA1061" Action="None" />
<Rule Id="CA1062" Action="None" />
<Rule Id="CA1063" Action="None" />
<Rule Id="CA1064" Action="None" />
<Rule Id="CA1067" Action="None" />
<Rule Id="CA1068" Action="None" />
<Rule Id="CA1707" Action="None" />
<Rule Id="CA1710" Action="None" />
<Rule Id="CA1714" Action="None" />
<Rule Id="CA1716" Action="None" />
<Rule Id="CA1717" Action="None" />
<Rule Id="CA1720" Action="None" />
<Rule Id="CA1721" Action="None" />
<Rule Id="CA1724" Action="None" />
<Rule Id="CA1801" Action="None" />
<Rule Id="CA1806" Action="None" />
<Rule Id="CA1812" Action="None" />
<Rule Id="CA1814" Action="None" />
<Rule Id="CA1815" Action="None" />
<Rule Id="CA1819" Action="None" />
<Rule Id="CA1822" Action="None" />
<Rule Id="CA1823" Action="None" />
<Rule Id="CA2007" Action="Warning" />
<Rule Id="CA2119" Action="None" />
<Rule Id="CA2211" Action="None" />
<Rule Id="CA2214" Action="None" />
<Rule Id="CA2225" Action="None" />
<Rule Id="CA2227" Action="None" />
<Rule Id="CA2231" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeQuality.CSharp.Analyzers" RuleNamespace="Microsoft.CodeQuality.CSharp.Analyzers">
<Rule Id="CA1001" Action="None" />
<Rule Id="CA1032" Action="None" />
<Rule Id="CA1065" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.NetCore.Analyzers" RuleNamespace="Microsoft.NetCore.Analyzers">
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1304" Action="None" />
<Rule Id="CA1305" Action="None" />
<Rule Id="CA1307" Action="None" />
<Rule Id="CA1308" Action="None" />
<Rule Id="CA1816" Action="None" />
<Rule Id="CA1826" Action="None" />
<Rule Id="CA2000" Action="None" />
<Rule Id="CA2008" Action="None" />
<Rule Id="CA2101" Action="None" />
<Rule Id="CA2213" Action="None" />
<Rule Id="CA2237" Action="None" />
<Rule Id="CA5351" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.NetCore.CSharp.Analyzers" RuleNamespace="Microsoft.NetCore.CSharp.Analyzers">
<Rule Id="CA1309" Action="Warning" />
<Rule Id="CA1810" Action="None" />
<Rule Id="CA2201" Action="Warning" />
</Rules>
</RuleSet>

View File

@@ -28,7 +28,17 @@
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\BannedSymbols.txt" />
</ItemGroup>
<PropertyGroup Label="Code Analysis">
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodeAnalysis\osu-framework.ruleset</CodeAnalysisRuleSet>
<AnalysisMode>Default</AnalysisMode>
<AnalysisModeDesign>Default</AnalysisModeDesign>
<AnalysisModeDocumentation>Recommended</AnalysisModeDocumentation>
<AnalysisModeGlobalization>Recommended</AnalysisModeGlobalization>
<AnalysisModeInteroperability>Recommended</AnalysisModeInteroperability>
<AnalysisModeMaintainability>Recommended</AnalysisModeMaintainability>
<AnalysisModeNaming>Default</AnalysisModeNaming>
<AnalysisModePerformance>Minimum</AnalysisModePerformance>
<AnalysisModeReliability>Recommended</AnalysisModeReliability>
<AnalysisModeSecurity>Default</AnalysisModeSecurity>
<AnalysisModeUsage>Default</AnalysisModeUsage>
</PropertyGroup>
<PropertyGroup Label="NuGet">
<Authors>ppy Pty Ltd</Authors>

View File

@@ -31,7 +31,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.globalconfig = .globalconfig
Directory.Build.props = Directory.Build.props
.config\dotnet-tools.json = .config\dotnet-tools.json
CodeAnalysis\osu-framework.ruleset = CodeAnalysis\osu-framework.ruleset
global.json = global.json
osu-framework.sln.DotSettings = osu-framework.sln.DotSettings
osu.Framework.Android.props = osu.Framework.Android.props
osu.Framework.iOS.props = osu.Framework.iOS.props
@@ -74,7 +74,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeAnalysis", "CodeAnalysis", "{50334A1F-990D-45FA-A1FE-C92F1994D97B}"
ProjectSection(SolutionItems) = preProject
CodeAnalysis\BannedSymbols.txt = CodeAnalysis\BannedSymbols.txt
CodeAnalysis\osu-framework.ruleset = CodeAnalysis\osu-framework.ruleset
EndProjectSection
EndProject
Global

View File

@@ -18,7 +18,7 @@
<ProjectReference Include="..\osu.Framework\osu.Framework.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.SDL3-CS.Android" Version="2024.1022.0" />
<PackageReference Include="ppy.SDL3-CS.Android" Version="2024.1128.0" />
<PackageReference Include="Xamarin.AndroidX.Window" Version="1.2.0.1" PrivateAssets="compile" />
</ItemGroup>
</Project>

View File

@@ -22,7 +22,7 @@ namespace osu.Framework.SourceGeneration.Tests
.Where(d => d.Severity == DiagnosticSeverity.Error)
.ToArray();
if (compilationDiagnostics.Any() || generatorDiagnostics.Any())
if (compilationDiagnostics.Length > 0 || generatorDiagnostics.Length > 0)
{
var sb = new StringBuilder();

View File

@@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.Extensions;
using osu.Framework.IO.Stores;
using osu.Framework.Threading;
@@ -87,7 +88,7 @@ namespace osu.Framework.Tests.Audio
runScheduled();
Task.WaitAll(cts.Task);
cts.Task.WaitSafely();
}
}
}

View File

@@ -16,6 +16,8 @@ using osu.Framework.Testing;
using osu.Framework.Tests.Visual;
using osuTK;
#pragma warning disable CA1826 // Performance for test is not important
namespace osu.Framework.Tests.Containers
{
[System.ComponentModel.Description("ensure valid container state in various scenarios")]

View File

@@ -891,7 +891,9 @@ namespace osu.Framework.Tests.IO
[JsonProperty("json")]
public TestObject Json { get; set; }
#pragma warning disable CA1507 // Happens to name the same because of casing preference
[JsonProperty("form")]
#pragma warning restore CA1507
private Dictionary<string, object> form { get; set; }
}
@@ -906,7 +908,9 @@ namespace osu.Framework.Tests.IO
[JsonProperty("args")]
private Dictionary<string, object> arguments { get; set; }
#pragma warning disable CA1507 // Happens to name the same because of casing preference
[JsonProperty("form")]
#pragma warning restore CA1507
private Dictionary<string, object> form { get; set; }
}

View File

@@ -17,6 +17,8 @@ using osu.Framework.Input;
using osu.Framework.Localisation;
using osuTK;
#pragma warning disable CA1826 // Performance for test is not important
namespace osu.Framework.Tests.Visual.UserInterface
{
public partial class TestSceneTabControl : FrameworkTestScene

View File

@@ -186,7 +186,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// <param name="mode">How to set the position.</param>
/// <returns>
/// If successful, then <see langword="true"/> is returned, else <see langword="false"/> is returned.
/// Use <see cref="P:ManagedBass.Bass.LastError"/> to get the error code.
/// Use <see cref="ManagedBass.Bass.LastError"/> to get the error code.
/// </returns>
public bool ChannelSetPosition(IBassAudioChannel channel, long position, PositionFlags mode = PositionFlags.Bytes)
{
@@ -222,11 +222,11 @@ namespace osu.Framework.Audio.Mixing.Bass
/// <remarks>See: <see cref="ManagedBass.Bass.ChannelGetData(int, float[], int)"/>.</remarks>
/// <param name="channel">The <see cref="IBassAudioChannel"/> to retrieve the data of.</param>
/// <param name="buffer">float[] to write the data to.</param>
/// <param name="length">Number of bytes wanted, and/or <see cref="T:ManagedBass.DataFlags"/>.</param>
/// <returns>If an error occurs, -1 is returned, use <see cref="P:ManagedBass.Bass.LastError"/> to get the error code.
/// <param name="length">Number of bytes wanted, and/or <see cref="DataFlags"/>.</param>
/// <returns>If an error occurs, -1 is returned, use <see cref="ManagedBass.Bass.LastError"/> to get the error code.
/// <para>When requesting FFT data, the number of bytes read from the channel (to perform the FFT) is returned.</para>
/// <para>When requesting sample data, the number of bytes written to buffer will be returned (not necessarily the same as the number of bytes read when using the <see cref="F:ManagedBass.DataFlags.Float"/> or DataFlags.Fixed flag).</para>
/// <para>When using the <see cref="F:ManagedBass.DataFlags.Available"/> flag, the number of bytes in the channel's buffer is returned.</para>
/// <para>When requesting sample data, the number of bytes written to buffer will be returned (not necessarily the same as the number of bytes read when using the <see cref="DataFlags.Float"/> or DataFlags.Fixed flag).</para>
/// <para>When using the <see cref="DataFlags.Available"/> flag, the number of bytes in the channel's buffer is returned.</para>
/// </returns>
public int ChannelGetData(IBassAudioChannel channel, float[] buffer, int length)
=> BassMix.ChannelGetData(channel.Handle, buffer, length);
@@ -240,7 +240,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// <param name="parameter">The sync parameters, depending on the sync type.</param>
/// <param name="procedure">The callback function which should be invoked with the sync.</param>
/// <param name="user">User instance data to pass to the callback function.</param>
/// <returns>If successful, then the new synchroniser's handle is returned, else 0 is returned. Use <see cref="P:ManagedBass.Bass.LastError" /> to get the error code.</returns>
/// <returns>If successful, then the new synchroniser's handle is returned, else 0 is returned. Use <see cref="ManagedBass.Bass.LastError" /> to get the error code.</returns>
public int ChannelSetSync(IBassAudioChannel channel, SyncFlags type, long parameter, SyncProcedure procedure, IntPtr user = default)
=> BassMix.ChannelSetSync(channel.Handle, type, parameter, procedure, user);
@@ -248,8 +248,8 @@ namespace osu.Framework.Audio.Mixing.Bass
/// Removes a synchroniser from a mixer source channel.
/// </summary>
/// <param name="channel">The <see cref="IBassAudioChannel"/> to remove the synchroniser for.</param>
/// <param name="sync">Handle of the synchroniser to remove (return value of a previous <see cref="M:ManagedBass.Mix.BassMix.ChannelSetSync(System.Int32,ManagedBass.SyncFlags,System.Int64,ManagedBass.SyncProcedure,System.IntPtr)" /> call).</param>
/// <returns>If successful, <see langword="true" /> is returned, else <see langword="false" /> is returned. Use <see cref="P:ManagedBass.Bass.LastError" /> to get the error code.</returns>
/// <param name="sync">Handle of the synchroniser to remove (return value of a previous <see cref="BassMix.ChannelSetSync(int,SyncFlags,long,SyncProcedure,IntPtr)" /> call).</param>
/// <returns>If successful, <see langword="true" /> is returned, else <see langword="false" /> is returned. Use <see cref="ManagedBass.Bass.LastError" /> to get the error code.</returns>
public bool ChannelRemoveSync(IBassAudioChannel channel, int sync)
=> BassMix.ChannelRemoveSync(channel.Handle, sync);
@@ -257,7 +257,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// Frees a channel's resources.
/// </summary>
/// <param name="channel">The <see cref="IBassAudioChannel"/> to free.</param>
/// <returns>If successful, <see langword="true" /> is returned, else <see langword="false" /> is returned. Use <see cref="P:ManagedBass.Bass.LastError" /> to get the error code.</returns>
/// <returns>If successful, <see langword="true" /> is returned, else <see langword="false" /> is returned. Use <see cref="ManagedBass.Bass.LastError" /> to get the error code.</returns>
public bool StreamFree(IBassAudioChannel channel)
{
Remove(channel, false);

View File

@@ -270,7 +270,7 @@ namespace osu.Framework.Audio.Track
/// <returns>An async task for the generation of the <see cref="Waveform"/>.</returns>
public async Task<Waveform> GenerateResampledAsync(int pointCount, CancellationToken cancellationToken = default)
{
if (pointCount < 0) throw new ArgumentOutOfRangeException(nameof(pointCount));
ArgumentOutOfRangeException.ThrowIfNegative(pointCount);
if (pointCount == 0)
return new Waveform(null);

View File

@@ -137,10 +137,10 @@ namespace osu.Framework.Graphics.Containers
/// <returns>The position of the drawable in the layout.</returns>
public float GetLayoutPosition(Drawable drawable)
{
if (!layoutChildren.ContainsKey(drawable))
if (!layoutChildren.TryGetValue(drawable, out float value))
throw new InvalidOperationException($"Cannot get layout position of drawable which is not contained within this {nameof(FlowContainer<T>)}.");
return layoutChildren[drawable];
return value;
}
protected override bool UpdateChildrenLife()

View File

@@ -121,7 +121,7 @@ namespace osu.Framework.Graphics.Containers
private void performFilter()
{
string[] terms = (searchTerm ?? string.Empty).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
matchSubTree(this, terms, terms.Any(), allowNonContiguousMatching);
matchSubTree(this, terms, terms.Length > 0, allowNonContiguousMatching);
}
private bool matchSubTree(Drawable drawable, IReadOnlyList<string> searchTerms, bool searchActive, bool nonContiguousMatching)

View File

@@ -18,7 +18,7 @@ namespace osu.Framework.Graphics.OpenGL.Buffers
public int Id { get; }
private readonly TData[] data;
private readonly uint elementSize;
private readonly int elementSize;
public GLShaderStorageBufferObject(GLRenderer renderer, int uboSize, int ssboSize)
{
@@ -27,10 +27,10 @@ namespace osu.Framework.Graphics.OpenGL.Buffers
Id = GL.GenBuffer();
Size = renderer.UseStructuredBuffers ? ssboSize : uboSize;
data = new TData[Size];
elementSize = (uint)Marshal.SizeOf(default(TData));
elementSize = Marshal.SizeOf(default(TData));
GL.BindBuffer(BufferTarget.UniformBuffer, Id);
GL.BufferData(BufferTarget.UniformBuffer, (IntPtr)(elementSize * Size), ref data[0], BufferUsageHint.DynamicDraw);
GL.BufferData(BufferTarget.UniformBuffer, elementSize * Size, ref data[0], BufferUsageHint.DynamicDraw);
GL.BindBuffer(BufferTarget.UniformBuffer, 0);
}
@@ -73,7 +73,7 @@ namespace osu.Framework.Graphics.OpenGL.Buffers
return;
GL.BindBuffer(BufferTarget.UniformBuffer, Id);
GL.BufferSubData(BufferTarget.UniformBuffer, (IntPtr)(changeBeginIndex * elementSize), (IntPtr)(elementSize * changeCount), ref data[changeBeginIndex]);
GL.BufferSubData(BufferTarget.UniformBuffer, changeBeginIndex * elementSize, elementSize * changeCount, ref data[changeBeginIndex]);
GL.BindBuffer(BufferTarget.UniformBuffer, 0);
changeBeginIndex = -1;

View File

@@ -54,7 +54,7 @@ namespace osu.Framework.Graphics.Rendering.Deferred
throw new NotImplementedException($"Topology '{topology}' is not yet implemented for this renderer.");
default:
throw new ArgumentOutOfRangeException();
throw new ArgumentOutOfRangeException(nameof(topology));
}
}
else

View File

@@ -701,7 +701,7 @@ namespace osu.Framework.Graphics.UserInterface
{
var visibleMenuItemsList = VisibleMenuItems.ToList();
if (visibleMenuItemsList.Any())
if (visibleMenuItemsList.Count > 0)
{
var currentPreselected = PreselectedItem;
int targetPreselectionIndex = visibleMenuItemsList.IndexOf(currentPreselected);

View File

@@ -203,8 +203,8 @@ namespace osu.Framework.Graphics.UserInterface
protected override void LoadComplete()
{
// Default to first selection in list, if we can
if (firstSelection && SelectFirstTabByDefault && !Current.Disabled && Items.Any())
Current.Value = Items.First();
if (firstSelection && SelectFirstTabByDefault && !Current.Disabled && Items.Count > 0)
Current.Value = Items[0];
Current.BindValueChanged(v =>
{
@@ -545,7 +545,7 @@ namespace osu.Framework.Graphics.UserInterface
private void updateChildIfNeeded(TabItem<T> child, bool isVisible)
{
if (!tabVisibility.ContainsKey(child) || tabVisibility[child] != isVisible)
if (!tabVisibility.TryGetValue(child, out bool currentVisibility) || currentVisibility != isVisible)
{
TabVisibilityChanged?.Invoke(child, isVisible);
tabVisibility[child] = isVisible;

View File

@@ -80,7 +80,7 @@ namespace osu.Framework.Graphics.Visualisation
foreach (var type in source.GetType().EnumerateBaseTypes())
{
type.GetMembers(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)
.Where(m => m is FieldInfo || (m is PropertyInfo pi && pi.GetMethod != null && !pi.GetIndexParameters().Any()))
.Where(m => m is FieldInfo || (m is PropertyInfo pi && pi.GetMethod != null && pi.GetIndexParameters().Length == 0))
.ForEach(m => allMembers.Add(m));
}

View File

@@ -409,7 +409,7 @@ namespace osu.Framework.Input.Bindings
var currentQueue = keyBindingQueues[binding];
if (rebuildIfEmpty && !currentQueue.Any())
if (rebuildIfEmpty && currentQueue.Count == 0)
currentQueue.AddRange(KeyBindingInputQueue);
return currentQueue;

View File

@@ -32,7 +32,7 @@ namespace osu.Framework.Input.Bindings
/// <param name="keys">The keys.</param>
public KeyCombination(ICollection<InputKey>? keys)
{
if (keys == null || !keys.Any())
if (keys == null || keys.Count == 0)
{
Keys = none;
return;

View File

@@ -182,10 +182,9 @@ namespace osu.Framework.Input.Handlers.Midi
// need running status to be interpreted correctly
if (statusType <= 0x7F)
{
if (!runningStatus.ContainsKey(senderId))
if (!runningStatus.TryGetValue(senderId, out eventType))
throw new InvalidDataException($"Received running status of sender {senderId}, but no event type was stored");
eventType = runningStatus[senderId];
key = statusType;
velocity = data[i++];
return;

View File

@@ -33,12 +33,12 @@ namespace osu.Framework.Platform.SDL3
switch (surfaceType)
{
case GraphicsSurfaceType.OpenGL:
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_ACCUM_ALPHA_SIZE, 0);
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_ACCUM_ALPHA_SIZE, 0);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_STENCIL_SIZE, 8);
break;
case GraphicsSurfaceType.Vulkan:
@@ -70,19 +70,19 @@ namespace osu.Framework.Platform.SDL3
{
if (RuntimeInfo.IsMobile)
{
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL_GLProfile.SDL_GL_CONTEXT_PROFILE_ES);
// Minimum OpenGL version for ES profile:
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_CONTEXT_MINOR_VERSION, 0);
}
else
{
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_CONTEXT_PROFILE_MASK, (int)SDL_GLProfile.SDL_GL_CONTEXT_PROFILE_CORE);
// Minimum OpenGL version for core profile:
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GLAttr.SDL_GL_CONTEXT_MINOR_VERSION, 2);
}
context = SDL_GL_CreateContext(window.SDLWindowHandle);

View File

@@ -65,7 +65,9 @@ namespace osu.Framework.Platform.Windows
int payloadSize = sizeof(RawInputData);
#pragma warning disable CA2020 // Prevent behavioral change for IntPtr conversion
Native.Input.GetRawInputData((IntPtr)lParam, RawInputCommand.Input, out var data, ref payloadSize, sizeof(RawInputHeader));
#pragma warning restore CA2020
if (data.Header.Type != RawInputType.Mouse)
return IntPtr.Zero;

View File

@@ -403,7 +403,7 @@ namespace osu.Framework.Testing
var methods = newTest.GetType().GetMethods();
var soloTests = methods.Where(m => m.GetCustomAttribute(typeof(SoloAttribute), false) != null).ToArray();
if (soloTests.Any())
if (soloTests.Length > 0)
methods = soloTests;
foreach (var m in methods)
@@ -519,7 +519,7 @@ namespace osu.Framework.Testing
{
var setUpMethods = ReflectionUtils.GetMethodsWithAttribute(newTest.GetType(), typeof(SetUpAttribute), true);
if (setUpMethods.Any())
if (setUpMethods.Length > 0)
{
CurrentTest.AddStep(new SingleStepButton
{

View File

@@ -38,7 +38,7 @@
<PackageReference Include="ppy.osuTK.NS20" Version="1.0.211" />
<PackageReference Include="StbiSharp" Version="1.1.0" />
<PackageReference Include="ppy.SDL2-CS" Version="1.0.741-alpha" />
<PackageReference Include="ppy.SDL3-CS" Version="2024.1022.0" />
<PackageReference Include="ppy.SDL3-CS" Version="2024.1128.0" />
<PackageReference Include="ppy.osu.Framework.SourceGeneration" Version="2024.1128.0" />
<!-- DO NOT use ProjectReference for native packaging project.