autorefresh after scan
0
emulation/3ds/roms/pokemon y.3ds
Normal file
0
emulation/3ds/roms/zelda majoras mask.3ds
Normal file
0
emulation/3ds/roms/zelda ocarina of time.3ds
Normal file
0
emulation/gb/roms/pokemon yellow.gb
Normal file
0
emulation/gba/roms/pokemon emerald.gba
Normal file
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.1 KiB |
BIN
emulation/resources/3ds/pokemon ultra moon_l.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
emulation/resources/3ds/pokemon ultra moon_s.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
emulation/resources/3ds/pokemon ultra sun_l.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
emulation/resources/3ds/pokemon ultra sun_s.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
emulation/resources/3ds/zelda majoras mask_l.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
emulation/resources/3ds/zelda majoras mask_s.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
emulation/resources/3ds/zelda ocarina of time_l.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
emulation/resources/3ds/zelda ocarina of time_s.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
emulation/resources/gba/pokemon emerald_l.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
emulation/resources/gba/pokemon emerald_s.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
@@ -1,21 +1,25 @@
|
||||
<script setup>
|
||||
import { ref, inject } from "vue";
|
||||
import { ref, inject, toRaw } from "vue"
|
||||
import { useTheme } from "vuetify";
|
||||
import Navigation from '@/components/Navigation.vue'
|
||||
|
||||
// Props
|
||||
useTheme().global.name.value = localStorage.getItem('theme') || 'dark'
|
||||
const scanning = ref(false)
|
||||
const refresh = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('scanning', () => { refresh.value = !refresh.value })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-app>
|
||||
|
||||
<navigation/>
|
||||
<navigation :key="refresh"/>
|
||||
|
||||
<v-main>
|
||||
<v-container fluid>
|
||||
<router-view/>
|
||||
<router-view :key="refresh"/>
|
||||
</v-container>
|
||||
</v-main>
|
||||
|
||||
@@ -28,7 +32,7 @@ const scanning = ref(false)
|
||||
* {
|
||||
scrollbar-width: none;
|
||||
/* scrollbar-width: thin; */
|
||||
scrollbar-color: #808080 #ffffff;
|
||||
scrollbar-color: #6e6e6e rgba(0, 0, 0, 0);;
|
||||
}
|
||||
|
||||
/* Chrome, Edge, and Safari */
|
||||
@@ -44,6 +48,5 @@ const scanning = ref(false)
|
||||
*::-webkit-scrollbar-thumb {
|
||||
background-color: #808080;
|
||||
border-radius: 5px;
|
||||
/* border: 3px solid #ffffff; */
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,15 +6,14 @@ import { useTheme } from "vuetify";
|
||||
|
||||
// Props
|
||||
const platforms = ref([])
|
||||
const currentPlatformName = ref(localStorage.getItem('currentPlatformName') || "")
|
||||
const currentPlatformSlug = ref(localStorage.getItem('currentPlatformSlug') || "")
|
||||
const currentPlatform = ref(JSON.parse(localStorage.getItem('currentPlatform')) || "")
|
||||
const platformsToScan = ref([])
|
||||
const scanOverwrite = ref(false)
|
||||
const scanning = ref(false)
|
||||
const scanOverwrite = ref(false)
|
||||
const gettingRomsFlag = ref(false)
|
||||
const filter = ref('')
|
||||
const drawer = ref(null)
|
||||
const settings = ref(null)
|
||||
const filter = ref('')
|
||||
const rail = (localStorage.getItem('rail') == 'true') ? ref(true) : ref(false)
|
||||
const theme = useTheme()
|
||||
const darkMode = (localStorage.getItem('theme') == 'light') ? ref(false) : ref(true)
|
||||
@@ -36,14 +35,17 @@ async function getPlatforms() {
|
||||
}).catch((error) => {console.log(error)})
|
||||
}
|
||||
|
||||
function setFilter(filter) {
|
||||
// Sets the roms filter
|
||||
emitter.emit('romsFilter', filter)
|
||||
}
|
||||
|
||||
async function selectPlatform(platform){
|
||||
// Select the current platform
|
||||
await router.push(import.meta.env.BASE_URL)
|
||||
localStorage.setItem('currentPlatformSlug', platform.slug)
|
||||
localStorage.setItem('currentPlatformName', platform.name)
|
||||
emitter.emit('currentPlatform', platform.slug)
|
||||
currentPlatformName.value = platform.name
|
||||
currentPlatformSlug.value = platform.slug
|
||||
localStorage.setItem('currentPlatform', JSON.stringify(platform))
|
||||
emitter.emit('currentPlatform', platform)
|
||||
currentPlatform.value = platform
|
||||
}
|
||||
|
||||
function toggleRail(){
|
||||
@@ -56,7 +58,6 @@ async function scan() {
|
||||
// Complete scan of by platform
|
||||
console.log("scanning...")
|
||||
scanning.value = true
|
||||
emitter.emit('scanning', true)
|
||||
const platforms = []
|
||||
toRaw(platformsToScan)._rawValue.forEach(p => {
|
||||
platforms.push(toRaw(p))
|
||||
@@ -69,8 +70,7 @@ async function scan() {
|
||||
console.log(response.data)
|
||||
}).catch((error) => {console.log(error)})
|
||||
scanning.value = false
|
||||
emitter.emit('scanning', false)
|
||||
// router.go()
|
||||
emitter.emit('scanning')
|
||||
}
|
||||
else{
|
||||
platforms.forEach(async p => {
|
||||
@@ -83,17 +83,11 @@ async function scan() {
|
||||
console.log(response.data)
|
||||
}).catch((error) => {console.log(error)})
|
||||
scanning.value = false
|
||||
emitter.emit('scanning', false)
|
||||
// router.go()
|
||||
emitter.emit('scanning')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setFilter(filter) {
|
||||
// Sets the roms filter
|
||||
emitter.emit('romsFilter', filter)
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
// Toggle dark/light theme
|
||||
theme.global.name.value = darkMode.value ? "dark" : "light"
|
||||
@@ -105,74 +99,75 @@ getPlatforms()
|
||||
|
||||
<template>
|
||||
<!-- Settings drawer -->
|
||||
<v-navigation-drawer width="250" v-model="settings" location="right" temporary floating>
|
||||
<v-navigation-drawer v-model="settings" location="right" width="250" temporary floating>
|
||||
<!-- Settings drawer - title -->
|
||||
<v-list-item id="settings-title" class="text-h5 d-flex align-center justify-center pt-4 pb-4 pl-7 font-weight-bold bg-primary">
|
||||
Settings<v-btn icon="mdi-close-box" class="ml-1" rounded="0" variant="plain" @click="settings = !settings"/>
|
||||
<v-list-item class="text-h5 d-flex align-center justify-center font-weight-bold bg-primary pt-4 pb-4 pl-7">
|
||||
Settings
|
||||
<v-btn title="close settings" @click="settings = !settings" class="ml-1" icon="mdi-close-box" rounded="0" variant="plain"/>
|
||||
</v-list-item>
|
||||
<v-divider class="border-opacity-100" :thickness="2"></v-divider>
|
||||
<v-divider class="border-opacity-100" :thickness="2"/>
|
||||
<v-list>
|
||||
<!-- Settings drawer - scan button -->
|
||||
<v-list-item class="d-flex align-center justify-center mb-2">
|
||||
<v-btn :disabled="scanning" color="secondary" prepend-icon="mdi-magnify-scan" @click="scan()" inset rounded="0">
|
||||
<v-btn title="scan" @click="scan()" :disabled="scanning" prepend-icon="mdi-magnify-scan" color="secondary" rounded="0" inset>
|
||||
<p v-if="!scanning">Scan</p>
|
||||
<p v-if="scanning">Scanning</p>
|
||||
<v-progress-circular v-show="scanning" indeterminate color="primary" :width="2" :size="20" class="ml-2" />
|
||||
<v-progress-circular v-show="scanning" class="ml-2" color="primary" :width="2" :size="20" indeterminate/>
|
||||
</v-btn>
|
||||
</v-list-item>
|
||||
<v-select class="pl-2 pr-2" v-model="platformsToScan" :items="platforms" item-title="name" label="Platforms" multiple return-object clearable density="comfortable" variant="outlined" />
|
||||
<v-divider class="border-opacity-25"></v-divider>
|
||||
<v-select label="Platforms" item-title="name" v-model="platformsToScan" :items="platforms" class="pl-2 pr-2" density="comfortable" variant="outlined" multiple return-object clearable/>
|
||||
<v-divider class="border-opacity-25"/>
|
||||
<!-- Settings drawer - theme toggle -->
|
||||
<v-list-item class="d-flex align-center justify-center">
|
||||
<v-switch prepend-icon="mdi-theme-light-dark" class="pr-2 pl-2" v-model="darkMode" @change="toggleTheme()" hide-details="true" inset/>
|
||||
<v-switch @change="toggleTheme()" v-model="darkMode" class="pr-2 pl-2" hide-details="true" prepend-icon="mdi-theme-light-dark" inset/>
|
||||
</v-list-item>
|
||||
<v-divider class="border-opacity-25"></v-divider>
|
||||
<v-divider class="border-opacity-25"/>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<!-- App bar -->
|
||||
<v-app-bar color="toolbar" class="elevation-3" >
|
||||
<v-app-bar color="toolbar" class="elevation-3">
|
||||
<!-- App bar - RomM avatar -->
|
||||
<v-avatar class="ml-4" :rounded="0"><v-img src="/assets/romm.png"></v-img></v-avatar>
|
||||
<!-- App bar - RomM title -->
|
||||
<v-list-item-title class="text-h6 ml-5 hidden-md-and-down font-weight-black">ROM MANAGER</v-list-item-title>
|
||||
<v-list-item-title class="text-h6 hidden-md-and-down font-weight-black ml-5">ROM MANAGER</v-list-item-title>
|
||||
<!-- App bar - Platforms drawer toggle -->
|
||||
<v-app-bar-nav-icon @click="drawer = !drawer" rounded="0" class="hidden-lg-and-up ml-1"/>
|
||||
<v-app-bar-nav-icon title="toggle platforms drawer" @click="drawer = !drawer" class="hidden-lg-and-up ml-1" rounded="0"/>
|
||||
<!-- App bar - Platform title - desktop -->
|
||||
<v-toolbar-title class="align-center justify-center text-h6 ml-4 d-none d-sm-flex"></v-toolbar-title>
|
||||
<v-toolbar-title class="text-h6 align-center justify-center d-none d-sm-flex ml-4"/>
|
||||
<!-- App bar - Platform title - mobile -->
|
||||
<v-toolbar-title class="align-center text-h6 ml-2 d-sm-none">
|
||||
<v-avatar class="mr-3" :rounded="0"><v-img :src="'/assets/platforms/'+currentPlatformSlug+'.png'"></v-img></v-avatar>
|
||||
<v-toolbar-title class="text-h6 align-center d-sm-none ml-2">
|
||||
<v-avatar class="mr-3" :rounded="0"><v-img :src="'/assets/platforms/'+currentPlatform.slug+'.png'"></v-img></v-avatar>
|
||||
</v-toolbar-title>
|
||||
<!-- App bar - Scan progress bar -->
|
||||
<v-progress-linear absolute bottom :active="scanning" :indeterminate="true" id="scan-progress"/>
|
||||
<v-progress-linear :active="scanning" :indeterminate="true" absolute/>
|
||||
<!-- App bar - Search bar -->
|
||||
<v-text-field hide-details label="search" variant="outlined" density="compact" class="ml-5 mr-3" clearable prepend-inner-icon="mdi-magnify" v-model="filter" @keyup="setFilter(filter)" @click:clear="setFilter('')"/>
|
||||
<v-text-field @click:clear="setFilter('')" @keyup="setFilter(filter)" v-model="filter" label="search" class="ml-5 mr-3" prepend-inner-icon="mdi-magnify" variant="outlined" density="compact" hide-details clearable/>
|
||||
<!-- App bar - Settings -->
|
||||
<v-app-bar-nav-icon @click="settings = !settings" rounded="0"><v-icon>mdi-cog</v-icon></v-app-bar-nav-icon>
|
||||
<v-app-bar-nav-icon title="settings" @click="settings = !settings" rounded="0"><v-icon>mdi-cog</v-icon></v-app-bar-nav-icon>
|
||||
</v-app-bar>
|
||||
|
||||
<!-- Platforms drawer -->
|
||||
<v-navigation-drawer width="250" rail-width="72" v-model="drawer" :rail="rail">
|
||||
<v-navigation-drawer v-model="drawer" :rail="rail" width="250" rail-width="72">
|
||||
<v-list nav>
|
||||
<!-- Platforms drawer - Platforms list -->
|
||||
<v-list-item v-for="platform in platforms"
|
||||
class="mt-3"
|
||||
:title="rail ? '' : platform.name"
|
||||
:value="platform.slug"
|
||||
:key="platform"
|
||||
@:click="selectPlatform(platform)">
|
||||
@:click="selectPlatform(platform)"
|
||||
class="mt-3">
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :rounded="0"><v-img :src="'/assets/platforms/'+platform.slug+'.png'"></v-img></v-avatar>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-progress-circular v-show="gettingRomsFlag && currentPlatformName == platform.name" indeterminate color="primary" :width="2" :size="20" class="ml-2" />
|
||||
<v-progress-circular v-show="gettingRomsFlag && currentPlatform.name == platform.name" class="ml-2" :width="2" :size="20" indeterminate/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<!-- Platforms drawer - Platforms list - rail toggle -->
|
||||
<template v-slot:append>
|
||||
<v-btn block @click="toggleRail()" rounded="0">
|
||||
<v-btn title="toggle rail platforms drawer" @click="toggleRail()" rounded="0" block>
|
||||
<v-icon v-if="rail">mdi-arrow-collapse-right</v-icon>
|
||||
<v-icon v-if="!rail">mdi-arrow-collapse-left</v-icon>
|
||||
</v-btn>
|
||||
|
||||
@@ -3,13 +3,11 @@ import axios from 'axios'
|
||||
import { ref, inject, toRaw } from "vue";
|
||||
|
||||
// Props
|
||||
const rom = ref("")
|
||||
const scanOverwrite = ref(false)
|
||||
rom.value = JSON.parse(localStorage.getItem('currentRom')) || ''
|
||||
const matchedRoms = ref([])
|
||||
const rom = ref(JSON.parse(localStorage.getItem('currentRom')) || '')
|
||||
const searching = ref(false)
|
||||
const matchedRoms = ref([])
|
||||
const changing = ref(false)
|
||||
const romFilename = ref(rom.value.filename)
|
||||
const romNewName = ref(rom.value.filename)
|
||||
const submitted = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
@@ -56,10 +54,10 @@ async function changeRom(newRomRaw) {
|
||||
async function submitEdit() {
|
||||
submitted.value = true
|
||||
await axios.patch('/api/platforms/'+rom.value.p_slug+'/roms/'+rom.value.filename, {
|
||||
filename: romFilename.value
|
||||
filename: romNewName.value
|
||||
}).then((response) => {
|
||||
console.log("update "+rom.value.filename+" to "+romFilename.value)
|
||||
rom.value.filename = romFilename.value
|
||||
console.log("update "+rom.value.filename+" to "+romNewName.value)
|
||||
rom.value.filename = romNewName.value
|
||||
}).catch((error) => {console.log(error)})
|
||||
}
|
||||
</script>
|
||||
@@ -67,14 +65,14 @@ async function submitEdit() {
|
||||
<template>
|
||||
<v-row class="text-body-1 justify-center">
|
||||
<v-col cols="8" xs="8" sm="4" md="3" lg="2">
|
||||
<v-container fluid class="pa-0">
|
||||
<v-container class="pa-0" fluid>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-card >
|
||||
<v-img :src="rom.path_cover_l+'?reload='+Date.now()" :lazy-src="rom.path_cover_s+'?reload='+Date.now()" cover>
|
||||
<template v-slot:placeholder>
|
||||
<div class="d-flex align-center justify-center fill-height">
|
||||
<v-progress-circular color="grey-lighten-4" indeterminate />
|
||||
<v-progress-circular :width="2" :size="20" indeterminate/>
|
||||
</div>
|
||||
</template>
|
||||
</v-img>
|
||||
@@ -85,37 +83,37 @@ async function submitEdit() {
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col class="pa-1">
|
||||
<v-btn rounded="0" @click="downloadRom()" block><v-icon size="large" icon="mdi-download"/></v-btn>
|
||||
<v-btn @click="downloadRom()" rounded="0" block><v-icon icon="mdi-download" size="large"/></v-btn>
|
||||
</v-col>
|
||||
<v-col class="pa-1">
|
||||
<v-btn rounded="0" @click="downloadSaves()" block><v-icon size="large" icon="mdi-content-save-all"/></v-btn>
|
||||
<v-btn @click="downloadSaves()" rounded="0" block><v-icon icon="mdi-content-save-all" size="large"/></v-btn>
|
||||
</v-col>
|
||||
<v-col class="pa-1">
|
||||
<v-menu location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn rounded="0" block v-bind="props">
|
||||
<v-icon size="large" v-show="!changing" icon="mdi-dots-vertical"/>
|
||||
<v-progress-circular v-show="changing" indeterminate color="primary" :width="2" :size="20" class="ml-2"/>
|
||||
<v-btn v-bind="props" rounded="0" block>
|
||||
<v-icon v-show="!changing" icon="mdi-dots-vertical" size="large"/>
|
||||
<v-progress-circular v-show="changing" :width="2" :size="20" indeterminate/>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list rounded="0">
|
||||
<v-menu location="end">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item key="search_igdb" value="search_igdb" @click="searchRomIGDB()" v-bind="props">
|
||||
<v-list-item @click="searchRomIGDB()" v-bind="props">
|
||||
<v-list-item-title class="d-flex"><v-icon icon="mdi-search-web" class="mr-2"/>
|
||||
Search IGDB
|
||||
<v-progress-circular v-show="searching" indeterminate color="primary" :width="2" :size="20" class="ml-2"/>
|
||||
<v-progress-circular v-show="searching" :width="2" :size="20" class="ml-2" indeterminate/>
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<v-list rounded="0">
|
||||
<v-list-item v-for="rom in matchedRoms" :key="rom" :value="rom">
|
||||
<v-list-item-title class="d-flex" @click="changeRom(rom)">{{ rom.name }}</v-list-item-title>
|
||||
<v-list-item-title @click="changeRom(rom)" class="d-flex">{{ rom.name }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-divider class="mb-2 mt-2"></v-divider>
|
||||
<v-menu location="end" :close-on-content-click="false" min-width="290px">
|
||||
<v-divider class="mb-2 mt-2"/>
|
||||
<v-menu :close-on-content-click="false" location="end" min-width="290px">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item key="edit" value="edit" v-bind="props">
|
||||
<v-list-item-title class="d-flex"><v-icon icon="mdi-pencil-box" class="mr-2"/>Edit</v-list-item-title>
|
||||
@@ -123,14 +121,14 @@ async function submitEdit() {
|
||||
</template>
|
||||
<v-list rounded="0">
|
||||
<v-form @submit.prevent class="ma-4">
|
||||
<v-text-field v-model="romFilename" label="File name" variant="outlined" required @keyup.enter="submitEdit()"/>
|
||||
<v-file-input prepend-icon="mdi-image" label="Cover L" variant="outlined"/>
|
||||
<v-file-input prepend-icon="mdi-image" label="Cover S" variant="outlined"/>
|
||||
<v-btn type="submit" class="mt-2" @click="submitEdit()" block>Submit<v-icon v-if="submitted" icon="mdi-check-bold" color="green" class="ml-2"/></v-btn>
|
||||
<v-text-field @keyup.enter="submitEdit()" v-model="romNewName" label="File name" variant="outlined" required/>
|
||||
<v-file-input label="Cover L" prepend-icon="mdi-image" variant="outlined"/>
|
||||
<v-file-input label="Cover S" prepend-icon="mdi-image" variant="outlined"/>
|
||||
<v-btn type="submit" @click="submitEdit()" class="mt-2" block>Submit<v-icon v-if="submitted" icon="mdi-check-bold" color="green" class="ml-2"/></v-btn>
|
||||
</v-form>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-divider class="mb-4 mt-2"></v-divider>
|
||||
<v-divider class="mb-4 mt-2"/>
|
||||
<v-list-item key="delete" value="delete" class="bg-red mb-2">
|
||||
<v-list-item-title class="d-flex"><v-icon icon="mdi-delete" class="mr-2"/>Delete</v-list-item-title>
|
||||
</v-list-item>
|
||||
@@ -150,10 +148,10 @@ async function submitEdit() {
|
||||
<v-row>Slug: {{ rom.r_slug }}</v-row>
|
||||
<v-row>Platform: {{ rom.p_slug }}</v-row>
|
||||
<v-row>Cover: {{ rom.path_cover_l }}</v-row>
|
||||
<v-divider v-if="rom.summary != ''" class="mt-8 mb-8"></v-divider>
|
||||
<v-divider v-if="rom.summary != ''" class="mt-8 mb-8"/>
|
||||
<v-row>{{ rom.summary }}</v-row>
|
||||
</v-container>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="mt-10 mb-10 border-opacity-75"></v-divider>
|
||||
<v-divider class="mt-10 mb-10 border-opacity-75"/>
|
||||
</template>
|
||||
@@ -8,17 +8,34 @@ import { saveAs } from 'file-saver'
|
||||
const roms = ref([])
|
||||
const romsFiltered = ref([])
|
||||
const currentFilter = ref('')
|
||||
const noRoms = ref(false)
|
||||
var currentPlatformSlug = localStorage.getItem('currentPlatformSlug') || ""
|
||||
const router = useRouter()
|
||||
const forceImgReload = Date.now()
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('currentPlatform', (platform) => { getRoms(platform) })
|
||||
emitter.on('currentPlatform', (platform) => { getRoms(platform.slug) })
|
||||
emitter.on('romsFilter', (filter) => { setFilter(filter) })
|
||||
|
||||
// Functions
|
||||
async function getRoms(platform) {
|
||||
console.log("Getting roms...")
|
||||
emitter.emit('gettingRoms', true)
|
||||
await axios.get('/api/platforms/'+platform+'/roms').then((response) => {
|
||||
console.log("Roms loaded!")
|
||||
console.log(response.data.data)
|
||||
roms.value = response.data.data
|
||||
setFilter(currentFilter.value)
|
||||
}).catch((error) => {console.log(error)})
|
||||
emitter.emit('gettingRoms', false)
|
||||
}
|
||||
|
||||
async function selectRom(rom) {
|
||||
console.log("Selected rom "+rom.name)
|
||||
localStorage.setItem('currentRom', JSON.stringify(rom))
|
||||
await router.push(import.meta.env.BASE_URL+'details')
|
||||
emitter.emit('currentRom', rom)
|
||||
}
|
||||
|
||||
function normalizeString(s) {
|
||||
return s.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g,"")
|
||||
}
|
||||
@@ -29,40 +46,19 @@ function setFilter(filter) {
|
||||
return normalizeString(rom.name).includes(currentFilter.value)
|
||||
})
|
||||
}
|
||||
|
||||
async function getRoms(platform) {
|
||||
currentPlatformSlug = platform
|
||||
console.log("Getting roms...")
|
||||
emitter.emit('gettingRoms', true)
|
||||
await axios.get('/api/platforms/'+platform+'/roms').then((response) => {
|
||||
console.log("Roms loaded!")
|
||||
console.log(response.data.data)
|
||||
roms.value = response.data.data
|
||||
setFilter(currentFilter.value)
|
||||
if (roms.value.length == 0){ noRoms.value = true }else{ noRoms.value = false }
|
||||
}).catch((error) => {console.log(error)})
|
||||
emitter.emit('gettingRoms', false)
|
||||
}
|
||||
|
||||
function downloadRom(filename) {
|
||||
console.log("Downloading "+filename)
|
||||
axios.get('/assets/emulation/'+currentPlatformSlug+'/roms/'+filename, { responseType: 'blob' }).then(response => {
|
||||
saveAs(new Blob([response.data], { type: 'application/file' }), filename)
|
||||
function downloadRom(rom) {
|
||||
console.log("Downloading "+rom.filename)
|
||||
axios.get('/assets/emulation/'+rom.p_slug+'/roms/'+rom.filename, { responseType: 'blob' }).then(response => {
|
||||
saveAs(new Blob([response.data], { type: 'application/file' }), rom.filename)
|
||||
}).catch(console.error)
|
||||
}
|
||||
|
||||
function downloadSave(name) {
|
||||
console.log("Downloading "+name+" save file")
|
||||
function downloadSave(rom) {
|
||||
console.log("Downloading "+rom.filename+" save file")
|
||||
}
|
||||
|
||||
async function selectRom(rom) {
|
||||
console.log("Selected rom "+rom.name)
|
||||
localStorage.setItem('currentRom', JSON.stringify(rom))
|
||||
await router.push(import.meta.env.BASE_URL+'details')
|
||||
emitter.emit('currentRom', rom)
|
||||
}
|
||||
|
||||
onMounted(() => { if(currentPlatformSlug){ getRoms(currentPlatformSlug) } })
|
||||
onMounted(() => { if(localStorage.getItem('currentPlatform')){ getRoms(JSON.parse(localStorage.getItem('currentPlatform')).slug) } })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -70,29 +66,29 @@ onMounted(() => { if(currentPlatformSlug){ getRoms(currentPlatformSlug) } })
|
||||
<v-row>
|
||||
<v-col v-for="rom in romsFiltered" cols="6" xs="6" sm="3" md="3" lg="2">
|
||||
<v-hover v-slot="{isHovering, props}">
|
||||
<v-card :elevation="isHovering ? 20 : 3" :class="{'on-hover': isHovering}" v-bind="props">
|
||||
<v-card v-bind="props" :class="{'on-hover': isHovering}" :elevation="isHovering ? 20 : 3">
|
||||
<v-img :src="rom.path_cover_l+'?reload='+forceImgReload" :lazy-src="rom.path_cover_s+'?reload='+forceImgReload" cover>
|
||||
<v-tooltip activator="parent" location="top" open-delay="500">{{ rom.filename }}</v-tooltip>
|
||||
<v-tooltip activator="parent" open-delay="500" location="top">{{ rom.filename }}</v-tooltip>
|
||||
<template v-slot:placeholder>
|
||||
<div class="d-flex align-center justify-center fill-height">
|
||||
<v-progress-circular color="grey-lighten-4" indeterminate />
|
||||
<v-progress-circular indeterminate/>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="!rom.has_cover" class="d-flex align-center text-body-1 pt-2 pr-5 pb-2 pl-5 bg-secondary rom-title" >{{ rom.filename }}</div>
|
||||
<v-btn class="d-flex align-center justify-center fill-height" @click="selectRom(rom)" color="transparent" block />
|
||||
<div v-if="!rom.has_cover" class="rom-title d-flex align-center text-body-1 pt-2 pr-5 pb-2 pl-5 bg-secondary">{{ rom.filename }}</div>
|
||||
<v-btn @click="selectRom(rom)" class="d-flex align-center justify-center fill-height" color="transparent" block/>
|
||||
</v-img>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-btn size="small" variant="flat" icon="mdi-download" @click="downloadRom(rom.filename)" />
|
||||
<v-btn size="small" variant="flat" icon="mdi-content-save-all" @click=" downloadSave(rom.filename)"/>
|
||||
<v-btn @click="downloadRom(rom)" icon="mdi-download" size="small" variant="flat"/>
|
||||
<v-btn @click=" downloadSave(rom)" icon="mdi-content-save-all" size="small" variant="flat"/>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-hover>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="noRoms" class="d-flex align-center justify-center fill-height">
|
||||
<div class="mt-16 pt-16 text-h6">Feels cold here... <v-icon>mdi-emoticon-sad</v-icon></div>
|
||||
<v-row v-if="roms.length==0" class="d-flex align-center justify-center fill-height">
|
||||
<div class="text-h6 mt-16 pt-16">Feels cold here... <v-icon>mdi-emoticon-sad</v-icon></div>
|
||||
</v-row>
|
||||
|
||||
</template>
|
||||
|
||||