From 3356bc2c8edd5380b16fc2ad4cb9c4dac9c2e544 Mon Sep 17 00:00:00 2001 From: Vince Au Date: Tue, 1 Dec 2020 10:01:33 +1100 Subject: [PATCH] Don't rename OBS files by default --- src/renderer/containers/OBSStatusBar.tsx | 13 ++++++++---- src/renderer/lib/dolphin.ts | 14 ++++++++----- src/renderer/store/models/appContainer.ts | 7 +++++++ .../views/settings/PlaybackSettings.tsx | 21 ++++++++++++++++--- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/renderer/containers/OBSStatusBar.tsx b/src/renderer/containers/OBSStatusBar.tsx index 5ad2dc8f..b528f70f 100644 --- a/src/renderer/containers/OBSStatusBar.tsx +++ b/src/renderer/containers/OBSStatusBar.tsx @@ -48,10 +48,14 @@ const StopButton = styled(Button)` export const OBSStatusBar: React.FC = () => { const history = useHistory(); - const { recordSeparateClips } = useSelector((state: iRootState) => state.filesystem); - const { obsConnectionStatus, obsRecordingStatus, dolphinQueue, dolphinPlaybackFile, dolphinRunning } = useSelector( - (state: iRootState) => state.tempContainer - ); + const autoNameRecordedFiles = useSelector((state: iRootState) => state.appContainer.autoNameRecordedFiles); + const recordSeparateClips = useSelector((state: iRootState) => state.filesystem.recordSeparateClips); + const obsConnectionStatus = useSelector((state: iRootState) => state.tempContainer.obsConnectionStatus); + const obsRecordingStatus = useSelector((state: iRootState) => state.tempContainer.obsRecordingStatus); + const dolphinQueue = useSelector((state: iRootState) => state.tempContainer.dolphinQueue); + const dolphinPlaybackFile = useSelector((state: iRootState) => state.tempContainer.dolphinPlaybackFile); + const dolphinRunning = useSelector((state: iRootState) => state.tempContainer.dolphinRunning); + const dispatch = useDispatch(); const recordValue = recordSeparateClips ? RecordingMethod.SEPARATE : RecordingMethod.TOGETHER; @@ -71,6 +75,7 @@ export const OBSStatusBar: React.FC = () => { loadQueueIntoDolphin({ record: true, recordAsOneFile: !recordSeparateClips, + renameOutput: autoNameRecordedFiles, }).catch(console.error); }; diff --git a/src/renderer/lib/dolphin.ts b/src/renderer/lib/dolphin.ts index c3a73f0d..92af4a42 100644 --- a/src/renderer/lib/dolphin.ts +++ b/src/renderer/lib/dolphin.ts @@ -34,8 +34,9 @@ import { toastNoDolphin } from "./toasts"; const defaultDolphinRecorderOptions = { record: false, recordAsOneFile: true, + renameOutput: false, outputFilename: "", - outputFolder: "ProjectClippi", + outputFolder: "", gameEndDelayMs: 1000, }; @@ -162,8 +163,8 @@ export class DolphinRecorder extends DolphinLauncher { } private async _handleSetOBSFilename(filename: string): Promise { - // Return if recording is off, or if recording has already started - if (!this.recordOptions.record || obsConnection.isRecording()) { + // Return if recording is off, or if recording has already started, or if we're not changing output names + if (!this.recordOptions.record || obsConnection.isRecording() || !this.recordOptions.renameOutput) { return; } @@ -196,8 +197,11 @@ export class DolphinRecorder extends DolphinLauncher { if (obsConnection.isRecording()) { await obsConnection.setRecordingState(OBSRecordingAction.STOP); } - // Restore the original user filename format - await obsConnection.setFilenameFormat(this.userFilenameFormat); + + // Restore the original user filename format if we changed it + if (this.recordOptions.renameOutput) { + await obsConnection.setFilenameFormat(this.userFilenameFormat); + } if (killDolphin) { this.killDolphin(); diff --git a/src/renderer/store/models/appContainer.ts b/src/renderer/store/models/appContainer.ts index 19fba49f..ab506648 100644 --- a/src/renderer/store/models/appContainer.ts +++ b/src/renderer/store/models/appContainer.ts @@ -4,10 +4,12 @@ import { createModel } from "@rematch/core"; export interface AppContainerState { showDevOptions: boolean; + autoNameRecordedFiles: boolean; } const initialState: AppContainerState = { showDevOptions: false, + autoNameRecordedFiles: false, }; export const appContainer = createModel({ @@ -18,5 +20,10 @@ export const appContainer = createModel({ draft.showDevOptions = payload; }); }, + setAutoNameRecordedFiles: (state: AppContainerState, payload: boolean): AppContainerState => { + return produce(state, (draft) => { + draft.autoNameRecordedFiles = payload; + }); + }, }, }); diff --git a/src/renderer/views/settings/PlaybackSettings.tsx b/src/renderer/views/settings/PlaybackSettings.tsx index f39d18a7..cf50d52e 100644 --- a/src/renderer/views/settings/PlaybackSettings.tsx +++ b/src/renderer/views/settings/PlaybackSettings.tsx @@ -2,7 +2,7 @@ import React from "react"; import { FileInput } from "@/components/FileInput"; -import { Field, FormContainer, Label, PageHeader, Text } from "@/components/Form"; +import { Field, FormContainer, Label, PageHeader, Text, Toggle } from "@/components/Form"; import { getDolphinExecutableNames, getDolphinPath } from "@/lib/dolphin"; import { Dispatch, iRootState } from "@/store"; import { useDispatch, useSelector } from "react-redux"; @@ -49,10 +49,12 @@ const PlaybackExecutableNames: React.FC = () => { export const PlaybackSettings: React.FC = () => { const dispatch = useDispatch(); const { meleeIsoPath, dolphinPath } = useSelector((state: iRootState) => state.filesystem); - const { showDevOptions } = useSelector((state: iRootState) => state.appContainer); + const showDevOptions = useSelector((state: iRootState) => state.appContainer.showDevOptions); + const autoNameRecordedFiles = useSelector((state: iRootState) => state.appContainer.autoNameRecordedFiles); const setMeleeIsoPath = (filePath: string) => dispatch.filesystem.setMeleeIsoPath(filePath); const setDolphinPath = (filePath: string) => dispatch.filesystem.setDolphinPath(filePath); const resetDolphinPath = () => dispatch.filesystem.setDolphinPath(defaultDolphinPath); + const setAutoNameRecordedFiles = () => dispatch.appContainer.setAutoNameRecordedFiles(!autoNameRecordedFiles); const showDolphinPathField = showDevOptions || !IS_MAC_OR_WIN; const showResetButton = showDolphinPathField && dolphinPath !== defaultDolphinPath; return ( @@ -66,8 +68,9 @@ export const PlaybackSettings: React.FC = () => { should match the Melee ISO File in the Slippi Desktop App. + {showDolphinPathField && ( - + {showResetButton && ( @@ -84,6 +87,18 @@ export const PlaybackSettings: React.FC = () => { )} + + + + + If enabled, games that are recorded separately will have their video file named to match the SLP filename. + Restoration of the original OBS filename format is NOT guaranteed. Use at own risk. + + ); };