Make launch behaviour closer to official launcher

no custom start event, only specifying launchtime when launched from website
oh yeah i fixed a bug with fflag management
This commit is contained in:
pizzaboxer 2023-04-20 11:51:37 +01:00
parent 826b0a04ca
commit b3dcb48038
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
4 changed files with 17 additions and 21 deletions

View File

@ -163,9 +163,6 @@ namespace Bloxstrap
ShowMessageBox(message, MessageBoxImage.Warning); ShowMessageBox(message, MessageBoxImage.Warning);
} }
// this needs to be loaded this early for the menu and also to check for default values
FastFlags.Load();
// check if installed // check if installed
using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}")) using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}"))
{ {
@ -179,6 +176,7 @@ namespace Bloxstrap
if (!IsQuiet) if (!IsQuiet)
{ {
IsSetupComplete = false; IsSetupComplete = false;
FastFlags.Load();
new MainWindow().ShowDialog(); new MainWindow().ShowDialog();
} }
} }
@ -197,7 +195,7 @@ namespace Bloxstrap
} }
Directories.Initialize(BaseDirectory); Directories.Initialize(BaseDirectory);
FastFlags.AltFileLocation = Path.Combine(Directories.Modifications, "ClientSettings\\ClientAppSettings.json"); FastFlags.Load();
// we shouldn't save settings on the first run until the first installation is finished, // we shouldn't save settings on the first run until the first installation is finished,
// just in case the user decides to cancel the install // just in case the user decides to cancel the install

View File

@ -62,11 +62,11 @@ namespace Bloxstrap
}; };
private const string AppSettings = private const string AppSettings =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
"<Settings>\n" + "<Settings>\r\n" +
" <ContentFolder>content</ContentFolder>\n" + " <ContentFolder>content</ContentFolder>\r\n" +
" <BaseUrl>http://www.roblox.com</BaseUrl>\n" + " <BaseUrl>http://www.roblox.com</BaseUrl>\r\n" +
"</Settings>\n"; "</Settings>\r\n";
private readonly CancellationTokenSource _cancelTokenSource = new(); private readonly CancellationTokenSource _cancelTokenSource = new();
@ -76,7 +76,7 @@ namespace Bloxstrap
private string _playerLocation => Path.Combine(_versionFolder, "RobloxPlayerBeta.exe"); private string _playerLocation => Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
private string? _launchCommandLine; private string _launchCommandLine;
private string _latestVersionGuid = null!; private string _latestVersionGuid = null!;
private PackageManifest _versionPackageManifest = null!; private PackageManifest _versionPackageManifest = null!;
@ -92,7 +92,7 @@ namespace Bloxstrap
#endregion #endregion
#region Core #region Core
public Bootstrapper(string? launchCommandLine = null) public Bootstrapper(string launchCommandLine)
{ {
_launchCommandLine = launchCommandLine; _launchCommandLine = launchCommandLine;
@ -226,8 +226,6 @@ namespace Bloxstrap
private async Task StartRoblox() private async Task StartRoblox()
{ {
string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
SetStatus("Starting Roblox..."); SetStatus("Starting Roblox...");
if (_launchCommandLine == "--app" && App.Settings.Prop.UseDisableAppPatch) if (_launchCommandLine == "--app" && App.Settings.Prop.UseDisableAppPatch)
@ -237,14 +235,11 @@ namespace Bloxstrap
return; return;
} }
// launch time isn't really required for all launches, but it's usually just safest to do this _launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString());
_launchCommandLine += " --launchtime=" + DateTimeOffset.Now.ToUnixTimeMilliseconds();
if (App.Settings.Prop.Channel.ToLower() != DeployManager.DefaultChannel.ToLower()) if (App.Settings.Prop.Channel.ToLower() != DeployManager.DefaultChannel.ToLower())
_launchCommandLine += " -channel " + App.Settings.Prop.Channel.ToLower(); _launchCommandLine += " -channel " + App.Settings.Prop.Channel.ToLower();
_launchCommandLine += " -startEvent " + startEventName;
// whether we should wait for roblox to exit to handle stuff in the background or clean up after roblox closes // whether we should wait for roblox to exit to handle stuff in the background or clean up after roblox closes
bool shouldWait = false; bool shouldWait = false;
@ -256,7 +251,7 @@ namespace Bloxstrap
App.Logger.WriteLine($"[Bootstrapper::StartRoblox] Started Roblox (PID {gameClient.Id})"); App.Logger.WriteLine($"[Bootstrapper::StartRoblox] Started Roblox (PID {gameClient.Id})");
using (SystemEvent startEvent = new(startEventName)) using (SystemEvent startEvent = new("www.roblox.com/robloxStartedEvent"))
{ {
bool startEventFired = await startEvent.WaitForEvent(); bool startEventFired = await startEvent.WaitForEvent();

View File

@ -7,8 +7,7 @@ namespace Bloxstrap.Helpers
public class JsonManager<T> where T : new() public class JsonManager<T> where T : new()
{ {
public T Prop { get; set; } = new(); public T Prop { get; set; } = new();
public virtual string FileLocation => AltFileLocation ?? Path.Combine(Directories.Base, $"{typeof(T).Name}.json"); public virtual string FileLocation => Path.Combine(Directories.Base, $"{typeof(T).Name}.json");
public string? AltFileLocation { get; set; }
public virtual void Load() public virtual void Load()
{ {

View File

@ -18,7 +18,7 @@ namespace Bloxstrap.Helpers
{ "launchmode", "--" }, { "launchmode", "--" },
{ "gameinfo", "-t " }, { "gameinfo", "-t " },
{ "placelauncherurl", "-j "}, { "placelauncherurl", "-j "},
// { "launchtime", "--launchtime=" }, we'll set this when launching the game client { "launchtime", "--launchtime=" },
{ "browsertrackerid", "-b " }, { "browsertrackerid", "-b " },
{ "robloxLocale", "--rloc " }, { "robloxLocale", "--rloc " },
{ "gameLocale", "--gloc " }, { "gameLocale", "--gloc " },
@ -50,6 +50,10 @@ namespace Bloxstrap.Helpers
if (key == "placelauncherurl") if (key == "placelauncherurl")
val = HttpUtility.UrlDecode(val); val = HttpUtility.UrlDecode(val);
// we'll set this before launching because for some reason roblox just refuses to launch if its like a few minutes old so ???
if (key == "launchtime")
val = "LAUNCHTIMEPLACEHOLDER";
if (key == "channel") if (key == "channel")
{ {
if (val.ToLower() != App.Settings.Prop.Channel.ToLower()) if (val.ToLower() != App.Settings.Prop.Channel.ToLower())