Skip to content

Commit

Permalink
Merge branch 'master' into pp_refactoring_merge_multipliers
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo authored Sep 12, 2024
2 parents 174f4d3 + e16769f commit c7a2e79
Show file tree
Hide file tree
Showing 360 changed files with 8,799 additions and 3,269 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ jobs:

build-only-ios:
name: Build only (iOS)
# `macos-13` is required, because the newest Microsoft.iOS.Sdk versions require Xcode 14.3.
# TODO: can be changed to `macos-latest` once `macos-13` becomes latest (currently in beta: https://github.com/actions/runner-images/tree/main#available-images)
runs-on: macos-13
runs-on: macos-latest
timeout-minutes: 60
steps:
- name: Checkout
Expand All @@ -137,8 +135,5 @@ jobs:
- name: Install .NET Workloads
run: dotnet workload install maui-ios

- name: Select Xcode 15.2
run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer

- name: Build
run: dotnet build -c Debug osu.iOS
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.802.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.912.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Expand Down
2 changes: 1 addition & 1 deletion osu.Android/OsuGameAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override void SetHost(GameHost host)
host.Window.CursorState |= CursorState.Hidden;
}

protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager();
protected override UpdateManager CreateUpdateManager() => new MobileUpdateNotifier();

protected override BatteryInfo CreateBatteryInfo() => new AndroidBatteryInfo();

Expand Down
36 changes: 7 additions & 29 deletions osu.Desktop/OsuGameDesktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using Microsoft.Win32;
using osu.Desktop.Performance;
using osu.Desktop.Security;
Expand Down Expand Up @@ -95,42 +95,20 @@ public OsuGameDesktop(string[]? args = null)
return key?.OpenSubKey(WindowsAssociationManager.SHELL_OPEN_COMMAND)?.GetValue(string.Empty)?.ToString()?.Split('"')[1].Replace("osu!.exe", "");
}

public static bool IsPackageManaged => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("OSU_EXTERNAL_UPDATE_PROVIDER"));

protected override UpdateManager CreateUpdateManager()
{
string? packageManaged = Environment.GetEnvironmentVariable("OSU_EXTERNAL_UPDATE_PROVIDER");

if (!string.IsNullOrEmpty(packageManaged))
if (IsPackageManaged)
return new NoActionUpdateManager();

switch (RuntimeInfo.OS)
{
case RuntimeInfo.Platform.Windows:
Debug.Assert(OperatingSystem.IsWindows());

return new SquirrelUpdateManager();

default:
return new SimpleUpdateManager();
}
return new VelopackUpdateManager();
}

public override bool RestartAppWhenExited()
{
switch (RuntimeInfo.OS)
{
case RuntimeInfo.Platform.Windows:
Debug.Assert(OperatingSystem.IsWindows());

// Of note, this is an async method in squirrel that adds an arbitrary delay before returning
// likely to ensure the external process is in a good state.
//
// We're not waiting on that here, but the outro playing before the actual exit should be enough
// to cover this.
Squirrel.UpdateManager.RestartAppWhenExited().FireAndForget();
return true;
}

return base.RestartAppWhenExited();
Task.Run(() => Velopack.UpdateExe.Start()).FireAndForget();
return true;
}

protected override void LoadComplete()
Expand Down
66 changes: 26 additions & 40 deletions osu.Desktop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using osu.Game.IPC;
using osu.Game.Tournament;
using SDL;
using Squirrel;
using Velopack;

namespace osu.Desktop
{
Expand All @@ -31,19 +31,11 @@ public static class Program
[STAThread]
public static void Main(string[] args)
{
/*
* WARNING: DO NOT PLACE **ANY** CODE ABOVE THE FOLLOWING BLOCK!
*
* Logic handling Squirrel MUST run before EVERYTHING if you do not want to break it.
* To be more precise: Squirrel is internally using a rather... crude method to determine whether it is running under NUnit,
* namely by checking loaded assemblies:
* https://github.com/clowd/Clowd.Squirrel/blob/24427217482deeeb9f2cacac555525edfc7bd9ac/src/Squirrel/SimpleSplat/PlatformModeDetector.cs#L17-L32
*
* If it finds ANY assembly from the ones listed above - REGARDLESS of the reason why it is loaded -
* the app will then do completely broken things like:
* - not creating system shortcuts (as the logic is if'd out if "running tests")
* - not exiting after the install / first-update / uninstall hooks are ran (as the `Environment.Exit()` calls are if'd out if "running tests")
*/
// IMPORTANT DON'T IGNORE: For general sanity, velopack's setup needs to run before anything else.
// This has bitten us in the rear before (bricked updater), and although the underlying issue from
// last time has been fixed, let's not tempt fate.
setupVelopack();

if (OperatingSystem.IsWindows())
{
var windowsVersion = Environment.OSVersion.Version;
Expand All @@ -66,8 +58,6 @@ public static void Main(string[] args)
return;
}
}

setupSquirrel();
}

// NVIDIA profiles are based on the executable name of a process.
Expand Down Expand Up @@ -177,32 +167,28 @@ private static bool trySendIPCMessage(IIpcHost host, string cwd, string[] args)
return false;
}

[SupportedOSPlatform("windows")]
private static void setupSquirrel()
private static void setupVelopack()
{
SquirrelAwareApp.HandleEvents(onInitialInstall: (_, tools) =>
{
tools.CreateShortcutForThisExe();
tools.CreateUninstallerRegistryEntry();
WindowsAssociationManager.InstallAssociations();
}, onAppUpdate: (_, tools) =>
if (OsuGameDesktop.IsPackageManaged)
{
tools.CreateUninstallerRegistryEntry();
WindowsAssociationManager.UpdateAssociations();
}, onAppUninstall: (_, tools) =>
{
tools.RemoveShortcutForThisExe();
tools.RemoveUninstallerRegistryEntry();
WindowsAssociationManager.UninstallAssociations();
}, onEveryRun: (_, _, _) =>
{
// While setting the `ProcessAppUserModelId` fixes duplicate icons/shortcuts on the taskbar, it currently
// causes the right-click context menu to function incorrectly.
//
// This may turn out to be non-required after an alternative solution is implemented.
// see https://github.com/clowd/Clowd.Squirrel/issues/24
// tools.SetProcessAppUserModelId();
});
Logger.Log("Updates are being managed by an external provider. Skipping Velopack setup.");
return;
}

var app = VelopackApp.Build();

if (OperatingSystem.IsWindows())
configureWindows(app);

app.Run();
}

[SupportedOSPlatform("windows")]
private static void configureWindows(VelopackApp app)
{
app.WithFirstRun(_ => WindowsAssociationManager.InstallAssociations());
app.WithAfterUpdateFastCallback(_ => WindowsAssociationManager.UpdateAssociations());
app.WithBeforeUninstallFastCallback(_ => WindowsAssociationManager.UninstallAssociations());
}
}
}
180 changes: 0 additions & 180 deletions osu.Desktop/Updater/SquirrelUpdateManager.cs

This file was deleted.

Loading

0 comments on commit c7a2e79

Please sign in to comment.