diff --git a/src/dolphin/api.ts b/src/dolphin/api.ts index da9426311..9296477ce 100644 --- a/src/dolphin/api.ts +++ b/src/dolphin/api.ts @@ -2,14 +2,12 @@ import type { GeckoCode } from "./config/gecko_code"; import { - ipc_checkDesktopAppDolphin, ipc_checkPlayKeyExists, ipc_configureDolphin, ipc_dolphinEvent, ipc_downloadDolphin, ipc_fetchGeckoCodes, ipc_hardResetDolphin, - ipc_importDolphinSettings, ipc_launchNetplayDolphin, ipc_openDolphinSettingsFolder, ipc_removePlayKeyFile, @@ -59,13 +57,6 @@ const dolphinApi: DolphinService = { async launchNetplayDolphin(options: { bootToCss?: boolean }): Promise { await ipc_launchNetplayDolphin.renderer!.trigger(options); }, - async checkDesktopAppDolphin() { - const { result } = await ipc_checkDesktopAppDolphin.renderer!.trigger({}); - return result; - }, - async importDolphinSettings(options: { toImportDolphinPath: string; dolphinType: DolphinLaunchType }): Promise { - await ipc_importDolphinSettings.renderer!.trigger(options); - }, async fetchGeckoCodes(dolphinType: DolphinLaunchType): Promise { const { result } = await ipc_fetchGeckoCodes.renderer!.trigger({ dolphinType }); return result.codes; diff --git a/src/dolphin/ipc.ts b/src/dolphin/ipc.ts index b1056002f..897fda7af 100644 --- a/src/dolphin/ipc.ts +++ b/src/dolphin/ipc.ts @@ -54,19 +54,6 @@ export const ipc_launchNetplayDolphin = makeEndpoint.main( _, ); -export const ipc_checkDesktopAppDolphin = makeEndpoint.main( - "getDesktopAppDolphinPath", - _, - <{ dolphinPath: string; exists: boolean }>_, -); - -// toImportDolphin path must point to a "Slippi Dolphin.{exe,app}" -export const ipc_importDolphinSettings = makeEndpoint.main( - "importDolphinSettings", - <{ toImportDolphinPath: string; dolphinType: DolphinLaunchType }>_, - _, -); - export const ipc_fetchGeckoCodes = makeEndpoint.main( "fetchGeckoCodes", <{ dolphinType: DolphinLaunchType }>_, diff --git a/src/dolphin/setup.ts b/src/dolphin/setup.ts index 5b517cf43..f71cbf226 100644 --- a/src/dolphin/setup.ts +++ b/src/dolphin/setup.ts @@ -1,19 +1,16 @@ -import { app, shell } from "electron"; +import { shell } from "electron"; import log from "electron-log"; import * as fs from "fs-extra"; import isEqual from "lodash/isEqual"; -import path from "path"; import { fileExists } from "utils/file_exists"; import { - ipc_checkDesktopAppDolphin, ipc_checkPlayKeyExists, ipc_configureDolphin, ipc_dolphinEvent, ipc_downloadDolphin, ipc_fetchGeckoCodes, ipc_hardResetDolphin, - ipc_importDolphinSettings, ipc_launchNetplayDolphin, ipc_openDolphinSettingsFolder, ipc_removePlayKeyFile, @@ -25,10 +22,7 @@ import { import type { DolphinManager } from "./manager"; import { deletePlayKeyFile, writePlayKeyFile } from "./playkey"; import { DolphinLaunchType } from "./types"; -import { fetchGeckoCodes, findDolphinExecutable, saveGeckoCodes, updateBootToCssCode } from "./util"; - -const isMac = process.platform === "darwin"; -const isLinux = process.platform === "linux"; +import { fetchGeckoCodes, saveGeckoCodes, updateBootToCssCode } from "./util"; export default function setupDolphinIpc({ dolphinManager }: { dolphinManager: DolphinManager }) { dolphinManager.events.subscribe((event) => { @@ -119,41 +113,6 @@ export default function setupDolphinIpc({ dolphinManager }: { dolphinManager: Do return { success: true }; }); - ipc_importDolphinSettings.main!.handle(async ({ toImportDolphinPath, dolphinType }) => { - let dolphinPath = toImportDolphinPath; - if (isMac) { - dolphinPath = path.join(dolphinPath, "Contents", "Resources"); - } else { - dolphinPath = path.dirname(dolphinPath); - } - - await dolphinManager.importConfig(dolphinType, dolphinPath); - return { success: true }; - }); - - ipc_checkDesktopAppDolphin.main!.handle(async () => { - // get the path and check existence - const desktopAppPath = path.join(app.getPath("appData"), "Slippi Desktop App"); - let exists = await fs.pathExists(desktopAppPath); - - if (!exists) { - return { dolphinPath: "", exists: false }; - } - - // Linux doesn't need to do anything because their dolphin settings are in a user config dir - if (isLinux && exists) { - await fs.remove(desktopAppPath); - return { dolphinPath: "", exists: false }; - } - - const dolphinFolderPath = path.join(desktopAppPath, "dolphin"); - exists = await fs.pathExists(dolphinFolderPath); - - const dolphinExecutablePath = await findDolphinExecutable(DolphinLaunchType.NETPLAY, dolphinFolderPath); - - return { dolphinPath: dolphinExecutablePath, exists: exists }; - }); - ipc_fetchGeckoCodes.main!.handle(async ({ dolphinType }) => { const installation = dolphinManager.getInstallation(dolphinType); const codes = await fetchGeckoCodes(installation); diff --git a/src/dolphin/types.ts b/src/dolphin/types.ts index 0a8244da1..c4770ca0b 100644 --- a/src/dolphin/types.ts +++ b/src/dolphin/types.ts @@ -111,8 +111,6 @@ export interface DolphinService { removePlayKeyFile(): Promise; viewSlpReplay(files: ReplayQueueItem[]): Promise; launchNetplayDolphin(options: { bootToCss?: boolean }): Promise; - checkDesktopAppDolphin(): Promise<{ dolphinPath: string; exists: boolean }>; - importDolphinSettings(options: { toImportDolphinPath: string; dolphinType: DolphinLaunchType }): Promise; fetchGeckoCodes(dolphinLaunchType: DolphinLaunchType): Promise; saveGeckoCodes(dolphinLaunchType: DolphinLaunchType, geckoCodes: GeckoCode[]): Promise; onEvent(eventType: T, handle: (event: DolphinEventMap[T]) => void): () => void; diff --git a/src/main/api.ts b/src/main/api.ts index a24143c10..be12ee6f5 100644 --- a/src/main/api.ts +++ b/src/main/api.ts @@ -5,7 +5,6 @@ import { ipc_checkValidIso, ipc_clearTempFolder, ipc_copyLogsToClipboard, - ipc_deleteDesktopAppPath, ipc_deleteFiles, ipc_fetchNewsFeed, ipc_getLatestGitHubReleaseVersion, @@ -35,9 +34,6 @@ export default { async deleteFiles(filePaths: string[]) { await ipc_deleteFiles.renderer!.trigger({ filePaths }); }, - async deleteDesktopAppPath() { - await ipc_deleteDesktopAppPath.renderer!.trigger({}); - }, async copyLogsToClipboard(): Promise { await ipc_copyLogsToClipboard.renderer!.trigger({}); }, diff --git a/src/main/ipc.ts b/src/main/ipc.ts index 26b78ca6d..f4377407c 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -10,8 +10,6 @@ export const ipc_checkValidIso = makeEndpoint.main( <{ path: string; valid: IsoValidity }>_, ); -export const ipc_deleteDesktopAppPath = makeEndpoint.main("deleteDesktopAppPath", _, _); - export const ipc_copyLogsToClipboard = makeEndpoint.main("copyLogsToClipboard", _, _); export const ipc_checkForUpdate = makeEndpoint.main("checkForUpdate", _, _); diff --git a/src/main/setup.ts b/src/main/setup.ts index c570b6d82..e7abe993c 100644 --- a/src/main/setup.ts +++ b/src/main/setup.ts @@ -18,7 +18,6 @@ import { ipc_checkValidIso, ipc_clearTempFolder, ipc_copyLogsToClipboard, - ipc_deleteDesktopAppPath, ipc_deleteFiles, ipc_fetchNewsFeed, ipc_getLatestGitHubReleaseVersion, @@ -90,14 +89,6 @@ export default function setupMainIpc({ } }); - ipc_deleteDesktopAppPath.main!.handle(async () => { - // get the path and remove - const desktopAppPath = path.join(app.getPath("appData"), "Slippi Desktop App"); - await fs.remove(desktopAppPath); - - return { success: true }; - }); - ipc_copyLogsToClipboard.main!.handle(async () => { let logsFolder = isMac ? app.getPath("logs") : path.resolve(app.getPath("userData"), "logs"); if (isDevelopment) { diff --git a/src/renderer/lib/dolphin/use_dolphin_actions.ts b/src/renderer/lib/dolphin/use_dolphin_actions.ts index 1b0ce9d05..59c1c91f6 100644 --- a/src/renderer/lib/dolphin/use_dolphin_actions.ts +++ b/src/renderer/lib/dolphin/use_dolphin_actions.ts @@ -8,7 +8,7 @@ import { useToasts } from "@/lib/hooks/use_toasts"; import { DolphinStatus, setDolphinOpened, useDolphinStore } from "./use_dolphin_store"; export const useDolphinActions = (dolphinService: DolphinService) => { - const { showError, showSuccess } = useToasts(); + const { showError } = useToasts(); const netplayStatus = useDolphinStore((store) => store.netplayStatus); const playbackStatus = useDolphinStore((store) => store.playbackStatus); @@ -114,18 +114,6 @@ export const useDolphinActions = (dolphinService: DolphinService) => { [getInstallStatus, dolphinService, showError], ); - const importDolphin = useCallback( - (toImportDolphinPath: string, dolphinType: DolphinLaunchType) => { - dolphinService - .importDolphinSettings({ toImportDolphinPath, dolphinType }) - .then(() => { - showSuccess(`${dolphinType} Dolphin settings successfully imported`); - }) - .catch(showError); - }, - [dolphinService, showError, showSuccess], - ); - const readGeckoCodes = useCallback( async (dolphinType: DolphinLaunchType) => { if (getInstallStatus(dolphinType) !== DolphinStatus.READY) { @@ -155,7 +143,6 @@ export const useDolphinActions = (dolphinService: DolphinService) => { hardResetDolphin, launchNetplay, viewReplays, - importDolphin, updateDolphin, readGeckoCodes, saveGeckoCodes, diff --git a/src/renderer/lib/hooks/use_app.ts b/src/renderer/lib/hooks/use_app.ts index 4e4ce962b..18ab2e267 100644 --- a/src/renderer/lib/hooks/use_app.ts +++ b/src/renderer/lib/hooks/use_app.ts @@ -8,8 +8,6 @@ import { useToasts } from "@/lib/hooks/use_toasts"; import { useServices } from "@/services"; import type { AuthUser } from "@/services/auth/types"; -import { useDesktopApp } from "./use_quick_start"; - export const useAppStore = create( combine( { @@ -39,8 +37,6 @@ export const useAppInitialization = () => { const setUserData = useAccount((store) => store.setUserData); const setUser = useAccount((store) => store.setUser); const setServerError = useAccount((store) => store.setServerError); - const setDesktopAppExists = useDesktopApp((store) => store.setExists); - const setDesktopAppDolphinPath = useDesktopApp((store) => store.setDolphinPath); const initialize = async () => { if (initializing || initialized) { @@ -93,16 +89,6 @@ export const useAppInitialization = () => { }); }); - promises.push( - dolphinService - .checkDesktopAppDolphin() - .then(({ exists, dolphinPath }) => { - setDesktopAppExists(exists); - setDesktopAppDolphinPath(dolphinPath); - }) - .catch(log.error), - ); - // Check if there is an update to the launcher promises.push(window.electron.common.checkForAppUpdates()); diff --git a/src/renderer/lib/hooks/use_quick_start.ts b/src/renderer/lib/hooks/use_quick_start.ts index c8b7f278e..80936e32f 100644 --- a/src/renderer/lib/hooks/use_quick_start.ts +++ b/src/renderer/lib/hooks/use_quick_start.ts @@ -1,8 +1,6 @@ import { currentRulesVersion } from "@common/constants"; import React from "react"; import { useNavigate } from "react-router-dom"; -import { create } from "zustand"; -import { combine } from "zustand/middleware"; import { useSettings } from "@/lib/hooks/use_settings"; @@ -12,7 +10,6 @@ export enum QuickStartStep { LOGIN = "LOGIN", VERIFY_EMAIL = "VERIFY_EMAIL", ACCEPT_RULES = "ACCEPT_RULES", - MIGRATE_DOLPHIN = "MIGRATE_DOLPHIN", ACTIVATE_ONLINE = "ACTIVATE_ONLINE", SET_ISO_PATH = "SET_ISO_PATH", COMPLETE = "COMPLETE", @@ -26,7 +23,6 @@ function generateSteps( showRules: boolean; serverError: boolean; hasIso: boolean; - hasOldDesktopApp: boolean; }>, ): QuickStartStep[] { // Build the steps in reverse order @@ -36,10 +32,6 @@ function generateSteps( steps.unshift(QuickStartStep.SET_ISO_PATH); } - if (options.hasOldDesktopApp) { - steps.unshift(QuickStartStep.MIGRATE_DOLPHIN); - } - if (!options.hasPlayKey && !options.serverError) { steps.unshift(QuickStartStep.ACTIVATE_ONLINE); } @@ -65,7 +57,6 @@ export const useQuickStart = () => { const user = useAccount((store) => store.user); const userData = useAccount((store) => store.userData); const serverError = useAccount((store) => store.serverError); - const desktopAppPathExists = useDesktopApp((store) => store.exists); const options = { hasUser: Boolean(user), hasIso: Boolean(savedIsoPath), @@ -73,7 +64,6 @@ export const useQuickStart = () => { hasPlayKey: Boolean(userData?.playKey), showRules: Boolean((userData?.rulesAccepted ?? 0) < currentRulesVersion), serverError: Boolean(serverError), - hasOldDesktopApp: desktopAppPathExists, }; const [steps] = React.useState(generateSteps(options)); const [currentStep, setCurrentStep] = React.useState(null); @@ -90,10 +80,6 @@ export const useQuickStart = () => { stepToShow = QuickStartStep.SET_ISO_PATH; } - if (options.hasOldDesktopApp) { - stepToShow = QuickStartStep.MIGRATE_DOLPHIN; - } - if (!options.hasPlayKey && !options.serverError) { stepToShow = QuickStartStep.ACTIVATE_ONLINE; } @@ -115,7 +101,6 @@ export const useQuickStart = () => { steps, options.hasIso, options.hasVerifiedEmail, - options.hasOldDesktopApp, options.hasPlayKey, options.hasUser, options.showRules, @@ -144,18 +129,3 @@ export const useQuickStart = () => { prevStep, }; }; - -export const oldDesktopApp = { path: "", exists: false }; - -export const useDesktopApp = create( - combine( - { - exists: false, - dolphinPath: "", - }, - (set) => ({ - setExists: (exists: boolean) => set({ exists }), - setDolphinPath: (dolphinPath: string) => set({ dolphinPath }), - }), - ), -); diff --git a/src/renderer/pages/quick_start/quick_start.tsx b/src/renderer/pages/quick_start/quick_start.tsx index 6822aca5a..c61b59c1d 100644 --- a/src/renderer/pages/quick_start/quick_start.tsx +++ b/src/renderer/pages/quick_start/quick_start.tsx @@ -11,7 +11,6 @@ import { platformTitleBarStyles } from "@/styles/platform_title_bar_styles"; import { AcceptRulesStep } from "./steps/accept_rules_step"; import { ActivateOnlineStep } from "./steps/activate_online_step"; -import { ImportDolphinSettingsStep } from "./steps/import_dolphin_settings_step"; import { IsoSelectionStep } from "./steps/iso_selection_step"; import { LoginStep } from "./steps/login_step"; import { SetupCompleteStep } from "./steps/setup_complete_step"; @@ -43,8 +42,6 @@ const getStepContent = (step: QuickStartStep | null) => { return ; case QuickStartStep.ACTIVATE_ONLINE: return ; - case QuickStartStep.MIGRATE_DOLPHIN: - return ; case QuickStartStep.SET_ISO_PATH: return ; case QuickStartStep.COMPLETE: diff --git a/src/renderer/pages/quick_start/steps/import_dolphin_settings_step.tsx b/src/renderer/pages/quick_start/steps/import_dolphin_settings_step.tsx deleted file mode 100644 index 6ca73f965..000000000 --- a/src/renderer/pages/quick_start/steps/import_dolphin_settings_step.tsx +++ /dev/null @@ -1,167 +0,0 @@ -import { DolphinLaunchType } from "@dolphin/types"; -import { css } from "@emotion/react"; -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; -import Container from "@mui/material/Container"; -import FormHelperText from "@mui/material/FormHelperText"; -import React from "react"; -import { Controller, useForm } from "react-hook-form"; - -import { Checkbox } from "@/components/form/checkbox"; -import { PathInput } from "@/components/path_input"; -import { useDolphinActions } from "@/lib/dolphin/use_dolphin_actions"; -import { useDesktopApp } from "@/lib/hooks/use_quick_start"; -import { useToasts } from "@/lib/hooks/use_toasts"; -import { useServices } from "@/services"; - -import { QuickStartHeader } from "../quick_start_header/quick_start_header"; - -const isMac = window.electron.bootstrap.isMac; - -type FormValues = { - netplayPath: string; - shouldImportPlayback: boolean; - shouldImportNetplay: boolean; -}; - -export const ImportDolphinSettingsStep = React.memo(() => { - const setExists = useDesktopApp((store) => store.setExists); - const desktopAppDolphinPath = useDesktopApp((store) => store.dolphinPath); - const { showError } = useToasts(); - const { dolphinService } = useServices(); - const { importDolphin } = useDolphinActions(dolphinService); - - const migrateDolphin = async (values: FormValues) => { - if (values.shouldImportNetplay) { - importDolphin(values.netplayPath, DolphinLaunchType.NETPLAY); - } - if (values.shouldImportPlayback) { - importDolphin(desktopAppDolphinPath, DolphinLaunchType.PLAYBACK); - } - - await finishMigration(); - }; - - const finishMigration = async () => { - // delete desktop app path - await window.electron.common.deleteDesktopAppPath(); - setExists(false); - }; - - const { - handleSubmit, - watch, - control, - setValue, - formState: { errors }, - } = useForm({ - defaultValues: { netplayPath: "", shouldImportNetplay: false, shouldImportPlayback: false }, - }); - const netplayPath = watch("netplayPath"); - const migrateNetplay = watch("shouldImportNetplay"); - const migratePlayback = watch("shouldImportPlayback"); - - const onFormSubmit = handleSubmit((values) => { - migrateDolphin(values).catch(showError); - }); - - const extension = isMac ? "app" : "exe"; - return ( - - - Import old Dolphin settings -
Which Dolphin settings would you like to import?
- -
* { - margin-top: 5px; - } - `} - > - setValue("shouldImportPlayback", !migratePlayback)} - /> - setValue("shouldImportNetplay", !migrateNetplay)} - /> -
-
-
- {migrateNetplay && ( -
-
- Select the Dolphin.{extension} with the desired netplay settings. -
- ( - setValue("netplayPath", newPath)} - placeholder="No Netplay Dolphin selected" - options={{ - filters: [{ name: "Slippi Dolphin", extensions: [isMac ? "app" : "exe"] }], - }} - /> - )} - rules={{ validate: (val) => val.length > 0 || "No path selected" }} - /> -
- {errors?.netplayPath?.message} -
-
- )} - -
- - -
-
-
-
-
- ); -}); diff --git a/src/renderer/pages/settings/dolphin_settings/dolphin_settings.tsx b/src/renderer/pages/settings/dolphin_settings/dolphin_settings.tsx index 6f008222b..4a1f8c0b3 100644 --- a/src/renderer/pages/settings/dolphin_settings/dolphin_settings.tsx +++ b/src/renderer/pages/settings/dolphin_settings/dolphin_settings.tsx @@ -6,7 +6,6 @@ import FormControlLabel from "@mui/material/FormControlLabel"; import Radio from "@mui/material/Radio"; import RadioGroup from "@mui/material/RadioGroup"; import Typography from "@mui/material/Typography"; -import log from "electron-log"; import capitalize from "lodash/capitalize"; import React from "react"; @@ -20,8 +19,6 @@ import { useServices } from "@/services"; import { SettingItem } from "../setting_item_section"; import { GeckoCodes } from "./gecko_codes/gecko_codes"; -const { isMac, isWindows } = window.electron.bootstrap; - enum ResetType { SOFT, HARD, @@ -41,7 +38,7 @@ export const DolphinSettings = ({ dolphinType }: { dolphinType: DolphinLaunchTyp const [resetModalOpen, setResetModalOpen] = React.useState(false); const [isResetType, setResetType] = React.useState(null); const { dolphinService } = useServices(); - const { openConfigureDolphin, hardResetDolphin, softResetDolphin, importDolphin } = useDolphinActions(dolphinService); + const { openConfigureDolphin, hardResetDolphin, softResetDolphin } = useDolphinActions(dolphinService); const { showWarning } = useToasts(); const dolphinIsReady = dolphinStatus === DolphinStatus.READY && !dolphinIsOpen && isResetType === null; const versionString: string = @@ -78,11 +75,6 @@ export const DolphinSettings = ({ dolphinType }: { dolphinType: DolphinLaunchTyp setResetType(null); }; - const importDolphinHandler = (importPath: string) => { - log.info(`importing dolphin from ${importPath}`); - importDolphin(importPath, dolphinType); - }; - const dolphinTypeName = capitalize(dolphinType); return (
@@ -181,48 +173,6 @@ export const DolphinSettings = ({ dolphinType }: { dolphinType: DolphinLaunchTyp )} - {isWindows && ( - - )}
); }; - -const ImportDolphinConfigForm = ({ - dolphinType, - disabled, - onImportDolphin, -}: { - dolphinType: DolphinLaunchType; - disabled?: boolean; - onImportDolphin: (importPath: string) => void; -}) => { - const dolphinTypeName = capitalize(dolphinType); - const extension = isMac ? "app" : "exe"; - - const onImportClick = async () => { - const result = await window.electron.common.showOpenDialog({ - filters: [{ name: "Slippi Dolphin", extensions: [isMac ? "app" : "exe"] }], - }); - const res = result.filePaths; - if (result.canceled || res.length === 0) { - return; - } - onImportDolphin(res[0]); - }; - - return ( - - - - ); -}; diff --git a/src/renderer/services/dolphin/dolphin.service.mock.ts b/src/renderer/services/dolphin/dolphin.service.mock.ts index 5abec8139..cfaaa8731 100644 --- a/src/renderer/services/dolphin/dolphin.service.mock.ts +++ b/src/renderer/services/dolphin/dolphin.service.mock.ts @@ -85,19 +85,6 @@ class MockDolphinClient implements DolphinService { throw new Error("Method not implemented."); } - @delayAndMaybeError(SHOULD_ERROR) - public async checkDesktopAppDolphin(): Promise<{ dolphinPath: string; exists: boolean }> { - throw new Error("Method not implemented."); - } - - @delayAndMaybeError(SHOULD_ERROR) - public async importDolphinSettings(_options: { - toImportDolphinPath: string; - dolphinType: DolphinLaunchType; - }): Promise { - throw new Error("Method not implemented."); - } - @delayAndMaybeError(SHOULD_ERROR) public async openDolphinSettingsFolder(_dolphinType: DolphinLaunchType): Promise { throw new Error("Method not implemented.");