mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge pull request #13957 from frenzibyte/allow-custom-game-names
Allow running with different game IDs for debug builds of osu!lazer
This commit is contained in:
7
.run/Dual client test.run.xml
Normal file
7
.run/Dual client test.run.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Dual client test" type="CompoundRunConfigurationType">
|
||||
<toRun name="osu!" type="DotNetProject" />
|
||||
<toRun name="osu! (Second Client)" type="DotNetProject" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
20
.run/osu! (Second Client).run.xml
Normal file
20
.run/osu! (Second Client).run.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="osu! (Second Client)" type="DotNetProject" factoryName=".NET Project" folderName="osu!" activateToolWindowBeforeRun="false">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/net5.0/osu!.dll" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--debug-client-id=1" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/net5.0" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="PROJECT_PATH" value="$PROJECT_DIR$/osu.Desktop/osu.Desktop.csproj" />
|
||||
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
|
||||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||
<option name="PROJECT_TFM" value="net5.0" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework;
|
||||
@ -17,13 +16,43 @@ namespace osu.Desktop
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
private const string base_game_name = @"osu";
|
||||
|
||||
[STAThread]
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
// Back up the cwd before DesktopGameHost changes it
|
||||
var cwd = Environment.CurrentDirectory;
|
||||
|
||||
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
|
||||
string gameName = base_game_name;
|
||||
bool tournamentClient = false;
|
||||
|
||||
foreach (var arg in args)
|
||||
{
|
||||
var split = arg.Split('=');
|
||||
|
||||
var key = split[0];
|
||||
var val = split[1];
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case "--tournament":
|
||||
tournamentClient = true;
|
||||
break;
|
||||
|
||||
case "--debug-client-id":
|
||||
if (!DebugUtils.IsDebugBuild)
|
||||
throw new InvalidOperationException("Cannot use this argument in a non-debug build.");
|
||||
|
||||
if (!int.TryParse(val, out int clientID))
|
||||
throw new ArgumentException("Provided client ID must be an integer.");
|
||||
|
||||
gameName = $"{base_game_name}-{clientID}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
using (DesktopGameHost host = Host.GetSuitableHost(gameName, true))
|
||||
{
|
||||
host.ExceptionThrown += handleException;
|
||||
|
||||
@ -48,16 +77,10 @@ namespace osu.Desktop
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (args.FirstOrDefault() ?? string.Empty)
|
||||
{
|
||||
default:
|
||||
host.Run(new OsuGameDesktop(args));
|
||||
break;
|
||||
|
||||
case "--tournament":
|
||||
host.Run(new TournamentGame());
|
||||
break;
|
||||
}
|
||||
if (tournamentClient)
|
||||
host.Run(new TournamentGame());
|
||||
else
|
||||
host.Run(new OsuGameDesktop(args));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user