diff --git a/frontend/jsconfig.json b/frontend/jsconfig.json index fff9e437d..6b73ad5a0 100644 --- a/frontend/jsconfig.json +++ b/frontend/jsconfig.json @@ -1,12 +1,11 @@ { "compilerOptions": { "allowJs": true, - "target": "es5", + "target": "esnext", "module": "esnext", - "baseUrl": "./", - "moduleResolution": "node", + "moduleResolution": "bundler", "paths": { - "@/*": ["src/*"] + "@/*": ["./src/*"] }, "lib": ["esnext", "dom", "dom.iterable", "scripthost"] } diff --git a/frontend/src/console/views/Game.vue b/frontend/src/console/views/Game.vue index 667a4edec..f183e511c 100644 --- a/frontend/src/console/views/Game.vue +++ b/frontend/src/console/views/Game.vue @@ -20,6 +20,7 @@ import type { InputAction } from "@/console/input/actions"; import { ROUTES } from "@/plugins/router"; import romApi from "@/services/api/rom"; import stateApi from "@/services/api/state"; +import storeConfig from "@/stores/config"; import storeHeartbeat from "@/stores/heartbeat"; import type { DetailedRom } from "@/stores/roms"; import storeRoms from "@/stores/roms"; @@ -42,6 +43,7 @@ type PlayerState = "loading" | "unsupported" | "error" | "ready"; const romsStore = storeRoms(); const heartbeatStore = storeHeartbeat(); +const configStore = storeConfig(); const route = useRoute(); const router = useRouter(); const { t, locale } = useI18n(); @@ -467,7 +469,10 @@ onMounted(async () => { const { data: romData } = await romApi.getRom({ romId: parseInt(route.params.rom as string), }); - const cores = getSupportedEJSCores(romData.platform_slug); + const cores = getSupportedEJSCores( + romData.platform_slug, + configStore.config.EJS_NETPLAY_ENABLED, + ); if (!cores.length) { playerState.value = "unsupported"; throw new Error(`Platform ${romData.platform_slug} not supported yet.`); diff --git a/frontend/src/console/views/Play.vue b/frontend/src/console/views/Play.vue index d626e8a34..072eee3a5 100644 --- a/frontend/src/console/views/Play.vue +++ b/frontend/src/console/views/Play.vue @@ -400,7 +400,10 @@ async function boot() { rom.ss_metadata?.bezel_path || getBezelImagePath(rom.platform_slug).value; // Configure EmulatorJS globals - const supported = getSupportedEJSCores(rom.platform_slug); + const supported = getSupportedEJSCores( + rom.platform_slug, + configStore.config.EJS_NETPLAY_ENABLED, + ); const core = playerStorage.core.value && supported.includes(playerStorage.core.value) ? playerStorage.core.value diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index 2a81c0321..f5b495771 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -446,8 +446,6 @@ export function languageToEmoji(language: string) { */ const _EJS_CORES_MAP: Record = { "3do": ["opera"], - "3ds": ["azahar"], - "new-nintendo-3ds": ["azahar"], acpc: ["cap32", "crocods"], amiga: ["puae"], "amiga-cd32": ["puae"], @@ -473,7 +471,6 @@ const _EJS_CORES_MAP: Record = { colecovision: ["gearcoleco"], doom: ["prboom"], dos: ["dosbox_pure"], - intellivision: ["freeintv"], jaguar: ["virtualjaguar"], lynx: ["handy"], "atari-lynx-mkii": ["handy"], @@ -501,8 +498,42 @@ const _EJS_CORES_MAP: Record = { psx: ["pcsx_rearmed", "mednafen_psx_hw"], "philips-cd-i": ["same_cdi"], psp: ["ppsspp"], - segacd: ["genesis_plus_gx", "genesis_plus_gx_wide", "picodrive"], + segacd: ["genesis_plus_gx", "picodrive"], sega32: ["picodrive"], + gamegear: ["genesis_plus_gx"], + sms: ["genesis_plus_gx"], + "sega-mark-iii": ["genesis_plus_gx"], + "sega-game-box-9": ["genesis_plus_gx"], + "sega-master-system-ii": ["genesis_plus_gx", "smsplus"], + "master-system-super-compact": ["genesis_plus_gx"], + "master-system-girl": ["genesis_plus_gx"], + genesis: ["genesis_plus_gx"], + "sega-mega-drive-2-slash-genesis": ["genesis_plus_gx"], + "sega-mega-jet": ["genesis_plus_gx"], + "mega-pc": ["genesis_plus_gx"], + "tera-drive": ["genesis_plus_gx"], + "sega-nomad": ["genesis_plus_gx"], + saturn: ["yabause"], + snes: ["snes9x"], + sfam: ["snes9x"], + "super-nintendo-original-european-version": ["snes9x"], + "super-famicom-shvc-001": ["snes9x"], + "super-famicom-jr-model-shvc-101": ["snes9x"], + "new-style-super-nes-model-sns-101": ["snes9x"], + tg16: ["mednafen_pce"], + "vic-20": ["vice_xvic"], + virtualboy: ["beetle_vb"], + wonderswan: ["mednafen_wswan"], + swancrystal: ["mednafen_wswan"], + "wonderswan-color": ["mednafen_wswan"], + zsx: ["fuse"], +} as const; + +const _EJS_NIGHTLY_CORES_MAP: Record = { + "3ds": ["azahar"], + "new-nintendo-3ds": ["azahar"], + intellivision: ["freeintv"], + segacd: ["genesis_plus_gx", "genesis_plus_gx_wide", "picodrive"], gamegear: ["genesis_plus_gx", "genesis_plus_gx_wide"], sms: ["genesis_plus_gx", "genesis_plus_gx_wide"], "sega-mark-iii": ["genesis_plus_gx", "genesis_plus_gx_wide"], @@ -523,21 +554,13 @@ const _EJS_CORES_MAP: Record = { "mega-pc": ["genesis_plus_gx", "genesis_plus_gx_wide"], "tera-drive": ["genesis_plus_gx", "genesis_plus_gx_wide"], "sega-nomad": ["genesis_plus_gx", "genesis_plus_gx_wide"], - saturn: ["yabause"], snes: ["snes9x", "bsnes"], sfam: ["snes9x", "bsnes"], "super-nintendo-original-european-version": ["snes9x", "bsnes"], "super-famicom-shvc-001": ["snes9x", "bsnes"], "super-famicom-jr-model-shvc-101": ["snes9x", "bsnes"], "new-style-super-nes-model-sns-101": ["snes9x", "bsnes"], - tg16: ["mednafen_pce"], - "vic-20": ["vice_xvic"], - virtualboy: ["beetle_vb"], - wonderswan: ["mednafen_wswan"], - swancrystal: ["mednafen_wswan"], - "wonderswan-color": ["mednafen_wswan"], - zsx: ["fuse"], -} as const; +}; export type EJSPlatformSlug = keyof typeof _EJS_CORES_MAP; @@ -547,8 +570,14 @@ export type EJSPlatformSlug = keyof typeof _EJS_CORES_MAP; * @param platformSlug The platform slug. * @returns An array of supported cores. */ -export function getSupportedEJSCores(platformSlug: string): string[] { - return _EJS_CORES_MAP[platformSlug.toLowerCase() as EJSPlatformSlug] || []; +export function getSupportedEJSCores( + platformSlug: string, + netplayEnabled: boolean = false, +): string[] { + const coresMap = netplayEnabled + ? { ..._EJS_CORES_MAP, ..._EJS_NIGHTLY_CORES_MAP } + : _EJS_CORES_MAP; + return coresMap[platformSlug.toLowerCase() as EJSPlatformSlug] || []; } /** @@ -582,7 +611,8 @@ export function isEJSEmulationSupported( const slug = config?.PLATFORMS_VERSIONS[platformSlug] || platformSlug; return ( - getSupportedEJSCores(slug).length > 0 && gl instanceof WebGLRenderingContext + getSupportedEJSCores(slug, config?.EJS_NETPLAY_ENABLED).length > 0 && + gl instanceof WebGLRenderingContext ); } diff --git a/frontend/src/views/Player/EmulatorJS/Base.vue b/frontend/src/views/Player/EmulatorJS/Base.vue index af02f9317..23bdb895c 100644 --- a/frontend/src/views/Player/EmulatorJS/Base.vue +++ b/frontend/src/views/Player/EmulatorJS/Base.vue @@ -183,7 +183,12 @@ onMounted(async () => { }); firmwareOptions.value = firmwareResponse.data; - supportedCores.value = [...getSupportedEJSCores(rom.value.platform_slug)]; + supportedCores.value = [ + ...getSupportedEJSCores( + rom.value.platform_slug, + configStore.config.EJS_NETPLAY_ENABLED, + ), + ]; // Listen for save/state selection from dialogs emitter?.on("saveSelected", selectSave); diff --git a/frontend/src/views/Player/EmulatorJS/Player.vue b/frontend/src/views/Player/EmulatorJS/Player.vue index c9782e20b..a50ed1d6e 100644 --- a/frontend/src/views/Player/EmulatorJS/Player.vue +++ b/frontend/src/views/Player/EmulatorJS/Player.vue @@ -124,7 +124,10 @@ declare global { } } -const supportedCores = getSupportedEJSCores(romRef.value.platform_slug); +const supportedCores = getSupportedEJSCores( + romRef.value.platform_slug, + configStore.config.EJS_NETPLAY_ENABLED, +); window.EJS_core = supportedCores.find((core) => core === props.core) ?? supportedCores[0]; window.EJS_controlScheme = getControlSchemeForPlatform( diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 1e4ec0c72..3dd752ab0 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -7,7 +7,6 @@ "composite": true, "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "lib": ["dom", "esnext"], - "baseUrl": ".", "noImplicitAny": true, "paths": { "@/*": ["./src/*"]