-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
161 lines (161 loc) · 7.18 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<html>
<head>
<title>Emulatorjs | Select Game Rom</title>
<link rel="icon" type="image/png" href="docs/Emulatorjs Logo.png">
</head>
<body>
<style>
body{
background: #c4bdff;
margin: 0;
padding: 0;
}
.form{
position: absolute;
top: 450px;
left: 50%;
margin-top: -150px;
margin-left: -250px;
width: 500px;
height: 200px;
border: 4px dashed #111;
}
.form p{
width: 100%;
height: 100%;
text-align: center;
line-height: 170px;
color: #111;
font-family: Arial;
}
.form input{
position: absolute;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
outline: none;
opacity: 0;
}
.eimg{
width: 250px;
}
#uploadf, #uploadf1{
display: block;
EJS_BETA = true;
</style>
<script>
window.addEventListener('load', function() {
document.getElementById('file').onchange = async function(e) {
var ce = function(e) {return document.createElement(e);};
var br = function(e) {e.appendChild(ce('br'))};
var gameUrl = URL.createObjectURL(new Blob([e.target.files[0]]))
var extension = e.target.files[0].name.split('.').pop()
var gameName = e.target.files[0].name.replaceAll("'", "\\'")
var gameName = gameName.substr(0, gameName.length - extension.length - 1)
e.target.remove();
document.getElementById('uploadf').style.display = "none"; document.getElementById('uploadf1').style.display = "none";
if (['fds', 'nes', 'unif', 'unf'].includes(extension)) {
var core = 'nes';
} else if (['z64'].includes(extension)) {
var core = 'n64';
} else if (['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'].includes(extension)) {
var core = 'snes';
} else if (['nds'].includes(extension)) {
var core = 'nds';
} else if (['gba'].includes(extension)) {
var core = 'gba';
} else if (['gb'].includes(extension)) {
var core = 'gb';
} else if (['gen'].includes(extension)) {
var core = 'segaGG';
} else if (['sms'].includes(extension)) {
var core = 'segaMS';
} else {
var core = await function() {
return new Promise(function(resolve, reject) {
var cores = {"NES / Nintendo Entertainment System / Famicon": "nes",
"SNES / Super Nintendo Entertainment System": "snes",
"Nintendo 64": "n64",
"Nintendo Game Boy": "gb",
"Nintendo Game Boy Advance": "gba",
"Nintendo DS": "nds",
"PlayStation": "psx",
"Virtual Boy": "vb",
"Sega Mega Drive": "segaMD",
"Sega Master System": "segaMS",
"Sega CD": "segaCD",
"Atari Lynx": "lynx",
"Sega 32X": "sega32x",
"Atari Jaguar": "jaguar",
"Sega Game Gear": "segaGG",
"Sega Saturn": "segaSaturn",
"Atari 7800": "atari7800",
"Atari 2600": "atari2600"};
var a = ce('div');
a.style = 'padding: 50px;';
var p = ce('h2');
p.innerHTML = 'Unable to auto-detect system. Please select the desired system.';
a.appendChild(p);
br(a);
for (var k in cores) {
var input = ce('input');
input.type = 'radio';
input.id = 'game-' + cores[k];
input.name = 'game';
input.value = cores[k];
a.appendChild(input);
var label = ce('label');
label.for = 'game-' + cores[k];
label.innerHTML = k;
a.appendChild(label);
br(a);
};
br(a);
var submit = ce('input');
submit.type = 'submit';
submit.value = 'Load Game';
submit.onclick = function(e) {
var q = false;
var radios = document.getElementsByName('game');
for (var i=0; i<radios.length; i++) {
if (radios[i].checked) {
var q = radios[i].value;
break;
};
};
if (! q) {
return;
};
a.remove();
resolve(q);
};
a.appendChild(submit);
document.body.appendChild(a);
});
}();
};
var a = document.createElement('div');
a.style = "width:65%;height:100%;max-width:100%";
var b = document.createElement('div');
b.id = 'game';
a.appendChild(b);
document.getElementById("cont").appendChild(a);
var script = document.createElement('script');
script.innerHTML = "EJS_player = '#game'; EJS_gameName = '" + gameName + "'; EJS_biosUrl = ''; EJS_gameUrl = '" + gameUrl + "'; EJS_core = '" + core + "'; EJS_pathtodata = 'data/';";
document.body.appendChild(script);
var script = document.createElement('script');
script.src = 'data/loader.js';
document.body.appendChild(script);
}
})
</script>
<center id="cont">
<img id="uploadf1" class="eimg" src="docs/Emulatorjs Logo.png">
</center>
<div id="uploadf" class="form">
<input type="file" id="file">
<b><p>Select Game Rom: Drag your files here or click in this area.</p></b>
</div>
</body>
</html>