Skip to content

Commit 54e30fc

Browse files
committed
Merge remote-tracking branch 'upstream/master' into mcnc-tournament-streamer
2 parents a362124 + 8f82462 commit 54e30fc

File tree

210 files changed

+5249
-1151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+5249
-1151
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
]
1010
},
1111
"nvika": {
12-
"version": "3.0.0",
12+
"version": "4.0.0",
1313
"commands": [
1414
"nvika"
1515
]

CodeAnalysis/osu.globalconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ dotnet_diagnostic.IDE1006.severity = warning
5151
# Too many noisy warnings for parsing/formatting numbers
5252
dotnet_diagnostic.CA1305.severity = none
5353

54+
# messagepack complains about "osu" not being title cased due to reserved words
55+
dotnet_diagnostic.CS8981.severity = none
56+
5457
# CA1507: Use nameof to express symbol names
55-
# Flaggs serialization name attributes
58+
# Flags serialization name attributes
5659
dotnet_diagnostic.CA1507.severity = suggestion
5760

5861
# CA1806: Do not ignore method results

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can also generally download a version for your current device from the [osu!
3737

3838
If your platform is unsupported or not listed above, there is still a chance you can run the release or manually build it by following the instructions below.
3939

40-
**For iOS/iPadOS users**: The iOS testflight link fills up very fast (Apple has a hard limit of 10,000 users). We reset it occasionally. Please do not ask about this. Check back regularly for link resets or follow [peppy](https://twitter.com/ppy) on twitter for announcements. Our goal is to get the game on mobile app stores in early 2024.
40+
**For iOS/iPadOS users**: The iOS testflight link fills up very fast (Apple has a hard limit of 10,000 users). We reset it occasionally. Please do not ask about this. Check back regularly for link resets or follow [peppy](https://twitter.com/ppy) on twitter for announcements. Our goal is to get the game on mobile app stores very soon so we don't have to live with this limitation.
4141

4242
## Developing a custom ruleset
4343

Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform.Tests/osu.Game.Rulesets.EmptyFreeform.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<GenerateProgramFile>false</GenerateProgramFile>
1010
</PropertyGroup>
1111
<ItemGroup Label="Package References">
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1313
<PackageReference Include="NUnit" Version="3.14.0" />
14-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
14+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<ProjectReference Include="..\osu.Game.Rulesets.EmptyFreeform\osu.Game.Rulesets.EmptyFreeform.csproj" />

Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<GenerateProgramFile>false</GenerateProgramFile>
1010
</PropertyGroup>
1111
<ItemGroup Label="Package References">
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1313
<PackageReference Include="NUnit" Version="3.14.0" />
14-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
14+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<ProjectReference Include="..\osu.Game.Rulesets.Pippidon\osu.Game.Rulesets.Pippidon.csproj" />

Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling.Tests/osu.Game.Rulesets.EmptyScrolling.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<GenerateProgramFile>false</GenerateProgramFile>
1010
</PropertyGroup>
1111
<ItemGroup Label="Package References">
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1313
<PackageReference Include="NUnit" Version="3.14.0" />
14-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
14+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<ProjectReference Include="..\osu.Game.Rulesets.EmptyScrolling\osu.Game.Rulesets.EmptyScrolling.csproj" />

Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon.Tests/osu.Game.Rulesets.Pippidon.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<GenerateProgramFile>false</GenerateProgramFile>
1010
</PropertyGroup>
1111
<ItemGroup Label="Package References">
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1313
<PackageReference Include="NUnit" Version="3.14.0" />
14-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
14+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<ProjectReference Include="..\osu.Game.Rulesets.Pippidon\osu.Game.Rulesets.Pippidon.csproj" />

osu.Android.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.1224.0" />
13+
<PackageReference Include="ppy.osu.Framework.Android" Version="2025.115.0" />
1414
</ItemGroup>
1515
<PropertyGroup>
1616
<!-- Fody does not handle Android build well, and warns when unchanged.

osu.Android/OsuGameActivity.cs

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using Android.OS;
1414
using Android.Views;
1515
using osu.Framework.Android;
16-
using osu.Framework.Extensions.ObjectExtensions;
1716
using osu.Game.Database;
1817
using Debug = System.Diagnostics.Debug;
1918
using Uri = Android.Net.Uri;
@@ -50,9 +49,23 @@ public class OsuGameActivity : AndroidGameActivity
5049
/// <remarks>Adjusted on startup to match expected UX for the current device type (phone/tablet).</remarks>
5150
public ScreenOrientation DefaultOrientation = ScreenOrientation.Unspecified;
5251

53-
private OsuGameAndroid game = null!;
52+
private readonly OsuGameAndroid game;
5453

55-
protected override Framework.Game CreateGame() => game = new OsuGameAndroid(this);
54+
private bool gameCreated;
55+
56+
protected override Framework.Game CreateGame()
57+
{
58+
if (gameCreated)
59+
throw new InvalidOperationException("Framework tried to create a game twice.");
60+
61+
gameCreated = true;
62+
return game;
63+
}
64+
65+
public OsuGameActivity()
66+
{
67+
game = new OsuGameAndroid(this);
68+
}
5669

5770
protected override void OnCreate(Bundle? savedInstanceState)
5871
{
@@ -95,25 +108,38 @@ protected override void OnCreate(Bundle? savedInstanceState)
95108

96109
private void handleIntent(Intent? intent)
97110
{
98-
switch (intent?.Action)
111+
if (intent == null)
112+
return;
113+
114+
switch (intent.Action)
99115
{
100116
case Intent.ActionDefault:
101117
if (intent.Scheme == ContentResolver.SchemeContent)
102-
handleImportFromUris(intent.Data.AsNonNull());
118+
{
119+
if (intent.Data != null)
120+
handleImportFromUris(intent.Data);
121+
}
103122
else if (osu_url_schemes.Contains(intent.Scheme))
104-
game.HandleLink(intent.DataString);
123+
{
124+
if (intent.DataString != null)
125+
game.HandleLink(intent.DataString);
126+
}
127+
105128
break;
106129

107130
case Intent.ActionSend:
108131
case Intent.ActionSendMultiple:
109132
{
133+
if (intent.ClipData == null)
134+
break;
135+
110136
var uris = new List<Uri>();
111137

112-
for (int i = 0; i < intent.ClipData?.ItemCount; i++)
138+
for (int i = 0; i < intent.ClipData.ItemCount; i++)
113139
{
114-
var content = intent.ClipData?.GetItemAt(i);
115-
if (content != null)
116-
uris.Add(content.Uri.AsNonNull());
140+
var item = intent.ClipData.GetItemAt(i);
141+
if (item?.Uri != null)
142+
uris.Add(item.Uri);
117143
}
118144

119145
handleImportFromUris(uris.ToArray());

osu.Desktop/DiscordRichPresence.cs

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ internal partial class DiscordRichPresence : Component
5151
[Resolved]
5252
private LocalUserStatisticsProvider statisticsProvider { get; set; } = null!;
5353

54-
[Resolved]
55-
private OsuConfigManager config { get; set; } = null!;
56-
57-
private readonly IBindable<UserStatus?> status = new Bindable<UserStatus?>();
58-
private readonly IBindable<UserActivity> activity = new Bindable<UserActivity>();
59-
private readonly Bindable<DiscordRichPresenceMode> privacyMode = new Bindable<DiscordRichPresenceMode>();
54+
private IBindable<DiscordRichPresenceMode> privacyMode = null!;
55+
private IBindable<UserStatus> userStatus = null!;
56+
private IBindable<UserActivity?> userActivity = null!;
6057

6158
private readonly RichPresence presence = new RichPresence
6259
{
@@ -71,8 +68,12 @@ internal partial class DiscordRichPresence : Component
7168
private IBindable<APIUser>? user;
7269

7370
[BackgroundDependencyLoader]
74-
private void load()
71+
private void load(OsuConfigManager config, SessionStatics session)
7572
{
73+
privacyMode = config.GetBindable<DiscordRichPresenceMode>(OsuSetting.DiscordRichPresence);
74+
userStatus = config.GetBindable<UserStatus>(OsuSetting.UserOnlineStatus);
75+
userActivity = session.GetBindable<UserActivity?>(Static.UserOnlineActivity);
76+
7677
client = new DiscordRpcClient(client_id)
7778
{
7879
// SkipIdenticalPresence allows us to fire SetPresence at any point and leave it to the underlying implementation
@@ -105,21 +106,11 @@ protected override void LoadComplete()
105106
{
106107
base.LoadComplete();
107108

108-
config.BindWith(OsuSetting.DiscordRichPresence, privacyMode);
109-
110109
user = api.LocalUser.GetBoundCopy();
111-
user.BindValueChanged(u =>
112-
{
113-
status.UnbindBindings();
114-
status.BindTo(u.NewValue.Status);
115-
116-
activity.UnbindBindings();
117-
activity.BindTo(u.NewValue.Activity);
118-
}, true);
119110

120111
ruleset.BindValueChanged(_ => schedulePresenceUpdate());
121-
status.BindValueChanged(_ => schedulePresenceUpdate());
122-
activity.BindValueChanged(_ => schedulePresenceUpdate());
112+
userStatus.BindValueChanged(_ => schedulePresenceUpdate());
113+
userActivity.BindValueChanged(_ => schedulePresenceUpdate());
123114
privacyMode.BindValueChanged(_ => schedulePresenceUpdate());
124115

125116
multiplayerClient.RoomUpdated += onRoomUpdated;
@@ -151,13 +142,13 @@ private void schedulePresenceUpdate()
151142
if (!client.IsInitialized)
152143
return;
153144

154-
if (status.Value == UserStatus.Offline || privacyMode.Value == DiscordRichPresenceMode.Off)
145+
if (!api.IsLoggedIn || userStatus.Value == UserStatus.Offline || privacyMode.Value == DiscordRichPresenceMode.Off)
155146
{
156147
client.ClearPresence();
157148
return;
158149
}
159150

160-
bool hideIdentifiableInformation = privacyMode.Value == DiscordRichPresenceMode.Limited || status.Value == UserStatus.DoNotDisturb;
151+
bool hideIdentifiableInformation = privacyMode.Value == DiscordRichPresenceMode.Limited || userStatus.Value == UserStatus.DoNotDisturb;
161152

162153
updatePresence(hideIdentifiableInformation);
163154
client.SetPresence(presence);
@@ -170,12 +161,12 @@ private void updatePresence(bool hideIdentifiableInformation)
170161
return;
171162

172163
// user activity
173-
if (activity.Value != null)
164+
if (userActivity.Value != null)
174165
{
175-
presence.State = clampLength(activity.Value.GetStatus(hideIdentifiableInformation));
176-
presence.Details = clampLength(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
166+
presence.State = clampLength(userActivity.Value.GetStatus(hideIdentifiableInformation));
167+
presence.Details = clampLength(userActivity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
177168

178-
if (activity.Value.GetBeatmapID(hideIdentifiableInformation) is int beatmapId && beatmapId > 0)
169+
if (userActivity.Value.GetBeatmapID(hideIdentifiableInformation) is int beatmapId && beatmapId > 0)
179170
{
180171
presence.Buttons = new[]
181172
{

0 commit comments

Comments
 (0)