From 53808f464a6a9fbd8d2d93e4f050dddc420679d5 Mon Sep 17 00:00:00 2001 From: Nikhil Narayana Date: Sun, 15 Aug 2021 23:12:51 -0700 Subject: [PATCH 1/2] deps: bump slippi-js to 6.1.2 --- package.json | 2 +- ...pi-js+6.1.1.patch => @slippi+slippi-js+6.1.2.patch} | 10 +++++----- yarn.lock | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) rename patches/{@slippi+slippi-js+6.1.1.patch => @slippi+slippi-js+6.1.2.patch} (81%) diff --git a/package.json b/package.json index c952be13d..3d08db4ae 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@material-ui/core": "^4.11.4", "@material-ui/icons": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.58", - "@slippi/slippi-js": "^6.1.1", + "@slippi/slippi-js": "6.1.2", "adm-zip": "^0.5.1", "compare-func": "^2.0.0", "cross-fetch": "^3.0.6", diff --git a/patches/@slippi+slippi-js+6.1.1.patch b/patches/@slippi+slippi-js+6.1.2.patch similarity index 81% rename from patches/@slippi+slippi-js+6.1.1.patch rename to patches/@slippi+slippi-js+6.1.2.patch index 13e9bca9f..0f18c0264 100644 --- a/patches/@slippi+slippi-js+6.1.1.patch +++ b/patches/@slippi+slippi-js+6.1.2.patch @@ -1,16 +1,16 @@ diff --git a/node_modules/@slippi/slippi-js/dist/index.es.js b/node_modules/@slippi/slippi-js/dist/index.es.js -index ba1a67e..5bdd7cd 100644 +index 2710ec9..9ac9b90 100644 --- a/node_modules/@slippi/slippi-js/dist/index.es.js +++ b/node_modules/@slippi/slippi-js/dist/index.es.js -@@ -4,6 +4,7 @@ import fs from 'fs'; - import moment from 'moment'; +@@ -5,6 +5,7 @@ import moment from 'moment'; import { Writable } from 'stream'; + import { decode, encode } from '@shelacek/ubjson'; import net from 'net'; +import enet from 'enet'; import inject from 'reconnect-core'; - import { decode, encode } from '@shelacek/ubjson'; import iconv from 'iconv-lite'; -@@ -2081,7 +2082,6 @@ class DolphinConnection extends EventEmitter { + import path from 'path'; +@@ -2085,7 +2086,6 @@ class DolphinConnection extends EventEmitter { console.log(`Connecting to: ${ip}:${port}`); this.ipAddress = ip; this.port = port; diff --git a/yarn.lock b/yarn.lock index 67a6a1470..aa0fc72c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2332,10 +2332,10 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== -"@slippi/slippi-js@^6.1.1": - version "6.1.1" - resolved "https://registry.yarnpkg.com/@slippi/slippi-js/-/slippi-js-6.1.1.tgz#b99e520d2bd71ffd7f99099362afc01b638c2a26" - integrity sha512-14Ob9GB4j+PGHAr6OMLHDOKxD9W7Z8ll6YxgSQD01tI6yJ10G2LRtL0rjuUKG2tcC+rcuqrkJ8H81UUM3d7uZg== +"@slippi/slippi-js@6.1.2": + version "6.1.2" + resolved "https://registry.yarnpkg.com/@slippi/slippi-js/-/slippi-js-6.1.2.tgz#6cedd18d54ead123a9ed40f1f2e514b7bbb4d770" + integrity sha512-cZEWKJWRB61ZZEUBIsRi1TPcmWFIU+Z9fQd650jyxFJAS9j0xWWAZypd5TM9TfhaMyOU73XsQ5DLoeH7BPumXw== dependencies: "@shelacek/ubjson" "^1.0.1" enet "^0.2.9" From f56a3918ac74f085b77927810f9c235b59022966 Mon Sep 17 00:00:00 2001 From: Nikhil Narayana Date: Sun, 15 Aug 2021 23:16:30 -0700 Subject: [PATCH 2/2] feat: pass isRealtime to ConsoleConnection --- src/console/mirrorManager.ts | 4 ++-- src/console/mirrorWorker.ts | 10 +++++----- src/console/types.ts | 2 +- src/console/workerInterface.ts | 4 ++-- src/dolphin/types.ts | 2 +- .../containers/Console/AddConnectionDialog.tsx | 2 +- src/renderer/containers/Console/AddConnectionForm.tsx | 8 ++++---- src/renderer/lib/consoleConnection.ts | 2 +- src/settings/types.ts | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/console/mirrorManager.ts b/src/console/mirrorManager.ts index a63540177..c3ad19f28 100644 --- a/src/console/mirrorManager.ts +++ b/src/console/mirrorManager.ts @@ -118,7 +118,7 @@ export class MirrorManager extends EventEmitter { }); }); this.emit(MirrorEvent.LOG, config.port); - connection.connect(config.ipAddress, config.port ?? Ports.DEFAULT); + connection.connect(config.ipAddress, config.port ?? Ports.DEFAULT, config.isRealtime); let autoSwitcher: AutoSwitcher | null = null; if (config.autoSwitcherSettings) { @@ -219,7 +219,7 @@ export class MirrorManager extends EventEmitter { } private async _playFile(filePath: string, playbackId: string) { - return this.emit(MirrorEvent.NEW_FILE, playbackId, filePath, this.mirrors[playbackId].isRealTimeMode); + return this.emit(MirrorEvent.NEW_FILE, playbackId, filePath, this.mirrors[playbackId].isRealtime); } public async handleClosedDolphin(playbackId: string) { diff --git a/src/console/mirrorWorker.ts b/src/console/mirrorWorker.ts index c1eb70d82..fc308e46e 100644 --- a/src/console/mirrorWorker.ts +++ b/src/console/mirrorWorker.ts @@ -17,7 +17,7 @@ export interface Methods { dolphinClosed(playbackId: string): Promise; getLogObservable(): Observable; getErrorObservable(): Observable; - getMirrorDetailsObservable(): Observable<{ playbackId: string; filePath: string; isRealTimeMode: boolean }>; + getMirrorDetailsObservable(): Observable<{ playbackId: string; filePath: string; isRealtime: boolean }>; getMirrorStatusObservable(): Observable<{ ip: string; info: Partial }>; } @@ -27,7 +27,7 @@ const mirrorManager = new MirrorManager(); const logSubject = new Subject(); const errorSubject = new Subject(); -const mirrorDetailsSubject = new Subject<{ playbackId: string; filePath: string; isRealTimeMode: boolean }>(); +const mirrorDetailsSubject = new Subject<{ playbackId: string; filePath: string; isRealtime: boolean }>(); const mirrorStatusSubject = new Subject<{ ip: string; info: Partial }>(); // Forward the events to the renderer @@ -39,8 +39,8 @@ mirrorManager.on(MirrorEvent.ERROR, async (error: Error | string) => { errorSubject.next(error); }); -mirrorManager.on(MirrorEvent.NEW_FILE, async (playbackId: string, filePath: string, isRealTimeMode: boolean) => { - mirrorDetailsSubject.next({ playbackId, filePath, isRealTimeMode }); +mirrorManager.on(MirrorEvent.NEW_FILE, async (playbackId: string, filePath: string, isRealtime: boolean) => { + mirrorDetailsSubject.next({ playbackId, filePath, isRealtime }); }); mirrorManager.on( @@ -72,7 +72,7 @@ const methods: WorkerSpec = { getErrorObservable(): Observable { return Observable.from(errorSubject); }, - getMirrorDetailsObservable(): Observable<{ playbackId: string; filePath: string; isRealTimeMode: boolean }> { + getMirrorDetailsObservable(): Observable<{ playbackId: string; filePath: string; isRealtime: boolean }> { return Observable.from(mirrorDetailsSubject); }, getMirrorStatusObservable(): Observable<{ ip: string; info: Partial }> { diff --git a/src/console/types.ts b/src/console/types.ts index 13d496d77..6a41c8087 100644 --- a/src/console/types.ts +++ b/src/console/types.ts @@ -14,7 +14,7 @@ export interface MirrorConfig { ipAddress: string; port: number; folderPath: string; - isRealTimeMode: boolean; + isRealtime: boolean; enableRelay: boolean; autoSwitcherSettings?: AutoSwitcherSettings; } diff --git a/src/console/workerInterface.ts b/src/console/workerInterface.ts index ef602174a..e867f5f18 100644 --- a/src/console/workerInterface.ts +++ b/src/console/workerInterface.ts @@ -21,10 +21,10 @@ export const mirrorWorker: Promise = new Promise(( worker.getErrorObservable().subscribe((errorMessage) => { mirrorLog.error(errorMessage); }); - worker.getMirrorDetailsObservable().subscribe(({ playbackId, filePath, isRealTimeMode }) => { + worker.getMirrorDetailsObservable().subscribe(({ playbackId, filePath, isRealtime }) => { const replayComm: ReplayCommunication = { mode: "mirror", - isRealTimeMode: isRealTimeMode, + isRealtime: isRealtime, replay: filePath, }; dolphinManager.launchPlaybackDolphin(playbackId, replayComm).catch(mirrorLog.error); diff --git a/src/dolphin/types.ts b/src/dolphin/types.ts index 7e8cc74de..a35495dd6 100644 --- a/src/dolphin/types.ts +++ b/src/dolphin/types.ts @@ -5,7 +5,7 @@ export interface ReplayCommunication { endFrame?: number; // when to stop watching the replay commandId?: string; // random string, doesn't really matter outputOverlayFiles?: boolean; // outputs gameStartAt and gameStation to text files (only works in queue mode) - isRealTimeMode?: boolean; // default true; keeps dolphin fairly close to real time (about 2-3 frames); only relevant in mirror mode + isRealtime?: boolean; // default true; keeps dolphin fairly close to real time (about 2-3 frames); only relevant in mirror mode shouldResync?: boolean; // default true; disables the resync functionality rollbackDisplayMethod?: "off" | "normal" | "visible"; // default off; normal shows like a player experienced it, visible shows ALL frames (normal and rollback) queue?: ReplayQueueItem[]; diff --git a/src/renderer/containers/Console/AddConnectionDialog.tsx b/src/renderer/containers/Console/AddConnectionDialog.tsx index 81bcf00a1..e31e7b6f9 100644 --- a/src/renderer/containers/Console/AddConnectionDialog.tsx +++ b/src/renderer/containers/Console/AddConnectionDialog.tsx @@ -37,7 +37,7 @@ export const AddConnectionDialog: React.FC = ({ }; const defaultValues: Partial = merge( { - isRealTimeMode: false, + isRealtime: false, folderPath: spectateFolder, port: Ports.DEFAULT, enableRelay: false, diff --git a/src/renderer/containers/Console/AddConnectionForm.tsx b/src/renderer/containers/Console/AddConnectionForm.tsx index 10e2761aa..192fcaaf5 100644 --- a/src/renderer/containers/Console/AddConnectionForm.tsx +++ b/src/renderer/containers/Console/AddConnectionForm.tsx @@ -21,7 +21,7 @@ type FormValues = { ipAddress: string; port: number; folderPath: string; - isRealTimeMode: boolean; + isRealtime: boolean; enableAutoSwitcher: boolean; obsIP?: string; obsSourceName?: string; @@ -44,7 +44,7 @@ export const AddConnectionForm: React.FC = ({ defaultVal formState: { errors }, } = useForm({ defaultValues }); const folderPath = watch("folderPath"); - const isRealTimeMode = watch("isRealTimeMode"); + const isRealtime = watch("isRealtime"); const enableAutoSwitcher = watch("enableAutoSwitcher"); const obsPassword = watch("obsPassword"); const obsSourceName = watch("obsSourceName"); @@ -87,8 +87,8 @@ export const AddConnectionForm: React.FC = ({ defaultVal
setValue("isRealTimeMode", checked)} + value={Boolean(isRealtime)} + onChange={(checked) => setValue("isRealtime", checked)} label="Enable Real-time Mode" description="Prevents delay from accumulating when mirroring. Keep this off unless both the Wii and computer are on a wired LAN connection." /> diff --git a/src/renderer/lib/consoleConnection.ts b/src/renderer/lib/consoleConnection.ts index 1cb19a959..94c110012 100644 --- a/src/renderer/lib/consoleConnection.ts +++ b/src/renderer/lib/consoleConnection.ts @@ -36,7 +36,7 @@ export const connectToConsole = async (conn: StoredConnection) => { ipAddress: conn.ipAddress, port: conn.port ?? Ports.DEFAULT, folderPath: conn.folderPath, - isRealTimeMode: conn.isRealTimeMode, + isRealtime: conn.isRealtime, enableRelay: conn.enableRelay, }; diff --git a/src/settings/types.ts b/src/settings/types.ts index ad794796d..31fb9958e 100644 --- a/src/settings/types.ts +++ b/src/settings/types.ts @@ -2,7 +2,7 @@ export interface StoredConnection { id: number; ipAddress: string; folderPath: string; - isRealTimeMode: boolean; + isRealtime: boolean; port?: number; consoleNick?: string; enableAutoSwitcher: boolean;