Merge pull request #3294 from rommapp/copilot/fix-msdos-games-launch-issue

fix: MSDOS games fail to launch in console mode ("Error for site owner / Check console")
This commit is contained in:
Georges-Antoine Assi
2026-04-20 16:43:49 -04:00
committed by GitHub
3 changed files with 14 additions and 3 deletions

View File

@@ -9,15 +9,17 @@ map $http_x_forwarded_proto $forwardscheme {
}
# COEP and COOP headers for cross-origin isolation, which are set only for the
# EmulatorJS player path, to enable SharedArrayBuffer support, which is needed
# EmulatorJS player paths, to enable SharedArrayBuffer support, which is needed
# for multi-threaded cores.
map $request_uri $coep_header {
default "";
~^/rom/.*/ejs$ "require-corp";
~^/console/rom/[0-9]+/play "require-corp";
}
map $request_uri $coop_header {
default "";
~^/rom/.*/ejs$ "same-origin";
~^/console/rom/[0-9]+/play "same-origin";
}
server {

View File

@@ -350,7 +350,7 @@ function handleAction(action: InputAction): boolean {
}
}
function play() {
async function play() {
if (!rom.value) return;
romApi
@@ -375,11 +375,14 @@ function play() {
if (origin.id) query.id = Number(origin.id);
if (origin.collection) query.collection = Number(origin.collection);
router.push({
await router.push({
name: ROUTES.CONSOLE_PLAY,
params: { rom: rom.value.id },
query: Object.keys(query).length ? query : undefined,
});
// Force full reload to retrieve COEP/COOP headers from nginx,
// required to enable multi-threading in EmulatorJS (e.g., for dosbox_pure/MSDOS).
router.go(0);
}
const currentStateId = computed(

View File

@@ -5,6 +5,7 @@ import {
computed,
onMounted,
onBeforeUnmount,
onUnmounted,
ref,
watch,
nextTick,
@@ -737,6 +738,11 @@ onBeforeUnmount(() => {
detachKey?.();
detachPad?.();
});
onUnmounted(() => {
// Force full reload to reset COEP/COOP, so cross-origin isolation is turned off.
window.location.reload();
});
</script>
<template>