diff --git a/frontend/src/v2/components/GameDetails/SaveDataTab.vue b/frontend/src/v2/components/GameDetails/SaveDataTab.vue index 2091279bc..469f3c07b 100644 --- a/frontend/src/v2/components/GameDetails/SaveDataTab.vue +++ b/frontend/src/v2/components/GameDetails/SaveDataTab.vue @@ -130,17 +130,17 @@ const subtabDefs = computed(() => [ ]); // ---------- Upload / refresh plumbing ---------- -// Every upload goes through the dialog, which asks for the slot and the -// core; dropped files land in it pre-picked. +// Every upload goes through the dialog, which asks saves for a slot and +// states for a core; dropped files land in it pre-picked. const uploadDialog = ref<{ type: UploadAssetType; files: File[] } | null>(null); function openUpload(type: UploadAssetType, files: File[] = []) { uploadDialog.value = { type, files }; } -// The platform's cores plus whatever the existing assets were tagged with. +// The platform's cores plus whatever the existing states were tagged with. const uploadCores = computed(() => { const cores = new Set(getSupportedEJSCores(props.rom.platform_slug)); - for (const asset of [...mySaves.value, ...myStates.value]) { - if (asset.emulator) cores.add(asset.emulator); + for (const state of myStates.value) { + if (state.emulator) cores.add(state.emulator); } return [...cores]; }); @@ -155,7 +155,7 @@ async function onUploadSubmit({ }) { const type = uploadDialog.value?.type; uploadDialog.value = null; - if (type === "save") await onSaveUpload(files, slot, emulator); + if (type === "save") await onSaveUpload(files, slot); else if (type === "state") await onStateUpload(files, emulator); } const uploadingSaves = ref(false); @@ -169,11 +169,7 @@ async function refreshRom() { await refetchRom(props.rom.id); } -async function onSaveUpload( - files: File[], - slot: string | null, - emulator: string | null, -) { +async function onSaveUpload(files: File[], slot: string | null) { if (files.length === 0 || uploadingSaves.value) return; uploadingSaves.value = true; @@ -182,7 +178,6 @@ async function onSaveUpload( rom: props.rom, savesToUpload: files.map((saveFile) => ({ saveFile })), slot: slot ?? undefined, - emulator: emulator ?? undefined, }); const successful = results.filter((r) => r.status === "fulfilled").length; const failed = results.length - successful; diff --git a/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts b/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts index 712c51b7c..dbda7ce6b 100644 --- a/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts +++ b/frontend/src/v2/components/GameDetails/UploadAssetDialog.test.ts @@ -151,15 +151,15 @@ describe("UploadAssetDialog", () => { expect(await submitted(wrapper)).toMatchObject({ slot: "main_quest" }); }); - it("names a new slot and tags the core", async () => { + it("names a new slot and asks saves for nothing else", async () => { const wrapper = mountDialog("save", [new File(["x"], "a.srm")]); + expect(wrapper.findAll("select")).toHaveLength(1); await choose(wrapper, 0, 3); await wrapper.get("input.slot-name").setValue(" speedrun "); - await choose(wrapper, 1, 1); expect(await submitted(wrapper)).toMatchObject({ slot: "speedrun", - emulator: "mgba", + emulator: null, }); }); @@ -176,6 +176,12 @@ describe("UploadAssetDialog", () => { const wrapper = mountDialog("state", [new File(["x"], "a.state")]); expect(wrapper.findAll("select")).toHaveLength(1); + expect(wrapper.findAll("option").map((o) => o.text())).toEqual([ + "play.any-core", + "mgba", + "builtin", + ]); + await choose(wrapper, 0, 2); expect(await submitted(wrapper)).toMatchObject({ slot: null, diff --git a/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue b/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue index df8396d9f..1d8f376cd 100644 --- a/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue +++ b/frontend/src/v2/components/GameDetails/UploadAssetDialog.vue @@ -1,5 +1,5 @@ @@ -154,6 +154,7 @@ async function submit() { autocomplete="off" />