From 764262f3488aa183beb81736e8a7c6a95545b73d Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Fri, 4 Aug 2023 11:52:11 -0500 Subject: [PATCH] "fix" picodrive core --- data/GameManager.js | 9 ++++++++- data/emulator.js | 13 ++++++------- data/emulator.min.js | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/data/GameManager.js b/data/GameManager.js index ea41fc5..1d64b11 100644 --- a/data/GameManager.js +++ b/data/GameManager.js @@ -165,11 +165,18 @@ class EJS_GameManager { } this.functions.simulateInput(player, index, value); } + getFileNames() { + if (this.EJS.getCore() === "picodrive") { + return ["bin", "gen", "smd", "md", "32x", "cue", "iso", "sms", "68k", "chd"]; + } else { + return ["toc", "ccd", "exe", "pbp", "chd", "img", "bin", "iso"]; + } + } createCueFile(fileNames) { try { if (fileNames.length > 1) { fileNames = fileNames.filter((item) => { - return ["toc", "ccd", "exe", "pbp", "chd", "img", "bin", "iso"].includes(item.split(".").pop().toLowerCase()); + return this.getFileNames().includes(item.split(".").pop().toLowerCase()); }) fileNames = fileNames.sort((a, b) => { if (isNaN(a.charAt()) || isNaN(b.charAt())) throw new Error("Incorrect file name format"); diff --git a/data/emulator.js b/data/emulator.js index ad10f34..3fa4df2 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -808,7 +808,7 @@ class EmulatorJS { } let resData = {}; - const isPsx = (this.getCore(true) === "psx" && this.getCore() !== "pcsx_rearmed"); + const needsCue = (["mednafen_psx", "mednafen_psx_hw", "picodrive"].includes(this.getCore())); const altName = this.config.gameUrl.startsWith("blob:") ? (this.config.gameName || "game") : this.config.gameUrl.split('/').pop().split("#")[0].split("?")[0]; this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Data"), (fileName, fileData) => { if (fileName.includes("/")) { @@ -826,7 +826,7 @@ class EmulatorJS { FS.mkdir(fileName); return; } - if (isPsx && ["m3u", "cue"].includes(fileName.split(".").pop().toLowerCase())) { + if (needsCue && ["m3u", "cue"].includes(fileName.split(".").pop().toLowerCase())) { resData[fileName] = fileData; } else if (fileName !== "!!notCompressedData") { resData[fileName] = true; @@ -845,14 +845,13 @@ class EmulatorJS { })(); if (fileNames.length === 1) fileNames[0] = altName; let execFile = null; - if (isPsx) { - //Not needed for pcsx_rearmed core + if (needsCue) { execFile = this.gameManager.createCueFile(fileNames); } for (const k in resData) { if (k === "!!notCompressedData") { - if (isPsx && execFile !== null) { + if (needsCue && execFile !== null) { this.fileName = execFile; } else { this.fileName = altName; @@ -864,11 +863,11 @@ class EmulatorJS { !(this.getCore(true) === "psx" && ["m3u", "ccd"].includes(this.fileName.split(".").pop())))) { this.fileName = k; } - if (isPsx && execFile === null && ["m3u", "cue"].includes(k.split(".").pop().toLowerCase())) { + if (needsCue && execFile === null && ["m3u", "cue"].includes(k.split(".").pop().toLowerCase())) { FS.writeFile("/"+k, resData[k]); } } - if (isPsx && execFile !== null) { + if (needsCue && execFile !== null) { this.fileName = execFile; } resolve(); diff --git a/data/emulator.min.js b/data/emulator.min.js index 40825bf..361d96a 100644 --- a/data/emulator.min.js +++ b/data/emulator.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("nipplejs",[],t):"object"==typeof exports?exports.nipplejs=t():e.nipplejs=t()}(window,function(){return n=[function(e,t,n){"use strict";n.r(t);function _(e,t){var n=t.x-e.x,t=t.y-e.y;return Math.sqrt(n*n+t*t)}function b(e){return e*(Math.PI/180)}function o(e){f.has(e)&&clearTimeout(f.get(e)),f.set(e,setTimeout(e,100))}function s(e,t,n){for(var i,o=t.split(/[ ,]+/g),s=0;sthis.options.threshold){var r,l={};for(r in this.direction)this.direction.hasOwnProperty(r)&&(l[r]=this.direction[r]);var c={};for(r in this.direction={x:n,y:i,angle:t},e.direction=this.direction,l)l[r]===this.direction[r]&&(c[r]=!0);if(c.x&&c.y&&c.angle)return e;c.x&&c.y||this.trigger("plain",e),c.x||this.trigger("plain:"+n,e),c.y||this.trigger("plain:"+i,e),c.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var x=w;function E(e,t){this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=e,this.id=E.id,E.id+=1,this.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},this.config(t),"static"!==this.options.mode&&"semi"!==this.options.mode||(this.options.multitouch=!1),this.options.multitouch||(this.options.maxNumberOfNipples=1);e=getComputedStyle(this.options.zone.parentElement);return e&&"flex"===e.display&&(this.parentIsFlex=!0),this.updateBox(),this.prepareNipples(),this.bindings(),this.begin(),this.nipples}E.prototype=new m,(E.constructor=E).id=0,E.prototype.prepareNipples=function(){var i=this.nipples;i.on=this.on.bind(this),i.off=this.off.bind(this),i.options=this.options,i.destroy=this.destroy.bind(this),i.ids=this.ids,i.id=this.id,i.processOnMove=this.processOnMove.bind(this),i.processOnEnd=this.processOnEnd.bind(this),i.get=function(e){if(void 0===e)return i[0];for(var t=0,n=i.length;t