diff --git a/frontend/src/components/Details/Saves.vue b/frontend/src/components/Details/Saves.vue index 435a20237..e8aa75dca 100644 --- a/frontend/src/components/Details/Saves.vue +++ b/frontend/src/components/Details/Saves.vue @@ -173,7 +173,7 @@ function onCardClick(save: SaveSchema, event: MouseEvent) { {{ formatBytes(save.file_size_bytes) }} - {{ formatTimestamp(save.updated_at) }} + Updated: {{ formatTimestamp(save.updated_at) }} diff --git a/frontend/src/components/Details/States.vue b/frontend/src/components/Details/States.vue index 47b9e67a7..165e13f8b 100644 --- a/frontend/src/components/Details/States.vue +++ b/frontend/src/components/Details/States.vue @@ -175,7 +175,7 @@ function onCardClick(state: StateSchema, event: MouseEvent) { {{ formatBytes(state.file_size_bytes) }} - {{ formatTimestamp(state.updated_at) }} + Updated: {{ formatTimestamp(state.updated_at) }} diff --git a/frontend/src/components/common/Game/Dialog/Asset/SelectSave.vue b/frontend/src/components/common/Game/Dialog/Asset/SelectSave.vue index ce599e703..540d72dab 100644 --- a/frontend/src/components/common/Game/Dialog/Asset/SelectSave.vue +++ b/frontend/src/components/common/Game/Dialog/Asset/SelectSave.vue @@ -100,7 +100,7 @@ function closeDialog() { {{ formatBytes(save.file_size_bytes) }} - {{ formatTimestamp(save.updated_at) }} + Updated: {{ formatTimestamp(save.updated_at) }} diff --git a/frontend/src/components/common/Game/Dialog/Asset/SelectState.vue b/frontend/src/components/common/Game/Dialog/Asset/SelectState.vue index 922c07290..53e7c9fb7 100644 --- a/frontend/src/components/common/Game/Dialog/Asset/SelectState.vue +++ b/frontend/src/components/common/Game/Dialog/Asset/SelectState.vue @@ -100,7 +100,7 @@ function closeDialog() { {{ formatBytes(state.file_size_bytes) }} - {{ formatTimestamp(state.updated_at) }} + Updated: {{ formatTimestamp(state.updated_at) }} diff --git a/frontend/src/views/Player/EmulatorJS/Base.vue b/frontend/src/views/Player/EmulatorJS/Base.vue index 82c338c3f..ba85a3799 100644 --- a/frontend/src/views/Player/EmulatorJS/Base.vue +++ b/frontend/src/views/Player/EmulatorJS/Base.vue @@ -4,7 +4,7 @@ import RomListItem from "@/components/common/Game/ListItem.vue"; import firmwareApi from "@/services/api/firmware"; import romApi from "@/services/api/rom"; import storeAuth from "@/stores/auth"; -import type { DetailedRom } from "@/stores/roms"; +import storeRoms, { type DetailedRom } from "@/stores/roms"; import { formatBytes, formatTimestamp, getSupportedEJSCores } from "@/utils"; import { ROUTES } from "@/plugins/router"; import Player from "@/views/Player/EmulatorJS/Player.vue"; @@ -24,6 +24,7 @@ const EMULATORJS_VERSION = "4.2.1"; const { t } = useI18n(); const route = useRoute(); const auth = storeAuth(); +const romsStore = storeRoms(); const rom = ref(null); const firmwareOptions = ref([]); const biosRef = ref(null); @@ -70,6 +71,7 @@ function onFullScreenChange() { } async function onlyQuit() { + if (rom.value) romsStore.update(rom.value); window.history.back(); } @@ -94,6 +96,7 @@ async function saveAndQuit() { screenshotFile, }); + romsStore.update(rom.value); window.history.back(); } diff --git a/frontend/src/views/Player/EmulatorJS/utils.ts b/frontend/src/views/Player/EmulatorJS/utils.ts index ffb700e11..65038284c 100644 --- a/frontend/src/views/Player/EmulatorJS/utils.ts +++ b/frontend/src/views/Player/EmulatorJS/utils.ts @@ -67,13 +67,18 @@ export async function saveSave({ }): Promise { if (save) { try { - const { data: updateSave } = await saveApi.updateSave({ + const { data: updatedSave } = await saveApi.updateSave({ save: save, saveFile: new File([saveFile], save.file_name, { type: "application/octet-stream", }), }); - return updateSave; + + // Update the save in the rom object + const index = rom.user_saves.findIndex((s) => s.id === updatedSave.id); + rom.user_saves[index] = updatedSave; + + return updatedSave; } catch (error) { console.error("Failed to update save", error); return null;