[feat/663] moved to advanced settings section + finalisations + old comments

This commit is contained in:
LiamillionSS
2024-11-23 08:14:52 +11:00
parent 4f42b3ffcf
commit 3741558ffb
19 changed files with 98 additions and 37 deletions
@@ -29,6 +29,9 @@ export abstract class AbstractLauncherService {
if (launchOptions.additionalArgs) {
launchArgs.push(...launchOptions.additionalArgs);
}
if (launchOptions.launchVR) {
launchArgs.push(...launchOptions.launchVR);
}
return Array.from(new Set(launchArgs).values());
}
@@ -105,7 +105,8 @@ export class BSLauncherService {
oculus: params.oculusMode === "true",
desktop: params.desktopMode === "true",
debug: params.debug === "true",
additionalArgs: params.additionalArgs
additionalArgs: params.additionalArgs,
skipVR: params.skipVR === "true",
};
return res;
@@ -123,6 +124,7 @@ export class BSLauncherService {
if(launchOptions.desktop){ res.desktopMode = "true"; }
if(launchOptions.debug){ res.debug = "true"; }
if(launchOptions.additionalArgs){ res.additionalArgs = launchOptions.additionalArgs; }
if(launchOptions.skipVR){ res.skipVR = "true"; }
return res;
}
@@ -239,6 +241,7 @@ type ShortcutParams = {
desktopMode?: string;
debug?: string;
additionalArgs?: string[];
skipVR?: string;
version: string;
versionName?: string;
versionIno?: string;
@@ -77,8 +77,10 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
throw CustomError.fromError(new Error(`Path not exist : ${exePath}`), BSLaunchError.BS_NOT_FOUND);
}
const skipVR: boolean = launchOptions.skipVR ?? false;
// Open Steam if not running
if(!(await this.steam.steamRunning())){
if(!skipVR && !(await this.steam.steamRunning())){
obs.next({type: BSLaunchEvent.STEAM_LAUNCHING});
await this.steam.openSteam().then(() => {
@@ -88,6 +90,9 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
obs.next({type: BSLaunchWarning.UNABLE_TO_LAUNCH_STEAM});
});
}
else if (!launchOptions.desktop) {
obs.next({ type: BSLaunchEvent.SKIPPING_STEAM_LAUNCH});
}
// Backup SteamVR when desktop mode is enabled
if(launchOptions.desktop){
@@ -35,7 +35,7 @@ export function BsVersionItem(props: { version: BSVersion }) {
useOnUpdate(() => {
const subs: Subscription[] = []
subs.push(bsDownloader.downloadingVersion$.pipe(map(download => equal(download, props.version)), distinctUntilChanged()).subscribe(isDownloading => {
setIsDownloading(() => isDownloading);
}));
@@ -63,6 +63,7 @@ export function BsVersionItem(props: { version: BSVersion }) {
oculus: !!configService.get<boolean>(LaunchMods.OCULUS_MOD),
desktop: !!configService.get<boolean>(LaunchMods.DESKTOP_MOD),
debug: !!configService.get<boolean>(LaunchMods.DEBUG_MOD),
skipVR: !!configService.get<boolean>(LaunchMods.SKIPVR_MOD),
});
return lastValueFrom(launch$).catch(() => {});
};
@@ -67,7 +67,7 @@ import { BrowseIcon } from "./icons/browse-icon.component";
import { AddFileIcon } from "./icons/add-file-icon.component";
export type BsmIconType = SongDetailDiffCharactertistic | ("settings" | "trash" | "favorite" | "folder" | "bsNote" | "check" | "three-dots" | "twitch" | "eye" | "play" | "checkCircleIcon" | "discord" | "info" | "eye-cross" | "terminal" | "desktop" | "oculus" | "add" | "cross" | "task" | "github" | "close" | "thumbUpFill" | "timerFill" | "pause" | "twitter" | "sync" | "chevron-top" | "copy" | "steam" | "edit" | "export" | "patreon" | "search" | "bsMapDifficulty" | "link" | "unlink" | "download" | "filter" | "mee6" | "volume-up" | "volume-off" | "volume-down" | "shortcut" | "backup-restore" | "web-site" | "clean" | "browse" | "add-file" | "fr-FR-flag" | "es-ES-flag" | "en-US-flag" | "en-EN-flag" | "de-DE-flag" | "ru-RU-flag" | "zh-CN-flag" | "zh-TW-flag" | "ja-JP-flag" | "ko-KR-flag");
export type BsmIconType = SongDetailDiffCharactertistic | ("settings" | "trash" | "favorite" | "folder" | "bsNote" | "check" | "three-dots" | "twitch" | "eye" | "play" | "checkCircleIcon" | "discord" | "info" | "eye-cross" | "terminal" | "desktop" | "oculus" | "add" | "cross" | "task" | "github" | "close" | "thumbUpFill" | "timerFill" | "pause" | "twitter" | "sync" | "chevron-top" | "copy" | "steam" | "edit" | "export" | "patreon" | "search" | "bsMapDifficulty" | "link" | "unlink" | "download" | "filter" | "mee6" | "volume-up" | "volume-off" | "volume-down" | "shortcut" | "backup-restore" | "web-site" | "clean" | "browse" | "add-file" | "fr-FR-flag" | "es-ES-flag" | "en-US-flag" | "en-EN-flag" | "de-DE-flag" | "ru-RU-flag" | "zh-CN-flag" | "zh-TW-flag" | "ja-JP-flag" | "ko-KR-flag" | "null" );
export const BsmIcon = memo(({ className, icon, style }: { className?: string; icon: BsmIconType; style?: CSSProperties }) => {
// TODO : Very ugly very messy, need to find a better way to do this
@@ -275,7 +275,9 @@ export const BsmIcon = memo(({ className, icon, style }: { className?: string; i
if(icon === "add-file") {
return <AddFileIcon className={className} style={style} />;
}
if(icon === "null") {
return null;
}
return <TrashIcon className={className} style={style} />;
@@ -18,11 +18,11 @@ export function LaunchModToogle({ onClick, active, text, icon, infoText }: Props
<div className={`relative rounded-full cursor-pointer group active:scale-95 transition-transform ${!active && "shadow-md shadow-black"}`} onClick={() => onClick(!active)}>
<GlowEffect visible={active} className="absolute !rounded-full blur-[2px]" />
<div className="w-full h-full px-6 flex gap-1.5 justify-center items-center bg-light-main-color-2 dark:bg-main-color-2 p-3 rounded-full text-gray-800 dark:text-white group-hover:bg-light-main-color-1 dark:group-hover:bg-main-color-1">
<BsmIcon icon={icon} className="h-7 text-gray-800 dark:text-white" />
<BsmIcon icon={icon} className="h-7 shrink-0 text-gray-800 dark:text-white" />
<span className="w-fit min-w-fit text-lg font-bold uppercase tracking-wide italic ">{t(text)}</span>
{infoText && (
<Tippy content={t(infoText)} placement="bottom" delay={[400, 0]}>
<div className="h-[25px] w-[25px] p-1.5 rounded-full cursor-help bg-light-main-color-1 dark:bg-main-color-3 hover:brightness-110">
<div className="h-[25px] w-[25px] shrink-0 p-1.5 rounded-full cursor-help bg-light-main-color-1 dark:bg-main-color-3 hover:brightness-110">
<BsmIcon className="w-full h-full" icon="info" />
</div>
</Tippy>
@@ -30,6 +30,7 @@ export function LaunchSlide({ version }: Props) {
const [debugMode, setDebugMode] = useState(!!configService.get<boolean>(LaunchMods.DEBUG_MOD));
const [advancedLaunch, setAdvancedLaunch] = useState(false);
const [additionalArgsString, setAdditionalArgsString] = useState<string>(configService.get<string>("additionnal-args") || "");
const [skipVRMode, setSkipVRMode] = useState(!!configService.get<boolean>(LaunchMods.SKIPVR_MOD));
const versionDownloading = useObservable(() => bsDownloader.downloadingVersion$);
const versionRunning = useObservable(() => bsLauncherService.versionRunning$);
@@ -51,6 +52,8 @@ export function LaunchSlide({ version }: Props) {
setOculusMode(value);
} else if (mode === LaunchMods.DESKTOP_MOD) {
setDesktopMode(value);
} else if (mode === LaunchMods.SKIPVR_MOD) {
setSkipVRMode(value);
}
configService.set(mode, value);
};
@@ -66,6 +69,7 @@ export function LaunchSlide({ version }: Props) {
desktop: desktopMode,
debug: debugMode,
additionalArgs: advancedLaunch ? additionalArgs : [],
skipVR: skipVRMode,
});
return lastValueFrom(launch$).catch(() => {});
@@ -98,6 +102,9 @@ export function LaunchSlide({ version }: Props) {
<div className="bg-light-main-color-2 dark:bg-main-color-2 h-9 rounded-full overflow-hidden flex items-center justify-center transition-all duration-100 ease-in-out w-full origin-top shadow-black shadow-sm" style={{ scale: advancedLaunch ? "100% 100%" : "0 0" }}>
<input className="w-[calc(100%-12px)] h-[calc(100%-12px)] bg-light-main-color-1 dark:bg-main-color-1 text-black dark:text-white rounded-full outline-none text-center" type="text" placeholder={t("pages.version-viewer.launch-mods.advanced-launch.placeholder")} value={additionalArgsString} onChange={handleAdditionalArgsChange} />
</div>
<div className="grid grid-cols-3 gap-3 transition-all duration-300 ease-in-out origin-top" style={{ scale: advancedLaunch ? "75% 75%" : "0% 0%" }}>
{advancedLaunch && !(version.oculus || version.metadata?.store === BsStore.OCULUS) && <LaunchModToogle infoText="pages.version-viewer.launch-mods.skipvr-description" icon="null" onClick={() => setMode(LaunchMods.SKIPVR_MOD, !skipVRMode)} active={skipVRMode} text="pages.version-viewer.launch-mods.skipvr" />}
</div>
</div>
<div className='grow flex justify-center items-center'>
<BsmButton
+3 -1
View File
@@ -50,7 +50,8 @@ export class BSLauncherService {
oculus: this.config.get(LaunchMods.OCULUS_MOD),
desktop: this.config.get(LaunchMods.DESKTOP_MOD),
debug: this.config.get(LaunchMods.DEBUG_MOD),
additionalArgs: (this.config.get<string>("additionnal-args") || "").split(";").map(arg => arg.trim()).filter(arg => arg.length > 0)
additionalArgs: (this.config.get<string>("additionnal-args") || "").split(";").map(arg => arg.trim()).filter(arg => arg.length > 0),
skipVR: this.config.get(LaunchMods.SKIPVR_MOD),
}
}
@@ -128,4 +129,5 @@ export enum LaunchMods {
OCULUS_MOD = "LAUNCH_OCULUS_MOD",
DESKTOP_MOD = "LAUNCH_DESKTOP_MOD",
DEBUG_MOD = "LAUNCH_DEBUG_MOD",
SKIPVR_MOD = "LAUNCH_SKIPVR_MOD",
}
@@ -23,6 +23,7 @@ export enum BSLaunchError{
export enum BSLaunchEvent{
STEAM_LAUNCHING = "STEAM_LAUNCHING",
STEAM_LAUNCHED = "STEAM_LAUNCHED",
SKIPPING_STEAM_LAUNCH = "SKIPPING_STEAM_LAUNCH",
BS_LAUNCHING = "BS_LAUNCHING",
}
@@ -7,4 +7,5 @@ export interface LaunchOption {
debug?: boolean,
additionalArgs?: string[],
admin?: boolean,
skipVR?: boolean
}