Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions frontend/src/console/views/Play.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "vue";
import { useI18n } from "vue-i18n";
import { useRoute, useRouter } from "vue-router";
import type { FirmwareSchema } from "@/__generated__";
import type { DetailedRomSchema } from "@/__generated__/models/DetailedRomSchema";
import NavigationText from "@/console/components/NavigationText.vue";
import { useInputScope } from "@/console/composables/useInputScope";
Expand Down Expand Up @@ -359,6 +360,7 @@ async function boot() {
? playerStorage.core.value
: supported[0];

const coreOptions = configStore.getEJSCoreOptions(core);
window.EJS_core = core;
window.EJS_controlScheme = getControlSchemeForPlatform(rom.platform_slug);
window.EJS_threads = areThreadsRequiredForEJSCore(core);
Expand Down Expand Up @@ -386,10 +388,16 @@ async function boot() {
const { data: firmware } = await firmwareApi.getFirmware({
platformId: rom.platform_id,
});
const bios = playerStorage.biosId.value

const biosFromStorage = playerStorage.biosId.value
? firmware.find((f) => f.id === parseInt(playerStorage.biosId.value!))
: null;
: undefined;

const biosFromConfig = coreOptions["bios_file"]
? firmware.find((f) => f.file_name === coreOptions["bios_file"])
: undefined;

const bios = biosFromStorage ?? biosFromConfig ?? null;
window.EJS_biosUrl = bios
? `/api/firmware/${bios.id}/content/${bios.file_name}`
: "";
Expand Down Expand Up @@ -424,7 +432,6 @@ async function boot() {
// window.EJS_fullscreenOnLoaded = true;
window.EJS_backgroundImage = `${window.location.origin}/assets/logos/romm_logo_xbox_one_circle_boot.svg`;
window.EJS_backgroundColor = "#000000"; // Match original which uses theme colors, but #000000 should work fine
const coreOptions = configStore.getEJSCoreOptions(core);
window.EJS_defaultOptions = {
"save-state-location": "browser",
rewindEnabled: "enabled",
Expand Down
19 changes: 14 additions & 5 deletions frontend/src/views/Player/EmulatorJS/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,23 @@ onMounted(async () => {
selectedCore.value = supportedCores.value[0];
}

const coreOptions = configStore.getEJSCoreOptions(selectedCore.value);
const storedBiosID = localStorage.getItem(
`player:${rom.value.platform_slug}:bios_id`,
);
if (storedBiosID) {
selectedFirmware.value =
firmwareOptions.value.find((f) => f.id === parseInt(storedBiosID)) ??
null;
}

const biosFromStorage = storedBiosID
? firmwareOptions.value.find((f) => f.id === parseInt(storedBiosID))
: undefined;

// Use default bios file if set in config.yml
const biosFromConfig = coreOptions["bios_file"]
? firmwareOptions.value.find(
(f) => f.file_name === coreOptions["bios_file"],
)
: undefined;

selectedFirmware.value = biosFromStorage ?? biosFromConfig ?? null;
});

onBeforeUnmount(async () => {
Expand Down
Loading