From 84597bc046a938dba14b638326cd8c7f0bdd2de2 Mon Sep 17 00:00:00 2001 From: OrigamingWasTaken <74014262+OrigamingWasTaken@users.noreply.github.com> Date: Sun, 30 Jun 2024 18:00:33 +0200 Subject: [PATCH] FastFlags and Launching Complete --- frontend/src/windows/main/App.svelte | 29 ++++- .../src/windows/main/pages/FastFlags.svelte | 26 +++-- .../pages/Settings/FFButtonsCustom.svelte | 26 ++++- .../windows/main/pages/Settings/Panel.svelte | 2 +- frontend/src/windows/main/ts/roblox.ts | 100 ++++++++++++++++-- frontend/src/windows/main/ts/settings.ts | 4 +- neutralino.config.json | 3 +- 7 files changed, 160 insertions(+), 30 deletions(-) diff --git a/frontend/src/windows/main/App.svelte b/frontend/src/windows/main/App.svelte index 48214df..5f058af 100644 --- a/frontend/src/windows/main/App.svelte +++ b/frontend/src/windows/main/App.svelte @@ -6,11 +6,12 @@ import FastFlags from "./pages/FastFlags.svelte"; import { Toaster } from "$lib/components/ui/sonner"; import { Progress } from "$lib/components/ui/progress"; - import { hasRoblox } from "./ts/roblox"; + import { hasRoblox, parseFFlags } from "./ts/roblox"; import Misc from "./pages/Misc.svelte"; import { toast } from "svelte-sonner"; - import { debug, os } from "@neutralinojs/lib"; + import { debug, filesystem, os } from "@neutralinojs/lib"; import { ModeWatcher, setMode } from "mode-watcher"; + import { pathExists } from "./ts/utils"; let currentPage: string; let launchingRoblox = false; @@ -22,7 +23,29 @@ if (!(await hasRoblox())) { launchingRoblox = false; } - // Implement launching logic + + // FFLAGS + launchProgess = 20 + if (await pathExists("/Applications/Roblox.app/Contents/MacOS/ClientSettings/ClientAppSettings.json")) { + await filesystem.remove("/Applications/Roblox.app/Contents/MacOS/ClientSettings/") + ltext = "Removing current ClientAppSettings..." + } + launchProgess = 40 + ltext = "Copying fast flags..." + await filesystem.createDirectory("/Applications/Roblox.app/Contents/MacOS/ClientSettings").catch(console.error) + console.log(await parseFFlags(true)) + const fflags = {...(await parseFFlags(false)), ...(await parseFFlags(true))} + await filesystem.writeFile("/Applications/Roblox.app/Contents/MacOS/ClientSettings/ClientAppSettings.json",JSON.stringify(fflags)) + launchProgess = 60 + setTimeout(()=>{ + os.execCommand("open /Applications/Roblox.app") + launchProgess = 100 + ltext = "Roblox Launched" + setTimeout(()=>{ + launchingRoblox = false + filesystem.remove("/Applications/Roblox.app/Contents/MacOS/ClientSettings/").catch(console.error) + },1000) + },1000) } // Darkmode diff --git a/frontend/src/windows/main/pages/FastFlags.svelte b/frontend/src/windows/main/pages/FastFlags.svelte index b629371..b8cb0c3 100644 --- a/frontend/src/windows/main/pages/FastFlags.svelte +++ b/frontend/src/windows/main/pages/FastFlags.svelte @@ -53,26 +53,24 @@ const panelOpts: SettingsPanel = { options: { type: 'dropdown', list: [ - {label: 'Metal (M1/2/3)', value: 'metal'}, + {label: 'Metal', value: 'metal'}, {label: 'Vulkan (MoltenVK)', value: 'vulkan'}, - {label: 'Rosetta (Intel)', value: 'rosetta'}, + {label: 'OpenGL (Intel)', value: 'opengl'}, ], - default: {label: 'Metal (M1/2/3)', value: 'metal'}, + default: {label: 'Metal', value: 'metal'}, }, }, { - label: 'Escape Menu Version', - description: 'Choose the version of your ESC menu', - id: 'ff_menu', + label: 'Hide GUI', + description: `Input the ID of any group you're in. Defaults to Ori's group Paper4win. +
 CMD + Shift + B: Toggles GUIs in 3D space (BillboardGuis, etc) +
 CMD + Shift + C: Toggles game-defined ScreenGuis +
 CMD + Shift + G: Toggles Roblox CoreGuis +
 CMD + Shift + N: Toggles player names, and other that shows...`, + id: 'ff_gui', options: { - type: 'dropdown', - list: [ - {label: 'Default', value: 'default'}, - {label: 'Version 1', value: 'v1'}, - {label: 'Version 2', value: 'v2'}, - {label: 'Version 4', value: 'v4'}, - ], - default: {label: 'Default', value: 'default'}, + type: "string", + default: "8699949" }, }, { diff --git a/frontend/src/windows/main/pages/Settings/FFButtonsCustom.svelte b/frontend/src/windows/main/pages/Settings/FFButtonsCustom.svelte index 2e761ee..cdaf4e7 100644 --- a/frontend/src/windows/main/pages/Settings/FFButtonsCustom.svelte +++ b/frontend/src/windows/main/pages/Settings/FFButtonsCustom.svelte @@ -1,5 +1,5 @@
@@ -71,7 +90,8 @@ async function btnAddFlag() {
- + +
@@ -110,8 +130,6 @@ async function btnAddFlag() { - Options - { diff --git a/frontend/src/windows/main/pages/Settings/Panel.svelte b/frontend/src/windows/main/pages/Settings/Panel.svelte index 9e12045..bc829f6 100644 --- a/frontend/src/windows/main/pages/Settings/Panel.svelte +++ b/frontend/src/windows/main/pages/Settings/Panel.svelte @@ -75,7 +75,7 @@ {#if inter.options.type !== 'button' && inter.options.type !== 'ff_buttons_custom'}

{inter.label}

-

{inter.description}

+

{@html inter.description}

{/if} {#if inter.options.type == 'button'} diff --git a/frontend/src/windows/main/ts/roblox.ts b/frontend/src/windows/main/ts/roblox.ts index 0146b2d..40153e1 100644 --- a/frontend/src/windows/main/ts/roblox.ts +++ b/frontend/src/windows/main/ts/roblox.ts @@ -1,8 +1,11 @@ -import {pathExists} from './utils'; -import {os} from '@neutralinojs/lib'; +import { dataPath } from "./settings"; +import { pathExists } from "./utils"; +import { filesystem, os } from "@neutralinojs/lib"; +import path from "path-browserify"; +/** Checks if roblox is installed, and if not show a popup */ export async function hasRoblox(): Promise { - if (await pathExists('/Applications/Roblox.app/Contents/MacOS/RobloxPlayer')) { + if (await pathExists("/Applications/Roblox.app/Contents/MacOS/RobloxPlayer")) { return true; } else { os.execCommand(`osascript <<'END' @@ -18,7 +21,92 @@ END`); } } +/** Uses cli to check if any instance of roblox is open */ export async function isRobloxOpen() { - const cmd = await os.execCommand('ps aux | grep "Roblox" | grep -v "grep"') - return cmd.stdOut.includes("Roblox") -} \ No newline at end of file + const cmd = await os.execCommand('ps aux | grep "Roblox" | grep -v "grep"'); + return cmd.stdOut.includes("Roblox"); +} + +/** Returns a JSON object in the form of the ClientSettings.json file for the FFLags */ +export async function parseFFlags(preset = false): Promise { + // Get the path to Application Supoort + const appPath = await dataPath(); + let fflagsJson: { [key: string]: string | number } = {}; + if (preset) { + const neuPath = path.join(appPath, "fastflags.neustorage"); + const ohioFinalBoss = JSON.parse(await filesystem.readFile(neuPath)); + // i know this isn't efficient, but i didn't want to re-write the fastlfags saving system. + // in the future, i may change this to a dynamic system. + for (const name of Object.keys(ohioFinalBoss.presets)) { + const data = ohioFinalBoss.presets[name] + console.log(name,data) + switch (name) { + case "ff_fps": + if (data[0] > 60) { + fflagsJson["FFlagDebugGraphicsDisableMetal"] = "true"; + fflagsJson["FFlagDebugGraphicsPreferVulkan"] = "true"; + } + fflagsJson["DFIntTaskSchedulerTargetFps"] = data[0]; + break; + case "ff_lightning": + if (data.disabled) break; + switch (data.value) { + case "voxel": + fflagsJson["DFFlagDebugRenderForceTechnologyVoxel"] = "true"; + break; + case "shadowmap": + fflagsJson["FFlagDebugForceFutureIsBrightPhase2"] = "true"; + break; + case "future": + fflagsJson["FFlagDebugForceFutureIsBrightPhase3"] = "true"; + break; + } + break; + case "ff_engine": + if (data.disabled) break; + switch (data.value) { + // don't know if disabling Metal works, need testing. For now it uses OpenGL + case "opengl": + fflagsJson["FFlagDebugGraphicsDisableMetal"] = "true"; + fflagsJson["FFlagDebugGraphicsPreferOpenGL"] = "true"; + break; + case "metal": + fflagsJson["FFlagDebugGraphicsPreferMetal"] = "true"; + break; + case "vulkan": + fflagsJson["FFlagDebugGraphicsDisableMetal"] = "true"; + fflagsJson["FFlagDebugGraphicsPreferVulkan"] = "true"; + break; + } + break; + case "ff_gui": + if (data.length < 1) break; + fflagsJson["DFIntCanHideGuiGroupId"] = data + break; + case "ff_display": + if (data) { + fflagsJson["DFIntDebugFRMQualityLevelOverride"] = 1 + }; + break; + case "ff_graphics": + if (data) { + fflagsJson["FFlagCommitToGraphicsQualityFix"] = "true" + fflagsJson["FFlagFixGraphicsQuality"] = "true" + } + break; + } + } + return fflagsJson; + } else { + const neuPath = path.join(appPath, "fflags.neustorage"); + const skibidiOhioFanumTax: { flag: string; enabled: boolean; value: string | number }[] = JSON.parse( + await filesystem.readFile(neuPath) + ); + for (const flag of skibidiOhioFanumTax) { + if (flag.enabled) { + fflagsJson[flag.flag] = flag.value; + } + } + return fflagsJson; + } +} diff --git a/frontend/src/windows/main/ts/settings.ts b/frontend/src/windows/main/ts/settings.ts index 5988365..53bbe5c 100644 --- a/frontend/src/windows/main/ts/settings.ts +++ b/frontend/src/windows/main/ts/settings.ts @@ -1,9 +1,11 @@ import {debug, storage, filesystem, os} from '@neutralinojs/lib'; import {pathExists} from './utils'; -async function dataPath(): Promise { +export async function dataPath(): Promise { return `${await os.getPath('data')}/AppleBlox/.storage`; } + +/** Copies the settings folder to Application Support */ async function copyNeuStorage(panelId: string) { const path = await dataPath(); if (!(await pathExists(path))) { diff --git a/neutralino.config.json b/neutralino.config.json index 842f1ac..5b829d8 100644 --- a/neutralino.config.json +++ b/neutralino.config.json @@ -13,7 +13,8 @@ "os.*", "storage.*", "filesystem.*", - "window.*" + "window.*", + "clipboard.*" ], "exportAuthInfo": false, "logging": {