(data)
| 785 | this.textElem.innerText = this.localization("Download Game Data"); |
| 786 | |
| 787 | const gotGameData = (data) => { |
| 788 | if (["arcade", "mame"].includes(this.getCore(true))) { |
| 789 | this.fileName = this.getBaseFileName(true); |
| 790 | this.gameManager.FS.writeFile(this.fileName, new Uint8Array(data)); |
| 791 | resolve(); |
| 792 | return; |
| 793 | } |
| 794 | |
| 795 | const altName = this.getBaseFileName(true); |
| 796 | |
| 797 | let disableCue = false; |
| 798 | if (["pcsx_rearmed", "genesis_plus_gx", "picodrive", "mednafen_pce", "smsplus", "vice_x64", "vice_x64sc", "vice_x128", "vice_xvic", "vice_xplus4", "vice_xpet", "puae"].includes(this.getCore()) && this.config.disableCue === undefined) { |
| 799 | disableCue = true; |
| 800 | } else { |
| 801 | disableCue = this.config.disableCue; |
| 802 | } |
| 803 | |
| 804 | let fileNames = []; |
| 805 | this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Data"), (fileName, fileData) => { |
| 806 | if (fileName.includes("/")) { |
| 807 | const paths = fileName.split("/"); |
| 808 | let cp = ""; |
| 809 | for (let i = 0; i < paths.length - 1; i++) { |
| 810 | if (paths[i] === "") continue; |
| 811 | cp += `/${paths[i]}`; |
| 812 | if (!this.gameManager.FS.analyzePath(cp).exists) { |
| 813 | this.gameManager.FS.mkdir(cp); |
| 814 | } |
| 815 | } |
| 816 | } |
| 817 | if (fileName.endsWith("/")) { |
| 818 | this.gameManager.FS.mkdir(fileName); |
| 819 | return; |
| 820 | } |
| 821 | if (fileName === "!!notCompressedData") { |
| 822 | this.gameManager.FS.writeFile(altName, fileData); |
| 823 | fileNames.push(altName); |
| 824 | } else { |
| 825 | this.gameManager.FS.writeFile(`/${fileName}`, fileData); |
| 826 | fileNames.push(fileName); |
| 827 | } |
| 828 | }).then(() => { |
| 829 | let isoFile = null; |
| 830 | let supportedFile = null; |
| 831 | let cueFile = null; |
| 832 | let selectedCueExt = null; |
| 833 | fileNames.forEach(fileName => { |
| 834 | const ext = fileName.split(".").pop().toLowerCase(); |
| 835 | if (supportedFile === null && supportsExt(ext)) { |
| 836 | supportedFile = fileName; |
| 837 | } |
| 838 | if (isoFile === null && ["iso", "cso", "chd", "elf"].includes(ext)) { |
| 839 | isoFile = fileName; |
| 840 | } |
| 841 | if (["cue", "ccd", "toc", "m3u"].includes(ext)) { |
| 842 | if (this.getCore(true) === "psx") { |
| 843 | //always prefer m3u files for psx cores |
| 844 | if (selectedCueExt !== "m3u") { |
nothing calls this directly
no test coverage detected