From b8545d68008e7b81c4924459cb5a36de60070b71 Mon Sep 17 00:00:00 2001 From: Vince Au Date: Thu, 13 Jul 2023 17:30:55 +1000 Subject: [PATCH] sorry nikki im indecisive ok --- src/dolphin/config/config.ts | 12 ++++++------ src/dolphin/manager.ts | 2 +- src/renderer/containers/Settings/MeleeOptions.tsx | 10 +++++----- src/renderer/lib/hooks/useSettings.ts | 12 ++++++------ src/settings/api.ts | 6 +++--- src/settings/defaultSettings.ts | 2 +- src/settings/ipc.ts | 2 +- src/settings/settingsManager.ts | 4 ++-- src/settings/setup.ts | 8 ++++---- src/settings/types.ts | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/dolphin/config/config.ts b/src/dolphin/config/config.ts index 5c2ea3685..ee5449299 100644 --- a/src/dolphin/config/config.ts +++ b/src/dolphin/config/config.ts @@ -7,7 +7,7 @@ import type { IniFile } from "./iniFile"; export type SyncedDolphinSettings = { useMonthlySubfolders: boolean; replayPath: string; - jukebox: boolean; + enableJukebox: boolean; }; export async function addGamePath(iniFile: IniFile, gameDir: string): Promise { @@ -20,7 +20,7 @@ export async function addGamePath(iniFile: IniFile, gameDir: string): Promise): Promise { const useMonthlySubfolders = options.useMonthlySubfolders ? "True" : "False"; - const jukebox = options.jukebox ? "True" : "False"; + const enableJukebox = options.enableJukebox ? "True" : "False"; const coreSection = iniFile.getOrCreateSection("Core"); if (options.replayPath !== undefined) { coreSection.set("SlippiReplayDir", options.replayPath); @@ -28,8 +28,8 @@ export async function setSlippiSettings(iniFile: IniFile, options: Partial { diff --git a/src/dolphin/manager.ts b/src/dolphin/manager.ts index 538774321..4b7e09efc 100644 --- a/src/dolphin/manager.ts +++ b/src/dolphin/manager.ts @@ -219,7 +219,7 @@ export class DolphinManager { await this.settingsManager.setRootSlpPath(newSettings.replayPath); await this.settingsManager.setUseMonthlySubfolders(newSettings.useMonthlySubfolders); - await this.settingsManager.setJukebox(newSettings.jukebox); + await this.settingsManager.setEnableJukebox(newSettings.enableJukebox); } private _onStart(dolphinType: DolphinLaunchType) { diff --git a/src/renderer/containers/Settings/MeleeOptions.tsx b/src/renderer/containers/Settings/MeleeOptions.tsx index 0df0ba635..5ca6df7da 100644 --- a/src/renderer/containers/Settings/MeleeOptions.tsx +++ b/src/renderer/containers/Settings/MeleeOptions.tsx @@ -15,7 +15,7 @@ import { Toggle } from "@/components/FormInputs/Toggle"; import { PathInput } from "@/components/PathInput"; import { useDolphinStore } from "@/lib/dolphin/useDolphinStore"; import { useIsoVerification } from "@/lib/hooks/useIsoVerification"; -import { useIsoPath, useJukebox, useLaunchMeleeOnPlay } from "@/lib/hooks/useSettings"; +import { useEnableJukebox, useIsoPath, useLaunchMeleeOnPlay } from "@/lib/hooks/useSettings"; import { SettingItem } from "./SettingItem"; @@ -39,7 +39,7 @@ export const MeleeOptions = React.memo(() => { const isoValidity = useIsoVerification((state) => state.validity); const [isoPath, setIsoPath] = useIsoPath(); const [launchMeleeOnPlay, setLaunchMelee] = useLaunchMeleeOnPlay(); - const [jukebox, setJukebox] = useJukebox(); + const [enableJukebox, setEnableJukebox] = useEnableJukebox(); const netplayDolphinOpen = useDolphinStore((store) => store.netplayOpened); const playbackDolphinOpen = useDolphinStore((store) => store.playbackOpened); @@ -89,10 +89,10 @@ export const MeleeOptions = React.memo(() => { {showJukeboxToggle && ( setJukebox(checked)} + value={enableJukebox} + onChange={(checked) => setEnableJukebox(checked)} label="Enable Music" - description="Enable music in game via Slippi Jukebox. Incompatible with WASAPI." + description="Enable in-game music via Slippi Jukebox. Incompatible with WASAPI." disabled={netplayDolphinOpen} /> diff --git a/src/renderer/lib/hooks/useSettings.ts b/src/renderer/lib/hooks/useSettings.ts index 4f91bfbd1..cce9dcf45 100644 --- a/src/renderer/lib/hooks/useSettings.ts +++ b/src/renderer/lib/hooks/useSettings.ts @@ -42,12 +42,12 @@ export const useMonthlySubfolders = () => { return [useMonthlySubfolders, setUseMonthlySubfolders] as const; }; -export const useJukebox = () => { - const jukebox = useSettings((store) => store.settings.jukebox); - const setJukebox = async (toggle: boolean) => { - await window.electron.settings.setJukebox(toggle); - }; - return [jukebox, setJukebox] as const; +export const useEnableJukebox = () => { + const enableJukebox = useSettings((store) => store.settings.enableJukebox); + const setEnableJukebox = useCallback(async (toggle: boolean) => { + await window.electron.settings.setEnableJukebox(toggle); + }, []); + return [enableJukebox, setEnableJukebox] as const; }; export const useSpectateSlpPath = () => { diff --git a/src/settings/api.ts b/src/settings/api.ts index 25c210fa7..d9a515e58 100644 --- a/src/settings/api.ts +++ b/src/settings/api.ts @@ -7,9 +7,9 @@ import { ipc_editConnection, ipc_openSettingsModalEvent, ipc_setAutoUpdateLauncher, + ipc_setEnableJukebox, ipc_setExtraSlpPaths, ipc_setIsoPath, - ipc_setJukebox, ipc_setLaunchMeleeOnPlay, ipc_setNetplayDolphinPath, ipc_setPlaybackDolphinPath, @@ -45,8 +45,8 @@ export default { async setUseMonthlySubfolders(toggle: boolean): Promise { await ipc_setUseMonthlySubfolders.renderer!.trigger({ toggle }); }, - async setJukebox(toggle: boolean): Promise { - await ipc_setJukebox.renderer!.trigger({ toggle }); + async setEnableJukebox(toggle: boolean): Promise { + await ipc_setEnableJukebox.renderer!.trigger({ toggle }); }, async setSpectateSlpPath(spectateSlpPath: string): Promise { await ipc_setSpectateSlpPath.renderer!.trigger({ path: spectateSlpPath }); diff --git a/src/settings/defaultSettings.ts b/src/settings/defaultSettings.ts index 6c7ea185f..c3eb140dd 100644 --- a/src/settings/defaultSettings.ts +++ b/src/settings/defaultSettings.ts @@ -23,7 +23,7 @@ export const defaultAppSettings: AppSettings = { isoPath: null, rootSlpPath: getDefaultRootSlpPath(), useMonthlySubfolders: false, - jukebox: true, + enableJukebox: true, spectateSlpPath: path.join(getDefaultRootSlpPath(), "Spectate"), extraSlpPaths: [], netplayDolphinPath: path.join(app.getPath("userData"), "netplay"), diff --git a/src/settings/ipc.ts b/src/settings/ipc.ts index 3653997d4..21bc3dfc8 100644 --- a/src/settings/ipc.ts +++ b/src/settings/ipc.ts @@ -15,7 +15,7 @@ export const ipc_setUseMonthlySubfolders = makeEndpoint.main( _, ); -export const ipc_setJukebox = makeEndpoint.main("setJukebox", <{ toggle: boolean }>_, _); +export const ipc_setEnableJukebox = makeEndpoint.main("setEnableJukebox", <{ toggle: boolean }>_, _); export const ipc_setSpectateSlpPath = makeEndpoint.main("setSpectateSlpPath", <{ path: string }>_, _); diff --git a/src/settings/settingsManager.ts b/src/settings/settingsManager.ts index c880c140e..f406f3fc2 100644 --- a/src/settings/settingsManager.ts +++ b/src/settings/settingsManager.ts @@ -65,8 +65,8 @@ export class SettingsManager { await this._set("settings.useMonthlySubfolders", toggle); } - public async setJukebox(toggle: boolean): Promise { - await this._set("settings.jukebox", toggle); + public async setEnableJukebox(toggle: boolean): Promise { + await this._set("settings.enableJukebox", toggle); } public async setSpectateSlpPath(slpPath: string): Promise { diff --git a/src/settings/setup.ts b/src/settings/setup.ts index 2c06e3c1e..bf56f0dc4 100644 --- a/src/settings/setup.ts +++ b/src/settings/setup.ts @@ -9,9 +9,9 @@ import { ipc_deleteConnection, ipc_editConnection, ipc_setAutoUpdateLauncher, + ipc_setEnableJukebox, ipc_setExtraSlpPaths, ipc_setIsoPath, - ipc_setJukebox, ipc_setLaunchMeleeOnPlay, ipc_setNetplayDolphinPath, ipc_setPlaybackDolphinPath, @@ -63,10 +63,10 @@ export default function setupSettingsIpc({ return { success: true }; }); - ipc_setJukebox.main!.handle(async ({ toggle }) => { - await settingsManager.setJukebox(toggle); + ipc_setEnableJukebox.main!.handle(async ({ toggle }) => { + await settingsManager.setEnableJukebox(toggle); const installation = dolphinManager.getInstallation(DolphinLaunchType.NETPLAY); - await installation.updateSettings({ jukebox: toggle }); + await installation.updateSettings({ enableJukebox: toggle }); return { success: true }; }); diff --git a/src/settings/types.ts b/src/settings/types.ts index 087d18e7f..c999c771d 100644 --- a/src/settings/types.ts +++ b/src/settings/types.ts @@ -21,7 +21,7 @@ export type AppSettings = { isoPath: string | null; rootSlpPath: string; useMonthlySubfolders: boolean; - jukebox: boolean; + enableJukebox: boolean; spectateSlpPath: string; extraSlpPaths: string[]; netplayDolphinPath: string;