mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add setting deeplink launch data from BloxstrapRPC
plus a bunch of tweaks to the bootstrapper
This commit is contained in:
parent
719fbb898e
commit
f747f40ca5
@ -281,6 +281,8 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
SetStatus(Strings.Bootstrapper_Status_Starting);
|
SetStatus(Strings.Bootstrapper_Status_Starting);
|
||||||
|
|
||||||
|
if (_launchMode == LaunchMode.Player)
|
||||||
|
{
|
||||||
if (App.Settings.Prop.ForceRobloxLanguage)
|
if (App.Settings.Prop.ForceRobloxLanguage)
|
||||||
{
|
{
|
||||||
var match = Regex.Match(_launchCommandLine, "gameLocale:([a-z_]+)", RegexOptions.CultureInvariant);
|
var match = Regex.Match(_launchCommandLine, "gameLocale:([a-z_]+)", RegexOptions.CultureInvariant);
|
||||||
@ -289,11 +291,11 @@ namespace Bloxstrap
|
|||||||
_launchCommandLine = _launchCommandLine.Replace("robloxLocale:en_us", $"robloxLocale:{match.Groups[1].Value}", StringComparison.InvariantCultureIgnoreCase);
|
_launchCommandLine = _launchCommandLine.Replace("robloxLocale:en_us", $"robloxLocale:{match.Groups[1].Value}", StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
// needed for the start event to fire
|
|
||||||
if (!String.IsNullOrEmpty(_launchCommandLine))
|
if (!String.IsNullOrEmpty(_launchCommandLine))
|
||||||
_launchCommandLine += " ";
|
_launchCommandLine += " ";
|
||||||
|
|
||||||
_launchCommandLine += "-isInstallerLaunch";
|
_launchCommandLine += "-isInstallerLaunch";
|
||||||
|
}
|
||||||
|
|
||||||
var startInfo = new ProcessStartInfo()
|
var startInfo = new ProcessStartInfo()
|
||||||
{
|
{
|
||||||
@ -308,7 +310,7 @@ namespace Bloxstrap
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var startEvent = new EventWaitHandle(false, EventResetMode.ManualReset, "www.roblox.com/robloxStartedEvent");
|
using var startEvent = new EventWaitHandle(false, EventResetMode.ManualReset, AppData.StartEvent);
|
||||||
|
|
||||||
// v2.2.0 - byfron will trip if we keep a process handle open for over a minute, so we're doing this now
|
// v2.2.0 - byfron will trip if we keep a process handle open for over a minute, so we're doing this now
|
||||||
int gameClientPid;
|
int gameClientPid;
|
||||||
@ -357,7 +359,6 @@ namespace Bloxstrap
|
|||||||
autoclosePids.Add(pid);
|
autoclosePids.Add(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string args = gameClientPid.ToString();
|
string args = gameClientPid.ToString();
|
||||||
|
|
||||||
if (autoclosePids.Any())
|
if (autoclosePids.Any())
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace Bloxstrap.Integrations
|
using System.Web;
|
||||||
|
|
||||||
|
namespace Bloxstrap.Integrations
|
||||||
{
|
{
|
||||||
public class ActivityWatcher : IDisposable
|
public class ActivityWatcher : IDisposable
|
||||||
{
|
{
|
||||||
@ -43,6 +45,7 @@
|
|||||||
public string ActivityMachineAddress = "";
|
public string ActivityMachineAddress = "";
|
||||||
public bool ActivityMachineUDMUX = false;
|
public bool ActivityMachineUDMUX = false;
|
||||||
public bool ActivityIsTeleport = false;
|
public bool ActivityIsTeleport = false;
|
||||||
|
public string ActivityLaunchData = "";
|
||||||
public ServerType ActivityServerType = ServerType.Public;
|
public ServerType ActivityServerType = ServerType.Public;
|
||||||
|
|
||||||
public bool IsDisposed = false;
|
public bool IsDisposed = false;
|
||||||
@ -119,6 +122,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetActivityDeeplink()
|
||||||
|
{
|
||||||
|
string deeplink = $"roblox://experiences/start?placeId={ActivityPlaceId}&gameInstanceId={ActivityJobId}";
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(ActivityLaunchData))
|
||||||
|
deeplink += "&launchData=" + HttpUtility.UrlEncode(ActivityLaunchData);
|
||||||
|
|
||||||
|
return deeplink;
|
||||||
|
}
|
||||||
|
|
||||||
private void ReadLogEntry(string entry)
|
private void ReadLogEntry(string entry)
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "ActivityWatcher::ReadLogEntry";
|
const string LOG_IDENT = "ActivityWatcher::ReadLogEntry";
|
||||||
@ -222,6 +235,7 @@
|
|||||||
ActivityMachineAddress = "";
|
ActivityMachineAddress = "";
|
||||||
ActivityMachineUDMUX = false;
|
ActivityMachineUDMUX = false;
|
||||||
ActivityIsTeleport = false;
|
ActivityIsTeleport = false;
|
||||||
|
ActivityLaunchData = "";
|
||||||
ActivityServerType = ServerType.Public;
|
ActivityServerType = ServerType.Public;
|
||||||
|
|
||||||
OnGameLeave?.Invoke(this, new EventArgs());
|
OnGameLeave?.Invoke(this, new EventArgs());
|
||||||
@ -280,6 +294,35 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.Command == "SetLaunchData")
|
||||||
|
{
|
||||||
|
string? data;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
data = message.Data.Deserialize<string>();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Failed to parse message! (JSON deserialization threw an exception)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data is null)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Failed to parse message! (JSON deserialization returned null)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.Length > 200)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Data cannot be longer than 200 characters");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityLaunchData = data;
|
||||||
|
}
|
||||||
|
|
||||||
OnRPCMessage?.Invoke(this, message);
|
OnRPCMessage?.Invoke(this, message);
|
||||||
|
|
||||||
LastRPCRequest = DateTime.Now;
|
LastRPCRequest = DateTime.Now;
|
||||||
|
@ -51,7 +51,7 @@ namespace Bloxstrap.Integrations
|
|||||||
{
|
{
|
||||||
const string LOG_IDENT = "DiscordRichPresence::ProcessRPCMessage";
|
const string LOG_IDENT = "DiscordRichPresence::ProcessRPCMessage";
|
||||||
|
|
||||||
if (message.Command != "SetRichPresence")
|
if (message.Command != "SetRichPresence" && message.Command != "SetLaunchData")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_currentPresence is null || _currentPresenceCopy is null)
|
if (_currentPresence is null || _currentPresenceCopy is null)
|
||||||
@ -61,10 +61,21 @@ namespace Bloxstrap.Integrations
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Models.BloxstrapRPC.RichPresence? presenceData;
|
|
||||||
|
|
||||||
// a lot of repeated code here, could this somehow be cleaned up?
|
// a lot of repeated code here, could this somehow be cleaned up?
|
||||||
|
|
||||||
|
if (message.Command == "SetLaunchData")
|
||||||
|
{
|
||||||
|
var buttonQuery = _currentPresence.Buttons.Where(x => x.Label == "Join server");
|
||||||
|
|
||||||
|
if (!buttonQuery.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
|
buttonQuery.First().Url = _activityWatcher.GetActivityDeeplink();
|
||||||
|
}
|
||||||
|
else if (message.Command == "SetRichPresence")
|
||||||
|
{
|
||||||
|
Models.BloxstrapRPC.RichPresence? presenceData;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
presenceData = message.Data.Deserialize<Models.BloxstrapRPC.RichPresence>();
|
presenceData = message.Data.Deserialize<Models.BloxstrapRPC.RichPresence>();
|
||||||
@ -152,6 +163,7 @@ namespace Bloxstrap.Integrations
|
|||||||
_currentPresence.Assets.LargeImageText = presenceData.LargeImage.HoverText;
|
_currentPresence.Assets.LargeImageText = presenceData.LargeImage.HoverText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (implicitUpdate)
|
if (implicitUpdate)
|
||||||
UpdatePresence();
|
UpdatePresence();
|
||||||
|
@ -104,7 +104,7 @@ namespace Bloxstrap.UI.Elements.ContextMenu
|
|||||||
|
|
||||||
private void RichPresenceMenuItem_Click(object sender, RoutedEventArgs e) => _watcher.RichPresence?.SetVisibility(((MenuItem)sender).IsChecked);
|
private void RichPresenceMenuItem_Click(object sender, RoutedEventArgs e) => _watcher.RichPresence?.SetVisibility(((MenuItem)sender).IsChecked);
|
||||||
|
|
||||||
private void InviteDeeplinkMenuItem_Click(object sender, RoutedEventArgs e) => Clipboard.SetDataObject($"roblox://experiences/start?placeId={_activityWatcher?.ActivityPlaceId}&gameInstanceId={_activityWatcher?.ActivityJobId}");
|
private void InviteDeeplinkMenuItem_Click(object sender, RoutedEventArgs e) => Clipboard.SetDataObject(_activityWatcher?.GetActivityDeeplink());
|
||||||
|
|
||||||
private void ServerDetailsMenuItem_Click(object sender, RoutedEventArgs e) => ShowServerInformationWindow();
|
private void ServerDetailsMenuItem_Click(object sender, RoutedEventArgs e) => ShowServerInformationWindow();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user