Upload multiple games at once

This commit is contained in:
Evan Barger
2020-04-04 11:24:54 -04:00
parent 5f96ccfe3f
commit 0ebdb5abf0
3 changed files with 10 additions and 6 deletions

View File

@@ -13,7 +13,6 @@ This tool can build the data necessary to flash new games to a [Nintendo Power G
- Pokemon Classic Font: https://www.dafont.com/pokemon-classic.font
## Ideas
- Upload multiple games at once
- Move more templating into components
- Add ability to upload arbitrary 128x8 images for menu entries
- Save settings to local storage

View File

@@ -85,9 +85,9 @@
<tr>
<td>
<button v-on:click="triggerAddRomLabel" class="upload" :disabled="!menu.ready() || romOverflow" type="button">
<label for="romFileInput" ref="addRomLabel" v-on:click="stopPropagation">Add Game</label>
<label for="romFileInput" ref="addRomLabel" v-on:click="stopPropagation">Add Games</label>
</button>
<input style="display: none" id="romFileInput" type="file" v-on:change="addROM" :disabled="!menu.ready() || romOverflow" accept=".gb,.gbc">
<input style="display: none" id="romFileInput" type="file" v-on:change="addROM" :disabled="!menu.ready() || romOverflow" accept=".gb,.gbc" multiple>
</td>
<td></td>
<td></td>

View File

@@ -42,9 +42,14 @@ let app = new Vue({
e.target.value = '';
},
addROM: function(e) {
let fileReader = new FileReader()
fileReader.onload = () => this.roms.push(new ROM(fileReader.result, this.fontIndex));
fileReader.readAsArrayBuffer(e.target.files[0]);
const files = e.target.files;
for (let i = 0; i < files.length; i++) {
let fileReader = new FileReader();
fileReader.onload = () => {
this.roms.push(new ROM(fileReader.result, this.fontIndex));
}
fileReader.readAsArrayBuffer(files[i]);
}
this.processor.roms = this.roms;