mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Version 2.3.0
This commit is contained in:
parent
0a539d452a
commit
f9787a7396
1057
data/emu-main.js
1057
data/emu-main.js
File diff suppressed because it is too large
Load Diff
442
data/emulator.js
442
data/emulator.js
@ -83,344 +83,114 @@ var EJS = function(_0x574f5e) {
|
||||
element.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+_this.localization('Network Error')+'</strong>';
|
||||
}
|
||||
}
|
||||
}, null, null, null, null, null, function(_0x3982a1, _0x519c5e, _0x21c4c0) {
|
||||
! function(_0x36fa8f) {
|
||||
'use strict';
|
||||
var _0x519c5e = function() {},
|
||||
_0x21c4c0 = {
|
||||
'getType': function() {
|
||||
return 'null';
|
||||
},
|
||||
'isSupported': function() {
|
||||
return !0x1;
|
||||
},
|
||||
'update': _0x519c5e
|
||||
},
|
||||
_0x51f790 = function(_0x961a83) {
|
||||
var _0x21c4c0 = this,
|
||||
_0x55f0e2 = window;
|
||||
this.update = _0x519c5e, this.requestAnimationFrame = _0x961a83 || _0x55f0e2.requestAnimationFrame || _0x55f0e2.webkitRequestAnimationFrame || _0x55f0e2.mozRequestAnimationFrame, this.tickFunction = function() {
|
||||
_0x21c4c0.update(), _0x21c4c0.startTicker();
|
||||
}, this.startTicker = function() {
|
||||
_0x21c4c0.requestAnimationFrame.apply(_0x55f0e2, [_0x21c4c0.tickFunction]);
|
||||
};
|
||||
};
|
||||
_0x51f790.prototype.start = function(_0x17a8e5) {
|
||||
this.update = _0x17a8e5 || _0x519c5e, this.startTicker();
|
||||
};
|
||||
var _0x594d89 = function() {};
|
||||
_0x594d89.prototype.update = _0x519c5e, _0x594d89.prototype.start = function(_0x39fdd2) {
|
||||
this.update = _0x39fdd2 || _0x519c5e;
|
||||
};
|
||||
var _0x2ff982 = function(_0x2b1a98, _0x4f87ba) {
|
||||
this.listener = _0x2b1a98, this.gamepadGetter = _0x4f87ba, this.knownGamepads = [];
|
||||
};
|
||||
_0x2ff982.factory = function(_0xc62323) {
|
||||
var _0x519c5e = _0x21c4c0,
|
||||
_0x2c02e1 = window && window.navigator;
|
||||
return _0x2c02e1 && (void 0x0 !== _0x2c02e1.getGamepads ? _0x519c5e = new _0x2ff982(_0xc62323, function() {
|
||||
return _0x2c02e1.getGamepads();
|
||||
}) : void 0x0 !== _0x2c02e1.webkitGamepads ? _0x519c5e = new _0x2ff982(_0xc62323, function() {
|
||||
return _0x2c02e1.webkitGamepads();
|
||||
}) : void 0x0 !== _0x2c02e1.webkitGetGamepads && (_0x519c5e = new _0x2ff982(_0xc62323, function() {
|
||||
return _0x2c02e1.webkitGetGamepads();
|
||||
}))), _0x519c5e;
|
||||
}, _0x2ff982.getType = function() {
|
||||
return 'WebKit';
|
||||
}, _0x2ff982.prototype.getType = function() {
|
||||
return _0x2ff982.getType();
|
||||
}, _0x2ff982.prototype.isSupported = function() {
|
||||
return true;
|
||||
}, _0x2ff982.prototype.update = function() {
|
||||
var _0x36fa8f, _0x519c5e, _0x21c4c0 = Array.prototype.slice.call(this.gamepadGetter(), 0x0);
|
||||
for (_0x519c5e = this.knownGamepads.length - 0x1; _0x519c5e >= 0x0; _0x519c5e--) _0x36fa8f = this.knownGamepads[_0x519c5e], _0x21c4c0.indexOf(_0x36fa8f) < 0x0 && (this.knownGamepads.splice(_0x519c5e, 0x1), this.listener._disconnect(_0x36fa8f));
|
||||
for (_0x519c5e = 0x0; _0x519c5e < _0x21c4c0.length; _0x519c5e++)(_0x36fa8f = _0x21c4c0[_0x519c5e]) && this.knownGamepads.indexOf(_0x36fa8f) < 0x0 && (this.knownGamepads.push(_0x36fa8f), this.listener._connect(_0x36fa8f));
|
||||
};
|
||||
var _0x2f4e6b = function(_0x3d65fc) {
|
||||
this.listener = _0x3d65fc, window.addEventListener('gamepadconnected', function(_0x44ea49) {
|
||||
_0x3d65fc._connect(_0x44ea49.gamepad);
|
||||
}), window.addEventListener('gamepaddisconnected', function(_0xfb7aa0) {
|
||||
_0x3d65fc._disconnect(_0xfb7aa0.gamepad);
|
||||
});
|
||||
};
|
||||
_0x2f4e6b.factory = function(_0x4c832a) {
|
||||
var _0x519c5e = _0x21c4c0;
|
||||
return window && void 0x0 !== window.addEventListener && (_0x519c5e = new _0x2f4e6b(_0x4c832a)), _0x519c5e;
|
||||
}, _0x2f4e6b.getType = function() {
|
||||
return 'Firefox';
|
||||
}, _0x2f4e6b.prototype.getType = function() {
|
||||
return _0x2f4e6b.getType();
|
||||
}, _0x2f4e6b.prototype.isSupported = function() {
|
||||
return -0x1 !== (window && window.navigator).userAgent.indexOf('Firefox');
|
||||
}, _0x2f4e6b.prototype.update = _0x519c5e;
|
||||
var _0x5633cb = function(_0x1f6314) {
|
||||
this.updateStrategy = _0x1f6314 || new _0x51f790(), this.gamepads = [], this.listeners = {}, this.platform = _0x21c4c0, this.deadzone = 0.03, this.maximizeThreshold = 0.97;
|
||||
};
|
||||
_0x5633cb.UpdateStrategies = {
|
||||
'AnimFrameUpdateStrategy': _0x51f790,
|
||||
'ManualUpdateStrategy': _0x594d89
|
||||
}, _0x5633cb.PlatformFactories = [_0x2f4e6b.factory, _0x2ff982.factory], _0x5633cb.Type = {
|
||||
'N64': 'n64',
|
||||
'PLAYSTATION': 'playstation',
|
||||
'LOGITECH': 'logitech',
|
||||
'XBOX': 'xbox',
|
||||
'ECKA': 'ecka',
|
||||
'UNKNOWN': 'unknown'
|
||||
}, _0x5633cb.Event = {
|
||||
'CONNECTED': 'connected',
|
||||
'UNSUPPORTED': 'unsupported',
|
||||
'DISCONNECTED': 'disconnected',
|
||||
'TICK': 'tick',
|
||||
'BUTTON_DOWN': 'button-down',
|
||||
'BUTTON_UP': 'button-up',
|
||||
'AXIS_CHANGED': 'axis-changed'
|
||||
}, _0x5633cb.StandardButtons = ['BUTTON_1', 'BUTTON_2', 'BUTTON_3', 'BUTTON_4', 'LEFT_TOP_SHOULDER', 'RIGHT_TOP_SHOULDER', 'LEFT_BOTTOM_SHOULDER', 'RIGHT_BOTTOM_SHOULDER', 'SELECT_BACK', 'START_FORWARD', 'LEFT_STICK', 'RIGHT_STICK', 'DPAD_UP', 'DPAD_DOWN', 'DPAD_LEFT', 'DPAD_RIGHT', 'HOME'], _0x5633cb.StandardAxes = ['LEFT_STICK_X', 'LEFT_STICK_Y', 'RIGHT_STICK_X', 'RIGHT_STICK_Y'];
|
||||
var _0x11b15e, _0x1380fc = function(_0x2a091d, _0x396791, _0x49a80e) {
|
||||
return _0x396791 < _0x2a091d.length ? _0x2a091d[_0x396791] : _0x49a80e + (_0x396791 - _0x2a091d.length + 0x1);
|
||||
};
|
||||
_0x5633cb.StandardMapping = {
|
||||
'env': {},
|
||||
'buttons': {
|
||||
'byButton': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, 0x2, 0x3]
|
||||
}
|
||||
}, _0x5633cb.Mappings = [{
|
||||
'env': {
|
||||
'platform': _0x2f4e6b.getType(),
|
||||
'type': _0x5633cb.Type.N64
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0x2, 0x1, 0x3, 0x0, 0x4, 0x5, -0x1, -0x1, 0x8, 0x9, -0x1, -0x1, 0xc, 0xd, 0xe, 0xf, -0x1]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x1, 0x2, -0x1, -0x1]
|
||||
}
|
||||
}, {
|
||||
'env': {
|
||||
'platform': _0x2ff982.getType(),
|
||||
'type': _0x5633cb.Type.N64
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0x2, 0x1, 0x3, 0x0, 0x4, 0x5, -0x1, -0x1, 0x8, 0x9, -0x1, -0x1, 0xc, 0xd, 0xe, 0xf, -0x1]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, -0x1, -0x1]
|
||||
}
|
||||
}, {
|
||||
'env': {
|
||||
'platform': _0x2f4e6b.getType(),
|
||||
'type': _0x5633cb.Type.XBOX
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0xf, 0x10, 0x9, 0x8, 0x6, 0x7, 0xb, 0xc, 0xd, 0xe, 0xa]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, 0x2, 0x3]
|
||||
}
|
||||
}, {
|
||||
'env': {
|
||||
'platform': _0x2f4e6b.getType(),
|
||||
'type': _0x5633cb.Type.PLAYSTATION
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0xe, 0xd, 0xf, 0xc, 0xa, 0xb, 0x8, 0x9, 0x0, 0x3, 0x1, 0x2, 0x4, 0x6, 0x7, 0x5, 0x10]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, 0x2, 0x3]
|
||||
}
|
||||
}, {
|
||||
'env': {
|
||||
'platform': _0x2ff982.getType(),
|
||||
'type': _0x5633cb.Type.LOGITECH
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0x1, 0x2, 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xb, 0xc, 0xd, 0xe, 0xa]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, 0x2, 0x3]
|
||||
}
|
||||
}, {
|
||||
'env': {
|
||||
'platform': _0x2f4e6b.getType(),
|
||||
'type': _0x5633cb.Type.LOGITECH
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0, 1, 2, 3, 4, 5, -1, -1, 6, 7, 8, 9, 11, 12, 13, 14, 10],
|
||||
'byAxis': [-0x1, -0x1, -0x1, -0x1, -0x1, -0x1, [0x2, 0x0, 0x1],
|
||||
[0x2, 0x0, -0x1]
|
||||
]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, 0x3, 0x4]
|
||||
}
|
||||
}, {
|
||||
'env': {
|
||||
'platform': _0x2ff982.getType(),
|
||||
'type': _0x5633cb.Type.ECKA
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0x2, 0x1, 0x3, 0x0, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xb, 0xc, 0xd, 0xe, 0xa],
|
||||
'byAxis': [-0x1, -0x1, -0x1, -0x1, -0x1, -0x1, [0x2, 0x0, 0x1],
|
||||
[0x2, 0x0, -0x1]
|
||||
]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, 0x3, 0x4]
|
||||
}
|
||||
}, {
|
||||
'env': {
|
||||
'platform': _0x2ff982.getType(),
|
||||
'type': _0x5633cb.Type.UNKNOWN
|
||||
},
|
||||
'buttons': {
|
||||
'byButton': [0x0, 0x1, 0x2, 0x3, 0x4, 0x5, -0x1, -0x1, 0x6, 0x7, 0x8, 0x9, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0xa]
|
||||
},
|
||||
'axes': {
|
||||
'byAxis': [0x0, 0x1, 0x2, 0x5]
|
||||
}
|
||||
}], _0x5633cb.prototype.init = function() {
|
||||
var _0x36fa8f = _0x5633cb.resolvePlatform(this),
|
||||
_0x519c5e = this;
|
||||
return this.platform = _0x36fa8f, this.updateStrategy.start(function() {
|
||||
_0x519c5e._update();
|
||||
}), this.buttonState = [], this.extraButtonState = [], _0x36fa8f.isSupported();
|
||||
}, _0x5633cb.prototype.bind = function(_0x1ad7a3, _0x381962) {
|
||||
return void 0x0 === this.listeners[_0x1ad7a3] && (this.listeners[_0x1ad7a3] = []), this.listeners[_0x1ad7a3].push(_0x381962), this;
|
||||
}, _0x5633cb.prototype.unbind = function(_0x1e8e29, _0x14faad) {
|
||||
if (void 0x0 !== _0x1e8e29) {
|
||||
if (void 0x0 !== _0x14faad) {
|
||||
if (void 0x0 === this.listeners[_0x1e8e29]) return !0x1;
|
||||
for (var _0x21c4c0 = 0x0; _0x21c4c0 < this.listeners[_0x1e8e29].length; _0x21c4c0++)
|
||||
if (this.listeners[_0x1e8e29][_0x21c4c0] === _0x14faad) return this.listeners[_0x1e8e29].splice(_0x21c4c0, 0x1), true;
|
||||
return !0x1;
|
||||
}, null, null, null, null, null, function(module) {
|
||||
//I wrote this myself -- theres bound to be bugs
|
||||
function Gamepad() {
|
||||
var gp = navigator.getGamepads || navigator.webkitGetGamepads;
|
||||
if (!gp) {
|
||||
throw new Error("get gamepads not found!");
|
||||
}
|
||||
this.rAF = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.requestAnimationFrame;
|
||||
if (!this.rAF) {
|
||||
throw new Error("request animation frame was not found!");
|
||||
}
|
||||
this.loop();
|
||||
}
|
||||
Gamepad.prototype = {
|
||||
gamepads: [],
|
||||
rAF: null,
|
||||
getGamepads: function() {
|
||||
return navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);
|
||||
},
|
||||
loop: async function() {
|
||||
this.updateGamepadState();
|
||||
this.rAF.call(null, this.loop.bind(this));
|
||||
},
|
||||
updateGamepadState: function() {
|
||||
var gamepads = this.getGamepads();
|
||||
for (var i=0; i<gamepads.length; i++) {
|
||||
if (!gamepads[i]) continue;
|
||||
var hasGamepad = false;
|
||||
for (var j=0; j<this.gamepads.length; j++) {
|
||||
if (!this.gamepads[j]) continue;
|
||||
if (this.gamepads[j].index === gamepads[i].index) {
|
||||
hasGamepad = true;
|
||||
if (typeof this.onaxischanged == 'function') {
|
||||
for (var q=0; q<this.gamepads[j].axes.length; q++) {
|
||||
if (gamepads[i].axes[q] !== this.gamepads[j].axes[q]) {
|
||||
var axis = function(index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return 'LEFT_STICK_X';
|
||||
case 1:
|
||||
return 'LEFT_STICK_Y';
|
||||
case 2:
|
||||
return 'RIGHT_STICK_X';
|
||||
case 3:
|
||||
return 'RIGHT_STICK_Y';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}(q);
|
||||
if (!axis) continue;
|
||||
this.onaxischanged({axis:axis, value:gamepads[i].axes[q], index:i, gamepadIndex:gamepads[i].index});
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var q=0; q<this.gamepads[j].buttons.length; q++) {
|
||||
let pressed = this.gamepads[j].buttons[q] == 1.0;
|
||||
if (typeof(this.gamepads[j].buttons[q]) == "object") {
|
||||
pressed = this.gamepads[j].buttons[q].pressed;
|
||||
}
|
||||
let pressed2 = gamepads[i].buttons[q] == 1.0;
|
||||
if (typeof(gamepads[i].buttons[q]) == "object") {
|
||||
pressed2 = gamepads[i].buttons[q].pressed;
|
||||
}
|
||||
if (pressed !== pressed2) {
|
||||
if (pressed2) {
|
||||
if (typeof this.onbuttondown == 'function') {
|
||||
this.onbuttondown({index:q, gamepadIndex:gamepads[i].index});
|
||||
}
|
||||
} else {
|
||||
if (typeof this.onbuttonup == 'function') {
|
||||
this.onbuttonup({index:q, gamepadIndex:gamepads[i].index});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.gamepads[j] = gamepads[i];
|
||||
}
|
||||
}
|
||||
if (!hasGamepad) {
|
||||
this.gamepads.push(gamepads[i]);
|
||||
if (typeof this.onconnected == 'function') {
|
||||
this.onconnected();
|
||||
}
|
||||
}
|
||||
this.listeners[_0x1e8e29] = [];
|
||||
} else this.listeners = {};
|
||||
}, _0x5633cb.prototype.count = function() {
|
||||
return this.gamepads.length;
|
||||
}, _0x5633cb.prototype._fire = function(_0x4ccbe8, _0x5d1f53) {
|
||||
if (void 0x0 !== this.listeners[_0x4ccbe8]) {
|
||||
for (var _0x21c4c0 = 0x0; _0x21c4c0 < this.listeners[_0x4ccbe8].length; _0x21c4c0++) this.listeners[_0x4ccbe8][_0x21c4c0].apply(this.listeners[_0x4ccbe8][_0x21c4c0], [_0x5d1f53]);
|
||||
var _0x2be19b = this;
|
||||
_0x5d1f53.gamepad && _0x5d1f53.gamepad.extra_buttons && _0x5d1f53.gamepad.extra_buttons.forEach(function(_0xef3dc7, _0x4315f4) {
|
||||
_0x2be19b.extraButtonState[_0x5d1f53.gamepad.index] || (_0x2be19b.extraButtonState[_0x5d1f53.gamepad.index] = []), _0x2be19b.extraButtonState[_0x5d1f53.gamepad.index][_0x4315f4] = _0xef3dc7;
|
||||
});
|
||||
}
|
||||
}, _0x5633cb.getNullPlatform = function() {
|
||||
return Object.create(_0x21c4c0);
|
||||
}, _0x5633cb.resolvePlatform = function(_0x3528ec) {
|
||||
var _0x519c5e, _0x1ff0c4 = _0x21c4c0;
|
||||
for (_0x519c5e = 0x0; !_0x1ff0c4.isSupported() && _0x519c5e < _0x5633cb.PlatformFactories.length; _0x519c5e++) _0x1ff0c4 = _0x5633cb.PlatformFactories[_0x519c5e](_0x3528ec);
|
||||
return _0x1ff0c4;
|
||||
}, _0x5633cb.prototype._connect = function(_0x1606a1) {
|
||||
var _0x519c5e, _0x21c4c0, _0x3108dc = this._resolveMapping(_0x1606a1);
|
||||
for (_0x1606a1.state = {}, _0x1606a1.lastState = {}, _0x1606a1.updater = [], this.buttonState[_0x1606a1.index] || (this.buttonState[_0x1606a1.index] = []), this.extraButtonState[_0x1606a1.index] || (this.extraButtonState[_0x1606a1.index] = []), _0x519c5e = _0x3108dc.buttons.byButton.length, _0x21c4c0 = 0x0; _0x21c4c0 < _0x519c5e; _0x21c4c0++) this._addButtonUpdater(_0x1606a1, _0x3108dc, _0x21c4c0);
|
||||
for (_0x519c5e = _0x3108dc.axes.byAxis.length, _0x21c4c0 = 0x0; _0x21c4c0 < _0x519c5e; _0x21c4c0++) this._addAxisUpdater(_0x1606a1, _0x3108dc, _0x21c4c0);
|
||||
if (this.gamepads[_0x1606a1.index] = _0x1606a1, !this.gamepads[_0x1606a1.index].extra_buttons)
|
||||
for (this.gamepads[_0x1606a1.index].extra_buttons = [], _0x21c4c0 = _0x1606a1.buttons.length; _0x21c4c0 < 0x10; _0x21c4c0++) this.extraButtonState[_0x1606a1.index][_0x21c4c0] ? this.gamepads[_0x1606a1.index].extra_buttons[_0x21c4c0] = this.extraButtonState[_0x1606a1.index][_0x21c4c0] : this.gamepads[_0x1606a1.index].extra_buttons[_0x21c4c0] = {
|
||||
'pressed': !0x1,
|
||||
'value': 0x0
|
||||
};
|
||||
this._fire(_0x5633cb.Event.CONNECTED, _0x1606a1);
|
||||
}, _0x5633cb.prototype._addButtonUpdater = function(_0x19541b, _0x3a8718, _0x2e14e2) {
|
||||
var _0x14879d, _0x49f481 = _0x1380fc(_0x5633cb.StandardButtons, _0x2e14e2, 'EXTRA_BUTTON_'),
|
||||
_0x220cd5 = this._createButtonGetter(_0x19541b, _0x3a8718.buttons, _0x2e14e2),
|
||||
_0x1fe059 = this,
|
||||
_0x2ff716 = {
|
||||
'gamepad': _0x19541b,
|
||||
'control': _0x49f481,
|
||||
'index': _0x2e14e2,
|
||||
'gamepadIndex': _0x19541b.index
|
||||
};
|
||||
_0x19541b.state[_0x49f481] = 0x0, _0x19541b.lastState[_0x49f481] = 0x0, null == this.buttonState[_0x19541b.index][_0x49f481] && (this.buttonState[_0x19541b.index][_0x49f481] = 0x0), _0x14879d = function() {
|
||||
var _0x3a8718 = _0x220cd5(),
|
||||
_0x2e14e2 = _0x19541b.lastState[_0x49f481],
|
||||
_0x11e126 = _0x3a8718 > 0.5,
|
||||
_0x1078e7 = _0x2e14e2 > 0.5;
|
||||
_0x19541b.state[_0x49f481] = _0x3a8718, _0x11e126 && !_0x1078e7 ? _0x1fe059._fire(_0x5633cb.Event.BUTTON_DOWN, Object.create(_0x2ff716)) : !_0x11e126 && _0x1078e7 ? _0x1fe059._fire(_0x5633cb.Event.BUTTON_UP, Object.create(_0x2ff716)) : _0x1fe059.buttonState[_0x19541b.index][_0x49f481] != _0x3a8718 && _0x1fe059._fire(_0x5633cb.Event.BUTTON_UP, Object.create(_0x2ff716)), 0x0 !== _0x3a8718 && 0x1 !== _0x3a8718 && _0x3a8718 !== _0x2e14e2 && _0x1fe059._fireAxisChangedEvent(_0x19541b, _0x49f481, _0x3a8718), _0x19541b.lastState[_0x49f481] = _0x3a8718, _0x1fe059.buttonState[_0x19541b.index][_0x49f481] = _0x3a8718;
|
||||
}, _0x19541b.updater.push(_0x14879d);
|
||||
}, _0x5633cb.prototype._addAxisUpdater = function(_0x54e7b0, _0x2a7b73, _0x8f3c6d) {
|
||||
var _0x180376, _0x32658f = _0x1380fc(_0x5633cb.StandardAxes, _0x8f3c6d, 'EXTRA_AXIS_'),
|
||||
_0x4a1dfc = this._createAxisGetter(_0x54e7b0, _0x2a7b73.axes, _0x8f3c6d),
|
||||
_0x11e62a = this;
|
||||
_0x54e7b0.state[_0x32658f] = 0x0, _0x54e7b0.lastState[_0x32658f] = 0x0, null == this.buttonState[_0x54e7b0.index][_0x32658f] && (this.buttonState[_0x54e7b0.index][_0x32658f] = 0x0), _0x180376 = function() {
|
||||
var _0x2a7b73 = _0x4a1dfc(),
|
||||
_0x8f3c6d = _0x11e62a.buttonState[_0x54e7b0.index][_0x32658f];
|
||||
_0x54e7b0.state[_0x32658f] = _0x2a7b73, _0x2a7b73 !== _0x8f3c6d && _0x11e62a._fireAxisChangedEvent(_0x54e7b0, _0x32658f, _0x2a7b73), _0x54e7b0.lastState[_0x32658f] = _0x2a7b73, _0x11e62a.buttonState[_0x54e7b0.index][_0x32658f] = _0x2a7b73;
|
||||
}, _0x54e7b0.updater.push(_0x180376);
|
||||
}, _0x5633cb.prototype._fireAxisChangedEvent = function(_0x1b1af6, _0x297863, _0x310ce0) {
|
||||
var _0x181122 = {
|
||||
'gamepad': _0x1b1af6,
|
||||
'axis': _0x297863,
|
||||
'value': _0x310ce0
|
||||
};
|
||||
this._fire(_0x5633cb.Event.AXIS_CHANGED, _0x181122);
|
||||
}, _0x5633cb.prototype._createButtonGetter = (_0x11b15e = function() {
|
||||
return 0x0;
|
||||
}, function(_0x8afe40, _0x4912fb, _0x78724a) {
|
||||
var _0x57e1d5, _0x2126da, _0xbc04b4 = _0x11b15e,
|
||||
_0x4f004d = this;
|
||||
return -0x1 !== (_0x57e1d5 = _0x4912fb.byButton[_0x78724a]) ? 'number' == typeof _0x57e1d5 && _0x57e1d5 < _0x8afe40.buttons.length && (_0xbc04b4 = function() {
|
||||
var _0x4912fb = _0x8afe40.buttons[_0x57e1d5];
|
||||
return 'number' == typeof _0x4912fb ? _0x4912fb : 'number' == typeof _0x4912fb.value ? _0x4912fb.value : 0x0;
|
||||
}) : _0x4912fb.byAxis && _0x78724a < _0x4912fb.byAxis.length && (_0x57e1d5 = _0x4912fb.byAxis[_0x78724a], _0x2126da = _0x57e1d5, '[object Array]' === Object.prototype.toString.call(_0x2126da) && 0x3 == _0x57e1d5.length && _0x57e1d5[0x0] < _0x8afe40.axes.length && (_0xbc04b4 = function(_0x41d3e7, _0xfe6d41, _0x1c883a) {
|
||||
var _0x23be26 = _0x11b15e;
|
||||
return _0xfe6d41 < _0x1c883a ? _0x23be26 = function() {
|
||||
var _0x5bba97 = _0x1c883a - _0xfe6d41,
|
||||
_0x23be85 = _0x41d3e7();
|
||||
return (_0x23be85 = (_0x23be85 - _0xfe6d41) / _0x5bba97) < 0x0 ? 0x0 : _0x23be85;
|
||||
} : _0x1c883a < _0xfe6d41 && (_0x23be26 = function() {
|
||||
var _0xd24650 = _0xfe6d41 - _0x1c883a,
|
||||
_0x183f73 = _0x41d3e7();
|
||||
return (_0x183f73 = (_0x183f73 - _0x1c883a) / _0xd24650) > 0x1 ? 0x0 : 0x1 - _0x183f73;
|
||||
}), _0x23be26;
|
||||
}(_0xbc04b4 = function() {
|
||||
var _0x4912fb = _0x8afe40.axes[_0x57e1d5[0x0]];
|
||||
return _0x4f004d._applyDeadzoneMaximize(_0x4912fb);
|
||||
}, _0x57e1d5[0x1], _0x57e1d5[0x2]))), _0xbc04b4;
|
||||
}), _0x5633cb.prototype._createAxisGetter = function() {
|
||||
var _0x36fa8f = function() {
|
||||
return 0x0;
|
||||
};
|
||||
return function(_0x2d14b3, _0x6afd0e, _0x20eff1) {
|
||||
var _0x1b8acf, _0x2b1b0a = _0x36fa8f,
|
||||
_0x101060 = this;
|
||||
return -0x1 !== (_0x1b8acf = _0x6afd0e.byAxis[_0x20eff1]) && 'number' == typeof _0x1b8acf && _0x1b8acf < _0x2d14b3.axes.length && (_0x2b1b0a = function() {
|
||||
var _0x36fa8f = _0x2d14b3.axes[_0x1b8acf];
|
||||
return _0x101060._applyDeadzoneMaximize(_0x36fa8f);
|
||||
}), _0x2b1b0a;
|
||||
};
|
||||
}(), _0x5633cb.prototype._disconnect = function(_0x116fb9) {
|
||||
var _0x519c5e, _0x21c4c0 = [];
|
||||
for (void 0x0 !== this.gamepads[_0x116fb9.index] && delete this.gamepads[_0x116fb9.index], _0x519c5e = 0x0; _0x519c5e < this.gamepads.length; _0x519c5e++) void 0x0 !== this.gamepads[_0x519c5e] && (_0x21c4c0[_0x519c5e] = this.gamepads[_0x519c5e]);
|
||||
this.gamepads = _0x21c4c0, this._fire(_0x5633cb.Event.DISCONNECTED, _0x116fb9);
|
||||
}, _0x5633cb.prototype._resolveControllerType = function(_0x582727) {
|
||||
return -0x1 !== (_0x582727 = _0x582727.toLowerCase().replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '')).indexOf('playstation') ? _0x5633cb.Type.PLAYSTATION : -0x1 !== _0x582727.indexOf('logitech') || -0x1 !== _0x582727.indexOf('wireless gamepad') ? _0x5633cb.Type.LOGITECH : -0x1 !== _0x582727.indexOf('xbox') || -0x1 !== _0x582727.indexOf('360') ? _0x5633cb.Type.XBOX : -0x1 !== _0x582727.indexOf('79-6-generic') && -0x1 !== _0x582727.indexOf('joystick') || -0x1 !== _0x582727.indexOf('vendor: 0079 product: 0006') && -0x1 !== _0x582727.indexOf('generic usb joystick') ? _0x5633cb.Type.N64 : 'usb joystick (vendor: 0e8f product: 0002)' === _0x582727 ? _0x5633cb.Type.ECKA : _0x5633cb.Type.UNKNOWN;
|
||||
}, _0x5633cb.prototype._resolveMapping = function(_0x13e45d) {
|
||||
var _0x519c5e, _0x21c4c0, _0x4d3f81 = _0x5633cb.Mappings,
|
||||
_0x1d4264 = null,
|
||||
_0xebffe5 = {
|
||||
'platform': this.platform.getType(),
|
||||
'type': this._resolveControllerType(_0x13e45d.id)
|
||||
};
|
||||
for (_0x519c5e = 0x0; !_0x1d4264 && _0x519c5e < _0x4d3f81.length; _0x519c5e++) _0x21c4c0 = _0x4d3f81[_0x519c5e], _0x5633cb.envMatchesFilter(_0x21c4c0.env, _0xebffe5) && (_0x1d4264 = _0x21c4c0);
|
||||
return _0x1d4264 || _0x5633cb.StandardMapping;
|
||||
}, _0x5633cb.envMatchesFilter = function(_0x26e73d, _0x55c334) {
|
||||
var _0x21c4c0, _0x514a3a = true;
|
||||
for (_0x21c4c0 in _0x26e73d) _0x26e73d[_0x21c4c0] !== _0x55c334[_0x21c4c0] && (_0x514a3a = !0x1);
|
||||
return _0x514a3a;
|
||||
}, _0x5633cb.prototype._update = function() {
|
||||
this.platform.update(), this.gamepads.forEach(function(_0x415bf6) {
|
||||
_0x415bf6 && _0x415bf6.updater.forEach(function(_0x39f57c) {
|
||||
_0x39f57c();
|
||||
});
|
||||
}), this.gamepads.length > 0x0 && this._fire(_0x5633cb.Event.TICK, this.gamepads);
|
||||
}, _0x5633cb.prototype._applyDeadzoneMaximize = function(_0x5b561d, _0x55976e, _0x5df97a) {
|
||||
return _0x55976e = void 0x0 !== _0x55976e ? _0x55976e : this.deadzone, _0x5df97a = void 0x0 !== _0x5df97a ? _0x5df97a : this.maximizeThreshold, _0x5b561d >= 0x0 ? _0x5b561d < _0x55976e ? _0x5b561d = 0x0 : _0x5b561d > _0x5df97a && (_0x5b561d = 0x1) : _0x5b561d > -_0x55976e ? _0x5b561d = 0x0 : _0x5b561d < -_0x5df97a && (_0x5b561d = -0x1), _0x5b561d;
|
||||
}, _0x36fa8f.Gamepad = _0x5633cb;
|
||||
}(_0x3982a1.exports || window);
|
||||
for (var j=0; j<this.gamepads.length; j++) {
|
||||
if (!this.gamepads[j]) continue;
|
||||
var has = false;
|
||||
for (var i=0; i<gamepads.length; i++) {
|
||||
if (!gamepads[i]) continue;
|
||||
if (this.gamepads[j].index === gamepads[i].index) {
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
this.gamepads.splice(j, 1);
|
||||
j--;
|
||||
if (typeof this.ondisconnected == 'function') {
|
||||
this.ondisconnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
on: function(name, cb) {
|
||||
this["on"+name.toLowerCase()] = cb;
|
||||
}
|
||||
}
|
||||
module.exports = Gamepad;
|
||||
}, null, null, null, null, function(module, _0x4f5203, _0x5028a6) {
|
||||
var _0x33171 = function(url, opts) {
|
||||
var url;
|
||||
|
||||
2
data/emulator.min.js
vendored
2
data/emulator.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
(async function() {
|
||||
var VERSION = 2.4;
|
||||
var VERSION = 3;
|
||||
if ((window.location && ['localhost', '127.0.0.1'].includes(location.hostname)) ||
|
||||
'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX) {
|
||||
fetch('https://raw.githack.com/ethanaobrien/emulatorjs/main/data/version.json').then(response => {
|
||||
@ -73,6 +73,7 @@
|
||||
'undefined' != typeof EJS_loadStateURL && (config.loadStateOnStart = EJS_loadStateURL);
|
||||
'undefined' != typeof EJS_language && (config.lang = EJS_language);
|
||||
'undefined' != typeof EJS_noAutoCloseAd && (config.noAutoAdClose = EJS_noAutoCloseAd);
|
||||
'undefined' != typeof EJS_VirtualGamepadSettings && (config.VirtualGamepadSettings = EJS_VirtualGamepadSettings);
|
||||
'undefined' != typeof EJS_oldEJSNetplayServer && (config.oldNetplayServer = EJS_oldEJSNetplayServer);
|
||||
'undefined' != typeof EJS_Buttons && (config.buttons = EJS_Buttons);
|
||||
'undefined' != typeof EJS_Settings && (config.settings = EJS_Settings);
|
||||
|
||||
34
data/v.json
34
data/v.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"nes": {
|
||||
"version":"21",
|
||||
"version":"23",
|
||||
"netplay": 1,
|
||||
"old": {"wasm":1, "asmjs":1 },
|
||||
"state": 1,
|
||||
@ -10,7 +10,7 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"snes": {
|
||||
"version":"18",
|
||||
"version":"20",
|
||||
"netplay": 1,
|
||||
"old": {"wasm":1, "asmjs":1 },
|
||||
"state": 1,
|
||||
@ -119,7 +119,7 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"vb": {
|
||||
"version":"4",
|
||||
"version":"6",
|
||||
"netplay": 0,
|
||||
"old": {"wasm":1, "asmjs":1 },
|
||||
"state": 1,
|
||||
@ -138,7 +138,7 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"atari5200": {
|
||||
"version":"2",
|
||||
"version":"3",
|
||||
"netplay": 1,
|
||||
"state": 1,
|
||||
"asmjs": 1,
|
||||
@ -183,7 +183,7 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"gb": {
|
||||
"version":"9",
|
||||
"version":"11",
|
||||
"netplay": 0,
|
||||
"state": 1,
|
||||
"old": {"wasm":0, "asmjs":1 },
|
||||
@ -202,12 +202,13 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"gba": {
|
||||
"version":"7",
|
||||
"version":"9",
|
||||
"netplay": 0,
|
||||
"state": 1,
|
||||
"old": {"wasm":0, "asmjs":1 },
|
||||
"asmjs": 1,
|
||||
"wasm": 0,
|
||||
"newCores": 0,
|
||||
"wasm": 1,
|
||||
"newCores": 1,
|
||||
"oldCores": 1
|
||||
},
|
||||
"segaGG": {
|
||||
@ -265,7 +266,7 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"n64": {
|
||||
"version":"10",
|
||||
"version":"12",
|
||||
"netplay": 1,
|
||||
"state": 1,
|
||||
"asmjs": 0,
|
||||
@ -275,7 +276,7 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"nds": {
|
||||
"version":"13",
|
||||
"version":"15",
|
||||
"old": {"wasm":1, "asmjs":1 },
|
||||
"netplay": 0,
|
||||
"state": 1,
|
||||
@ -303,8 +304,8 @@
|
||||
"oldCores": 1
|
||||
},
|
||||
"mame2003": {
|
||||
"version":"2",
|
||||
"old": {"wasm":1, "asmjs":1 },
|
||||
"version":"4",
|
||||
"old": {"wasm":0, "asmjs":1 },
|
||||
"netplay": 1,
|
||||
"state": 1,
|
||||
"asmjs": 0,
|
||||
@ -329,14 +330,5 @@
|
||||
"wasm": 1,
|
||||
"newCores": 0,
|
||||
"oldCores": 1
|
||||
},
|
||||
"dos": {
|
||||
"version":"1",
|
||||
"netplay": 0,
|
||||
"state": 0,
|
||||
"asmjs": 0,
|
||||
"wasm": 1,
|
||||
"newCores": 1,
|
||||
"oldCores": 0
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
{ "current_version": 2.4 }
|
||||
{ "current_version": 3 }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user