mirror of
https://github.com/marcrobledo/RomPatcher.js.git
synced 2025-06-27 16:25:54 +00:00
fix: set fake patch file name when picking a patch from a zip file
This commit is contained in:
parent
de2f0e5c7d
commit
9ec774421e
2 changed files with 7 additions and 7 deletions
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var PRECACHE_ID = 'rom-patcher-js';
|
var PRECACHE_ID = 'rom-patcher-js';
|
||||||
var PRECACHE_VERSION = 'v30rc1';
|
var PRECACHE_VERSION = 'v30rc1b';
|
||||||
var PRECACHE_URLS = [
|
var PRECACHE_URLS = [
|
||||||
'/RomPatcher.js/', '/RomPatcher.js/index.html',
|
'/RomPatcher.js/', '/RomPatcher.js/index.html',
|
||||||
'/RomPatcher.js/manifest.json',
|
'/RomPatcher.js/manifest.json',
|
||||||
|
|
|
@ -295,13 +295,13 @@ var RomPatcherWeb = (function () {
|
||||||
return fallback || 0;
|
return fallback || 0;
|
||||||
},
|
},
|
||||||
setFakeFile: function (id, fileName) {
|
setFakeFile: function (id, fileName) {
|
||||||
if (document.getElementById('rom-patcher-' + id)) {
|
if (document.getElementById('rom-patcher-input-file-' + id)) {
|
||||||
try {
|
try {
|
||||||
/* add a fake file to the input file, so it shows the chosen file name */
|
/* add a fake file to the input file, so it shows the chosen file name */
|
||||||
const fakeFile = new File(new Uint8Array(0), fileName);
|
const fakeFile = new File(new Uint8Array(0), fileName);
|
||||||
const dataTransfer = new DataTransfer();
|
const dataTransfer = new DataTransfer();
|
||||||
dataTransfer.items.add(fakeFile);
|
dataTransfer.items.add(fakeFile);
|
||||||
document.getElementById('rom-patcher-' + id).files = dataTransfer.files;
|
document.getElementById('rom-patcher-input-file-' + id).files = dataTransfer.files;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.warning('File API constructor is not supported');
|
console.warning('File API constructor is not supported');
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ var RomPatcherWeb = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transferFakeFile) {
|
if (transferFakeFile) {
|
||||||
htmlElements.setFakeFile('input-file-rom', romFile.fileName);
|
htmlElements.setFakeFile('rom', romFile.fileName);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ var RomPatcherWeb = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transferFakeFile) {
|
if (transferFakeFile) {
|
||||||
htmlElements.setFakeFile('input-file-patch', binFile.fileName);
|
htmlElements.setFakeFile('patch', binFile.fileName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_setToastError(_('Invalid patch file'));
|
_setToastError(_('Invalid patch file'));
|
||||||
|
@ -762,7 +762,7 @@ var RomPatcherWeb = (function () {
|
||||||
|
|
||||||
refreshRomFileName: function () {
|
refreshRomFileName: function () {
|
||||||
if (romFile)
|
if (romFile)
|
||||||
htmlElements.setFakeFile('input-file-rom', romFile.fileName);
|
htmlElements.setFakeFile('rom', romFile.fileName);
|
||||||
},
|
},
|
||||||
|
|
||||||
pickEmbededFile: function (fileName) {
|
pickEmbededFile: function (fileName) {
|
||||||
|
@ -1059,7 +1059,7 @@ const ZIPManager = (function (romPatcherWeb) {
|
||||||
onUnzip(binFile, true);
|
onUnzip(binFile, true);
|
||||||
} else {
|
} else {
|
||||||
_setPatchInputSpinner(false);
|
_setPatchInputSpinner(false);
|
||||||
onUnzip(binFile);
|
onUnzip(binFile, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fileReader.readAsArrayBuffer(blob);
|
fileReader.readAsArrayBuffer(blob);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue