fixes for launching studio with no map
This commit is contained in:
parent
9a37c2daaf
commit
68a4402896
|
|
@ -404,7 +404,7 @@ namespace NovetusCMD
|
|||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
{
|
||||
ConsolePrint("Server Loaded.", 4);
|
||||
Process client = new Process();
|
||||
client.StartInfo.FileName = rbxexe;
|
||||
|
|
@ -414,7 +414,7 @@ namespace NovetusCMD
|
|||
client.Exited += new EventHandler(ServerExited);
|
||||
client.Start();
|
||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server);
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map);
|
||||
LocalVars.ProcessID = client.Id;
|
||||
CreateTXT();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ public class LauncherFuncs
|
|||
return image;
|
||||
}
|
||||
|
||||
public static void UpdateRichPresence(LauncherState state, bool initial = false)
|
||||
public static void UpdateRichPresence(LauncherState state, string mapname, bool initial = false)
|
||||
{
|
||||
if (GlobalVars.DiscordPresence)
|
||||
{
|
||||
|
|
@ -805,6 +805,8 @@ public class LauncherFuncs
|
|||
GlobalVars.presence.startTimestamp = SecurityFuncs.UnixTimeNow();
|
||||
}
|
||||
|
||||
string ValidMapname = (string.IsNullOrWhiteSpace(mapname) ? "Place1.rbxl" : mapname);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case LauncherState.InLauncher:
|
||||
|
|
@ -816,21 +818,21 @@ public class LauncherFuncs
|
|||
break;
|
||||
case LauncherState.InMPGame:
|
||||
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
|
||||
GlobalVars.presence.details = "";
|
||||
GlobalVars.presence.details = ValidMapname;
|
||||
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Multiplayer Game";
|
||||
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
|
||||
GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Multiplayer Game";
|
||||
break;
|
||||
case LauncherState.InSoloGame:
|
||||
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
|
||||
GlobalVars.presence.details = GlobalVars.Map;
|
||||
GlobalVars.presence.details = ValidMapname;
|
||||
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Solo Game";
|
||||
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
|
||||
GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Solo Game";
|
||||
break;
|
||||
case LauncherState.InStudio:
|
||||
GlobalVars.presence.smallImageKey = GlobalVars.image_instudio;
|
||||
GlobalVars.presence.details = GlobalVars.Map;
|
||||
GlobalVars.presence.details = ValidMapname;
|
||||
GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Studio";
|
||||
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
|
||||
GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Studio";
|
||||
|
|
@ -844,14 +846,14 @@ public class LauncherFuncs
|
|||
break;
|
||||
case LauncherState.InEasterEggGame:
|
||||
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
|
||||
GlobalVars.presence.details = GlobalVars.Map;
|
||||
GlobalVars.presence.details = ValidMapname;
|
||||
GlobalVars.presence.state = "Reading a message.";
|
||||
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
|
||||
GlobalVars.presence.smallImageText = "Reading a message.";
|
||||
break;
|
||||
case LauncherState.LoadingURI:
|
||||
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
|
||||
GlobalVars.presence.details = "";
|
||||
GlobalVars.presence.details = ValidMapname;
|
||||
GlobalVars.presence.state = "Joining a " + GlobalVars.SelectedClient + " Multiplayer Game";
|
||||
GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version;
|
||||
GlobalVars.presence.smallImageText = "Joining a " + GlobalVars.SelectedClient + " Multiplayer Game";
|
||||
|
|
|
|||
|
|
@ -150,22 +150,22 @@ public class SecurityFuncs
|
|||
return new String(' ', random.Next(20));
|
||||
}
|
||||
|
||||
public static void RenameWindow(Process exe, ScriptGenerator.ScriptType type)
|
||||
public static void RenameWindow(Process exe, ScriptGenerator.ScriptType type, string mapname)
|
||||
{
|
||||
if (GlobalVars.AlreadyHasSecurity != true) {
|
||||
int time = 500;
|
||||
BackgroundWorker worker = new BackgroundWorker();
|
||||
worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, GlobalVars.SelectedClient);
|
||||
worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, GlobalVars.SelectedClient, mapname);
|
||||
worker.RunWorkerAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private static void WorkerDoWork(Process exe, ScriptGenerator.ScriptType type, int time, BackgroundWorker worker, string clientname)
|
||||
private static void WorkerDoWork(Process exe, ScriptGenerator.ScriptType type, int time, BackgroundWorker worker, string clientname, string mapname)
|
||||
{
|
||||
if (exe.IsRunning() == true) {
|
||||
while (exe.IsRunning() == true) {
|
||||
if (exe.IsRunning() != true) {
|
||||
worker.DoWork -= (obj, e) => WorkerDoWork(exe, type, time, worker, clientname);
|
||||
worker.DoWork -= (obj, e) => WorkerDoWork(exe, type, time, worker, clientname, mapname);
|
||||
worker.CancelAsync();
|
||||
worker.Dispose();
|
||||
break;
|
||||
|
|
@ -174,7 +174,7 @@ public class SecurityFuncs
|
|||
if (type == ScriptGenerator.ScriptType.Client) {
|
||||
SetWindowText(exe.MainWindowHandle, "Novetus " + GlobalVars.Version + " - " + clientname + " " + ScriptGenerator.GetNameForType(type) + " [" + GlobalVars.IP + ":" + GlobalVars.RobloxPort + "]" + RandomStringTitle());
|
||||
} else if (type == ScriptGenerator.ScriptType.Server || type == ScriptGenerator.ScriptType.Solo || type == ScriptGenerator.ScriptType.Studio) {
|
||||
SetWindowText(exe.MainWindowHandle, "Novetus " + GlobalVars.Version + " - " + clientname + " " + ScriptGenerator.GetNameForType(type) + " [" + GlobalVars.Map + "]" + RandomStringTitle());
|
||||
SetWindowText(exe.MainWindowHandle, "Novetus " + GlobalVars.Version + " - " + clientname + " " + ScriptGenerator.GetNameForType(type) + (string.IsNullOrWhiteSpace(mapname) ? " [Place1.rbxl]" : " [" + mapname + "]") + RandomStringTitle());
|
||||
}else if (type == ScriptGenerator.ScriptType.EasterEgg) {
|
||||
SetWindowText(exe.MainWindowHandle, ScriptGenerator.GetNameForType(type) + RandomStringTitle());
|
||||
}
|
||||
|
|
@ -182,7 +182,7 @@ public class SecurityFuncs
|
|||
}
|
||||
} else {
|
||||
Thread.Sleep(time);
|
||||
RenameWindow(exe, type);
|
||||
RenameWindow(exe, type, mapname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ namespace NovetusLauncher
|
|||
checkBox1.Checked = GlobalVars.Custom_Extra_ShowHats;
|
||||
|
||||
//discord
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InCustomization);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InCustomization, GlobalVars.Map);
|
||||
|
||||
LauncherFuncs.ReloadLoadtextValue();
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ namespace NovetusLauncher
|
|||
|
||||
void CharacterCustomizationClose(object sender, CancelEventArgs e)
|
||||
{
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||
LauncherFuncs.ReloadLoadtextValue();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ namespace NovetusLauncher
|
|||
// button3
|
||||
//
|
||||
this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button3.Location = new System.Drawing.Point(113, 3);
|
||||
this.button3.Location = new System.Drawing.Point(157, 3);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(81, 20);
|
||||
this.button3.TabIndex = 6;
|
||||
|
|
@ -484,7 +484,7 @@ namespace NovetusLauncher
|
|||
// button35
|
||||
//
|
||||
this.button35.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button35.Location = new System.Drawing.Point(197, 3);
|
||||
this.button35.Location = new System.Drawing.Point(113, 3);
|
||||
this.button35.Name = "button35";
|
||||
this.button35.Size = new System.Drawing.Size(41, 20);
|
||||
this.button35.TabIndex = 61;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace NovetusLauncher
|
|||
handlers.requestCallback += RequestCallback;
|
||||
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
|
||||
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, true);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -627,7 +627,7 @@ namespace NovetusLauncher
|
|||
{
|
||||
GlobalVars.SelectedClient = listBox2.SelectedItem.ToString();
|
||||
ReadClientValues(GlobalVars.SelectedClient);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||
}
|
||||
|
||||
void CheckBox3CheckedChanged(object sender, EventArgs e)
|
||||
|
|
@ -970,13 +970,13 @@ namespace NovetusLauncher
|
|||
client.Exited += new EventHandler(ClientExited);
|
||||
client.Start();
|
||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame);
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client, GlobalVars.Map);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, GlobalVars.Map);
|
||||
}
|
||||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||
if (GlobalVars.CloseOnLaunch == true)
|
||||
{
|
||||
this.Visible = true;
|
||||
|
|
@ -1017,8 +1017,8 @@ namespace NovetusLauncher
|
|||
client.Exited += new EventHandler(StudioExited);
|
||||
client.Start();
|
||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame);
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo, GlobalVars.Map);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame, GlobalVars.Map);
|
||||
}
|
||||
catch (Exception ex) when (!Env.Debugging)
|
||||
{
|
||||
|
|
@ -1069,7 +1069,7 @@ namespace NovetusLauncher
|
|||
client.Exited += new EventHandler(ServerExited);
|
||||
client.Start();
|
||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server);
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map);
|
||||
}
|
||||
catch (Exception ex) when (!Env.Debugging)
|
||||
{
|
||||
|
|
@ -1091,6 +1091,7 @@ namespace NovetusLauncher
|
|||
string luafile = GetLuaFileName();
|
||||
string rbxexe = GetClientEXEDir(ScriptGenerator.ScriptType.Studio);
|
||||
string mapfile = (nomap ? "" : GlobalVars.MapPath);
|
||||
string mapname = (nomap ? "" : GlobalVars.Map);
|
||||
string quote = "\"";
|
||||
string args = "";
|
||||
if (GlobalVars.CustomArgs.Equals("%args%"))
|
||||
|
|
@ -1120,8 +1121,8 @@ namespace NovetusLauncher
|
|||
client.Exited += new EventHandler(StudioExited);
|
||||
client.Start();
|
||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio);
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio, mapname);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio, mapname);
|
||||
}
|
||||
catch (Exception ex) when (!Env.Debugging)
|
||||
{
|
||||
|
|
@ -1132,7 +1133,7 @@ namespace NovetusLauncher
|
|||
|
||||
void StudioExited(object sender, EventArgs e)
|
||||
{
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||
if (GlobalVars.CloseOnLaunch == true)
|
||||
{
|
||||
this.Visible = true;
|
||||
|
|
@ -1761,8 +1762,8 @@ namespace NovetusLauncher
|
|||
client.Exited += new EventHandler(EasterEggExited);
|
||||
client.Start();
|
||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame);
|
||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg, "");
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame, "");
|
||||
}
|
||||
catch (Exception ex) when (!Env.Debugging)
|
||||
{
|
||||
|
|
@ -1773,7 +1774,7 @@ namespace NovetusLauncher
|
|||
|
||||
void EasterEggExited(object sender, EventArgs e)
|
||||
{
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||
label3.Text = "";
|
||||
if (GlobalVars.CloseOnLaunch == true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace NovetusLauncher
|
|||
handlers.requestCallback += RequestCallback;
|
||||
DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, "");
|
||||
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.LoadingURI, true);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.LoadingURI, "", true);
|
||||
}
|
||||
|
||||
void StartGame()
|
||||
|
|
@ -196,14 +196,14 @@ namespace NovetusLauncher
|
|||
clientproc.Exited += new EventHandler(ClientExited);
|
||||
clientproc.Start();
|
||||
clientproc.PriorityClass = ProcessPriorityClass.RealTime;
|
||||
SecurityFuncs.RenameWindow(clientproc, ScriptGenerator.ScriptType.Client);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame);
|
||||
SecurityFuncs.RenameWindow(clientproc, ScriptGenerator.ScriptType.Client, "");
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, "");
|
||||
this.Visible = false;
|
||||
}
|
||||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher);
|
||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue