only add new cores in nightly

This commit is contained in:
Georges-Antoine Assi
2026-05-30 20:53:52 -04:00
parent be15ab4513
commit 96ac7ac5e8
7 changed files with 69 additions and 25 deletions

View File

@@ -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"]
}

View File

@@ -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.`);

View File

@@ -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

View File

@@ -446,8 +446,6 @@ export function languageToEmoji(language: string) {
*/
const _EJS_CORES_MAP: Record<string, string[]> = {
"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<string, string[]> = {
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<string, string[]> = {
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<string, string[]> = {
"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<string, string[]> = {
"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
);
}

View File

@@ -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);

View File

@@ -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(

View File

@@ -7,7 +7,6 @@
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"lib": ["dom", "esnext"],
"baseUrl": ".",
"noImplicitAny": true,
"paths": {
"@/*": ["./src/*"]