(v1.4.4) Add support for multiple game instances

This commit is contained in:
pizzaboxer 2022-10-01 06:47:17 +01:00
parent dd6af1d741
commit e3803bc58c
6 changed files with 48 additions and 42 deletions

View File

@ -9,8 +9,8 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<Platforms>AnyCPU;x86</Platforms>
<ApplicationIcon>Bloxstrap.ico</ApplicationIcon>
<Version>1.4.3</Version>
<FileVersion>1.4.3.0</FileVersion>
<Version>1.4.4</Version>
<FileVersion>1.4.4.0</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -70,9 +70,9 @@ namespace Bloxstrap
private string? LaunchCommandLine;
private string VersionGuid;
private PackageManifest VersionPackageManifest;
private string VersionFolder;
private string VersionGuid = null!;
private PackageManifest VersionPackageManifest = null!;
private string VersionFolder = null!;
private readonly bool FreshInstall;
@ -101,7 +101,9 @@ namespace Bloxstrap
await CheckLatestVersion();
if (!Directory.Exists(VersionFolder) || Program.Settings.VersionGuid != VersionGuid)
// if bloxstrap is installing for the first time but is running, prompt to close roblox
// if roblox needs updating but is running, ignore update for now
if (!Directory.Exists(VersionFolder) && CheckIfRunning(true) || Program.Settings.VersionGuid != VersionGuid && !CheckIfRunning(false))
await InstallLatestVersion();
ApplyModifications();
@ -130,24 +132,31 @@ namespace Bloxstrap
VersionPackageManifest = await PackageManifest.Get(VersionGuid);
}
private void CheckIfRunning()
private bool CheckIfRunning(bool shutdown)
{
Process[] processes = Process.GetProcessesByName("RobloxPlayerBeta");
if (processes.Length > 0)
if (processes.Length == 0)
return false;
if (shutdown)
{
Dialog.PromptShutdown();
try
{
// try/catch just in case process was closed before prompt was answered
foreach (Process process in processes)
try
{
process.CloseMainWindow();
process.Close();
// try/catch just in case process was closed before prompt was answered
foreach (Process process in processes)
{
process.CloseMainWindow();
process.Close();
}
}
catch (Exception) { }
}
catch (Exception) { }
return true;
}
private async Task StartRoblox()
@ -321,7 +330,7 @@ namespace Bloxstrap
private void Uninstall()
{
CheckIfRunning();
CheckIfRunning(true);
Dialog.Message = $"Uninstalling {Program.ProjectName}...";
@ -368,8 +377,6 @@ namespace Bloxstrap
#region Roblox Install
private async Task InstallLatestVersion()
{
CheckIfRunning();
if (FreshInstall)
Dialog.Message = "Installing Roblox...";
else

View File

@ -9,7 +9,7 @@ namespace Bloxstrap.Helpers.Integrations
public async Task<bool> SetPresence(string placeId)
{
string placeThumbnail;
string placeThumbnail = "roblox";
var placeInfo = await Utilities.GetJson<RobloxAsset>($"https://economy.roblox.com/v2/assets/{placeId}/details");
@ -18,10 +18,8 @@ namespace Bloxstrap.Helpers.Integrations
var thumbnailInfo = await Utilities.GetJson<RobloxThumbnails>($"https://thumbnails.roblox.com/v1/places/gameicons?placeIds={placeId}&returnPolicy=PlaceHolder&size=512x512&format=Png&isCircular=false");
if (thumbnailInfo is null)
placeThumbnail = "roblox"; //fallback
else
placeThumbnail = thumbnailInfo.Data[0].ImageUrl;
if (thumbnailInfo is not null)
placeThumbnail = thumbnailInfo.Data![0].ImageUrl!;
DiscordRPC.Button[]? buttons = null;

View File

@ -51,7 +51,7 @@ namespace Bloxstrap.Helpers.Integrations
return;
lastReleasePublish = DateTime.Parse(releaseInfo.CreatedAt);
downloadUrl = releaseInfo.Assets[0].BrowserDownloadUrl;
downloadUrl = releaseInfo.Assets![0].BrowserDownloadUrl!;
Directory.CreateDirectory(folderLocation);

View File

@ -56,12 +56,6 @@ namespace Bloxstrap
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
if (Process.GetProcessesByName(ProjectName).Length > 1)
{
ShowMessageBox($"{ProjectName} is already running. Please close any currently open {ProjectName} window.\nIf you have Discord Rich Presence enabled, then close Roblox if it's running.", MessageBoxIcon.Error);
return;
}
LocalAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
StartMenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs", ProjectName);
@ -105,6 +99,12 @@ namespace Bloxstrap
{
if (args[0] == "-preferences")
{
if (Process.GetProcessesByName(ProjectName).Length > 1)
{
ShowMessageBox($"{ProjectName} is already running. Please close any currently open Bloxstrap or Roblox window before opening the configuration menu.", MessageBoxIcon.Error);
return;
}
Application.Run(new Dialogs.Preferences());
}
else if (args[0].StartsWith("roblox-player:"))

View File

@ -1,33 +1,34 @@
# <img src="https://github.com/pizzaboxer/bloxstrap/raw/main/Bloxstrap/Resources/IconBloxstrap-png.png" width="48"/> Bloxstrap
![License](https://img.shields.io/github/license/pizzaboxer/bloxstrap) ![Downloads](https://img.shields.io/github/downloads/pizzaboxer/bloxstrap/total) ![Star](https://img.shields.io/github/stars/pizzaboxer/bloxstrap?style=social)
An open, customizable, feature-packed alternative bootstrapper for Roblox.
## What is this?
This is intended to be a seamless replacement for the stock Roblox bootstrapper, working more or less how you'd expect it to, while providing new and useful features.
This a seamless replacement for the stock Roblox bootstrapper, working more or less how you'd expect it to, while providing additional useful features.
Please keep in mind that **Bloxstrap is in very early development**, and you'll no doubt encounter some bugs. If you do, or you would like to suggest a feature, please submit an issue!
If you encounter a bug, or would like to suggest a feature, please submit an issue!
Bloxstrap is only supported for PCs running Windows.
## Features
Here's some of the features that Bloxstrap provides over the stock Roblox bootstrapper:
* Support for persistent file modifications (including re-adding the old death sound!)
* Ability to choose where Roblox is installed to
* Ability to choose which Roblox build channel to download from
* Doesn't force you to launch Roblox in the Desktop App
* Support for persistent file modifications (e.g. re-adding the old death sound)
* Lets you choose where to install Roblox to
* Gives you the ability to opt-in to pre-release testing channels
* Integration with Discord Rich Presence and [rbxfpsunlocker](https://github.com/axstin/rbxfpsunlocker)
* Custom bootstrapper styles (includes old versions and dark theme)
* Bootstrapper styling
## Installing
Download the [latest release of Bloxstrap](https://github.com/pizzaboxer/bloxstrap/releases/latest), and run it. Configure your preferences if needed, and install. That's about it!
Bloxstrap requires the [x86 .NET 6 Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-6.0.8-windows-x86-installer). If you don't already have it installed, you'll be prompted to install it when trying to run Bloxstrap.
You will also need the [x86 .NET 6 Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-6.0.8-windows-x86-installer). If you don't already have it installed, you'll be prompted to install it anyway.
It's not unlikely that Windows Smartscreen will show a popup when you run Bloxstrap for the first time. This happens because it's an unknown program, not because it's actually detected as being malicious. To dismiss it, just click on "More info" and then "Run anyway".
Bloxstrap is added to your Start Menu, where you can change your preferences if needed.
Once installed, Bloxstrap is added to your Start Menu, where you can change your preferences if needed.
## Contributions
* [Roblox Studio Mod Manager](https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager) by [MaximumADHD](https://www.roblox.com/users/2032622/profile) - some utility code was borrowed to help with Bloxstrap's bootstrapper functionality. They're all under Bloxstrap.Helpers.RSMM, with some having slight modifications. Besides, it's a great project.
* [Roblox Studio Mod Manager](https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager) by [MaximumADHD](https://www.roblox.com/users/2032622/profile) - some slightly modified utility code was borrowed to help with Bloxstrap's bootstrapper functionality (Bloxstrap.Helpers.RSMM). Besides, it's a great project.
* [skulyire](https://www.roblox.com/users/2485612194/profile) - Making the Bloxstrap logo
* [rbxfpsunlocker](https://github.com/axstin/rbxfpsunlocker) by axstin - FPS unlocker for Roblox.
* [rbxfpsunlocker](https://github.com/axstin/rbxfpsunlocker) by axstin - Added as a Bloxstrap integration.