From e1e46cd99bfad9e9539a7c012266bbd1836384fe Mon Sep 17 00:00:00 2001 From: Arianrhod Sandlot Date: Tue, 6 Feb 2024 19:20:34 +0800 Subject: [PATCH] fix: fix merge options --- demo/demo.ts | 1 - src/nostalgist.ts | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/demo/demo.ts b/demo/demo.ts index 6f9e25f..485c054 100644 --- a/demo/demo.ts +++ b/demo/demo.ts @@ -50,7 +50,6 @@ async function launchCustomRom() { nostalgist = await Nostalgist.launch({ core: 'fceumm', rom: await showOpenFilePicker().then(([fileHandle]) => fileHandle.getFile()), - shader: 'crt/crt-easymode', }) } diff --git a/src/nostalgist.ts b/src/nostalgist.ts index 60116f9..0dc3511 100644 --- a/src/nostalgist.ts +++ b/src/nostalgist.ts @@ -30,9 +30,8 @@ export class Nostalgist { private emulator: Emulator | undefined private constructor(options: NostalgistLaunchOptions) { - const mergedOptions = {} + const mergedOptions = { ...Nostalgist.globalOptions, ...options } merge(mergedOptions, Nostalgist.globalOptions, options) - // @ts-expect-error we cannot infer the final type here this.options = mergedOptions } @@ -602,13 +601,13 @@ export class Nostalgist { } private getRetroarchOption() { - const options = {} + const options = { ...Nostalgist.globalOptions.retroarchConfig, ...this.options.retroarchConfig } merge(options, Nostalgist.globalOptions.retroarchConfig, this.options.retroarchConfig) return options as typeof this.options.retroarchConfig } private getRetroarchCoreOption() { - const options = {} + const options = { ...Nostalgist.globalOptions.retroarchCoreConfig, ...this.options.retroarchCoreConfig } merge(options, Nostalgist.globalOptions.retroarchCoreConfig, this.options.retroarchCoreConfig) return options }