Skip to content

Commit de44d5b

Browse files
authored
Merge pull request #3373 from rommapp/copilot/feature-disable-console-button
Apply `DISABLE_EMULATOR_JS` to Console mode (disable Play + block direct player route)
2 parents c635ba5 + 5b02d6b commit de44d5b

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

frontend/src/console/views/Game.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ const descriptionOverlayRef = useTemplateRef<HTMLDivElement>(
6464
"description-overlay-ref",
6565
);
6666
const detailsOverlayRef = useTemplateRef<HTMLDivElement>("details-overlay-ref");
67+
const isConsoleEmulationDisabled = computed(
68+
() => heartbeatStore.value.EMULATION.DISABLE_EMULATOR_JS,
69+
);
6770
6871
const releaseDate = computed(() => {
6972
if (!rom.value?.metadatum.first_release_date) return null;
@@ -351,7 +354,7 @@ function handleAction(action: InputAction): boolean {
351354
}
352355
353356
async function play() {
354-
if (!rom.value) return;
357+
if (!rom.value || isConsoleEmulationDisabled.value) return;
355358
356359
romApi
357360
.updateUserRomProps({
@@ -633,7 +636,10 @@ onUnmounted(() => {
633636
:class="{
634637
'scale-105 shadow-[0_8px_28px_rgba(0,0,0,0.35),_0_0_0_2px_var(--console-game-play-button-focus-border),_0_0_16px_var(--console-accent-secondary)]':
635638
selectedZone === 'play',
639+
'opacity-60 cursor-not-allowed':
640+
isConsoleEmulationDisabled,
636641
}"
642+
:disabled="isConsoleEmulationDisabled"
637643
@click="play()"
638644
>
639645
<span class="text-lg md:text-xl">▶</span>

frontend/src/console/views/Play.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import playSessionApi from "@/services/api/play-session";
2626
import romApi from "@/services/api/rom";
2727
import storeAuth from "@/stores/auth";
2828
import storeConfig from "@/stores/config";
29+
import storeHeartbeat from "@/stores/heartbeat";
2930
import storeLanguage from "@/stores/language";
3031
import type { DetailedRom } from "@/stores/roms";
3132
import {
@@ -59,6 +60,7 @@ const router = useRouter();
5960
const { getBezelImagePath } = useThemeAssets();
6061
const authStore = storeAuth();
6162
const configStore = storeConfig();
63+
const heartbeatStore = storeHeartbeat();
6264
const languageStore = storeLanguage();
6365
const { selectedLanguage } = storeToRefs(languageStore);
6466
const romId = Number(route.params.rom);
@@ -727,6 +729,15 @@ onMounted(async () => {
727729
// Guard against duplicate mounts
728730
if (booted) return;
729731
732+
if (heartbeatStore.value.EMULATION.DISABLE_EMULATOR_JS) {
733+
await router.replace({
734+
name: ROUTES.CONSOLE_ROM,
735+
params: { rom: romId },
736+
query: route.query,
737+
});
738+
return;
739+
}
740+
730741
booted = true;
731742
await boot();
732743
detachKey = attachKeyboardExit();

0 commit comments

Comments
 (0)