diff --git a/osu-framework b/osu-framework index 7439250a63..aa96aeec4a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 7439250a63dd451f34dbc08ecf68a196cf8e479f +Subproject commit aa96aeec4a1da743b5b997844b9107ea94b9b8de diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 0af085dce0..a1a29b918f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -14,7 +14,7 @@ namespace osu.Desktop public static void Main(string[] args) { BasicGameHost host = Host.GetSuitableHost(@"osu"); - host.Add(new OsuGame()); + host.Add(new OsuGame(args)); host.Run(); } } diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index d8463dbc35..86ca44e381 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -59,6 +59,7 @@ AllRules.ruleset false false + none diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index fa4d5f3a9c..26607e0bf8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -20,17 +20,30 @@ using osu.Framework; using osu.Framework.Input; using osu.Game.Input; using OpenTK.Input; +using System.IO; namespace osu.Game { public class OsuGame : OsuGameBase { + private class ImportBeatmapIPC + { + public string Path; + } + public Toolbar Toolbar; public ChatConsole Chat; public MainMenu MainMenu => intro?.ChildGameMode as MainMenu; private Intro intro; + private string[] args; + private IPCHost BeatmapIPC; public Bindable PlayMode; + + public OsuGame(string[] args) + { + this.args = args; + } public override void SetHost(BasicGameHost host) { @@ -41,7 +54,27 @@ namespace osu.Game public override void Load(BaseGame game) { +<<<<<<< HEAD base.Load(game); +======= + BeatmapIPC = new IPCHost(Host); + + if (!Host.IsPrimaryInstance) + { + if (args.Length == 1 && File.Exists(args[0])) + { + BeatmapIPC.SendMessage(new ImportBeatmapIPC { Path = args[0] }).Wait(); + Console.WriteLine(@"Sent file to running instance"); + } + else + Console.WriteLine(@"osu! does not support multiple running instances."); + Environment.Exit(0); + } + + BeatmapIPC.MessageReceived += (message) => Console.WriteLine($@"Got beatmap: {message.Path}"); + + base.Load(); +>>>>>>> Implement beatmap sending/receiving over IPC //attach our bindables to the audio subsystem. Audio.Volume.Weld(Config.GetBindable(OsuConfig.VolumeGlobal)); diff --git a/osu.sln b/osu.sln index d9f58def79..8fba171a2f 100644 --- a/osu.sln +++ b/osu.sln @@ -26,6 +26,7 @@ Global Debug|Any CPU = Debug|Any CPU Deploy|Any CPU = Deploy|Any CPU Release|Any CPU = Release|Any CPU + Deploy|Any CPU = Deploy|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU