mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
iOS 12 support
Some checks are pending
Make Latest Folder On EmulatorJS CDN / run (push) Waiting to run
Some checks are pending
Make Latest Folder On EmulatorJS CDN / run (push) Waiting to run
This commit is contained in:
parent
83768b6804
commit
d9e1e69d9c
2 changed files with 220 additions and 220 deletions
|
@ -89,7 +89,6 @@ class EmulatorJS {
|
||||||
}
|
}
|
||||||
return options[core] || core;
|
return options[core] || core;
|
||||||
}
|
}
|
||||||
extensions = []
|
|
||||||
createElement(type) {
|
createElement(type) {
|
||||||
return document.createElement(type);
|
return document.createElement(type);
|
||||||
}
|
}
|
||||||
|
@ -225,6 +224,8 @@ class EmulatorJS {
|
||||||
}
|
}
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
this.ejs_version = "4.0.13-beta";
|
this.ejs_version = "4.0.13-beta";
|
||||||
|
this.extensions = [];
|
||||||
|
this.initControlVars();
|
||||||
this.debug = (window.EJS_DEBUG_XX === true);
|
this.debug = (window.EJS_DEBUG_XX === true);
|
||||||
if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates();
|
if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates();
|
||||||
this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true);
|
this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true);
|
||||||
|
@ -397,12 +398,13 @@ class EmulatorJS {
|
||||||
this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]);
|
this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
functions = {};
|
|
||||||
on(event, func) {
|
on(event, func) {
|
||||||
|
if (!this.functions) this.functions = {};
|
||||||
if (!Array.isArray(this.functions[event])) this.functions[event] = [];
|
if (!Array.isArray(this.functions[event])) this.functions[event] = [];
|
||||||
this.functions[event].push(func);
|
this.functions[event].push(func);
|
||||||
}
|
}
|
||||||
callEvent(event, data) {
|
callEvent(event, data) {
|
||||||
|
if (!this.functions) this.functions = {};
|
||||||
if (!Array.isArray(this.functions[event])) return 0;
|
if (!Array.isArray(this.functions[event])) return 0;
|
||||||
this.functions[event].forEach(e => e(data));
|
this.functions[event].forEach(e => e(data));
|
||||||
return this.functions[event].length;
|
return this.functions[event].length;
|
||||||
|
@ -2773,224 +2775,225 @@ class EmulatorJS {
|
||||||
this.controlMenu.appendChild(popup);
|
this.controlMenu.appendChild(popup);
|
||||||
|
|
||||||
}
|
}
|
||||||
defaultControllers = {
|
initControlVars() {
|
||||||
0: {
|
this.defaultControllers = {
|
||||||
0: {
|
0: {
|
||||||
'value': 'x',
|
0: {
|
||||||
'value2': 'BUTTON_2'
|
'value': 'x',
|
||||||
|
'value2': 'BUTTON_2'
|
||||||
|
},
|
||||||
|
1: {
|
||||||
|
'value': 's',
|
||||||
|
'value2': 'BUTTON_4'
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
'value': 'v',
|
||||||
|
'value2': 'SELECT'
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
'value': 'enter',
|
||||||
|
'value2': 'START'
|
||||||
|
},
|
||||||
|
4: {
|
||||||
|
'value': 'up arrow',
|
||||||
|
'value2': 'DPAD_UP'
|
||||||
|
},
|
||||||
|
5: {
|
||||||
|
'value': 'down arrow',
|
||||||
|
'value2': 'DPAD_DOWN'
|
||||||
|
},
|
||||||
|
6: {
|
||||||
|
'value': 'left arrow',
|
||||||
|
'value2': 'DPAD_LEFT'
|
||||||
|
},
|
||||||
|
7: {
|
||||||
|
'value': 'right arrow',
|
||||||
|
'value2': 'DPAD_RIGHT'
|
||||||
|
},
|
||||||
|
8: {
|
||||||
|
'value': 'z',
|
||||||
|
'value2': 'BUTTON_1'
|
||||||
|
},
|
||||||
|
9: {
|
||||||
|
'value': 'a',
|
||||||
|
'value2': 'BUTTON_3'
|
||||||
|
},
|
||||||
|
10: {
|
||||||
|
'value': 'q',
|
||||||
|
'value2': 'LEFT_TOP_SHOULDER'
|
||||||
|
},
|
||||||
|
11: {
|
||||||
|
'value': 'e',
|
||||||
|
'value2': 'RIGHT_TOP_SHOULDER'
|
||||||
|
},
|
||||||
|
12: {
|
||||||
|
'value': 'tab',
|
||||||
|
'value2': 'LEFT_BOTTOM_SHOULDER'
|
||||||
|
},
|
||||||
|
13: {
|
||||||
|
'value': 'r',
|
||||||
|
'value2': 'RIGHT_BOTTOM_SHOULDER'
|
||||||
|
},
|
||||||
|
14: {
|
||||||
|
'value': '',
|
||||||
|
'value2': 'LEFT_STICK',
|
||||||
|
},
|
||||||
|
15: {
|
||||||
|
'value': '',
|
||||||
|
'value2': 'RIGHT_STICK',
|
||||||
|
},
|
||||||
|
16: {
|
||||||
|
'value': 'h',
|
||||||
|
'value2': 'LEFT_STICK_X:+1'
|
||||||
|
},
|
||||||
|
17: {
|
||||||
|
'value': 'f',
|
||||||
|
'value2': 'LEFT_STICK_X:-1'
|
||||||
|
},
|
||||||
|
18: {
|
||||||
|
'value': 'g',
|
||||||
|
'value2': 'LEFT_STICK_Y:+1'
|
||||||
|
},
|
||||||
|
19: {
|
||||||
|
'value': 't',
|
||||||
|
'value2': 'LEFT_STICK_Y:-1'
|
||||||
|
},
|
||||||
|
20: {
|
||||||
|
'value': 'l',
|
||||||
|
'value2': 'RIGHT_STICK_X:+1'
|
||||||
|
},
|
||||||
|
21: {
|
||||||
|
'value': 'j',
|
||||||
|
'value2': 'RIGHT_STICK_X:-1'
|
||||||
|
},
|
||||||
|
22: {
|
||||||
|
'value': 'k',
|
||||||
|
'value2': 'RIGHT_STICK_Y:+1'
|
||||||
|
},
|
||||||
|
23: {
|
||||||
|
'value': 'i',
|
||||||
|
'value2': 'RIGHT_STICK_Y:-1'
|
||||||
|
},
|
||||||
|
24: {
|
||||||
|
'value': '1'
|
||||||
|
},
|
||||||
|
25: {
|
||||||
|
'value': '2'
|
||||||
|
},
|
||||||
|
26: {
|
||||||
|
'value': '3'
|
||||||
|
},
|
||||||
|
27: {},
|
||||||
|
28: {},
|
||||||
|
29: {},
|
||||||
},
|
},
|
||||||
1: {
|
1: {},
|
||||||
'value': 's',
|
2: {},
|
||||||
'value2': 'BUTTON_4'
|
3: {}
|
||||||
},
|
}
|
||||||
2: {
|
this.keyMap = {
|
||||||
'value': 'v',
|
0: '',
|
||||||
'value2': 'SELECT'
|
8: 'backspace',
|
||||||
},
|
9: 'tab',
|
||||||
3: {
|
13: 'enter',
|
||||||
'value': 'enter',
|
16: 'shift',
|
||||||
'value2': 'START'
|
17: 'ctrl',
|
||||||
},
|
18: 'alt',
|
||||||
4: {
|
19: 'pause/break',
|
||||||
'value': 'up arrow',
|
20: 'caps lock',
|
||||||
'value2': 'DPAD_UP'
|
27: 'escape',
|
||||||
},
|
32: 'space',
|
||||||
5: {
|
33: 'page up',
|
||||||
'value': 'down arrow',
|
34: 'page down',
|
||||||
'value2': 'DPAD_DOWN'
|
35: 'end',
|
||||||
},
|
36: 'home',
|
||||||
6: {
|
37: 'left arrow',
|
||||||
'value': 'left arrow',
|
38: 'up arrow',
|
||||||
'value2': 'DPAD_LEFT'
|
39: 'right arrow',
|
||||||
},
|
40: 'down arrow',
|
||||||
7: {
|
45: 'insert',
|
||||||
'value': 'right arrow',
|
46: 'delete',
|
||||||
'value2': 'DPAD_RIGHT'
|
48: '0',
|
||||||
},
|
49: '1',
|
||||||
8: {
|
50: '2',
|
||||||
'value': 'z',
|
51: '3',
|
||||||
'value2': 'BUTTON_1'
|
52: '4',
|
||||||
},
|
53: '5',
|
||||||
9: {
|
54: '6',
|
||||||
'value': 'a',
|
55: '7',
|
||||||
'value2': 'BUTTON_3'
|
56: '8',
|
||||||
},
|
57: '9',
|
||||||
10: {
|
65: 'a',
|
||||||
'value': 'q',
|
66: 'b',
|
||||||
'value2': 'LEFT_TOP_SHOULDER'
|
67: 'c',
|
||||||
},
|
68: 'd',
|
||||||
11: {
|
69: 'e',
|
||||||
'value': 'e',
|
70: 'f',
|
||||||
'value2': 'RIGHT_TOP_SHOULDER'
|
71: 'g',
|
||||||
},
|
72: 'h',
|
||||||
12: {
|
73: 'i',
|
||||||
'value': 'tab',
|
74: 'j',
|
||||||
'value2': 'LEFT_BOTTOM_SHOULDER'
|
75: 'k',
|
||||||
},
|
76: 'l',
|
||||||
13: {
|
77: 'm',
|
||||||
'value': 'r',
|
78: 'n',
|
||||||
'value2': 'RIGHT_BOTTOM_SHOULDER'
|
79: 'o',
|
||||||
},
|
80: 'p',
|
||||||
14: {
|
81: 'q',
|
||||||
'value': '',
|
82: 'r',
|
||||||
'value2': 'LEFT_STICK',
|
83: 's',
|
||||||
},
|
84: 't',
|
||||||
15: {
|
85: 'u',
|
||||||
'value': '',
|
86: 'v',
|
||||||
'value2': 'RIGHT_STICK',
|
87: 'w',
|
||||||
},
|
88: 'x',
|
||||||
16: {
|
89: 'y',
|
||||||
'value': 'h',
|
90: 'z',
|
||||||
'value2': 'LEFT_STICK_X:+1'
|
91: 'left window key',
|
||||||
},
|
92: 'right window key',
|
||||||
17: {
|
93: 'select key',
|
||||||
'value': 'f',
|
96: 'numpad 0',
|
||||||
'value2': 'LEFT_STICK_X:-1'
|
97: 'numpad 1',
|
||||||
},
|
98: 'numpad 2',
|
||||||
18: {
|
99: 'numpad 3',
|
||||||
'value': 'g',
|
100: 'numpad 4',
|
||||||
'value2': 'LEFT_STICK_Y:+1'
|
101: 'numpad 5',
|
||||||
},
|
102: 'numpad 6',
|
||||||
19: {
|
103: 'numpad 7',
|
||||||
'value': 't',
|
104: 'numpad 8',
|
||||||
'value2': 'LEFT_STICK_Y:-1'
|
105: 'numpad 9',
|
||||||
},
|
106: 'multiply',
|
||||||
20: {
|
107: 'add',
|
||||||
'value': 'l',
|
109: 'subtract',
|
||||||
'value2': 'RIGHT_STICK_X:+1'
|
110: 'decimal point',
|
||||||
},
|
111: 'divide',
|
||||||
21: {
|
112: 'f1',
|
||||||
'value': 'j',
|
113: 'f2',
|
||||||
'value2': 'RIGHT_STICK_X:-1'
|
114: 'f3',
|
||||||
},
|
115: 'f4',
|
||||||
22: {
|
116: 'f5',
|
||||||
'value': 'k',
|
117: 'f6',
|
||||||
'value2': 'RIGHT_STICK_Y:+1'
|
118: 'f7',
|
||||||
},
|
119: 'f8',
|
||||||
23: {
|
120: 'f9',
|
||||||
'value': 'i',
|
121: 'f10',
|
||||||
'value2': 'RIGHT_STICK_Y:-1'
|
122: 'f11',
|
||||||
},
|
123: 'f12',
|
||||||
24: {
|
144: 'num lock',
|
||||||
'value': '1'
|
145: 'scroll lock',
|
||||||
},
|
186: 'semi-colon',
|
||||||
25: {
|
187: 'equal sign',
|
||||||
'value': '2'
|
188: 'comma',
|
||||||
},
|
189: 'dash',
|
||||||
26: {
|
190: 'period',
|
||||||
'value': '3'
|
191: 'forward slash',
|
||||||
},
|
192: 'grave accent',
|
||||||
27: {},
|
219: 'open bracket',
|
||||||
28: {},
|
220: 'back slash',
|
||||||
29: {},
|
221: 'close braket',
|
||||||
},
|
222: 'single quote'
|
||||||
1: {},
|
}
|
||||||
2: {},
|
|
||||||
3: {}
|
|
||||||
}
|
}
|
||||||
keyMap = {
|
|
||||||
0: '',
|
|
||||||
8: 'backspace',
|
|
||||||
9: 'tab',
|
|
||||||
13: 'enter',
|
|
||||||
16: 'shift',
|
|
||||||
17: 'ctrl',
|
|
||||||
18: 'alt',
|
|
||||||
19: 'pause/break',
|
|
||||||
20: 'caps lock',
|
|
||||||
27: 'escape',
|
|
||||||
32: 'space',
|
|
||||||
33: 'page up',
|
|
||||||
34: 'page down',
|
|
||||||
35: 'end',
|
|
||||||
36: 'home',
|
|
||||||
37: 'left arrow',
|
|
||||||
38: 'up arrow',
|
|
||||||
39: 'right arrow',
|
|
||||||
40: 'down arrow',
|
|
||||||
45: 'insert',
|
|
||||||
46: 'delete',
|
|
||||||
48: '0',
|
|
||||||
49: '1',
|
|
||||||
50: '2',
|
|
||||||
51: '3',
|
|
||||||
52: '4',
|
|
||||||
53: '5',
|
|
||||||
54: '6',
|
|
||||||
55: '7',
|
|
||||||
56: '8',
|
|
||||||
57: '9',
|
|
||||||
65: 'a',
|
|
||||||
66: 'b',
|
|
||||||
67: 'c',
|
|
||||||
68: 'd',
|
|
||||||
69: 'e',
|
|
||||||
70: 'f',
|
|
||||||
71: 'g',
|
|
||||||
72: 'h',
|
|
||||||
73: 'i',
|
|
||||||
74: 'j',
|
|
||||||
75: 'k',
|
|
||||||
76: 'l',
|
|
||||||
77: 'm',
|
|
||||||
78: 'n',
|
|
||||||
79: 'o',
|
|
||||||
80: 'p',
|
|
||||||
81: 'q',
|
|
||||||
82: 'r',
|
|
||||||
83: 's',
|
|
||||||
84: 't',
|
|
||||||
85: 'u',
|
|
||||||
86: 'v',
|
|
||||||
87: 'w',
|
|
||||||
88: 'x',
|
|
||||||
89: 'y',
|
|
||||||
90: 'z',
|
|
||||||
91: 'left window key',
|
|
||||||
92: 'right window key',
|
|
||||||
93: 'select key',
|
|
||||||
96: 'numpad 0',
|
|
||||||
97: 'numpad 1',
|
|
||||||
98: 'numpad 2',
|
|
||||||
99: 'numpad 3',
|
|
||||||
100: 'numpad 4',
|
|
||||||
101: 'numpad 5',
|
|
||||||
102: 'numpad 6',
|
|
||||||
103: 'numpad 7',
|
|
||||||
104: 'numpad 8',
|
|
||||||
105: 'numpad 9',
|
|
||||||
106: 'multiply',
|
|
||||||
107: 'add',
|
|
||||||
109: 'subtract',
|
|
||||||
110: 'decimal point',
|
|
||||||
111: 'divide',
|
|
||||||
112: 'f1',
|
|
||||||
113: 'f2',
|
|
||||||
114: 'f3',
|
|
||||||
115: 'f4',
|
|
||||||
116: 'f5',
|
|
||||||
117: 'f6',
|
|
||||||
118: 'f7',
|
|
||||||
119: 'f8',
|
|
||||||
120: 'f9',
|
|
||||||
121: 'f10',
|
|
||||||
122: 'f11',
|
|
||||||
123: 'f12',
|
|
||||||
144: 'num lock',
|
|
||||||
145: 'scroll lock',
|
|
||||||
186: 'semi-colon',
|
|
||||||
187: 'equal sign',
|
|
||||||
188: 'comma',
|
|
||||||
189: 'dash',
|
|
||||||
190: 'period',
|
|
||||||
191: 'forward slash',
|
|
||||||
192: 'grave accent',
|
|
||||||
219: 'open bracket',
|
|
||||||
220: 'back slash',
|
|
||||||
221: 'close braket',
|
|
||||||
222: 'single quote'
|
|
||||||
}
|
|
||||||
controls;
|
|
||||||
setupKeys() {
|
setupKeys() {
|
||||||
for (let i=0; i<4; i++) {
|
for (let i=0; i<4; i++) {
|
||||||
for (let j=0; j<30; j++) {
|
for (let j=0; j<30; j++) {
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
class GamepadHandler {
|
class GamepadHandler {
|
||||||
gamepads;
|
|
||||||
timeout;
|
|
||||||
listeners;
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.buttonLabels = {
|
this.buttonLabels = {
|
||||||
0: 'BUTTON_1',
|
0: 'BUTTON_1',
|
||||||
|
|
Loading…
Reference in a new issue