diff --git a/frontend/src/components/Details/ActionBar.vue b/frontend/src/components/Details/ActionBar.vue index 96360e4f7..088420abf 100644 --- a/frontend/src/components/Details/ActionBar.vue +++ b/frontend/src/components/Details/ActionBar.vue @@ -1,19 +1,13 @@ + + diff --git a/frontend/src/components/common/Game/Table.vue b/frontend/src/components/common/Game/Table.vue index bcf7bded2..af58eae50 100644 --- a/frontend/src/components/common/Game/Table.vue +++ b/frontend/src/components/common/Game/Table.vue @@ -2,22 +2,15 @@ import PlatformIcon from "@/components/common/Platform/Icon.vue"; import AdminMenu from "@/components/common/Game/AdminMenu.vue"; import FavBtn from "@/components/common/Game/FavBtn.vue"; +import PlayBtn from "@/components/common/Game/PlayBtn.vue"; import RAvatarRom from "@/components/common/Game/RAvatar.vue"; import MissingFromFSIcon from "@/components/common/MissingFromFSIcon.vue"; import romApi from "@/services/api/rom"; -import storeConfig from "@/stores/config"; import storeDownload from "@/stores/download"; -import storeHeartbeat from "@/stores/heartbeat"; import storeAuth from "@/stores/auth"; import storeGalleryFilter from "@/stores/galleryFilter"; import storeRoms, { type SimpleRom } from "@/stores/roms"; -import { - formatBytes, - isEJSEmulationSupported, - isRuffleEmulationSupported, - languageToEmoji, - regionToEmoji, -} from "@/utils"; +import { formatBytes, languageToEmoji, regionToEmoji } from "@/utils"; import { ROUTES } from "@/plugins/router"; import { isNull } from "lodash"; import { storeToRefs } from "pinia"; @@ -40,9 +33,6 @@ const downloadStore = storeDownload(); const romsStore = storeRoms(); const { filteredRoms, selectedRoms, fetchingRoms, fetchTotalRoms } = storeToRefs(romsStore); -const heartbeatStore = storeHeartbeat(); -const configStore = storeConfig(); -const { config } = storeToRefs(configStore); const auth = storeAuth(); const galleryFilterStore = storeGalleryFilter(); @@ -104,22 +94,6 @@ function rowClick(_: Event, row: { item: SimpleRom }) { romsStore.resetSelection(); } -function getTruePlatformSlug(platformSlug: string) { - return platformSlug in config.value.PLATFORMS_VERSIONS - ? config.value.PLATFORMS_VERSIONS[platformSlug] - : platformSlug; -} - -function checkIfEJSEmulationSupported(platformSlug: string) { - const slug = getTruePlatformSlug(platformSlug); - return isEJSEmulationSupported(slug, heartbeatStore.value); -} - -function checkIfRuffleEmulationSupported(platformSlug: string) { - const slug = getTruePlatformSlug(platformSlug); - return isRuffleEmulationSupported(slug, heartbeatStore.value); -} - function updateSelectAll() { if (selectedRoms.value.length === filteredRoms.value.length) { romsStore.resetSelection(); @@ -319,34 +293,7 @@ function updateOptions({ sortBy }: { sortBy: SortBy }) { > mdi-download - - mdi-play - - - mdi-play - + 0 && - gl instanceof WebGLRenderingContext + getSupportedEJSCores(slug).length > 0 && gl instanceof WebGLRenderingContext ); } @@ -521,15 +525,36 @@ export function getControlSchemeForPlatform( * * @param platformSlug The platform slug. * @param heartbeat The heartbeat object. + * @param config Optional configuration object. * @returns True if supported, false otherwise. */ export function isRuffleEmulationSupported( platformSlug: string, heartbeat: Heartbeat, + config?: Config, +) { + if (heartbeat.EMULATION.DISABLE_RUFFLE_RS) return false; + + const slug = config?.PLATFORMS_VERSIONS[platformSlug] || platformSlug; + return ["flash", "browser"].includes(slug.toLowerCase()); +} + +/** + * Check whether any kind of emulation is supported for a given platform. + * + * @param platformSlug The platform slug. + * @param heartbeat The heartbeat object. + * @param config Optional configuration object. + * @returns True if any emulation is supported, false otherwise. + */ +export function isAnyEmulationSupported( + platformSlug: string, + heartbeat: Heartbeat, + config?: Config, ) { return ( - ["flash", "browser"].includes(platformSlug.toLowerCase()) && - !heartbeat.EMULATION.DISABLE_RUFFLE_RS + isEJSEmulationSupported(platformSlug, heartbeat, config) || + isRuffleEmulationSupported(platformSlug, heartbeat, config) ); }