From 5307aaa4c4e1a7cf1a88cf0d90eb08ebf04f69af Mon Sep 17 00:00:00 2001 From: Alexey Nurgaliev Date: Thu, 31 Aug 2023 17:30:20 +0300 Subject: [PATCH] WonderSwan, ColecoVision support --- data/emulator.js | 62 ++++++++++++++++++++++++++++++++++++++++---- data/emulator.min.js | 2 +- index.html | 11 ++++++-- 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/data/emulator.js b/data/emulator.js index e01a759..709bd1b 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -3,14 +3,11 @@ class EmulatorJS { getCore(generic) { const core = this.config.system; /*todo: - Systems: Wonderswan (ws), Neo Geo Pocket, msx + Systems: msx Cores: - - Beetle NeoPop - - Beetle WonderSwan - FreeChaF - FreeIntv - - Gearcoleco - NeoCD - O2EM - Vecx @@ -25,12 +22,14 @@ class EmulatorJS { 'fbneo': 'arcade', 'fceumm': 'nes', 'gambatte': 'gb', + 'gearcoleco': 'coleco', 'genesis_plus_gx': 'sega', 'handy': 'lynx', 'mame2003': 'mame2003', 'mednafen_ngp': 'ngp', 'mednafen_pce': 'pce', 'mednafen_psx_hw': 'psx', + 'mednafen_wswan': 'ws', 'melonds': 'nds', 'mgba': 'gba', 'mupen64plus_next': 'n64', @@ -73,7 +72,9 @@ class EmulatorJS { '3do': 'opera', 'psp': 'ppsspp', 'pce': 'mednafen_pce', - 'ngp': 'mednafen_ngp' + 'ngp': 'mednafen_ngp', + 'ws': 'mednafen_wswan', + 'coleco': 'gearcoleco', } if (this.isSafari && this.isMobile && this.getCore(true) === "n64") { return "parallel_n64"; @@ -88,12 +89,14 @@ class EmulatorJS { 'fbneo': ['zip', '7z'], 'fceumm': ['fds', 'nes', 'unif', 'unf'], 'gambatte': ['gb', 'gbc', 'dmg'], + 'gearcoleco': ['col', 'cv', 'bin', 'rom'], 'genesis_plus_gx': ['m3u', 'mdx', 'md', 'smd', 'gen', 'bin', 'cue', 'iso', 'chd', 'bms', 'sms', 'gg', 'sg', '68k', 'sgd'], 'handy': ['lnx'], 'mame2003': ['zip'], 'mednafen_ngp': ['ngp', 'ngc'], 'mednafen_pce': ['pce', 'cue', 'ccd', 'iso', 'img', 'bin', 'chd'], 'mednafen_psx': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'], + 'mednafen_wswan': ['ws', 'wsc', 'pc2'], 'mednafen_psx_hw': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'], 'beetle_vb': ['vb', 'vboy', 'bin'], 'melonds': ['nds'], @@ -2086,6 +2089,39 @@ class EmulatorJS { {id: 6, label: this.localization('LEFT')}, {id: 7, label: this.localization('RIGHT')}, ]; + } else if ('ws' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('X UP')}, + {id: 5, label: this.localization('X DOWN')}, + {id: 6, label: this.localization('X LEFT')}, + {id: 7, label: this.localization('X RIGHT')}, + {id: 13, label: this.localization('Y UP')}, + {id: 12, label: this.localization('Y DOWN')}, + {id: 10, label: this.localization('Y LEFT')}, + {id: 11, label: this.localization('Y RIGHT')}, + ]; + } else if ('coleco' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('LEFT BUTTON')}, + {id: 0, label: this.localization('RIGHT BUTTON')}, + {id: 9, label: this.localization('1')}, + {id: 1, label: this.localization('2')}, + {id: 11, label: this.localization('3')}, + {id: 10, label: this.localization('4')}, + {id: 13, label: this.localization('5')}, + {id: 12, label: this.localization('6')}, + {id: 15, label: this.localization('7')}, + {id: 14, label: this.localization('8')}, + {id: 2, label: this.localization('*')}, + {id: 3, label: this.localization('#')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; } else { buttons = [ {id: 0, label: this.localization('B')}, @@ -2818,6 +2854,22 @@ class EmulatorJS { {"type":"button","text":"Option","id":"option","location":"center","left":30,"fontSize":15,"block":true,"input_value":3} ]; info.push(...speedControlButtons); + } else if ('ws' === this.getControlScheme()) { + info = [ + {"type":"button","text":"B","id":"b","location":"right","right":75,"top":150,"bold":true,"input_value":0}, + {"type":"button","text":"A","id":"a","location":"right","right":5,"top":150,"bold":true,"input_value":8}, + {"type":"dpad","location":"left","left":"50%","right":"50%","joystickInput":false,"inputValues":[4,5,6,7]}, + {"type":"dpad","location":"right","left":"50%","right":"50%","joystickInput":false,"inputValues":[13,12,10,11]}, + {"type":"button","text":"Start","id":"start","location":"center","left":30,"fontSize":15,"block":true,"input_value":3}, + ]; + info.push(...speedControlButtons); + } else if ('coleco' === this.getControlScheme()) { + info = [ + {"type":"button","text":"L","id":"buttonLeft","location":"right","left":10,"top":40,"bold":true,"input_value":8}, + {"type":"button","text":"R","id":"buttonRight","location":"right","left":81,"top":40,"bold":true,"input_value":0}, + {"type":"dpad","location":"left","left":"50%","right":"50%","joystickInput":false,"inputValues":[4,5,6,7]} + ]; + info.push(...speedControlButtons); } else { info = [ {"type":"button","text":"Y","id":"y","location":"right","left":40,"bold":true,"input_value":9}, diff --git a/data/emulator.min.js b/data/emulator.min.js index 4d9848f..6663981 100644 --- a/data/emulator.min.js +++ b/data/emulator.min.js @@ -1 +1 @@ -!function(){var e,t;e=window,t=function(){return n=[function(e,t,n){"use strict";n.r(t);function b(e,t){var n=t.x-e.x,t=t.y-e.y;return Math.sqrt(n*n+t*t)}function _(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