mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Check if player executable exists (#128)
This commit is contained in:
parent
65c85b612a
commit
d7dc198a8b
@ -68,6 +68,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
private static bool FreshInstall => String.IsNullOrEmpty(App.State.Prop.VersionGuid);
|
private static bool FreshInstall => String.IsNullOrEmpty(App.State.Prop.VersionGuid);
|
||||||
private static string DesktopShortcutLocation => Path.Combine(Directories.Desktop, "Play Roblox.lnk");
|
private static string DesktopShortcutLocation => Path.Combine(Directories.Desktop, "Play Roblox.lnk");
|
||||||
|
private string _playerLocation => Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
|
||||||
|
|
||||||
private string? _launchCommandLine;
|
private string? _launchCommandLine;
|
||||||
|
|
||||||
@ -144,8 +145,9 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
CheckInstallMigration();
|
CheckInstallMigration();
|
||||||
|
|
||||||
// if roblox needs updating but is running and we have multiple instances open, ignore update for now
|
// only update roblox if we're running for the first time, or if
|
||||||
if (App.IsFirstRun || _versionGuid != App.State.Prop.VersionGuid && !Utilities.CheckIfRobloxRunning())
|
// roblox isn't running and our version guid is out of date, or the player exe doesn't exist
|
||||||
|
if (App.IsFirstRun || !Utilities.CheckIfRobloxRunning() && (_versionGuid != App.State.Prop.VersionGuid || !File.Exists(_playerLocation)))
|
||||||
await InstallLatestVersion();
|
await InstallLatestVersion();
|
||||||
|
|
||||||
// last time the version folder was set, it was set to the latest version guid
|
// last time the version folder was set, it was set to the latest version guid
|
||||||
@ -153,10 +155,10 @@ namespace Bloxstrap
|
|||||||
_versionFolder = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid);
|
_versionFolder = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid);
|
||||||
|
|
||||||
if (App.IsFirstRun)
|
if (App.IsFirstRun)
|
||||||
{
|
|
||||||
App.ShouldSaveConfigs = true;
|
App.ShouldSaveConfigs = true;
|
||||||
App.FastFlags.Save();
|
|
||||||
}
|
IntegrationMigrator.Execute();
|
||||||
|
App.FastFlags.Save();
|
||||||
|
|
||||||
if (App.Settings.Prop.UseReShade)
|
if (App.Settings.Prop.UseReShade)
|
||||||
SetStatus("Configuring/Downloading ReShade...");
|
SetStatus("Configuring/Downloading ReShade...");
|
||||||
@ -170,8 +172,6 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
CheckInstall();
|
CheckInstall();
|
||||||
|
|
||||||
IntegrationMigrator.Execute();
|
|
||||||
|
|
||||||
// at this point we've finished updating our configs
|
// at this point we've finished updating our configs
|
||||||
App.Settings.Save();
|
App.Settings.Save();
|
||||||
App.State.Save();
|
App.State.Save();
|
||||||
@ -336,7 +336,7 @@ namespace Bloxstrap
|
|||||||
// 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;
|
||||||
|
|
||||||
Process gameClient = Process.Start(Path.Combine(_versionFolder, "RobloxPlayerBeta.exe"), _launchCommandLine);
|
Process gameClient = Process.Start(_playerLocation, _launchCommandLine);
|
||||||
List<Process> autocloseProcesses = new();
|
List<Process> autocloseProcesses = new();
|
||||||
GameActivityWatcher? activityWatcher = null;
|
GameActivityWatcher? activityWatcher = null;
|
||||||
DiscordRichPresence? richPresence = null;
|
DiscordRichPresence? richPresence = null;
|
||||||
@ -708,23 +708,20 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
string oldVersionFolder = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid);
|
string oldVersionFolder = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid);
|
||||||
|
|
||||||
|
// and also to delete our old version folder
|
||||||
if (_versionGuid != App.State.Prop.VersionGuid && Directory.Exists(oldVersionFolder))
|
if (_versionGuid != App.State.Prop.VersionGuid && Directory.Exists(oldVersionFolder))
|
||||||
{
|
|
||||||
// and also to delete our old version folder
|
|
||||||
Directory.Delete(oldVersionFolder, true);
|
Directory.Delete(oldVersionFolder, true);
|
||||||
}
|
|
||||||
|
|
||||||
// move old compatibility flags for the old location
|
// move old compatibility flags for the old location
|
||||||
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
|
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
|
||||||
{
|
{
|
||||||
string oldGameClientLocation = Path.Combine(oldVersionFolder, "RobloxPlayerBeta.exe");
|
string oldGameClientLocation = Path.Combine(oldVersionFolder, "RobloxPlayerBeta.exe");
|
||||||
string newGameClientLocation = Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
|
|
||||||
string? appFlags = (string?)appFlagsKey.GetValue(oldGameClientLocation);
|
string? appFlags = (string?)appFlagsKey.GetValue(oldGameClientLocation);
|
||||||
|
|
||||||
if (appFlags is not null)
|
if (appFlags is not null)
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine($"[Bootstrapper::InstallLatestVersion] Migrating app compatibility flags from {oldGameClientLocation} to {newGameClientLocation}...");
|
App.Logger.WriteLine($"[Bootstrapper::InstallLatestVersion] Migrating app compatibility flags from {oldGameClientLocation} to {_playerLocation}...");
|
||||||
appFlagsKey.SetValue(newGameClientLocation, appFlags);
|
appFlagsKey.SetValue(_playerLocation, appFlags);
|
||||||
appFlagsKey.DeleteValue(oldGameClientLocation);
|
appFlagsKey.DeleteValue(oldGameClientLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -747,23 +744,22 @@ namespace Bloxstrap
|
|||||||
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
|
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
|
||||||
{
|
{
|
||||||
const string flag = " DISABLEDXMAXIMIZEDWINDOWEDMODE";
|
const string flag = " DISABLEDXMAXIMIZEDWINDOWEDMODE";
|
||||||
string gameClientLocation = Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
|
string? appFlags = (string?)appFlagsKey.GetValue(_playerLocation);
|
||||||
string? appFlags = (string?)appFlagsKey.GetValue(gameClientLocation);
|
|
||||||
|
|
||||||
if (App.Settings.Prop.DisableFullscreenOptimizations)
|
if (App.Settings.Prop.DisableFullscreenOptimizations)
|
||||||
{
|
{
|
||||||
if (appFlags is null)
|
if (appFlags is null)
|
||||||
appFlagsKey.SetValue(gameClientLocation, $"~{flag}");
|
appFlagsKey.SetValue(_playerLocation, $"~{flag}");
|
||||||
else if (!appFlags.Contains(flag))
|
else if (!appFlags.Contains(flag))
|
||||||
appFlagsKey.SetValue(gameClientLocation, appFlags + flag);
|
appFlagsKey.SetValue(_playerLocation, appFlags + flag);
|
||||||
}
|
}
|
||||||
else if (appFlags is not null && appFlags.Contains(flag))
|
else if (appFlags is not null && appFlags.Contains(flag))
|
||||||
{
|
{
|
||||||
// if there's more than one space, there's more flags set we need to preserve
|
// if there's more than one space, there's more flags set we need to preserve
|
||||||
if (appFlags.Split(' ').Length > 2)
|
if (appFlags.Split(' ').Length > 2)
|
||||||
appFlagsKey.SetValue(gameClientLocation, appFlags.Remove(appFlags.IndexOf(flag), flag.Length));
|
appFlagsKey.SetValue(_playerLocation, appFlags.Remove(appFlags.IndexOf(flag), flag.Length));
|
||||||
else
|
else
|
||||||
appFlagsKey.DeleteValue(gameClientLocation);
|
appFlagsKey.DeleteValue(_playerLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,29 +69,24 @@ namespace Bloxstrap.Helpers
|
|||||||
{
|
{
|
||||||
base.Load();
|
base.Load();
|
||||||
|
|
||||||
// set to 99999 by default if it doesnt immediately exist
|
// set to 9999 by default if it doesnt already exist
|
||||||
if (GetValue("DFIntTaskSchedulerTargetFps") is null)
|
if (GetValue("DFIntTaskSchedulerTargetFps") is null)
|
||||||
{
|
|
||||||
SetValue("DFIntTaskSchedulerTargetFps", 9999);
|
SetValue("DFIntTaskSchedulerTargetFps", 9999);
|
||||||
|
|
||||||
if (!App.IsFirstRun)
|
|
||||||
Save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine($"[FastFlagManager::Save] Attempting to save JSON to {FileLocation}...");
|
App.Logger.WriteLine($"[FastFlagManager::Save] Attempting to save JSON to {FileLocation}...");
|
||||||
|
|
||||||
|
// reload for any changes made while the menu was open
|
||||||
|
Load();
|
||||||
|
|
||||||
if (Changes.Count == 0)
|
if (Changes.Count == 0)
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine($"[FastFlagManager::Save] No changes to apply, aborting.");
|
App.Logger.WriteLine($"[FastFlagManager::Save] No changes to apply, aborting.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload for any changes made while the menu was open
|
|
||||||
Load();
|
|
||||||
|
|
||||||
foreach (var change in Changes)
|
foreach (var change in Changes)
|
||||||
{
|
{
|
||||||
if (change.Value is null)
|
if (change.Value is null)
|
||||||
|
@ -6,8 +6,6 @@ namespace Bloxstrap.Helpers
|
|||||||
{
|
{
|
||||||
public static void Execute()
|
public static void Execute()
|
||||||
{
|
{
|
||||||
App.FastFlags.Load();
|
|
||||||
|
|
||||||
// v2.2.0 - remove rbxfpsunlocker
|
// v2.2.0 - remove rbxfpsunlocker
|
||||||
string rbxfpsunlocker = Path.Combine(Directories.Integrations, "rbxfpsunlocker");
|
string rbxfpsunlocker = Path.Combine(Directories.Integrations, "rbxfpsunlocker");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user