Skip to content

Commit

Permalink
Allow launching Roblox when it is already open and AppleBlox isn't tr…
Browse files Browse the repository at this point in the history
…acking it
  • Loading branch information
OrigamingWasTaken committed Oct 30, 2024
1 parent fe30da7 commit b3af87d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions frontend/src/windows/main/ts/roblox/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ export async function launchRoblox(
fixResolution: (await getValue<boolean>('mods.general.fix_res')) === true,
};

if (rbxInstance || (await shell('pgrep', ['-f', 'RobloxPlayer'], { skipStderrCheck: true })).stdOut.trim().length > 2) {
if (rbxInstance) {
setLaunchText('Roblox is already open');
setLaunchingRoblox(false);
toast.error('Due to technical reasons, you must close all instances of Roblox before launching from AppleBlox.');
toast.error('You are already running an instance from AppleBlox.');
return;
}
if ((await shell('pgrep', ['-f', 'RobloxPlayer'], { skipStderrCheck: true })).stdOut.trim().length > 3) {
await shell('pkill', ['-9', '-f', 'RobloxPlayer'], { skipStderrCheck: true });
}
try {
console.info('[Launch] Launching Roblox');
setLaunchingRoblox(true);
Expand Down Expand Up @@ -70,7 +73,7 @@ export async function launchRoblox(
) {
const isIgnored = await showFlagErrorPopup(
'Outdated presets',
"You are using presets which contain outdated flags. They may or may not work. To fix this, update to the latest version of the app or wait for a new one.",
'You are using presets which contain outdated flags. They may or may not work. To fix this, update to the latest version of the app or wait for a new one.',
presetFlags.nameMap.join(', ')
);
if (!isIgnored) {
Expand All @@ -87,7 +90,7 @@ export async function launchRoblox(
) {
const isIgnored = await showFlagErrorPopup(
'Invalid flags in selected profile',
"You have one or several invalid flags in your selected profile:",
'You have one or several invalid flags in your selected profile:',
beautify(editorFlags.invalidFlags, null, 2, 100)
);
if (!isIgnored) {
Expand All @@ -104,7 +107,7 @@ export async function launchRoblox(
) {
const isIgnored = await showFlagErrorPopup(
'Invalid flags in game profile(s)',
"You have one or several invalid flags in the following profiles:",
'You have one or several invalid flags in the following profiles:',
editorFlags.invalidProfileFlags
.map((profile) => `${profile.name.toUpperCase()}:\n ${beautify(profile.flags, null, 2, 100)}`)
.join('<br><br>')
Expand Down

0 comments on commit b3af87d

Please sign in to comment.