1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

Implement beatmap sending/receiving over IPC

This commit is contained in:
Drew DeVault 2016-10-10 16:56:01 -04:00 committed by Dean Herbert
parent c7d12bc072
commit 94f2898f52
5 changed files with 37 additions and 2 deletions

@ -1 +1 @@
Subproject commit 7439250a63dd451f34dbc08ecf68a196cf8e479f
Subproject commit aa96aeec4a1da743b5b997844b9107ea94b9b8de

View File

@ -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();
}
}

View File

@ -59,6 +59,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<Prefer32Bit>false</Prefer32Bit>
<Commandlineparameters></Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>

View File

@ -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<ImportBeatmapIPC> BeatmapIPC;
public Bindable<PlayMode> 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<ImportBeatmapIPC>(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<double>(OsuConfig.VolumeGlobal));

View File

@ -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